6.12.36-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainercover 6.12.36-rc1 review
This is the start of the stable review cycle for the 6.12.36 release. There are 218 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 Sat, 05 Jul 2025 14:39:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.36-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.12.36-rc1
Kevin Hao <[email protected]>
spi: fsl-qspi: Fix double cleanup in probe error path
Sasha Levin <[email protected]>
btrfs: fix use-after-free on inode when scanning root during em shrinking
Naohiro Aota <[email protected]>
btrfs: zoned: fix extent range end unlock in cow_file_range()
Han Xu <[email protected]>
spi: fsl-qspi: use devm function instead of driver remove
Miquel Raynal <[email protected]>
spi: fsl-qspi: Support per spi-mem operation frequency switches
Miquel Raynal <[email protected]>
spi: spi-mem: Add a new controller capability
Miquel Raynal <[email protected]>
spi: spi-mem: Extend spi-mem operations with a per-operation maximum frequency
Qingfang Deng <[email protected]>
net: stmmac: Fix accessing freed irq affinity_hint
Jay Cornwall <[email protected]>
drm/amdkfd: Fix instruction hazard in gfx12 trap handler
Jonathan Kim <[email protected]>
drm/amdkfd: remove gfx 12 trap handler page size cap
Andres Traumann <[email protected]>
ALSA: hda/realtek: Bass speaker fixup for ASUS UM5606KA
Dragan Simic <[email protected]>
arm64: dts: rockchip: Add avdd HDMI supplies to RockPro64 board dtsi
Bibo Mao <[email protected]>
LoongArch: Set hugetlb mmap base address aligned with pmd size
Sasha Levin <[email protected]>
riscv/atomic: Do proper sign extension also for unsigned in arch_cmpxchg
Filipe Manana <[email protected]>
btrfs: do regular iput instead of delayed iput during extent map shrinking
Filipe Manana <[email protected]>
btrfs: make the extent map shrinker run asynchronously as a work queue job
Filipe Manana <[email protected]>
btrfs: skip inodes without loaded extent maps when shrinking extent maps
Thomas Zimmermann <[email protected]>
drm/fbdev-dma: Add shadow buffering for deferred I/O
Sasha Levin <[email protected]>
drm/msm/dp: account for widebus and yuv420 during mode validation
Sasha Levin <[email protected]>
usb: typec: tcpm: PSSourceOffTimer timeout in PR_Swap enters ERROR_RECOVERY
Sasha Levin <[email protected]>
drm/xe: Carve out wopcm portion from the stolen memory
Angelo Dureghello <[email protected]>
iio: dac: ad3552r-common: fix ad3541/2r ranges
Angelo Dureghello <[email protected]>
iio: dac: ad3552r: extract common code (no changes in behavior intended)
Angelo Dureghello <[email protected]>
iio: dac: ad3552r: changes to use FIELD_PREP
Qu Wenruo <[email protected]>
btrfs: do proper folio cleanup when cow_file_range() failed
Heiner Kallweit <[email protected]>
net: phy: realtek: add RTL8125D-internal PHY
Heiner Kallweit <[email protected]>
net: phy: realtek: merge the drivers for internal NBase-T PHY's
Heiner Kallweit <[email protected]>
r8169: add support for RTL8125D
Lorenzo Stoakes <[email protected]>
mm/vma: reset VMA iterator on commit_merge() OOM failure
Jens Axboe <[email protected]>
io_uring/kbuf: flag partial buffer mappings
Jens Axboe <[email protected]>
io_uring/net: mark iov as dynamically allocated even for single segments
Jens Axboe <[email protected]>
io_uring/net: always use current transfer count for buffer put
Jens Axboe <[email protected]>
io_uring/net: only consider msg_inq if larger than 1
Jens Axboe <[email protected]>
io_uring/net: only retry recv bundle for a full transfer
Jens Axboe <[email protected]>
io_uring/net: improve recv bundles
Pavel Begunkov <[email protected]>
io_uring/rsrc: don't rely on user vaddr alignment
Pavel Begunkov <[email protected]>
io_uring/rsrc: fix folio unpinning
Penglei Jiang <[email protected]>
io_uring: fix potential page leak in io_sqe_buffer_register()
Jiawen Wu <[email protected]>
net: libwx: fix Tx L4 checksum
Chang S. Bae <[email protected]>
x86/pkeys: Simplify PKRU update in signal frame
Chang S. Bae <[email protected]>
x86/fpu: Refactor xfeature bitmask update code for sigframe XSAVE
Ricardo Ribalda <[email protected]>
media: uvcvideo: Rollback non processed entities on error
Alex Hung <[email protected]>
drm/amd/display: Fix mpv playback corruption on weston
Alex Deucher <[email protected]>
drm/amdgpu: switch job hw_fence to amdgpu_fence
Jesse Zhang <[email protected]>
drm/amdgpu: Fix SDMA UTC_L1 handling during start/stop sequences
Ville Syrjälä <[email protected]>
drm/i915/dsi: Fix off by one in BXT_MIPI_TRANS_VTOTAL
Daniele Ceraolo Spurio <[email protected]>
drm/xe: Fix early wedge on GuC load failure
Lucas De Marchi <[email protected]>
drm/xe: Fix taking invalid lock on wedge
Lucas De Marchi <[email protected]>
drm/xe: Fix memset on iomem
Alex Hung <[email protected]>
drm/amd/display: Check dce_hwseq before dereferencing it
Frank Min <[email protected]>
drm/amdgpu: Add kicker device detection
Yihan Zhu <[email protected]>
drm/amd/display: Fix RMCM programming seq errors
Matthew Auld <[email protected]>
drm/xe/guc_submit: add back fix
Matthew Auld <[email protected]>
drm/xe/sched: stop re-submitting signalled jobs
Matthew Auld <[email protected]>
drm/xe/vm: move rebind_work init earlier
Zhongwei Zhang <[email protected]>
drm/amd/display: Correct non-OLED pre_T11_delay.
John Olender <[email protected]>
drm/amdgpu: amdgpu_vram_mgr_new(): Clamp lpfn to total vram
Wentao Liang <[email protected]>
drm/amd/display: Add null pointer check for get_first_active_display()
Aradhya Bhatia <[email protected]>
drm/bridge: cdns-dsi: Wait for Clk and Data Lanes to be ready
Aradhya Bhatia <[email protected]>
drm/bridge: cdns-dsi: Check return value when getting default PHY config
Aradhya Bhatia <[email protected]>
drm/bridge: cdns-dsi: Fix connecting to next bridge
Aradhya Bhatia <[email protected]>
drm/bridge: cdns-dsi: Fix phy de-init and flag it so
Aradhya Bhatia <[email protected]>
drm/bridge: cdns-dsi: Fix the clock variable for mode_valid()
Jay Cornwall <[email protected]>
drm/amdkfd: Fix race in GWS queue scheduling
Stephan Gerhold <[email protected]>
drm/msm/gpu: Fix crash when throttling GPU immediately during boot
Thomas Zimmermann <[email protected]>
drm/udl: Unregister device before cleaning up on disconnect
Qiu-ji Chen <[email protected]>
drm/tegra: Fix a possible null pointer dereference
Thierry Reding <[email protected]>
drm/tegra: Assign plane type before registration
Maíra Canal <[email protected]>
drm/etnaviv: Protect the scheduler's pending list with its lock
Thomas Zimmermann <[email protected]>
drm/cirrus-qemu: Fix pitch programming
Thomas Zimmermann <[email protected]>
drm/ast: Fix comment on modeset lock
anvithdosapati <[email protected]>
scsi: ufs: core: Fix clk scaling to be conditional in reset and restore
Chen Yu <[email protected]>
scsi: megaraid_sas: Fix invalid node index
Qasim Ijaz <[email protected]>
HID: wacom: fix kobject reference count leak
Qasim Ijaz <[email protected]>
HID: wacom: fix memory leak on sysfs attribute creation failure
Qasim Ijaz <[email protected]>
HID: wacom: fix memory leak on kobject creation failure
Iusico Maxim <[email protected]>
HID: lenovo: Restrict F7/9/11 mode to compact keyboards only
Chao Yu <[email protected]>
f2fs: fix to zero post-eof page
David Hildenbrand <[email protected]>
mm/gup: revert "mm: gup: fix infinite loop within __get_longterm_locked"
Liam R. Howlett <[email protected]>
maple_tree: fix MA_STATE_PREALLOC flag in mas_preallocate()
Jiawen Wu <[email protected]>
net: libwx: fix the creation of page_pool
Khairul Anuar Romli <[email protected]>
spi: spi-cadence-quadspi: Fix pm runtime unbalance
Mark Harmstone <[email protected]>
btrfs: update superblock's device bytes_used when dropping chunk
Filipe Manana <[email protected]>
btrfs: fix a race between renames and directory logging
Heinz Mauelshagen <[email protected]>
dm-raid: fix variable in journal device check
Frédéric Danis <[email protected]>
Bluetooth: L2CAP: Fix L2CAP MTU negotiation
Fabio Estevam <[email protected]>
serial: imx: Restore original RXTL for console to fix data loss
Aidan Stewart <[email protected]>
serial: core: restore of_node information in sysfs
Yao Zi <[email protected]>
dt-bindings: serial: 8250: Make clocks and clock-frequency exclusive
Nathan Chancellor <[email protected]>
staging: rtl8723bs: Avoid memset() in aes_cipher() and aes_decipher()
Xin Li (Intel) <[email protected]>
x86/traps: Initialize DR6 by writing its architectural reset value
Avadhut Naik <[email protected]>
EDAC/amd64: Fix size calculation for Non-Power-of-Two DIMMs
David Howells <[email protected]>
cifs: Fix reading into an ITER_FOLIOQ from the smbdirect code
David Howells <[email protected]>
cifs: Fix the smbd_response slab to allow usercopy
Stefan Metzmacher <[email protected]>
smb: client: make use of common smbdirect_socket_parameters
Stefan Metzmacher <[email protected]>
smb: smbdirect: introduce smbdirect_socket_parameters
Stefan Metzmacher <[email protected]>
smb: client: make use of common smbdirect_socket
Stefan Metzmacher <[email protected]>
smb: smbdirect: add smbdirect_socket.h
Stefan Metzmacher <[email protected]>
smb: smbdirect: add smbdirect.h with public structures
Stefan Metzmacher <[email protected]>
smb: client: make use of common smbdirect_pdu.h
Stefan Metzmacher <[email protected]>
smb: smbdirect: add smbdirect_pdu.h with protocol definitions
Paulo Alcantara <[email protected]>
smb: client: fix potential deadlock when reconnecting channels
Michal Wajdeczko <[email protected]>
drm/xe: Process deferred GGTT node removals on device unwind
Jayesh Choudhary <[email protected]>
drm/bridge: ti-sn65dsi86: Add HPD for DisplayPort connector type
Wolfram Sang <[email protected]>
drm/bridge: ti-sn65dsi86: make use of debugfs_init callback
Arnd Bergmann <[email protected]>
drm/i915: fix build error some more
Mario Limonciello <[email protected]>
drm/amd: Adjust output for discovery error handling
Alex Deucher <[email protected]>
drm/amdgpu/discovery: optionally use fw based ip discovery
Jakub Kicinski <[email protected]>
net: selftests: fix TCP packet checksum
Salvatore Bonaccorso <[email protected]>
ALSA: hda/realtek: Fix built-in mic on ASUS VivoBook X507UAR
Kuniyuki Iwashima <[email protected]>
atm: Release atm_dev_mutex after removing procfs in atm_dev_deregister().
Jakub Kicinski <[email protected]>
netlink: specs: tc: replace underscores with dashes in names
Simon Horman <[email protected]>
net: enetc: Correct endianness handling in _enetc_rd_reg64
Adin Scannell <[email protected]>
libbpf: Fix possible use-after-free for externs
Tiwei Bie <[email protected]>
um: ubd: Add missing error check in start_io_thread()
Yan Zhai <[email protected]>
bnxt: properly flush XDP redirect lists
Stefano Garzarella <[email protected]>
vsock/uapi: fix linux/vm_sockets.h userspace compilation errors
Johannes Berg <[email protected]>
wifi: mac80211: finish link init before RCU publish
Muna Sinada <[email protected]>
wifi: mac80211: Create separate links for VLAN interfaces
Muna Sinada <[email protected]>
wifi: mac80211: Add link iteration macro for link data
Kuniyuki Iwashima <[email protected]>
af_unix: Don't set -ECONNRESET for consumed OOB skb.
Lachlan Hodges <[email protected]>
wifi: mac80211: fix beacon interval calculation overflow
Thomas Fourier <[email protected]>
ethernet: ionic: Fix DMA mapping tests
Yuan Chen <[email protected]>
libbpf: Fix null pointer dereference in btf_dump__free on allocation failure
Al Viro <[email protected]>
attach_recursive_mnt(): do not lock the covering tree when sliding something under it
Youngjun Lee <[email protected]>
ALSA: usb-audio: Fix out-of-bounds read in snd_usb_get_audioformat_uac3()
Kuniyuki Iwashima <[email protected]>
Bluetooth: hci_core: Fix use-after-free in vhci_flush()
Eric Dumazet <[email protected]>
atm: clip: prevent NULL deref in clip_push()
Thomas Zeitlhofer <[email protected]>
HID: wacom: fix crash in wacom_aes_battery_handler()
Haoxiang Li <[email protected]>
drm/xe/display: Add check for alloc_ordered_workqueue()
Imre Deak <[email protected]>
drm/dp: Change AUX DPCD probe address from DPCD_REV to LANE0_1_STATUS
Nam Cao <[email protected]>
Revert "riscv: misaligned: fix sleeping function called during misaligned access handling"
Nam Cao <[email protected]>
Revert "riscv: Define TASK_SIZE_MAX for __access_ok()"
Yu Kuai <[email protected]>
lib/group_cpus: fix NULL pointer dereference from group_cpus_evenly()
David Hildenbrand <[email protected]>
fs/proc/task_mmu: fix PAGE_IS_PFNZERO detection for the huge zero folio
Fedor Pchelkin <[email protected]>
s390/pkey: Prevent overflow in size calculation for memdup_user()
Oliver Schramm <[email protected]>
ASoC: amd: yc: Add DMI quirk for Lenovo IdeaPad Slim 5 15
SeongJae Park <[email protected]>
mm/damon/sysfs-schemes: free old damon_sysfs_scheme_filter->memcg_path on write
Stefan Metzmacher <[email protected]>
smb: client: remove \t from TP_printk statements
Niklas Cassel <[email protected]>
ata: ahci: Use correct DMI identifier for ASUSPRO-D840SA LPM quirk
Wolfram Sang <[email protected]>
i2c: robotfuzz-osif: disable zero-length read messages
Wolfram Sang <[email protected]>
i2c: tiny-usb: disable zero-length read messages
Kuniyuki Iwashima <[email protected]>
af_unix: Don't leave consecutive consumed OOB skbs.
Karol Wachowski <[email protected]>
accel/ivpu: Trigger device recovery on engine reset/resume failure
Karol Wachowski <[email protected]>
accel/ivpu: Add debugfs interface for setting HWS priority bands
Karol Wachowski <[email protected]>
accel/ivpu: Separate DB ID and CMDQ ID allocations from CMDQ allocation
Karol Wachowski <[email protected]>
accel/ivpu: Make command queue ID allocated on XArray
Andrzej Kacprowski <[email protected]>
accel/ivpu: Remove copy engine support
Karol Wachowski <[email protected]>
accel/ivpu: Do not fail on cmdq if failed to allocate preemption buffers
Janne Grunau <[email protected]>
PCI: apple: Set only available ports up
Zhang Zekun <[email protected]>
PCI: apple: Use helper function for_each_child_of_node_scoped()
Chao Yu <[email protected]>
f2fs: don't over-report free space or inodes in statvfs
Krzysztof Kozlowski <[email protected]>
ASoC: codecs: wcd9335: Fix missing free of regulator supplies
Peng Fan <[email protected]>
ASoC: codec: wcd9335: Convert to GPIO descriptors
Vasiliy Kovalev <[email protected]>
jfs: validate AG parameters in dbMount() to prevent crashes
Dave Kleikamp <[email protected]>
fs/jfs: consolidate sanity checking in dbMount
Filipe Manana <[email protected]>
btrfs: fix qgroup reservation leak on failure to allocate ordered extent
David Sterba <[email protected]>
btrfs: use unsigned types for constants defined as bit shifts
Qu Wenruo <[email protected]>
btrfs: factor out nocow ordered extent and extent map generation into a helper
Joonas Lahtinen <[email protected]>
Revert "drm/i915/gem: Allow EXEC_CAPTURE on recoverable contexts on DG1"
Ville Syrjälä <[email protected]>
drm/i915/gem: Allow EXEC_CAPTURE on recoverable contexts on DG1
Qu Wenruo <[email protected]>
btrfs: handle csum tree error with rescue=ibadroots correctly
Kees Cook <[email protected]>
ovl: Check for NULL d_inode() in ovl_dentry_upper()
Ziqi Chen <[email protected]>
scsi: ufs: core: Don't perform UFS clkscaling during host async scan
Dmitry Kandybka <[email protected]>
ceph: fix possible integer overflow in ceph_zero_objects()
Shuming Fan <[email protected]>
ASoC: rt1320: fix speaker noise when volume bar is 100%
Mario Limonciello <[email protected]>
ALSA: usb-audio: Add a quirk for Lenovo Thinkpad Thunderbolt 3 dock
Vijendar Mukunda <[email protected]>
ALSA: hda: Add new pci id for AMD GPU display HD audio controller
Cezary Rojewski <[email protected]>
ALSA: hda: Ignore unsol events for cards being shut down
Andy Chiu <[email protected]>
riscv: add a data fence for CMODX in the kernel mode
Michael Grzeschik <[email protected]>
usb: typec: mux: do not return on EOPNOTSUPP in {mux, switch}_set
Jos Wang <[email protected]>
usb: typec: displayport: Receive DP Status Update NAK request exit dp altmode
Peter Korsgaard <[email protected]>
usb: gadget: f_hid: wake up readers on disable/unbind
Robert Hodaszi <[email protected]>
usb: cdc-wdm: avoid setting WDM_READ for ZLP-s
Andy Shevchenko <[email protected]>
usb: Add checks for snprintf() calls in usb_alloc_dev()
Chance Yang <[email protected]>
usb: common: usb-conn-gpio: use a unique name for usb connector device
Jakub Lewalski <[email protected]>
tty: serial: uartlite: register uart driver in init
Chen Yufeng <[email protected]>
usb: potential integer overflow in usbg_make_tpg()
Chenyuan Yang <[email protected]>
misc: tps6594-pfsm: Add NULL pointer check in tps6594_pfsm_probe()
Purva Yeshi <[email protected]>
iio: adc: ad_sigma_delta: Fix use of uninitialized status_pos
Michael Grzeschik <[email protected]>
usb: dwc2: also exit clock_gating when stopping udc while suspended
James Clark <[email protected]>
coresight: Only check bottom two claim bits
Rengarajan S <[email protected]>
8250: microchip: pci1xxxx: Add PCIe Hot reset disable support for Rev C0 and later devices
Benjamin Berg <[email protected]>
um: use proper care when taking mmap lock during segfault
Sami Tolvanen <[email protected]>
um: Add cmpxchg8b_emu and checksum functions to asm-prototypes.h
Jonathan Cameron <[email protected]>
iio: pressure: zpa2326: Use aligned_s64 for the timestamp
Lin.Cao <[email protected]>
drm/scheduler: signal scheduled fence when kill job
Philip Yang <[email protected]>
drm/amdgpu: seq64 memory unmap uses uninterruptible lock
Linggang Zeng <[email protected]>
bcache: fix NULL pointer in cache_set_flush()
Yifan Zhang <[email protected]>
amd/amdkfd: fix a kfd_process ref leak
Yu Kuai <[email protected]>
md/md-bitmap: fix dm-raid max_write_behind setting
Hannes Reinecke <[email protected]>
nvme-tcp: sanitize request list handling
Hannes Reinecke <[email protected]>
nvme-tcp: fix I/O stalls on congested sockets
Richard Zhu <[email protected]>
PCI: imx6: Add workaround for errata ERR051624
Hector Martin <[email protected]>
PCI: apple: Fix missing OF node reference in apple_pcie_setup_port
Wenbin Yao <[email protected]>
PCI: dwc: Make link training more robust by setting PORT_LOGIC_LINK_WIDTH to one lane
Thomas Gessler <[email protected]>
dmaengine: xilinx_dma: Set dma_device directions
Yi Sun <[email protected]>
dmaengine: idxd: Check availability of workqueue allocated by idxd wq driver before using
Lukas Wunner <[email protected]>
Revert "iommu/amd: Prevent binding other PCI drivers to IOMMU PCI devices"
Rudraksha Gupta <[email protected]>
rust: arm: fix unknown (to Clang) argument '-mno-fdpic'
FUJITA Tomonori <[email protected]>
rust: module: place cleanup_module() in .exit.text section
Namjae Jeon <[email protected]>
ksmbd: provide zero as a unique ID to the Mac client
Namjae Jeon <[email protected]>
ksmbd: allow a filename to contain special characters on SMB3.1.1 posix extension
Alexis Czezar Torreno <[email protected]>
hwmon: (pmbus/max34440) Fix support for max34451
Scott Mayhew <[email protected]>
NFSv4: xattr handlers should check for absent nfs filehandles
Robert Richter <[email protected]>
cxl/region: Add a dev_err() on missing target list entries
Guang Yuan Wu <[email protected]>
fuse: fix race between concurrent setattrs from multiple nodes
Sven Schwermer <[email protected]>
leds: multicolor: Fix intensity setting while SW blinking
Matthew Sakai <[email protected]>
dm vdo indexer: don't read request structure after enqueuing
Nikhil Jha <[email protected]>
sunrpc: don't immediately retransmit on seqno miss
Krzysztof Kozlowski <[email protected]>
mfd: max14577: Fix wakeup source leaks on device unbind
Peng Fan <[email protected]>
mailbox: Not protect module_put with spin_lock_irqsave
Sagi Grimberg <[email protected]>
NFSv4.2: fix setattr caching of TIME_[MODIFY|ACCESS]_SET when timestamps are delegated
Olga Kornievskaia <[email protected]>
NFSv4.2: fix listxattr to return selinux security label
Han Young <[email protected]>
NFSv4: Always set NLINK even if the server doesn't support it
Pali Rohár <[email protected]>
cifs: Fix encoding of SMB1 Session Setup NTLMSSP Request in non-UNICODE mode
Pali Rohár <[email protected]>
cifs: Fix cifs_query_path_info() for Windows NT servers
Pali Rohár <[email protected]>
cifs: Correctly set SMB1 SessionKey field in Session Setup Request
-------------
Diffstat:
Documentation/devicetree/bindings/serial/8250.yaml | 2 +- Documentation/netlink/specs/tc.yaml | 4 +- Makefile | 4 +- arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 12 + arch/loongarch/mm/mmap.c | 6 +- arch/riscv/include/asm/cmpxchg.h | 2 +- arch/riscv/include/asm/pgtable.h | 1 - arch/riscv/kernel/traps_misaligned.c | 4 +- arch/riscv/mm/cacheflush.c | 15 +- arch/um/drivers/ubd_user.c | 2 +- arch/um/include/asm/asm-prototypes.h | 5 + arch/um/kernel/trap.c | 129 +++- arch/x86/include/uapi/asm/debugreg.h | 21 +- arch/x86/kernel/cpu/common.c | 24 +- arch/x86/kernel/fpu/signal.c | 11 +- arch/x86/kernel/fpu/xstate.h | 22 +- arch/x86/kernel/traps.c | 34 +- arch/x86/um/asm/checksum.h | 3 + drivers/accel/ivpu/ivpu_debugfs.c | 84 +++ drivers/accel/ivpu/ivpu_drv.c | 6 + drivers/accel/ivpu/ivpu_drv.h | 10 +- drivers/accel/ivpu/ivpu_hw.c | 21 + drivers/accel/ivpu/ivpu_hw.h | 5 + drivers/accel/ivpu/ivpu_job.c | 203 +++--- drivers/accel/ivpu/ivpu_job.h | 2 + drivers/accel/ivpu/ivpu_jsm_msg.c | 46 +- drivers/ata/ahci.c | 2 +- drivers/cxl/core/region.c | 7 + drivers/dma/idxd/cdev.c | 4 +- drivers/dma/xilinx/xilinx_dma.c | 2 + drivers/edac/amd64_edac.c | 57 +- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 64 +- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 30 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 12 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 16 + drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 17 + drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 6 + drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 6 +- drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h | 703 +++++++++++---------- .../gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm | 82 +-- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 +- drivers/gpu/drm/amd/amdkfd/kfd_events.c | 1 + drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c | 2 +- .../dc/dml2/dml21/dml21_translation_helper.c | 1 + .../dml21/src/dml2_core/dml2_core_dcn4_calcs.c | 5 +- .../amd/display/dc/dml2/dml2_translation_helper.c | 1 + .../drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 9 +- .../gpu/drm/amd/display/modules/hdcp/hdcp_psp.c | 3 + drivers/gpu/drm/ast/ast_mode.c | 6 +- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 32 +- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 109 ++-- drivers/gpu/drm/display/drm_dp_helper.c | 2 +- drivers/gpu/drm/drm_fbdev_dma.c | 219 +++++-- drivers/gpu/drm/etnaviv/etnaviv_sched.c | 5 +- drivers/gpu/drm/i915/display/vlv_dsi.c | 4 +- drivers/gpu/drm/i915/i915_pmu.c | 2 +- drivers/gpu/drm/msm/dp/dp_display.c | 11 +- drivers/gpu/drm/msm/dp/dp_drm.c | 5 +- drivers/gpu/drm/msm/msm_gpu_devfreq.c | 1 + drivers/gpu/drm/scheduler/sched_entity.c | 1 + drivers/gpu/drm/tegra/dc.c | 17 +- drivers/gpu/drm/tegra/hub.c | 4 +- drivers/gpu/drm/tegra/hub.h | 3 +- drivers/gpu/drm/tiny/cirrus.c | 1 - drivers/gpu/drm/udl/udl_drv.c | 2 +- drivers/gpu/drm/xe/display/xe_display.c | 2 + drivers/gpu/drm/xe/xe_ggtt.c | 11 + drivers/gpu/drm/xe/xe_gpu_scheduler.h | 10 +- drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 8 + drivers/gpu/drm/xe/xe_guc_ct.c | 7 +- drivers/gpu/drm/xe/xe_guc_ct.h | 5 + drivers/gpu/drm/xe/xe_guc_pc.c | 2 +- drivers/gpu/drm/xe/xe_guc_submit.c | 23 + drivers/gpu/drm/xe/xe_guc_types.h | 5 + drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c | 70 +- drivers/gpu/drm/xe/xe_vm.c | 8 +- drivers/hid/hid-lenovo.c | 11 +- drivers/hid/wacom_sys.c | 7 +- drivers/hwmon/pmbus/max34440.c | 48 +- drivers/hwtracing/coresight/coresight-core.c | 3 +- drivers/hwtracing/coresight/coresight-priv.h | 1 + drivers/i2c/busses/i2c-robotfuzz-osif.c | 6 + drivers/i2c/busses/i2c-tiny-usb.c | 6 + drivers/iio/adc/ad_sigma_delta.c | 4 + drivers/iio/dac/Makefile | 2 +- drivers/iio/dac/ad3552r-common.c | 248 ++++++++ drivers/iio/dac/ad3552r.c | 553 +++------------- drivers/iio/dac/ad3552r.h | 223 +++++++ drivers/iio/pressure/zpa2326.c | 2 +- drivers/iommu/amd/init.c | 3 - drivers/leds/led-class-multicolor.c | 3 +- drivers/mailbox/mailbox.c | 2 +- drivers/md/bcache/super.c | 7 +- drivers/md/dm-raid.c | 2 +- drivers/md/dm-vdo/indexer/volume.c | 24 +- drivers/md/md-bitmap.c | 2 +- drivers/media/usb/uvc/uvc_ctrl.c | 34 +- drivers/mfd/max14577.c | 1 + drivers/misc/tps6594-pfsm.c | 3 + drivers/mtd/nand/spi/core.c | 2 + drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 +- drivers/net/ethernet/freescale/enetc/enetc_hw.h | 2 +- drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 12 +- drivers/net/ethernet/realtek/r8169.h | 1 + drivers/net/ethernet/realtek/r8169_main.c | 23 +- drivers/net/ethernet/realtek/r8169_phy_config.c | 10 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +- drivers/net/ethernet/wangxun/libwx/wx_lib.c | 6 +- drivers/net/phy/realtek.c | 54 +- drivers/nvme/host/tcp.c | 22 +- drivers/pci/controller/dwc/pci-imx6.c | 15 + drivers/pci/controller/dwc/pcie-designware.c | 5 +- drivers/pci/controller/pcie-apple.c | 7 +- drivers/s390/crypto/pkey_api.c | 2 +- drivers/scsi/megaraid/megaraid_sas_base.c | 6 +- drivers/spi/spi-cadence-quadspi.c | 12 +- drivers/spi/spi-fsl-qspi.c | 48 +- drivers/spi/spi-mem.c | 34 + drivers/staging/rtl8723bs/core/rtw_security.c | 44 +- drivers/tty/serial/8250/8250_pci1xxxx.c | 10 + drivers/tty/serial/imx.c | 17 +- drivers/tty/serial/serial_base_bus.c | 1 + drivers/tty/serial/uartlite.c | 25 +- drivers/ufs/core/ufshcd.c | 6 +- drivers/usb/class/cdc-wdm.c | 23 +- drivers/usb/common/usb-conn-gpio.c | 25 +- drivers/usb/core/usb.c | 14 +- drivers/usb/dwc2/gadget.c | 6 + drivers/usb/gadget/function/f_hid.c | 19 +- drivers/usb/gadget/function/f_tcm.c | 4 +- drivers/usb/typec/altmodes/displayport.c | 4 + drivers/usb/typec/mux.c | 4 +- drivers/usb/typec/tcpm/tcpm.c | 3 +- fs/btrfs/backref.h | 4 +- fs/btrfs/direct-io.c | 4 +- fs/btrfs/disk-io.c | 5 +- fs/btrfs/extent_io.h | 2 +- fs/btrfs/extent_map.c | 132 +++- fs/btrfs/extent_map.h | 3 +- fs/btrfs/fs.h | 2 + fs/btrfs/inode.c | 299 +++++---- fs/btrfs/ordered-data.c | 14 +- fs/btrfs/raid56.c | 5 +- fs/btrfs/super.c | 13 +- fs/btrfs/tests/extent-io-tests.c | 6 +- fs/btrfs/volumes.c | 6 + fs/btrfs/zstd.c | 2 +- fs/ceph/file.c | 2 +- fs/f2fs/file.c | 38 ++ fs/f2fs/super.c | 30 +- fs/fuse/dir.c | 11 + fs/jfs/jfs_dmap.c | 41 +- fs/namespace.c | 8 +- fs/nfs/inode.c | 51 +- fs/nfs/nfs4proc.c | 25 +- fs/overlayfs/util.c | 4 +- fs/proc/task_mmu.c | 2 +- fs/smb/client/cifs_debug.c | 23 +- fs/smb/client/cifsglob.h | 2 + fs/smb/client/cifspdu.h | 6 +- fs/smb/client/cifssmb.c | 1 + fs/smb/client/connect.c | 58 +- fs/smb/client/misc.c | 8 + fs/smb/client/sess.c | 21 +- fs/smb/client/smb2ops.c | 14 +- fs/smb/client/smbdirect.c | 513 +++++++-------- fs/smb/client/smbdirect.h | 62 +- fs/smb/client/trace.h | 24 +- fs/smb/common/smbdirect/smbdirect.h | 37 ++ fs/smb/common/smbdirect/smbdirect_pdu.h | 55 ++ fs/smb/common/smbdirect/smbdirect_socket.h | 43 ++ fs/smb/server/connection.h | 1 + fs/smb/server/smb2pdu.c | 72 ++- fs/smb/server/smb2pdu.h | 3 + include/linux/spi/spi-mem.h | 14 +- include/net/bluetooth/hci_core.h | 2 + include/uapi/drm/ivpu_accel.h | 6 +- include/uapi/linux/vm_sockets.h | 4 + io_uring/kbuf.c | 1 + io_uring/kbuf.h | 1 + io_uring/net.c | 46 +- io_uring/rsrc.c | 23 +- io_uring/rsrc.h | 1 + lib/group_cpus.c | 9 +- lib/maple_tree.c | 4 +- mm/damon/sysfs-schemes.c | 1 + mm/gup.c | 14 +- mm/vma.c | 27 +- net/atm/clip.c | 11 +- net/atm/resources.c | 3 +- net/bluetooth/hci_core.c | 34 +- net/bluetooth/l2cap_core.c | 9 +- net/core/selftests.c | 5 +- net/mac80211/chan.c | 3 + net/mac80211/ieee80211_i.h | 12 + net/mac80211/iface.c | 12 +- net/mac80211/link.c | 94 ++- net/mac80211/util.c | 2 +- net/sunrpc/clnt.c | 9 +- net/unix/af_unix.c | 31 +- rust/Makefile | 2 +- rust/macros/module.rs | 1 + sound/pci/hda/hda_bind.c | 2 +- sound/pci/hda/hda_intel.c | 3 + sound/pci/hda/patch_realtek.c | 2 + sound/soc/amd/yc/acp6x-mach.c | 7 + sound/soc/codecs/rt1320-sdw.c | 17 +- sound/soc/codecs/wcd9335.c | 40 +- sound/usb/quirks.c | 2 + sound/usb/stream.c | 2 + tools/lib/bpf/btf_dump.c | 3 + tools/lib/bpf/libbpf.c | 10 +- .../selftests/bpf/progs/test_global_map_resize.c | 16 + 218 files changed, 3862 insertions(+), 2248 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/218 cifs: Correctly set SMB1 SessionKey field in Session Setup Request
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pali Rohár <[email protected]>
[ Upstream commit 89381c72d52094988e11d23ef24a00066a0fa458 ]
[MS-CIFS] specification in section 2.2.4.53.1 where is described SMB_COM_SESSION_SETUP_ANDX Request, for SessionKey field says:
The client MUST set this field to be equal to the SessionKey field in the SMB_COM_NEGOTIATE Response for this SMB connection.
Linux SMB client currently set this field to zero. This is working fine against Windows NT SMB servers thanks to [MS-CIFS] product behavior <94>:
Windows NT Server ignores the client's SessionKey.
For compatibility with [MS-CIFS], set this SessionKey field in Session Setup Request to value retrieved from Negotiate response.
--- fs/smb/client/cifsglob.h | 1 + fs/smb/client/cifspdu.h | 6 +++--- fs/smb/client/cifssmb.c | 1 + fs/smb/client/sess.c | 1 + 4 files changed, 6 insertions(+), 3 deletions(-)
fs/smb/client/cifsglob.h +1 -0
@@ -739,6 +739,7 @@ struct TCP_Server_Info {char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL ];__u32 sequence_number;/* for signing, protected by srv_mutex */ __u32 reconnect_instance;/* incremented on each reconnect */ +__le32 session_key_id;/* retrieved from negotiate response and send in session setup request */ struct session_key session_key;unsigned long lstrp;/* when we got last response from this server */ struct cifs_secmech secmech;/* crypto sec mech functs, descriptors */
fs/smb/client/cifspdu.h +3 -3
@@ -557,7 +557,7 @@ typedef union smb_com_session_setup_andx {__le16 MaxBufferSize;__le16 MaxMpxCount;__le16 VcNumber; -__u32 SessionKey; +__le32 SessionKey;__le16 SecurityBlobLength;__u32 Reserved;__le32 Capabilities;/* see below */
@@ -576,7 +576,7 @@ typedef union smb_com_session_setup_andx {__le16 MaxBufferSize;__le16 MaxMpxCount;__le16 VcNumber; -__u32 SessionKey; +__le32 SessionKey;__le16 CaseInsensitivePasswordLength;/* ASCII password len */ __le16 CaseSensitivePasswordLength;/* Unicode password length*/ __u32 Reserved;/* see below */
@@ -614,7 +614,7 @@ typedef union smb_com_session_setup_andx {__le16 MaxBufferSize;__le16 MaxMpxCount;__le16 VcNumber; -__u32 SessionKey; +__le32 SessionKey;__le16 PasswordLength;__u32 Reserved;/* encrypt key len and offset */ __le16 ByteCount;
fs/smb/client/cifssmb.c +1 -0
@@ -481,6 +481,7 @@ CIFSSMBNegotiate(const unsigned int xid, server->max_rw =le32_to_cpu (pSMBr->MaxRawSize);cifs_dbg (NOISY ,"Max buf = %d\n" , ses->server->maxBuf); server->capabilities =le32_to_cpu (pSMBr->Capabilities); + server->session_key_id = pSMBr->SessionKey; server->timeAdj = (int )(__s16 )le16_to_cpu (pSMBr->ServerTimeZone); server->timeAdj *=60 ;
fs/smb/client/sess.c +1 -0
@@ -658,6 +658,7 @@ static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, USHRT_MAX)); pSMB->req.MaxMpxCount =cpu_to_le16 (server->maxReq); pSMB->req.VcNumber =cpu_to_le16 (1 ); + pSMB->req.SessionKey = server->session_key_id;/* Now no need to set SMBFLG_CASELESS or obsolete CANONICAL PATH */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 2/218 cifs: Fix cifs_query_path_info() for Windows NT servers
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pali Rohár <[email protected]>
[ Upstream commit a3e771afbb3bce91c8296828304903e7348003fe ]
For TRANS2 QUERY_PATH_INFO request when the path does not exist, the Windows NT SMB server returns error response STATUS_OBJECT_NAME_NOT_FOUND or ERRDOS/ERRbadfile without the SMBFLG_RESPONSE flag set. Similarly it returns STATUS_DELETE_PENDING when the file is being deleted. And looks like that any error response from TRANS2 QUERY_PATH_INFO does not have SMBFLG_RESPONSE flag set.
So relax check in check_smb_hdr() for detecting if the packet is response for this special case.
This change fixes stat() operation against Windows NT SMB servers and also all operations which depends on -ENOENT result from stat like creat() or mkdir().
--- fs/smb/client/misc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/smb/client/misc.c +8 -0
@@ -323,6 +323,14 @@ check_smb_hdr(struct smb_hdr *smb)if (smb->Command ==SMB_COM_LOCKING_ANDX )return 0 ; +/* +* Windows NT server returns error resposne (e.g. STATUS_DELETE_PENDING +* or STATUS_OBJECT_NAME_NOT_FOUND or ERRDOS/ERRbadfile or any other) +* for some TRANS2 requests without the RESPONSE flag set in header. +*/ +if (smb->Command ==SMB_COM_TRANSACTION2 && smb->Status.CifsError !=0 ) +return 0 ; +cifs_dbg (VFS ,"Server sent request, not response. mid=%u\n" ,get_mid (smb));return 1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 3/218 cifs: Fix encoding of SMB1 Session Setup NTLMSSP Request in non-UNICODE mode
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pali Rohár <[email protected]>
[ Upstream commit 6510ef4230b68c960309e0c1d6eb3e32eb785142 ]
SMB1 Session Setup NTLMSSP Request in non-UNICODE mode is similar to UNICODE mode, just strings are encoded in ASCII and not in UTF-16.
With this change it is possible to setup SMB1 session with NTLM authentication in non-UNICODE mode with Windows SMB server.
This change fixes mounting SMB1 servers with -o nounicode mount option together with -o sec=ntlmssp mount option (which is the default sec=).
--- fs/smb/client/sess.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
fs/smb/client/sess.c +10 -10
@@ -1715,22 +1715,22 @@ _sess_auth_rawntlmssp_assemble_req(struct sess_data *sess_data) pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0 ].iov_base; capabilities =cifs_ssetup_hdr (ses, server, pSMB); -if ((pSMB->req.hdr.Flags2 &SMBFLG2_UNICODE ) ==0 ) { -cifs_dbg (VFS ,"NTLMSSP requires Unicode support\n" ); -return -ENOSYS ; - } - pSMB->req.hdr.Flags2 |=SMBFLG2_EXT_SEC ; capabilities |=CAP_EXTENDED_SECURITY ; pSMB->req.Capabilities |=cpu_to_le32 (capabilities); bcc_ptr = sess_data->iov[2 ].iov_base; -/* unicode strings must be word aligned */ -if (!IS_ALIGNED (sess_data->iov[0 ].iov_len + sess_data->iov[1 ].iov_len,2 )) { - *bcc_ptr =0 ; - bcc_ptr++; + +if (pSMB->req.hdr.Flags2 &SMBFLG2_UNICODE ) { +/* unicode strings must be word aligned */ +if (!IS_ALIGNED (sess_data->iov[0 ].iov_len + sess_data->iov[1 ].iov_len,2 )) { + *bcc_ptr =0 ; + bcc_ptr++; + } +unicode_oslm_strings (&bcc_ptr, sess_data->nls_cp); + }else { +ascii_oslm_strings (&bcc_ptr, sess_data->nls_cp); } -unicode_oslm_strings (&bcc_ptr, sess_data->nls_cp); sess_data->iov[2 ].iov_len = (long ) bcc_ptr - (long ) sess_data->iov[2 ].iov_base;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 4/218 NFSv4: Always set NLINK even if the server doesnt support it
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Han Young <[email protected]>
[ Upstream commit 3a3065352f73381d3a1aa0ccab44aec3a5a9b365 ]
fattr4_numlinks is a recommended attribute, so the client should emulate it even if the server doesn't support it. In decode_attr_nlink function in nfs4xdr.c, nlink is initialized to 1. However, this default value isn't set to the inode due to the check in nfs_fhget.
So if the server doesn't support numlinks, inode's nlink will be zero, the mount will fail with error "Stale file handle". Set the nlink to 1 if the server doesn't support it.
--- fs/nfs/inode.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfs/inode.c +2 -0
@@ -557,6 +557,8 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)set_nlink (inode, fattr->nlink); else if (fattr_supported & NFS_ATTR_FATTR_NLINK) nfs_set_cache_invalid(inode, NFS_INO_INVALID_NLINK); + else + set_nlink(inode, 1);if (fattr->valid &NFS_ATTR_FATTR_OWNER ) inode->i_uid = fattr->uid;else if (fattr_supported &NFS_ATTR_FATTR_OWNER )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 5/218 NFSv4.2: fix listxattr to return selinux security label
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
[ Upstream commit 243fea134633ba3d64aceb4c16129c59541ea2c6 ]
Currently, when NFS is queried for all the labels present on the file via a command example "getfattr -d -m . /mnt/testfile", it does not return the security label. Yet when asked specifically for the label (getfattr -n security.selinux) it will be returned. Include the security label when all attributes are queried.
--- fs/nfs/nfs4proc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +10 -2
@@ -10814,7 +10814,7 @@ const struct nfs4_minor_version_ops *nfs_v4_minor_ops[] = {static ssize_t nfs4_listxattr (struct dentry *dentry,char *list,size_t size) { -ssize_t error, error2, error3; +ssize_t error, error2, error3, error4;size_t left = size; error =generic_listxattr (dentry, list, left);
@@ -10837,8 +10837,16 @@ static ssize_t nfs4_listxattr(struct dentry *dentry, char *list, size_t size) error3 =nfs4_listxattr_nfs4_user (d_inode (dentry), list, left);if (error3 <0 )return error3; +if (list) { + list += error3; + left -= error3; + } + + error4 =security_inode_listsecurity (d_inode (dentry), list, left); +if (error4 <0 ) +return error4; - error += error2 + error3; + error += error2 + error3 + error4;if (size && error > size)return -ERANGE ;return error;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 6/218 NFSv4.2: fix setattr caching of TIME_[MODIFY|ACCESS]_SET when timestamps are delegated
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
[ Upstream commit aba41e90aadeca8d4656f90639aa5f91ce564f1c ]
nfs_setattr will flush all pending writes before updating a file time attributes. However when the client holds delegated timestamps, it can update its timestamps locally as it is the authority for the file times attributes. The client will later set the file attributes by adding a setattr to the delegreturn compound updating the server time attributes.
Fix nfs_setattr to avoid flushing pending writes when the file time attributes are delegated and the mtime/atime are set to a fixed timestamp (ATTR_[MODIFY|ACCESS]_SET. Also, when sending the setattr procedure over the wire, we need to clear the correct attribute bits from the bitmask.
I was able to measure a noticable speedup when measuring untar performance.
Test: $ time tar xzf ~/dir.tgz
Baseline: 1m13.072s
Patched: 0m49.038s
Which is more than 30% latency improvement.
--- fs/nfs/inode.c | 49 +++++++++++++++++++++++++++++++++++++++++++---- fs/nfs/nfs4proc.c | 8 ++++---- 2 files changed, 49 insertions(+), 8 deletions(-)
fs/nfs/inode.c +45 -4
@@ -635,6 +635,34 @@ nfs_fattr_fixup_delegated(struct inode *inode, struct nfs_fattr *fattr) } } +static void nfs_set_timestamps_to_ts (struct inode *inode,struct iattr *attr) +{ +unsigned int cache_flags =0 ; + +if (attr->ia_valid &ATTR_MTIME_SET ) { +struct timespec64 ctime =inode_get_ctime (inode); +struct timespec64 mtime =inode_get_mtime (inode); +struct timespec64 now; +int updated =0 ; + + now =inode_set_ctime_current (inode); +if (!timespec64_equal (&now, &ctime)) + updated |=S_CTIME ; + +inode_set_mtime_to_ts (inode, attr->ia_mtime); +if (!timespec64_equal (&now, &mtime)) + updated |=S_MTIME ; + +inode_maybe_inc_iversion (inode, updated); + cache_flags |=NFS_INO_INVALID_CTIME |NFS_INO_INVALID_MTIME ; + } +if (attr->ia_valid &ATTR_ATIME_SET ) { +inode_set_atime_to_ts (inode, attr->ia_atime); + cache_flags |=NFS_INO_INVALID_ATIME ; + } +NFS_I (inode)->cache_validity &= ~cache_flags; +} +static void nfs_update_timestamps (struct inode *inode,unsigned int ia_valid) {enum file_time_flags time_flags =0 ;
@@ -703,14 +731,27 @@ nfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,if (nfs_have_delegated_mtime (inode) && attr->ia_valid &ATTR_MTIME ) {spin_lock (&inode->i_lock); -nfs_update_timestamps (inode, attr->ia_valid); +if (attr->ia_valid &ATTR_MTIME_SET ) { +nfs_set_timestamps_to_ts (inode, attr); + attr->ia_valid &= ~(ATTR_MTIME |ATTR_MTIME_SET | +ATTR_ATIME |ATTR_ATIME_SET ); + }else { +nfs_update_timestamps (inode, attr->ia_valid); + attr->ia_valid &= ~(ATTR_MTIME |ATTR_ATIME ); + }spin_unlock (&inode->i_lock); - attr->ia_valid &= ~(ATTR_MTIME |ATTR_ATIME ); }else if (nfs_have_delegated_atime (inode) && attr->ia_valid &ATTR_ATIME && !(attr->ia_valid &ATTR_MTIME )) { -nfs_update_delegated_atime (inode); - attr->ia_valid &= ~ATTR_ATIME ; +if (attr->ia_valid &ATTR_ATIME_SET ) { +spin_lock (&inode->i_lock); +nfs_set_timestamps_to_ts (inode, attr); +spin_unlock (&inode->i_lock); + attr->ia_valid &= ~(ATTR_ATIME |ATTR_ATIME_SET ); + }else { +nfs_update_delegated_atime (inode); + attr->ia_valid &= ~ATTR_ATIME ; + } }/* Optimization: if the end result is no change, don't RPC */
fs/nfs/nfs4proc.c +4 -4
@@ -313,14 +313,14 @@ static void nfs4_bitmap_copy_adjust(__u32 *dst, const __u32 *src,if (nfs_have_delegated_mtime (inode)) {if (!(cache_validity &NFS_INO_INVALID_ATIME )) - dst[1 ] &= ~FATTR4_WORD1_TIME_ACCESS ; + dst[1 ] &= ~(FATTR4_WORD1_TIME_ACCESS |FATTR4_WORD1_TIME_ACCESS_SET );if (!(cache_validity &NFS_INO_INVALID_MTIME )) - dst[1 ] &= ~FATTR4_WORD1_TIME_MODIFY ; + dst[1 ] &= ~(FATTR4_WORD1_TIME_MODIFY |FATTR4_WORD1_TIME_MODIFY_SET );if (!(cache_validity &NFS_INO_INVALID_CTIME )) - dst[1 ] &= ~FATTR4_WORD1_TIME_METADATA ; + dst[1 ] &= ~(FATTR4_WORD1_TIME_METADATA |FATTR4_WORD1_TIME_MODIFY_SET ); }else if (nfs_have_delegated_atime (inode)) {if (!(cache_validity &NFS_INO_INVALID_ATIME )) - dst[1 ] &= ~FATTR4_WORD1_TIME_ACCESS ; + dst[1 ] &= ~(FATTR4_WORD1_TIME_ACCESS |FATTR4_WORD1_TIME_ACCESS_SET ); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 7/218 mailbox: Not protect module_put with spin_lock_irqsave
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit dddbd233e67e792bb0a3f9694a4707e6be29b2c6 ]
&chan->lock is not supposed to protect 'chan->mbox'. And in __mbox_bind_client, try_module_get is also not protected by &chan->lock. So move module_put out of the lock protected region.
--- drivers/mailbox/mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/mailbox.c +1 -1
@@ -490,8 +490,8 @@ void mbox_free_channel(struct mbox_chan *chan)if (chan->txdone_method ==TXDONE_BY_ACK ) chan->txdone_method =TXDONE_BY_POLL ; -module_put (chan->mbox->dev->driver->owner);spin_unlock_irqrestore (&chan->lock, flags); +module_put (chan->mbox->dev->driver->owner); }EXPORT_SYMBOL_GPL (mbox_free_channel);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 8/218 mfd: max14577: Fix wakeup source leaks on device unbind
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit d905d06e64b0eb3da43af6186c132f5282197998 ]
Device can be unbound, so driver must also release memory for the wakeup source.
--- drivers/mfd/max14577.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/max14577.c +1 -0
@@ -456,6 +456,7 @@ static void max14577_i2c_remove(struct i2c_client *i2c) {struct max14577 *max14577 =i2c_get_clientdata (i2c); +device_init_wakeup (max14577->dev, false);mfd_remove_devices (max14577->dev);regmap_del_irq_chip (max14577->irq, max14577->irq_data);if (max14577->dev_type ==MAXIM_DEVICE_TYPE_MAX77836 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 9/218 sunrpc: dont immediately retransmit on seqno miss
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikhil Jha <[email protected]>
[ Upstream commit fadc0f3bb2de8c570ced6d9c1f97222213d93140 ]
RFC2203 requires that retransmitted messages use a new gss sequence number, but the same XID. This means that if the server is just slow (e.x. overloaded), the client might receive a response using an older seqno than the one it has recorded.
Currently, Linux's client immediately retransmits in this case. However, this leads to a lot of wasted retransmits until the server eventually responds faster than the client can resend.
Client -> SEQ 1 -> Server
Client -> SEQ 2 -> Server
Client <- SEQ 1 <- Server (misses, expecting seqno = 2) Client -> SEQ 3 -> Server (immediate retransmission on miss) Client <- SEQ 2 <- Server (misses, expecting seqno = 3) Client -> SEQ 4 -> Server (immediate retransmission on miss) ... and so on ...
This commit makes it so that we ignore messages with bad checksums due to seqnum mismatch, and rely on the usual timeout behavior for retransmission instead of doing so immediately.
--- net/sunrpc/clnt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/sunrpc/clnt.c +7 -2
@@ -2749,8 +2749,13 @@ rpc_decode_header(struct rpc_task *task, struct xdr_stream *xdr)case -EPROTONOSUPPORT : goto out_err;case -EACCES : -/* Re-encode with a fresh cred */ - fallthrough; +/* possible RPCSEC_GSS out-of-sequence event (RFC2203), +* reset recv state and keep waiting, don't retransmit +*/ + task->tk_rqstp->rq_reply_bytes_recvd =0 ; + task->tk_status =xprt_request_enqueue_receive (task); + task->tk_action = call_transmit_status; +return -EBADMSG ;default : goto out_garbage; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 10/218 dm vdo indexer: dont read request structure after enqueuing
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Sakai <[email protected]>
[ Upstream commit 3da732687d72078e52cc7f334a482383e84ca156 ]
The function get_volume_page_protected may place a request on a queue for another thread to process asynchronously. When this happens, the volume should not read the request from the original thread. This can not currently cause problems, due to the way request processing is handled, but it is not safe in general.
--- drivers/md/dm-vdo/indexer/volume.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/md/dm-vdo/indexer/volume.c +13 -11
@@ -754,10 +754,11 @@ static int get_volume_page_protected(struct volume *volume, struct uds_request * u32 physical_page, struct cached_page **page_ptr) { struct cached_page *page; +unsigned int zone_number = request->zone_number;get_page_from_cache (&volume->page_cache, physical_page, &page);if (page !=NULL ) { -if (request->zone_number ==0 ) { +if (zone_number ==0 ) {/* Only one zone is allowed to update the LRU. */ make_page_most_recent (&volume->page_cache, page); }
@@ -767,7 +768,7 @@ static int get_volume_page_protected(struct volume *volume, struct uds_request * }/* Prepare to enqueue a read for the page. */ -end_pending_search (&volume->page_cache, request->zone_number); +end_pending_search (&volume->page_cache, zone_number);mutex_lock (&volume->read_threads_mutex);/*
@@ -787,8 +788,7 @@ static int get_volume_page_protected(struct volume *volume, struct uds_request ** the order does not matter for correctness as it does below. */ mutex_unlock (&volume->read_threads_mutex); -begin_pending_search (&volume->page_cache, physical_page, - request->zone_number); +begin_pending_search (&volume->page_cache, physical_page, zone_number);return UDS_QUEUED ; }
@@ -797,7 +797,7 @@ static int get_volume_page_protected(struct volume *volume, struct uds_request ** "search pending" state in careful order so no other thread can mess with the data before * the caller gets to look at it. */ -begin_pending_search (&volume->page_cache, physical_page, request->zone_number); +begin_pending_search (&volume->page_cache, physical_page, zone_number);mutex_unlock (&volume->read_threads_mutex); *page_ptr = page;return UDS_SUCCESS ;
@@ -849,6 +849,7 @@ static int search_cached_index_page(struct volume *volume, struct uds_request *r {int result;struct cached_page *page =NULL ; +unsigned int zone_number = request->zone_number;u32 physical_page =map_to_physical_page (volume->geometry, chapter, index_page_number);
@@ -858,18 +859,18 @@ static int search_cached_index_page(struct volume *volume, struct uds_request *r* invalidation by the reader thread, before the reader thread has noticed that the * invalidate_counter has been incremented. */ -begin_pending_search (&volume->page_cache, physical_page, request->zone_number); +begin_pending_search (&volume->page_cache, physical_page, zone_number); result =get_volume_page_protected (volume, request, physical_page, &page);if (result !=UDS_SUCCESS ) { -end_pending_search (&volume->page_cache, request->zone_number); +end_pending_search (&volume->page_cache, zone_number);return result; } result =uds_search_chapter_index_page (&page->index_page, volume->geometry, &request->record_name, record_page_number); -end_pending_search (&volume->page_cache, request->zone_number); +end_pending_search (&volume->page_cache, zone_number);return result; }
@@ -882,6 +883,7 @@ int uds_search_cached_record_page(struct volume *volume, struct uds_request *req {struct cached_page *record_page;struct index_geometry *geometry = volume->geometry; +unsigned int zone_number = request->zone_number;int result;u32 physical_page, page_number;
@@ -905,11 +907,11 @@ int uds_search_cached_record_page(struct volume *volume, struct uds_request *req* invalidation by the reader thread, before the reader thread has noticed that the * invalidate_counter has been incremented. */ -begin_pending_search (&volume->page_cache, physical_page, request->zone_number); +begin_pending_search (&volume->page_cache, physical_page, zone_number); result =get_volume_page_protected (volume, request, physical_page, &record_page);if (result !=UDS_SUCCESS ) { -end_pending_search (&volume->page_cache, request->zone_number); +end_pending_search (&volume->page_cache, zone_number);return result; }
@@ -917,7 +919,7 @@ int uds_search_cached_record_page(struct volume *volume, struct uds_request *req &request->record_name, geometry, &request->old_metadata)) *found = true; -end_pending_search (&volume->page_cache, request->zone_number); +end_pending_search (&volume->page_cache, zone_number);return UDS_SUCCESS ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 11/218 leds: multicolor: Fix intensity setting while SW blinking
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Schwermer <[email protected]>
[ Upstream commit e35ca991a777ef513040cbb36bc8245a031a2633 ]
When writing to the multi_intensity file, don't unconditionally call led_set_brightness. By only doing this if blinking is inactive we prevent blinking from stopping if the blinking is in its off phase while the file is written.
Instead, if blinking is active, the changed intensity values are applied upon the next blink. This is consistent with changing the brightness on monochrome LEDs with active blinking.
--- drivers/leds/led-class-multicolor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/leds/led-class-multicolor.c +2 -1
@@ -61,7 +61,8 @@ static ssize_t multi_intensity_store(struct device *dev,for (i =0 ; i < mcled_cdev->num_colors; i++) mcled_cdev->subled_info[i].intensity = intensity_value[i]; -led_set_brightness (led_cdev, led_cdev->brightness); +if (!test_bit (LED_BLINK_SW , &led_cdev->work_flags)) +led_set_brightness (led_cdev, led_cdev->brightness); ret = size; err_out:mutex_unlock (&led_cdev->led_access);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 12/218 fuse: fix race between concurrent setattrs from multiple nodes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guang Yuan Wu <[email protected]>
[ Upstream commit 69efbff69f89c9b2b72c4d82ad8b59706add768a ]
When mounting a user-space filesystem on multiple clients, after concurrent ->setattr() calls from different node, stale inode attributes may be cached in some node.
This is caused by fuse_setattr() racing withfuse_reverse_inval_inode().
When filesystem server receives setattr request, the client node with valid iattr cached will be required to update the fuse_inode's attr_version and invalidate the cache by fuse_reverse_inval_inode(), and at the next call to ->getattr() they will be fetched from user space.
The race scenario is:
1. client-1 sends setattr (iattr-1) request to server
2. client-1 receives the reply from server
3. before client-1 updates iattr-1 to the cached attributes by fuse_change_attributes_common(), server receives another setattr (iattr-2) request from client-2
4. server requests client-1 to update the inode attr_version and invalidate the cached iattr, and iattr-1 becomes staled
5. client-2 receives the reply from server, and caches iattr-2
6. continue with step 2, client-1 invokes fuse_change_attributes_common(), and caches iattr-1
The issue has been observed from concurrent of chmod, chown, or truncate, which all invoke ->setattr() call.
The solution is to use fuse_inode's attr_version to check whether the attributes have been modified during the setattr request's lifetime. If so, mark the attributes as invalid in the function fuse_change_attributes_common().
--- fs/fuse/dir.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/fuse/dir.c +11 -0
@@ -1921,6 +1921,7 @@ int fuse_do_setattr(struct mnt_idmap *idmap, struct dentry *dentry,int err;bool trust_local_cmtime = is_wb;bool fault_blocked = false; +u64 attr_version;if (!fc->default_permissions) attr->ia_valid |=ATTR_FORCE ;
@@ -2005,6 +2006,8 @@ int fuse_do_setattr(struct mnt_idmap *idmap, struct dentry *dentry,if (fc->handle_killpriv_v2 && !capable (CAP_FSETID )) inarg.valid |=FATTR_KILL_SUIDGID ; } + + attr_version =fuse_get_attr_version (fm->fc);fuse_setattr_fill (fc, &args, inode, &inarg, &outarg); err =fuse_simple_request (fm, &args);if (err) {
@@ -2030,6 +2033,14 @@ int fuse_do_setattr(struct mnt_idmap *idmap, struct dentry *dentry,/* FIXME: clear I_DIRTY_SYNC? */ } +if (fi->attr_version > attr_version) { +/* +* Apply attributes, for example for fsnotify_change(), but set +* attribute timeout to zero. +*/ + outarg.attr_valid = outarg.attr_valid_nsec =0 ; + } +fuse_change_attributes_common (inode, &outarg.attr,NULL ,ATTR_TIMEOUT (&outarg),fuse_get_cache_mask (inode));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 13/218 cxl/region: Add a dev_err() on missing target list entries
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Richter <[email protected]>
[ Upstream commit d90acdf49e18029cfe4194475c45ef143657737a ]
Broken target lists are hard to discover as the driver fails at a later initialization stage. Add an error message for this.
Example log messages:
cxl_mem mem1: failed to find endpoint6:0000:e0:01.3 in target list of decoder1.1 cxl_port endpoint6: failed to register decoder6.0: -6
cxl_port endpoint6: probe: 0
--- drivers/cxl/core/region.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/cxl/core/region.c +7 -0
@@ -1781,6 +1781,13 @@ static int find_pos_and_ways(struct cxl_port *port, struct range *range, }put_device (dev); +if (rc) +dev_err (port->uport_dev, +"failed to find %s:%s in target list of %s\n" , +dev_name (&port->dev), +dev_name (port->parent_dport->dport_dev), +dev_name (&cxlsd->cxld.dev)); +return rc; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 14/218 NFSv4: xattr handlers should check for absent nfs filehandles
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Scott Mayhew <[email protected]>
[ Upstream commit 6e9a2f8dbe93c8004c2af2c0158888628b7ca034 ]
The nfs inodes for referral anchors that have not yet been followed have their filehandles zeroed out.
Attempting to call getxattr() on one of these will cause the nfs client to send a GETATTR to the nfs server with the preceding PUTFH sans filehandle. The server will reply NFS4ERR_NOFILEHANDLE, leading to -EIO being returned to the application.
For example:
$ strace -e trace=getxattr getfattr -n system.nfs4_acl /mnt/t/ref
getxattr("/mnt/t/ref", "system.nfs4_acl", NULL, 0) = -1 EIO (Input/output error)
/mnt/t/ref: system.nfs4_acl: Input/output error
+++ exited with 1 +++Have the xattr handlers return -ENODATA instead.
--- fs/nfs/nfs4proc.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/nfs/nfs4proc.c +5 -0
@@ -6174,6 +6174,8 @@ static ssize_t nfs4_proc_get_acl(struct inode *inode, void *buf, size_t buflen,struct nfs_server *server =NFS_SERVER (inode);int ret; +if (unlikely (NFS_FH (inode)->size ==0 )) +return -ENODATA ;if (!nfs4_server_supports_acls (server, type))return -EOPNOTSUPP ; ret =nfs_revalidate_inode (inode,NFS_INO_INVALID_CHANGE );
@@ -6248,6 +6250,9 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf, {struct nfs4_exception exception = { };int err; + +if (unlikely (NFS_FH (inode)->size ==0 )) +return -ENODATA ; do { err = __nfs4_proc_set_acl(inode, buf, buflen, type); trace_nfs4_set_acl(inode, err);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 15/218 hwmon: (pmbus/max34440) Fix support for max34451
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Czezar Torreno <[email protected]>
[ Upstream commit 19932f844f3f51646f762f3eac4744ec3a405064 ]
The max344** family has an issue with some PMBUS address being switched. This includes max34451 however version MAX34451-NA6 and later has this issue fixed and this commit supports that update.
--- drivers/hwmon/pmbus/max34440.c | 48 +++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-)
drivers/hwmon/pmbus/max34440.c +44 -4
@@ -34,16 +34,21 @@ enum chips { max34440, max34441, max34446, max34451, max34460, max34461 };/* * The whole max344* family have IOUT_OC_WARN_LIMIT and IOUT_OC_FAULT_LIMIT * swapped from the standard pmbus spec addresses. +* For max34451, version MAX34451ETNA6+ and later has this issue fixed. */ #define MAX34440_IOUT_OC_WARN_LIMIT 0x46#define MAX34440_IOUT_OC_FAULT_LIMIT 0x4A +#define MAX34451ETNA6_MFR_REV 0x0012 +#define MAX34451_MFR_CHANNEL_CONFIG 0xe4#define MAX34451_MFR_CHANNEL_CONFIG_SEL_MASK 0x3fstruct max34440_data {int id;struct pmbus_driver_info info; +u8 iout_oc_warn_limit; +u8 iout_oc_fault_limit; };#define to_max34440_data (x) container_of(x, struct max34440_data, info)
@@ -60,11 +65,11 @@ static int max34440_read_word_data(struct i2c_client *client, int page,switch (reg) {case PMBUS_IOUT_OC_FAULT_LIMIT : ret =pmbus_read_word_data (client, page, phase, -MAX34440_IOUT_OC_FAULT_LIMIT ); + data->iout_oc_fault_limit);break ;case PMBUS_IOUT_OC_WARN_LIMIT : ret =pmbus_read_word_data (client, page, phase, -MAX34440_IOUT_OC_WARN_LIMIT ); + data->iout_oc_warn_limit);break ;case PMBUS_VIRT_READ_VOUT_MIN : ret = pmbus_read_word_data(client, page, phase,
@@ -133,11 +138,11 @@ static int max34440_write_word_data(struct i2c_client *client, int page,switch (reg) {case PMBUS_IOUT_OC_FAULT_LIMIT : - ret =pmbus_write_word_data (client, page,MAX34440_IOUT_OC_FAULT_LIMIT , + ret =pmbus_write_word_data (client, page, data->iout_oc_fault_limit, word);break ;case PMBUS_IOUT_OC_WARN_LIMIT : - ret =pmbus_write_word_data (client, page,MAX34440_IOUT_OC_WARN_LIMIT , + ret =pmbus_write_word_data (client, page, data->iout_oc_warn_limit, word);break ;case PMBUS_VIRT_RESET_POUT_HISTORY :
@@ -235,6 +240,25 @@ static int max34451_set_supported_funcs(struct i2c_client *client,*/ int page, rv; +bool max34451_na6 = false; + + rv =i2c_smbus_read_word_data (client,PMBUS_MFR_REVISION ); +if (rv <0 ) +return rv; + +if (rv >=MAX34451ETNA6_MFR_REV ) { + max34451_na6 = true; + data->info.format[PSC_VOLTAGE_IN ] = direct; + data->info.format[PSC_CURRENT_IN ] = direct; + data->info.m[PSC_VOLTAGE_IN ] =1 ; + data->info.b[PSC_VOLTAGE_IN ] =0 ; + data->info.R[PSC_VOLTAGE_IN ] =3 ; + data->info.m[PSC_CURRENT_IN ] =1 ; + data->info.b[PSC_CURRENT_IN ] =0 ; + data->info.R[PSC_CURRENT_IN ] =2 ; + data->iout_oc_fault_limit =PMBUS_IOUT_OC_FAULT_LIMIT ; + data->iout_oc_warn_limit =PMBUS_IOUT_OC_WARN_LIMIT ; + }for (page =0 ; page <16 ; page++) { rv =i2c_smbus_write_byte_data (client,PMBUS_PAGE , page);
@@ -251,16 +275,30 @@ static int max34451_set_supported_funcs(struct i2c_client *client,case 0x20 : data->info.func[page] =PMBUS_HAVE_VOUT |PMBUS_HAVE_STATUS_VOUT ; + +if (max34451_na6) + data->info.func[page] |=PMBUS_HAVE_VIN | +PMBUS_HAVE_STATUS_INPUT ;break ;case 0x21 : data->info.func[page] =PMBUS_HAVE_VOUT ; + +if (max34451_na6) + data->info.func[page] |=PMBUS_HAVE_VIN ;break ;case 0x22 : data->info.func[page] =PMBUS_HAVE_IOUT |PMBUS_HAVE_STATUS_IOUT ; + +if (max34451_na6) + data->info.func[page] |=PMBUS_HAVE_IIN | +PMBUS_HAVE_STATUS_INPUT ;break ;case 0x23 : data->info.func[page] =PMBUS_HAVE_IOUT ; + +if (max34451_na6) + data->info.func[page] |=PMBUS_HAVE_IIN ;break ;default :break ;
@@ -494,6 +532,8 @@ static int max34440_probe(struct i2c_client *client)return -ENOMEM ; data->id =i2c_match_id (max34440_id, client)->driver_data; data->info = max34440_info[data->id]; + data->iout_oc_fault_limit =MAX34440_IOUT_OC_FAULT_LIMIT ; + data->iout_oc_warn_limit =MAX34440_IOUT_OC_WARN_LIMIT ;if (data->id == max34451) { rv =max34451_set_supported_funcs (client, data);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 16/218 ksmbd: allow a filename to contain special characters on SMB3.1.1 posix extension
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit dc3e0f17f74558e8a2fce00608855f050de10230 ]
If client send SMB2_CREATE_POSIX_CONTEXT to ksmbd, Allow a filename to contain special characters.
--- fs/smb/server/smb2pdu.c | 53 +++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 26 deletions(-)
fs/smb/server/smb2pdu.c +27 -26
@@ -2871,7 +2871,7 @@ int smb2_open(struct ksmbd_work *work)int req_op_level =0 , open_flags =0 , may_flags =0 , file_info =0 ;int rc =0 ;int contxt_cnt =0 , query_disk_id =0 ; -int maximal_access_ctxt =0 , posix_ctxt =0 ; +bool maximal_access_ctxt = false, posix_ctxt = false;int s_type =0 ;int next_off =0 ;char *name =NULL ;
@@ -2898,6 +2898,27 @@ int smb2_open(struct ksmbd_work *work)return create_smb2_pipe (work); } +if (req->CreateContextsOffset && tcon->posix_extensions) { + context =smb2_find_context_vals (req,SMB2_CREATE_TAG_POSIX ,16 ); +if (IS_ERR (context)) { + rc =PTR_ERR (context); + goto err_out2; + }else if (context) { +struct create_posix *posix = (struct create_posix *)context; + +if (le16_to_cpu (context->DataOffset) + +le32_to_cpu (context->DataLength) < +sizeof (struct create_posix ) -4 ) { + rc = -EINVAL ; + goto err_out2; + } +ksmbd_debug (SMB ,"get posix context\n" ); + + posix_mode =le32_to_cpu (posix->Mode); + posix_ctxt = true; + } + } +if (req->NameLength) { name = smb2_get_name((char *)req + le16_to_cpu(req->NameOffset), le16_to_cpu(req->NameLength),
@@ -2920,9 +2941,11 @@ int smb2_open(struct ksmbd_work *work) goto err_out2; } - rc =ksmbd_validate_filename (name); -if (rc <0 ) - goto err_out2; +if (posix_ctxt == false) { + rc =ksmbd_validate_filename (name); +if (rc <0 ) + goto err_out2; + }if (ksmbd_share_veto_filename (share, name)) { rc = -ENOENT ;
@@ -3080,28 +3103,6 @@ int smb2_open(struct ksmbd_work *work) rc = -EBADF ; goto err_out2; } - -if (tcon->posix_extensions) { - context =smb2_find_context_vals (req, -SMB2_CREATE_TAG_POSIX ,16 ); -if (IS_ERR (context)) { - rc =PTR_ERR (context); - goto err_out2; - }else if (context) { -struct create_posix *posix = - (struct create_posix *)context; -if (le16_to_cpu (context->DataOffset) + -le32_to_cpu (context->DataLength) < -sizeof (struct create_posix ) -4 ) { - rc = -EINVAL ; - goto err_out2; - } -ksmbd_debug (SMB ,"get posix context\n" ); - - posix_mode =le32_to_cpu (posix->Mode); - posix_ctxt =1 ; - } - } }if (ksmbd_override_fsids (work)) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 17/218 ksmbd: provide zero as a unique ID to the Mac client
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 571781eb7ffefa65b0e922c8031e42b4411a40d4 ]
The Mac SMB client code seems to expect the on-disk file identifier to have the semantics of HFS+ Catalog Node Identifier (CNID). ksmbd provides the inode number as a unique ID to the client, but in the case of subvolumes of btrfs, there are cases where different files have the same inode number, so the mac smb client treats it as an error. There is a report that a similar problem occurs when the share is ZFS.
Returning UniqueId of zero will make the Mac client to stop using and trusting the file id returned from the server.
--- fs/smb/server/connection.h | 1 + fs/smb/server/smb2pdu.c | 19 +++++++++++++++++-- fs/smb/server/smb2pdu.h | 3 +++ 3 files changed, 21 insertions(+), 2 deletions(-)
fs/smb/server/connection.h +1 -0
@@ -108,6 +108,7 @@ struct ksmbd_conn {__le16 signing_algorithm;bool binding;atomic_t refcnt; +bool is_aapl; };struct ksmbd_conn_ops {
fs/smb/server/smb2pdu.c +17 -2
@@ -3535,6 +3535,15 @@ int smb2_open(struct ksmbd_work *work)ksmbd_debug (SMB ,"get query on disk id context\n" ); query_disk_id =1 ; } + +if (conn->is_aapl == false) { + context =smb2_find_context_vals (req,SMB2_CREATE_AAPL ,4 ); +if (IS_ERR (context)) { + rc =PTR_ERR (context); + goto err_out1; + }else if (context) + conn->is_aapl = true; + } } rc =ksmbd_vfs_getattr (&path, &stat);
@@ -3974,7 +3983,10 @@ static int smb2_populate_readdir_entry(struct ksmbd_conn *conn, int info_level,if (dinfo->EaSize) dinfo->ExtFileAttributes =FILE_ATTRIBUTE_REPARSE_POINT_LE ; dinfo->Reserved =0 ; - dinfo->UniqueId =cpu_to_le64 (ksmbd_kstat->kstat->ino); +if (conn->is_aapl) + dinfo->UniqueId =0 ; +else + dinfo->UniqueId =cpu_to_le64 (ksmbd_kstat->kstat->ino);if (d_info->hide_dot_file && d_info->name[0 ] =='.' ) dinfo->ExtFileAttributes |=FILE_ATTRIBUTE_HIDDEN_LE ;memcpy (dinfo->FileName, conv_name, conv_len);
@@ -3991,7 +4003,10 @@ static int smb2_populate_readdir_entry(struct ksmbd_conn *conn, int info_level,smb2_get_reparse_tag_special_file (ksmbd_kstat->kstat->mode);if (fibdinfo->EaSize) fibdinfo->ExtFileAttributes =FILE_ATTRIBUTE_REPARSE_POINT_LE ; - fibdinfo->UniqueId =cpu_to_le64 (ksmbd_kstat->kstat->ino); +if (conn->is_aapl) + fibdinfo->UniqueId =0 ; +else + fibdinfo->UniqueId =cpu_to_le64 (ksmbd_kstat->kstat->ino); fibdinfo->ShortNameLength =0 ; fibdinfo->Reserved =0 ; fibdinfo->Reserved2 =cpu_to_le16 (0 );
fs/smb/server/smb2pdu.h +3 -0
@@ -63,6 +63,9 @@ struct preauth_integrity_info {#define SMB2_SESSION_TIMEOUT (10 * HZ) +/* Apple Defined Contexts */ +#define SMB2_CREATE_AAPL "AAPL" +struct create_durable_req_v2 {struct create_context_hdr ccontext;__u8 Name[8 ];
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 18/218 rust: module: place cleanup_module() in .exit.text section
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: FUJITA Tomonori <[email protected]>
[ Upstream commit 249c3a0e53acefc2b06d3b3e1fc28fb2081f878d ]
Place cleanup_module() in .exit.text section. Currently, cleanup_module() is likely placed in the .text section. It's inconsistent with the layout of C modules, where cleanup_module() is placed in .exit.text.
[ Boqun asked for an example of how the section changed to be
put in the log. Tomonori provided the following examples:
C module:
$ objdump -t ~/build/x86/drivers/block/loop.o|grep clean
0000000000000000 l O .exit.data 0000000000000008 __UNIQUE_ID___addressable_cleanup_module412
0000000000000000 g F .exit.text 000000000000009c cleanup_module
Rust module without this patch:
$ objdump -t ~/build/x86/samples/rust/rust_minimal.o|grep clean
00000000000002b0 g F .text 00000000000000c6 cleanup_module
0000000000000000 g O .exit.data 0000000000000008 _R...___UNIQUE_ID___addressable_cleanup_module
Rust module with this patch:
$ objdump -t ~/build/x86/samples/rust/rust_minimal.o|grep clean
0000000000000000 g F .exit.text 00000000000000c6 cleanup_module
0000000000000000 g O .exit.data 0000000000000008 _R...___UNIQUE_ID___addressable_cleanup_module- Miguel ]
--- rust/macros/module.rs | 1 + 1 file changed, 1 insertion(+)
rust/macros/module.rs +1 -0
@@ -260,6 +260,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream { #[cfg(MODULE)] #[doc(hidden)] #[no_mangle] + #[link_section = \".exit.text\"] pub extern \"C\" fn cleanup_module() {{ // SAFETY: // - This function is inaccessible to the outside due to the double
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 19/218 rust: arm: fix unknown (to Clang) argument -mno-fdpic
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rudraksha Gupta <[email protected]>
[ Upstream commit 977c4308ee4270cf46e2c66b37de8e04670daa0c ]
Currently rust on arm fails to compile due to '-mno-fdpic'. This flag disables a GCC feature that we don't want for kernel builds, so let's skip it as it doesn't apply to Clang.
UPD include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
RUSTC L rust/core.o
BINDGEN rust/bindings/bindings_generated.rs
BINDGEN rust/bindings/bindings_helpers_generated.rs
CC rust/helpers/helpers.o
Unable to generate bindings: clang diagnosed error: error: unknown argument: '-mno-fdpic' make[2]: *** [rust/Makefile:369: rust/bindings/bindings_helpers_generated.rs] Error 1 make[2]: *** Deleting file 'rust/bindings/bindings_helpers_generated.rs' make[2]: *** Waiting for unfinished jobs....
Unable to generate bindings: clang diagnosed error: error: unknown argument: '-mno-fdpic' make[2]: *** [rust/Makefile:349: rust/bindings/bindings_generated.rs] Error 1 make[2]: *** Deleting file 'rust/bindings/bindings_generated.rs'
make[1]: *** [/home/pmos/build/src/linux-next-next-20250521/Makefile:1285: prepare] Error 2
make: *** [Makefile:248: __sub-make] Error 2
[ Naresh provided the draft diff [1].
Ben explained [2]:
FDPIC is only relevant with no-MMU targets, and then only for userspace. When configured for the arm-*-uclinuxfdpiceabi target, GCC enables FDPIC by default to facilitate compiling userspace programs. FDPIC is never used for the kernel, and we pass -mno-fdpic when building the kernel to override the default and make sure FDPIC is disabled.
and [3]:
-mno-fdpic disables a GCC feature that we don't want for kernel builds. clang does not support this feature, so it always behaves as though -mno-fdpic is passed. Therefore, it should be fine to mix the two, at least as far as FDPIC is concerned.
[1] https://lore.kernel.org/rust-for-linux/CA+G9fYt4otQK4pHv8pJBW9e28yHSGCDncKquwuJiJ_1ou0pq0w@mail.gmail.com/
[2] https://lore.kernel.org/rust-for-linux/aAKrq2InExQk7f_k@dell-precision-5540/
[3] https://lore.kernel.org/rust-for-linux/aAo_F_UP1Gd4jHlZ@dell-precision-5540/
- Miguel ]
--- rust/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
rust/Makefile +1 -1
@@ -238,7 +238,7 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \ -fzero-call-used-regs=% -fno-stack-clash-protection \ -fno-inline-functions-called-once -fsanitize=bounds-strict \ -fstrict-flex-arrays=% -fmin-function-alignment=% \ - -fzero-init-padding-bits=% \ + -fzero-init-padding-bits=% -mno-fdpic \ --param=% --param asan-% # Derived from `scripts/Makefile.clang`.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 20/218 Revert "iommu/amd: Prevent binding other PCI drivers to IOMMU PCI devices"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
[ Upstream commit 3be5fa236649da6404f1bca1491bf02d4b0d5cce ]
Commit 991de2e59090 ("PCI, x86: Implement pcibios_alloc_irq() and pcibios_free_irq()") changed IRQ handling on PCI driver probing. It inadvertently broke resume from system sleep on AMD platforms:
https://lore.kernel.org/r/[email protected]/
This was fixed by two independent commits:
* 8affb487d4a4 ("x86/PCI: Don't alloc pcibios-irq when MSI is enabled")
* cbbc00be2ce3 ("iommu/amd: Prevent binding other PCI drivers to IOMMU PCI devices")
The breaking change and one of these two fixes were subsequently reverted:
* fe25d078874f ("Revert "x86/PCI: Don't alloc pcibios-irq when MSI is enabled"")
* 6c777e8799a9 ("Revert "PCI, x86: Implement pcibios_alloc_irq() and pcibios_free_irq()"")
This rendered the second fix unnecessary, so revert it as well. It used the match_driver flag in struct pci_dev, which is internal to the PCI core and not supposed to be touched by arbitrary drivers.
--- drivers/iommu/amd/init.c | 3 --- 1 file changed, 3 deletions(-)
drivers/iommu/amd/init.c +0 -3
@@ -2026,9 +2026,6 @@ static int __init iommu_init_pci(struct amd_iommu *iommu)if (!iommu->dev)return -ENODEV ; -/* Prevent binding other PCI device drivers to IOMMU devices */ - iommu->dev->match_driver = false; -/* ACPI _PRT won't have an IRQ for IOMMU */ iommu->dev->irq_managed =1 ;
Signature · 1 line
2.39.5
Re: [PATCH 6.12 020/218] Revert "iommu/amd: Prevent binding other PCI drivers to IOMMU PCI devices"
Quoted 3 lines · Greg Kroah-Hartman
6.12-stable review patch. If anyone has any objections, please let me know.
[ Upstream commit
3be5fa236649da6404f1bca1491bf02d4b0d5cce]
This should not be backported to stable kernels. It does not fix any known issues, but conversely it is known to cause an error message on boot, for which there's a fix pending here:
https://lore.kernel.org/r/b29e7fbfc6d146f947603d0ebaef44cbd2f0d754.1751468802.git.lukas@wunner.de/
Long story short, please unqueue this one. :)
Thanks!
Lukas
Re: [PATCH 6.12 020/218] Revert "iommu/amd: Prevent binding other PCI drivers to IOMMU PCI devices"
Quoted 5 lines · Lukas Wunner
Quoted 3 lines · Greg Kroah-Hartman
6.12-stable review patch. If anyone has any objections, please let me know.
[ Upstream commit
3be5fa236649da6404f1bca1491bf02d4b0d5cce]
Quoted 7 lines
This should not be backported to stable kernels. It does not fix any known issues, but conversely it is known to cause an error message on boot, for which there's a fix pending here:
https://lore.kernel.org/r/b29e7fbfc6d146f947603d0ebaef44cbd2f0d754.1751468802.git.lukas@wunner.de/
Long story short, please unqueue this one. :)
Gentle ping - I just noticed that upstream commit 3be5fa236649 is still on the queue/6.15, queue/6.12, queue/6.6, queue/6.1, queue/5.15, queue/5.10, queue/5.4 branches (which were all updated 6 hours ago).
Please drop the commit from all of them. This commit is not eligible for backporting to stable.
Thanks,
Lukas
Greg Kroah-Hartman
maintainerRe: [PATCH 6.12 020/218] Revert "iommu/amd: Prevent binding other PCI drivers to IOMMU PCI devices"
Quoted 12 lines · Lukas Wunner
Quoted 11 lines · Lukas Wunner
Quoted 3 lines · Greg Kroah-Hartman
6.12-stable review patch. If anyone has any objections, please let me know.
[ Upstream commit
3be5fa236649da6404f1bca1491bf02d4b0d5cce]This should not be backported to stable kernels. It does not fix any known issues, but conversely it is known to cause an error message on boot, for which there's a fix pending here:
https://lore.kernel.org/r/b29e7fbfc6d146f947603d0ebaef44cbd2f0d754.1751468802.git.lukas@wunner.de/
Quoted 8 lines
Quoted 1 line
Long story short, please unqueue this one. :)
Gentle ping - I just noticed that upstream commit
3be5fa236649is still on the queue/6.15, queue/6.12, queue/6.6, queue/6.1, queue/5.15, queue/5.10, queue/5.4 branches (which were all updated 6 hours ago).Please drop the commit from all of them. This commit is not eligible for backporting to stable.
Sorry about that, I was hoping that the fix would hit Linus's tree. Now dropped from all queues.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 21/218 dmaengine: idxd: Check availability of workqueue allocated by idxd wq driver before using
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Sun <[email protected]>
[ Upstream commit 17502e7d7b7113346296f6758324798d536c31fd ]
Running IDXD workloads in a container with the /dev directory mounted can trigger a call trace or even a kernel panic when the parent process of the container is terminated.
This issue occurs because, under certain configurations, Docker does not properly propagate the mount replica back to the original mount point.
In this case, when the user driver detaches, the WQ is destroyed but it still calls destroy_workqueue() attempting to completes all pending work. It's necessary to check wq->wq and skip the drain if it no longer exists.
--- drivers/dma/idxd/cdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/idxd/cdev.c +3 -1
@@ -354,7 +354,9 @@ static void idxd_cdev_evl_drain_pasid(struct idxd_wq *wq, u32 pasid)set_bit (h, evl->bmap); h = (h +1 ) % size; } -drain_workqueue (wq->wq); +if (wq->wq) +drain_workqueue (wq->wq); +mutex_unlock (&evl->lock); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 22/218 dmaengine: xilinx_dma: Set dma_device directions
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gessler <[email protected]>
[ Upstream commit 7e01511443c30a55a5ae78d3debd46d4d872517e ]
Coalesce the direction bits from the enabled TX and/or RX channels into the directions bit mask of dma_device. Without this mask set, dma_get_slave_caps() in the DMAEngine fails, which prevents the driver from being used with an IIO DMAEngine buffer.
--- drivers/dma/xilinx/xilinx_dma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/xilinx/xilinx_dma.c +2 -0
@@ -2906,6 +2906,8 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,return -EINVAL ; } + xdev->common.directions |= chan->direction; +/* Request the interrupt */ chan->irq =of_irq_get (node, chan->tdest);if (chan->irq <0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 23/218 PCI: dwc: Make link training more robust by setting PORT_LOGIC_LINK_WIDTH to one lane
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenbin Yao <[email protected]>
[ Upstream commit af3c6eacce0c464f28fe0e3d365b3860aba07931 ]
As per DWC PCIe registers description 4.30a, section 1.13.43, NUM_OF_LANES named as PORT_LOGIC_LINK_WIDTH in PCIe DWC driver, is referred to as the "Predetermined Number of Lanes" in PCIe r6.0, sec 4.2.7.2.1, which explains the conditions required to enter Polling.Configuration:
Next state is Polling.Configuration after at least 1024 TS1 Ordered Sets were transmitted, and all Lanes that detected a Receiver during Detect receive eight consecutive training sequences ...
Otherwise, after a 24 ms timeout the next state is:
Polling.Configuration if,
(i) Any Lane, which detected a Receiver during Detect, received eight consecutive training sequences ... and a minimum of 1024 TS1 Ordered Sets are transmitted after receiving one TS1 or TS2 Ordered Set.
And
(ii) At least a predetermined set of Lanes that detected a Receiver during Detect have detected an exit from Electrical Idle at least once since entering Polling.Active.
Note: This may prevent one or more bad Receivers or Transmitters from holding up a valid Link from being configured, and allow for additional training in Polling.Configuration. The exact set of predetermined Lanes is implementation specific.
Note: Any Lane that receives eight consecutive TS1 or TS2 Ordered Sets should have detected an exit from Electrical Idle at least once since entering Polling.Active.
In a PCIe link supporting multiple lanes, if PORT_LOGIC_LINK_WIDTH is set to lane width the hardware supports, all lanes that detect a receiver during the Detect phase must receive eight consecutive training sequences. Otherwise, LTSSM will not enter Polling.Configuration and link training will fail.
Therefore, always set PORT_LOGIC_LINK_WIDTH to 1, regardless of the number of lanes the port actually supports, to make link up more robust. This setting will not affect the intended link width if all lanes are functional. Additionally, the link can still be established with at least one lane if other lanes are faulty.
--- drivers/pci/controller/dwc/pcie-designware.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pci/controller/dwc/pcie-designware.c +1 -4
@@ -752,22 +752,19 @@ static void dw_pcie_link_set_max_link_width(struct dw_pcie *pci, u32 num_lanes)/* Set link width speed control register */ lwsc =dw_pcie_readl_dbi (pci,PCIE_LINK_WIDTH_SPEED_CONTROL ); lwsc &= ~PORT_LOGIC_LINK_WIDTH_MASK ; + lwsc |=PORT_LOGIC_LINK_WIDTH_1_LANES ;switch (num_lanes) {case 1 : plc |=PORT_LINK_MODE_1_LANES ; - lwsc |=PORT_LOGIC_LINK_WIDTH_1_LANES ;break ;case 2 : plc |=PORT_LINK_MODE_2_LANES ; - lwsc |=PORT_LOGIC_LINK_WIDTH_2_LANES ;break ;case 4 : plc |=PORT_LINK_MODE_4_LANES ; - lwsc |=PORT_LOGIC_LINK_WIDTH_4_LANES ;break ;case 8 : plc |=PORT_LINK_MODE_8_LANES ; - lwsc |=PORT_LOGIC_LINK_WIDTH_8_LANES ;break ;default :dev_err (pci->dev,"num-lanes %u: invalid value\n" , num_lanes);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 24/218 PCI: apple: Fix missing OF node reference in apple_pcie_setup_port
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hector Martin <[email protected]>
[ Upstream commit 7fa9fbf39116b061f8a41cd84f1884c545f322c4 ]
In the success path, we hang onto a reference to the node, so make sure to grab one. The caller iterator puts our borrowed reference when we return.
--- drivers/pci/controller/pcie-apple.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pci/controller/pcie-apple.c +3 -0
@@ -585,6 +585,9 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,list_add_tail (&port->entry, &pcie->ports);init_completion (&pcie->event); +/* In the success path, we keep a reference to np around */ +of_node_get (np); + ret =apple_pcie_port_register_irqs (port);WARN_ON (ret);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 25/218 PCI: imx6: Add workaround for errata ERR051624
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Zhu <[email protected]>
[ Upstream commit ce0c43e855c7f652b6351110aaaabf9b521debd7 ]
ERR051624: The Controller Without Vaux Cannot Exit L23 Ready Through Beacon or PERST# De-assertion
When the auxiliary power is not available, the controller cannot exit from L23 Ready with beacon or PERST# de-assertion when main power is not removed. So the workaround is to set SS_RW_REG_1[SYS_AUX_PWR_DET] to 1.
This workaround is required irrespective of whether Vaux is supplied to the link partner or not.
--- drivers/pci/controller/dwc/pci-imx6.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/pci/controller/dwc/pci-imx6.c +15 -0
@@ -48,6 +48,8 @@#define IMX95_PCIE_SS_RW_REG_0 0xf0#define IMX95_PCIE_REF_CLKEN BIT(23)#define IMX95_PCIE_PHY_CR_PARA_SEL BIT(9) +#define IMX95_PCIE_SS_RW_REG_1 0xf4 +#define IMX95_PCIE_SYS_AUX_PWR_DET BIT(31)#define IMX95_PE0_GEN_CTRL_1 0x1050#define IMX95_PCIE_DEVICE_TYPE GENMASK(3, 0)
@@ -206,6 +208,19 @@ static unsigned int imx_pcie_grp_offset(const struct imx_pcie *imx_pcie)static int imx95_pcie_init_phy (struct imx_pcie *imx_pcie) { +/* +* ERR051624: The Controller Without Vaux Cannot Exit L23 Ready +* Through Beacon or PERST# De-assertion +* +* When the auxiliary power is not available, the controller +* cannot exit from L23 Ready with beacon or PERST# de-assertion +* when main power is not removed. +* +* Workaround: Set SS_RW_REG_1[SYS_AUX_PWR_DET] to 1. +*/ +regmap_set_bits (imx_pcie->iomuxc_gpr,IMX95_PCIE_SS_RW_REG_1 , +IMX95_PCIE_SYS_AUX_PWR_DET ); + regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_SS_RW_REG_0, IMX95_PCIE_PHY_CR_PARA_SEL,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 26/218 nvme-tcp: fix I/O stalls on congested sockets
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
[ Upstream commit f42d4796ee100fade86086d1cf98537fb4d326c8 ]
When the socket is busy processing nvme_tcp_try_recv() might return -EAGAIN, but this doesn't automatically imply that the sending side is blocked, too. So check if there are pending requests once nvme_tcp_try_recv() returns -EAGAIN and continue with the sending loop to avoid I/O stalls.
--- drivers/nvme/host/tcp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/nvme/host/tcp.c +6 -1
@@ -1349,7 +1349,7 @@ static int nvme_tcp_try_recv(struct nvme_tcp_queue *queue) queue->nr_cqe =0 ; consumed = sock->ops->read_sock (sk, &rd_desc, nvme_tcp_recv_skb);release_sock (sk); -return consumed; +return consumed == -EAGAIN ?0 : consumed; }static void nvme_tcp_io_work (struct work_struct *w)
@@ -1377,6 +1377,11 @@ static void nvme_tcp_io_work(struct work_struct *w)else if (unlikely (result <0 ))return ; +/* did we get some space after spending time in recv? */ +if (nvme_tcp_queue_has_pending (queue) && +sk_stream_is_writeable (queue->sock->sk)) + pending = true; +if (!pending || !queue->rd_enabled)return ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 27/218 nvme-tcp: sanitize request list handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
[ Upstream commit 0bf04c874fcb1ae46a863034296e4b33d8fbd66c ]
Validate the request in nvme_tcp_handle_r2t() to ensure it's not part of any list, otherwise a malicious R2T PDU might inject a loop in request list processing.
--- drivers/nvme/host/tcp.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/nvme/host/tcp.c +14 -1
@@ -453,7 +453,8 @@ nvme_tcp_fetch_request(struct nvme_tcp_queue *queue)return NULL ; } -list_del (&req->entry); +list_del_init (&req->entry); +init_llist_node (&req->lentry);return req; }
@@ -561,6 +562,8 @@ static int nvme_tcp_init_request(struct blk_mq_tag_set *set, req->queue = queue;nvme_req (rq)->ctrl = &ctrl->ctrl;nvme_req (rq)->cmd = &pdu->cmd; +init_llist_node (&req->lentry); +INIT_LIST_HEAD (&req->entry);return 0 ; }
@@ -765,6 +768,14 @@ static int nvme_tcp_handle_r2t(struct nvme_tcp_queue *queue,return -EPROTO ; } +if (llist_on_list (&req->lentry) || + !list_empty (&req->entry)) { +dev_err (queue->ctrl->ctrl.device, +"req %d unexpected r2t while processing request\n" , + rq->tag); +return -EPROTO ; + } + req->pdu_len =0 ; req->h2cdata_left = r2t_length; req->h2cdata_offset = r2t_offset;
@@ -2599,6 +2610,8 @@ static void nvme_tcp_submit_async_event(struct nvme_ctrl *arg) ctrl->async_req.offset =0 ; ctrl->async_req.curr_bio =NULL ; ctrl->async_req.data_len =0 ; +init_llist_node (&ctrl->async_req.lentry); +INIT_LIST_HEAD (&ctrl->async_req.entry);nvme_tcp_queue_request (&ctrl->async_req, true, true); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 28/218 md/md-bitmap: fix dm-raid max_write_behind setting
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 2afe17794cfed5f80295b1b9facd66e6f65e5002 ]
It's supposed to be COUNTER_MAX / 2, not COUNTER_MAX.
--- drivers/md/md-bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md-bitmap.c +1 -1
@@ -787,7 +787,7 @@ static int md_bitmap_new_disk_sb(struct bitmap *bitmap)* is a good choice? We choose COUNTER_MAX / 2 arbitrarily. */ write_behind = bitmap->mddev->bitmap_info.max_write_behind; -if (write_behind >COUNTER_MAX ) +if (write_behind >COUNTER_MAX /2 ) write_behind =COUNTER_MAX /2 ; sb->write_behind =cpu_to_le32 (write_behind); bitmap->mddev->bitmap_info.max_write_behind = write_behind;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 29/218 amd/amdkfd: fix a kfd_process ref leak
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifan Zhang <[email protected]>
[ Upstream commit 90237b16ec1d7afa16e2173cc9a664377214cdd9 ]
This patch is to fix a kfd_prcess ref leak.
--- drivers/gpu/drm/amd/amdkfd/kfd_events.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/kfd_events.c +1 -0
@@ -1315,6 +1315,7 @@ void kfd_signal_poison_consumed_event(struct kfd_node *dev, u32 pasid) user_gpu_id =kfd_process_get_user_gpu_id (p, dev->id);if (unlikely (user_gpu_id == -EINVAL )) {WARN_ONCE (1 ,"Could not get user_gpu_id from dev->id:%x\n" , dev->id); +kfd_unref_process (p);return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 30/218 bcache: fix NULL pointer in cache_set_flush()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linggang Zeng <[email protected]>
[ Upstream commit 1e46ed947ec658f89f1a910d880cd05e42d3763e ]
1. LINE#1794 - LINE#1887 is some codes about function of bch_cache_set_alloc().
2. LINE#2078 - LINE#2142 is some codes about function of register_cache_set().
3. register_cache_set() will call bch_cache_set_alloc() in LINE#2098.
1794 struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) 1795 {
...
1860 if (!(c->devices = kcalloc(c->nr_uuids, sizeof(void *), GFP_KERNEL)) ||
1861 mempool_init_slab_pool(&c->search, 32, bch_search_cache) ||
1862 mempool_init_kmalloc_pool(&c->bio_meta, 2,
1863 sizeof(struct bbio) + sizeof(struct bio_vec) *
1864 bucket_pages(c)) ||
1865 mempool_init_kmalloc_pool(&c->fill_iter, 1, iter_size) ||
1866 bioset_init(&c->bio_split, 4, offsetof(struct bbio, bio),
1867 BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER) ||
1868 !(c->uuids = alloc_bucket_pages(GFP_KERNEL, c)) ||
1869 !(c->moving_gc_wq = alloc_workqueue("bcache_gc",
1870 WQ_MEM_RECLAIM, 0)) ||
1871 bch_journal_alloc(c) ||
1872 bch_btree_cache_alloc(c) ||
1873 bch_open_buckets_alloc(c) ||
1874 bch_bset_sort_state_init(&c->sort, ilog2(c->btree_pages)))
1875 goto err;
^^^^^^^^
1876
...
1883 return c;
1884 err:
1885 bch_cache_set_unregister(c);
^^^^^^^^^^^^^^^^^^^^^^^^^^^
1886 return NULL;
1887 }
...
2078 static const char *register_cache_set(struct cache *ca)
2079 {
...
2098 c = bch_cache_set_alloc(&ca->sb);
2099 if (!c)
2100 return err;
^^^^^^^^^^
...
2128 ca->set = c;
2129 ca->set->cache[ca->sb.nr_this_dev] = ca;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...
2138 return NULL;
2139 err:
2140 bch_cache_set_unregister(c);
2141 return err;
2142 }
(1) If LINE#1860 - LINE#1874 is true, then do 'goto err'(LINE#1875) and
call bch_cache_set_unregister()(LINE#1885).
(2) As (1) return NULL(LINE#1886), LINE#2098 - LINE#2100 would return.
(3) As (2) has returned, LINE#2128 - LINE#2129 would do *not* give the
value to c->cache[], it means that c->cache[] is NULL.LINE#1624 - LINE#1665 is some codes about function of cache_set_flush(). As (1), in LINE#1885 callbch_cache_set_unregister()
---> bch_cache_set_stop()
---> closure_queue()
-.-> cache_set_flush() (as below LINE#1624) 1624 static void cache_set_flush(struct closure *cl) 1625 {
...
1654 for_each_cache(ca, c, i)
1655 if (ca->alloc_thread)
^^
1656 kthread_stop(ca->alloc_thread);
...
1665 }
(4) In LINE#1655 ca is NULL(see (3)) in cache_set_flush() then the kernel crash occurred as below:
[ 846.712887] bcache: register_cache() error drbd6: cannot allocate memory [ 846.713242] bcache: register_bcache() error : failed to register device [ 846.713336] bcache: cache_set_free() Cache set 2f84bdc1-498a-4f2f-98a7-01946bf54287 unregistered [ 846.713768] BUG: unable to handle kernel NULL pointer dereference at 00000000000009f8 [ 846.714790] PGD 0 P4D 0 [ 846.715129] Oops: 0000 [#1] SMP PTI [ 846.715472] CPU: 19 PID: 5057 Comm: kworker/19:16 Kdump: loaded Tainted: G OE --------- - - 4.18.0-147.5.1.el8_1.5es.3.x86_64 #1 [ 846.716082] Hardware name: ESPAN GI-25212/X11DPL-i, BIOS 2.1 06/15/2018 [ 846.716451] Workqueue: events cache_set_flush [bcache] [ 846.716808] RIP: 0010:cache_set_flush+0xc9/0x1b0 [bcache] [ 846.717155] Code: 00 4c 89 a5 b0 03 00 00 48 8b 85 68 f6 ff ff a8 08 0f 84 88 00 00 00 31 db 66 83 bd 3c f7 ff ff 00 48 8b 85 48 ff ff ff 74 28 <48> 8b b8 f8 09 00 00 48 85 ff 74 05 e8 b6 58 a2 e1 0f b7 95 3c f7 [ 846.718026] RSP: 0018:ffffb56dcf85fe70 EFLAGS: 00010202 [ 846.718372] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 [ 846.718725] RDX: 0000000000000001 RSI: 0000000040000001 RDI: 0000000000000000 [ 846.719076] RBP: ffffa0ccc0f20df8 R08: ffffa0ce1fedb118 R09: 000073746e657665 [ 846.719428] R10: 8080808080808080 R11: 0000000000000000 R12: ffffa0ce1fee8700 [ 846.719779] R13: ffffa0ccc0f211a8 R14: ffffa0cd1b902840 R15: ffffa0ccc0f20e00 [ 846.720132] FS: 0000000000000000(0000) GS:ffffa0ce1fec0000(0000) knlGS:0000000000000000 [ 846.720726] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 846.721073] CR2: 00000000000009f8 CR3: 00000008ba00a005 CR4: 00000000007606e0 [ 846.721426] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 846.721778] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 846.722131] PKRU: 55555554 [ 846.722467] Call Trace: [ 846.722814] process_one_work+0x1a7/0x3b0 [ 846.723157] worker_thread+0x30/0x390 [ 846.723501] ? create_worker+0x1a0/0x1a0 [ 846.723844] kthread+0x112/0x130 [ 846.724184] ? kthread_flush_work_fn+0x10/0x10 [ 846.724535] ret_from_fork+0x35/0x40
Now, check whether that ca is NULL in LINE#1655 to fix the issue.
--- drivers/md/bcache/super.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/md/bcache/super.c +6 -1
@@ -1733,7 +1733,12 @@ static CLOSURE_CALLBACK(cache_set_flush)mutex_unlock (&b->write_lock); } -if (ca->alloc_thread) +/* +* If the register_cache_set() call to bch_cache_set_alloc() failed, +* ca has not been assigned a value and return error. +* So we need check ca is not NULL during bch_cache_set_unregister(). +*/ +if (ca && ca->alloc_thread)kthread_stop (ca->alloc_thread);if (c->journal.cur) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 31/218 drm/amdgpu: seq64 memory unmap uses uninterruptible lock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philip Yang <[email protected]>
[ Upstream commit a359288ccb4dd8edb086e7de8fdf6e36f544c922 ]
To unmap and free seq64 memory when drm node close to free vm, if there is signal accepted, then taking vm lock failed and leaking seq64 va mapping, and then dmesg has error log "still active bo inside vm".
Change to use uninterruptible lock fix the mapping leaking and no dmesg error log.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c +1 -1
@@ -133,7 +133,7 @@ void amdgpu_seq64_unmap(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv) vm = &fpriv->vm; -drm_exec_init (&exec,DRM_EXEC_INTERRUPTIBLE_WAIT ,0 ); +drm_exec_init (&exec,0 ,0 ); drm_exec_until_all_locked(&exec) { r =amdgpu_vm_lock_pd (vm, &exec,0 );if (likely (!r))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 32/218 drm/scheduler: signal scheduled fence when kill job
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin.Cao <[email protected]>
[ Upstream commit 471db2c2d4f80ee94225a1ef246e4f5011733e50 ]
When an entity from application B is killed, drm_sched_entity_kill() removes all jobs belonging to that entity through drm_sched_entity_kill_jobs_work(). If application A's job depends on a scheduled fence from application B's job, and that fence is not properly signaled during the killing process, application A's dependency cannot be cleared.
This leads to application A hanging indefinitely while waiting for a dependency that will never be resolved. Fix this issue by ensuring that scheduled fences are properly signaled when an entity is killed, allowing dependent applications to continue execution.
--- drivers/gpu/drm/scheduler/sched_entity.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/scheduler/sched_entity.c +1 -0
@@ -189,6 +189,7 @@ static void drm_sched_entity_kill_jobs_work(struct work_struct *wrk) {struct drm_sched_job *job =container_of (wrk,typeof (*job), work); +drm_sched_fence_scheduled (job->s_fence,NULL );drm_sched_fence_finished (job->s_fence, -ESRCH );WARN_ON (job->s_fence->parent); job->sched->ops->free_job (job);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 33/218 iio: pressure: zpa2326: Use aligned_s64 for the timestamp
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
[ Upstream commit 886a446b76afddfad307488e95e87f23a08ffd51 ]
On x86_32 s64 fields are only 32-bit aligned. Hence force the alignment of the field and padding in the structure by using aligned_s64 instead.
--- drivers/iio/pressure/zpa2326.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/pressure/zpa2326.c +1 -1
@@ -582,7 +582,7 @@ static int zpa2326_fill_sample_buffer(struct iio_dev *indio_dev,struct {u32 pressure;u16 temperature; -u64 timestamp; +aligned_s64 timestamp; } sample;int err;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 34/218 um: Add cmpxchg8b_emu and checksum functions to asm-prototypes.h
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sami Tolvanen <[email protected]>
[ Upstream commit 674d03f6bd6b0f8327f1a4920ff5893557facfbd ]
With CONFIG_GENDWARFKSYMS, um builds fail due to missing prototypes in asm/asm-prototypes.h. Add declarations for cmpxchg8b_emu and the exported checksum functions, including csum_partial_copy_generic as it's also exported.
--- arch/um/include/asm/asm-prototypes.h | 5 +++++ arch/x86/um/asm/checksum.h | 3 +++ 2 files changed, 8 insertions(+)
arch/um/include/asm/asm-prototypes.h +5 -0
@@ -1 +1,6 @@#include <asm-generic/asm-prototypes.h> +#include <asm/checksum.h> + +#ifdef CONFIG_UML_X86 +extern void cmpxchg8b_emu (void ); +#endif
arch/x86/um/asm/checksum.h +3 -0
@@ -20,6 +20,9 @@*/ extern __wsum csum_partial (const void *buff,int len,__wsum sum); +/* Do not call this directly. Declared for export type visibility. */ +extern __visible __wsum csum_partial_copy_generic(const void *src, void *dst, int len); +/** * csum_fold - Fold and invert a 32bit checksum. * sum: 32bit unfolded sum
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 35/218 um: use proper care when taking mmap lock during segfault
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Berg <[email protected]>
[ Upstream commit 6767e8784cd2e8b386a62330ea6864949d983a3e ]
Segfaults can occur at times where the mmap lock cannot be taken. If that happens the segfault handler may not be able to take the mmap lock.
Fix the code to use the same approach as most other architectures. Unfortunately, this requires copying code from mm/memory.c and modifying it slightly as UML does not have exception tables.
--- arch/um/kernel/trap.c | 129 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 117 insertions(+), 12 deletions(-)
arch/um/kernel/trap.c +117 -12
@@ -17,6 +17,122 @@#include <os.h> #include <skas.h> +/* +* NOTE: UML does not have exception tables. As such, this is almost a copy +* of the code in mm/memory.c, only adjusting the logic to simply check whether +* we are coming from the kernel instead of doing an additional lookup in the +* exception table. +* We can do this simplification because we never get here if the exception was +* fixable. +*/ +static inline bool get_mmap_lock_carefully (struct mm_struct *mm,bool is_user) +{ +if (likely (mmap_read_trylock (mm))) +return true; + +if (!is_user) +return false; + +return !mmap_read_lock_killable (mm); +} + +static inline bool mmap_upgrade_trylock (struct mm_struct *mm) +{ +/* +* We don't have this operation yet. +* +* It should be easy enough to do: it's basically a +* atomic_long_try_cmpxchg_acquire() +* from RWSEM_READER_BIAS -> RWSEM_WRITER_LOCKED, but +* it also needs the proper lockdep magic etc. +*/ +return false; +} + +static inline bool upgrade_mmap_lock_carefully (struct mm_struct *mm,bool is_user) +{ +mmap_read_unlock (mm); +if (!is_user) +return false; + +return !mmap_write_lock_killable (mm); +} + +/* +* Helper for page fault handling. +* +* This is kind of equivalend to "mmap_read_lock()" followed +* by "find_extend_vma()", except it's a lot more careful about +* the locking (and will drop the lock on failure). +* +* For example, if we have a kernel bug that causes a page +* fault, we don't want to just use mmap_read_lock() to get +* the mm lock, because that would deadlock if the bug were +* to happen while we're holding the mm lock for writing. +* +* So this checks the exception tables on kernel faults in +* order to only do this all for instructions that are actually +* expected to fault. +* +* We can also actually take the mm lock for writing if we +* need to extend the vma, which helps the VM layer a lot. +*/ +static struct vm_area_struct * +um_lock_mm_and_find_vma (struct mm_struct *mm, +unsigned long addr,bool is_user) +{ +struct vm_area_struct *vma; + +if (!get_mmap_lock_carefully (mm, is_user)) +return NULL ; + + vma =find_vma (mm, addr); +if (likely (vma && (vma->vm_start <= addr))) +return vma; + +/* +* Well, dang. We might still be successful, but only +* if we can extend a vma to do so. +*/ +if (!vma || !(vma->vm_flags &VM_GROWSDOWN )) { +mmap_read_unlock (mm); +return NULL ; + } + +/* +* We can try to upgrade the mmap lock atomically, +* in which case we can continue to use the vma +* we already looked up. +* +* Otherwise we'll have to drop the mmap lock and +* re-take it, and also look up the vma again, +* re-checking it. +*/ +if (!mmap_upgrade_trylock (mm)) { +if (!upgrade_mmap_lock_carefully (mm, is_user)) +return NULL ; + + vma =find_vma (mm, addr); +if (!vma) + goto fail; +if (vma->vm_start <= addr) + goto success; +if (!(vma->vm_flags &VM_GROWSDOWN )) + goto fail; + } + +if (expand_stack_locked (vma, addr)) + goto fail; + +success: +mmap_write_downgrade (mm); +return vma; + +fail: +mmap_write_unlock (mm); +return NULL ; +} +/* * Note this is constrained to return 0, -EFAULT, -EACCES, -ENOMEM by * segv().
@@ -43,21 +159,10 @@ int handle_page_fault(unsigned long address, unsigned long ip,if (is_user) flags |=FAULT_FLAG_USER ; retry: -mmap_read_lock (mm); - vma =find_vma (mm, address); -if (!vma) - goto out; -if (vma->vm_start <= address) - goto good_area; -if (!(vma->vm_flags &VM_GROWSDOWN )) - goto out; -if (is_user && !ARCH_IS_STACKGROW (address)) - goto out; - vma =expand_stack (mm, address); + vma =um_lock_mm_and_find_vma (mm, address, is_user);if (!vma) goto out_nosemaphore; -good_area: *code_out =SEGV_ACCERR ;if (is_write) {if (!(vma->vm_flags &VM_WRITE ))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 36/218 8250: microchip: pci1xxxx: Add PCIe Hot reset disable support for Rev C0 and later devices
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rengarajan S <[email protected]>
[ Upstream commit c40b91e38eb8d4489def095d62ab476d45871323 ]
Systems that issue PCIe hot reset requests during a suspend/resume cycle cause PCI1XXXX device revisions prior to C0 to get its UART configuration registers reset to hardware default values. This results in device inaccessibility and data transfer failures. Starting with Revision C0, support was added in the device hardware (via the Hot Reset Disable Bit) to allow resetting only the PCIe interface and its associated logic, but preserving the UART configuration during a hot reset. This patch enables the hot reset disable feature during suspend/ resume for C0 and later revisions of the device.
--- drivers/tty/serial/8250/8250_pci1xxxx.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/tty/serial/8250/8250_pci1xxxx.c +10 -0
@@ -115,6 +115,7 @@#define UART_RESET_REG 0x94#define UART_RESET_D3_RESET_DISABLE BIT(16) +#define UART_RESET_HOT_RESET_DISABLE BIT(17)#define UART_BURST_STATUS_REG 0x9C#define UART_TX_BURST_FIFO 0xA0
@@ -620,6 +621,10 @@ static int pci1xxxx_suspend(struct device *dev) } data =readl (p +UART_RESET_REG ); + +if (priv->dev_rev >=0xC0 ) + data |=UART_RESET_HOT_RESET_DISABLE ; +writel (data |UART_RESET_D3_RESET_DISABLE , p +UART_RESET_REG );if (wakeup)
@@ -647,7 +652,12 @@ static int pci1xxxx_resume(struct device *dev) } data =readl (p +UART_RESET_REG ); + +if (priv->dev_rev >=0xC0 ) + data &= ~UART_RESET_HOT_RESET_DISABLE ; +writel (data & ~UART_RESET_D3_RESET_DISABLE , p +UART_RESET_REG ); +iounmap (p);for (i =0 ; i < priv->nr; i++) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 37/218 coresight: Only check bottom two claim bits
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <[email protected]>
[ Upstream commit a4e65842e1142aa18ef36113fbd81d614eaefe5a ]
The use of the whole register and == could break the claim mechanism if any of the other bits are used in the future. The referenced doc "PSCI - ARM DEN 0022D" also says to only read and clear the bottom two bits.
Use FIELD_GET() to extract only the relevant part.
--- drivers/hwtracing/coresight/coresight-core.c | 3 ++- drivers/hwtracing/coresight/coresight-priv.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-core.c +2 -1
@@ -97,7 +97,8 @@ coresight_find_out_connection(struct coresight_device *src_dev,static inline u32 coresight_read_claim_tags (struct coresight_device *csdev) { -return csdev_access_relaxed_read32 (&csdev->access,CORESIGHT_CLAIMCLR ); +return FIELD_GET (CORESIGHT_CLAIM_MASK , +csdev_access_relaxed_read32 (&csdev->access,CORESIGHT_CLAIMCLR )); }static inline bool coresight_is_claimed_self_hosted (struct coresight_device *csdev)
drivers/hwtracing/coresight/coresight-priv.h +1 -0
@@ -35,6 +35,7 @@ extern const struct device_type coresight_dev_type[];* Coresight device CLAIM protocol. * See PSCI - ARM DEN 0022D, Section: 6.8.1 Debug and Trace save and restore. */ +#define CORESIGHT_CLAIM_MASK GENMASK(1, 0)#define CORESIGHT_CLAIM_SELF_HOSTED BIT(1)#define TIMEOUT_US 100
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 38/218 usb: dwc2: also exit clock_gating when stopping udc while suspended
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Grzeschik <[email protected]>
[ Upstream commit af076a41f8a28faf9ceb9dd2d88aef2c202ef39a ]
It is possible that the gadget will be disabled, while the udc is suspended. When enabling the udc in that case, the clock gating will not be enabled again. Leaving the phy unclocked. Even when the udc is not enabled, connecting this powered but not clocked phy leads to enumeration errors on the host side.
To ensure that the clock gating will be in an valid state, we ensure that the clock gating will be enabled before stopping the udc.
--- drivers/usb/dwc2/gadget.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/dwc2/gadget.c +6 -0
@@ -4604,6 +4604,12 @@ static int dwc2_hsotg_udc_stop(struct usb_gadget *gadget)if (!hsotg)return -ENODEV ; +/* Exit clock gating when driver is stopped. */ +if (hsotg->params.power_down ==DWC2_POWER_DOWN_PARAM_NONE && + hsotg->bus_suspended && !hsotg->params.no_clock_gating) { +dwc2_gadget_exit_clock_gating (hsotg,0 ); + } +/* all endpoints should be shutdown */ for (ep =1 ; ep < hsotg->num_of_eps; ep++) {if (hsotg->eps_in[ep])
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 39/218 iio: adc: ad_sigma_delta: Fix use of uninitialized status_pos
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Purva Yeshi <[email protected]>
[ Upstream commit e5cdb098a3cb165d52282ffc3a6448642953ea13 ]
Fix Smatch-detected issue:drivers/iio/adc/ad_sigma_delta.c:604 ad_sd_trigger_handler() error:
uninitialized symbol 'status_pos'.
The variable status_pos was only initialized in specific switch cases (1, 2, 3, 4), which could leave it uninitialized if reg_size had an unexpected value.
Fix by adding a default case to the switch block to catch unexpected values of reg_size. Use dev_err_ratelimited() for error logging and goto irq_handled instead of returning early.
--- drivers/iio/adc/ad_sigma_delta.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/iio/adc/ad_sigma_delta.c +4 -0
@@ -477,6 +477,10 @@ static irqreturn_t ad_sd_trigger_handler(int irq, void *p)* byte set to zero. */ ad_sd_read_reg_raw (sigma_delta, data_reg, transfer_size, &data[1 ]);break ; + +default : +dev_err_ratelimited (&indio_dev->dev,"Unsupported reg_size: %u\n" , reg_size); + goto irq_handled; }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 40/218 misc: tps6594-pfsm: Add NULL pointer check in tps6594_pfsm_probe()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenyuan Yang <[email protected]>
[ Upstream commit a99b598d836c9c6411110c70a2da134c78d96e67 ]
The returned value, pfsm->miscdev.name, from devm_kasprintf() could be NULL.
A pointer check is added to prevent potential NULL pointer dereference. This is similar to the fix in commit 3027e7b15b02
("ice: Fix some null pointer dereference issues in ice_ptp.c").
This issue is found by our static analysis tool.
--- drivers/misc/tps6594-pfsm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/misc/tps6594-pfsm.c +3 -0
@@ -281,6 +281,9 @@ static int tps6594_pfsm_probe(struct platform_device *pdev) pfsm->miscdev.minor =MISC_DYNAMIC_MINOR ; pfsm->miscdev.name =devm_kasprintf (dev,GFP_KERNEL ,"pfsm-%ld-0x%02x" , tps->chip_id, tps->reg); +if (!pfsm->miscdev.name) +return -ENOMEM ; + pfsm->miscdev.fops = &tps6594_pfsm_fops; pfsm->miscdev.parent = dev->parent; pfsm->chip_id = tps->chip_id;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 41/218 usb: potential integer overflow in usbg_make_tpg()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Yufeng <[email protected]>
[ Upstream commit 153874010354d050f62f8ae25cbb960c17633dc5 ]
The variable tpgt in usbg_make_tpg() is defined as unsigned long and is assigned to tpgt->tport_tpgt, which is defined as u16. This may cause an integer overflow when tpgt is greater than USHRT_MAX (65535). I haven't tried to trigger it myself, but it is possible to trigger it by calling usbg_make_tpg() with a large value for tpgt.
I modified the type of tpgt to match tpgt->tport_tpgt and adjusted the relevant code accordingly.
This patch is similar to commit 59c816c1f24d ("vhost/scsi: potential memory corruption").
--- drivers/usb/gadget/function/f_tcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_tcm.c +2 -2
@@ -1297,14 +1297,14 @@ static struct se_portal_group *usbg_make_tpg(struct se_wwn *wwn, struct usbg_tport *tport = container_of(wwn, struct usbg_tport, tport_wwn);struct usbg_tpg *tpg; -unsigned long tpgt; +u16 tpgt;int ret;struct f_tcm_opts *opts;unsigned i;if (strstr (name,"tpgt_" ) != name)return ERR_PTR (-EINVAL ); -if (kstrtoul (name +5 ,0 , &tpgt) || tpgt >UINT_MAX ) +if (kstrtou16 (name +5 ,0 , &tpgt))return ERR_PTR (-EINVAL ); ret = -ENODEV ;mutex_lock (&tpg_instances_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 42/218 tty: serial: uartlite: register uart driver in init
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Lewalski <[email protected]>
[ Upstream commit 6bd697b5fc39fd24e2aa418c7b7d14469f550a93 ]
When two instances of uart devices are probing, a concurrency race can occur. If one thread calls uart_register_driver function, which first allocates and assigns memory to 'uart_state' member of uart_driver structure, the other instance can bypass uart driver registration and call ulite_assign. This calls uart_add_one_port, which expects the uart driver to be fully initialized. This leads to a kernel panic due to a null pointer dereference:
[ 8.143581] BUG: kernel NULL pointer dereference, address: 00000000000002b8 [ 8.156982] #PF: supervisor write access in kernel mode [ 8.156984] #PF: error_code(0x0002) - not-present page [ 8.156986] PGD 0 P4D 0 ... [ 8.180668] RIP: 0010:mutex_lock+0x19/0x30 [ 8.188624] Call Trace: [ 8.188629] ? __die_body.cold+0x1a/0x1f [ 8.195260] ? page_fault_oops+0x15c/0x290 [ 8.209183] ? __irq_resolve_mapping+0x47/0x80 [ 8.209187] ? exc_page_fault+0x64/0x140 [ 8.209190] ? asm_exc_page_fault+0x22/0x30 [ 8.209196] ? mutex_lock+0x19/0x30 [ 8.223116] uart_add_one_port+0x60/0x440 [ 8.223122] ? proc_tty_register_driver+0x43/0x50 [ 8.223126] ? tty_register_driver+0x1ca/0x1e0 [ 8.246250] ulite_probe+0x357/0x4b0 [uartlite]
To prevent it, move uart driver registration in to init function. This will ensure that uart_driver is always registered when probe function is called.
--- drivers/tty/serial/uartlite.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
drivers/tty/serial/uartlite.c +12 -13
@@ -880,16 +880,6 @@ static int ulite_probe(struct platform_device *pdev)pm_runtime_set_active (&pdev->dev);pm_runtime_enable (&pdev->dev); -if (!ulite_uart_driver.state) { -dev_dbg (&pdev->dev,"uartlite: calling uart_register_driver()\n" ); - ret =uart_register_driver (&ulite_uart_driver); -if (ret <0 ) { -dev_err (&pdev->dev,"Failed to register driver\n" ); -clk_disable_unprepare (pdata->clk); -return ret; - } - } - ret =ulite_assign (&pdev->dev, id, res->start, irq, pdata);pm_runtime_mark_last_busy (&pdev->dev);
@@ -929,16 +919,25 @@ static struct platform_driver ulite_platform_driver = {static int __init ulite_init (void ) { +int ret; + +pr_debug ("uartlite: calling uart_register_driver()\n" ); + ret =uart_register_driver (&ulite_uart_driver); +if (ret) +return ret;pr_debug ("uartlite: calling platform_driver_register()\n" ); -return platform_driver_register (&ulite_platform_driver); + ret =platform_driver_register (&ulite_platform_driver); +if (ret) +uart_unregister_driver (&ulite_uart_driver); + +return ret; } static void __exit ulite_exit(void) {platform_driver_unregister (&ulite_platform_driver); -if (ulite_uart_driver.state) -uart_unregister_driver (&ulite_uart_driver); +uart_unregister_driver (&ulite_uart_driver); }module_init (ulite_init);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 43/218 usb: common: usb-conn-gpio: use a unique name for usb connector device
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chance Yang <[email protected]>
[ Upstream commit d4e5b10c55627e2f3fc9e5b337a28b4e2f02a55e ]
The current implementation of the usb-conn-gpio driver uses a fixed "usb-charger" name for all USB connector devices. This causes conflicts in the power supply subsystem when multiple USB connectors are present, as duplicate names are not allowed.
Use IDA to manage unique IDs for naming usb connectors (e.g., usb-charger-0, usb-charger-1).
--- drivers/usb/common/usb-conn-gpio.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
drivers/usb/common/usb-conn-gpio.c +22 -3
@@ -20,6 +20,9 @@#include <linux/power_supply.h> #include <linux/regulator/consumer.h> #include <linux/usb/role.h> +#include <linux/idr.h> + +static DEFINE_IDA (usb_conn_ida);#define USB_GPIO_DEB_MS 20/* ms */ #define USB_GPIO_DEB_US ((USB_GPIO_DEB_MS) * 1000)/* us */
@@ -29,6 +32,7 @@struct usb_conn_info {struct device *dev; +int conn_id;/* store the IDA-allocated ID */ struct usb_role_switch *role_sw;enum usb_role last_role;struct regulator *vbus;
@@ -160,7 +164,17 @@ static int usb_conn_psy_register(struct usb_conn_info *info) .of_node = dev->of_node, }; - desc->name ="usb-charger" ; + info->conn_id =ida_alloc (&usb_conn_ida,GFP_KERNEL ); +if (info->conn_id <0 ) +return info->conn_id; + + desc->name =devm_kasprintf (dev,GFP_KERNEL ,"usb-charger-%d" , + info->conn_id); +if (!desc->name) { +ida_free (&usb_conn_ida, info->conn_id); +return -ENOMEM ; + } + desc->properties = usb_charger_properties; desc->num_properties =ARRAY_SIZE (usb_charger_properties); desc->get_property = usb_charger_get_property;
@@ -168,8 +182,10 @@ static int usb_conn_psy_register(struct usb_conn_info *info) cfg.drv_data = info; info->charger =devm_power_supply_register (dev, desc, &cfg); -if (IS_ERR (info->charger)) -dev_err (dev,"Unable to register charger\n" ); +if (IS_ERR (info->charger)) { +dev_err (dev,"Unable to register charger %d\n" , info->conn_id); +ida_free (&usb_conn_ida, info->conn_id); + }return PTR_ERR_OR_ZERO (info->charger); }
@@ -277,6 +293,9 @@ static void usb_conn_remove(struct platform_device *pdev)cancel_delayed_work_sync (&info->dw_det); +if (info->charger) +ida_free (&usb_conn_ida, info->conn_id); +if (info->last_role ==USB_ROLE_HOST && info->vbus)regulator_disable (info->vbus);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 44/218 usb: Add checks for snprintf() calls in usb_alloc_dev()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 82fe5107fa3d21d6c3fba091c9dbc50495588630 ]
When creating a device path in the driver the snprintf() takes up to 16 characters long argument along with the additional up to 12 characters for the signed integer (as it can't see the actual limits) and tries to pack this into 16 bytes array. GCC complains about that when build with make W=1:
drivers/usb/core/usb.c:705:25: note: ‘snprintf’ output between 3 and 28 bytes into a destination of size 16
Since everything works until now, let's just check for the potential buffer overflow and bail out. It is most likely a never happen situation, but at least it makes GCC happy.
--- drivers/usb/core/usb.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/usb/core/usb.c +10 -4
@@ -695,15 +695,16 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,device_set_of_node_from_dev (&dev->dev, bus->sysdev);dev_set_name (&dev->dev,"usb%d" , bus->busnum); }else { +int n; +/* match any labeling on the hubs; it's one-based */ if (parent->devpath[0 ] =='0' ) { -snprintf (dev->devpath,sizeof dev->devpath, -"%d" , port1); + n =snprintf (dev->devpath,sizeof (dev->devpath),"%d" , port1);/* Root ports are not counted in route string */ dev->route =0 ; }else { -snprintf (dev->devpath,sizeof dev->devpath, -"%s.%d" , parent->devpath, port1); + n =snprintf (dev->devpath,sizeof (dev->devpath),"%s.%d" , + parent->devpath, port1);/* Route string assumes hubs have less than 16 ports */ if (port1 <15 ) dev->route = parent->route +
@@ -712,6 +713,11 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, dev->route = parent->route + (15 << ((parent->level -1 )*4 )); } +if (n >=sizeof (dev->devpath)) { +usb_put_hcd (bus_to_hcd (bus)); +usb_put_dev (dev); +return NULL ; + } dev->dev.parent = &parent->dev;dev_set_name (&dev->dev,"%d-%s" , bus->busnum, dev->devpath);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 45/218 usb: cdc-wdm: avoid setting WDM_READ for ZLP-s
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Hodaszi <[email protected]>
[ Upstream commit 387602d8a75574fafb451b7a8215e78dfd67ee63 ]
Don't set WDM_READ flag in wdm_in_callback() for ZLP-s, otherwise when userspace tries to poll for available data, it might - incorrectly - believe there is something available, and when it tries to non-blocking read it, it might get stuck in the read loop.
For example this is what glib does for non-blocking read (briefly):
1. poll()
2. if poll returns with non-zero, starts a read data loop:
a. loop on poll() (EINTR disabled)
b. if revents was set, reads data
I. if read returns with EINTR or EAGAIN, goto 2.a. II. otherwise return with data
So if ZLP sets WDM_READ (#1), we expect data, and try to read it (#2). But as that was a ZLP, and we are doing non-blocking read, wdm_read() returns with EAGAIN (#2.b.I), so loop again, and try to read again (#2.a.).
With glib, we might stuck in this loop forever, as EINTR is disabled (#2.a).
--- drivers/usb/class/cdc-wdm.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
drivers/usb/class/cdc-wdm.c +9 -14
@@ -92,7 +92,6 @@ struct wdm_device {u16 wMaxCommand;u16 wMaxPacketSize;__le16 inum; -int reslength;int length;int read;int count;
@@ -214,6 +213,11 @@ static void wdm_in_callback(struct urb *urb)if (desc->rerr ==0 && status != -EPIPE ) desc->rerr = status; +if (length ==0 ) { +dev_dbg (&desc->intf->dev,"received ZLP\n" ); + goto skip_zlp; + } +if (length + desc->length > desc->wMaxCommand) {/* The buffer would overflow */ set_bit (WDM_OVERFLOW , &desc->flags);
@@ -222,18 +226,18 @@ static void wdm_in_callback(struct urb *urb)if (!test_bit (WDM_OVERFLOW , &desc->flags)) {memmove (desc->ubuf + desc->length, desc->inbuf, length); desc->length += length; - desc->reslength = length; } } skip_error:if (desc->rerr) {/* -* Since there was an error, userspace may decide to not read -* any data after poll'ing. +* If there was a ZLP or an error, userspace may decide to not +* read any data after poll'ing. * We should respond to further attempts from the device to send * data, so that we can get unstuck. */ +skip_zlp:schedule_work (&desc->service_outs_intr); }else {set_bit (WDM_READ , &desc->flags);
@@ -585,15 +589,6 @@ static ssize_t wdm_read goto retry; } -if (!desc->reslength) {/* zero length read */ -dev_dbg (&desc->intf->dev,"zero length - clearing WDM_READ\n" ); -clear_bit (WDM_READ , &desc->flags); - rv =service_outstanding_interrupt (desc); -spin_unlock_irq (&desc->iuspin); -if (rv <0 ) - goto err; - goto retry; - } cntr = desc->length;spin_unlock_irq (&desc->iuspin); }
@@ -1016,7 +1011,7 @@ static void service_interrupt_work(struct work_struct *work)spin_lock_irq (&desc->iuspin);service_outstanding_interrupt (desc); -if (!desc->resp_count) { +if (!desc->resp_count && (desc->length || desc->rerr)) {set_bit (WDM_READ , &desc->flags);wake_up (&desc->wait); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 46/218 usb: gadget: f_hid: wake up readers on disable/unbind
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Korsgaard <[email protected]>
[ Upstream commit 937a8a3a8d46a3377b4195cd8f2aa656666ebc8b ]
Similar to how it is done in the write path.
Add a disabled flag to track the function state and use it to exit the read loops to ensure no readers get stuck when the function is disabled/unbound, protecting against corruption when the waitq and spinlocks are reinitialized in hidg_bind().
--- drivers/usb/gadget/function/f_hid.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_hid.c +17 -2
@@ -75,6 +75,7 @@ struct f_hidg {/* recv report */ spinlock_t read_spinlock;wait_queue_head_t read_queue; +bool disabled;/* recv report - interrupt out only (use_out_ep == 1) */ struct list_head completed_out_req;unsigned int qlen;
@@ -329,7 +330,7 @@ static ssize_t f_hidg_intout_read(struct file *file, char __user *buffer,spin_lock_irqsave (&hidg->read_spinlock, flags); -#define READ_COND_INTOUT (!list_empty(&hidg->completed_out_req)) +#define READ_COND_INTOUT (!list_empty(&hidg->completed_out_req) || hidg->disabled)/* wait for at least one buffer to complete */ while (!READ_COND_INTOUT ) {
@@ -343,6 +344,11 @@ static ssize_t f_hidg_intout_read(struct file *file, char __user *buffer,spin_lock_irqsave (&hidg->read_spinlock, flags); } +if (hidg->disabled) { +spin_unlock_irqrestore (&hidg->read_spinlock, flags); +return -ESHUTDOWN ; + } +/* pick the first one */ list =list_first_entry (&hidg->completed_out_req, struct f_hidg_req_list, list);
@@ -387,7 +393,7 @@ static ssize_t f_hidg_intout_read(struct file *file, char __user *buffer,return count; } -#define READ_COND_SSREPORT (hidg->set_report_buf != NULL) +#define READ_COND_SSREPORT (hidg->set_report_buf != NULL || hidg->disabled)static ssize_t f_hidg_ssreport_read (struct file *file,char __user *buffer,size_t count,loff_t *ptr)
@@ -1012,6 +1018,11 @@ static void hidg_disable(struct usb_function *f) }spin_unlock_irqrestore (&hidg->get_report_spinlock, flags); +spin_lock_irqsave (&hidg->read_spinlock, flags); + hidg->disabled = true; +spin_unlock_irqrestore (&hidg->read_spinlock, flags); +wake_up (&hidg->read_queue); +spin_lock_irqsave (&hidg->write_spinlock, flags);if (!hidg->write_pending) {free_ep_req (hidg->in_ep, hidg->req);
@@ -1097,6 +1108,10 @@ static int hidg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) } } +spin_lock_irqsave (&hidg->read_spinlock, flags); + hidg->disabled = false; +spin_unlock_irqrestore (&hidg->read_spinlock, flags); +if (hidg->in_ep !=NULL ) {spin_lock_irqsave (&hidg->write_spinlock, flags); hidg->req = req_in;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 47/218 usb: typec: displayport: Receive DP Status Update NAK request exit dp altmode
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jos Wang <[email protected]>
[ Upstream commit b4b38ffb38c91afd4dc387608db26f6fc34ed40b ]
Although some Type-C DRD devices that do not support the DP Sink function (such as Huawei Mate 40Pro), the Source Port initiates Enter Mode CMD, but the device responds to Enter Mode ACK, the Source port then initiates DP Status Update CMD, and the device responds to DP Status Update NAK.
As PD2.0 spec ("6.4.4.3.4 Enter Mode Command"),A DR_Swap Message Shall Not be sent during Modal Operation between the Port Partners. At this time, the source port initiates DR_Swap message through the "echo device > /sys/class/typec/port0/data_role" command to switch the data role from host to device. The device will initiate a Hard Reset for recovery, resulting in the failure of data role swap.
Therefore, when DP Status Update NAK is received, Exit Mode CMD is initiated to exit the currently entered DP altmode.
--- drivers/usb/typec/altmodes/displayport.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/typec/altmodes/displayport.c +4 -0
@@ -393,6 +393,10 @@ static int dp_altmode_vdm(struct typec_altmode *alt,break ;case CMDT_RSP_NAK :switch (cmd) { +case DP_CMD_STATUS_UPDATE : +if (typec_altmode_exit (alt)) +dev_err (&dp->alt->dev,"Exit Mode Failed!\n" ); +break ;case DP_CMD_CONFIGURE : dp->data.conf =0 ; ret =dp_altmode_configured (dp);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 48/218 usb: typec: mux: do not return on EOPNOTSUPP in {mux, switch}_set
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Grzeschik <[email protected]>
[ Upstream commit 0f7bbef1794dc87141897f804e5871a293aa174b ]
Since the typec connectors can have many muxes or switches for different lanes (sbu, usb2, usb3) going into different modal states (usb2, usb3, audio, debug) all of them will be called on typec_switch_set and typec_mux_set. But not all of them will be handling the expected mode.
If one of the mux or switch will come back with EOPTNOSUPP this is no reason to stop running through the next ones. Therefor we skip this particular error value and continue calling the next.
--- drivers/usb/typec/mux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/typec/mux.c +2 -2
@@ -214,7 +214,7 @@ int typec_switch_set(struct typec_switch *sw, sw_dev = sw->sw_devs[i]; ret = sw_dev->set (sw_dev, orientation); -if (ret) +if (ret && ret != -EOPNOTSUPP )return ret; }
@@ -378,7 +378,7 @@ int typec_mux_set(struct typec_mux *mux, struct typec_mux_state *state) mux_dev = mux->mux_devs[i]; ret = mux_dev->set (mux_dev, state); -if (ret) +if (ret && ret != -EOPNOTSUPP )return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 49/218 riscv: add a data fence for CMODX in the kernel mode
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Chiu <[email protected]>
[ Upstream commit ca358692de41b273468e625f96926fa53e13bd8c ]
RISC-V spec explicitly calls out that a local fence.i is not enough for the code modification to be visble from a remote hart. In fact, it states:
To make a store to instruction memory visible to all RISC-V harts, the writing hart also has to execute a data FENCE before requesting that all remote RISC-V harts execute a FENCE.I.
Although current riscv drivers for IPI use ordered MMIO when sending IPIs in order to synchronize the action between previous csd writes, riscv does not restrict itself to any particular flavor of IPI. Any driver or firmware implementation that does not order data writes before the IPI may pose a risk for code-modifying race.
Thus, add a fence here to order data writes before making the IPI.
--- arch/riscv/mm/cacheflush.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
arch/riscv/mm/cacheflush.c +14 -1
@@ -24,7 +24,20 @@ void flush_icache_all(void)if (num_online_cpus () <2 )return ; -else if (riscv_use_sbi_for_rfence ()) + +/* +* Make sure all previous writes to the D$ are ordered before making +* the IPI. The RISC-V spec states that a hart must execute a data fence +* before triggering a remote fence.i in order to make the modification +* visable for remote harts. +* +* IPIs on RISC-V are triggered by MMIO writes to either CLINT or +* S-IMSIC, so the fence ensures previous data writes "happen before" +* the MMIO. +*/ +RISCV_FENCE (w, o); + +if (riscv_use_sbi_for_rfence ())sbi_remote_fence_i (NULL );else on_each_cpu (ipi_remote_fence_i,NULL ,1 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 50/218 ALSA: hda: Ignore unsol events for cards being shut down
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 3f100f524e75586537e337b34d18c8d604b398e7 ]
For the classic snd_hda_intel driver, codec->card and bus->card point to the exact same thing. When snd_card_diconnect() fires, bus->shutdown is set thanks to azx_dev_disconnect(). card->shutdown is already set when that happens but both provide basically the same functionality.
For the DSP snd_soc_avs driver where multiple codecs are located on multiple cards, bus->shutdown 'shortcut' is not sufficient. One codec card may be unregistered while other codecs are still operational. Proper check in form of card->shutdown must be used to verify whether the codec's card is being shut down.
--- sound/pci/hda/hda_bind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/hda_bind.c +1 -1
@@ -44,7 +44,7 @@ static void hda_codec_unsol_event(struct hdac_device *dev, unsigned int ev) struct hda_codec *codec = container_of(dev, struct hda_codec, core);/* ignore unsol events during shutdown */ -if (codec->bus->shutdown) +if (codec->card->shutdown || codec->bus->shutdown)return ;/* ignore unsol events during system suspend/resume */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 51/218 ALSA: hda: Add new pci id for AMD GPU display HD audio controller
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vijendar Mukunda <[email protected]>
[ Upstream commit ab72bfce7647522e01a181e3600c3d14ff5c143e ]
Add new pci id for AMD GPU display HD audio controller(device id- 0xab40).
--- sound/pci/hda/hda_intel.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/hda_intel.c +3 -0
@@ -2727,6 +2727,9 @@ static const struct pci_device_id azx_ids[] = { { PCI_VDEVICE(ATI, 0xab38), .driver_data =AZX_DRIVER_ATIHDMI_NS |AZX_DCAPS_PRESET_ATI_HDMI_NS | AZX_DCAPS_PM_RUNTIME }, + { PCI_VDEVICE(ATI, 0xab40), + .driver_data =AZX_DRIVER_ATIHDMI_NS |AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, /* GLENFLY */ { PCI_DEVICE(PCI_VENDOR_ID_GLENFLY, PCI_ANY_ID), .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 52/218 ALSA: usb-audio: Add a quirk for Lenovo Thinkpad Thunderbolt 3 dock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 4919353c7789b8047e06a9b2b943f775a8f72883 ]
The audio controller in the Lenovo Thinkpad Thunderbolt 3 dock doesn't support reading the sampling rate.
Add a quirk for it.
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -2282,6 +2282,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_DISABLE_AUTOSUSPEND),DEVICE_FLG (0x17aa ,0x104d ,/* Lenovo ThinkStation P620 Internal Speaker + Front Headset */ QUIRK_FLAG_DISABLE_AUTOSUSPEND ), +DEVICE_FLG (0x17ef ,0x3083 ,/* Lenovo TBT3 dock */ +QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x1852 ,0x5062 ,/* Luxman D-08u */ QUIRK_FLAG_ITF_USB_DSD_DAC |QUIRK_FLAG_CTL_MSG_DELAY ), DEVICE_FLG(0x1852, 0x5065, /* Luxman DA-06 */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 53/218 ASoC: rt1320: fix speaker noise when volume bar is 100%
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuming Fan <[email protected]>
[ Upstream commit 9adf2de86611ac108d07e769a699556d87f052e2 ]
This patch updates the settings to fix the speaker noise.
--- sound/soc/codecs/rt1320-sdw.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
sound/soc/codecs/rt1320-sdw.c +16 -1
@@ -2085,7 +2085,7 @@ static const struct reg_sequence rt1320_vc_patch_code_write[] = { { 0x3fc2bfc0, 0x03 }, { 0x0000d486, 0x43 }, { SDW_SDCA_CTL(FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23, RT1320_SDCA_CTL_REQ_POWER_STATE, 0), 0x00 }, - { 0x1000db00, 0x04 }, + { 0x1000db00, 0x07 }, { 0x1000db01, 0x00 }, { 0x1000db02, 0x11 }, { 0x1000db03, 0x00 },
@@ -2106,6 +2106,21 @@ static const struct reg_sequence rt1320_vc_patch_code_write[] = { { 0x1000db12, 0x00 }, { 0x1000db13, 0x00 }, { 0x1000db14, 0x45 }, + { 0x1000db15, 0x0d }, + { 0x1000db16, 0x01 }, + { 0x1000db17, 0x00 }, + { 0x1000db18, 0x00 }, + { 0x1000db19, 0xbf }, + { 0x1000db1a, 0x13 }, + { 0x1000db1b, 0x09 }, + { 0x1000db1c, 0x00 }, + { 0x1000db1d, 0x00 }, + { 0x1000db1e, 0x00 }, + { 0x1000db1f, 0x12 }, + { 0x1000db20, 0x09 }, + { 0x1000db21, 0x00 }, + { 0x1000db22, 0x00 }, + { 0x1000db23, 0x00 }, { 0x0000d540, 0x01 }, { 0x0000c081, 0xfc }, { 0x0000f01e, 0x80 },
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 54/218 ceph: fix possible integer overflow in ceph_zero_objects()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Kandybka <[email protected]>
[ Upstream commit 0abd87942e0c93964e93224836944712feba1d91 ]
In 'ceph_zero_objects', promote 'object_size' to 'u64' to avoid possible integer overflow.
Compile tested only.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/ceph/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/file.c +1 -1
@@ -2616,7 +2616,7 @@ static int ceph_zero_objects(struct inode *inode, loff_t offset, loff_t length)s32 stripe_unit = ci->i_layout.stripe_unit;s32 stripe_count = ci->i_layout.stripe_count;s32 object_size = ci->i_layout.object_size; -u64 object_set_size = object_size * stripe_count; +u64 object_set_size = (u64 ) object_size * stripe_count;u64 nearly, t;/* round offset up to next period boundary */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 55/218 scsi: ufs: core: Dont perform UFS clkscaling during host async scan
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ziqi Chen <[email protected]>
[ Upstream commit e97633492f5a3eca7b3ff03b4ef6f993017f7955 ]
When preparing for UFS clock scaling, the UFS driver will quiesce all sdevs queues in the UFS SCSI host tagset list and then unquiesce them in ufshcd_clock_scaling_unprepare(). If the UFS SCSI host async scan is in progress at this time, some LUs may be added to the tagset list between UFS clkscale prepare and unprepare. This can cause two issues:
1. During clock scaling, there may be I/O requests issued through new added queues that have not been quiesced, leading to task abort issue.
2. These new added queues that have not been quiesced will be unquiesced as well when UFS clkscale is unprepared, resulting in warning prints.
Therefore, use the mutex lock scan_mutex in ufshcd_clock_scaling_prepare() and ufshcd_clock_scaling_unprepare() to protect it.
--- drivers/ufs/core/ufshcd.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ufs/core/ufshcd.c +3 -0
@@ -1392,6 +1392,7 @@ static int ufshcd_clock_scaling_prepare(struct ufs_hba *hba, u64 timeout_us)* make sure that there are no outstanding requests when * clock scaling is in progress */ +mutex_lock (&hba->host->scan_mutex);blk_mq_quiesce_tagset (&hba->host->tag_set);mutex_lock (&hba->wb_mutex);down_write (&hba->clk_scaling_lock);
@@ -1402,6 +1403,7 @@ static int ufshcd_clock_scaling_prepare(struct ufs_hba *hba, u64 timeout_us)up_write (&hba->clk_scaling_lock);mutex_unlock (&hba->wb_mutex);blk_mq_unquiesce_tagset (&hba->host->tag_set); +mutex_unlock (&hba->host->scan_mutex); goto out; }
@@ -1423,6 +1425,7 @@ static void ufshcd_clock_scaling_unprepare(struct ufs_hba *hba, int err, bool scmutex_unlock (&hba->wb_mutex);blk_mq_unquiesce_tagset (&hba->host->tag_set); +mutex_unlock (&hba->host->scan_mutex);ufshcd_release (hba); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 56/218 ovl: Check for NULL d_inode() in ovl_dentry_upper()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 8a39f1c870e9d6fbac5638f3a42a6a6363829c49 ]
In ovl_path_type() and ovl_is_metacopy_dentry() GCC notices that it is possible for OVL_E() to return NULL (which implies that d_inode(dentry) may be NULL). This would result in out of bounds reads via container_of(), seen with GCC 15's -Warray-bounds -fdiagnostics-details. For example:
In file included from arch/x86/include/generated/asm/rwonce.h:1,
from include/linux/compiler.h:339, from include/linux/export.h:5,
from include/linux/linkage.h:7,
from include/linux/fs.h:5,
from fs/overlayfs/util.c:7:
In function 'ovl_upperdentry_dereference',
inlined from 'ovl_dentry_upper' at ../fs/overlayfs/util.c:305:9,
inlined from 'ovl_path_type' at ../fs/overlayfs/util.c:216:6:
include/asm-generic/rwonce.h:44:26: error: array subscript 0 is outside array bounds of 'struct inode[7486503276667837]' [-Werror=array-bounds=]
44 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
50 | __READ_ONCE(x); \
| ^~~~~~~~~~~
fs/overlayfs/ovl_entry.h:195:16: note: in expansion of macro 'READ_ONCE'
195 | return READ_ONCE(oi->__upperdentry);
| ^~~~~~~~~ 'ovl_path_type': event 1
185 | return inode ? OVL_I(inode)->oe : NULL;
'ovl_path_type': event 2
Avoid this by allowing ovl_dentry_upper() to return NULL if d_inode() is NULL, as that means the problematic dereferencing can never be reached. Note that this fixes the over-eager compiler warning in an effort to being able to enable -Warray-bounds globally. There is no known behavioral bug here.
--- fs/overlayfs/util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/overlayfs/util.c +3 -1
@@ -300,7 +300,9 @@ enum ovl_path_type ovl_path_realdata(struct dentry *dentry, struct path *path)struct dentry *ovl_dentry_upper (struct dentry *dentry) { -return ovl_upperdentry_dereference (OVL_I (d_inode (dentry))); +struct inode *inode =d_inode (dentry); + +return inode ?ovl_upperdentry_dereference (OVL_I (inode)) :NULL ; }struct dentry *ovl_dentry_lower (struct dentry *dentry)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 57/218 btrfs: handle csum tree error with rescue=ibadroots correctly
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 547e836661554dcfa15c212a3821664e85b4191a ]
[BUG]
There is syzbot based reproducer that can crash the kernel, with the following call trace: (With some debug output added)
DEBUG: rescue=ibadroots parsed
BTRFS: device fsid 14d642db-7b15-43e4-81e6-4b8fac6a25f8 devid 1 transid 8 /dev/loop0 (7:0) scanned by repro (1010)
BTRFS info (device loop0): first mount of filesystem 14d642db-7b15-43e4-81e6-4b8fac6a25f8
BTRFS info (device loop0): using blake2b (blake2b-256-generic) checksum algorithm
BTRFS info (device loop0): using free-space-tree
BTRFS warning (device loop0): checksum verify failed on logical 5312512 mirror 1 wanted 0xb043382657aede36608fd3386d6b001692ff406164733d94e2d9a180412c6003 found 0x810ceb2bacb7f0f9eb2bf3b2b15c02af867cb35ad450898169f3b1f0bd818651 level 0
DEBUG: read tree root path failed for tree csum, ret=-5
BTRFS warning (device loop0): checksum verify failed on logical 5328896 mirror 1 wanted 0x51be4e8b303da58e6340226815b70e3a93592dac3f30dd510c7517454de8567a found 0x51be4e8b303da58e634022a315b70e3a93592dac3f30dd510c7517454de8567a level 0 BTRFS warning (device loop0): checksum verify failed on logical 5292032 mirror 1 wanted 0x1924ccd683be9efc2fa98582ef58760e3848e9043db8649ee382681e220cdee4 found 0x0cb6184f6e8799d9f8cb335dccd1d1832da1071d12290dab3b85b587ecacca6e level 0 process 'repro' launched './file2' with NULL argv: empty string added
DEBUG: no csum root, idatacsums=0 ibadroots=134217728
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000041: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000208-0x000000000000020f] CPU: 5 UID: 0 PID: 1010 Comm: repro Tainted: G OE 6.15.0-custom+ #249 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS unknown 02/02/2022 RIP: 0010:btrfs_lookup_csum+0x93/0x3d0 [btrfs] Call Trace: <TASK> btrfs_lookup_bio_sums+0x47a/0xdf0 [btrfs] btrfs_submit_bbio+0x43e/0x1a80 [btrfs] submit_one_bio+0xde/0x160 [btrfs] btrfs_readahead+0x498/0x6a0 [btrfs] read_pages+0x1c3/0xb20 page_cache_ra_order+0x4b5/0xc20 filemap_get_pages+0x2d3/0x19e0 filemap_read+0x314/0xde0 __kernel_read+0x35b/0x900 bprm_execve+0x62e/0x1140 do_execveat_common.isra.0+0x3fc/0x520 __x64_sys_execveat+0xdc/0x130 do_syscall_64+0x54/0x1d0 entry_SYSCALL_64_after_hwframe+0x76/0x7e ---[ end trace 0000000000000000 ]---
[CAUSE]
Firstly the fs has a corrupted csum tree root, thus to mount the fs we have to go "ro,rescue=ibadroots" mount option.
Normally with that mount option, a bad csum tree root should set BTRFS_FS_STATE_NO_DATA_CSUMS flag, so that any future data read will ignore csum search.
But in this particular case, we have the following call trace that caused NULL csum root, but not setting BTRFS_FS_STATE_NO_DATA_CSUMS:
load_global_roots_objectid():
ret = btrfs_search_slot();
/* Succeeded */
btrfs_item_key_to_cpu()
found = true;
/* We found the root item for csum tree. */
root = read_tree_root_path();
if (IS_ERR(root)) {
if (!btrfs_test_opt(fs_info, IGNOREBADROOTS))
/*
* Since we have rescue=ibadroots mount option,
* @ret is still 0.
*/
break;
if (!found || ret) {
/* @found is true, @ret is 0, error handling for csum
* tree is skipped.
*/
}This means we completely skipped to set BTRFS_FS_STATE_NO_DATA_CSUMS if the csum tree is corrupted, which results unexpected later csum lookup.
[FIX]
If read_tree_root_path() failed, always populate @ret to the error number.
As at the end of the function, we need @ret to determine if we need to do the extra error handling for csum tree.
--- fs/btrfs/disk-io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/btrfs/disk-io.c +1 -2
@@ -2168,8 +2168,7 @@ static int load_global_roots_objectid(struct btrfs_root *tree_root, found = true; root =read_tree_root_path (tree_root, path, &key);if (IS_ERR (root)) { -if (!btrfs_test_opt (fs_info,IGNOREBADROOTS )) - ret =PTR_ERR (root); + ret =PTR_ERR (root);break ; }set_bit (BTRFS_ROOT_TRACK_DIRTY , &root->state);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 58/218 drm/i915/gem: Allow EXEC_CAPTURE on recoverable contexts on DG1
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ville Syrjälä <[email protected]>
[ Upstream commit 25eeba495b2fc16037647c1a51bcdf6fc157af5c ]
The intel-media-driver is currently broken on DG1 because it uses EXEC_CAPTURE with recovarable contexts. Relax the check to allow that.
I've also submitted a fix for the intel-media-driver:
https://github.com/intel/media-driver/pull/1920
Cc: [email protected] # v6.0+
Cc: Matthew Auld <[email protected]>
Cc: Thomas Hellström <[email protected]>
Testcase: igt/gem_exec_capture/capture-invisible
Stable-dep-of: ed5915cfce2a ("Revert "drm/i915/gem: Allow EXEC_CAPTURE on recoverable contexts on DG1"")
--- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +1 -1
@@ -2014,7 +2014,7 @@ static int eb_capture_stage(struct i915_execbuffer *eb)continue ;if (i915_gem_context_is_recoverable (eb->gem_context) && - (IS_DGFX (eb->i915) ||GRAPHICS_VER_FULL (eb->i915) >IP_VER (12 ,0 ))) +GRAPHICS_VER_FULL (eb->i915) >IP_VER (12 ,10 ))return -EINVAL ;for_each_batch_create_order (eb, j) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 59/218 Revert "drm/i915/gem: Allow EXEC_CAPTURE on recoverable contexts on DG1"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joonas Lahtinen <[email protected]>
[ Upstream commit ed5915cfce2abb9a553c3737badebd4a11d6c9c7 ]
This reverts commit d6e020819612a4a06207af858e0978be4d3e3140.
The IS_DGFX check was put in place because error capture of buffer objects is expected to be broken on devices with VRAM.
Userspace fix[1] to the impacted media driver has been submitted, merged and a new driver release is out as 25.2.3 where the capture flag is dropped on DG1 thus unblocking the usage of media driver on DG1.
[1] https://github.com/intel/media-driver/commit/93c07d9b4b96a78bab21f6acd4eb863f4313ea4a
--- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +1 -1
@@ -2014,7 +2014,7 @@ static int eb_capture_stage(struct i915_execbuffer *eb)continue ;if (i915_gem_context_is_recoverable (eb->gem_context) && -GRAPHICS_VER_FULL (eb->i915) >IP_VER (12 ,10 )) + (IS_DGFX (eb->i915) ||GRAPHICS_VER_FULL (eb->i915) >IP_VER (12 ,0 )))return -EINVAL ;for_each_batch_create_order (eb, j) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 60/218 btrfs: factor out nocow ordered extent and extent map generation into a helper
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 10326fdcb3ace2f2dcbc8b9fc50b87e5cab93345 ]
Currently we're doing all the ordered extent and extent map generation inside a while() loop of run_delalloc_nocow(). This makes it pretty hard to read, nor doing proper error handling.
So move that part of code into a helper, nocow_one_range().
This should not change anything, but there is a tiny timing change where btrfs_dec_nocow_writers() is only called after nocow_one_range() helper exits.
This timing change is small, and makes error handling easier, thus should be fine.
Stable-dep-of: 1f2889f5594a ("btrfs: fix qgroup reservation leak on failure to allocate ordered extent")
--- fs/btrfs/inode.c | 122 +++++++++++++++++++++++------------------------ 1 file changed, 61 insertions(+), 61 deletions(-)
fs/btrfs/inode.c +61 -61
@@ -2055,6 +2055,63 @@ static void cleanup_dirty_folios(struct btrfs_inode *inode,mapping_set_error (mapping, error); } +static int nocow_one_range (struct btrfs_inode *inode,struct folio *locked_folio, +struct extent_state **cached, +struct can_nocow_file_extent_args *nocow_args, +u64 file_pos,bool is_prealloc) +{ +struct btrfs_ordered_extent *ordered; +u64 len = nocow_args->file_extent.num_bytes; +u64 end = file_pos + len -1 ; +int ret =0 ; + +lock_extent (&inode->io_tree, file_pos, end, cached); + +if (is_prealloc) { +struct extent_map *em; + + em =btrfs_create_io_em (inode, file_pos, &nocow_args->file_extent, +BTRFS_ORDERED_PREALLOC ); +if (IS_ERR (em)) { +unlock_extent (&inode->io_tree, file_pos, end, cached); +return PTR_ERR (em); + } +free_extent_map (em); + } + + ordered =btrfs_alloc_ordered_extent (inode, file_pos, &nocow_args->file_extent, + is_prealloc + ? (1 <<BTRFS_ORDERED_PREALLOC ) + : (1 <<BTRFS_ORDERED_NOCOW )); +if (IS_ERR (ordered)) { +if (is_prealloc) +btrfs_drop_extent_map_range (inode, file_pos, end, false); +unlock_extent (&inode->io_tree, file_pos, end, cached); +return PTR_ERR (ordered); + } + +if (btrfs_is_data_reloc_root (inode->root)) +/* +* Errors are handled later, as we must prevent +* extent_clear_unlock_delalloc() in error handler from freeing +* metadata of the created ordered extent. +*/ + ret =btrfs_reloc_clone_csums (ordered); +btrfs_put_ordered_extent (ordered); + +extent_clear_unlock_delalloc (inode, file_pos, end, locked_folio, cached, +EXTENT_LOCKED |EXTENT_DELALLOC | +EXTENT_CLEAR_DATA_RESV , +PAGE_UNLOCK |PAGE_SET_ORDERED ); + +/* +* btrfs_reloc_clone_csums() error, now we're OK to call error handler, +* as metadata for created ordered extent will only be freed by +* btrfs_finish_ordered_io(). +*/ +return ret; +} +/* * when nowcow writeback call back. This checks for snapshots or COW copies * of the extents that exist in the file, and COWs the file as required.
@@ -2099,15 +2156,12 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode,while (cur_offset <= end) {struct btrfs_block_group *nocow_bg =NULL ; -struct btrfs_ordered_extent *ordered;struct btrfs_key found_key;struct btrfs_file_extent_item *fi;struct extent_buffer *leaf;struct extent_state *cached_state =NULL ;u64 extent_end; -u64 nocow_end;int extent_type; -bool is_prealloc; ret =btrfs_lookup_file_extent (NULL , root, path, ino, cur_offset,0 );
@@ -2242,67 +2296,13 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode, } } - nocow_end = cur_offset + nocow_args.file_extent.num_bytes -1 ; -lock_extent (&inode->io_tree, cur_offset, nocow_end, &cached_state); - - is_prealloc = extent_type ==BTRFS_FILE_EXTENT_PREALLOC ; -if (is_prealloc) { -struct extent_map *em; - - em =btrfs_create_io_em (inode, cur_offset, - &nocow_args.file_extent, -BTRFS_ORDERED_PREALLOC ); -if (IS_ERR (em)) { -unlock_extent (&inode->io_tree, cur_offset, - nocow_end, &cached_state); -btrfs_dec_nocow_writers (nocow_bg); - ret =PTR_ERR (em); - goto error; - } -free_extent_map (em); - } - - ordered =btrfs_alloc_ordered_extent (inode, cur_offset, - &nocow_args.file_extent, - is_prealloc - ? (1 <<BTRFS_ORDERED_PREALLOC ) - : (1 <<BTRFS_ORDERED_NOCOW )); + ret =nocow_one_range (inode, locked_folio, &cached_state, + &nocow_args, cur_offset, + extent_type ==BTRFS_FILE_EXTENT_PREALLOC );btrfs_dec_nocow_writers (nocow_bg); -if (IS_ERR (ordered)) { -if (is_prealloc) { -btrfs_drop_extent_map_range (inode, cur_offset, - nocow_end, false); - } -unlock_extent (&inode->io_tree, cur_offset, - nocow_end, &cached_state); - ret =PTR_ERR (ordered); +if (ret <0 ) goto error; - } - -if (btrfs_is_data_reloc_root (root)) -/* -* Error handled later, as we must prevent -* extent_clear_unlock_delalloc() in error handler -* from freeing metadata of created ordered extent. -*/ - ret =btrfs_reloc_clone_csums (ordered); -btrfs_put_ordered_extent (ordered); - -extent_clear_unlock_delalloc (inode, cur_offset, nocow_end, - locked_folio, &cached_state, -EXTENT_LOCKED |EXTENT_DELALLOC | -EXTENT_CLEAR_DATA_RESV , -PAGE_UNLOCK |PAGE_SET_ORDERED ); - cur_offset = extent_end; - -/* -* btrfs_reloc_clone_csums() error, now we're OK to call error -* handler, as metadata for created ordered extent will only -* be freed by btrfs_finish_ordered_io(). -*/ -if (ret) - goto error; }btrfs_release_path (path);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 61/218 btrfs: use unsigned types for constants defined as bit shifts
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
[ Upstream commit 05a6ec865d091fe8244657df8063f74e704d1711 ]
The unsigned type is a recommended practice (CWE-190, CWE-194) for bit shifts to avoid problems with potential unwanted sign extensions. Although there are no such cases in btrfs codebase, follow the recommendation.
Stable-dep-of: 1f2889f5594a ("btrfs: fix qgroup reservation leak on failure to allocate ordered extent")
--- fs/btrfs/backref.h | 4 ++-- fs/btrfs/direct-io.c | 4 ++-- fs/btrfs/extent_io.h | 2 +- fs/btrfs/inode.c | 12 ++++++------ fs/btrfs/ordered-data.c | 4 ++-- fs/btrfs/raid56.c | 5 ++--- fs/btrfs/tests/extent-io-tests.c | 6 +++--- fs/btrfs/zstd.c | 2 +- 8 files changed, 19 insertions(+), 20 deletions(-)
fs/btrfs/backref.h +2 -2
@@ -427,8 +427,8 @@ struct btrfs_backref_node *btrfs_backref_alloc_node(struct btrfs_backref_edge *btrfs_backref_alloc_edge (struct btrfs_backref_cache *cache); -#define LINK_LOWER (1 << 0) -#define LINK_UPPER (1 << 1) +#define LINK_LOWER (1U << 0) +#define LINK_UPPER (1U << 1) void btrfs_backref_link_edge(struct btrfs_backref_edge *edge, struct btrfs_backref_node *lower,
fs/btrfs/direct-io.c +2 -2
@@ -151,8 +151,8 @@ static struct extent_map *btrfs_create_dio_extent(struct btrfs_inode *inode, } ordered =btrfs_alloc_ordered_extent (inode, start, file_extent, - (1 << type) | - (1 <<BTRFS_ORDERED_DIRECT )); + (1U << type) | + (1U <<BTRFS_ORDERED_DIRECT ));if (IS_ERR (ordered)) {if (em) {free_extent_map (em);
fs/btrfs/extent_io.h +1 -1
@@ -79,7 +79,7 @@ enum {* single word in a bitmap may straddle two pages in the extent buffer. */ #define BIT_BYTE (nr) ((nr) / BITS_PER_BYTE) -#define BYTE_MASK ((1 << BITS_PER_BYTE) - 1) +#define BYTE_MASK ((1U << BITS_PER_BYTE) - 1)#define BITMAP_FIRST_BYTE_MASK (start) \ ((BYTE_MASK << ((start) & (BITS_PER_BYTE - 1))) & BYTE_MASK)#define BITMAP_LAST_BYTE_MASK (nbits) \
fs/btrfs/inode.c +6 -6
@@ -1249,7 +1249,7 @@ static void submit_one_async_extent(struct async_chunk *async_chunk,free_extent_map (em); ordered =btrfs_alloc_ordered_extent (inode, start, &file_extent, -1 <<BTRFS_ORDERED_COMPRESSED ); +1U <<BTRFS_ORDERED_COMPRESSED );if (IS_ERR (ordered)) {btrfs_drop_extent_map_range (inode, start, end, false); ret =PTR_ERR (ordered);
@@ -1484,7 +1484,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,free_extent_map (em); ordered =btrfs_alloc_ordered_extent (inode, start, &file_extent, -1 <<BTRFS_ORDERED_REGULAR ); +1U <<BTRFS_ORDERED_REGULAR );if (IS_ERR (ordered)) {unlock_extent (&inode->io_tree, start, start + ram_size -1 , &cached);
@@ -2081,8 +2081,8 @@ static int nocow_one_range(struct btrfs_inode *inode, struct folio *locked_folio ordered =btrfs_alloc_ordered_extent (inode, file_pos, &nocow_args->file_extent, is_prealloc - ? (1 <<BTRFS_ORDERED_PREALLOC ) - : (1 <<BTRFS_ORDERED_NOCOW )); + ? (1U <<BTRFS_ORDERED_PREALLOC ) + : (1U <<BTRFS_ORDERED_NOCOW ));if (IS_ERR (ordered)) {if (is_prealloc)btrfs_drop_extent_map_range (inode, file_pos, end, false);
@@ -9683,8 +9683,8 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from,free_extent_map (em); ordered =btrfs_alloc_ordered_extent (inode, start, &file_extent, - (1 <<BTRFS_ORDERED_ENCODED ) | - (1 <<BTRFS_ORDERED_COMPRESSED )); + (1U <<BTRFS_ORDERED_ENCODED ) | + (1U <<BTRFS_ORDERED_COMPRESSED ));if (IS_ERR (ordered)) {btrfs_drop_extent_map_range (inode, start, end, false); ret =PTR_ERR (ordered);
fs/btrfs/ordered-data.c +2 -2
@@ -155,7 +155,7 @@ static struct btrfs_ordered_extent *alloc_ordered_extent(u64 qgroup_rsv =0 ;if (flags & - ((1 <<BTRFS_ORDERED_NOCOW ) | (1 <<BTRFS_ORDERED_PREALLOC ))) { + ((1U <<BTRFS_ORDERED_NOCOW ) | (1U <<BTRFS_ORDERED_PREALLOC ))) {/* For nocow write, we can release the qgroup rsv right now */ ret =btrfs_qgroup_free_data (inode,NULL , file_offset, num_bytes, &qgroup_rsv);if (ret <0 )
@@ -253,7 +253,7 @@ static void insert_ordered_extent(struct btrfs_ordered_extent *entry)* @disk_bytenr: Offset of extent on disk. * @disk_num_bytes: Size of extent on disk. * @offset: Offset into unencoded data where file data starts. -* @flags: Flags specifying type of extent (1 << BTRFS_ORDERED_*). +* @flags: Flags specifying type of extent (1U << BTRFS_ORDERED_*). * @compress_type: Compression algorithm used for data. * * Most of these parameters correspond to &struct btrfs_file_extent_item. The
fs/btrfs/raid56.c +2 -3
@@ -200,8 +200,7 @@ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info)struct btrfs_stripe_hash_table *x;struct btrfs_stripe_hash *cur;struct btrfs_stripe_hash *h; -int num_entries =1 <<BTRFS_STRIPE_HASH_TABLE_BITS ; -int i; +unsigned int num_entries =1U <<BTRFS_STRIPE_HASH_TABLE_BITS ;if (info->stripe_hash_table)return 0 ;
@@ -222,7 +221,7 @@ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info) h = table->table; -for (i =0 ; i < num_entries; i++) { +for (unsigned int i =0 ; i < num_entries; i++) { cur = h + i;INIT_LIST_HEAD (&cur->hash_list);spin_lock_init (&cur->lock);
fs/btrfs/tests/extent-io-tests.c +3 -3
@@ -14,9 +14,9 @@#include "../disk-io.h" #include "../btrfs_inode.h" -#define PROCESS_UNLOCK (1 << 0) -#define PROCESS_RELEASE (1 << 1) -#define PROCESS_TEST_LOCKED (1 << 2) +#define PROCESS_UNLOCK (1U << 0) +#define PROCESS_RELEASE (1U << 1) +#define PROCESS_TEST_LOCKED (1U << 2) static noinline int process_page_range(struct inode *inode, u64 start, u64 end,unsigned long flags)
fs/btrfs/zstd.c +1 -1
@@ -24,7 +24,7 @@#include "super.h" #define ZSTD_BTRFS_MAX_WINDOWLOG 17 -#define ZSTD_BTRFS_MAX_INPUT (1 << ZSTD_BTRFS_MAX_WINDOWLOG) +#define ZSTD_BTRFS_MAX_INPUT (1U << ZSTD_BTRFS_MAX_WINDOWLOG)#define ZSTD_BTRFS_DEFAULT_LEVEL 3#define ZSTD_BTRFS_MAX_LEVEL 15/* 307s to avoid pathologically clashing with transaction commit */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 62/218 btrfs: fix qgroup reservation leak on failure to allocate ordered extent
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 1f2889f5594a2bc4c6a52634c4a51b93e785def5 ]
If we fail to allocate an ordered extent for a COW write we end up leaking a qgroup data reservation since we called btrfs_qgroup_release_data() but we didn't call btrfs_qgroup_free_refroot() (which would happen when running the respective data delayed ref created by ordered extent completion or when finishing the ordered extent in case an error happened).
So make sure we call btrfs_qgroup_free_refroot() if we fail to allocate an ordered extent for a COW write.
--- fs/btrfs/ordered-data.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
fs/btrfs/ordered-data.c +9 -3
@@ -153,9 +153,10 @@ static struct btrfs_ordered_extent *alloc_ordered_extent(struct btrfs_ordered_extent *entry;int ret;u64 qgroup_rsv =0 ; +const bool is_nocow = (flags & + ((1U <<BTRFS_ORDERED_NOCOW ) | (1U <<BTRFS_ORDERED_PREALLOC ))); -if (flags & - ((1U <<BTRFS_ORDERED_NOCOW ) | (1U <<BTRFS_ORDERED_PREALLOC ))) { +if (is_nocow) {/* For nocow write, we can release the qgroup rsv right now */ ret =btrfs_qgroup_free_data (inode,NULL , file_offset, num_bytes, &qgroup_rsv);if (ret <0 )
@@ -170,8 +171,13 @@ static struct btrfs_ordered_extent *alloc_ordered_extent(return ERR_PTR (ret); } entry =kmem_cache_zalloc (btrfs_ordered_extent_cache,GFP_NOFS ); -if (!entry) +if (!entry) { +if (!is_nocow) +btrfs_qgroup_free_refroot (inode->root->fs_info, +btrfs_root_id (inode->root), + qgroup_rsv,BTRFS_QGROUP_RSV_DATA );return ERR_PTR (-ENOMEM ); + } entry->file_offset = file_offset; entry->num_bytes = num_bytes;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 63/218 fs/jfs: consolidate sanity checking in dbMount
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Kleikamp <[email protected]>
[ Upstream commit 0d250b1c52484d489e31df2cf9118b7c4bd49d31 ]
Sanity checks have been added to dbMount as individual if clauses with identical error handling. Move these all into one clause.
Stable-dep-of: 37bfb464ddca ("jfs: validate AG parameters in dbMount() to prevent crashes")
--- fs/jfs/jfs_dmap.c | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-)
fs/jfs/jfs_dmap.c +9 -28
@@ -178,45 +178,26 @@ int dbMount(struct inode *ipbmap) dbmp_le = (struct dbmap_disk *) mp->data; bmp->db_mapsize =le64_to_cpu (dbmp_le->dn_mapsize); bmp->db_nfree =le64_to_cpu (dbmp_le->dn_nfree); - bmp->db_l2nbperpage =le32_to_cpu (dbmp_le->dn_l2nbperpage); -if (bmp->db_l2nbperpage >L2PSIZE -L2MINBLOCKSIZE || - bmp->db_l2nbperpage <0 ) { - err = -EINVAL ; - goto err_release_metapage; - } - bmp->db_numag =le32_to_cpu (dbmp_le->dn_numag); -if (!bmp->db_numag || bmp->db_numag >MAXAG ) { - err = -EINVAL ; - goto err_release_metapage; - } - bmp->db_maxlevel =le32_to_cpu (dbmp_le->dn_maxlevel); bmp->db_maxag =le32_to_cpu (dbmp_le->dn_maxag); bmp->db_agpref =le32_to_cpu (dbmp_le->dn_agpref); -if (bmp->db_maxag >=MAXAG || bmp->db_maxag <0 || - bmp->db_agpref >=MAXAG || bmp->db_agpref <0 ) { - err = -EINVAL ; - goto err_release_metapage; - } - bmp->db_aglevel =le32_to_cpu (dbmp_le->dn_aglevel); bmp->db_agheight =le32_to_cpu (dbmp_le->dn_agheight); bmp->db_agwidth =le32_to_cpu (dbmp_le->dn_agwidth); -if (!bmp->db_agwidth) { - err = -EINVAL ; - goto err_release_metapage; - } bmp->db_agstart =le32_to_cpu (dbmp_le->dn_agstart); bmp->db_agl2size =le32_to_cpu (dbmp_le->dn_agl2size); -if (bmp->db_agl2size >L2MAXL2SIZE -L2MAXAG || - bmp->db_agl2size <0 ) { - err = -EINVAL ; - goto err_release_metapage; - } -if (((bmp->db_mapsize -1 ) >> bmp->db_agl2size) >MAXAG ) { +if ((bmp->db_l2nbperpage >L2PSIZE -L2MINBLOCKSIZE ) || + (bmp->db_l2nbperpage <0 ) || + !bmp->db_numag || (bmp->db_numag >MAXAG ) || + (bmp->db_maxag >=MAXAG ) || (bmp->db_maxag <0 ) || + (bmp->db_agpref >=MAXAG ) || (bmp->db_agpref <0 ) || + !bmp->db_agwidth || + (bmp->db_agl2size >L2MAXL2SIZE -L2MAXAG ) || + (bmp->db_agl2size <0 ) || + ((bmp->db_mapsize -1 ) >> bmp->db_agl2size) >MAXAG ) { err = -EINVAL ; goto err_release_metapage; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 64/218 jfs: validate AG parameters in dbMount() to prevent crashes
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
[ Upstream commit 37bfb464ddca87f203071b5bd562cd91ddc0b40a ]
Validate db_agheight, db_agwidth, and db_agstart in dbMount to catch corrupted metadata early and avoid undefined behavior in dbAllocAG. Limits are derived from L2LPERCTL, LPERCTL/MAXAG, and CTLTREESIZE:
- agheight: 0 to L2LPERCTL/2 (0 to 5) ensures shift (L2LPERCTL - 2*agheight) >= 0.
- agwidth: 1 to min(LPERCTL/MAXAG, 2^(L2LPERCTL - 2*agheight)) ensures agperlev >= 1.
- Ranges: 1-8 (agheight 0-3), 1-4 (agheight 4), 1 (agheight 5).
- LPERCTL/MAXAG = 1024/128 = 8 limits leaves per AG;
2^(10 - 2*agheight) prevents division to 0.- agstart: 0 to CTLTREESIZE-1 - agwidth*(MAXAG-1) keeps ti within stree (size 1365).
- Ranges: 0-1237 (agwidth 1), 0-348 (agwidth 8).
UBSAN: shift-out-of-bounds in fs/jfs/jfs_dmap.c:1400:9 shift exponent -335544310 is negative CPU: 0 UID: 0 PID: 5822 Comm: syz-executor130 Not tainted 6.14.0-rc5-syzkaller #0 Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 ubsan_epilogue lib/ubsan.c:231 [inline] __ubsan_handle_shift_out_of_bounds+0x3c8/0x420 lib/ubsan.c:468 dbAllocAG+0x1087/0x10b0 fs/jfs/jfs_dmap.c:1400 dbDiscardAG+0x352/0xa20 fs/jfs/jfs_dmap.c:1613 jfs_ioc_trim+0x45a/0x6b0 fs/jfs/jfs_discard.c:105 jfs_ioctl+0x2cd/0x3e0 fs/jfs/ioctl.c:131 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:906 [inline] __se_sys_ioctl+0xf5/0x170 fs/ioctl.c:892 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- fs/jfs/jfs_dmap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/jfs/jfs_dmap.c +5 -1
@@ -194,7 +194,11 @@ int dbMount(struct inode *ipbmap) !bmp->db_numag || (bmp->db_numag >MAXAG ) || (bmp->db_maxag >=MAXAG ) || (bmp->db_maxag <0 ) || (bmp->db_agpref >=MAXAG ) || (bmp->db_agpref <0 ) || - !bmp->db_agwidth || + (bmp->db_agheight <0 ) || (bmp->db_agheight > (L2LPERCTL >>1 )) || + (bmp->db_agwidth <1 ) || (bmp->db_agwidth > (LPERCTL /MAXAG )) || + (bmp->db_agwidth > (1 << (L2LPERCTL - (bmp->db_agheight <<1 )))) || + (bmp->db_agstart <0 ) || + (bmp->db_agstart > (CTLTREESIZE -1 - bmp->db_agwidth * (MAXAG -1 ))) || (bmp->db_agl2size >L2MAXL2SIZE -L2MAXAG ) || (bmp->db_agl2size <0 ) || ((bmp->db_mapsize - 1) >> bmp->db_agl2size) > MAXAG) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 65/218 ASoC: codec: wcd9335: Convert to GPIO descriptors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit d5099bc1b56417733f4cccf10c61ee74dadd5562 ]
of_gpio.h is deprecated, update the driver to use GPIO descriptors.
- Use dev_gpiod_get to get GPIO descriptor.
- Use gpiod_set_value to configure output value.
With legacy of_gpio API, the driver set gpio value 0 to assert reset, and 1 to deassert reset. And the reset-gpios use GPIO_ACTIVE_LOW flag in DTS, so set GPIOD_OUT_LOW when get GPIO descriptors, and set value 1 means output low, set value 0 means output high with gpiod API.
The in-tree DTS files have the right polarity set up already so we can expect this to "just work"
Stable-dep-of: 9079db287fc3 ("ASoC: codecs: wcd9335: Fix missing free of regulator supplies")
--- sound/soc/codecs/wcd9335.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
sound/soc/codecs/wcd9335.c +7 -8
@@ -17,7 +17,7 @@#include <sound/soc.h> #include <sound/pcm_params.h> #include <sound/soc-dapm.h> -#include <linux/of_gpio.h> +#include <linux/gpio/consumer.h> #include <linux/of.h> #include <linux/of_irq.h> #include <sound/tlv.h>
@@ -329,7 +329,7 @@ struct wcd9335_codec {int comp_enabled[COMPANDER_MAX ];int intr1; -int reset_gpio; +struct gpio_desc *reset_gpio;struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY ];unsigned int rx_port_value[WCD9335_RX_MAX ];
@@ -4973,12 +4973,11 @@ static const struct regmap_irq_chip wcd9335_regmap_irq1_chip = {static int wcd9335_parse_dt (struct wcd9335_codec *wcd) {struct device *dev = wcd->dev; -struct device_node *np = dev->of_node;int ret; - wcd->reset_gpio =of_get_named_gpio (np,"reset-gpios" ,0 ); -if (wcd->reset_gpio <0 ) -return dev_err_probe (dev, wcd->reset_gpio,"Reset GPIO missing from DT\n" ); + wcd->reset_gpio =devm_gpiod_get (dev,"reset" ,GPIOD_OUT_LOW ); +if (IS_ERR (wcd->reset_gpio)) +return dev_err_probe (dev,PTR_ERR (wcd->reset_gpio),"Reset GPIO missing from DT\n" ); wcd->mclk =devm_clk_get (dev,"mclk" );if (IS_ERR (wcd->mclk))
@@ -5021,9 +5020,9 @@ static int wcd9335_power_on_reset(struct wcd9335_codec *wcd)*/ usleep_range (600 ,650 ); -gpio_direction_output (wcd->reset_gpio,0 ); +gpiod_set_value (wcd->reset_gpio,1 );msleep (20 ); -gpio_set_value (wcd->reset_gpio,1 ); +gpiod_set_value (wcd->reset_gpio,0 );msleep (20 );return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 66/218 ASoC: codecs: wcd9335: Fix missing free of regulator supplies
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 9079db287fc3e38e040b0edeb0a25770bb679c8e ]
Driver gets and enables all regulator supplies in probe path (wcd9335_parse_dt() and wcd9335_power_on_reset()), but does not cleanup in final error paths and in unbind (missing remove() callback). This leads to leaked memory and unbalanced regulator enable count during probe errors or unbind.
Fix this by converting entire code into devm_regulator_bulk_get_enable() which also greatly simplifies the code.
--- sound/soc/codecs/wcd9335.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-)
sound/soc/codecs/wcd9335.c +7 -18
@@ -330,7 +330,6 @@ struct wcd9335_codec {int intr1;struct gpio_desc *reset_gpio; -struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY ];unsigned int rx_port_value[WCD9335_RX_MAX ];unsigned int tx_port_value[WCD9335_TX_MAX ];
@@ -353,6 +352,10 @@ struct wcd9335_irq {char *name; }; +static const char *const wcd9335_supplies[] = { +"vdd-buck" ,"vdd-buck-sido" ,"vdd-tx" ,"vdd-rx" ,"vdd-io" , +}; +static const struct wcd9335_slim_ch wcd9335_tx_chs[WCD9335_TX_MAX ] = {WCD9335_SLIM_TX_CH (0 ),WCD9335_SLIM_TX_CH (1 ),
@@ -4987,30 +4990,16 @@ static int wcd9335_parse_dt(struct wcd9335_codec *wcd)if (IS_ERR (wcd->native_clk))return dev_err_probe (dev,PTR_ERR (wcd->native_clk),"slimbus clock not found\n" ); - wcd->supplies[0 ].supply ="vdd-buck" ; - wcd->supplies[1 ].supply ="vdd-buck-sido" ; - wcd->supplies[2 ].supply ="vdd-tx" ; - wcd->supplies[3 ].supply ="vdd-rx" ; - wcd->supplies[4 ].supply ="vdd-io" ; - - ret =regulator_bulk_get (dev,WCD9335_MAX_SUPPLY , wcd->supplies); + ret =devm_regulator_bulk_get_enable (dev,ARRAY_SIZE (wcd9335_supplies), + wcd9335_supplies);if (ret) -return dev_err_probe (dev, ret,"Failed to get supplies\n" ); +return dev_err_probe (dev, ret,"Failed to get and enable supplies\n" );return 0 ; }static int wcd9335_power_on_reset (struct wcd9335_codec *wcd) { -struct device *dev = wcd->dev; -int ret; - - ret =regulator_bulk_enable (WCD9335_MAX_SUPPLY , wcd->supplies); -if (ret) { -dev_err (dev,"Failed to get supplies: err = %d\n" , ret); -return ret; - } -/* * For WCD9335, it takes about 600us for the Vout_A and * Vout_D to be ready after BUCK_SIDO is powered up.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 67/218 f2fs: dont over-report free space or inodes in statvfs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit a9201960623287927bf5776de3f70fb2fbde7e02 ]
This fixes an analogus bug that was fixed in modern filesystems:
a) xfs in commit 4b8d867ca6e2 ("xfs: don't over-report free space or inodes in statvfs")
b) ext4 in commit f87d3af74193 ("ext4: don't over-report free space or inodes in statvfs")
where statfs can report misleading / incorrect information where project quota is enabled, and the free space is less than the remaining quota.
This commit will resolve a test failure in generic/762 which tests for this bug.
generic/762 - output mismatch (see /share/git/fstests/results//generic/762.out.bad)
# --- tests/generic/762.out 2025-04-15 10:21:53.371067071 +0800 # +++ /share/git/fstests/results//generic/762.out.bad 2025-05-13 16:13:37.000000000 +0800 # @@ -6,8 +6,10 @@ # root blocks2 is in range # dir blocks2 is in range # root bavail2 is in range # -dir bavail2 is in range # +dir bavail2 has value of 1539066 # +dir bavail2 is NOT in range 304734.87 .. 310891.13
# root blocks3 is in range
# ...
# (Run 'diff -u /share/git/fstests/tests/generic/762.out /share/git/fstests/results//generic/762.out.bad' to see the entire diff)
HINT: You _MAY_ be missing kernel fix:
XXXXXXXXXXXXXX xfs: don't over-report free space or inodes in statvfs
--- fs/f2fs/super.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
fs/f2fs/super.c +18 -12
@@ -1787,26 +1787,32 @@ static int f2fs_statfs_project(struct super_block *sb, limit =min_not_zero (dquot->dq_dqb.dqb_bsoftlimit, dquot->dq_dqb.dqb_bhardlimit); -if (limit) - limit >>= sb->s_blocksize_bits; + limit >>= sb->s_blocksize_bits; + +if (limit) { +uint64_t remaining =0 ; -if (limit && buf->f_blocks > limit) { curblock = (dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace) >> sb->s_blocksize_bits; - buf->f_blocks = limit; - buf->f_bfree = buf->f_bavail = - (buf->f_blocks > curblock) ? - (buf->f_blocks - curblock) :0 ; +if (limit > curblock) + remaining = limit - curblock; + + buf->f_blocks =min (buf->f_blocks, limit); + buf->f_bfree =min (buf->f_bfree, remaining); + buf->f_bavail =min (buf->f_bavail, remaining); } limit =min_not_zero (dquot->dq_dqb.dqb_isoftlimit, dquot->dq_dqb.dqb_ihardlimit); -if (limit && buf->f_files > limit) { - buf->f_files = limit; - buf->f_ffree = - (buf->f_files > dquot->dq_dqb.dqb_curinodes) ? - (buf->f_files - dquot->dq_dqb.dqb_curinodes) :0 ; +if (limit) { +uint64_t remaining =0 ; + +if (limit > dquot->dq_dqb.dqb_curinodes) + remaining = limit - dquot->dq_dqb.dqb_curinodes; + + buf->f_files =min (buf->f_files, limit); + buf->f_ffree =min (buf->f_ffree, remaining); }spin_unlock (&dquot->dq_dqb_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 68/218 PCI: apple: Use helper function for_each_child_of_node_scoped()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Zekun <[email protected]>
[ Upstream commit f60b4e06a945f25d463ae065c6e41c6e24faee0a ]
The for_each_available_child_of_node_scoped() helper provides a scope-based clean-up functionality to put the device_node automatically, and as such, there is no need to call of_node_put() directly.
Thus, use this helper to simplify the code.
Stable-dep-of: 751bec089c4e ("PCI: apple: Set only available ports up")
--- drivers/pci/controller/pcie-apple.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pci/controller/pcie-apple.c +1 -3
@@ -767,7 +767,6 @@ static int apple_pcie_init(struct pci_config_window *cfg) {struct device *dev = cfg->parent;struct platform_device *platform =to_platform_device (dev); -struct device_node *of_port;struct apple_pcie *pcie;int ret;
@@ -790,11 +789,10 @@ static int apple_pcie_init(struct pci_config_window *cfg)if (ret)return ret; -for_each_child_of_node (dev->of_node, of_port) { +for_each_child_of_node_scoped (dev->of_node, of_port) { ret =apple_pcie_setup_port (pcie, of_port);if (ret) {dev_err (pcie->dev,"Port %pOF setup fail: %d\n" , of_port, ret); -of_node_put (of_port);return ret; } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 69/218 PCI: apple: Set only available ports up
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Janne Grunau <[email protected]>
[ Upstream commit 751bec089c4eed486578994abd2c5395f08d0302 ]
Iterating over disabled ports results in of_irq_parse_raw() parsing the wrong "interrupt-map" entries, as it takes the status of the node into account.
This became apparent after disabling unused PCIe ports in the Apple Silicon device trees instead of deleting them.
Switching from for_each_child_of_node_scoped() to for_each_available_child_of_node_scoped() solves this issue.
--- drivers/pci/controller/pcie-apple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-apple.c +1 -1
@@ -789,7 +789,7 @@ static int apple_pcie_init(struct pci_config_window *cfg)if (ret)return ret; -for_each_child_of_node_scoped (dev->of_node, of_port) { +for_each_available_child_of_node_scoped (dev->of_node, of_port) { ret =apple_pcie_setup_port (pcie, of_port);if (ret) {dev_err (pcie->dev,"Port %pOF setup fail: %d\n" , of_port, ret);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 70/218 accel/ivpu: Do not fail on cmdq if failed to allocate preemption buffers
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karol Wachowski <[email protected]>
[ Upstream commit 08eb99ce911d3ea202f79b42b96cd6e8498f7f69 ]
Allow to proceed with job command queue creation even if preemption buffers failed to be allocated, print warning that preemption on such command queue will be disabled.
Stable-dep-of: a47e36dc5d90 ("accel/ivpu: Trigger device recovery on engine reset/resume failure")
--- drivers/accel/ivpu/ivpu_job.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/accel/ivpu/ivpu_job.c +16 -11
@@ -60,6 +60,7 @@ static int ivpu_preemption_buffers_create(struct ivpu_device *vdev, err_free_primary:ivpu_bo_free (cmdq->primary_preempt_buf); + cmdq->primary_preempt_buf =NULL ;return -ENOMEM ; }
@@ -69,10 +70,10 @@ static void ivpu_preemption_buffers_free(struct ivpu_device *vdev,if (vdev->fw->sched_mode !=VPU_SCHEDULING_MODE_HW )return ; -drm_WARN_ON (&vdev->drm, !cmdq->primary_preempt_buf); -drm_WARN_ON (&vdev->drm, !cmdq->secondary_preempt_buf); -ivpu_bo_free (cmdq->primary_preempt_buf); -ivpu_bo_free (cmdq->secondary_preempt_buf); +if (cmdq->primary_preempt_buf) +ivpu_bo_free (cmdq->primary_preempt_buf); +if (cmdq->secondary_preempt_buf) +ivpu_bo_free (cmdq->secondary_preempt_buf); }static struct ivpu_cmdq *ivpu_cmdq_alloc (struct ivpu_file_priv *file_priv)
@@ -98,12 +99,10 @@ static struct ivpu_cmdq *ivpu_cmdq_alloc(struct ivpu_file_priv *file_priv) ret =ivpu_preemption_buffers_create (vdev, file_priv, cmdq);if (ret) - goto err_free_cmdq_mem; +ivpu_warn (vdev,"Failed to allocate preemption buffers, preemption limited\n" );return cmdq; -err_free_cmdq_mem: -ivpu_bo_free (cmdq->mem); err_erase_xa:xa_erase (&vdev->db_xa, cmdq->db_id); err_free_cmdq:
@@ -363,10 +362,16 @@ static int ivpu_cmdq_push_job(struct ivpu_cmdq *cmdq, struct ivpu_job *job)if (vdev->fw->sched_mode ==VPU_SCHEDULING_MODE_HW && (unlikely (!(ivpu_test_mode &IVPU_TEST_MODE_PREEMPTION_DISABLE )))) { - entry->primary_preempt_buf_addr = cmdq->primary_preempt_buf->vpu_addr; - entry->primary_preempt_buf_size =ivpu_bo_size (cmdq->primary_preempt_buf); - entry->secondary_preempt_buf_addr = cmdq->secondary_preempt_buf->vpu_addr; - entry->secondary_preempt_buf_size =ivpu_bo_size (cmdq->secondary_preempt_buf); +if (cmdq->primary_preempt_buf) { + entry->primary_preempt_buf_addr = cmdq->primary_preempt_buf->vpu_addr; + entry->primary_preempt_buf_size =ivpu_bo_size (cmdq->primary_preempt_buf); + } + +if (cmdq->secondary_preempt_buf) { + entry->secondary_preempt_buf_addr = cmdq->secondary_preempt_buf->vpu_addr; + entry->secondary_preempt_buf_size = +ivpu_bo_size (cmdq->secondary_preempt_buf); + } }wmb ();/* Ensure that tail is updated after filling entry */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 71/218 accel/ivpu: Remove copy engine support
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrzej Kacprowski <[email protected]>
[ Upstream commit 94b2a2c0e7cba3f163609dbd94120ee533ad2a07 ]
Copy engine was deprecated by the FW and is no longer supported. Compute engine includes all copy engine functionality and should be used instead.
This change does not affect user space as the copy engine was never used outside of a couple of tests.
Stable-dep-of: a47e36dc5d90 ("accel/ivpu: Trigger device recovery on engine reset/resume failure")
--- drivers/accel/ivpu/ivpu_drv.h | 5 +--- drivers/accel/ivpu/ivpu_job.c | 43 +++++++++++-------------------- drivers/accel/ivpu/ivpu_jsm_msg.c | 8 +++--- include/uapi/drm/ivpu_accel.h | 6 +---- 4 files changed, 21 insertions(+), 41 deletions(-)
drivers/accel/ivpu/ivpu_drv.h +1 -4
@@ -50,11 +50,8 @@#define IVPU_JOB_ID_JOB_MASK GENMASK(7, 0)#define IVPU_JOB_ID_CONTEXT_MASK GENMASK(31, 8) -#define IVPU_NUM_ENGINES 2#define IVPU_NUM_PRIORITIES 4 -#define IVPU_NUM_CMDQS_PER_CTX (IVPU_NUM_ENGINES * IVPU_NUM_PRIORITIES) - -#define IVPU_CMDQ_INDEX (engine, priority) ((engine) * IVPU_NUM_PRIORITIES + (priority)) +#define IVPU_NUM_CMDQS_PER_CTX (IVPU_NUM_PRIORITIES)#define IVPU_PLATFORM_SILICON 0#define IVPU_PLATFORM_SIMICS 2
drivers/accel/ivpu/ivpu_job.c +15 -28
101 lines not on this page · raw message
drivers/accel/ivpu/ivpu_jsm_msg.c +4 -4
@@ -132,7 +132,7 @@ int ivpu_jsm_get_heartbeat(struct ivpu_device *vdev, u32 engine, u64 *heartbeat)struct vpu_jsm_msg resp;int ret; -if (engine >VPU_ENGINE_COPY ) +if (engine !=VPU_ENGINE_COMPUTE )return -EINVAL ; req.payload.query_engine_hb.engine_idx = engine;
@@ -155,7 +155,7 @@ int ivpu_jsm_reset_engine(struct ivpu_device *vdev, u32 engine)struct vpu_jsm_msg resp;int ret; -if (engine >VPU_ENGINE_COPY ) +if (engine !=VPU_ENGINE_COMPUTE )return -EINVAL ; req.payload.engine_reset.engine_idx = engine;
@@ -174,7 +174,7 @@ int ivpu_jsm_preempt_engine(struct ivpu_device *vdev, u32 engine, u32 preempt_idstruct vpu_jsm_msg resp;int ret; -if (engine >VPU_ENGINE_COPY ) +if (engine !=VPU_ENGINE_COMPUTE )return -EINVAL ; req.payload.engine_preempt.engine_idx = engine;
@@ -346,7 +346,7 @@ int ivpu_jsm_hws_resume_engine(struct ivpu_device *vdev, u32 engine)struct vpu_jsm_msg resp;int ret; -if (engine >=VPU_ENGINE_NB ) +if (engine !=VPU_ENGINE_COMPUTE )return -EINVAL ; req.payload.hws_resume_engine.engine_idx = engine;
include/uapi/drm/ivpu_accel.h +1 -5
@@ -261,7 +261,7 @@ struct drm_ivpu_bo_info {/* drm_ivpu_submit engines */ #define DRM_IVPU_ENGINE_COMPUTE 0 -#define DRM_IVPU_ENGINE_COPY 1 +#define DRM_IVPU_ENGINE_COPY 1/* Deprecated */ /** * struct drm_ivpu_submit - Submit commands to the VPU
@@ -292,10 +292,6 @@ struct drm_ivpu_submit {* %DRM_IVPU_ENGINE_COMPUTE: * * Performs Deep Learning Neural Compute Inference Operations -* -* %DRM_IVPU_ENGINE_COPY: -* -* Performs memory copy operations to/from system memory allocated for VPU */ __u32 engine;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 72/218 accel/ivpu: Make command queue ID allocated on XArray
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karol Wachowski <[email protected]>
[ Upstream commit 76ad741ec7349bb1112f3a0ff27adf1ca75cf025 ]
Use XArray for dynamic command queue ID allocations instead of fixed ones. This is required by upcoming changes to UAPI that will allow to manage command queues by user space instead of having predefined number of queues in a context.
Stable-dep-of: a47e36dc5d90 ("accel/ivpu: Trigger device recovery on engine reset/resume failure")
--- drivers/accel/ivpu/ivpu_drv.c | 6 +++ drivers/accel/ivpu/ivpu_drv.h | 7 ++- drivers/accel/ivpu/ivpu_job.c | 91 ++++++++++++++++++----------------- drivers/accel/ivpu/ivpu_job.h | 2 + 4 files changed, 60 insertions(+), 46 deletions(-)
drivers/accel/ivpu/ivpu_drv.c +6 -0
@@ -102,6 +102,8 @@ static void file_priv_release(struct kref *ref)pm_runtime_get_sync (vdev->drm.dev);mutex_lock (&vdev->context_list_lock);file_priv_unbind (vdev, file_priv); +drm_WARN_ON (&vdev->drm, !xa_empty (&file_priv->cmdq_xa)); +xa_destroy (&file_priv->cmdq_xa);mutex_unlock (&vdev->context_list_lock);pm_runtime_put_autosuspend (vdev->drm.dev);
@@ -261,6 +263,10 @@ static int ivpu_open(struct drm_device *dev, struct drm_file *file) file_priv->job_limit.min =FIELD_PREP (IVPU_JOB_ID_CONTEXT_MASK , (file_priv->ctx.id -1 )); file_priv->job_limit.max = file_priv->job_limit.min |IVPU_JOB_ID_JOB_MASK ; +xa_init_flags (&file_priv->cmdq_xa,XA_FLAGS_ALLOC1 ); + file_priv->cmdq_limit.min =IVPU_CMDQ_MIN_ID ; + file_priv->cmdq_limit.max =IVPU_CMDQ_MAX_ID ; +mutex_unlock (&vdev->context_list_lock);drm_dev_exit (idx);
drivers/accel/ivpu/ivpu_drv.h +6 -1
@@ -53,6 +53,9 @@#define IVPU_NUM_PRIORITIES 4#define IVPU_NUM_CMDQS_PER_CTX (IVPU_NUM_PRIORITIES) +#define IVPU_CMDQ_MIN_ID 1 +#define IVPU_CMDQ_MAX_ID 255 +#define IVPU_PLATFORM_SILICON 0#define IVPU_PLATFORM_SIMICS 2#define IVPU_PLATFORM_FPGA 3
@@ -171,13 +174,15 @@ struct ivpu_file_priv {struct kref ref;struct ivpu_device *vdev;struct mutex lock;/* Protects cmdq */ -struct ivpu_cmdq *cmdq[IVPU_NUM_CMDQS_PER_CTX ]; +struct xarray cmdq_xa;struct ivpu_mmu_context ctx;struct mutex ms_lock;/* Protects ms_instance_list, ms_info_bo */ struct list_head ms_instance_list;struct ivpu_bo *ms_info_bo;struct xa_limit job_limit;u32 job_id_next; +struct xa_limit cmdq_limit; +u32 cmdq_id_next;bool has_mmu_faults;bool bound;bool aborted;
drivers/accel/ivpu/ivpu_job.c +46 -45
211 lines not on this page · raw message
drivers/accel/ivpu/ivpu_job.h +2 -0
@@ -28,8 +28,10 @@ struct ivpu_cmdq {struct ivpu_bo *secondary_preempt_buf;struct ivpu_bo *mem;u32 entry_count; +u32 id;u32 db_id;bool db_registered; +u8 priority; };/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 73/218 accel/ivpu: Separate DB ID and CMDQ ID allocations from CMDQ allocation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karol Wachowski <[email protected]>
[ Upstream commit 950942b4813f8c44dbec683fdb140cf4a238516b ]
Move doorbell ID and command queue ID XArray allocations from command queue memory allocation function. This will allow ID allocations to be done without the need for actual memory allocation.
Stable-dep-of: a47e36dc5d90 ("accel/ivpu: Trigger device recovery on engine reset/resume failure")
--- drivers/accel/ivpu/ivpu_job.c | 88 +++++++++++++++++++++++++---------- 1 file changed, 64 insertions(+), 24 deletions(-)
drivers/accel/ivpu/ivpu_job.c +64 -24
@@ -86,23 +86,9 @@ static struct ivpu_cmdq *ivpu_cmdq_alloc(struct ivpu_file_priv *file_priv)if (!cmdq)return NULL ; - ret =xa_alloc_cyclic (&vdev->db_xa, &cmdq->db_id,NULL , vdev->db_limit, &vdev->db_next, -GFP_KERNEL ); -if (ret <0 ) { -ivpu_err (vdev,"Failed to allocate doorbell id: %d\n" , ret); - goto err_free_cmdq; - } - - ret =xa_alloc_cyclic (&file_priv->cmdq_xa, &cmdq->id, cmdq, file_priv->cmdq_limit, - &file_priv->cmdq_id_next,GFP_KERNEL ); -if (ret <0 ) { -ivpu_err (vdev,"Failed to allocate command queue id: %d\n" , ret); - goto err_erase_db_xa; - } - cmdq->mem =ivpu_bo_create_global (vdev,SZ_4K ,DRM_IVPU_BO_WC |DRM_IVPU_BO_MAPPABLE );if (!cmdq->mem) - goto err_erase_cmdq_xa; + goto err_free_cmdq; ret =ivpu_preemption_buffers_create (vdev, file_priv, cmdq);if (ret)
@@ -110,10 +96,6 @@ static struct ivpu_cmdq *ivpu_cmdq_alloc(struct ivpu_file_priv *file_priv)return cmdq; -err_erase_cmdq_xa: -xa_erase (&file_priv->cmdq_xa, cmdq->id); -err_erase_db_xa: -xa_erase (&vdev->db_xa, cmdq->db_id); err_free_cmdq:kfree (cmdq);return NULL ;
@@ -231,30 +213,88 @@ static int ivpu_cmdq_fini(struct ivpu_file_priv *file_priv, struct ivpu_cmdq *cmreturn 0 ; } +static int ivpu_db_id_alloc (struct ivpu_device *vdev,u32 *db_id) +{ +int ret; +u32 id; + + ret =xa_alloc_cyclic (&vdev->db_xa, &id,NULL , vdev->db_limit, &vdev->db_next,GFP_KERNEL ); +if (ret <0 ) +return ret; + + *db_id = id; +return 0 ; +} + +static int ivpu_cmdq_id_alloc (struct ivpu_file_priv *file_priv,u32 *cmdq_id) +{ +int ret; +u32 id; + + ret =xa_alloc_cyclic (&file_priv->cmdq_xa, &id,NULL , file_priv->cmdq_limit, + &file_priv->cmdq_id_next,GFP_KERNEL ); +if (ret <0 ) +return ret; + + *cmdq_id = id; +return 0 ; +} +static struct ivpu_cmdq *ivpu_cmdq_acquire (struct ivpu_file_priv *file_priv,u8 priority) { +struct ivpu_device *vdev = file_priv->vdev;struct ivpu_cmdq *cmdq; -unsigned long cmdq_id; +unsigned long id;int ret;lockdep_assert_held (&file_priv->lock); -xa_for_each (&file_priv->cmdq_xa, cmdq_id, cmdq) +xa_for_each (&file_priv->cmdq_xa, id, cmdq)if (cmdq->priority == priority)break ;if (!cmdq) { cmdq =ivpu_cmdq_alloc (file_priv); -if (!cmdq) +if (!cmdq) { +ivpu_err (vdev,"Failed to allocate command queue\n" );return NULL ; + } + + ret =ivpu_db_id_alloc (vdev, &cmdq->db_id); +if (ret) { +ivpu_err (file_priv->vdev,"Failed to allocate doorbell ID: %d\n" , ret); + goto err_free_cmdq; + } + + ret =ivpu_cmdq_id_alloc (file_priv, &cmdq->id); +if (ret) { +ivpu_err (vdev,"Failed to allocate command queue ID: %d\n" , ret); + goto err_erase_db_id; + } + cmdq->priority = priority; + ret =xa_err (xa_store (&file_priv->cmdq_xa, cmdq->id, cmdq,GFP_KERNEL )); +if (ret) { +ivpu_err (vdev,"Failed to store command queue in cmdq_xa: %d\n" , ret); + goto err_erase_cmdq_id; + } } ret =ivpu_cmdq_init (file_priv, cmdq, priority); -if (ret) -return NULL ; +if (ret) { +ivpu_err (vdev,"Failed to initialize command queue: %d\n" , ret); + goto err_free_cmdq; + }return cmdq; + +err_erase_cmdq_id: +xa_erase (&file_priv->cmdq_xa, cmdq->id); +err_erase_db_id: +xa_erase (&vdev->db_xa, cmdq->db_id); +err_free_cmdq: +ivpu_cmdq_free (file_priv, cmdq); +return NULL ; }void ivpu_cmdq_release_all_locked (struct ivpu_file_priv *file_priv)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 74/218 accel/ivpu: Add debugfs interface for setting HWS priority bands
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karol Wachowski <[email protected]>
[ Upstream commit 320323d2e5456df9d6236ac1ce9c030b1a74aa5b ]
Add debugfs interface to modify following priority bands properties:
* grace period
* process grace period
* process quantum
This allows for the adjustment of hardware scheduling algorithm parameters for each existing priority band, facilitating validation and fine-tuning.
Stable-dep-of: a47e36dc5d90 ("accel/ivpu: Trigger device recovery on engine reset/resume failure")
--- drivers/accel/ivpu/ivpu_debugfs.c | 84 +++++++++++++++++++++++++++++++ drivers/accel/ivpu/ivpu_hw.c | 21 ++++++++ drivers/accel/ivpu/ivpu_hw.h | 5 ++ drivers/accel/ivpu/ivpu_jsm_msg.c | 29 ++++------- 4 files changed, 121 insertions(+), 18 deletions(-)
drivers/accel/ivpu/ivpu_debugfs.c +84 -0
@@ -423,6 +423,88 @@ static int dct_active_set(void *data, u64 active_percent)DEFINE_DEBUGFS_ATTRIBUTE (ivpu_dct_fops, dct_active_get, dct_active_set,"%llu\n" ); +static int priority_bands_show (struct seq_file *s,void *v) +{ +struct ivpu_device *vdev = s->private; +struct ivpu_hw_info *hw = vdev->hw; + +for (int band =VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE ; + band <VPU_JOB_SCHEDULING_PRIORITY_BAND_COUNT ; band++) { +switch (band) { +case VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE : +seq_puts (s,"Idle: " ); +break ; + +case VPU_JOB_SCHEDULING_PRIORITY_BAND_NORMAL : +seq_puts (s,"Normal: " ); +break ; + +case VPU_JOB_SCHEDULING_PRIORITY_BAND_FOCUS : +seq_puts (s,"Focus: " ); +break ; + +case VPU_JOB_SCHEDULING_PRIORITY_BAND_REALTIME : +seq_puts (s,"Realtime: " ); +break ; + } + +seq_printf (s,"grace_period %9u process_grace_period %9u process_quantum %9u\n" , + hw->hws.grace_period[band], hw->hws.process_grace_period[band], + hw->hws.process_quantum[band]); + } + +return 0 ; +} + +static int priority_bands_fops_open (struct inode *inode,struct file *file) +{ +return single_open (file, priority_bands_show, inode->i_private); +} + +static ssize_t +priority_bands_fops_write (struct file *file,const char __user *user_buf,size_t size,loff_t *pos) +{ +struct seq_file *s = file->private_data; +struct ivpu_device *vdev = s->private; +char buf[64 ]; +u32 grace_period; +u32 process_grace_period; +u32 process_quantum; +u32 band; +int ret; + +if (size >=sizeof (buf)) +return -EINVAL ; + + ret =simple_write_to_buffer (buf,sizeof (buf) -1 , pos, user_buf, size); +if (ret <0 ) +return ret; + + buf[size] ='\0' ; + ret =sscanf (buf,"%u %u %u %u" , &band, &grace_period, &process_grace_period, + &process_quantum); +if (ret !=4 ) +return -EINVAL ; + +if (band >=VPU_JOB_SCHEDULING_PRIORITY_BAND_COUNT ) +return -EINVAL ; + + vdev->hw->hws.grace_period[band] = grace_period; + vdev->hw->hws.process_grace_period[band] = process_grace_period; + vdev->hw->hws.process_quantum[band] = process_quantum; + +return size; +} + +static const struct file_operations ivpu_hws_priority_bands_fops = { + .owner =THIS_MODULE , + .open = priority_bands_fops_open, + .write = priority_bands_fops_write, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +void ivpu_debugfs_init (struct ivpu_device *vdev) {struct dentry *debugfs_root = vdev->drm.debugfs_root;
@@ -445,6 +527,8 @@ void ivpu_debugfs_init(struct ivpu_device *vdev) &fw_trace_hw_comp_mask_fops);debugfs_create_file ("fw_trace_level" ,0200 , debugfs_root, vdev, &fw_trace_level_fops); +debugfs_create_file ("hws_priority_bands" ,0200 , debugfs_root, vdev, + &ivpu_hws_priority_bands_fops);debugfs_create_file ("reset_engine" ,0200 , debugfs_root, vdev, &ivpu_reset_engine_fops);
drivers/accel/ivpu/ivpu_hw.c +21 -0
@@ -110,6 +110,26 @@ static void timeouts_init(struct ivpu_device *vdev) } } +static void priority_bands_init (struct ivpu_device *vdev) +{ +/* Idle */ + vdev->hw->hws.grace_period[VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE ] =0 ; + vdev->hw->hws.process_grace_period[VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE ] =50000 ; + vdev->hw->hws.process_quantum[VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE ] =160000 ; +/* Normal */ + vdev->hw->hws.grace_period[VPU_JOB_SCHEDULING_PRIORITY_BAND_NORMAL ] =50000 ; + vdev->hw->hws.process_grace_period[VPU_JOB_SCHEDULING_PRIORITY_BAND_NORMAL ] =50000 ; + vdev->hw->hws.process_quantum[VPU_JOB_SCHEDULING_PRIORITY_BAND_NORMAL ] =300000 ; +/* Focus */ + vdev->hw->hws.grace_period[VPU_JOB_SCHEDULING_PRIORITY_BAND_FOCUS ] =50000 ; + vdev->hw->hws.process_grace_period[VPU_JOB_SCHEDULING_PRIORITY_BAND_FOCUS ] =50000 ; + vdev->hw->hws.process_quantum[VPU_JOB_SCHEDULING_PRIORITY_BAND_FOCUS ] =200000 ; +/* Realtime */ + vdev->hw->hws.grace_period[VPU_JOB_SCHEDULING_PRIORITY_BAND_REALTIME ] =0 ; + vdev->hw->hws.process_grace_period[VPU_JOB_SCHEDULING_PRIORITY_BAND_REALTIME ] =50000 ; + vdev->hw->hws.process_quantum[VPU_JOB_SCHEDULING_PRIORITY_BAND_REALTIME ] =200000 ; +} +static void memory_ranges_init (struct ivpu_device *vdev) {if (ivpu_hw_ip_gen (vdev) ==IVPU_HW_IP_37XX ) {
@@ -248,6 +268,7 @@ int ivpu_hw_init(struct ivpu_device *vdev) {ivpu_hw_btrs_info_init (vdev);ivpu_hw_btrs_freq_ratios_init (vdev); +priority_bands_init (vdev);memory_ranges_init (vdev);platform_init (vdev);wa_init (vdev);
drivers/accel/ivpu/ivpu_hw.h +5 -0
@@ -45,6 +45,11 @@ struct ivpu_hw_info {u8 pn_ratio;u32 profiling_freq; } pll; +struct { +u32 grace_period[VPU_HWS_NUM_PRIORITY_BANDS ]; +u32 process_quantum[VPU_HWS_NUM_PRIORITY_BANDS ]; +u32 process_grace_period[VPU_HWS_NUM_PRIORITY_BANDS ]; + } hws;u32 tile_fuse;u32 sku;u16 config;
drivers/accel/ivpu/ivpu_jsm_msg.c +11 -18
@@ -7,6 +7,7 @@#include "ivpu_hw.h" #include "ivpu_ipc.h" #include "ivpu_jsm_msg.h" +#include "vpu_jsm_api.h" const char *ivpu_jsm_msg_type_to_str (enum vpu_ipc_msg_type type) {
@@ -409,26 +410,18 @@ int ivpu_jsm_hws_setup_priority_bands(struct ivpu_device *vdev) {struct vpu_jsm_msg req = { .type =VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP };struct vpu_jsm_msg resp; +struct ivpu_hw_info *hw = vdev->hw; +struct vpu_ipc_msg_payload_hws_priority_band_setup *setup = + &req.payload.hws_priority_band_setup;int ret; -/* Idle */ - req.payload.hws_priority_band_setup.grace_period[0 ] =0 ; - req.payload.hws_priority_band_setup.process_grace_period[0 ] =50000 ; - req.payload.hws_priority_band_setup.process_quantum[0 ] =160000 ; -/* Normal */ - req.payload.hws_priority_band_setup.grace_period[1 ] =50000 ; - req.payload.hws_priority_band_setup.process_grace_period[1 ] =50000 ; - req.payload.hws_priority_band_setup.process_quantum[1 ] =300000 ; -/* Focus */ - req.payload.hws_priority_band_setup.grace_period[2 ] =50000 ; - req.payload.hws_priority_band_setup.process_grace_period[2 ] =50000 ; - req.payload.hws_priority_band_setup.process_quantum[2 ] =200000 ; -/* Realtime */ - req.payload.hws_priority_band_setup.grace_period[3 ] =0 ; - req.payload.hws_priority_band_setup.process_grace_period[3 ] =50000 ; - req.payload.hws_priority_band_setup.process_quantum[3 ] =200000 ; - - req.payload.hws_priority_band_setup.normal_band_percentage =10 ; +for (int band =VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE ; + band <VPU_JOB_SCHEDULING_PRIORITY_BAND_COUNT ; band++) { + setup->grace_period[band] = hw->hws.grace_period[band]; + setup->process_grace_period[band] = hw->hws.process_grace_period[band]; + setup->process_quantum[band] = hw->hws.process_quantum[band]; + } + setup->normal_band_percentage =10 ; ret =ivpu_ipc_send_receive_internal (vdev, &req,VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP_RSP , &resp,VPU_IPC_CHAN_ASYNC_CMD , vdev->timeout.jsm);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 75/218 accel/ivpu: Trigger device recovery on engine reset/resume failure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karol Wachowski <[email protected]>
[ Upstream commit a47e36dc5d90dc664cac87304c17d50f1595d634 ]
Trigger full device recovery when the driver fails to restore device state via engine reset and resume operations. This is necessary because, even if submissions from a faulty context are blocked, the NPU may still process previously submitted faulty jobs if the engine reset fails to abort them. Such jobs can continue to generate faults and occupy device resources. When engine reset is ineffective, the only way to recover is to perform a full device recovery.
--- drivers/accel/ivpu/ivpu_job.c | 6 ++++-- drivers/accel/ivpu/ivpu_jsm_msg.c | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/accel/ivpu/ivpu_job.c +4 -2
@@ -849,7 +849,8 @@ void ivpu_context_abort_thread_handler(struct work_struct *work)unsigned long id;if (vdev->fw->sched_mode ==VPU_SCHEDULING_MODE_HW ) -ivpu_jsm_reset_engine (vdev,0 ); +if (ivpu_jsm_reset_engine (vdev,0 )) +return ;mutex_lock (&vdev->context_list_lock);xa_for_each (&vdev->context_xa, ctx_id, file_priv) {
@@ -865,7 +866,8 @@ void ivpu_context_abort_thread_handler(struct work_struct *work)if (vdev->fw->sched_mode !=VPU_SCHEDULING_MODE_HW )return ; -ivpu_jsm_hws_resume_engine (vdev,0 ); +if (ivpu_jsm_hws_resume_engine (vdev,0 )) +return ;/* * In hardware scheduling mode NPU already has stopped processing jobs * and won't send us any further notifications, thus we have to free job related resources
drivers/accel/ivpu/ivpu_jsm_msg.c +7 -2
@@ -7,6 +7,7 @@#include "ivpu_hw.h" #include "ivpu_ipc.h" #include "ivpu_jsm_msg.h" +#include "ivpu_pm.h" #include "vpu_jsm_api.h" const char *ivpu_jsm_msg_type_to_str (enum vpu_ipc_msg_type type)
@@ -163,8 +164,10 @@ int ivpu_jsm_reset_engine(struct ivpu_device *vdev, u32 engine) ret =ivpu_ipc_send_receive (vdev, &req,VPU_JSM_MSG_ENGINE_RESET_DONE , &resp,VPU_IPC_CHAN_ASYNC_CMD , vdev->timeout.jsm); -if (ret) +if (ret) {ivpu_err_ratelimited (vdev,"Failed to reset engine %d: %d\n" , engine, ret); +ivpu_pm_trigger_recovery (vdev,"Engine reset failed" ); + }return ret; }
@@ -354,8 +357,10 @@ int ivpu_jsm_hws_resume_engine(struct ivpu_device *vdev, u32 engine) ret =ivpu_ipc_send_receive (vdev, &req,VPU_JSM_MSG_HWS_RESUME_ENGINE_DONE , &resp,VPU_IPC_CHAN_ASYNC_CMD , vdev->timeout.jsm); -if (ret) +if (ret) {ivpu_err_ratelimited (vdev,"Failed to resume engine %d: %d\n" , engine, ret); +ivpu_pm_trigger_recovery (vdev,"Engine resume failed" ); + }return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 76/218 af_unix: Dont leave consecutive consumed OOB skbs.
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 32ca245464e1479bfea8592b9db227fdc1641705 ]
Jann Horn reported a use-after-free in unix_stream_read_generic().
The following sequences reproduce the issue:
$ python3 from socket import * s1, s2 = socketpair(AF_UNIX, SOCK_STREAM) s1.send(b'x', MSG_OOB) s2.recv(1, MSG_OOB) # leave a consumed OOB skb s1.send(b'y', MSG_OOB) s2.recv(1, MSG_OOB) # leave a consumed OOB skb s1.send(b'z', MSG_OOB) s2.recv(1) # recv 'z' illegally s2.recv(1, MSG_OOB) # access 'z' skb (use-after-free)
Even though a user reads OOB data, the skb holding the data stays on the recv queue to mark the OOB boundary and break the next recv().
After the last send() in the scenario above, the sk2's recv queue has 2 leading consumed OOB skbs and 1 real OOB skb.
Then, the following happens during the next recv() without MSG_OOB
1. unix_stream_read_generic() peeks the first consumed OOB skb
2. manage_oob() returns the next consumed OOB skb
3. unix_stream_read_generic() fetches the next not-yet-consumed OOB skb
4. unix_stream_read_generic() reads and frees the OOB skb
, and the last recv(MSG_OOB) triggers KASAN splat.
The 3. above occurs because of the SO_PEEK_OFF code, which does not expect unix_skb_len(skb) to be 0, but this is true for such consumed OOB skbs.
while (skip >= unix_skb_len(skb)) {
skip -= unix_skb_len(skb);
skb = skb_peek_next(skb, &sk->sk_receive_queue);
...
}In addition to this use-after-free, there is another issue that ioctl(SIOCATMARK) does not function properly with consecutive consumed OOB skbs.
So, nothing good comes out of such a situation.
Instead of complicating manage_oob(), ioctl() handling, and the next ECONNRESET fix by introducing a loop for consecutive consumed OOB skbs, let's not leave such consecutive OOB unnecessarily.
Now, while receiving an OOB skb in unix_stream_recv_urg(), if its previous skb is a consumed OOB skb, it is freed.
[0]:
BUG: KASAN: slab-use-after-free in unix_stream_read_actor (net/unix/af_unix.c:3027) Read of size 4 at addr ffff888106ef2904 by task python3/315 CPU: 2 UID: 0 PID: 315 Comm: python3 Not tainted 6.16.0-rc1-00407-gec315832f6f9 #8 PREEMPT(voluntary) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-4.fc42 04/01/2014 Call Trace: <TASK> dump_stack_lvl (lib/dump_stack.c:122) print_report (mm/kasan/report.c:409 mm/kasan/report.c:521) kasan_report (mm/kasan/report.c:636) unix_stream_read_actor (net/unix/af_unix.c:3027) unix_stream_read_generic (net/unix/af_unix.c:2708 net/unix/af_unix.c:2847) unix_stream_recvmsg (net/unix/af_unix.c:3048) sock_recvmsg (net/socket.c:1063 (discriminator 20) net/socket.c:1085 (discriminator 20)) __sys_recvfrom (net/socket.c:2278) __x64_sys_recvfrom (net/socket.c:2291 (discriminator 1) net/socket.c:2287 (discriminator 1) net/socket.c:2287 (discriminator 1)) do_syscall_64 (arch/x86/entry/syscall_64.c:63 (discriminator 1) arch/x86/entry/syscall_64.c:94 (discriminator 1)) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) RIP: 0033:0x7f8911fcea06 Code: 5d e8 41 8b 93 08 03 00 00 59 5e 48 83 f8 fc 75 19 83 e2 39 83 fa 08 75 11 e8 26 ff ff ff 66 0f 1f 44 00 00 48 8b 45 10 0f 05 <48> 8b 5d f8 c9 c3 0f 1f 40 00 f3 0f 1e fa 55 48 89 e5 48 83 ec 08 RSP: 002b:00007fffdb0dccb0 EFLAGS: 00000202 ORIG_RAX: 000000000000002d RAX: ffffffffffffffda RBX: 00007fffdb0dcdc8 RCX: 00007f8911fcea06 RDX: 0000000000000001 RSI: 00007f8911a5e060 RDI: 0000000000000006 RBP: 00007fffdb0dccd0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000202 R12: 00007f89119a7d20 R13: ffffffffc4653600 R14: 0000000000000000 R15: 0000000000000000 </TASK> Allocated by task 315: kasan_save_stack (mm/kasan/common.c:48) kasan_save_track (mm/kasan/common.c:60 (discriminator 1) mm/kasan/common.c:69 (discriminator 1)) __kasan_slab_alloc (mm/kasan/common.c:348) kmem_cache_alloc_node_noprof (./include/linux/kasan.h:250 mm/slub.c:4148 mm/slub.c:4197 mm/slub.c:4249) __alloc_skb (net/core/skbuff.c:660 (discriminator 4)) alloc_skb_with_frags (./include/linux/skbuff.h:1336 net/core/skbuff.c:6668) sock_alloc_send_pskb (net/core/sock.c:2993) unix_stream_sendmsg (./include/net/sock.h:1847 net/unix/af_unix.c:2256 net/unix/af_unix.c:2418) __sys_sendto (net/socket.c:712 (discriminator 20) net/socket.c:727 (discriminator 20) net/socket.c:2226 (discriminator 20)) __x64_sys_sendto (net/socket.c:2233 (discriminator 1) net/socket.c:2229 (discriminator 1) net/socket.c:2229 (discriminator 1)) do_syscall_64 (arch/x86/entry/syscall_64.c:63 (discriminator 1) arch/x86/entry/syscall_64.c:94 (discriminator 1)) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) Freed by task 315: kasan_save_stack (mm/kasan/common.c:48) kasan_save_track (mm/kasan/common.c:60 (discriminator 1) mm/kasan/common.c:69 (discriminator 1)) kasan_save_free_info (mm/kasan/generic.c:579 (discriminator 1)) __kasan_slab_free (mm/kasan/common.c:271) kmem_cache_free (mm/slub.c:4643 (discriminator 3) mm/slub.c:4745 (discriminator 3)) unix_stream_read_generic (net/unix/af_unix.c:3010) unix_stream_recvmsg (net/unix/af_unix.c:3048) sock_recvmsg (net/socket.c:1063 (discriminator 20) net/socket.c:1085 (discriminator 20)) __sys_recvfrom (net/socket.c:2278) __x64_sys_recvfrom (net/socket.c:2291 (discriminator 1) net/socket.c:2287 (discriminator 1) net/socket.c:2287 (discriminator 1)) do_syscall_64 (arch/x86/entry/syscall_64.c:63 (discriminator 1) arch/x86/entry/syscall_64.c:94 (discriminator 1)) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) The buggy address belongs to the object at ffff888106ef28c0 which belongs to the cache skbuff_head_cache of size 224
The buggy address is located 68 bytes inside of
freed 224-byte region [ffff888106ef28c0, ffff888106ef29a0)
The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888106ef3cc0 pfn:0x106ef2 head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x200000000000040(head|node=0|zone=2) page_type: f5(slab) raw: 0200000000000040 ffff8881001d28c0 ffffea000422fe00 0000000000000004 raw: ffff888106ef3cc0 0000000080190010 00000000f5000000 0000000000000000
head: 0200000000000040 ffff8881001d28c0 ffffea000422fe00 0000000000000004
head: ffff888106ef3cc0 0000000080190010 00000000f5000000 0000000000000000
head: 0200000000000001 ffffea00041bbc81 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff888106ef2800: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
ffff888106ef2880: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
>ffff888106ef2900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888106ef2980: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
ffff888106ef2a00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb--- net/unix/af_unix.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
net/unix/af_unix.c +11 -2
@@ -2613,11 +2613,11 @@ struct unix_stream_read_state {#if IS_ENABLED (CONFIG_AF_UNIX_OOB )static int unix_stream_recv_urg (struct unix_stream_read_state *state) { +struct sk_buff *oob_skb, *read_skb =NULL ;struct socket *sock = state->socket;struct sock *sk = sock->sk;struct unix_sock *u =unix_sk (sk);int chunk =1 ; -struct sk_buff *oob_skb;mutex_lock (&u->iolock);unix_state_lock (sk);
@@ -2632,9 +2632,16 @@ static int unix_stream_recv_urg(struct unix_stream_read_state *state) oob_skb = u->oob_skb; -if (!(state->flags &MSG_PEEK )) +if (!(state->flags &MSG_PEEK )) {WRITE_ONCE (u->oob_skb,NULL ); +if (oob_skb->prev != (struct sk_buff *)&sk->sk_receive_queue && + !unix_skb_len (oob_skb->prev)) { + read_skb = oob_skb->prev; +__skb_unlink (read_skb, &sk->sk_receive_queue); + } + } +spin_unlock (&sk->sk_receive_queue.lock);unix_state_unlock (sk);
@@ -2645,6 +2652,8 @@ static int unix_stream_recv_urg(struct unix_stream_read_state *state)mutex_unlock (&u->iolock); +consume_skb (read_skb); +if (chunk <0 )return -EFAULT ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 77/218 i2c: tiny-usb: disable zero-length read messages
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit cbdb25ccf7566eee0c2b945e35cb98baf9ed0aa6 upstream.
This driver passes the length of an i2c_msg directly to usb_control_msg(). If the message is now a read and of length 0, it violates the USB protocol and a warning will be printed. Enable the I2C_AQ_NO_ZERO_LEN_READ quirk for this adapter thus forbidding 0-length read messages altogether.
--- drivers/i2c/busses/i2c-tiny-usb.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/i2c/busses/i2c-tiny-usb.c +6 -0
@@ -138,6 +138,11 @@ out:return ret; } +/* prevent invalid 0-length usb_control_msg */ +static const struct i2c_adapter_quirks usb_quirks = { + .flags =I2C_AQ_NO_ZERO_LEN_READ , +}; +/* This is the actual algorithm we define */ static const struct i2c_algorithm usb_algorithm = { .xfer = usb_xfer,
@@ -246,6 +251,7 @@ static int i2c_tiny_usb_probe(struct usb/* setup i2c adapter description */ dev->adapter.owner =THIS_MODULE ; dev->adapter.class =I2C_CLASS_HWMON ; + dev->adapter.quirks = &usb_quirks; dev->adapter.algo = &usb_algorithm; dev->adapter.algo_data = dev; snprintf(dev->adapter.name, sizeof(dev->adapter.name),
Greg Kroah-Hartman
maintainerPATCH 78/218 i2c: robotfuzz-osif: disable zero-length read messages
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit 56ad91c1aa9c18064348edf69308080b03c9dc48 upstream.
This driver passes the length of an i2c_msg directly to usb_control_msg(). If the message is now a read and of length 0, it violates the USB protocol and a warning will be printed. Enable the I2C_AQ_NO_ZERO_LEN_READ quirk for this adapter thus forbidding 0-length read messages altogether.
--- drivers/i2c/busses/i2c-robotfuzz-osif.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/i2c/busses/i2c-robotfuzz-osif.c +6 -0
@@ -111,6 +111,11 @@ static u32 osif_func(struct i2c_adapterreturn I2C_FUNC_I2C |I2C_FUNC_SMBUS_EMUL ; } +/* prevent invalid 0-length usb_control_msg */ +static const struct i2c_adapter_quirks osif_quirks = { + .flags =I2C_AQ_NO_ZERO_LEN_READ , +}; +static const struct i2c_algorithm osif_algorithm = { .xfer = osif_xfer, .functionality = osif_func,
@@ -143,6 +148,7 @@ static int osif_probe(struct usb_interfa priv->adapter.owner =THIS_MODULE ; priv->adapter.class =I2C_CLASS_HWMON ; + priv->adapter.quirks = &osif_quirks; priv->adapter.algo = &osif_algorithm; priv->adapter.algo_data = priv; snprintf(priv->adapter.name, sizeof(priv->adapter.name),
Greg Kroah-Hartman
maintainerPATCH 79/218 ata: ahci: Use correct DMI identifier for ASUSPRO-D840SA LPM quirk
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
commit 3e0809b1664b9dc650d9dbca9a2d3ac690d4f661 upstream.
ASUS store the board name in DMI_PRODUCT_NAME rather than DMI_PRODUCT_VERSION. (Apparently it is only Lenovo that stores the model-name in DMI_PRODUCT_VERSION.)
Use the correct DMI identifier, DMI_PRODUCT_NAME, to match the ASUSPRO-D840SA board, such that the quirk actually gets applied.
--- drivers/ata/ahci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/ahci.c +1 -1
@@ -1456,7 +1456,7 @@ static bool ahci_broken_lpm(struct pci_d { .matches = { DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_VERSION, "ASUSPRO D840MB_M840SA"), + DMI_MATCH(DMI_PRODUCT_NAME, "ASUSPRO D840MB_M840SA"), }, /* 320 is broken, there is no known good version. */ },
Greg Kroah-Hartman
maintainerPATCH 80/218 smb: client: remove \t from TP_printk statements
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
commit e97f9540ce001503a4539f337da742c1dfa7d86a upstream.
The generate '[FAILED TO PARSE]' strings in trace-cmd report output like this:
rm-5298 [001] 6084.533748493: smb3_exit_err: [FAILED TO PARSE] xid=972 func_name=cifs_rmdir rc=-39 rm-5298 [001] 6084.533959234: smb3_enter: [FAILED TO PARSE] xid=973 func_name=cifs_closedir rm-5298 [001] 6084.533967630: smb3_close_enter: [FAILED TO PARSE] xid=973 fid=94489281833 tid=1 sesid=96758029877361 rm-5298 [001] 6084.534004008: smb3_cmd_enter: [FAILED TO PARSE] tid=1 sesid=96758029877361 cmd=6 mid=566 rm-5298 [001] 6084.552248232: smb3_cmd_done: [FAILED TO PARSE] tid=1 sesid=96758029877361 cmd=6 mid=566 rm-5298 [001] 6084.552280542: smb3_close_done: [FAILED TO PARSE] xid=973 fid=94489281833 tid=1 sesid=96758029877361 rm-5298 [001] 6084.552316034: smb3_exit_done: [FAILED TO PARSE] xid=973 func_name=cifs_closedir
--- fs/smb/client/trace.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
fs/smb/client/trace.h +12 -12
@@ -140,7 +140,7 @@ DECLARE_EVENT_CLASS(smb3_rw_err_class, __entry->len = len; __entry->rc = rc; ), -TP_printk ("\tR=%08x[%x] xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x rc=%d" , +TP_printk ("R=%08x[%x] xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x rc=%d" , __entry->rreq_debug_id, __entry->rreq_debug_index, __entry->xid, __entry->sesid, __entry->tid, __entry->fid, __entry->offset, __entry->len, __entry->rc)
@@ -190,7 +190,7 @@ DECLARE_EVENT_CLASS(smb3_other_err_class __entry->len = len; __entry->rc = rc; ), -TP_printk ("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x rc=%d" , +TP_printk ("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x rc=%d" , __entry->xid, __entry->sesid, __entry->tid, __entry->fid, __entry->offset, __entry->len, __entry->rc) )
@@ -247,7 +247,7 @@ DECLARE_EVENT_CLASS(smb3_copy_range_err_ __entry->len = len; __entry->rc = rc; ), -TP_printk ("\txid=%u sid=0x%llx tid=0x%x source fid=0x%llx source offset=0x%llx target fid=0x%llx target offset=0x%llx len=0x%x rc=%d" , +TP_printk ("xid=%u sid=0x%llx tid=0x%x source fid=0x%llx source offset=0x%llx target fid=0x%llx target offset=0x%llx len=0x%x rc=%d" , __entry->xid, __entry->sesid, __entry->tid, __entry->target_fid, __entry->src_offset, __entry->target_fid, __entry->target_offset, __entry->len, __entry->rc) )
@@ -298,7 +298,7 @@ DECLARE_EVENT_CLASS(smb3_copy_range_done __entry->target_offset = target_offset; __entry->len = len; ), -TP_printk ("\txid=%u sid=0x%llx tid=0x%x source fid=0x%llx source offset=0x%llx target fid=0x%llx target offset=0x%llx len=0x%x" , +TP_printk ("xid=%u sid=0x%llx tid=0x%x source fid=0x%llx source offset=0x%llx target fid=0x%llx target offset=0x%llx len=0x%x" , __entry->xid, __entry->sesid, __entry->tid, __entry->target_fid, __entry->src_offset, __entry->target_fid, __entry->target_offset, __entry->len) )
@@ -482,7 +482,7 @@ DECLARE_EVENT_CLASS(smb3_fd_class, __entry->tid = tid; __entry->sesid = sesid; ), -TP_printk ("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx" , +TP_printk ("xid=%u sid=0x%llx tid=0x%x fid=0x%llx" , __entry->xid, __entry->sesid, __entry->tid, __entry->fid) )
@@ -521,7 +521,7 @@ DECLARE_EVENT_CLASS(smb3_fd_err_class, __entry->sesid = sesid; __entry->rc = rc; ), -TP_printk ("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx rc=%d" , +TP_printk ("xid=%u sid=0x%llx tid=0x%x fid=0x%llx rc=%d" , __entry->xid, __entry->sesid, __entry->tid, __entry->fid, __entry->rc) )
@@ -793,7 +793,7 @@ DECLARE_EVENT_CLASS(smb3_cmd_err_class, __entry->status = status; __entry->rc = rc; ), -TP_printk ("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu status=0x%x rc=%d" , +TP_printk ("sid=0x%llx tid=0x%x cmd=%u mid=%llu status=0x%x rc=%d" , __entry->sesid, __entry->tid, __entry->cmd, __entry->mid, __entry->status, __entry->rc) )
@@ -828,7 +828,7 @@ DECLARE_EVENT_CLASS(smb3_cmd_done_class, __entry->cmd = cmd; __entry->mid = mid; ), -TP_printk ("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu" , +TP_printk ("sid=0x%llx tid=0x%x cmd=%u mid=%llu" , __entry->sesid, __entry->tid, __entry->cmd, __entry->mid) )
@@ -866,7 +866,7 @@ DECLARE_EVENT_CLASS(smb3_mid_class, __entry->when_sent = when_sent; __entry->when_received = when_received; ), -TP_printk ("\tcmd=%u mid=%llu pid=%u, when_sent=%lu when_rcv=%lu" , +TP_printk ("cmd=%u mid=%llu pid=%u, when_sent=%lu when_rcv=%lu" , __entry->cmd, __entry->mid, __entry->pid, __entry->when_sent, __entry->when_received) )
@@ -897,7 +897,7 @@ DECLARE_EVENT_CLASS(smb3_exit_err_class,__assign_str (func_name); __entry->rc = rc; ), -TP_printk ("\t%s: xid=%u rc=%d" , +TP_printk ("%s: xid=%u rc=%d" ,__get_str (func_name), __entry->xid, __entry->rc) )
@@ -923,7 +923,7 @@ DECLARE_EVENT_CLASS(smb3_sync_err_class, __entry->ino = ino; __entry->rc = rc; ), -TP_printk ("\tino=%lu rc=%d" , +TP_printk ("ino=%lu rc=%d" , __entry->ino, __entry->rc) )
@@ -949,7 +949,7 @@ DECLARE_EVENT_CLASS(smb3_enter_exit_clas __entry->xid = xid;__assign_str (func_name); ), -TP_printk ("\t%s: xid=%u" , +TP_printk ("%s: xid=%u" ,__get_str (func_name), __entry->xid) )
Greg Kroah-Hartman
maintainerPATCH 81/218 mm/damon/sysfs-schemes: free old damon_sysfs_scheme_filter->memcg_path on write
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 4f489fe6afb395dbc79840efa3c05440b760d883 upstream.
memcg_path_store() assigns a newly allocated memory buffer to filter->memcg_path, without deallocating the previously allocated and assigned memory buffer. As a result, users can leak kernel memory by continuously writing a data to memcg_path DAMOS sysfs file. Fix the leak by deallocating the previously set memory buffer.
--- mm/damon/sysfs-schemes.c | 1 + 1 file changed, 1 insertion(+)
mm/damon/sysfs-schemes.c +1 -0
@@ -423,6 +423,7 @@ static ssize_t memcg_path_store(struct kreturn -ENOMEM ;strscpy (path, buf, count +1 ); +kfree (filter->memcg_path); filter->memcg_path = path;return count; }
Greg Kroah-Hartman
maintainerPATCH 82/218 ASoC: amd: yc: Add DMI quirk for Lenovo IdeaPad Slim 5 15
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Schramm <[email protected]>
commit bf39286adc5e10ce3e32eb86ad316ae56f3b52a0 upstream.
It's smaller brother has already received the patch to enable the microphone, now add it too 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
@@ -356,6 +356,13 @@ static const struct dmi_system_id yc_acp { .driver_data = &acp6x_card, .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "83J3"), + } + }, + { + .driver_data = &acp6x_card, + .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"ASUSTeK COMPUTER INC." ), DMI_MATCH(DMI_PRODUCT_NAME, "UM5302TA"), }
Greg Kroah-Hartman
maintainerPATCH 83/218 s390/pkey: Prevent overflow in size calculation for memdup_user()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 7360ee47599af91a1d5f4e74d635d9408a54e489 upstream.
Number of apqn target list entries contained in 'nr_apqns' variable is determined by userspace via an ioctl call so the result of the product in calculation of size passed to memdup_user() may overflow.
In this case the actual size of the allocated area and the value describing it won't be in sync leading to various types of unpredictable behaviour later.
Use a proper memdup_array_user() helper which returns an error if an overflow is detected. Note that it is different from when nr_apqns is initially zero - that case is considered valid and should be handled in subsequent pkey_handler implementations.
Found by Linux Verification Center (linuxtesting.org).
--- drivers/s390/crypto/pkey_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/crypto/pkey_api.c +1 -1
@@ -85,7 +85,7 @@ static void *_copy_apqns_from_user(voidif (!uapqns || nr_apqns ==0 )return NULL ; -return memdup_user (uapqns, nr_apqns *sizeof (struct pkey_apqn )); +return memdup_array_user (uapqns, nr_apqns,sizeof (struct pkey_apqn )); }static int pkey_ioctl_genseck (struct pkey_genseck __user *ugs)
Greg Kroah-Hartman
maintainerPATCH 84/218 fs/proc/task_mmu: fix PAGE_IS_PFNZERO detection for the huge zero folio
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit 4a5e85f4eb8fd18b1266342d100e4f0849544ca0 upstream.
is_zero_pfn() does not work for the huge zero folio. Fix it by using is_huge_zero_pmd().
This can cause the PAGEMAP_SCAN ioctl against /proc/pid/pagemap to present pages as PAGE_IS_PRESENT rather than as PAGE_IS_PFNZERO.
Found by code inspection.
--- fs/proc/task_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/task_mmu.c +1 -1
@@ -2155,7 +2155,7 @@ static unsigned long pagemap_thp_categor categories |=PAGE_IS_FILE ; } -if (is_zero_pfn (pmd_pfn (pmd))) +if (is_huge_zero_pmd (pmd)) categories |=PAGE_IS_PFNZERO ;if (pmd_soft_dirty (pmd)) categories |=PAGE_IS_SOFT_DIRTY ;
Greg Kroah-Hartman
maintainerPATCH 85/218 lib/group_cpus: fix NULL pointer dereference from group_cpus_evenly()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
commit df831e97739405ecbaddb85516bc7d4d1c933d6b upstream.
While testing null_blk with configfs, echo 0 > poll_queues will trigger following panic:
BUG: kernel NULL pointer dereference, address: 0000000000000010 Oops: Oops: 0000 [#1] SMP NOPTI CPU: 27 UID: 0 PID: 920 Comm: bash Not tainted 6.15.0-02023-gadbdb95c8696-dirty #1238 PREEMPT(undef) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 RIP: 0010:__bitmap_or+0x48/0x70 Call Trace: <TASK> __group_cpus_evenly+0x822/0x8c0 group_cpus_evenly+0x2d9/0x490 blk_mq_map_queues+0x1e/0x110 null_map_queues+0xc9/0x170 [null_blk] blk_mq_update_queue_map+0xdb/0x160 blk_mq_update_nr_hw_queues+0x22b/0x560 nullb_update_nr_hw_queues+0x71/0xf0 [null_blk] nullb_device_poll_queues_store+0xa4/0x130 [null_blk] configfs_write_iter+0x109/0x1d0 vfs_write+0x26e/0x6f0 ksys_write+0x79/0x180 __x64_sys_write+0x1d/0x30 x64_sys_call+0x45c4/0x45f0 do_syscall_64+0xa5/0x240 entry_SYSCALL_64_after_hwframe+0x76/0x7e
Root cause is that numgrps is set to 0, and ZERO_SIZE_PTR is returned from kcalloc(), and later ZERO_SIZE_PTR will be deferenced.
Fix the problem by checking numgrps first in group_cpus_evenly(), and return NULL directly if numgrps is zero.
--- lib/group_cpus.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
lib/group_cpus.c +8 -1
@@ -352,6 +352,9 @@ struct cpumask *group_cpus_evenly(unsignint ret = -ENOMEM ;struct cpumask *masks =NULL ; +if (numgrps ==0 ) +return NULL ; +if (!zalloc_cpumask_var (&nmsk,GFP_KERNEL ))return NULL ;
@@ -426,8 +429,12 @@ struct cpumask *group_cpus_evenly(unsign#else /* CONFIG_SMP */ struct cpumask *group_cpus_evenly (unsigned int numgrps) { -struct cpumask *masks =kcalloc (numgrps,sizeof (*masks),GFP_KERNEL ); +struct cpumask *masks; +if (numgrps ==0 ) +return NULL ; + + masks =kcalloc (numgrps,sizeof (*masks),GFP_KERNEL );if (!masks)return NULL ;
Greg Kroah-Hartman
maintainerPATCH 86/218 Revert "riscv: Define TASK_SIZE_MAX for __access_ok()"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nam Cao <[email protected]>
commit 890ba5be6335dbbbc99af14ea007befb5f83f174 upstream.
This reverts commit ad5643cf2f69 ("riscv: Define TASK_SIZE_MAX for __access_ok()").
This commit changes TASK_SIZE_MAX to be LONG_MAX to optimize access_ok(), because the previous TASK_SIZE_MAX (default to TASK_SIZE) requires some computation.
The reasoning was that all user addresses are less than LONG_MAX, and all kernel addresses are greater than LONG_MAX. Therefore access_ok() can filter kernel addresses.
Addresses between TASK_SIZE and LONG_MAX are not valid user addresses, but access_ok() let them pass. That was thought to be okay, because they are not valid addresses at hardware level.
Unfortunately, one case is missed: get_user_pages_fast() happily accepts addresses between TASK_SIZE and LONG_MAX. futex(), for instance, uses get_user_pages_fast(). This causes the problem reported by Robert [1].
Therefore, revert this commit. TASK_SIZE_MAX is changed to the default:TASK_SIZE.
This unfortunately reduces performance, because TASK_SIZE is more expensive to compute compared to LONG_MAX. But correctness first, we can think about optimization later, if required.
--- arch/riscv/include/asm/pgtable.h | 1 - 1 file changed, 1 deletion(-)
arch/riscv/include/asm/pgtable.h +0 -1
@@ -916,7 +916,6 @@ static inline pte_t pte_swp_clear_exclus*/ #ifdef CONFIG_64BIT #define TASK_SIZE_64 (PGDIR_SIZE * PTRS_PER_PGD / 2) -#define TASK_SIZE_MAX LONG_MAX#ifdef CONFIG_COMPAT #define TASK_SIZE_32 (_AC(0x80000000, UL) - PAGE_SIZE)
Greg Kroah-Hartman
maintainerPATCH 87/218 Revert "riscv: misaligned: fix sleeping function called during misaligned access handling"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nam Cao <[email protected]>
commit 2f73c62d4e13df67380ff6faca39eec2bf08dd93 upstream.
This reverts commit 61a74ad25462 ("riscv: misaligned: fix sleeping function called during misaligned access handling"). The commit addresses a sleeping in atomic context problem, but it is not the correct fix as explained by Clément:
"Using nofault would lead to failure to read from user memory that is paged out for instance. This is not really acceptable, we should handle user misaligned access even at an address that would generate a page fault."
This bug has been properly fixed by commit 453805f0a28f ("riscv:
misaligned: enable IRQs while handling misaligned accesses").
Revert this improper fix.
--- arch/riscv/kernel/traps_misaligned.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/traps_misaligned.c +2 -2
@@ -429,7 +429,7 @@ int handle_misaligned_load(struct pt_reg val.data_u64 =0 ;if (user_mode (regs)) { -if (copy_from_user_nofault (&val, (u8 __user *)addr, len)) +if (copy_from_user (&val, (u8 __user *)addr, len))return -1 ; }else {memcpy (&val, (u8 *)addr, len);
@@ -530,7 +530,7 @@ int handle_misaligned_store(struct pt_rereturn -EOPNOTSUPP ;if (user_mode (regs)) { -if (copy_to_user_nofault ((u8 __user *)addr, &val, len)) +if (copy_to_user ((u8 __user *)addr, &val, len))return -1 ; }else {memcpy ((u8 *)addr, &val, len);
Greg Kroah-Hartman
maintainerPATCH 88/218 drm/dp: Change AUX DPCD probe address from DPCD_REV to LANE0_1_STATUS
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
commit a3ef3c2da675a8a564c8bea1a511cdd0a2a9aa49 upstream.
Reading DPCD registers has side-effects in general. In particular accessing registers outside of the link training register range (0x102-0x106, 0x202-0x207, 0x200c-0x200f, 0x2216) is explicitly forbidden by the DP v2.1 Standard, see
3.6.5.1 DPTX AUX Transaction Handling Mandates 3.6.7.4 128b/132b DP Link Layer LTTPR Link Training Mandates
Based on my tests, accessing the DPCD_REV register during the link training of an UHBR TBT DP tunnel sink leads to link training failures.
Solve the above by using the DP_LANE0_1_STATUS (0x202) register for the DPCD register access quirk.
--- drivers/gpu/drm/display/drm_dp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/display/drm_dp_helper.c +1 -1
@@ -664,7 +664,7 @@ ssize_t drm_dp_dpcd_read(struct drm_dp_a* monitor doesn't power down exactly after the throw away read. */ if (!aux->is_remote) { - ret =drm_dp_dpcd_probe (aux,DP_DPCD_REV ); + ret =drm_dp_dpcd_probe (aux,DP_LANE0_1_STATUS );if (ret <0 )return ret; }
Greg Kroah-Hartman
maintainerPATCH 89/218 drm/xe/display: Add check for alloc_ordered_workqueue()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
commit 62207293479e6c03ef498a70f2914c51f4d31d2c upstream.
Add check for the return value of alloc_ordered_workqueue() in xe_display_create() to catch potential exception.
--- drivers/gpu/drm/xe/display/xe_display.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/xe/display/xe_display.c +2 -0
@@ -96,6 +96,8 @@ int xe_display_create(struct xe_device *spin_lock_init (&xe->display.fb_tracking.lock); xe->display.hotplug.dp_wq =alloc_ordered_workqueue ("xe-dp" ,0 ); +if (!xe->display.hotplug.dp_wq) +return -ENOMEM ;return drmm_add_action_or_reset (&xe->drm, display_destroy,NULL ); }
Greg Kroah-Hartman
maintainerPATCH 90/218 HID: wacom: fix crash in wacom_aes_battery_handler()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zeitlhofer <[email protected]>
[ Upstream commit f3054152c12e2eed1e72704aff47b0ea58229584 ]
Commit fd2a9b29dc9c ("HID: wacom: Remove AES power_supply after extended inactivity") introduced wacom_aes_battery_handler() which is scheduled as a delayed work (aes_battery_work).
In wacom_remove(), aes_battery_work is not canceled. Consequently, if the device is removed while aes_battery_work is still pending, then hard crashes or "Oops: general protection fault..." are experienced when wacom_aes_battery_handler() is finally called. E.g., this happens with built-in USB devices after resume from hibernate when aes_battery_work was still pending at the time of hibernation.
So, take care to cancel aes_battery_work in wacom_remove().
--- drivers/hid/wacom_sys.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/wacom_sys.c +1 -0
@@ -2874,6 +2874,7 @@ static void wacom_remove(struct hid_device *hdev)hid_hw_stop (hdev);cancel_delayed_work_sync (&wacom->init_work); +cancel_delayed_work_sync (&wacom->aes_battery_work);cancel_work_sync (&wacom->wireless_work);cancel_work_sync (&wacom->battery_work);cancel_work_sync (&wacom->remote_work);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 91/218 atm: clip: prevent NULL deref in clip_push()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit b993ea46b3b601915ceaaf3c802adf11e7d6bac6 ]
Blamed commit missed that vcc_destroy_socket() calls clip_push() with a NULL skb.
If clip_devs is NULL, clip_push() then crashes when reading skb->truesize.
--- net/atm/clip.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/atm/clip.c +5 -6
@@ -193,12 +193,6 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)pr_debug ("\n" ); -if (!clip_devs) { -atm_return (vcc, skb->truesize); -kfree_skb (skb); -return ; - } -if (!skb) {pr_debug ("removing VCC %p\n" , clip_vcc);if (clip_vcc->entry)
@@ -208,6 +202,11 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)return ; }atm_return (vcc, skb->truesize); +if (!clip_devs) { +kfree_skb (skb); +return ; + } + skb->dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : clip_devs;/* clip_vcc->entry == NULL if we don't have an IP address yet */ if (!skb->dev) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 92/218 Bluetooth: hci_core: Fix use-after-free in vhci_flush()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 1d6123102e9fbedc8d25bf4731da6d513173e49e ]
syzbot reported use-after-free in vhci_flush() without repro. [0]
Quoted 1 line
From the splat, a thread close()d a vhci file descriptor while
its device was being used by iotcl() on another thread.
Once the last fd refcnt is released, vhci_release() calls hci_unregister_dev(), hci_free_dev(), and kfree() for struct vhci_data, which is set to hci_dev->dev->driver_data.
The problem is that there is no synchronisation after unlinking hdev from hci_dev_list in hci_unregister_dev(). There might be another thread still accessing the hdev which was fetched before the unlink operation.
We can use SRCU for such synchronisation.
Let's run hci_dev_reset() under SRCU and wait for its completion in hci_unregister_dev().
Another option would be to restore hci_dev->destruct(), which was removed in commit 587ae086f6e4 ("Bluetooth: Remove unused hci-destruct cb"). However, this would not be a good solution, as we should not run hci_unregister_dev() while there are in-flight ioctl() requests, which could lead to another data-race KCSAN splat.
Note that other drivers seem to have the same problem, for exmaple, virtbt_remove().
[0]:
BUG: KASAN: slab-use-after-free in skb_queue_empty_lockless include/linux/skbuff.h:1891 [inline] BUG: KASAN: slab-use-after-free in skb_queue_purge_reason+0x99/0x360 net/core/skbuff.c:3937 Read of size 8 at addr ffff88807cb8d858 by task syz.1.219/6718 CPU: 1 UID: 0 PID: 6718 Comm: syz.1.219 Not tainted 6.16.0-rc1-syzkaller-00196-g08207f42d3ff #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: <TASK> dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xd2/0x2b0 mm/kasan/report.c:521 kasan_report+0x118/0x150 mm/kasan/report.c:634 skb_queue_empty_lockless include/linux/skbuff.h:1891 [inline] skb_queue_purge_reason+0x99/0x360 net/core/skbuff.c:3937 skb_queue_purge include/linux/skbuff.h:3368 [inline] vhci_flush+0x44/0x50 drivers/bluetooth/hci_vhci.c:69 hci_dev_do_reset net/bluetooth/hci_core.c:552 [inline] hci_dev_reset+0x420/0x5c0 net/bluetooth/hci_core.c:592 sock_do_ioctl+0xd9/0x300 net/socket.c:1190 sock_ioctl+0x576/0x790 net/socket.c:1311 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fcf5b98e929 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fcf5c7b9038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fcf5bbb6160 RCX: 00007fcf5b98e929 RDX: 0000000000000000 RSI: 00000000400448cb RDI: 0000000000000009 RBP: 00007fcf5ba10b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fcf5bbb6160 R15: 00007ffd6353d528 </TASK> Allocated by task 6535: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __kmalloc_cache_noprof+0x230/0x3d0 mm/slub.c:4359 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1039 [inline] vhci_open+0x57/0x360 drivers/bluetooth/hci_vhci.c:635 misc_open+0x2bc/0x330 drivers/char/misc.c:161 chrdev_open+0x4c9/0x5e0 fs/char_dev.c:414 do_dentry_open+0xdf0/0x1970 fs/open.c:964 vfs_open+0x3b/0x340 fs/open.c:1094 do_open fs/namei.c:3887 [inline] path_openat+0x2ee5/0x3830 fs/namei.c:4046 do_filp_open+0x1fa/0x410 fs/namei.c:4073 do_sys_openat2+0x121/0x1c0 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1463 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 6535: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x62/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2381 [inline] slab_free mm/slub.c:4643 [inline] kfree+0x18e/0x440 mm/slub.c:4842 vhci_release+0xbc/0xd0 drivers/bluetooth/hci_vhci.c:671 __fput+0x44c/0xa70 fs/file_table.c:465 task_work_run+0x1d1/0x260 kernel/task_work.c:227 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x6ad/0x22e0 kernel/exit.c:955 do_group_exit+0x21c/0x2d0 kernel/exit.c:1104 __do_sys_exit_group kernel/exit.c:1115 [inline] __se_sys_exit_group kernel/exit.c:1113 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1113 x64_sys_call+0x21ba/0x21c0 arch/x86/include/generated/asm/syscalls_64.h:232 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88807cb8d800 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 88 bytes inside of
freed 1024-byte region [ffff88807cb8d800, ffff88807cb8dc00)
--- include/net/bluetooth/hci_core.h | 2 ++ net/bluetooth/hci_core.c | 34 ++++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-)
include/net/bluetooth/hci_core.h +2 -0
@@ -29,6 +29,7 @@#include <linux/idr.h> #include <linux/leds.h> #include <linux/rculist.h> +#include <linux/srcu.h> #include <net/bluetooth/hci.h> #include <net/bluetooth/hci_sync.h>
@@ -338,6 +339,7 @@ struct adv_monitor {struct hci_dev {struct list_head list; +struct srcu_struct srcu;struct mutex lock;struct ida unset_handle_ida;
net/bluetooth/hci_core.c +30 -4
@@ -64,7 +64,7 @@ static DEFINE_IDA(hci_index_ida);/* Get HCI device by index. * Device is held on return. */ -struct hci_dev *hci_dev_get (int index) +static struct hci_dev *__hci_dev_get (int index,int *srcu_index) {struct hci_dev *hdev =NULL , *d;
@@ -77,6 +77,8 @@ struct hci_dev *hci_dev_get(int index)list_for_each_entry (d, &hci_dev_list, list) {if (d->id == index) { hdev =hci_dev_hold (d); +if (srcu_index) + *srcu_index =srcu_read_lock (&d->srcu);break ; } }
@@ -84,6 +86,22 @@ struct hci_dev *hci_dev_get(int index)return hdev; } +struct hci_dev *hci_dev_get (int index) +{ +return __hci_dev_get (index,NULL ); +} + +static struct hci_dev *hci_dev_get_srcu (int index,int *srcu_index) +{ +return __hci_dev_get (index, srcu_index); +} + +static void hci_dev_put_srcu (struct hci_dev *hdev,int srcu_index) +{ +srcu_read_unlock (&hdev->srcu, srcu_index); +hci_dev_put (hdev); +} +/* ---- Inquiry support ---- */ bool hci_discovery_active (struct hci_dev *hdev)
@@ -568,9 +586,9 @@ static int hci_dev_do_reset(struct hci_dev *hdev)int hci_dev_reset (__u16 dev) {struct hci_dev *hdev; -int err; +int err, srcu_index; - hdev =hci_dev_get (dev); + hdev =hci_dev_get_srcu (dev, &srcu_index);if (!hdev)return -ENODEV ;
@@ -592,7 +610,7 @@ int hci_dev_reset(__u16 dev) err =hci_dev_do_reset (hdev); done: -hci_dev_put (hdev); +hci_dev_put_srcu (hdev, srcu_index);return err; }
@@ -2439,6 +2457,11 @@ struct hci_dev *hci_alloc_dev_priv(int sizeof_priv)if (!hdev)return NULL ; +if (init_srcu_struct (&hdev->srcu)) { +kfree (hdev); +return NULL ; + } + hdev->pkt_type = (HCI_DM1 |HCI_DH1 |HCI_HV1 ); hdev->esco_type = (ESCO_HV1 ); hdev->link_mode = (HCI_LM_ACCEPT );
@@ -2684,6 +2707,9 @@ void hci_unregister_dev(struct hci_dev *hdev)list_del (&hdev->list);write_unlock (&hci_dev_list_lock); +synchronize_srcu (&hdev->srcu); +cleanup_srcu_struct (&hdev->srcu); +disable_work_sync (&hdev->rx_work);disable_work_sync (&hdev->cmd_work);disable_work_sync (&hdev->tx_work);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 93/218 ALSA: usb-audio: Fix out-of-bounds read in snd_usb_get_audioformat_uac3()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Youngjun Lee <[email protected]>
[ Upstream commit fb4e2a6e8f28a3c0ad382e363aeb9cd822007b8a ]
In snd_usb_get_audioformat_uac3(), the length value returned from snd_usb_ctl_msg() is used directly for memory allocation without validation. This length is controlled by the USB device.
The allocated buffer is cast to a uac3_cluster_header_descriptor and its fields are accessed without verifying that the buffer is large enough. If the device returns a smaller than expected length, this leads to an out-of-bounds read.
Add a length check to ensure the buffer is large enough for uac3_cluster_header_descriptor.
--- sound/usb/stream.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/stream.c +2 -0
@@ -987,6 +987,8 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,* and request Cluster Descriptor */ wLength =le16_to_cpu (hc_header.wLength); +if (wLength <sizeof (cluster)) +return NULL ; cluster =kzalloc (wLength,GFP_KERNEL );if (!cluster)return ERR_PTR (-ENOMEM );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 94/218 attach_recursive_mnt(): do not lock the covering tree when sliding something under it
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit ce7df19686530920f2f6b636e71ce5eb1d9303ef ]
If we are propagating across the userns boundary, we need to lock the mounts added there. However, in case when something has already been mounted there and we end up sliding a new tree under that, the stuff that had been there before should not get locked.
IOW, lock_mnt_tree() should be called before we reparent the preexisting tree on top of what we are adding.
--- fs/namespace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/namespace.c +4 -4
@@ -2521,14 +2521,14 @@ static int attach_recursive_mnt(struct mount *source_mnt,hlist_for_each_entry_safe (child, n, &tree_list, mnt_hash) {struct mount *q;hlist_del_init (&child->mnt_hash); - q =__lookup_mnt (&child->mnt_parent->mnt, - child->mnt_mountpoint); -if (q) -mnt_change_mountpoint (child, smp, q);/* Notice when we are propagating across user namespaces */ if (child->mnt_parent->mnt_ns->user_ns != user_ns)lock_mnt_tree (child); child->mnt.mnt_flags &= ~MNT_LOCKED ; + q =__lookup_mnt (&child->mnt_parent->mnt, + child->mnt_mountpoint); +if (q) +mnt_change_mountpoint (child, smp, q);commit_tree (child); }put_mountpoint (smp);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 95/218 libbpf: Fix null pointer dereference in btf_dump__free on allocation failure
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <[email protected]>
[ Upstream commit aa485e8789d56a4573f7c8d000a182b749eaa64d ]
When btf_dump__new() fails to allocate memory for the internal hashmap (btf_dump->type_names), it returns an error code. However, the cleanup function btf_dump__free() does not check if btf_dump->type_names is NULL before attempting to free it. This leads to a null pointer dereference when btf_dump__free() is called on a btf_dump object.
--- tools/lib/bpf/btf_dump.c | 3 +++ 1 file changed, 3 insertions(+)
tools/lib/bpf/btf_dump.c +3 -0
@@ -225,6 +225,9 @@ static void btf_dump_free_names(struct hashmap *map)size_t bkt;struct hashmap_entry *cur; +if (!map) +return ; +hashmap__for_each_entry (map, cur, bkt)free ((void *)cur->pkey);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 96/218 ethernet: ionic: Fix DMA mapping tests
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit d5e3241c5a386a2425823c8c7afb77a465bd040f ]
Change error values of ionic_tx_map_single() and ionic_tx_map_frag() from 0 to DMA_MAPPING_ERROR to prevent collision with 0 as a valid address.
This also fixes the use of dma_mapping_error() to test against 0 in ionic_xdp_post_frame()
--- drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_txrx.c +6 -6
@@ -321,7 +321,7 @@ static int ionic_xdp_post_frame(struct ionic_queue *q, struct xdp_frame *frame, len, DMA_TO_DEVICE); }else /* XDP_REDIRECT */ { dma_addr =ionic_tx_map_single (q, frame->data, len); -if (!dma_addr) +if (dma_addr ==DMA_MAPPING_ERROR )return -EIO ; }
@@ -357,7 +357,7 @@ static int ionic_xdp_post_frame(struct ionic_queue *q, struct xdp_frame *frame, }else { dma_addr =ionic_tx_map_frag (q, frag,0 ,skb_frag_size (frag)); -if (dma_mapping_error (q->dev, dma_addr)) { +if (dma_addr ==DMA_MAPPING_ERROR ) {ionic_tx_desc_unmap_bufs (q, desc_info);return -EIO ; }
@@ -1083,7 +1083,7 @@ static dma_addr_t ionic_tx_map_single(struct ionic_queue *q,net_warn_ratelimited ("%s: DMA single map failed on %s!\n" ,dev_name (dev), q->name);q_to_tx_stats (q)->dma_map_err++; -return 0 ; +return DMA_MAPPING_ERROR ; }return dma_addr; }
@@ -1100,7 +1100,7 @@ static dma_addr_t ionic_tx_map_frag(struct ionic_queue *q,net_warn_ratelimited ("%s: DMA frag map failed on %s!\n" ,dev_name (dev), q->name);q_to_tx_stats (q)->dma_map_err++; -return 0 ; +return DMA_MAPPING_ERROR ; }return dma_addr; }
@@ -1116,7 +1116,7 @@ static int ionic_tx_map_skb(struct ionic_queue *q, struct sk_buff *skb,int frag_idx; dma_addr =ionic_tx_map_single (q, skb->data,skb_headlen (skb)); -if (!dma_addr) +if (dma_addr ==DMA_MAPPING_ERROR )return -EIO ; buf_info->dma_addr = dma_addr; buf_info->len =skb_headlen (skb);
@@ -1126,7 +1126,7 @@ static int ionic_tx_map_skb(struct ionic_queue *q, struct sk_buff *skb, nfrags =skb_shinfo (skb)->nr_frags;for (frag_idx =0 ; frag_idx < nfrags; frag_idx++, frag++) { dma_addr =ionic_tx_map_frag (q, frag,0 ,skb_frag_size (frag)); -if (!dma_addr) +if (dma_addr ==DMA_MAPPING_ERROR ) goto dma_fail; buf_info->dma_addr = dma_addr; buf_info->len =skb_frag_size (frag);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 97/218 wifi: mac80211: fix beacon interval calculation overflow
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lachlan Hodges <[email protected]>
[ Upstream commit 7a3750ff0f2e8fee338a9c168f429f6c37f0e820 ]
As we are converting from TU to usecs, a beacon interval of 100*1024 usecs will lead to integer wrapping. To fix change to use a u32.
--- net/mac80211/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/util.c +1 -1
@@ -3908,7 +3908,7 @@ void ieee80211_recalc_dtim(struct ieee80211_local *local, {u64 tsf =drv_get_tsf (local, sdata);u64 dtim_count =0 ; -u16 beacon_int = sdata->vif.bss_conf.beacon_int *1024 ; +u32 beacon_int = sdata->vif.bss_conf.beacon_int *1024 ;u8 dtim_period = sdata->vif.bss_conf.dtim_period;struct ps_data *ps;u8 bcns_from_dtim;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 98/218 af_unix: Dont set -ECONNRESET for consumed OOB skb.
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 2a5a4841846b079b5fca5752fe94e59346fbda40 ]
Christian Brauner reported that even after MSG_OOB data is consumed, calling close() on the receiver socket causes the peer's recv() to return -ECONNRESET:
1. send() and recv() an OOB data.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
from socket import *
s1, s2 =socketpair(AF_UNIX, SOCK_STREAM)s1.send(b'x', MSG_OOB)
1
>>> s2.recv(1, MSG_OOB)
b'x' 2. close() for s2 sets ECONNRESET to s1->sk_err even though
s2 consumed the OOB data
>>> s2.close()
>>> s1.recv(10, MSG_DONTWAIT)
...
ConnectionResetError: [Errno 104] Connection reset by peerEven after being consumed, the skb holding the OOB 1-byte data stays in the recv queue to mark the OOB boundary and break recv() at that point.
This must be considered while close()ing a socket.
Let's skip the leading consumed OOB skb while checking the -ECONNRESET condition in unix_release_sock().
--- net/unix/af_unix.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
net/unix/af_unix.c +12 -6
@@ -666,6 +666,11 @@ static void unix_sock_destructor(struct sock *sk)#endif } +static unsigned int unix_skb_len (const struct sk_buff *skb) +{ +return skb->len -UNIXCB (skb).consumed; +} +static void unix_release_sock (struct sock *sk,int embrion) {struct unix_sock *u =unix_sk (sk);
@@ -700,10 +705,16 @@ static void unix_release_sock(struct sock *sk, int embrion)if (skpair !=NULL ) {if (sk->sk_type ==SOCK_STREAM || sk->sk_type ==SOCK_SEQPACKET ) { +struct sk_buff *skb =skb_peek (&sk->sk_receive_queue); + +#if IS_ENABLED (CONFIG_AF_UNIX_OOB ) +if (skb && !unix_skb_len (skb)) + skb =skb_peek_next (skb, &sk->sk_receive_queue); +#endif unix_state_lock (skpair);/* No more writes */ WRITE_ONCE (skpair->sk_shutdown,SHUTDOWN_MASK ); -if (!skb_queue_empty_lockless (&sk->sk_receive_queue) || embrion) +if (skb || embrion)WRITE_ONCE (skpair->sk_err,ECONNRESET );unix_state_unlock (skpair); skpair->sk_state_change (skpair);
@@ -2594,11 +2605,6 @@ static long unix_stream_data_wait(struct sock *sk, long timeo,return timeo; } -static unsigned int unix_skb_len (const struct sk_buff *skb) -{ -return skb->len -UNIXCB (skb).consumed; -} -struct unix_stream_read_state {int (*recv_actor)(struct sk_buff *,int ,int ,struct unix_stream_read_state *);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 99/218 wifi: mac80211: Add link iteration macro for link data
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muna Sinada <[email protected]>
[ Upstream commit f61c7b3d442bef91dd432d468d08f72eadcc3209 ]
Currently before iterating through valid links we are utilizing open-coding when checking if vif valid_links is a non-zero value.
Add new macro, for_each_link_data(), which iterates through link_id and checks if it is set on vif valid_links. If it is a valid link then access link data for that link id.
Stable-dep-of: d87c3ca0f8f1 ("wifi: mac80211: finish link init before RCU publish")
--- net/mac80211/ieee80211_i.h | 9 +++++++++ 1 file changed, 9 insertions(+)
net/mac80211/ieee80211_i.h +9 -0
@@ -1209,6 +1209,15 @@ struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)if ((_link =wiphy_dereference ((local)->hw.wiphy, \ ___sdata->link[___link_id]))) +#define for_each_link_data (sdata, __link) \ + struct ieee80211_sub_if_data *__sdata = sdata; \ + for (int __link_id = 0; \ + __link_id < ARRAY_SIZE((__sdata)->link); __link_id++) \ + if ((!(__sdata)->vif.valid_links || \ + (__sdata)->vif.valid_links & BIT(__link_id)) && \ + ((__link) = sdata_dereference((__sdata)->link[__link_id], \ + (__sdata)))) + static inline int ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems, struct cfg80211_rnr_elems *rnr_elems,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 100/218 wifi: mac80211: Create separate links for VLAN interfaces
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muna Sinada <[email protected]>
[ Upstream commit 90233b0ad215efc9ea56a7c0b09021bcd4eea4ac ]
Currently, MLD links for an AP_VLAN interface type is not fully supported.
Add allocation of separate links for each VLAN interface and copy chanctx and chandef of AP bss to VLAN where necessary. Separate links are created because for Dynamic VLAN each link will have its own default_multicast_key.
Stable-dep-of: d87c3ca0f8f1 ("wifi: mac80211: finish link init before RCU publish")
--- net/mac80211/chan.c | 3 ++ net/mac80211/ieee80211_i.h | 3 ++ net/mac80211/iface.c | 12 ++++- net/mac80211/link.c | 90 ++++++++++++++++++++++++++++++++++++-- 4 files changed, 103 insertions(+), 5 deletions(-)
net/mac80211/chan.c +3 -0
@@ -2097,6 +2097,9 @@ void ieee80211_link_release_channel(struct ieee80211_link_data *link) {struct ieee80211_sub_if_data *sdata = link->sdata; +if (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN ) +return ; +lockdep_assert_wiphy (sdata->local->hw.wiphy);if (rcu_access_pointer (link->conf->chanctx_conf))
net/mac80211/ieee80211_i.h +3 -0
@@ -2070,6 +2070,9 @@ static inline void ieee80211_vif_clear_links(struct ieee80211_sub_if_data *sdataieee80211_vif_set_links (sdata,0 ,0 ); } +void ieee80211_apvlan_link_setup (struct ieee80211_sub_if_data *sdata); +void ieee80211_apvlan_link_clear (struct ieee80211_sub_if_data *sdata); +/* tx handling */ void ieee80211_clear_tx_pending (struct ieee80211_local *local);void ieee80211_tx_pending (struct tasklet_struct *t);
net/mac80211/iface.c +11 -1
@@ -494,6 +494,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_dobreak ;list_del_rcu (&sdata->u.mntr.list);break ; +case NL80211_IFTYPE_AP_VLAN : +ieee80211_apvlan_link_clear (sdata); +break ;default :break ; }
@@ -1268,6 +1271,8 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) sdata->crypto_tx_tailroom_needed_cnt += master->crypto_tx_tailroom_needed_cnt; +ieee80211_apvlan_link_setup (sdata); +break ; }case NL80211_IFTYPE_AP :
@@ -1322,7 +1327,12 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)case NL80211_IFTYPE_AP_VLAN :/* no need to tell driver, but set carrier and chanctx */ if (sdata->bss->active) { -ieee80211_link_vlan_copy_chanctx (&sdata->deflink); +struct ieee80211_link_data *link; + +for_each_link_data (sdata, link) { +ieee80211_link_vlan_copy_chanctx (link); + } +netif_carrier_on (dev);ieee80211_set_vif_encap_ops (sdata); }else {
net/mac80211/link.c +86 -4
122 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 101/218 wifi: mac80211: finish link init before RCU publish
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit d87c3ca0f8f1ca4c25f2ed819e954952f4d8d709 ]
Since the link/conf pointers can be accessed without any protection other than RCU, make sure the data is actually set up before publishing the structures.
--- net/mac80211/link.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/mac80211/link.c +3 -3
@@ -93,9 +93,6 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata,if (link_id <0 ) link_id =0 ; -rcu_assign_pointer (sdata->vif.link_conf[link_id], link_conf); -rcu_assign_pointer (sdata->link[link_id], link); -if (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN ) {struct ieee80211_sub_if_data *ap_bss;struct ieee80211_bss_conf *ap_bss_conf;
@@ -142,6 +139,9 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata,ieee80211_link_debugfs_add (link); } + +rcu_assign_pointer (sdata->vif.link_conf[link_id], link_conf); +rcu_assign_pointer (sdata->link[link_id], link); }void ieee80211_link_stop (struct ieee80211_link_data *link)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 102/218 vsock/uapi: fix linux/vm_sockets.h userspace compilation errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Garzarella <[email protected]>
[ Upstream commit 22bbc1dcd0d6785fb390c41f0dd5b5e218d23bdd ]
If a userspace application just include <linux/vm_sockets.h> will fail to build with the following errors:
/usr/include/linux/vm_sockets.h:182:39: error: invalid application of ‘sizeof’ to incomplete type ‘struct sockaddr’
182 | unsigned char svm_zero[sizeof(struct sockaddr) -
| ^~~~~~
/usr/include/linux/vm_sockets.h:183:39: error: ‘sa_family_t’ undeclared here (not in a function)
183 | sizeof(sa_family_t) -
|
Include <sys/socket.h> for userspace (guarded by ifndef __KERNEL__) where struct sockaddr and sa_family_t are defined.
We already do something similar in <linux/mptcp.h> and <linux/if.h>.
--- include/uapi/linux/vm_sockets.h | 4 ++++ 1 file changed, 4 insertions(+)
include/uapi/linux/vm_sockets.h +4 -0
@@ -17,6 +17,10 @@#ifndef _UAPI_VM_SOCKETS_H#define _UAPI_VM_SOCKETS_H +#ifndef __KERNEL__ +#include <sys/socket.h> /* for struct sockaddr and sa_family_t */ +#endif +#include <linux/socket.h> #include <linux/types.h>
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 103/218 bnxt: properly flush XDP redirect lists
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yan Zhai <[email protected]>
[ Upstream commit 9caca6ac0e26cd20efd490d8b3b2ffb1c7c00f6f ]
We encountered following crash when testing a XDP_REDIRECT feature in production:
[56251.579676] list_add corruption. next->prev should be prev (ffff93120dd40f30), but was ffffb301ef3a6740. (next=ffff93120dd 40f30). [56251.601413] ------------[ cut here ]------------ [56251.611357] kernel BUG at lib/list_debug.c:29! [56251.621082] Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI [56251.632073] CPU: 111 UID: 0 PID: 0 Comm: swapper/111 Kdump: loaded Tainted: P O 6.12.33-cloudflare-2025.6. 3 #1 [56251.653155] Tainted: [P]=PROPRIETARY_MODULE, [O]=OOT_MODULE [56251.663877] Hardware name: MiTAC GC68B-B8032-G11P6-GPU/S8032GM-HE-CFR, BIOS V7.020.B10-sig 01/22/2025 [56251.682626] RIP: 0010:__list_add_valid_or_report+0x4b/0xa0 [56251.693203] Code: 0e 48 c7 c7 68 e7 d9 97 e8 42 16 fe ff 0f 0b 48 8b 52 08 48 39 c2 74 14 48 89 f1 48 c7 c7 90 e7 d9 97 48 89 c6 e8 25 16 fe ff <0f> 0b 4c 8b 02 49 39 f0 74 14 48 89 d1 48 c7 c7 e8 e7 d9 97 4c 89 [56251.725811] RSP: 0018:ffff93120dd40b80 EFLAGS: 00010246 [56251.736094] RAX: 0000000000000075 RBX: ffffb301e6bba9d8 RCX: 0000000000000000 [56251.748260] RDX: 0000000000000000 RSI: ffff9149afda0b80 RDI: ffff9149afda0b80 [56251.760349] RBP: ffff9131e49c8000 R08: 0000000000000000 R09: ffff93120dd40a18 [56251.772382] R10: ffff9159cf2ce1a8 R11: 0000000000000003 R12: ffff911a80850000 [56251.784364] R13: ffff93120fbc7000 R14: 0000000000000010 R15: ffff9139e7510e40 [56251.796278] FS: 0000000000000000(0000) GS:ffff9149afd80000(0000) knlGS:0000000000000000 [56251.809133] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [56251.819561] CR2: 00007f5e85e6f300 CR3: 00000038b85e2006 CR4: 0000000000770ef0 [56251.831365] PKRU: 55555554 [56251.838653] Call Trace: [56251.845560] <IRQ> [56251.851943] cpu_map_enqueue.cold+0x5/0xa [56251.860243] xdp_do_redirect+0x2d9/0x480 [56251.868388] bnxt_rx_xdp+0x1d8/0x4c0 [bnxt_en] [56251.877028] bnxt_rx_pkt+0x5f7/0x19b0 [bnxt_en] [56251.885665] ? cpu_max_write+0x1e/0x100 [56251.893510] ? srso_alias_return_thunk+0x5/0xfbef5 [56251.902276] __bnxt_poll_work+0x190/0x340 [bnxt_en] [56251.911058] bnxt_poll+0xab/0x1b0 [bnxt_en] [56251.919041] ? srso_alias_return_thunk+0x5/0xfbef5 [56251.927568] ? srso_alias_return_thunk+0x5/0xfbef5 [56251.935958] ? srso_alias_return_thunk+0x5/0xfbef5 [56251.944250] __napi_poll+0x2b/0x160 [56251.951155] bpf_trampoline_6442548651+0x79/0x123 [56251.959262] __napi_poll+0x5/0x160 [56251.966037] net_rx_action+0x3d2/0x880 [56251.973133] ? srso_alias_return_thunk+0x5/0xfbef5 [56251.981265] ? srso_alias_return_thunk+0x5/0xfbef5 [56251.989262] ? __hrtimer_run_queues+0x162/0x2a0 [56251.996967] ? srso_alias_return_thunk+0x5/0xfbef5 [56252.004875] ? srso_alias_return_thunk+0x5/0xfbef5 [56252.012673] ? bnxt_msix+0x62/0x70 [bnxt_en] [56252.019903] handle_softirqs+0xcf/0x270 [56252.026650] irq_exit_rcu+0x67/0x90 [56252.032933] common_interrupt+0x85/0xa0 [56252.039498] </IRQ> [56252.044246] <TASK> [56252.048935] asm_common_interrupt+0x26/0x40 [56252.055727] RIP: 0010:cpuidle_enter_state+0xb8/0x420 [56252.063305] Code: dc 01 00 00 e8 f9 79 3b ff e8 64 f7 ff ff 49 89 c5 0f 1f 44 00 00 31 ff e8 a5 32 3a ff 45 84 ff 0f 85 ae 01 00 00 fb 45 85 f6 <0f> 88 88 01 00 00 48 8b 04 24 49 63 ce 4c 89 ea 48 6b f1 68 48 29 [56252.088911] RSP: 0018:ffff93120c97fe98 EFLAGS: 00000202 [56252.096912] RAX: ffff9149afd80000 RBX: ffff9141d3a72800 RCX: 0000000000000000 [56252.106844] RDX: 00003329176c6b98 RSI: ffffffe36db3fdc7 RDI: 0000000000000000 [56252.116733] RBP: 0000000000000002 R08: 0000000000000002 R09: 000000000000004e [56252.126652] R10: ffff9149afdb30c4 R11: 071c71c71c71c71c R12: ffffffff985ff860 [56252.136637] R13: 00003329176c6b98 R14: 0000000000000002 R15: 0000000000000000 [56252.146667] ? cpuidle_enter_state+0xab/0x420 [56252.153909] cpuidle_enter+0x2d/0x40 [56252.160360] do_idle+0x176/0x1c0 [56252.166456] cpu_startup_entry+0x29/0x30 [56252.173248] start_secondary+0xf7/0x100 [56252.179941] common_startup_64+0x13e/0x141 [56252.186886] </TASK>
Quoted 1 line
From the crash dump, we found that the
cpu_map_flush_listinside
redirect info is partially corrupted: its list_head->next points to itself, but list_head->prev points to a valid list of unflushed bq entries.
This turned out to be a result of missed XDP flush on redirect lists. By digging in the actual source code, we found that
commit 7f0a168b0441 ("bnxt_en: Add completion ring pointer in TX and RX ring structures") incorrectly overwrites the event mask for XDP_REDIRECT in bnxt_rx_xdp. We can stably reproduce this crash by returning XDP_TX and XDP_REDIRECT randomly for incoming packets in a naive XDP program. Properly propagate the XDP_REDIRECT events back fixes the crash.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +4 -1
@@ -2871,6 +2871,7 @@ static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, {struct bnxt_napi *bnapi = cpr->bnapi;u32 raw_cons = cpr->cp_raw_cons; +bool flush_xdp = false;u32 cons;int rx_pkts =0 ;u8 event =0 ;
@@ -2924,6 +2925,8 @@ static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,else rc =bnxt_force_rx_discard (bp, cpr, &raw_cons, &event); +if (event &BNXT_REDIRECT_EVENT ) + flush_xdp = true;if (likely (rc >=0 )) rx_pkts += rc;/* Increment rx_pkts when rc is -ENOMEM to count towards
@@ -2948,7 +2951,7 @@ static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, } } -if (event &BNXT_REDIRECT_EVENT ) { +if (flush_xdp) {xdp_do_flush (); event &= ~BNXT_REDIRECT_EVENT ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 104/218 um: ubd: Add missing error check in start_io_thread()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
[ Upstream commit c55c7a85e02a7bfee20a3ffebdff7cbeb41613ef ]
The subsequent call to os_set_fd_block() overwrites the previous return value. OR the two return values together to fix it.
--- arch/um/drivers/ubd_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/ubd_user.c +1 -1
@@ -41,7 +41,7 @@ int start_io_thread(unsigned long sp, int *fd_out) *fd_out = fds[1 ]; err =os_set_fd_block (*fd_out,0 ); - err =os_set_fd_block (kernel_fd,0 ); + err |=os_set_fd_block (kernel_fd,0 );if (err) {printk ("start_io_thread - failed to set nonblocking I/O.\n" ); goto out_close;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 105/218 libbpf: Fix possible use-after-free for externs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adin Scannell <[email protected]>
[ Upstream commit fa6f092cc0a02d0fcee37e9e8172eda372a03d33 ]
The name field in obj->externs points into the BTF data at initial open time. However, some functions may invalidate this after opening and before loading (e.g. bpf_map__set_value_size), which results in pointers into freed memory and undefined behavior.
The simplest solution is to simply strdup these strings, similar to the essent_name, and free them at the same time.
In order to test this path, the global_map_resize BPF selftest is modified slightly to ensure the presence of an extern, which causes this test to fail prior to the fix. Given there isn't an obvious API or error to test against, I opted to add this to the existing test as an aspect of the resizing feature rather than duplicate the test.
--- tools/lib/bpf/libbpf.c | 10 +++++++--- .../selftests/bpf/progs/test_global_map_resize.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-)
tools/lib/bpf/libbpf.c +7 -3
@@ -596,7 +596,7 @@ struct extern_desc {int sym_idx;int btf_id;int sec_btf_id; -const char *name; +char *name;char *essent_name;bool is_set;bool is_weak;
@@ -4223,7 +4223,9 @@ static int bpf_object__collect_externs(struct bpf_object *obj)return ext->btf_id; } t =btf__type_by_id (obj->btf, ext->btf_id); - ext->name =btf__name_by_offset (obj->btf, t->name_off); + ext->name =strdup (btf__name_by_offset (obj->btf, t->name_off)); +if (!ext->name) +return -ENOMEM ; ext->sym_idx = i; ext->is_weak =ELF64_ST_BIND (sym->st_info) ==STB_WEAK ;
@@ -9062,8 +9064,10 @@ void bpf_object__close(struct bpf_object *obj)zfree (&obj->btf_custom_path);zfree (&obj->kconfig); -for (i =0 ; i < obj->nr_extern; i++) +for (i =0 ; i < obj->nr_extern; i++) { +zfree (&obj->externs[i].name);zfree (&obj->externs[i].essent_name); + }zfree (&obj->externs); obj->nr_extern =0 ;
tools/testing/selftests/bpf/progs/test_global_map_resize.c +16 -0
@@ -32,6 +32,16 @@ int my_int_last SEC(".data.array_not_last"); int percpu_arr[1] SEC(".data.percpu_arr"); +/* at least one extern is included, to ensure that a specific +* regression is tested whereby resizing resulted in a free-after-use +* bug after type information is invalidated by the resize operation. +* +* There isn't a particularly good API to test for this specific condition, +* but by having externs for the resizing tests it will cover this path. +*/ +extern int LINUX_KERNEL_VERSION __kconfig; +long version_sink; + SEC("tp/syscalls/sys_enter_getpid")int bss_array_sum (void *ctx) {
@@ -44,6 +54,9 @@ int bss_array_sum(void *ctx)for (size_t i =0 ; i < bss_array_len; ++i) sum += array[i]; +/* see above; ensure this is not optimized out */ + version_sink =LINUX_KERNEL_VERSION ; +return 0 ; }
@@ -59,6 +72,9 @@ int data_array_sum(void *ctx)for (size_t i =0 ; i < data_array_len; ++i) sum += my_array[i]; +/* see above; ensure this is not optimized out */ + version_sink =LINUX_KERNEL_VERSION ; +return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 106/218 net: enetc: Correct endianness handling in _enetc_rd_reg64
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Horman <[email protected]>
[ Upstream commit 7b515f35a911fdc31fbde6531828dcd6ae9803d3 ]
enetc_hw.h provides two versions of _enetc_rd_reg64. One which simply calls ioread64() when available.
And another that composes the 64-bit result from ioread32() calls.
In the second case the code appears to assume that each ioread32() call returns a little-endian value. However both the shift and logical or used to compose the return value would not work correctly on big endian systems if this were the case. Moreover, this is inconsistent with the first case where the return value of ioread64() is assumed to be in host byte order.
It appears that the correct approach is for both versions to treat the return value of ioread*() functions as being in host byte order. And this patch corrects the ioread32()-based version to do so.
This is a bug but would only manifest on big endian systems that make use of the ioread32-based implementation of _enetc_rd_reg64. While all in-tree users of this driver are little endian and make use of the ioread64-based implementation of _enetc_rd_reg64. Thus, no in-tree user of this driver is affected by this bug.
Flagged by Sparse.
Compile tested only.
--- drivers/net/ethernet/freescale/enetc/enetc_hw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc_hw.h +1 -1
@@ -485,7 +485,7 @@ static inline u64 _enetc_rd_reg64(void __iomem *reg) tmp = ioread32(reg + 4); }while (high != tmp); -return le64_to_cpu ((__le64 )high <<32 | low); +return (u64 )high <<32 | low; }#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 107/218 netlink: specs: tc: replace underscores with dashes in names
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit eef0eaeca7fa8e358a31e89802f564451b797718 ]
We're trying to add a strict regexp for the name format in the spec. Underscores will not be allowed, dashes should be used instead. This makes no difference to C (codegen, if used, replaces special chars in names) but it gives more uniform naming in Python.
--- Documentation/netlink/specs/tc.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/netlink/specs/tc.yaml +2 -2
@@ -227,7 +227,7 @@ definitions: type: u8 doc: log(P_max / (qth-max - qth-min)) - - name: Scell_log + name: Scell-log type: u8 doc: cell size for idle damping -
@@ -248,7 +248,7 @@ definitions: name: DPs type: u32 - - name: def_DP + name: def-DP type: u32 - name: grio
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 108/218 atm: Release atm_dev_mutex after removing procfs in atm_dev_deregister().
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit a433791aeaea6e84df709e0b9584b9bbe040cd1c ]
syzbot reported a warning below during atm_dev_register(). [0]
Before creating a new device and procfs/sysfs for it, atm_dev_register() looks up a duplicated device by __atm_dev_lookup(). These operations are done under atm_dev_mutex.
However, when removing a device in atm_dev_deregister(), it releases the mutex just after removing the device from the list that __atm_dev_lookup() iterates over.
So, there will be a small race window where the device does not exist on the device list but procfs/sysfs are still not removed, triggering the splat.
Let's hold the mutex until procfs/sysfs are removed in atm_dev_deregister().
[0]:proc_dir_entry 'atm/atmtcp:0' already registered
WARNING: CPU: 0 PID: 5919 at fs/proc/generic.c:377 proc_register+0x455/0x5f0 fs/proc/generic.c:377 Modules linked in: CPU: 0 UID: 0 PID: 5919 Comm: syz-executor284 Not tainted 6.16.0-rc2-syzkaller-00047-g52da431bf03b #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 RIP: 0010:proc_register+0x455/0x5f0 fs/proc/generic.c:377 Code: 48 89 f9 48 c1 e9 03 80 3c 01 00 0f 85 a2 01 00 00 48 8b 44 24 10 48 c7 c7 20 c0 c2 8b 48 8b b0 d8 00 00 00 e8 0c 02 1c ff 90 <0f> 0b 90 90 48 c7 c7 80 f2 82 8e e8 0b de 23 09 48 8b 4c 24 28 48 RSP: 0018:ffffc9000466fa30 EFLAGS: 00010282 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff817ae248 RDX: ffff888026280000 RSI: ffffffff817ae255 RDI: 0000000000000001 RBP: ffff8880232bed48 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: ffff888076ed2140 R13: dffffc0000000000 R14: ffff888078a61340 R15: ffffed100edda444 FS: 00007f38b3b0c6c0(0000) GS:ffff888124753000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f38b3bdf953 CR3: 0000000076d58000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> proc_create_data+0xbe/0x110 fs/proc/generic.c:585 atm_proc_dev_register+0x112/0x1e0 net/atm/proc.c:361 atm_dev_register+0x46d/0x890 net/atm/resources.c:113 atmtcp_create+0x77/0x210 drivers/atm/atmtcp.c:369 atmtcp_attach drivers/atm/atmtcp.c:403 [inline] atmtcp_ioctl+0x2f9/0xd60 drivers/atm/atmtcp.c:464 do_vcc_ioctl+0x12c/0x930 net/atm/ioctl.c:159 sock_do_ioctl+0x115/0x280 net/socket.c:1190 sock_ioctl+0x227/0x6b0 net/socket.c:1311 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __x64_sys_ioctl+0x18b/0x210 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f38b3b74459 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 18 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f38b3b0c198 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f38b3bfe318 RCX: 00007f38b3b74459 RDX: 0000000000000000 RSI: 0000000000006180 RDI: 0000000000000005 RBP: 00007f38b3bfe310 R08: 65732f636f72702f R09: 65732f636f72702f R10: 65732f636f72702f R11: 0000000000000246 R12: 00007f38b3bcb0ac R13: 00007f38b3b0c1a0 R14: 0000200000000200 R15: 00007f38b3bcb03b </TASK>
--- net/atm/resources.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/atm/resources.c +1 -2
@@ -146,11 +146,10 @@ void atm_dev_deregister(struct atm_dev *dev)*/ mutex_lock (&atm_dev_mutex);list_del (&dev->dev_list); -mutex_unlock (&atm_dev_mutex); -atm_dev_release_vccs (dev);atm_unregister_sysfs (dev);atm_proc_dev_deregister (dev); +mutex_unlock (&atm_dev_mutex);atm_dev_put (dev); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 109/218 ALSA: hda/realtek: Fix built-in mic on ASUS VivoBook X507UAR
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Salvatore Bonaccorso <[email protected]>
[ Upstream commit 7ab6847a03229e73bb7c58ca397630f699e79b53 ]
The built-in mic of ASUS VivoBook X507UAR is broken recently by the fix of the pin sort. The fixup ALC256_FIXUP_ASUS_MIC_NO_PRESENCE is working for addressing the regression, too.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10933,6 +10933,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x1da2 ,"ASUS UP6502ZA/ZD" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1043 ,0x1df3 ,"ASUS UM5606WA" ,ALC294_FIXUP_BASS_SPEAKER_15 ),SND_PCI_QUIRK (0x1043 ,0x1e02 ,"ASUS UX3402ZA" ,ALC245_FIXUP_CS35L41_SPI_2 ), +SND_PCI_QUIRK (0x1043 ,0x1e10 ,"ASUS VivoBook X507UAR" ,ALC256_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x1e11 ,"ASUS Zephyrus G15" ,ALC289_FIXUP_ASUS_GA502 ),SND_PCI_QUIRK (0x1043 ,0x1e12 ,"ASUS UM3402" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x1043, 0x1e1f, "ASUS Vivobook 15 X1504VAP", ALC2XX_FIXUP_HEADSET_MIC),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 110/218 net: selftests: fix TCP packet checksum
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 8d89661a36dd3bb8c9902cff36dc0c144dce3faf ]
The length in the pseudo header should be the length of the L3 payload AKA the L4 header+payload. The selftest code builds the packet from the lower layers up, so all the headers are pushed already when it constructs L4. We need to subtract the lower layer headers from skb->len.
--- net/core/selftests.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/core/selftests.c +3 -2
@@ -160,8 +160,9 @@ static struct sk_buff *net_test_get_skb(struct net_device *ndev, skb->csum =0 ; skb->ip_summed =CHECKSUM_PARTIAL ;if (attr->tcp) { - thdr->check = ~tcp_v4_check (skb->len, ihdr->saddr, - ihdr->daddr,0 ); +int l4len = skb->len -skb_transport_offset (skb); + + thdr->check = ~tcp_v4_check (l4len, ihdr->saddr, ihdr->daddr,0 ); skb->csum_start =skb_transport_header (skb) - skb->head; skb->csum_offset = offsetof(struct tcphdr , check); }else {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 111/218 drm/amdgpu/discovery: optionally use fw based ip discovery
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 80a0e828293389358f7db56adcdcb22b28df5e11 ]
On chips without native IP discovery support, use the fw binary if available, otherwise we can continue without it.
Stable-dep-of: 73eab78721f7 ("drm/amd: Adjust output for discovery error handling")
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 40 +++++++++++++++---- 1 file changed, 32 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +32 -8
@@ -2429,6 +2429,38 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev) {int r; +switch (adev->asic_type) { +case CHIP_VEGA10 : +case CHIP_VEGA12 : +case CHIP_RAVEN : +case CHIP_VEGA20 : +case CHIP_ARCTURUS : +case CHIP_ALDEBARAN : +/* this is not fatal. We have a fallback below +* if the new firmwares are not present. some of +* this will be overridden below to keep things +* consistent with the current behavior. +*/ + r =amdgpu_discovery_reg_base_init (adev); +if (!r) { +amdgpu_discovery_harvest_ip (adev); +amdgpu_discovery_get_gfx_info (adev); +amdgpu_discovery_get_mall_info (adev); +amdgpu_discovery_get_vcn_info (adev); + } +break ; +default : + r =amdgpu_discovery_reg_base_init (adev); +if (r) +return -EINVAL ; + +amdgpu_discovery_harvest_ip (adev); +amdgpu_discovery_get_gfx_info (adev); +amdgpu_discovery_get_mall_info (adev); +amdgpu_discovery_get_vcn_info (adev); +break ; + } +switch (adev->asic_type) {case CHIP_VEGA10 :vega10_reg_base_init (adev);
@@ -2591,14 +2623,6 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev) adev->ip_versions[XGMI_HWIP ][0 ] =IP_VERSION (6 ,1 ,0 );break ;default : - r =amdgpu_discovery_reg_base_init (adev); -if (r) -return -EINVAL ; - -amdgpu_discovery_harvest_ip (adev); -amdgpu_discovery_get_gfx_info (adev); -amdgpu_discovery_get_mall_info (adev); -amdgpu_discovery_get_vcn_info (adev);break ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 112/218 drm/amd: Adjust output for discovery error handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 73eab78721f7b85216f1ca8c7b732f13213b5b32 ]
commit 017fbb6690c2 ("drm/amdgpu/discovery: check ip_discovery fw file available") added support for reading an amdgpu IP discovery bin file for some specific products. If it's not found then it will fallback to hardcoded values. However if it's not found there is also a lot of noise about missing files and errors.
Adjust the error handling to decrease most messages to DEBUG and to show users less about missing files.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +13 -15
@@ -301,10 +301,12 @@ static int amdgpu_discovery_read_binary_from_file(struct amdgpu_device *adev,const struct firmware *fw;int r; - r =request_firmware (&fw, fw_name, adev->dev); + r =firmware_request_nowarn (&fw, fw_name, adev->dev);if (r) { -dev_err (adev->dev,"can't load firmware \"%s\"\n" , - fw_name); +if (amdgpu_discovery ==2 ) +dev_err (adev->dev,"can't load firmware \"%s\"\n" , fw_name); +else +drm_info (&adev->ddev,"Optional firmware \"%s\" was not found\n" , fw_name);return r; }
@@ -419,16 +421,12 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)/* Read from file if it is the preferred option */ fw_name =amdgpu_discovery_get_fw_name (adev);if (fw_name !=NULL ) { -dev_info (adev->dev,"use ip discovery information from file" ); +drm_dbg (&adev->ddev,"use ip discovery information from file" ); r =amdgpu_discovery_read_binary_from_file (adev, adev->mman.discovery_bin, fw_name); - -if (r) { -dev_err (adev->dev,"failed to read ip discovery binary from file\n" ); - r = -EINVAL ; +if (r) goto out; - } - }else { +drm_dbg (&adev->ddev,"use ip discovery information from memory" ); r =amdgpu_discovery_read_binary_from_mem ( adev, adev->mman.discovery_bin);if (r)
@@ -1286,10 +1284,8 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)int r; r =amdgpu_discovery_init (adev); -if (r) { -DRM_ERROR ("amdgpu_discovery_init failed\n" ); +if (r)return r; - } adev->gfx.xcc_mask =0 ; adev->sdma.sdma_mask =0 ;
@@ -2451,8 +2447,10 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)break ;default : r =amdgpu_discovery_reg_base_init (adev); -if (r) -return -EINVAL ; +if (r) { +drm_err (&adev->ddev,"discovery failed: %d\n" , r); +return r; + }amdgpu_discovery_harvest_ip (adev);amdgpu_discovery_get_gfx_info (adev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 113/218 drm/i915: fix build error some more
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit d02b2103a08b6d6908f1d3d8e8783d3f342555ac ]
An earlier patch fixed a build failure with clang, but I still see the same problem with some configurations using gcc:
drivers/gpu/drm/i915/i915_pmu.c: In function 'config_mask':include/linux/compiler_types.h:568:38: error: call to '__compiletime_assert_462' declared with attribute error: BUILD_BUG_ON failed: bit > BITS_PER_TYPE(typeof_member(struct i915_pmu, enable)) - 1 drivers/gpu/drm/i915/i915_pmu.c:116:3: note: in expansion of macro 'BUILD_BUG_ON'
116 | BUILD_BUG_ON(bit >
As I understand it, the problem is that the function is not always fully inlined, but the __builtin_constant_p() can still evaluate the argument as being constant.
Marking it as __always_inline so far works for me in all configurations.
--- drivers/gpu/drm/i915/i915_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_pmu.c +1 -1
@@ -111,7 +111,7 @@ static unsigned int config_bit(const u64 config)return other_bit (config); } -static u32 config_mask (const u64 config) +static __always_inline u32 config_mask(const u64 config) {unsigned int bit =config_bit (config);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 114/218 drm/bridge: ti-sn65dsi86: make use of debugfs_init callback
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit 1d1f7b15cb9c11974cebfd39da51dc69b8cb31ff ]
Do not create a custom directory in debugfs-root, but use the debugfs_init callback to create a custom directory at the given place for the bridge. The new directory layout looks like this on a Renesas GrayHawk-Single with a R-Car V4M SoC:
/sys/kernel/debug/dri/feb00000.display/DP-1/1-002c
Stable-dep-of: 55e8ff842051 ("drm/bridge: ti-sn65dsi86: Add HPD for DisplayPort connector type")
--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 40 +++++++-------------------- 1 file changed, 10 insertions(+), 30 deletions(-)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +10 -30
@@ -424,36 +424,8 @@ static int status_show(struct seq_file *s, void *data)return 0 ; } -DEFINE_SHOW_ATTRIBUTE (status); -static void ti_sn65dsi86_debugfs_remove (void *data) -{ -debugfs_remove_recursive (data); -} - -static void ti_sn65dsi86_debugfs_init (struct ti_sn65dsi86 *pdata) -{ -struct device *dev = pdata->dev; -struct dentry *debugfs; -int ret; - - debugfs =debugfs_create_dir (dev_name (dev),NULL ); - -/* -* We might get an error back if debugfs wasn't enabled in the kernel -* so let's just silently return upon failure. -*/ -if (IS_ERR_OR_NULL (debugfs)) -return ; - - ret =devm_add_action_or_reset (dev, ti_sn65dsi86_debugfs_remove, debugfs); -if (ret) -return ; - -debugfs_create_file ("status" ,0600 , debugfs, pdata, &status_fops); -} -/* ----------------------------------------------------------------------------- * Auxiliary Devices (*not* AUX) */
@@ -1217,6 +1189,15 @@ static const struct drm_edid *ti_sn_bridge_edid_read(struct drm_bridge *bridge,return drm_edid_read_ddc (connector, &pdata->aux.ddc); } +static void ti_sn65dsi86_debugfs_init (struct drm_bridge *bridge,struct dentry *root) +{ +struct ti_sn65dsi86 *pdata =bridge_to_ti_sn65dsi86 (bridge); +struct dentry *debugfs; + + debugfs =debugfs_create_dir (dev_name (pdata->dev), root); +debugfs_create_file ("status" ,0600 , debugfs, pdata, &status_fops); +} +static const struct drm_bridge_funcs ti_sn_bridge_funcs = { .attach = ti_sn_bridge_attach, .detach = ti_sn_bridge_detach,
@@ -1230,6 +1211,7 @@ static const struct drm_bridge_funcs ti_sn_bridge_funcs = { .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .debugfs_init = ti_sn65dsi86_debugfs_init, }; static void ti_sn_bridge_parse_lanes(struct ti_sn65dsi86 *pdata,
@@ -1938,8 +1920,6 @@ static int ti_sn65dsi86_probe(struct i2c_client *client)if (ret)return ret; -ti_sn65dsi86_debugfs_init (pdata); -/* * Break ourselves up into a collection of aux devices. The only real * motiviation here is to solve the chicken-and-egg problem of probe
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 115/218 drm/bridge: ti-sn65dsi86: Add HPD for DisplayPort connector type
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jayesh Choudhary <[email protected]>
[ Upstream commit 55e8ff842051b1150461d7595d8f1d033c69d66b ]
By default, HPD was disabled on SN65DSI86 bridge. When the driver was added (commit "a095f15c00e27"), the HPD_DISABLE bit was set in pre-enable call which was moved to other function calls subsequently. Later on, commit "c312b0df3b13" added detect utility for DP mode. But with HPD_DISABLE bit set, all the HPD events are disabled[0] and the debounced state always return 1 (always connected state).
Set HPD_DISABLE bit conditionally based on display sink's connector type. Since the HPD_STATE is reflected correctly only after waiting for debounce time (~100-400ms) and adding this delay in detect() is not feasible owing to the performace impact (glitches and frame drop), remove runtime calls in detect() and add hpd_enable()/disable() bridge hooks with runtime calls, to detect hpd properly without any delay.
[0]: <https://www.ti.com/lit/gpn/SN65DSI86> (Pg. 32)
--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 69 +++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +60 -9
@@ -331,12 +331,18 @@ static void ti_sn65dsi86_enable_comms(struct ti_sn65dsi86 *pdata)* 200 ms. We'll assume that the panel driver will have the hardcoded * delay in its prepare and always disable HPD. * -* If HPD somehow makes sense on some future panel we'll have to -* change this to be conditional on someone specifying that HPD should -* be used. +* For DisplayPort bridge type, we need HPD. So we use the bridge type +* to conditionally disable HPD. +* NOTE: The bridge type is set in ti_sn_bridge_probe() but enable_comms() +* can be called before. So for DisplayPort, HPD will be enabled once +* bridge type is set. We are using bridge type instead of "no-hpd" +* property because it is not used properly in devicetree description +* and hence is unreliable. */ -regmap_update_bits (pdata->regmap,SN_HPD_DISABLE_REG ,HPD_DISABLE , -HPD_DISABLE ); + +if (pdata->bridge.type != DRM_MODE_CONNECTOR_DisplayPort) +regmap_update_bits (pdata->regmap,SN_HPD_DISABLE_REG ,HPD_DISABLE , +HPD_DISABLE ); pdata->comms_enabled = true;
@@ -1173,9 +1179,14 @@ static enum drm_connector_status ti_sn_bridge_detect(struct drm_bridge *bridge)struct ti_sn65dsi86 *pdata =bridge_to_ti_sn65dsi86 (bridge);int val =0 ; -pm_runtime_get_sync (pdata->dev); +/* +* Runtime reference is grabbed in ti_sn_bridge_hpd_enable() +* as the chip won't report HPD just after being powered on. +* HPD_DEBOUNCED_STATE reflects correct state only after the +* debounce time (~100-400 ms). +*/ +regmap_read (pdata->regmap,SN_HPD_DISABLE_REG , &val); -pm_runtime_put_autosuspend (pdata->dev);return val &HPD_DEBOUNCED_STATE ? connector_status_connected : connector_status_disconnected;
@@ -1198,6 +1209,26 @@ static void ti_sn65dsi86_debugfs_init(struct drm_bridge *bridge, struct dentry *debugfs_create_file ("status" ,0600 , debugfs, pdata, &status_fops); } +static void ti_sn_bridge_hpd_enable (struct drm_bridge *bridge) +{ +struct ti_sn65dsi86 *pdata =bridge_to_ti_sn65dsi86 (bridge); + +/* +* Device needs to be powered on before reading the HPD state +* for reliable hpd detection in ti_sn_bridge_detect() due to +* the high debounce time. +*/ + +pm_runtime_get_sync (pdata->dev); +} + +static void ti_sn_bridge_hpd_disable (struct drm_bridge *bridge) +{ +struct ti_sn65dsi86 *pdata =bridge_to_ti_sn65dsi86 (bridge); + +pm_runtime_put_autosuspend (pdata->dev); +} +static const struct drm_bridge_funcs ti_sn_bridge_funcs = { .attach = ti_sn_bridge_attach, .detach = ti_sn_bridge_detach,
@@ -1212,6 +1243,8 @@ static const struct drm_bridge_funcs ti_sn_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .debugfs_init = ti_sn65dsi86_debugfs_init, + .hpd_enable = ti_sn_bridge_hpd_enable, + .hpd_disable = ti_sn_bridge_hpd_disable, }; static void ti_sn_bridge_parse_lanes(struct ti_sn65dsi86 *pdata,
@@ -1300,8 +1333,26 @@ static int ti_sn_bridge_probe(struct auxiliary_device *adev, pdata->bridge.type = pdata->next_bridge->type == DRM_MODE_CONNECTOR_DisplayPort ? DRM_MODE_CONNECTOR_DisplayPort : DRM_MODE_CONNECTOR_eDP; -if (pdata->bridge.type == DRM_MODE_CONNECTOR_DisplayPort) - pdata->bridge.ops =DRM_BRIDGE_OP_EDID |DRM_BRIDGE_OP_DETECT ; +if (pdata->bridge.type == DRM_MODE_CONNECTOR_DisplayPort) { + pdata->bridge.ops =DRM_BRIDGE_OP_EDID |DRM_BRIDGE_OP_DETECT | +DRM_BRIDGE_OP_HPD ; +/* +* If comms were already enabled they would have been enabled +* with the wrong value of HPD_DISABLE. Update it now. Comms +* could be enabled if anyone is holding a pm_runtime reference +* (like if a GPIO is in use). Note that in most cases nobody +* is doing AUX channel xfers before the bridge is added so +* HPD doesn't _really_ matter then. The only exception is in +* the eDP case where the panel wants to read the EDID before +* the bridge is added. We always consistently have HPD disabled +* for eDP. +*/ +mutex_lock (&pdata->comms_mutex); +if (pdata->comms_enabled) +regmap_update_bits (pdata->regmap,SN_HPD_DISABLE_REG , +HPD_DISABLE ,0 ); +mutex_unlock (&pdata->comms_mutex); + };drm_bridge_add (&pdata->bridge);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 116/218 drm/xe: Process deferred GGTT node removals on device unwind
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Wajdeczko <[email protected]>
[ Upstream commit af2b588abe006bd55ddd358c4c3b87523349c475 ]
While we are indirectly draining our dedicated workqueue ggtt->wq that we use to complete asynchronous removal of some GGTT nodes, this happends as part of the managed-drm unwinding (ggtt_fini_early), which could be later then manage-device unwinding, where we could already unmap our MMIO/GMS mapping (mmio_fini).
This was recently observed during unsuccessful VF initialization:
[ ] xe 0000:00:02.1: probe with driver xe failed with error -62
[ ] xe 0000:00:02.1: DEVRES REL ffff88811e747340 __xe_bo_unpin_map_no_vm (16 bytes) [ ] xe 0000:00:02.1: DEVRES REL ffff88811e747540 __xe_bo_unpin_map_no_vm (16 bytes) [ ] xe 0000:00:02.1: DEVRES REL ffff88811e747240 __xe_bo_unpin_map_no_vm (16 bytes) [ ] xe 0000:00:02.1: DEVRES REL ffff88811e747040 tiles_fini (16 bytes)
[ ] xe 0000:00:02.1: DEVRES REL ffff88811e746840 mmio_fini (16 bytes)
[ ] xe 0000:00:02.1: DEVRES REL ffff88811e747f40 xe_bo_pinned_fini (16 bytes)
[ ] xe 0000:00:02.1: DEVRES REL ffff88811e746b40 devm_drm_dev_init_release (16 bytes) [ ] xe 0000:00:02.1: [drm:drm_managed_release] drmres release begin
[ ] xe 0000:00:02.1: [drm:drm_managed_release] REL ffff88810ef81640 __fini_relay (8 bytes) [ ] xe 0000:00:02.1: [drm:drm_managed_release] REL ffff88810ef80d40 guc_ct_fini (8 bytes) [ ] xe 0000:00:02.1: [drm:drm_managed_release] REL ffff88810ef80040 __drmm_mutex_release (8 bytes) [ ] xe 0000:00:02.1: [drm:drm_managed_release] REL ffff88810ef80140 ggtt_fini_early (8 bytes)
and this was leading to:
[ ] BUG: unable to handle page fault for address: ffffc900058162a0 [ ] #PF: supervisor write access in kernel mode
[ ] #PF: error_code(0x0002) - not-present page
[ ] Oops: Oops: 0002 [#1] SMP NOPTI
[ ] Tainted: [W]=WARN
[ ] Workqueue: xe-ggtt-wq ggtt_node_remove_work_func [xe] [ ] RIP: 0010:xe_ggtt_set_pte+0x6d/0x350 [xe]
[ ] Call Trace:
[ ] <TASK> [ ] xe_ggtt_clear+0xb0/0x270 [xe] [ ] ggtt_node_remove+0xbb/0x120 [xe] [ ] ggtt_node_remove_work_func+0x30/0x50 [xe] [ ] process_one_work+0x22b/0x6f0 [ ] worker_thread+0x1e8/0x3d
Add managed-device action that will explicitly drain the workqueue with all pending node removals prior to releasing MMIO/GSM mapping.
--- drivers/gpu/drm/xe/xe_ggtt.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/xe/xe_ggtt.c +11 -0
@@ -198,6 +198,13 @@ static const struct xe_ggtt_pt_ops xelpg_pt_wa_ops = { .ggtt_set_pte = xe_ggtt_set_pte_and_flush, }; +static void dev_fini_ggtt (void *arg) +{ +struct xe_ggtt *ggtt = arg; + +drain_workqueue (ggtt->wq); +} +/** * xe_ggtt_init_early - Early GGTT initialization * @ggtt: the &xe_ggtt to be initialized
@@ -254,6 +261,10 @@ int xe_ggtt_init_early(struct xe_ggtt *ggtt)if (err)return err; + err =devm_add_action_or_reset (xe->drm.dev, dev_fini_ggtt, ggtt); +if (err) +return err; +if (IS_SRIOV_VF (xe)) { err =xe_gt_sriov_vf_prepare_ggtt (xe_tile_get_gt (ggtt->tile,0 ));if (err)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 117/218 smb: client: fix potential deadlock when reconnecting channels
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
[ Upstream commit 711741f94ac3cf9f4e3aa73aa171e76d188c0819 ]
Fix cifs_signal_cifsd_for_reconnect() to take the correct lock order and prevent the following deadlock from happening
======================================================
WARNING: possible circular locking dependency detected
6.16.0-rc3-build2+ #1301 Tainted: G S W
------------------------------------------------------
cifsd/6055 is trying to acquire lock:ffff88810ad56038 (&tcp_ses->srv_lock){+.+.}-{3:3}, at: cifs_signal_cifsd_for_reconnect+0x134/0x200
but task is already holding lock:ffff888119c64330 (&ret_buf->chan_lock){+.+.}-{3:3}, at: cifs_signal_cifsd_for_reconnect+0xcf/0x200
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&ret_buf->chan_lock){+.+.}-{3:3}:
validate_chain+0x1cf/0x270
__lock_acquire+0x60e/0x780
lock_acquire.part.0+0xb4/0x1f0
_raw_spin_lock+0x2f/0x40
cifs_setup_session+0x81/0x4b0
cifs_get_smb_ses+0x771/0x900
cifs_mount_get_session+0x7e/0x170
cifs_mount+0x92/0x2d0
cifs_smb3_do_mount+0x161/0x460
smb3_get_tree+0x55/0x90
vfs_get_tree+0x46/0x180
do_new_mount+0x1b0/0x2e0
path_mount+0x6ee/0x740
do_mount+0x98/0xe0
__do_sys_mount+0x148/0x180
do_syscall_64+0xa4/0x260
entry_SYSCALL_64_after_hwframe+0x76/0x7e-> #1 (&ret_buf->ses_lock){+.+.}-{3:3}:
validate_chain+0x1cf/0x270
__lock_acquire+0x60e/0x780
lock_acquire.part.0+0xb4/0x1f0
_raw_spin_lock+0x2f/0x40
cifs_match_super+0x101/0x320
sget+0xab/0x270
cifs_smb3_do_mount+0x1e0/0x460
smb3_get_tree+0x55/0x90
vfs_get_tree+0x46/0x180
do_new_mount+0x1b0/0x2e0
path_mount+0x6ee/0x740
do_mount+0x98/0xe0
__do_sys_mount+0x148/0x180
do_syscall_64+0xa4/0x260
entry_SYSCALL_64_after_hwframe+0x76/0x7e-> #0 (&tcp_ses->srv_lock){+.+.}-{3:3}:
check_noncircular+0x95/0xc0
check_prev_add+0x115/0x2f0
validate_chain+0x1cf/0x270
__lock_acquire+0x60e/0x780
lock_acquire.part.0+0xb4/0x1f0
_raw_spin_lock+0x2f/0x40
cifs_signal_cifsd_for_reconnect+0x134/0x200
__cifs_reconnect+0x8f/0x500
cifs_handle_standard+0x112/0x280
cifs_demultiplex_thread+0x64d/0xbc0
kthread+0x2f7/0x310
ret_from_fork+0x2a/0x230
ret_from_fork_asm+0x1a/0x30other info that might help us debug this:
Chain exists of: &tcp_ses->srv_lock --> &ret_buf->ses_lock --> &ret_buf->chan_lock Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&ret_buf->chan_lock);
lock(&ret_buf->ses_lock);
lock(&ret_buf->chan_lock); lock(&tcp_ses->srv_lock);
*** DEADLOCK ***
3 locks held by cifsd/6055:
#0: ffffffff857de398 (&cifs_tcp_ses_lock){+.+.}-{3:3}, at: cifs_signal_cifsd_for_reconnect+0x7b/0x200 #1: ffff888119c64060 (&ret_buf->ses_lock){+.+.}-{3:3}, at: cifs_signal_cifsd_for_reconnect+0x9c/0x200 #2: ffff888119c64330 (&ret_buf->chan_lock){+.+.}-{3:3}, at: cifs_signal_cifsd_for_reconnect+0xcf/0x200
--- fs/smb/client/cifsglob.h | 1 + fs/smb/client/connect.c | 58 +++++++++++++++++++++++++--------------- 2 files changed, 37 insertions(+), 22 deletions(-)
fs/smb/client/cifsglob.h +1 -0
@@ -677,6 +677,7 @@ inc_rfc1001_len(void *buf, int count)struct TCP_Server_Info {struct list_head tcp_ses_list;struct list_head smb_ses_list; +struct list_head rlist;/* reconnect list */ spinlock_t srv_lock;/* protect anything here that is not protected */ __u64 conn_id;/* connection identifier (useful for debugging) */ int srv_count;/* reference counter */
fs/smb/client/connect.c +36 -22
81 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 118/218 smb: smbdirect: add smbdirect_pdu.h with protocol definitions
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit 00fab6cf323fa5850e6cbe283b23e605e6e97912 ]
This is just a start moving into a common smbdirect layer.
It will be used in the next commits...
Stable-dep-of: 43e7e284fc77 ("cifs: Fix the smbd_response slab to allow usercopy")
--- fs/smb/common/smbdirect/smbdirect_pdu.h | 55 +++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 fs/smb/common/smbdirect/smbdirect_pdu.h
fs/smb/common/smbdirect/smbdirect_pdu.h new file +55 -0
@@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (c) 2017 Stefan Metzmacher +*/ + +#ifndef __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_PDU_H__ +#define __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_PDU_H__ + +#define SMBDIRECT_V1 0x0100 + +/* SMBD negotiation request packet [MS-SMBD] 2.2.1 */ +struct smbdirect_negotiate_req { +__le16 min_version; +__le16 max_version; +__le16 reserved; +__le16 credits_requested; +__le32 preferred_send_size; +__le32 max_receive_size; +__le32 max_fragmented_size; +} __packed; + +/* SMBD negotiation response packet [MS-SMBD] 2.2.2 */ +struct smbdirect_negotiate_resp { +__le16 min_version; +__le16 max_version; +__le16 negotiated_version; +__le16 reserved; +__le16 credits_requested; +__le16 credits_granted; +__le32 status; +__le32 max_readwrite_size; +__le32 preferred_send_size; +__le32 max_receive_size; +__le32 max_fragmented_size; +} __packed; + +#define SMBDIRECT_DATA_MIN_HDR_SIZE 0x14 +#define SMBDIRECT_DATA_OFFSET 0x18 + +#define SMBDIRECT_FLAG_RESPONSE_REQUESTED 0x0001 + +/* SMBD data transfer packet with payload [MS-SMBD] 2.2.3 */ +struct smbdirect_data_transfer { +__le16 credits_requested; +__le16 credits_granted; +__le16 flags; +__le16 reserved; +__le32 remaining_data_length; +__le32 data_offset; +__le32 data_length; +__le32 padding; +__u8 buffer[]; +} __packed; + +#endif /* __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_PDU_H__ */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 119/218 smb: client: make use of common smbdirect_pdu.h
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit 64946d5be665ddac6b5bf11f5b5ff319aae0f4c6 ]
Stable-dep-of: 43e7e284fc77 ("cifs: Fix the smbd_response slab to allow usercopy")
--- fs/smb/client/smbdirect.c | 40 ++++++++++++++++++-------------------- fs/smb/client/smbdirect.h | 41 --------------------------------------- 2 files changed, 19 insertions(+), 62 deletions(-)
fs/smb/client/smbdirect.c +19 -21
@@ -7,6 +7,7 @@#include <linux/module.h> #include <linux/highmem.h> #include <linux/folio_queue.h> +#include "../common/smbdirect/smbdirect_pdu.h" #include "smbdirect.h" #include "cifs_debug.h" #include "cifsproto.h"
@@ -50,9 +51,6 @@ struct smb_extract_to_rdma {static ssize_t smb_extract_iter_to_rdma (struct iov_iter *iter,size_t len,struct smb_extract_to_rdma *rdma); -/* SMBD version number */ -#define SMBD_V1 0x0100 -/* Port numbers for SMBD transport */ #define SMB_PORT 445#define SMBD_PORT 5445
@@ -299,7 +297,7 @@ static void send_done(struct ib_cq *cq, struct ib_wc *wc)mempool_free (request, request->info->request_mempool); } -static void dump_smbd_negotiate_resp (struct smbd_negotiate_resp *resp) +static void dump_smbdirect_negotiate_resp (struct smbdirect_negotiate_resp *resp) { log_rdma_event(INFO, "resp message min_version %u max_version %u negotiated_version %u credits_requested %u credits_granted %u status %u max_readwrite_size %u preferred_send_size %u max_receive_size %u max_fragmented_size %u\n", resp->min_version, resp->max_version,
@@ -318,15 +316,15 @@ static bool process_negotiation_response( struct smbd_response *response, int packet_length) {struct smbd_connection *info = response->info; -struct smbd_negotiate_resp *packet =smbd_response_payload (response); +struct smbdirect_negotiate_resp *packet =smbd_response_payload (response); -if (packet_length <sizeof (struct smbd_negotiate_resp )) { +if (packet_length <sizeof (struct smbdirect_negotiate_resp )) {log_rdma_event (ERR ,"error: packet_length=%d\n" , packet_length);return false; } -if (le16_to_cpu (packet->negotiated_version) !=SMBD_V1 ) { +if (le16_to_cpu (packet->negotiated_version) !=SMBDIRECT_V1 ) {log_rdma_event (ERR ,"error: negotiated_version=%x\n" ,le16_to_cpu (packet->negotiated_version));return false;
@@ -448,7 +446,7 @@ static void smbd_post_send_credits(struct work_struct *work)/* Called from softirq, when recv is done */ static void recv_done (struct ib_cq *cq,struct ib_wc *wc) { -struct smbd_data_transfer *data_transfer; +struct smbdirect_data_transfer *data_transfer;struct smbd_response *response = container_of(wc->wr_cqe, struct smbd_response, cqe);struct smbd_connection *info = response->info;
@@ -474,7 +472,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)switch (response->type) {/* SMBD negotiation response */ case SMBD_NEGOTIATE_RESP : -dump_smbd_negotiate_resp (smbd_response_payload (response)); +dump_smbdirect_negotiate_resp (smbd_response_payload (response)); info->full_packet_received = true; info->negotiate_done =process_negotiation_response (response, wc->byte_len);
@@ -531,7 +529,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)/* Send a KEEP_ALIVE response right away if requested */ info->keep_alive_requested =KEEP_ALIVE_NONE ;if (le16_to_cpu (data_transfer->flags) & -SMB_DIRECT_RESPONSE_REQUESTED ) { +SMBDIRECT_FLAG_RESPONSE_REQUESTED ) { info->keep_alive_requested =KEEP_ALIVE_PENDING ; }
@@ -686,7 +684,7 @@ static int smbd_post_send_negotiate_req(struct smbd_connection *info)struct ib_send_wr send_wr;int rc = -ENOMEM ;struct smbd_request *request; -struct smbd_negotiate_req *packet; +struct smbdirect_negotiate_req *packet; request =mempool_alloc (info->request_mempool,GFP_KERNEL );if (!request)
@@ -695,8 +693,8 @@ static int smbd_post_send_negotiate_req(struct smbd_connection *info) request->info = info; packet =smbd_request_payload (request); - packet->min_version =cpu_to_le16 (SMBD_V1 ); - packet->max_version =cpu_to_le16 (SMBD_V1 ); + packet->min_version =cpu_to_le16 (SMBDIRECT_V1 ); + packet->max_version =cpu_to_le16 (SMBDIRECT_V1 ); packet->reserved =0 ; packet->credits_requested =cpu_to_le16 (info->send_credit_target); packet->preferred_send_size =cpu_to_le32 (info->max_send_size);
@@ -774,10 +772,10 @@ static int manage_credits_prior_sending(struct smbd_connection *info)/* * Check if we need to send a KEEP_ALIVE message * The idle connection timer triggers a KEEP_ALIVE message when expires -* SMB_DIRECT_RESPONSE_REQUESTED is set in the message flag to have peer send +* SMBDIRECT_FLAG_RESPONSE_REQUESTED is set in the message flag to have peer send * back a response. * return value: -* 1 if SMB_DIRECT_RESPONSE_REQUESTED needs to be set +* 1 if SMBDIRECT_FLAG_RESPONSE_REQUESTED needs to be set * 0: otherwise */ static int manage_keep_alive_before_sending (struct smbd_connection *info)
@@ -837,7 +835,7 @@ static int smbd_post_send_iter(struct smbd_connection *info,int header_length;int data_length;struct smbd_request *request; -struct smbd_data_transfer *packet; +struct smbdirect_data_transfer *packet;int new_credits =0 ; wait_credit:
@@ -919,7 +917,7 @@ static int smbd_post_send_iter(struct smbd_connection *info, packet->flags =0 ;if (manage_keep_alive_before_sending (info)) - packet->flags |=cpu_to_le16 (SMB_DIRECT_RESPONSE_REQUESTED ); + packet->flags |=cpu_to_le16 (SMBDIRECT_FLAG_RESPONSE_REQUESTED ); packet->reserved =0 ;if (!data_length)
@@ -938,10 +936,10 @@ static int smbd_post_send_iter(struct smbd_connection *info, le32_to_cpu(packet->remaining_data_length));/* Map the packet to DMA */ - header_length =sizeof (struct smbd_data_transfer ); + header_length =sizeof (struct smbdirect_data_transfer );/* If this is a packet without payload, don't send padding */ if (!data_length) - header_length = offsetof(struct smbd_data_transfer , padding); + header_length = offsetof(struct smbdirect_data_transfer , padding); request->sge[0].addr = ib_dma_map_single(info->id->device, (void *)packet,
@@ -1432,7 +1430,7 @@ static int allocate_caches_and_workqueue(struct smbd_connection *info)kmem_cache_create ( name,sizeof (struct smbd_request ) + -sizeof (struct smbd_data_transfer ), +sizeof (struct smbdirect_data_transfer ),0 ,SLAB_HWCACHE_ALIGN ,NULL );if (!info->request_cache)return -ENOMEM ;
@@ -1735,7 +1733,7 @@ static int smbd_recv_buf(struct smbd_connection *info, char *buf, unsigned int size) {struct smbd_response *response; -struct smbd_data_transfer *data_transfer; +struct smbdirect_data_transfer *data_transfer;int to_copy, to_read, data_read, offset;u32 data_length, remaining_data_length, data_offset;int rc;
fs/smb/client/smbdirect.h +0 -41
47 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 120/218 smb: smbdirect: add smbdirect.h with public structures
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit 7e136a718633b2c54764e185f3bfccf0763fc1dd ]
Will be used in client and server in the next commits.
Stable-dep-of: 43e7e284fc77 ("cifs: Fix the smbd_response slab to allow usercopy")
--- fs/smb/common/smbdirect/smbdirect.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 fs/smb/common/smbdirect/smbdirect.h
fs/smb/common/smbdirect/smbdirect.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (C) 2017, Microsoft Corporation. +* Copyright (C) 2018, LG Electronics. +*/ + +#ifndef __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_H__ +#define __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_H__ + +/* SMB-DIRECT buffer descriptor V1 structure [MS-SMBD] 2.2.3.1 */ +struct smbdirect_buffer_descriptor_v1 { +__le64 offset; +__le32 token; +__le32 length; +} __packed; + +#endif /* __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_H__ */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 121/218 smb: smbdirect: add smbdirect_socket.h
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit 22234e37d7e97652cb53133009da5e14793d3c10 ]
This abstracts the common smbdirect layer.
Currently with just a few things in it, but that will change over time until everything is in common.
Will be used in client and server in the next commits
Stable-dep-of: 43e7e284fc77 ("cifs: Fix the smbd_response slab to allow usercopy")
--- fs/smb/common/smbdirect/smbdirect_socket.h | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 fs/smb/common/smbdirect/smbdirect_socket.h
fs/smb/common/smbdirect/smbdirect_socket.h new file +41 -0
@@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (c) 2025 Stefan Metzmacher +*/ + +#ifndef __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_SOCKET_H__ +#define __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_SOCKET_H__ + +enum smbdirect_socket_status { +SMBDIRECT_SOCKET_CREATED , +SMBDIRECT_SOCKET_CONNECTING , +SMBDIRECT_SOCKET_CONNECTED , +SMBDIRECT_SOCKET_NEGOTIATE_FAILED , +SMBDIRECT_SOCKET_DISCONNECTING , +SMBDIRECT_SOCKET_DISCONNECTED , +SMBDIRECT_SOCKET_DESTROYED +}; + +struct smbdirect_socket { +enum smbdirect_socket_status status; + +/* RDMA related */ +struct { +struct rdma_cm_id *cm_id; + } rdma; + +/* IB verbs related */ +struct { +struct ib_pd *pd; +struct ib_cq *send_cq; +struct ib_cq *recv_cq; + +/* +* shortcuts for rdma.cm_id->{qp,device}; +*/ +struct ib_qp *qp; +struct ib_device *dev; + } ib; +}; + +#endif /* __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_SOCKET_H__ */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 122/218 smb: client: make use of common smbdirect_socket
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit c3011b9a7deaaaabdf955815d29eac39c8b75e67 ]
This is the next step in the direction of a common smbdirect layer. Currently only structures are shared, but that will change over time until everything is shared.
Stable-dep-of: 43e7e284fc77 ("cifs: Fix the smbd_response slab to allow usercopy")
--- fs/smb/client/cifs_debug.c | 2 +- fs/smb/client/smbdirect.c | 258 ++++++++++++++++++++----------------- fs/smb/client/smbdirect.h | 12 +- 3 files changed, 146 insertions(+), 126 deletions(-)
fs/smb/client/cifs_debug.c +1 -1
@@ -387,7 +387,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)seq_printf (m,"\nSMBDirect (in hex) protocol version: %x " "transport status: %x" , server->smbd_conn->protocol, - server->smbd_conn->transport_status); + server->smbd_conn->socket.status); seq_printf(m, "\nConn receive_credit_max: %x " "send_credit_target: %x max_send_size: %x", server->smbd_conn->receive_credit_max,
fs/smb/client/smbdirect.c +141 -117
732 lines not on this page · raw message
fs/smb/client/smbdirect.h +4 -8
@@ -15,6 +15,8 @@#include <rdma/rdma_cm.h> #include <linux/mempool.h> +#include "../common/smbdirect/smbdirect_socket.h" +extern int rdma_readwrite_threshold;extern int smbd_max_frmr_depth;extern int smbd_keep_alive_interval;
@@ -50,14 +52,8 @@ enum smbd_connection_status {* 5. mempools for allocating packets */ struct smbd_connection { -enum smbd_connection_status transport_status; - -/* RDMA related */ -struct rdma_cm_id *id; -struct ib_qp_init_attr qp_attr; -struct ib_pd *pd; -struct ib_cq *send_cq, *recv_cq; -struct ib_device_attr dev_attr; +struct smbdirect_socket socket; +int ri_rc;struct completion ri_done;wait_queue_head_t conn_wait;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 123/218 smb: smbdirect: introduce smbdirect_socket_parameters
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit dce8047f4725d4469c0813ff50c4115fc2d0b628 ]
This is the next step in the direction of a common smbdirect layer.
Stable-dep-of: 43e7e284fc77 ("cifs: Fix the smbd_response slab to allow usercopy")
--- fs/smb/client/smbdirect.h | 1 + fs/smb/common/smbdirect/smbdirect.h | 20 ++++++++++++++++++++ fs/smb/common/smbdirect/smbdirect_socket.h | 2 ++ 3 files changed, 23 insertions(+)
fs/smb/client/smbdirect.h +1 -0
@@ -15,6 +15,7 @@#include <rdma/rdma_cm.h> #include <linux/mempool.h> +#include "../common/smbdirect/smbdirect.h" #include "../common/smbdirect/smbdirect_socket.h" extern int rdma_readwrite_threshold;
fs/smb/common/smbdirect/smbdirect.h +20 -0
@@ -14,4 +14,24 @@ struct smbdirect_buffer_descriptor_v1 { __le32 length; } __packed; +/* +* Connection parameters mostly from [MS-SMBD] 3.1.1.1 +* +* These are setup and negotiated at the beginning of a +* connection and remain constant unless explicitly changed. +* +* Some values are important for the upper layer. +*/ +struct smbdirect_socket_parameters { +__u16 recv_credit_max; +__u16 send_credit_target; +__u32 max_send_size; +__u32 max_fragmented_send_size; +__u32 max_recv_size; +__u32 max_fragmented_recv_size; +__u32 max_read_write_size; +__u32 keepalive_interval_msec; +__u32 keepalive_timeout_msec; +} __packed; +#endif /* __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_H__ */
fs/smb/common/smbdirect/smbdirect_socket.h +2 -0
@@ -36,6 +36,8 @@ struct smbdirect_socket {struct ib_qp *qp; struct ib_device *dev; } ib; + +struct smbdirect_socket_parameters parameters; };#endif /* __FS_SMB_COMMON_SMBDIRECT_SMBDIRECT_SOCKET_H__ */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 124/218 smb: client: make use of common smbdirect_socket_parameters
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit cc55f65dd352bdb7bdf8db1c36fb348c294c3b66 ]
Stable-dep-of: 43e7e284fc77 ("cifs: Fix the smbd_response slab to allow usercopy")
--- fs/smb/client/cifs_debug.c | 21 +++++---- fs/smb/client/smb2ops.c | 14 ++++-- fs/smb/client/smbdirect.c | 91 ++++++++++++++++++++++---------------- fs/smb/client/smbdirect.h | 10 +---- 4 files changed, 77 insertions(+), 59 deletions(-)
fs/smb/client/cifs_debug.c +13 -8
@@ -362,6 +362,10 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) c =0 ;spin_lock (&cifs_tcp_ses_lock);list_for_each_entry (server, &cifs_tcp_ses_list, tcp_ses_list) { +#ifdef CONFIG_CIFS_SMB_DIRECT +struct smbdirect_socket_parameters *sp; +#endif +/* channel info will be printed as a part of sessions below */ if (SERVER_IS_CHAN (server))continue ;
@@ -383,6 +387,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)seq_printf (m,"\nSMBDirect transport not available" ); goto skip_rdma; } + sp = &server->smbd_conn->socket.parameters; seq_printf(m, "\nSMBDirect (in hex) protocol version: %x " "transport status: %x",
@@ -390,18 +395,18 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) server->smbd_conn->socket.status);seq_printf (m,"\nConn receive_credit_max: %x " "send_credit_target: %x max_send_size: %x" , - server->smbd_conn->receive_credit_max, - server->smbd_conn->send_credit_target, - server->smbd_conn->max_send_size); + sp->recv_credit_max, + sp->send_credit_target, + sp->max_send_size);seq_printf (m,"\nConn max_fragmented_recv_size: %x " "max_fragmented_send_size: %x max_receive_size:%x" , - server->smbd_conn->max_fragmented_recv_size, - server->smbd_conn->max_fragmented_send_size, - server->smbd_conn->max_receive_size); + sp->max_fragmented_recv_size, + sp->max_fragmented_send_size, + sp->max_recv_size);seq_printf (m,"\nConn keep_alive_interval: %x " "max_readwrite_size: %x rdma_readwrite_threshold: %x" , - server->smbd_conn->keep_alive_interval, - server->smbd_conn->max_readwrite_size, + sp->keepalive_interval_msec *1000 , + sp->max_read_write_size, server->smbd_conn->rdma_readwrite_threshold); seq_printf(m, "\nDebug count_get_receive_buffer: %x " "count_put_receive_buffer: %x count_send_empty: %x",
fs/smb/client/smb2ops.c +10 -4
@@ -504,6 +504,9 @@ smb3_negotiate_wsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx) wsize = min_t(unsigned int, wsize, server->max_write);#ifdef CONFIG_CIFS_SMB_DIRECT if (server->rdma) { +struct smbdirect_socket_parameters *sp = + &server->smbd_conn->socket.parameters; +if (server->sign)/* * Account for SMB2 data transfer packet header and
@@ -511,12 +514,12 @@ smb3_negotiate_wsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)*/ wsize = min_t(unsigned int, wsize, - server->smbd_conn->max_fragmented_send_size - + sp->max_fragmented_send_size -SMB2_READWRITE_PDU_HEADER_SIZE -sizeof (struct smb2_transform_hdr )); else wsize = min_t(unsigned int, - wsize, server->smbd_conn->max_readwrite_size); + wsize, sp->max_read_write_size); }#endif if (!(server->capabilities &SMB2_GLOBAL_CAP_LARGE_MTU ))
@@ -552,6 +555,9 @@ smb3_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx) rsize = min_t(unsigned int, rsize, server->max_read);#ifdef CONFIG_CIFS_SMB_DIRECT if (server->rdma) { +struct smbdirect_socket_parameters *sp = + &server->smbd_conn->socket.parameters; +if (server->sign)/* * Account for SMB2 data transfer packet header and
@@ -559,12 +565,12 @@ smb3_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)*/ rsize = min_t(unsigned int, rsize, - server->smbd_conn->max_fragmented_recv_size - + sp->max_fragmented_recv_size -SMB2_READWRITE_PDU_HEADER_SIZE -sizeof (struct smb2_transform_hdr )); else rsize = min_t(unsigned int, - rsize, server->smbd_conn->max_readwrite_size); + rsize, sp->max_read_write_size); }#endif
fs/smb/client/smbdirect.c +53 -38
304 lines not on this page · raw message
fs/smb/client/smbdirect.h +1 -9
@@ -69,15 +69,7 @@ struct smbd_connection {spinlock_t lock_new_credits_offered;int new_credits_offered; -/* Connection parameters defined in [MS-SMBD] 3.1.1.1 */ -int receive_credit_max; -int send_credit_target; -int max_send_size; -int max_fragmented_recv_size; -int max_fragmented_send_size; -int max_receive_size; -int keep_alive_interval; -int max_readwrite_size; +/* dynamic connection parameters defined in [MS-SMBD] 3.1.1.1 */ enum keep_alive_status keep_alive_requested;int protocol;atomic_t send_credits;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 125/218 cifs: Fix the smbd_response slab to allow usercopy
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 43e7e284fc77b710d899569360ea46fa3374ae22 ]
The handling of received data in the smbdirect client code involves using copy_to_iter() to copy data from the smbd_reponse struct's packet trailer to a folioq buffer provided by netfslib that encapsulates a chunk of pagecache.
If, however, CONFIG_HARDENED_USERCOPY=y, this will result in the checks then performed in copy_to_iter() oopsing with something like the following:
CIFS: Attempting to mount //172.31.9.1/test
CIFS: VFS: RDMA transport established
usercopy: Kernel memory exposure attempt detected from SLUB object 'smbd_response_0000000091e24ea1' (offset 81, size 63)!
------------[ cut here ]------------ kernel BUG at mm/usercopy.c:102! ... RIP: 0010:usercopy_abort+0x6c/0x80 ... Call Trace: <TASK> __check_heap_object+0xe3/0x120 __check_object_size+0x4dc/0x6d0 smbd_recv+0x77f/0xfe0 [cifs] cifs_readv_from_socket+0x276/0x8f0 [cifs] cifs_read_from_socket+0xcd/0x120 [cifs] cifs_demultiplex_thread+0x7e9/0x2d50 [cifs] kthread+0x396/0x830 ret_from_fork+0x2b8/0x3b0 ret_from_fork_asm+0x1a/0x30
The problem is that the smbd_response slab's packet field isn't marked as being permitted for usercopy.
Fix this by passing parameters to kmem_slab_create() to indicate that copy_to_iter() is permitted from the packet region of the smbd_response slab objects, less the header space.
--- fs/smb/client/smbdirect.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
fs/smb/client/smbdirect.c +13 -5
@@ -1452,6 +1452,9 @@ static int allocate_caches_and_workqueue(struct smbd_connection *info)char name[MAX_NAME_LEN ];int rc; +if (WARN_ON_ONCE (sp->max_recv_size <sizeof (struct smbdirect_data_transfer ))) +return -ENOMEM ; +scnprintf (name,MAX_NAME_LEN ,"smbd_request_%p" , info); info->request_cache = kmem_cache_create(
@@ -1469,12 +1472,17 @@ static int allocate_caches_and_workqueue(struct smbd_connection *info) goto out1;scnprintf (name,MAX_NAME_LEN ,"smbd_response_%p" , info); + +struct kmem_cache_args response_args = { + .align = __alignof__(struct smbd_response ), + .useroffset = (offsetof(struct smbd_response , packet) + +sizeof (struct smbdirect_data_transfer )), + .usersize = sp->max_recv_size -sizeof (struct smbdirect_data_transfer ), + }; info->response_cache = -kmem_cache_create ( - name, -sizeof (struct smbd_response ) + - sp->max_recv_size, -0 ,SLAB_HWCACHE_ALIGN ,NULL ); +kmem_cache_create (name, +sizeof (struct smbd_response ) + sp->max_recv_size, + &response_args,SLAB_HWCACHE_ALIGN );if (!info->response_cache) goto out2;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 126/218 cifs: Fix reading into an ITER_FOLIOQ from the smbdirect code
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 263debecb4aa7cec0a86487e6f409814f6194a21 ]
When performing a file read from RDMA, smbd_recv() prints an "Invalid msg type 4" error and fails the I/O. This is due to the switch-statement there not handling the ITER_FOLIOQ handed down from netfslib.
Fix this by collapsing smbd_recv_buf() and smbd_recv_page() into smbd_recv() and just using copy_to_iter() instead of memcpy(). This future-proofs the function too, in case more ITER_* types are added.
--- fs/smb/client/smbdirect.c | 112 ++++++-------------------------------- 1 file changed, 17 insertions(+), 95 deletions(-)
fs/smb/client/smbdirect.c +17 -95
@@ -1755,35 +1755,39 @@ struct smbd_connection *smbd_get_connection( }/* -* Receive data from receive reassembly queue +* Receive data from the transport's receive reassembly queue * All the incoming data packets are placed in reassembly queue -* buf: the buffer to read data into +* iter: the buffer to read data into * size: the length of data to read * return value: actual data read -* Note: this implementation copies the data from reassebmly queue to receive +* +* Note: this implementation copies the data from reassembly queue to receive * buffers used by upper layer. This is not the optimal code path. A better way * to do it is to not have upper layer allocate its receive buffers but rather * borrow the buffer from reassembly queue, and return it after data is * consumed. But this will require more changes to upper layer code, and also * need to consider packet boundaries while they still being reassembled. */ -static int smbd_recv_buf (struct smbd_connection *info,char *buf, -unsigned int size) +int smbd_recv (struct smbd_connection *info,struct msghdr *msg) {struct smbdirect_socket *sc = &info->socket;struct smbd_response *response;struct smbdirect_data_transfer *data_transfer; +size_t size =iov_iter_count (&msg->msg_iter);int to_copy, to_read, data_read, offset;u32 data_length, remaining_data_length, data_offset;int rc; +if (WARN_ON_ONCE (iov_iter_rw (&msg->msg_iter) ==WRITE )) +return -EINVAL ;/* It's a bug in upper layer to get there */ + again:/* * No need to hold the reassembly queue lock all the time as we are * the only one reading from the front of the queue. The transport * may add more entries to the back of the queue at the same time */ -log_read (INFO ,"size=%d info->reassembly_data_length=%d\n" , size, +log_read (INFO ,"size=%zd info->reassembly_data_length=%d\n" , size, info->reassembly_data_length);if (info->reassembly_data_length >= size) {int queue_length;
@@ -1821,7 +1825,10 @@ static int smbd_recv_buf(struct smbd_connection *info, char *buf,if (response->first_segment && size ==4 ) {unsigned int rfc1002_len = data_length + remaining_data_length; - *((__be32 *)buf) =cpu_to_be32 (rfc1002_len); +__be32 rfc1002_hdr =cpu_to_be32 (rfc1002_len); +if (copy_to_iter (&rfc1002_hdr,sizeof (rfc1002_hdr), + &msg->msg_iter) !=sizeof (rfc1002_hdr)) +return -EFAULT ; data_read =4 ; response->first_segment = false; log_read(INFO, "returning rfc1002 length %d\n",
@@ -1830,10 +1837,9 @@ static int smbd_recv_buf(struct smbd_connection *info, char *buf, } to_copy =min_t (int, data_length - offset, to_read); -memcpy ( - buf + data_read, - (char *)data_transfer + data_offset + offset, - to_copy); +if (copy_to_iter ((char *)data_transfer + data_offset + offset, + to_copy, &msg->msg_iter) != to_copy) +return -EFAULT ;/* move on to the next buffer? */ if (to_copy == data_length - offset) {
@@ -1898,90 +1904,6 @@ static int smbd_recv_buf(struct smbd_connection *info, char *buf, goto again; } -/* -* Receive a page from receive reassembly queue -* page: the page to read data into -* to_read: the length of data to read -* return value: actual data read -*/ -static int smbd_recv_page (struct smbd_connection *info, -struct page *page,unsigned int page_offset, -unsigned int to_read) -{ -struct smbdirect_socket *sc = &info->socket; -int ret; -char *to_address; -void *page_address; - -/* make sure we have the page ready for read */ - ret =wait_event_interruptible ( - info->wait_reassembly_queue, - info->reassembly_data_length >= to_read || - sc->status !=SMBDIRECT_SOCKET_CONNECTED ); -if (ret) -return ret; - -/* now we can read from reassembly queue and not sleep */ - page_address =kmap_atomic (page); - to_address = (char *) page_address + page_offset; - -log_read (INFO ,"reading from page=%p address=%p to_read=%d\n" , - page, to_address, to_read); - - ret =smbd_recv_buf (info, to_address, to_read); -kunmap_atomic (page_address); - -return ret; -} - -/* -* Receive data from transport -* msg: a msghdr point to the buffer, can be ITER_KVEC or ITER_BVEC -* return: total bytes read, or 0. SMB Direct will not do partial read. -*/ -int smbd_recv (struct smbd_connection *info,struct msghdr *msg) -{ -char *buf; -struct page *page; -unsigned int to_read, page_offset; -int rc; - -if (iov_iter_rw (&msg->msg_iter) ==WRITE ) { -/* It's a bug in upper layer to get there */ -cifs_dbg (VFS ,"Invalid msg iter dir %u\n" , -iov_iter_rw (&msg->msg_iter)); - rc = -EINVAL ; - goto out; - } - -switch (iov_iter_type (&msg->msg_iter)) { -case ITER_KVEC : - buf = msg->msg_iter.kvec->iov_base; - to_read = msg->msg_iter.kvec->iov_len; - rc =smbd_recv_buf (info, buf, to_read); -break ; - -case ITER_BVEC : - page = msg->msg_iter.bvec->bv_page; - page_offset = msg->msg_iter.bvec->bv_offset; - to_read = msg->msg_iter.bvec->bv_len; - rc =smbd_recv_page (info, page, page_offset, to_read); -break ; - -default : -/* It's a bug in upper layer to get there */ -cifs_dbg (VFS ,"Invalid msg type %d\n" , -iov_iter_type (&msg->msg_iter)); - rc = -EINVAL ; - } - -out: -/* SMBDirect will read it all or nothing */ -if (rc >0 ) - msg->msg_iter.count =0 ; -return rc; -} -/* * Send data to transport * Each rqst is transported as a SMBDirect payload
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 127/218 EDAC/amd64: Fix size calculation for Non-Power-of-Two DIMMs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avadhut Naik <[email protected]>
commit a3f3040657417aeadb9622c629d4a0c2693a0f93 upstream.
Each Chip-Select (CS) of a Unified Memory Controller (UMC) on AMD Zen-based SOCs has an Address Mask and a Secondary Address Mask register associated with it. The amd64_edac module logs DIMM sizes on a per-UMC per-CS granularity during init using these two registers.
Currently, the module primarily considers only the Address Mask register for computing DIMM sizes. The Secondary Address Mask register is only considered for odd CS. Additionally, if it has been considered, the Address Mask register is ignored altogether for that CS. For power-of-two DIMMs i.e. DIMMs whose total capacity is a power of two (32GB, 64GB, etc), this is not an issue since only the Address Mask register is used.
For non-power-of-two DIMMs i.e., DIMMs whose total capacity is not a power of two (48GB, 96GB, etc), however, the Secondary Address Mask register is used in conjunction with the Address Mask register. However, since the module only considers either of the two registers for a CS, the size computed by the module is incorrect. The Secondary Address Mask register is not considered for even CS, and the Address Mask register is not considered for odd CS.
Introduce a new helper function so that both Address Mask and Secondary Address Mask registers are considered, when valid, for computing DIMM sizes. Furthermore, also rename some variables for greater clarity.
--- drivers/edac/amd64_edac.c | 57 +++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 21 deletions(-)
drivers/edac/amd64_edac.c +36 -21
@@ -1208,7 +1208,9 @@ static int umc_get_cs_mode(int dimm, u8if (csrow_enabled (2 * dimm +1 , ctrl, pvt)) cs_mode |=CS_ODD_PRIMARY ; -/* Asymmetric dual-rank DIMM support. */ +if (csrow_sec_enabled (2 * dimm, ctrl, pvt)) + cs_mode |=CS_EVEN_SECONDARY ; +if (csrow_sec_enabled (2 * dimm +1 , ctrl, pvt)) cs_mode |=CS_ODD_SECONDARY ;
@@ -1229,12 +1231,13 @@ static int umc_get_cs_mode(int dimm, u8return cs_mode; } -static int __addr_mask_to_cs_size (u32 addr_mask_orig,unsigned int cs_mode, -int csrow_nr,int dimm) +static int calculate_cs_size (u32 mask,unsigned int cs_mode) { -u32 msb, weight, num_zero_bits; -u32 addr_mask_deinterleaved; -int size =0 ; +int msb, weight, num_zero_bits; +u32 deinterleaved_mask; + +if (!mask) +return 0 ;/* * The number of zero bits in the mask is equal to the number of bits
@@ -1247,19 +1250,30 @@ static int __addr_mask_to_cs_size(u32 ad* without swapping with the most significant bit. This can be handled * by keeping the MSB where it is and ignoring the single zero bit. */ - msb =fls (addr_mask_orig) -1 ; - weight =hweight_long (addr_mask_orig); + msb =fls (mask) -1 ; + weight =hweight_long (mask); num_zero_bits = msb - weight - !!(cs_mode &CS_3R_INTERLEAVE );/* Take the number of zero bits off from the top of the mask. */ - addr_mask_deinterleaved =GENMASK_ULL (msb - num_zero_bits,1 ); + deinterleaved_mask =GENMASK (msb - num_zero_bits,1 ); +edac_dbg (1 ," Deinterleaved AddrMask: 0x%x\n" , deinterleaved_mask); + +return (deinterleaved_mask >>2 ) +1 ; +} + +static int __addr_mask_to_cs_size (u32 addr_mask,u32 addr_mask_sec, +unsigned int cs_mode,int csrow_nr,int dimm) +{ +int size;edac_dbg (1 ,"CS%d DIMM%d AddrMasks:\n" , csrow_nr, dimm); -edac_dbg (1 ," Original AddrMask: 0x%x\n" , addr_mask_orig); -edac_dbg (1 ," Deinterleaved AddrMask: 0x%x\n" , addr_mask_deinterleaved); +edac_dbg (1 ," Primary AddrMask: 0x%x\n" , addr_mask);/* Register [31:1] = Address [39:9]. Size is in kBs here. */ - size = (addr_mask_deinterleaved >>2 ) +1 ; + size =calculate_cs_size (addr_mask, cs_mode); + +edac_dbg (1 ," Secondary AddrMask: 0x%x\n" , addr_mask_sec); + size +=calculate_cs_size (addr_mask_sec, cs_mode);/* Return size in MBs. */ return size >>10 ;
@@ -1268,8 +1282,8 @@ static int __addr_mask_to_cs_size(u32 adstatic int umc_addr_mask_to_cs_size (struct amd64_pvt *pvt,u8 umc,unsigned int cs_mode,int csrow_nr) { +u32 addr_mask =0 , addr_mask_sec =0 ;int cs_mask_nr = csrow_nr; -u32 addr_mask_orig;int dimm, size =0 ;/* No Chip Selects are enabled. */
@@ -1307,13 +1321,13 @@ static int umc_addr_mask_to_cs_size(struif (!pvt->flags.zn_regs_v2) cs_mask_nr >>=1 ; -/* Asymmetric dual-rank DIMM support. */ -if ((csrow_nr &1 ) && (cs_mode &CS_ODD_SECONDARY )) - addr_mask_orig = pvt->csels[umc].csmasks_sec[cs_mask_nr]; -else - addr_mask_orig = pvt->csels[umc].csmasks[cs_mask_nr]; +if (cs_mode & (CS_EVEN_PRIMARY |CS_ODD_PRIMARY )) + addr_mask = pvt->csels[umc].csmasks[cs_mask_nr]; + +if (cs_mode & (CS_EVEN_SECONDARY |CS_ODD_SECONDARY )) + addr_mask_sec = pvt->csels[umc].csmasks_sec[cs_mask_nr]; -return __addr_mask_to_cs_size (addr_mask_orig, cs_mode, csrow_nr, dimm); +return __addr_mask_to_cs_size (addr_mask, addr_mask_sec, cs_mode, csrow_nr, dimm); }static void umc_debug_display_dimm_sizes (struct amd64_pvt *pvt,u8 ctrl)
@@ -3515,9 +3529,10 @@ static void gpu_get_err_info(struct mcestatic int gpu_addr_mask_to_cs_size (struct amd64_pvt *pvt,u8 umc,unsigned int cs_mode,int csrow_nr) { -u32 addr_mask_orig = pvt->csels[umc].csmasks[csrow_nr]; +u32 addr_mask = pvt->csels[umc].csmasks[csrow_nr]; +u32 addr_mask_sec = pvt->csels[umc].csmasks_sec[csrow_nr]; -return __addr_mask_to_cs_size (addr_mask_orig, cs_mode, csrow_nr, csrow_nr >>1 ); +return __addr_mask_to_cs_size (addr_mask, addr_mask_sec, cs_mode, csrow_nr, csrow_nr >>1 ); }static void gpu_debug_display_dimm_sizes (struct amd64_pvt *pvt,u8 ctrl)
Greg Kroah-Hartman
maintainerPATCH 128/218 x86/traps: Initialize DR6 by writing its architectural reset value
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Li (Intel) <[email protected]>
commit 5f465c148c61e876b6d6eacd8e8e365f2d47758f upstream.
Initialize DR6 by writing its architectural reset value to avoid incorrectly zeroing DR6 to clear DR6.BLD at boot time, which leads to a false bus lock detected warning.
The Intel SDM says:
1) Certain debug exceptions may clear bits 0-3 of DR6.
2) BLD induced #DB clears DR6.BLD and any other debug exception doesn't modify DR6.BLD.
3) RTM induced #DB clears DR6.RTM and any other debug exception sets DR6.RTM.
To avoid confusion in identifying debug exceptions, debug handlers should set DR6.BLD and DR6.RTM, and clear other DR6 bits before returning.
The DR6 architectural reset value 0xFFFF0FF0, already defined as macro DR6_RESERVED, satisfies these requirements, so just use it to reinitialize DR6 whenever needed.
Since clear_all_debug_regs() no longer zeros all debug registers, rename it to initialize_debug_regs() to better reflect its current behavior.
Since debug_read_clear_dr6() no longer clears DR6, rename it to debug_read_reset_dr6() to better reflect its current behavior.
--- arch/x86/include/uapi/asm/debugreg.h | 21 ++++++++++++++++++++- arch/x86/kernel/cpu/common.c | 24 ++++++++++-------------- arch/x86/kernel/traps.c | 34 +++++++++++++++++++++------------- 3 files changed, 51 insertions(+), 28 deletions(-)
arch/x86/include/uapi/asm/debugreg.h +20 -1
@@ -15,7 +15,26 @@which debugging register was responsible for the trap. The other bits are either reserved or not of interest to us. */ -/* Define reserved bits in DR6 which are always set to 1 */ +/* +* Define bits in DR6 which are set to 1 by default. +* +* This is also the DR6 architectural value following Power-up, Reset or INIT. +* +* Note, with the introduction of Bus Lock Detection (BLD) and Restricted +* Transactional Memory (RTM), the DR6 register has been modified: +* +* 1) BLD flag (bit 11) is no longer reserved to 1 if the CPU supports +* Bus Lock Detection. The assertion of a bus lock could clear it. +* +* 2) RTM flag (bit 16) is no longer reserved to 1 if the CPU supports +* restricted transactional memory. #DB occurred inside an RTM region +* could clear it. +* +* Apparently, DR6.BLD and DR6.RTM are active low bits. +* +* As a result, DR6_RESERVED is an incorrect name now, but it is kept for +* compatibility. +*/ #define DR6_RESERVED (0xFFFF0FF0)#define DR_TRAP0 (0x1)/* db0 */
arch/x86/kernel/cpu/common.c +10 -14
@@ -2145,20 +2145,16 @@ EXPORT_PER_CPU_SYMBOL(__stack_chk_guard)#endif /* CONFIG_X86_64 */ -/* -* Clear all 6 debug registers: -*/ -static void clear_all_debug_regs (void ) +static void initialize_debug_regs (void ) { -int i; - -for (i =0 ; i <8 ; i++) { -/* Ignore db4, db5 */ -if ((i ==4 ) || (i ==5 )) -continue ; - -set_debugreg (0 , i); - } +/* Control register first -- to make sure everything is disabled. */ +set_debugreg (0 ,7 ); +set_debugreg (DR6_RESERVED ,6 ); +/* dr5 and dr4 don't exist */ +set_debugreg (0 ,3 ); +set_debugreg (0 ,2 ); +set_debugreg (0 ,1 ); +set_debugreg (0 ,0 ); }#ifdef CONFIG_KGDB
@@ -2319,7 +2315,7 @@ void cpu_init(void)load_mm_ldt (&init_mm); -clear_all_debug_regs (); +initialize_debug_regs ();dbg_restore_debug_regs ();doublefault_init_cpu_tss ();
arch/x86/kernel/traps.c +21 -13
@@ -977,24 +977,32 @@ static bool is_sysenter_singlestep(struc#endif } -static __always_inline unsigned long debug_read_clear_dr6 (void ) +static __always_inline unsigned long debug_read_reset_dr6 (void ) {unsigned long dr6; +get_debugreg (dr6,6 ); + dr6 ^=DR6_RESERVED ;/* Flip to positive polarity */ +/* * The Intel SDM says: * -* Certain debug exceptions may clear bits 0-3. The remaining -* contents of the DR6 register are never cleared by the -* processor. To avoid confusion in identifying debug -* exceptions, debug handlers should clear the register before -* returning to the interrupted task. +* Certain debug exceptions may clear bits 0-3 of DR6. +* +* BLD induced #DB clears DR6.BLD and any other debug +* exception doesn't modify DR6.BLD. * -* Keep it simple: clear DR6 immediately. +* RTM induced #DB clears DR6.RTM and any other debug +* exception sets DR6.RTM. +* +* To avoid confusion in identifying debug exceptions, +* debug handlers should set DR6.BLD and DR6.RTM, and +* clear other DR6 bits before returning. +* +* Keep it simple: write DR6 with its architectural reset +* value 0xFFFF0FF0, defined as DR6_RESERVED, immediately. */ -get_debugreg (dr6,6 );set_debugreg (DR6_RESERVED ,6 ); - dr6 ^=DR6_RESERVED ;/* Flip to positive polarity */ return dr6; }
@@ -1194,13 +1202,13 @@ out:/* IST stack entry */ DEFINE_IDTENTRY_DEBUG (exc_debug) { -exc_debug_kernel (regs,debug_read_clear_dr6 ()); +exc_debug_kernel (regs,debug_read_reset_dr6 ()); }/* User entry, runs on regular task stack */ DEFINE_IDTENTRY_DEBUG_USER (exc_debug) { -exc_debug_user (regs,debug_read_clear_dr6 ()); +exc_debug_user (regs,debug_read_reset_dr6 ()); }#ifdef CONFIG_X86_FRED
@@ -1219,7 +1227,7 @@ DEFINE_FREDENTRY_DEBUG(exc_debug) {/* * FRED #DB stores DR6 on the stack in the format which -* debug_read_clear_dr6() returns for the IDT entry points. +* debug_read_reset_dr6() returns for the IDT entry points. */ unsigned long dr6 =fred_event_data (regs);
@@ -1234,7 +1242,7 @@ DEFINE_FREDENTRY_DEBUG(exc_debug)/* 32 bit does not have separate entry points. */ DEFINE_IDTENTRY_RAW (exc_debug) { -unsigned long dr6 =debug_read_clear_dr6 (); +unsigned long dr6 =debug_read_reset_dr6 ();if (user_mode (regs))exc_debug_user (regs, dr6);
Greg Kroah-Hartman
maintainerPATCH 129/218 staging: rtl8723bs: Avoid memset() in aes_cipher() and aes_decipher()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit a55bc4ffc06d8c965a7d6f0a01ed0ed41380df28 upstream.
After commit 6f110a5e4f99 ("Disable SLUB_TINY for build testing"), which causes CONFIG_KASAN to be enabled in allmodconfig again, arm64 allmodconfig builds with older versions of clang (15 through 17) show an instance of -Wframe-larger-than (which breaks the build with CONFIG_WERROR=y):
drivers/staging/rtl8723bs/core/rtw_security.c:1287:5: error: stack frame size (2208) exceeds limit (2048) in 'rtw_aes_decrypt' [-Werror,-Wframe-larger-than]
1287 | u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
| ^
This comes from aes_decipher() being inlined in rtw_aes_decrypt(). Running the same build with CONFIG_FRAME_WARN=128 shows aes_cipher() also uses a decent amount of stack, just under the limit of 2048:
drivers/staging/rtl8723bs/core/rtw_security.c:864:19: warning: stack frame size (1952) exceeds limit (128) in 'aes_cipher' [-Wframe-larger-than]
864 | static signed int aes_cipher(u8 *key, uint hdrlen,
| ^
-Rpass-analysis=stack-frame-layout only shows one large structure on the stack, which is the ctx variable inlined from aes128k128d(). A good number of the other variables come from the additional checks of fortified string routines, which are present in memset(), which both aes_cipher() and aes_decipher() use to initialize some temporary buffers. In this case, since the size is known at compile time, these additional checks should not result in any code generation changes but allmodconfig has several sanitizers enabled, which may make it harder for the compiler to eliminate the compile time checks and the variables that come about from them.
The memset() calls are just initializing these buffers to zero, so use '= {}' instead, which is used all over the kernel and does the exact same thing as memset() without the fortify checks, which drops the stack usage of these functions by a few hundred kilobytes.
drivers/staging/rtl8723bs/core/rtw_security.c:864:19: warning: stack frame size (1584) exceeds limit (128) in 'aes_cipher' [-Wframe-larger-than]
864 | static signed int aes_cipher(u8 *key, uint hdrlen,
| ^
drivers/staging/rtl8723bs/core/rtw_security.c:1271:5: warning: stack frame size (1456) exceeds limit (128) in 'rtw_aes_decrypt' [-Wframe-larger-than]
1271 | u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
| ^
--- drivers/staging/rtl8723bs/core/rtw_security.c | 44 ++++++++------------------ 1 file changed, 14 insertions(+), 30 deletions(-)
drivers/staging/rtl8723bs/core/rtw_security.c +14 -30
@@ -868,29 +868,21 @@ static signed int aes_cipher(u8 *key, ui num_blocks, payload_index;u8 pn_vector[6 ]; -u8 mic_iv[16 ]; -u8 mic_header1[16 ]; -u8 mic_header2[16 ]; -u8 ctr_preload[16 ]; +u8 mic_iv[16 ] = {}; +u8 mic_header1[16 ] = {}; +u8 mic_header2[16 ] = {}; +u8 ctr_preload[16 ] = {};/* Intermediate Buffers */ -u8 chain_buffer[16 ]; -u8 aes_out[16 ]; -u8 padded_buffer[16 ]; +u8 chain_buffer[16 ] = {}; +u8 aes_out[16 ] = {}; +u8 padded_buffer[16 ] = {};u8 mic[8 ];uint frtype =GetFrameType (pframe);uint frsubtype =GetFrameSubType (pframe); frsubtype = frsubtype>>4 ; -memset ((void *)mic_iv,0 ,16 ); -memset ((void *)mic_header1,0 ,16 ); -memset ((void *)mic_header2,0 ,16 ); -memset ((void *)ctr_preload,0 ,16 ); -memset ((void *)chain_buffer,0 ,16 ); -memset ((void *)aes_out,0 ,16 ); -memset ((void *)padded_buffer,0 ,16 ); -if ((hdrlen ==WLAN_HDR_A3_LEN ) || (hdrlen ==WLAN_HDR_A3_QOS_LEN )) a4_exists =0 ;else
@@ -1080,15 +1072,15 @@ static signed int aes_decipher(u8 *key, num_blocks, payload_index;signed int res = _SUCCESS;u8 pn_vector[6 ]; -u8 mic_iv[16 ]; -u8 mic_header1[16 ]; -u8 mic_header2[16 ]; -u8 ctr_preload[16 ]; +u8 mic_iv[16 ] = {}; +u8 mic_header1[16 ] = {}; +u8 mic_header2[16 ] = {}; +u8 ctr_preload[16 ] = {};/* Intermediate Buffers */ -u8 chain_buffer[16 ]; -u8 aes_out[16 ]; -u8 padded_buffer[16 ]; +u8 chain_buffer[16 ] = {}; +u8 aes_out[16 ] = {}; +u8 padded_buffer[16 ] = {};u8 mic[8 ];uint frtype =GetFrameType (pframe);
@@ -1096,14 +1088,6 @@ static signed int aes_decipher(u8 *key, frsubtype = frsubtype>>4 ; -memset ((void *)mic_iv,0 ,16 ); -memset ((void *)mic_header1,0 ,16 ); -memset ((void *)mic_header2,0 ,16 ); -memset ((void *)ctr_preload,0 ,16 ); -memset ((void *)chain_buffer,0 ,16 ); -memset ((void *)aes_out,0 ,16 ); -memset ((void *)padded_buffer,0 ,16 ); -/* start to decrypt the payload */ num_blocks = (plen-8 ) /16 ;/* plen including LLC, payload_length and mic) */
Greg Kroah-Hartman
maintainerPATCH 130/218 dt-bindings: serial: 8250: Make clocks and clock-frequency exclusive
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yao Zi <[email protected]>
commit 09812134071b3941fb81def30b61ed36d3a5dfb5 upstream.
The 8250 binding before converting to json-schema states,
- clock-frequency : the input clock frequency for the UART
or
- clocks phandle to refer to the clk used as per Documentation/devicetree
for clock-related properties, where "or" indicates these properties shouldn't exist at the same time.
Additionally, the behavior of Linux's driver is strange when both clocks and clock-frequency are specified: it ignores clocks and obtains the frequency from clock-frequency, left the specified clocks unclaimed. It may even be disabled, which is undesired most of the time.
But "anyOf" doesn't prevent these two properties from coexisting, as it considers the object valid as long as there's at LEAST one match.
Let's switch to "oneOf" and disallows the other property if one exists, precisely matching the original binding and avoiding future confusion on the driver's behavior.
--- Documentation/devicetree/bindings/serial/8250.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/serial/8250.yaml +1 -1
@@ -45,7 +45,7 @@ allOf: - ns16550 - ns16550a then: - anyOf: + oneOf: - required: [ clock-frequency ] - required: [ clocks ]
Greg Kroah-Hartman
maintainerPATCH 131/218 serial: core: restore of_node information in sysfs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aidan Stewart <[email protected]>
commit d36f0e9a0002f04f4d6dd9be908d58fe5bd3a279 upstream.
Since in v6.8-rc1, the of_node symlink under tty devices is missing. This breaks any udev rules relying on this information.
Link the of_node information in the serial controller device with the parent defined in the device tree. This will also apply to the serial device which takes the serial controller as a parent device.
--- drivers/tty/serial/serial_base_bus.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/serial_base_bus.c +1 -0
@@ -72,6 +72,7 @@ static int serial_base_device_init(struc dev->parent = parent_dev; dev->bus = &serial_base_bus_type; dev->release = release; +device_set_of_node_from_dev (dev, parent_dev);if (!serial_base_initialized) {dev_dbg (port->dev,"uart_add_one_port() called before arch_initcall()?\n" );
Greg Kroah-Hartman
maintainerPATCH 132/218 serial: imx: Restore original RXTL for console to fix data loss
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
commit f23c52aafb1675ab1d1f46914556d8e29cbbf7b3 upstream.
Commit 7a637784d517 ("serial: imx: reduce RX interrupt frequency") introduced a regression on the i.MX6UL EVK board. The issue can be reproduced with the following steps:
- Open vi on the board.
- Paste a text file (~150 characters).
- Save the file, then repeat the process.
- Compare the sha256sum of the saved files.
The checksums do not match due to missing characters or entire lines.
Fix this by restoring the RXTL value to 1 when the UART is used as a console.
This ensures timely RX interrupts and reliable data reception in console mode.
With this change, pasted content is saved correctly, and checksums are always consistent.
--- drivers/tty/serial/imx.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/tty/serial/imx.c +12 -5
@@ -233,6 +233,7 @@ struct imx_port {enum imx_tx_state tx_state;struct hrtimer trigger_start_tx;struct hrtimer trigger_stop_tx; +unsigned int rxtl; };struct imx_port_ucrs {
@@ -1328,6 +1329,7 @@ static void imx_uart_clear_rx_errors(str#define TXTL_DEFAULT 8#define RXTL_DEFAULT 8/* 8 characters or aging timer */ +#define RXTL_CONSOLE_DEFAULT 1#define TXTL_DMA 8/* DMA burst setting */ #define RXTL_DMA 9/* DMA burst setting */
@@ -1445,7 +1447,7 @@ static void imx_uart_disable_dma(struct ucr1 &= ~(UCR1_RXDMAEN |UCR1_TXDMAEN |UCR1_ATDMAEN );imx_uart_writel (sport, ucr1,UCR1 ); -imx_uart_setup_ufcr (sport,TXTL_DEFAULT ,RXTL_DEFAULT ); +imx_uart_setup_ufcr (sport,TXTL_DEFAULT , sport->rxtl); sport->dma_is_enabled =0 ; }
@@ -1470,7 +1472,12 @@ static int imx_uart_startup(struct uart_return retval; } -imx_uart_setup_ufcr (sport,TXTL_DEFAULT ,RXTL_DEFAULT ); +if (uart_console (&sport->port)) + sport->rxtl =RXTL_CONSOLE_DEFAULT ; +else + sport->rxtl =RXTL_DEFAULT ; + +imx_uart_setup_ufcr (sport,TXTL_DEFAULT , sport->rxtl);/* disable the DREN bit (Data Ready interrupt enable) before * requesting IRQs
@@ -1936,7 +1943,7 @@ static int imx_uart_poll_init(struct uarif (retval)clk_disable_unprepare (sport->clk_ipg); -imx_uart_setup_ufcr (sport,TXTL_DEFAULT ,RXTL_DEFAULT ); +imx_uart_setup_ufcr (sport,TXTL_DEFAULT , sport->rxtl);uart_port_lock_irqsave (&sport->port, &flags);
@@ -2028,7 +2035,7 @@ static int imx_uart_rs485_config(struct/* If the receiver trigger is 0, set it to a default value */ ufcr =imx_uart_readl (sport,UFCR );if ((ufcr &UFCR_RXTL_MASK ) ==0 ) -imx_uart_setup_ufcr (sport,TXTL_DEFAULT ,RXTL_DEFAULT ); +imx_uart_setup_ufcr (sport,TXTL_DEFAULT , sport->rxtl);imx_uart_start_rx (port); }
@@ -2213,7 +2220,7 @@ imx_uart_console_setup(struct console *celse imx_uart_console_get_options (sport, &baud, &parity, &bits); -imx_uart_setup_ufcr (sport,TXTL_DEFAULT ,RXTL_DEFAULT ); +imx_uart_setup_ufcr (sport,TXTL_DEFAULT , sport->rxtl); retval =uart_set_options (&sport->port, co, baud, parity, bits, flow);
Greg Kroah-Hartman
maintainerPATCH 133/218 Bluetooth: L2CAP: Fix L2CAP MTU negotiation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frédéric Danis <[email protected]>
commit 042bb9603c44620dce98717a2d23235ca57a00d7 upstream.
OBEX download from iPhone is currently slow due to small packet size used to transfer data which doesn't follow the MTU negotiated during L2CAP connection, i.e. 672 bytes instead of 32767:
< ACL Data TX: Handle 11 flags 0x00 dlen 12
L2CAP: Connection Request (0x02) ident 18 len 4
PSM: 4103 (0x1007)
Source CID: 72Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 16
L2CAP: Connection Response (0x03) ident 18 len 8
Destination CID: 14608
Source CID: 72
Result: Connection successful (0x0000)
Status: No further information available (0x0000)
< ACL Data TX: Handle 11 flags 0x00 dlen 27
L2CAP: Configure Request (0x04) ident 20 len 19
Destination CID: 14608
Flags: 0x0000
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 32767
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 63
Max transmit: 3
Retransmission timeout: 2000
Monitor timeout: 12000
Maximum PDU size: 1009Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 26
L2CAP: Configure Request (0x04) ident 72 len 18
Destination CID: 72
Flags: 0x0000
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 32
Max transmit: 255
Retransmission timeout: 0
Monitor timeout: 0
Maximum PDU size: 65527
Option: Frame Check Sequence (0x05) [mandatory]
FCS: 16-bit FCS (0x01)
< ACL Data TX: Handle 11 flags 0x00 dlen 29
L2CAP: Configure Response (0x05) ident 72 len 21
Source CID: 14608
Flags: 0x0000
Result: Success (0x0000)
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 672
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 32
Max transmit: 255
Retransmission timeout: 2000
Monitor timeout: 12000
Maximum PDU size: 1009Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 32
L2CAP: Configure Response (0x05) ident 20 len 24
Source CID: 72
Flags: 0x0000
Result: Success (0x0000)
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 32767
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 63
Max transmit: 3
Retransmission timeout: 2000
Monitor timeout: 12000
Maximum PDU size: 1009
Option: Frame Check Sequence (0x05) [mandatory]
FCS: 16-bit FCS (0x01)...
Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 680
Channel: 72 len 676 ctrl 0x0202 [PSM 4103 mode Enhanced Retransmission (0x03)] {chan 8}
I-frame: Unsegmented TxSeq 1 ReqSeq 2
< ACL Data TX: Handle 11 flags 0x00 dlen 13
Channel: 14608 len 9 ctrl 0x0204 [PSM 4103 mode Enhanced Retransmission (0x03)] {chan 8}
I-frame: Unsegmented TxSeq 2 ReqSeq 2
Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 680
Channel: 72 len 676 ctrl 0x0304 [PSM 4103 mode Enhanced Retransmission (0x03)] {chan 8}
I-frame: Unsegmented TxSeq 2 ReqSeq 3
The MTUs are negotiated for each direction. In this traces 32767 for iPhone->localhost and no MTU for localhost->iPhone, which based on '4.4 L2CAP_CONFIGURATION_REQ' (Core specification v5.4, Vol. 3, Part A):
The only parameters that should be included in the L2CAP_CONFIGURATION_REQ packet are those that require different values than the default or previously agreed values.
...
Any missing configuration parameters are assumed to have their most recently explicitly or implicitly accepted values.
and '5.1 Maximum transmission unit (MTU)':
If the remote device sends a positive L2CAP_CONFIGURATION_RSP packet it should include the actual MTU to be used on this channel for traffic flowing into the local device.
...
The default value is 672 octets.
is set by BlueZ to 672 bytes.
It seems that the iPhone used the lowest negotiated value to transfer data to the localhost instead of the negotiated one for the incoming direction.
This could be fixed by using the MTU negotiated for the other direction, if exists, in the L2CAP_CONFIGURATION_RSP. This allows to use segmented packets as in the following traces:
< ACL Data TX: Handle 11 flags 0x00 dlen 12
L2CAP: Connection Request (0x02) ident 22 len 4
PSM: 4103 (0x1007)
Source CID: 72
< ACL Data TX: Handle 11 flags 0x00 dlen 27
L2CAP: Configure Request (0x04) ident 24 len 19
Destination CID: 2832
Flags: 0x0000
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 32767
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 63
Max transmit: 3
Retransmission timeout: 2000
Monitor timeout: 12000
Maximum PDU size: 1009Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 26
L2CAP: Configure Request (0x04) ident 15 len 18
Destination CID: 72
Flags: 0x0000
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 32
Max transmit: 255
Retransmission timeout: 0
Monitor timeout: 0
Maximum PDU size: 65527
Option: Frame Check Sequence (0x05) [mandatory]
FCS: 16-bit FCS (0x01)
< ACL Data TX: Handle 11 flags 0x00 dlen 29
L2CAP: Configure Response (0x05) ident 15 len 21
Source CID: 2832
Flags: 0x0000
Result: Success (0x0000)
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 32767
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 32
Max transmit: 255
Retransmission timeout: 2000
Monitor timeout: 12000
Maximum PDU size: 1009Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 32
L2CAP: Configure Response (0x05) ident 24 len 24
Source CID: 72
Flags: 0x0000
Result: Success (0x0000)
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 32767
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Enhanced Retransmission (0x03)
TX window size: 63
Max transmit: 3
Retransmission timeout: 2000
Monitor timeout: 12000
Maximum PDU size: 1009
Option: Frame Check Sequence (0x05) [mandatory]
FCS: 16-bit FCS (0x01)...
Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 1009
Channel: 72 len 1005 ctrl 0x4202 [PSM 4103 mode Enhanced Retransmission (0x03)] {chan 8}
I-frame: Start (len 21884) TxSeq 1 ReqSeq 2Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 1009
Channel: 72 len 1005 ctrl 0xc204 [PSM 4103 mode Enhanced Retransmission (0x03)] {chan 8}
I-frame: Continuation TxSeq 2 ReqSeq 2
This has been tested with kernel 5.4 and BlueZ 5.77.
--- net/bluetooth/l2cap_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +8 -1
@@ -3380,7 +3380,7 @@ static int l2cap_parse_conf_req(struct lstruct l2cap_conf_rfc rfc = { .mode =L2CAP_MODE_BASIC };struct l2cap_conf_efs efs;u8 remote_efs =0 ; -u16 mtu =L2CAP_DEFAULT_MTU ; +u16 mtu =0 ;u16 result =L2CAP_CONF_SUCCESS ;u16 size;
@@ -3485,6 +3485,13 @@ done:/* Configure output options and let the other side know * which ones we don't like. */ +/* If MTU is not provided in configure request, use the most recently +* explicitly or implicitly accepted value for the other direction, +* or the default value. +*/ +if (mtu ==0 ) + mtu = chan->imtu ? chan->imtu :L2CAP_DEFAULT_MTU ; +if (mtu <L2CAP_DEFAULT_MIN_MTU ) result =L2CAP_CONF_UNACCEPT ;else {
Greg Kroah-Hartman
maintainerPATCH 134/218 dm-raid: fix variable in journal device check
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heinz Mauelshagen <[email protected]>
commit db53805156f1e0aa6d059c0d3f9ac660d4ef3eb4 upstream.
Replace "rdev" with correct loop variable name "r".
--- drivers/md/dm-raid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-raid.c +1 -1
@@ -2410,7 +2410,7 @@ static int super_init_validation(struct*/ sb_retrieve_failed_devices (sb, failed_devices);rdev_for_each (r, mddev) { -if (test_bit (Journal, &rdev->flags) || +if (test_bit (Journal, &r->flags) || !r->sb_page)continue ; sb2 =page_address (r->sb_page);
Greg Kroah-Hartman
maintainerPATCH 135/218 btrfs: fix a race between renames and directory logging
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 3ca864de852bc91007b32d2a0d48993724f4abad upstream.
We have a race between a rename and directory inode logging that if it happens and we crash/power fail before the rename completes, the next time the filesystem is mounted, the log replay code will end up deleting the file that was being renamed.
This is best explained following a step by step analysis of an interleaving of steps that lead into this situation.
Consider the initial conditions:
1) We are at transaction N;
2) We have directories A and B created in a past transaction (< N);
3) We have inode X corresponding to a file that has 2 hardlinks, one in directory A and the other in directory B, so we'll name them as "A/foo_link1" and "B/foo_link2". Both hard links were persisted in a past transaction (< N);
4) We have inode Y corresponding to a file that as a single hard link and is located in directory A, we'll name it as "A/bar". This file was also persisted in a past transaction (< N).
The steps leading to a file loss are the following and for all of them we are under transaction N:
1) Link "A/foo_link1" is removed, so inode's X last_unlink_trans field
is updated to N, through btrfs_unlink() -> btrfs_record_unlink_dir();
2) Task A starts a rename for inode Y, with the goal of renaming from
"A/bar" to "A/baz", so we enter btrfs_rename();
3) Task A inserts the new BTRFS_INODE_REF_KEY for inode Y by calling
btrfs_insert_inode_ref();
4) Because the rename happens in the same directory, we don't set the last_unlink_trans field of directoty A's inode to the current transaction id, that is, we don't cal btrfs_record_unlink_dir();
5) Task A then removes the entries from directory A (BTRFS_DIR_ITEM_KEY and BTRFS_DIR_INDEX_KEY items) when calling __btrfs_unlink_inode() (actually the dir index item is added as a delayed item, but the effect is the same);
6) Now before task A adds the new entry "A/baz" to directory A by
calling btrfs_add_link(), another task, task B is logging inode X;
7) Task B starts a fsync of inode X and after logging inode X, at btrfs_log_inode_parent() it calls btrfs_log_all_parents(), since inode X has a last_unlink_trans value of N, set at in step 1;
8) At btrfs_log_all_parents() we search for all parent directories of inode X using the commit root, so we find directories A and B and log them. Bu when logging direct A, we don't have a dir index item for inode Y anymore, neither the old name "A/bar" nor for the new name "A/baz" since the rename has deleted the old name but has not yet inserted the new name - task A hasn't called yet btrfs_add_link() to do that.
Note that logging directory A doesn't fallback to a transaction commit because its last_unlink_trans has a lower value than the current transaction's id (see step 4);
9) Task B finishes logging directories A and B and gets back to btrfs_sync_file() where it calls btrfs_sync_log() to persist the log tree;
10) Task B successfully persisted the log tree, btrfs_sync_log() completed with success, and a power failure happened.
We have a log tree without any directory entry for inode Y, so the log replay code deletes the entry for inode Y, name "A/bar", from the subvolume tree since it doesn't exist in the log tree and the log tree is authorative for its index (we logged a BTRFS_DIR_LOG_INDEX_KEY item that covers the index range for the dentry that corresponds to "A/bar").
Since there's no other hard link for inode Y and the log replay code deletes the name "A/bar", the file is lost.
The issue wouldn't happen if task B synced the log only after task A called btrfs_log_new_name(), which would update the log with the new name for inode Y ("A/bar").
Fix this by pinning the log root during renames before removing the old directory entry, and unpinning after btrfs_log_new_name() is called.
--- fs/btrfs/inode.c | 81 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 64 insertions(+), 17 deletions(-)
fs/btrfs/inode.c +64 -17
@@ -7997,6 +7997,7 @@ static int btrfs_rename_exchange(structint ret;int ret2;bool need_abort = false; +bool logs_pinned = false;struct fscrypt_name old_fname, new_fname;struct fscrypt_str *old_name, *new_name;
@@ -8120,6 +8121,31 @@ static int btrfs_rename_exchange(structinode_inc_iversion (new_inode);simple_rename_timestamp (old_dir, old_dentry, new_dir, new_dentry); +if (old_ino !=BTRFS_FIRST_FREE_OBJECTID && + new_ino !=BTRFS_FIRST_FREE_OBJECTID ) { +/* +* If we are renaming in the same directory (and it's not for +* root entries) pin the log early to prevent any concurrent +* task from logging the directory after we removed the old +* entries and before we add the new entries, otherwise that +* task can sync a log without any entry for the inodes we are +* renaming and therefore replaying that log, if a power failure +* happens after syncing the log, would result in deleting the +* inodes. +* +* If the rename affects two different directories, we want to +* make sure the that there's no log commit that contains +* updates for only one of the directories but not for the +* other. +* +* If we are renaming an entry for a root, we don't care about +* log updates since we called btrfs_set_log_full_commit(). +*/ +btrfs_pin_log_trans (root); +btrfs_pin_log_trans (dest); + logs_pinned = true; + } +if (old_dentry->d_parent != new_dentry->d_parent) {btrfs_record_unlink_dir (trans,BTRFS_I (old_dir),BTRFS_I (old_inode), true);
@@ -8177,30 +8203,23 @@ static int btrfs_rename_exchange(structBTRFS_I (new_inode)->dir_index = new_idx;/* -* Now pin the logs of the roots. We do it to ensure that no other task -* can sync the logs while we are in progress with the rename, because -* that could result in an inconsistency in case any of the inodes that -* are part of this rename operation were logged before. +* Do the log updates for all inodes. +* +* If either entry is for a root we don't need to update the logs since +* we've called btrfs_set_log_full_commit() before. */ -if (old_ino !=BTRFS_FIRST_FREE_OBJECTID ) -btrfs_pin_log_trans (root); -if (new_ino !=BTRFS_FIRST_FREE_OBJECTID ) -btrfs_pin_log_trans (dest); - -/* Do the log updates for all inodes. */ -if (old_ino !=BTRFS_FIRST_FREE_OBJECTID ) +if (logs_pinned) {btrfs_log_new_name (trans, old_dentry,BTRFS_I (old_dir), old_rename_ctx.index, new_dentry->d_parent); -if (new_ino !=BTRFS_FIRST_FREE_OBJECTID )btrfs_log_new_name (trans, new_dentry,BTRFS_I (new_dir), new_rename_ctx.index, old_dentry->d_parent); + } -/* Now unpin the logs. */ -if (old_ino !=BTRFS_FIRST_FREE_OBJECTID ) +out_fail: +if (logs_pinned) {btrfs_end_log_trans (root); -if (new_ino !=BTRFS_FIRST_FREE_OBJECTID )btrfs_end_log_trans (dest); -out_fail: + } ret2 =btrfs_end_transaction (trans); ret = ret ? ret : ret2; out_notrans:
@@ -8250,6 +8269,7 @@ static int btrfs_rename(struct mnt_idmapint ret2;u64 old_ino =btrfs_ino (BTRFS_I (old_inode));struct fscrypt_name old_fname, new_fname; +bool logs_pinned = false;if (btrfs_ino (BTRFS_I (new_dir)) ==BTRFS_EMPTY_SUBVOL_DIR_OBJECTID )return -EPERM ;
@@ -8384,6 +8404,29 @@ static int btrfs_rename(struct mnt_idmapinode_inc_iversion (old_inode);simple_rename_timestamp (old_dir, old_dentry, new_dir, new_dentry); +if (old_ino !=BTRFS_FIRST_FREE_OBJECTID ) { +/* +* If we are renaming in the same directory (and it's not a +* root entry) pin the log to prevent any concurrent task from +* logging the directory after we removed the old entry and +* before we add the new entry, otherwise that task can sync +* a log without any entry for the inode we are renaming and +* therefore replaying that log, if a power failure happens +* after syncing the log, would result in deleting the inode. +* +* If the rename affects two different directories, we want to +* make sure the that there's no log commit that contains +* updates for only one of the directories but not for the +* other. +* +* If we are renaming an entry for a root, we don't care about +* log updates since we called btrfs_set_log_full_commit(). +*/ +btrfs_pin_log_trans (root); +btrfs_pin_log_trans (dest); + logs_pinned = true; + } +if (old_dentry->d_parent != new_dentry->d_parent)btrfs_record_unlink_dir (trans,BTRFS_I (old_dir),BTRFS_I (old_inode), true);
@@ -8432,7 +8475,7 @@ static int btrfs_rename(struct mnt_idmapif (old_inode->i_nlink ==1 )BTRFS_I (old_inode)->dir_index = index; -if (old_ino !=BTRFS_FIRST_FREE_OBJECTID ) +if (logs_pinned)btrfs_log_new_name (trans, old_dentry,BTRFS_I (old_dir), rename_ctx.index, new_dentry->d_parent);
@@ -8448,6 +8491,10 @@ static int btrfs_rename(struct mnt_idmap } } out_fail: +if (logs_pinned) { +btrfs_end_log_trans (root); +btrfs_end_log_trans (dest); + } ret2 =btrfs_end_transaction (trans); ret = ret ? ret : ret2; out_notrans:
Greg Kroah-Hartman
maintainerPATCH 136/218 btrfs: update superblocks device bytes_used when dropping chunk
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Harmstone <[email protected]>
commit ae4477f937569d097ca5dbce92a89ba384b49bc6 upstream.
Each superblock contains a copy of the device item for that device. In a transaction which drops a chunk but doesn't create any new ones, we were correctly updating the device item in the chunk tree but not copying over the new bytes_used value to the superblock.
This can be seen by doing the following:
# dd if=/dev/zero of=test bs=4096 count=2621440 # mkfs.btrfs test # mount test /root/temp
# cd /root/temp
# for i in {00..10}; do dd if=/dev/zero of=$i bs=4096 count=32768; done
# sync
# rm *
# sync
# btrfs balance start -dusage=0 .
# sync# cd # umount /root/temp # btrfs check test
For btrfs-check to detect this, you will also need my patch at
https://github.com/kdave/btrfs-progs/pull/991.
Change btrfs_remove_dev_extents() so that it adds the devices to the fs_info->post_commit_list if they're not there already. This causes btrfs_commit_device_sizes() to be called, which updates the bytes_used value in the superblock.
--- fs/btrfs/volumes.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/volumes.c +6 -0
@@ -3268,6 +3268,12 @@ int btrfs_remove_chunk(struct btrfs_tran device->bytes_used - dev_extent_len);atomic64_add (dev_extent_len, &fs_info->free_chunk_space);btrfs_clear_space_info_full (fs_info); + +if (list_empty (&device->post_commit_list)) { +list_add_tail (&device->post_commit_list, + &trans->transaction->dev_update_list); + } +mutex_unlock (&fs_info->chunk_mutex); } }
Greg Kroah-Hartman
maintainerPATCH 137/218 spi: spi-cadence-quadspi: Fix pm runtime unbalance
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Khairul Anuar Romli <[email protected]>
commit b07f349d1864abe29436f45e3047da2bdd476462 upstream.
Having PM put sync in remove function is causing PM underflow during remove operation. This is caused by the function, runtime_pm_get_sync, not being called anywhere during the op. Ensure that calls to pm_runtime_enable()/pm_runtime_disable() and pm_runtime_get_sync()/pm_runtime_put_sync() match.
echo 108d2000.spi > /sys/bus/platform/drivers/cadence-qspi/unbind
[ 49.644256] Deleting MTD partitions on "108d2000.spi.0": [ 49.649575] Deleting u-boot MTD partition [ 49.684087] Deleting root MTD partition [ 49.724188] cadence-qspi 108d2000.spi: Runtime PM usage count underflow!
Continuous bind/unbind will result in an "Unbalanced pm_runtime_enable" error. Subsequent unbind attempts will return a "No such device" error, while bind attempts will return a "Resource temporarily unavailable" error.
[ 47.592434] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! [ 49.592233] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128) [ 53.232309] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! [ 55.828550] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128) [ 57.940627] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! [ 59.912490] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128) [ 61.876243] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! [ 61.883000] platform 108d2000.spi: Unbalanced pm_runtime_enable! [ 532.012270] cadence-qspi 108d2000.spi: probe with driver cadence-qspi failed1
Also, change clk_disable_unprepare() to clk_disable() since continuous bind and unbind operations will trigger a warning indicating that the clock is already unprepared.
--- drivers/spi/spi-cadence-quadspi.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/spi/spi-cadence-quadspi.c +7 -5
@@ -1929,10 +1929,10 @@ static int cqspi_probe(struct platform_d goto probe_setup_failed; } - ret =devm_pm_runtime_enable (dev); -if (ret) { -if (cqspi->rx_chan) -dma_release_channel (cqspi->rx_chan); +pm_runtime_enable (dev); + +if (cqspi->rx_chan) { +dma_release_channel (cqspi->rx_chan); goto probe_setup_failed; }
@@ -1952,6 +1952,7 @@ static int cqspi_probe(struct platform_dreturn 0 ; probe_setup_failed:cqspi_controller_enable (cqspi,0 ); +pm_runtime_disable (dev); probe_reset_failed:if (cqspi->is_jh7110)cqspi_jh7110_disable_clk (pdev, cqspi);
@@ -1970,7 +1971,8 @@ static void cqspi_remove(struct platformif (cqspi->rx_chan)dma_release_channel (cqspi->rx_chan); -clk_disable_unprepare (cqspi->clk); +if (pm_runtime_get_sync (&pdev->dev) >=0 ) +clk_disable (cqspi->clk);if (cqspi->is_jh7110)cqspi_jh7110_disable_clk (pdev, cqspi);