7.3.5-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 7.3.5-rc1 review
This is the start of the stable review cycle for the 7.3.5 release. There are 507 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun, 15 Nov 2026 15:36:17 +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/v7.x/stable-review/patch-7.3.5-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-7.3.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 7.3.5-rc1
Gianluca Balboni <[email protected]>
ASoC: amd: yc: Add DMI quirk for HP OmniBook 3 Laptop 16-by0xxx
Chao Yu <[email protected]>
f2fs: fix to use bio_in_atomic() in f2fs_write_end_io()
Arnd Bergmann <[email protected]>
mm/vmscan: avoid false-positive -Wuninitialized warning, again
Kairui Song <[email protected]>
mm/mglru: use explicit tier range in read_ctrl_pos()
Daeho Jeong <[email protected]>
f2fs: expose resizable_tail feature via sysfs
Rafael J. Wysocki <[email protected]>
intel_idle: Adjust state names and descriptions for _LPI states
Andy Shevchenko <[email protected]>
intel_idle: Use 2-argument strscpy()
Ali Ahmet Memiş <[email protected]>
thermal: intel: int340x: Evaluate _TMP exclusively
Andrea Parri <[email protected]>
iommufd/iova_bitmap: Ensure that iova_bitmap_set() handles the full IOVA
David Carlier <[email protected]>
media: ipu6: Fix firmware config leak on stream start
Antti Laakso <[email protected]>
media: ipu6: Rename pointer to firmware context
Daeho Jeong <[email protected]>
f2fs: release a removed xattr node in roll-forward recovery
Miquel Raynal <[email protected]>
clk: nuvoton: ma35d1: Add missing WDT/WWDT parent clocks
Miquel Raynal <[email protected]>
dt-bindings: clock: ma35d1: Add missing WDT/WWDT parent clocks
Miquel Raynal <[email protected]>
dt-bindings: clock: ma35d1: Drop CLK_MAX_IDX define
Miquel Raynal <[email protected]>
clk: nuvoton: ma35d1: Keep the clock count in the driver
Sumit Kumar <[email protected]>
PCI: dwc: Set DMA_BYPASS bit in outbound IATU CTRL2 register
Ali Ahmet Memiş <[email protected]>
ACPI: battery: Evaluate battery methods exclusively
Ali Ahmet Memiş <[email protected]>
ACPI: utils: Add exclusive AML evaluation helpers
Chao Yu <[email protected]>
f2fs: fix to invalidate curseg if change_curseg() fails
Vladimir Oltean <[email protected]>
PCI: cadence: Preserve all error codes in cdns_plat_pcie_probe()
Linmao Li <[email protected]>
PCI: cadence: Store the core controller in platform drvdata
[email protected] <[email protected]>
PCI: cadence: Remove device links to PHY
Hengyu Liang <[email protected]>
erofs: fix metadata reads at the end of file-backed images
Peter Ujfalusi <[email protected]>
ASoC: hdac_hda: Restore the codec device type on unbind
Peter Ujfalusi <[email protected]>
ASoC: hdac_hda: Allocate the private data at codec driver bind
Guixin Liu <[email protected]>
nvme-tcp: Validate the queue state under the queue lock in the address attribute
Chao Yu <[email protected]>
f2fs: fix to avoid potential reference count leak in do_garbage_collect()
Marc Zyngier <[email protected]>
KVM: arm64: vgic: Stop the target vcpu when disabling LPIs
Arnaldo Carvalho de Melo <[email protected]>
perf evsel: Close the fds opened so far when disabling missing features
Hui Su <[email protected]>
perf evsel: Restrict incremental open error unwind
Kaixuan Li <[email protected]>
f2fs: bound the SIT/NAT bitmaps by the checkpoint pack
Daeho Jeong <[email protected]>
f2fs: return -EIO for a lost inode block after cp_error
Chao Yu <[email protected]>
f2fs: zone: fix to avoid bio split on sequential zone
Vincent Donnefort <[email protected]>
KVM: arm64: Use kvm_s2_fault_vma_info in pkvm_mem_abort()
Bartosz Golaszewski <[email protected]>
dmaengine: qcom: bam_dma: free interrupt before the clock in error path
Vishnu Santhosh <[email protected]>
dmaengine: qcom: bam_dma: Defer IRQ trigger type to device tree
Salvatore Dipietro <[email protected]>
mm/page_alloc: avoid direct reclaim and compaction for costly __GFP_NORETRY allocations
Mehmet Fide <[email protected]>
wifi: rtw88: widen the ATIM window while an AP interface is up
Mehmet Fide <[email protected]>
wifi: rtw88: usb: only let the frames a dozing station needs use the after-DTIM queue
Mehmet Fide <[email protected]>
wifi: rtw88: usb: bound what the driver feeds the after-DTIM queue
Mehmet Fide <[email protected]>
wifi: rtw88: usb: route bmc frames via the high queue only for DTIM delivery
Martin Belanger <[email protected]>
nvme-tcp: skip TLS control records while waiting for the ICResp
Chris Mason <[email protected]>
mm/shmem: honour F_SEAL_EXEC when an ACL is set
Lorenzo Stoakes (ARM) <[email protected]>
mm/vma: avoid spurious write locks when mm->mm_lock_seq overflows
Dave Hansen <[email protected]>
mm: add RCU-based VMA lookup helper that waits for writers
David Hildenbrand (Arm) <[email protected]>
mm/userfaultfd: only allocate anon_vma in CoW mappings
James Fairweather <[email protected]>
platform/chrome: cros_usbpd_notify: Only use drvdata when parent is GOOG0004
Hemanth Selam <[email protected]>
platform/chrome: Fix typos in comments
Yuejie Shi <[email protected]>
fs/ntfs3: validate the EA value length in ntfs_read_ea()
Jun Yang <[email protected]>
sctp: re-point retained control chunks on association migration
David Lee <[email protected]>
sctp: hold shkey across socket migration
Jared Wuerzburger <[email protected]>
ALSA: hda/realtek: Fix internal mic on Minisforum V3 and V3 SE
Saim Masood <[email protected]>
ALSA: hda/realtek: Fix speakers on ASUS ExpertBook PM3606CHA
Chao Yu <[email protected]>
f2fs: fix to check continuousness in f2fs_sync_meta_pages() correctly
Chao Yu <[email protected]>
f2fs: fix to avoid folio->mapping dereference in is_{meta, node}_folio()Runyu Xiao <[email protected]>
ALSA: usb-audio: Protect Roland control activation
Nicholas Hobson <[email protected]>
ALSA: usb-audio: keep MIDI input running for Roland TD-11
Balakrishnan Sambath <[email protected]>
media: microchip-isc: fix SBGGR10 Bayer pattern
Balakrishnan Sambath <[email protected]>
media: microchip-isc: fix ISC_PFG_CFG0_BPS macro name typo
Fuad Tabba <[email protected]>
KVM: arm64: Use kvm_s2_fault_vma_info in gmem_abort()
Vincent Donnefort <[email protected]>
KVM: arm64: Pass kvm_s2_fault_desc to fault_supports_stage2_huge_mapping()
Balakrishnan Sambath <[email protected]>
media: microchip-isc: fix WB offset and gain register field masking
Balakrishnan Sambath <[email protected]>
media: microchip-isc: store the unshifted PFE_CFG0 BPS value
Cheng Ming Lin <[email protected]>
mtd: spi-nor: macronix: Restore fallback parameters for MX25L12805D
Richard Fitzgerald <[email protected]>
ASoC: cs35l56: Wait for firmware timer expiry before system suspend
Jason Gunthorpe <[email protected]>
iommu/arm-smmu-v3: Handle ARM erratum for CONT under invalidation with SVA
Zhao Gongyi <[email protected]>
ata: libata-scsi: reject data-in commands with a data-out buffer
Sven Eckelmann <[email protected]>
batman-adv: tt: only update flags for TT events
Sven Eckelmann <[email protected]>
batman-adv: tt: send ROAM_ADV on each roamed back client
Sven Eckelmann <[email protected]>
batman-adv: tt: clear ROAM flag when re-adding a pending local client
Sven Eckelmann <[email protected]>
batman-adv: tt: only transmit local ROAM flag together with DEL
Ido Schimmel <[email protected]>
vxlan: Stop rejecting dynamic FDB entries with a nexthop ID
Guanglei Zhu <[email protected]>
ceph: clamp the inline data length in ceph_fill_inline_data()
Suravee Suthikulpanit <[email protected]>
iommu/amd: Force device table to maximum size
Chris Mason <[email protected]>
x86/mm: Fix global ASID handed out to two processes
Marco Ziliani <[email protected]>
ata: libata-pmp: disable the SEMB port on Marvell 88SM9705
Kiryl Shutsemau (Meta) <[email protected]>
arm64: sdei: Preserve the interrupted context's exception registers
Kiryl Shutsemau (Meta) <[email protected]>
arm64: sdei: Run the event handler on the kernel vectors
Thorsten Blum <[email protected]>
x86/boot: Fix off-by-one error in sme_clear_pgd()
Jinjie Ruan <[email protected]>
arm64: kexec_file: Fix elf_headers memory leak in retry loop
Kevin Mitchell <[email protected]>
iommu/amd: remove obsolete domain pointer warning on release
Akshay Jindal <[email protected]>
iommu/amd: Skip non-IVMD entries when parsing IVRS memory definitions
Breno Leitao <[email protected]>
x86/nmi: Ignore negative NMI handler durations
Daehyeon Ko <[email protected]>
sched/fair: Clear throttle state when leaving the fair class
Danish Khateeb <[email protected]>
perf/core: Don't send SIGTRAP after exec removed the event
Shao Mingyin <[email protected]>
nvmet: bound the traddr and trsvcid configfs writes
Qiliang Yuan <[email protected]>
nvme: wait for SRCU readers before splicing the namespace list
Qiliang Yuan <[email protected]>
srcu: Add list_splice_init_srcu()
Imre Kaloz <[email protected]>
MIPS: sgi-ip32: Leave MACE PCI control alone in config accesses
Imre Kaloz <[email protected]>
MIPS: sgi-ip32: Mask MACE PCI interrupts in CRIME only
Imre Kaloz <[email protected]>
MIPS: mm: Fix the cache error vector jump for XKPHYS kernels
Matthias Goergens <[email protected]>
udf: don't use eloc after the end of the unallocated space table
Matthias Goergens <[email protected]>
udf: fix preallocation discarding before an empty allocation extent
Matthias Goergens <[email protected]>
udf: check the unallocated space table when it is loaded
Matthias Goergens <[email protected]>
udf: don't let the extent type hide an exhausted free-space table extent
Kyle Zeng <[email protected]>
mptcp: pm: kernel: use RCU to free endpoint listeners
Tvrtko Ursulin <[email protected]>
drm/sched: Adjust run-queue when changing priority at runtime
Tvrtko Ursulin <[email protected]>
drm/sched: Fix out of bounds entity priority check
Christian Gmeiner <[email protected]>
drm/etnaviv: Flush the tile status cache through both the PE and BLT
Christian Gmeiner <[email protected]>
drm/etnaviv: Fix NULL dereference on unbind without PPU flop reset
James Clark <[email protected]>
net: ethernet: ti: am65-cpsw-nuss: Enable timestamping of unicast PTP packets
Ray Zhang <[email protected]>
net: count last skb of each sk_backlog pass in __release_sock()
Bryam Vargas <[email protected]>
net/smc: don't spin in smc_rx_recvmsg() while a pipe holds spliced data
Hungyu Lin <[email protected]>
ext2: preserve IOMAP_F_DIRTY for extending direct writes
Sinan Turunc <[email protected]>
ALSA: usx2y: Guard the playback copy
Sinan Turunc <[email protected]>
ALSA: usx2y: Require a buffer of two URBs
Wentao Liang <[email protected]>
ALSA: caiaq: free the EP4 URB when input setup fails
Sinan Turunc <[email protected]>
ALSA: line6: Reject capture buffers smaller than two packets
Mohamed Yassine Jebabli <[email protected]>
ALSA: hda/tas2781: Only accept CRC-less V1 data if all entries are valid
Alexandr <[email protected]>
ALSA: hda/realtek: Enable mute and mic-mute LEDs on HP ENVY 17-cr0xxx
Yuqiang Sun <[email protected]>
ALSA: usb-audio: qcom: Check the return value of qmi_handle_init()
YuanZhe Liu <[email protected]>
ALSA: usx2y: Refuse a retried DSP load after a failure
YuanZhe Liu <[email protected]>
ALSA: bcd2000: Fix use-after-free of MIDI URBs on file close
Alex Kazinsky <[email protected]>
ALSA: cs46xx: Handle SCB creation failures before dereferencing
Chris Simpson <[email protected]>
ALSA: hda/realtek: Enable bass speakers on Alienware m17 R3
HyeongJun An <[email protected]>
ALSA: ump: Fix dropped data bytes at UMP System message conversion
Ilia Mirkin <[email protected]>
drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts
Finn Zeruhn <[email protected]>
drm/dp: keep MOT set between messages when no_zero_sized is set
Rosen Penev <[email protected]>
drm/nouveau/nvkm: clear use.enabled when subdev init fails
Hengyu Liang <[email protected]>
l2tp: only return sessions of the given tunnel in l2tp_session_get()
Amir Goldstein <[email protected]>
selftests/fscontext_ns: expect EINVAL for overlay descendant userns create
Chris Mason <[email protected]>
ovl: look up the index by the decoded origin
Sasha Levin <[email protected]>
nvme-pci: add NVME_QUIRK_DMAPOOL_ALIGN_512 for KIOXIA XG10d
Zhao Gongyi <[email protected]>
arm64: mm: validate /dev/mem mmap ranges without overflow
Wei Wang <[email protected]>
arm64: suspend: Save and restore TPIDR2_EL0 across CPU suspend
Ewan D. Milne <[email protected]>
nvmet: don't return memory contents beyond valid data when reading ANA log page
Jesse Zhang <[email protected]>
drm/amdgpu: don't drop the gang dependency fence twice
renpanpan <[email protected]>
drm/amdgpu: Only enable HDMI audio if display supports it
Jesse Zhang <[email protected]>
drm/amdgpu: don't walk the CS chunks when allocating them failed
Jesse Zhang <[email protected]>
drm/amdgpu: rewrite all PTEs of the BOs after a VM reset
Jesse Zhang <[email protected]>
drm/amdgpu: unlock the VM and BO when attaching a KFD BO fails
Jesse Zhang <[email protected]>
drm/amdgpu: drop the dma-buf reference when a KFD import fails
Hugo Sales <[email protected]>
drm/amdgpu: Clamp the ATIF backlight curve to its 99 points
Erhan Bilgili <[email protected]>
drm/amdgpu: Report MES ring wait timeouts.
Erhan Bilgili <[email protected]>
drm/amdgpu: Fix duplicate dependency fence releases
Kevin Wang <[email protected]>
drm/amd/pm: populate unique ID for smu 13.0.7
Melissa Wen <[email protected]>
drm/amd/display: Signal PQ EOTF in FreeSync infopacket for DP HDR
Mikhail Gavrilov <[email protected]>
drm/amd/display: set allow_freesync before validating a new stream
Kylie C <[email protected]>
drm/amd/display: Don't select zero V_TOTAL_MIN/MAX on seamless boot
Matthew Schwartz <[email protected]>
drm/amd/display: Keep the nominal vtotal while VRR is inactive
Misha Nasledov <[email protected]>
drm/amd/display: Drop clock requirements on DCN32 when no displays are active
Roman Demidov <[email protected]>
drm/amd/display: Fix NULL deref in dcn401_update_clocks_update_dtb_dto
Jesse Zhang <[email protected]>
drm/amdgpu/gfx12: disallow GFXOFF while updating the SPM VMID
Roman Li <[email protected]>
drm/amd/display: Reset DET of HUBPs without a plane before outstanding updates
Alex Hung <[email protected]>
drm/amd/display: Avoid closing unowned DDC pins
Milan Milicevic <[email protected]>
drm/amdgpu: publish IH enabled before PSP programs IH_RB_CNTL
Kent Russell <[email protected]>
drm/amdgpu: Ensure that harvest information gets set
Prike Liang <[email protected]>
drm/amdgpu: stop the schedulers before preparing the GPU reset
Milan Milicevic <[email protected]>
drm/amdgpu: clear RB_OVERFLOW bit when enabling interrupts for navi10_ih
Prike Liang <[email protected]>
drm/amdgpu: finish GPU recovery callbacks before restarting schedulers
Wayne Lin <[email protected]>
drm/amd/display: add missing CRC engine 1 registers
Jesse Zhang <[email protected]>
drm/amdgpu/userq: validate the moved individual BOs on restore
Dariusz Marcinkiewicz <[email protected]>
drm/amdgpu: check amdgpu_vm_ready() in dma-buf move notify
Prike Liang <[email protected]>
drm/amdgpu/userq: wait for GPU reset before mapping or unmapping queues
Jesse Zhang <[email protected]>
drm/amdkfd: use the queue's process info for the WPTR BO eviction fence
Jesse Zhang <[email protected]>
drm/amdgpu: keep the CS user fence BO in GTT
Jesse Zhang <[email protected]>
drm/amdgpu: parse CS IBs at the BO offset their VA mapping starts at
Jesse Zhang <[email protected]>
drm/amdgpu: sign extend the addresses GEM_OP(GET_MAPPING_INFO) returns
Ce Sun <[email protected]>
drm/amdgpu: skip RAS error count reset in debug mode
Bas Nieuwenhuizen <[email protected]>
drm/amdgpu: Check cs flags.
Jarkko Sakkinen <[email protected]>
nvme-keyring: Add a missing key_put() call to nvme_tls_key_lookup()
Yitang Yang <[email protected]>
ublk: add missing DEL_DEV_ASYNC to unprivileged permission check
Yilin Zhang <[email protected]>
mptcp: do not use Fast Open on MP_JOIN subflows
Daehyeon Ko <[email protected]>
vhost/vsock: size receive SKBs from declared payload
Alexei Starovoitov <[email protected]>
net: reject a negative TCP header offset in qdisc_pkt_len_segs_init()
Amir Goldstein <[email protected]>
ovl: inherit FMODE_NONOTIFY when opening directory realfiles
Jamal Hadi Salim <[email protected]>
net/sched: clamp skb->queue_mapping before indexing the tx queue
Chris Mason <[email protected]>
ovl: fix whiteout creation in casefolded directories
Chris Mason <[email protected]>
ovl: do not let chattr change the casefold flag
Chris Mason <[email protected]>
ovl: fail the mount if the casefold flag has changed
Xia Yan <[email protected]>
ipv6: fix device binding after failed datagram connect
Thomas Gleixner <[email protected]>
x86/entry: Fix ptrace regression
Samiullah Khawaja <[email protected]>
mm/gup: check folio->mapping under folio lock in memfd_pin_folios()
Lance Yang <[email protected]>
khugepaged: fix readahead lock inversion in collapse_file()
Ritesh Harjani (IBM) <[email protected]>
mm/huge_memory: set the mmu_gather page size in zap_huge_pud()
David Hildenbrand (Arm) <[email protected]>
mm/memory-tiers: unregister empty tiers outside memory_tier_lock
Rik van Riel <[email protected]>
mm/cma: don't release CMA pages still in use
David Hildenbrand (Arm) <[email protected]>
mm/vma: don't leak the charge for stack growth
David Hildenbrand (Arm) <[email protected]>
mm/huge_memory: split huge PUDs when adjusting VMA boundaries
Chris Mason <[email protected]>
mm/vma: call ->may_split() before a partial merge
Chris Mason <[email protected]>
mm/ksm: check large swap-cache folios before mapping them
David Hildenbrand (Arm) <[email protected]>
mm/ksm: fix use of a freed anon_vma at swap-in
David Hildenbrand (Arm) <[email protected]>
mm/ksm: reset the unstable trees of all nodes
Chris Mason <[email protected]>
mm: fix deadlock of mremap() against UFFDIO_MOVE
Chris Mason <[email protected]>
mm: fix unkillable fault loop on MAP_DROPPABLE memory
Josef Bacik <[email protected]>
mm: fix unmap_mapping_range() beyond 4 GiB on 32-bit
Chris Mason <[email protected]>
mm/memory: reject remote COW faults on PFN mappings
David Hildenbrand (Arm) <[email protected]>
mm/madvise: fix data loss from MADV_FREE on a KSM page
Josef Bacik <[email protected]>
mm/mremap: fix moving PUD leaves
David Hildenbrand (Arm) <[email protected]>
mm/mremap: recheck PUDs under the page table lock
David Hildenbrand (Arm) <[email protected]>
mm/mremap: use pudp_huge_get_and_clear() when moving huge PUDs
Chris Mason <[email protected]>
mm/mmu_notifier: set ->mm only after mmgrab()
Josef Bacik <[email protected]>
mm/mmu_notifier: finish non-blocking interval invalidation on error
Josef Bacik <[email protected]>
mm/mmu_gather: fix flushing ranges with 4 GiB or larger
Josef Bacik <[email protected]>
mm/userfaultfd: wake all waiters on unregister
David Hildenbrand (Arm) <[email protected]>
mm/userfaultfd: write-lock the VMA before waking waiters when unregistering
David Hildenbrand (Arm) <[email protected]>
mm/gup: check for overflow when converting nr_pages to bytes in GUP-fast
Chris Mason <[email protected]>
mm/gup: fix out-of-bounds write for nr_pages == 0 in GUP-fast
Chris Mason <[email protected]>
mm/gup: fix clearing folios in memfd_pin_folios()
David Hildenbrand (Arm) <[email protected]>
mm/gup: recheck the PUD under PTL in follow_pud_mask()
Chris Mason <[email protected]>
mm/khugepaged: preserve dirty bits when collapsing PTE-mapped THPs
Josef Bacik <[email protected]>
mm/khugepaged: fix PMD table lock leak in try_collapse_pte_mapped_thp()
Josef Bacik <[email protected]>
mm/khugepaged: always recheck the pmd in try_collapse_pte_mapped_thp()
Chris Mason <[email protected]>
mm/huge_memory: fix zapping migration entries for device-private THPs
Chris Mason <[email protected]>
mm/huge_memory: fix truncate racing with PMD zapping
Liu Changjie <[email protected]>
can: peak_usb: pcan_usb_fd_decode_buf(): accept short uCAN end-of-list records
ChunYuZhiQiang <[email protected]>
can: dev: can_fill_info(): don't wake up controller if interface is down
Oliver Hartkopp <[email protected]>
can: proc: skip stats calculation after reset in can_stat_update()
Runyu Xiao <[email protected]>
can: proc: reset pkg_stats atomics individually
Oliver Hartkopp <[email protected]>
can: raw, isotp: copy socket options outside of lock_sock()
Oliver Hartkopp <[email protected]>
can: protect the receive lists with a per-device lock
Oliver Hartkopp <[email protected]>
can: isotp: check the return values of can_rx_register() in isotp_bind()
Oliver Hartkopp <[email protected]>
can: replace ARPHRD_CAN type checks with can_get_ml_priv()
Cunhao Lu <[email protected]>
can: dev: can_put_echo_skb(): free skb on invalid echo index
Cunhao Lu <[email protected]>
can: skb: make echo skb freeing safe in any IRQ context
Kaixuan Li <[email protected]>
can: isotp: check the frame type, not just the length
Vincent Mailhol <[email protected]>
can: dev: can_dropped_invalid_skb: drop CAN XL frames on non-CAN XL devices
Yingjie Wang <[email protected]>
nvmet: reject keep-alive timeouts that would overflow
Christoph Hellwig <[email protected]>
xfs: fix recovery of partial attr removals
Hyunwoo Kim <[email protected]>
net: restore refcount ordering for lockless socket access
Daejun Park <[email protected]>
xfs: clamp the pNFS layout range to the maximum file size
Daejun Park <[email protected]>
xfs: cap the block count of xfs_iomap_write_direct() at one extent
Daejun Park <[email protected]>
xfs: clamp a pNFS LAYOUTCOMMIT extent before computing its end
Daejun Park <[email protected]>
xfs: refuse a pNFS LAYOUTCOMMIT of a range without blocks
Daejun Park <[email protected]>
xfs: add a flag to convert unwritten extents without allocating blocks
Daejun Park <[email protected]>
xfs: mark the inode preallocated for pNFS write layouts past EOF
Zhe Liu <[email protected]>
blk-iocost: account flush sequence latency only once
Krystian Kaniewski <[email protected]>
blk-mq: fix out-of-bounds read in blk_mq_free_rqs
Laveesh Bansal <[email protected]>
block: only serialize elevator switches of the same queue
Reid Downing <[email protected]>
xfs: fix wrong compat fields in xfs_ioctl32_bstat_copyin()
Hungyu Lin <[email protected]>
block: Return the soft block size for compat BLKBSZGET
Cong Zhang <[email protected]>
virtio_blk: use synchronous quiesce in virtblk_freeze_priv()
Josef Bacik <[email protected]>
blk-mq: end the request if getting a keyslot fails
Hungyu Lin <[email protected]>
inotify: do not coalesce rename events
chenglong.ma <[email protected]>
vduse: fix VA/PA confusion in the coherent page fault path
Thorsten Blum <[email protected]>
hwrng: virtio - prevent use-after-free after a failed restore
Esben Haabendal <[email protected]>
drm/bridge: nwl-dsi: Limit LCDIF specific sync override
Esben Haabendal <[email protected]>
drm/bridge: nwl-dsi: Cleanup endpoint mux control selection
Yuho Choi <[email protected]>
vdpa/snet: Don't discard the DPU error in snet_send_ctrl_msg()
Yuho Choi <[email protected]>
iommu/virtio: Reset device before deleting virtqueues on probe failure
Fang Xieyan <[email protected]>
vhost: fix used ring index wrap in vhost_add_used_n_in_order
Shubham Antil <[email protected]>
vhost-scsi: zero misaligned I/O bounce pages
Kyle Zeng <[email protected]>
net/sched: sch_qfq: prevent aggregate self-replacement
Jianyun Gao <[email protected]>
xfs: fix temporary cursor leak in btree shift corruption paths
Naman Jain <[email protected]>
x86/init: Initialize wall clock in get_rtc_noop()
Cen Zhang <[email protected]>
ocfs2: cache the mount context for dentry lock callbacks
Cen Zhang <[email protected]>
ocfs2: wait for filecheck kobject release after a failed add
Cen Zhang <[email protected]>
ocfs2/cluster: unlink socket containers before releasing resources
Cen Zhang <[email protected]>
ocfs2: stop recovery before shutting down local allocators
Cen Zhang <[email protected]>
ocfs2/dlm: serialize migration MLE cleanup on failure
Nickolai Zeldovich <[email protected]>
panic: zero the dynamically allocated taint buffer
Cen Zhang <[email protected]>
ocfs2: keep locking_state within the cluster connection lifetime
Cen Zhang <[email protected]>
ocfs2: validate move extents against a stable EOF
Matheus Alves de Almeida <[email protected]>
fat: hold truncate_lock in fat_write_failed()
Joseph Qi <[email protected]>
ocfs2: do not read the entry array of an empty xattr block
Joseph Qi <[email protected]>
ocfs2: do not index before the entry array when dividing an empty bucket
Joseph Qi <[email protected]>
ocfs2: do not read the entry array of an empty xattr bucket
Joseph Qi <[email protected]>
ocfs2: find the xattr entry again after converting a block to a bucket
Joseph Qi <[email protected]>
ocfs2: find the xattr entry again after defragmenting a bucket
Andrew Morton <[email protected]>
openrisc: export __mulsi3 for modules
Nathan Chancellor <[email protected]>
lib/base64: silence clang-24 -Wconstant-conversion with diag pragmas
T.J. Mercier <[email protected]>
mm: memcontrol: fix NULL pointer deref and UAF from high_work_func() on dying memcg
Mike Rapoport (Microsoft) <[email protected]>
mm/cma: accept memory of CMA areas reserved at a fixed address
Mike Rapoport (Microsoft) <[email protected]>
mm/cma: accept memory of multi-range CMA areas
Johannes Weiner <[email protected]>
mm: page_alloc: remove ALLOC_NON_BLOCK from ALLOC_RESERVES
Johannes Weiner <[email protected]>
mm: page_alloc: do not give all non-blocking requests reserve access
Kiryl Shutsemau (Meta) <[email protected]>
mm/hugetlb_vmemmap: map the shared tail page writable
Lorenzo Stoakes (ARM) <[email protected]>
mm/vma: update VMA iterator state on error in new VMA merge
Yafang Shao <[email protected]>
mm/migrate: snapshot the source nid before the misplaced migration
Lance Yang <[email protected]>
mm/ksm: fix userfaultfd protection during merge and unmerge
Hungyu Lin <[email protected]>
mm/migrate: untag addresses when querying page nodes
Chris Down <[email protected]>
mm: make swapoff interruptible when unusing mms/shmem
SJ Park <[email protected]>
mm/damon/core: move static variable rotation to damon_ctx
SJ Park <[email protected]>
mm/damon/core: move static variable last_nr_regions to damon_ctx
SJ Park <[email protected]>
mm/damon/sysfs-schemes: hold damon_sysfs_lock in target_metric_store()
Hengyu Liang <[email protected]>
fs/proc/task_mmu: return -ENOTTY for unknown pagemap ioctls
Samarth Narang <[email protected]>
mm/ksm: keep soft-dirty when merging a page
David Hildenbrand (Arm) <[email protected]>
mm/vma: write lock source VMA before duplicating it in __split_vma()
Zenghui Yu (Huawei) <[email protected]>
mm/page_alloc: mark pages freed by __free_pages_core() as not tagged
Li Zhe <[email protected]>
mm/hugetlb: fix mremap deadlock when PMD sharing is possible
Li Zhe <[email protected]>
mm/hugetlb: fix mremap move length truncation
Gregory Price (Meta) <[email protected]>
mm/page_alloc: let the highest memory node recover from hopeless state
Hungyu Lin <[email protected]>
mm/page-writeback: avoid 32-bit overflow in dirty threshold shares
Baolin Wang <[email protected]>
mm: memory: fix truncation removing mapped folios
David Hildenbrand (Arm) <[email protected]>
mm: fix address wraparound when scanning large folio PTEs
Kyle Zeng <[email protected]>
mm/khugepaged: flush deferred unmaps before dropping a failed folio
Babu Moger <[email protected]>
x86,fs/resctrl: Keep mbm_assign_mode in default mode at boot
Babu Moger <[email protected]>
x86/resctrl: Correct ABMC counter ID field width
Mohit Sharma <[email protected]>
ASoC: qcom: q6apm: Guard callbacks until probe data is ready
Michael McAllister <[email protected]>
Bluetooth: qca: Fix the WCN3950 NVM baud rate offset
Valentin Kindschi <[email protected]>
Bluetooth: hci_sync: pause advertising for the scan address update
Valentin Kindschi <[email protected]>
Bluetooth: hci_sync: re-enable legacy advertising on resume
Zack Rusin <[email protected]>
x86/vmware: Fix i386 high-bandwidth hypercall arguments
Yingjie Wang <[email protected]>
ipv6: reject wrapped temporary address preferred lifetimes
Eric Dumazet <[email protected]>
inet: frags: limit the truesize of a reassembly queue
James Calligeros <[email protected]>
ASoC: tas2770: Fix error detection in tas2770_set_dai_tdm_idle
Sean Christopherson <[email protected]>
KVM: x86: Unconditionally reset MMU context when emulating INIT
Sean Christopherson <[email protected]>
KVM: x86/mmu: Cap number of parent PTEs per SP at 1000 (the arbitrary rmap limit)
Sean Christopherson <[email protected]>
KVM: nVMX: Process each host MSR entry at most once when unwinding failed VM-Entry
Sean Christopherson <[email protected]>
KVM: x86: Conditionally resched when restarting REP string emulation
Sean Christopherson <[email protected]>
KVM: x86/mmu: Conditionally resched when retrying gPTE walk on A/D update failure
Yuqiang Sun <[email protected]>
nvme: Do not drop the cdev reference twice when cdev_device_add() fails
Daejun Park <[email protected]>
nvme: unregister when pr_register() is given a zero new key
Christian Aurich Zanettini Martins <[email protected]>
nvme-rdma: fix NULL queue->ctrl dereference on reconnect
Joonhoe Kim <[email protected]>
net: qrtr: announce local services again once our HELLO is sent
Vas Zayarskiy <[email protected]>
hwmon: (aquacomputer_d5next) Avoid truncating scaled sensor readings
Guenter Roeck <[email protected]>
hwmon: (sht4x) Convert update_interval to jiffies in pending data check
Guenter Roeck <[email protected]>
hwmon: (coretemp) Set nr_cores only after core_data allocation succeeds
Guenter Roeck <[email protected]>
hwmon: (coretemp) Check for NULL platform device in hotplug callbacks
Baek Kyu, Kim <[email protected]>
hwmon: (gpio-fan) Update the speed cache before dropping the PM reference
Guenter Roeck <[email protected]>
hwmon: (tmp108) Fix initial conversion delay and wait until ready
Guenter Roeck <[email protected]>
hwmon: (lm75) Fix setting polarity mask for chips with 16-bit config register
Guenter Roeck <[email protected]>
hwmon: (pmbus) Fix return value check from thermal zone registration
Guenter Roeck <[email protected]>
hwmon: (pmbus) Release devres allocated memory after devm_thermal_of_zone_register error
Guenter Roeck <[email protected]>
hwmon: (pmbus) Check return value from pmbus_thermal_add_sensor()
Guenter Roeck <[email protected]>
hwmon: (pmbus/q54sj108a2) Add missing NULL pointer check
Guenter Roeck <[email protected]>
hwmon: (peci/dimmtemp) Fix devres leak and UAF on concurrent unbind
Guenter Roeck <[email protected]>
hwmon: (nct6683) Fix incorrect struct cast in show_pwm() and store_pwm()
Guenter Roeck <[email protected]>
hwmon: (lm87) Fix drvdata type confusion in vrm_show() and vrm_store()
Guenter Roeck <[email protected]>
hwmon: (hp-wmi-sensors) Fix unbounded loops in scale_numeric_sensor()
Guenter Roeck <[email protected]>
hwmon: (hp-wmi-sensors) Avoid global struct mutation
Guenter Roeck <[email protected]>
hwmon: (asus_wmi_sensors) Avoid global struct mutation
Guenter Roeck <[email protected]>
hwmon: (aquacomputer_d5next) Check maxcollection when probing AQUAERO devices
Javier Carrasco <[email protected]>
hwmon: chipcap2: synchronize ready IRQ state
Javier Carrasco <[email protected]>
hwmon: chipcap2: serialize access to the alarm indicators
Javier Carrasco <[email protected]>
hwmon: chipcap2: do not discard pending alarms on disable
Javier Carrasco <[email protected]>
hwmon: chipcap2: balance regulator state
Javier Carrasco <[email protected]>
hwmon: chipcap2: enable IRQ processing when regulator is already enabled
Javier Carrasco <[email protected]>
hwmon: chipcap2: disable device after hwmon teardown
Javier Carrasco <[email protected]>
hwmon: chipcap2: fix IRQ teardown ordering
Javier Carrasco <[email protected]>
hwmon: chipcap2: defer probe when IRQs are unavailable
Javier Carrasco <[email protected]>
hwmon: chipcap2: fix be16 handling
Javier Carrasco <[email protected]>
hwmon: chipcap2: fix off-by-one in command mode retry loop
Javier Carrasco <[email protected]>
hwmon: chipcap2: fix command error diagnostics
Alexei Solcanu <[email protected]>
hwmon: (gpd-fan) Reset both fans to automatic on duo boards
Zac Lanzon <[email protected]>
hwmon: (asus_rog_ryujin) Fix pump control source on the Ryujin III
Jiale Yao <[email protected]>
hwmon: (aquacomputer_d5next) reject short status reports
Baek Kyu, Kim <[email protected]>
hwmon: (corsair-cpro) Cache fan target only after a successful command
Myeonghun Pak <[email protected]>
hwmon: (sht15) Stop deferred work before releasing its resources
Xia Yan <[email protected]>
veth: keep carrier off when resizing channels with a down peer
Fang Xieyan <[email protected]>
vringh: reject empty / undersized indirect descriptor tables
Fang Xieyan <[email protected]>
vringh: bound top-level re-entry into indirect tables
Tal Zussman <[email protected]>
vhost-vdpa: fix pinned page leak in vhost_vdpa_pa_map() error path
Zhan Xusheng <[email protected]>
ntfs: don't allow compression on volumes with clusters larger than 4K
Qihang <[email protected]>
cipso: fix optlen corruption in cipso_v4_delopt()
Maíra Canal <[email protected]>
drm/v3d: Widen cache_clean_lock over the whole L2TCACTL sequence
Jose Maria Casanova Crespo <[email protected]>
drm/v3d: Initialize timedout_batches when running a CSD job
Daejun Park <[email protected]>
xfs: don't skip free extents of the longest length in a whole-AG FITRIM
Daejun Park <[email protected]>
xfs: don't skip free extents in later batches of a whole-AG FITRIM
Binbin Deng <[email protected]>
xfs: set healthmon mount cookie before publishing it
Hungyu Lin <[email protected]>
ext2: preserve completed DIO bytes when buffered fallback fails
David Hildenbrand (Arm) <[email protected]>
mm/huge_memory: properly handle refcounted PUD mappings on fork
David Hildenbrand (Arm) <[email protected]>
mm/huge_memory: fix list corruption when deferred_split_scan() races with deferred_split_folio()
David Hildenbrand (Arm) <[email protected]>
mm/rmap: handle device-exclusive entries in folio_referenced_one()
David Hildenbrand (Arm) <[email protected]>
mm/filemap: finish fault cleanup before dropping the fault lock
Josef Bacik <[email protected]>
mm/filemap: don't lose a folio lock wakeup to a signal
Josef Bacik <[email protected]>
mm/filemap: read mapping->a_ops->free_folio under i_lock
David Hildenbrand (Arm) <[email protected]>
mm/truncate: look again if a folio left the mapping
Josef Bacik <[email protected]>
mm/memfd: make f_pos accesses atomic
David Hildenbrand (Arm) <[email protected]>
mm/shmem: make shmem_file() check the file's inode
David Hildenbrand (Arm) <[email protected]>
fork: take mmap_lock before copying mm_struct
Josef Bacik <[email protected]>
mm/mglru: don't use stack pointers when walking PUD and PMD tables
David Hildenbrand (Arm) <[email protected]>
mm/shmem: fix truncation of files containing only swapin-error markers
David Hildenbrand (Arm) <[email protected]>
mm/shmem: fix accounting of swapin-error markers
David Hildenbrand (Arm) <[email protected]>
mm/shmem: fix truncate loop after boundary swapin failure
David Hildenbrand (Arm) <[email protected]>
mm/shmem: preserve allocation errors when swapping in large entries
David Hildenbrand (Arm) <[email protected]>
mm/shmem: fix truncate hang in large swap entry
David Hildenbrand (Arm) <[email protected]>
mm/shmem: rescan after nonuniform folio splitting
David Hildenbrand (Arm) <[email protected]>
mm/shmem: discard whole new large folios on fallocate rollback
Chris Mason <[email protected]>
mm/shmem: preserve data in clean folios when splitting fails
Chris Mason <[email protected]>
mm/shmem: stop retrying folios that cannot be split
Josef Bacik <[email protected]>
tmpfs: preserve explicitly disabled quota limits
Josef Bacik <[email protected]>
tmpfs: keep the quota soft limits of an unused id
Chris Mason <[email protected]>
mm/mempolicy: charge shared policy nodes
Ian Bridges <[email protected]>
ksmbd: let the owner read and change the DACL when no ACE names it
Ian Bridges <[email protected]>
ksmbd: grant a POSIX ACL group entry only to the group's members
Ian Bridges <[email protected]>
ksmbd: do not read past the DACL in the access denied debug message
Federico Musto <[email protected]>
net: atl1c: drop oversized RX frames instead of panicking
Mitul Golani <[email protected]>
drm/i915/display: Allow port sync on PTL
Vidya Srinivas <[email protected]>
drm/i915/display: Disable pipe joiner on WCL
Vidya Srinivas <[email protected]>
drm/i915/display: Single scaler per pipe on WCL
Lu Yao <[email protected]>
drm/i915/gem: Reset err for each fence entry
Werner Sembach <[email protected]>
drm/i915/display: Add quirk to force backlight type on some TUXEDO devices
Jouni Högander <[email protected]>
drm/i915/psr: Don't clip plane state destination rectangle
Jouni Högander <[email protected]>
drm/i915/psr: Fix SFF and CFF CTL register bit definitions
Jouni Högander <[email protected]>
drm/i915/psr: Disable linked plane sel fetch as well
Jouni Högander <[email protected]>
drm/i915/display: Add enabled pipe planes into state for selective fetch
Jouni Högander <[email protected]>
drm/i915/psr: Clear selective fetch area when duplicating plane state
Rosen Penev <[email protected]>
x86/csum: Relax the len and proto constraints in 32-bit csum_ipv6_magic()
Breno Leitao <[email protected]>
x86/bugs: Select the BHI mitigation based on the attack vector properly
Lee Jones <[email protected]>
ASoC: SOF: Intel: hda-sdw-bpt: Stop active DMA before closing BPT streams
Miguel Ojeda <[email protected]>
rust: cpufreq: fix undocumented_unsafe_blocks in PolicyCpu::from_cpu()
Jack Blessed Kimani <[email protected]>
ksmbd: fix NULL pointer dereference in session_user_name() and session_account_type()
Ian Bridges <[email protected]>
ksmbd: revert fsids on durable reconnect and replay failure
Ian Bridges <[email protected]>
ksmbd: enforce the read-only share flag when creating a stream
Ian Bridges <[email protected]>
ksmbd: require DELETE access for delete-on-close opens
Jamal Hadi Salim <[email protected]>
bpf: Fix skb_pull() BUG in __bpf_redirect_neigh()
YuanZhe Liu <[email protected]>
ALSA: hwdep: Serialize DSP load requests
YuanZhe Liu <[email protected]>
ALSA: usx2y: Initialize idle URBs before submitting streams
YuanZhe Liu <[email protected]>
ALSA: us122l: Fix NULL dereference at hwdep open and release
YuanZhe Liu <[email protected]>
ALSA: us122l: Add missing NULL check in usb_stream_hwdep_mmap()
Evanshenf <[email protected]>
drm/loongson: Handle buffer mapping failures when clearing a BO
Evanshenf <[email protected]>
drm/loongson: Fix double free on BO initialization failure
Evanshenf <[email protected]>
drm/loongson: Fix framebuffer selection in async cursor updates
Shao Mingyin <[email protected]>
scsi: target: tcmu: Fix divide-by-zero in data_pages_per_blk store
Yuanhe Shu <[email protected]>
scsi: target: Verify the iSCSI ISID is null-terminated
Yingjie Wang <[email protected]>
scsi: bsg: Report io_uring data copyback failures
Yingjie Wang <[email protected]>
scsi: bsg: Report synchronous data copyback failures
Yu Zhang <[email protected]>
ptp: fix use-after-free in extts_fifo_show() reading tsevqs unlocked
guolingxing <[email protected]>
btrfs: prevent deleting the wrong subvolume by ID
guolingxing <[email protected]>
btrfs: sysfs: restore NOFS context on early return in btrfs_sysfs_add_block_group_type()
Hengyu Liang <[email protected]>
btrfs: fix chattr failing on nodatasum files that have the compress flag
Masafumi Suzuki <[email protected]>
sctp: account for chunk padding in sctp_init_cause()
Lucas Tanure <[email protected]>
drm/vc4: hdmi: enable scrambling before the TMDS clock starts
Lucas Tanure <[email protected]>
drm/vc4: hdmi: always cancel the scrambling work synchronously
Dom Cobley <[email protected]>
drm/vc4: hdmi: power down the BCM2712 PHY when the output is disabled
Zhou Qiuyue <[email protected]>
ipv6: raw: fix use-after-free in rawv6_send_hdrinc()
Franck Baur <[email protected]>
net: jme: keep RX MAC clock enabled for WoL
Sven Eckelmann <[email protected]>
batman-adv: tt: don't drop local events queued during TVLV update
Sven Eckelmann <[email protected]>
batman-adv: tt: ignore ROAM flag of received ADD changes
Sven Eckelmann <[email protected]>
batman-adv: stop originator purge worker before freeing TT
Sven Eckelmann <[email protected]>
batman-adv: fix skb leak when hard_iface is being released
Sven Eckelmann <[email protected]>
batman-adv: dat: initialize orig_node of unfilled candidate slots
Sven Eckelmann <[email protected]>
batman-adv: tpmeter: fix u32 truncation of reported bytes
Kyle Zeng <[email protected]>
batman-adv: mcast: validate tracker padding before forwarding
Eric Biggers <[email protected]>
lib/crypto: mldsa: Add __must_check to mldsa_verify()
Eric Biggers <[email protected]>
lib/crypto: mldsa: Explicitly check that 'alg' is a valid value
Eric Biggers <[email protected]>
lib/crypto: mldsa: Check pk_len before doing pointer arithmetic
Chengfeng Ye <[email protected]>
batman-adv: Close OGM aggregation before transmission
Yuanfu Xie <[email protected]>
9p: don't decrement a server-owned zero nlink
Yehyeong Lee <[email protected]>
9p/xen: validate the response size from the backend
Yu Zhang <[email protected]>
scsi: target: Fix demo-mode dynamic ACL dev-entry UAF vs LUN teardown
Andrew Luebke <[email protected]>
scsi: aic79xx: Fix NULL pointer dereference in device reset
Imre Kaloz <[email protected]>
scsi: aic7xxx: Use default settings on the SGI O2 onboard controllers
Fourie Zhang <[email protected]>
xfrm4: use a full socket for local errors
Toke Høiland-Jørgensen <[email protected]>
wifi: mac80211: reinstate IEEE80211_TX_CTL_AMPDU flag in ieee80211_tx_prep_agg()
Eric Biggers <[email protected]>
lib/crypto: mips: Disable Octeon SHA code on little-endian kernels
Maíra Canal <[email protected]>
drm/vc4: Drop the BO reservations outside of job_lock
Maíra Canal <[email protected]>
drm/vc4: Publish the output fence outside of job_lock
Zijing Yin <[email protected]>
wifi: cfg80211: fix out-of-bounds read in valid_rule()
Alex Kazinsky <[email protected]>
wifi: rsi: Skip TX aggregation setup for non-QoS frames
Jason Perlow <[email protected]>
wifi: brcmfmac: map msgbuf RX packet IDs bidirectional
Weigang He <[email protected]>
wifi: mac80211: reload TDLS header pointer after skb_linearize()
Yili Zhang <[email protected]>
dma-buf: Fix IOVA offset when linking phys vecs to sgt
André Draszik <[email protected]>
drm/drm_crtc: fix race with dma_fence_signal() in ::get_driver_name()
André Draszik <[email protected]>
drm/drm_crtc: ensure dma_fence_ops remain valid during device unbind
Devin Wittmayer <[email protected]>
drm/panic: Fix kmsg screen hang on a long log line
Sabrina Dubroca <[email protected]>
xfrm: espintcp: reorder operations within espintcp_init_sk
Qihang <[email protected]>
xfrm: interface: validate the IP header on xmit
Hyungjung Joo <[email protected]>
net/9p/usbg: clear stale client pointer on close
Michael Grzeschik <[email protected]>
net/9p/usbg: remove bogus context initialization in alloc_requests
Michael Grzeschik <[email protected]>
net/9p/usbg: fix out_req buffer leak in disable_usb9pfs
Michael Grzeschik <[email protected]>
net/9p/usbg: call disable_usb9pfs() from usb9pfs_disable()
Michael Grzeschik <[email protected]>
net/9p/usbg: always reset completion when disconnecting
Michael Grzeschik <[email protected]>
net/9p/usbg: set client to Disconnected on usb9pfs_disable
Michael Grzeschik <[email protected]>
net/9p/usbg: also disable endpoints on p9_usbg_close
Yizhou Zhao <[email protected]>
net/9p/usbg: Fix use-after-free in disable_usb9pfs()
Zhao Zhang <[email protected]>
9p: fix caches_show() out-of-bounds write
Yifei Gao <[email protected]>
9p/xen: fix refcount leak in p9_xen_response() on wrong tag
Michael Bommarito <[email protected]>
9p/trans_virtio: reject mount tags longer than NAME_MAX at probe
Chengfeng Ye <[email protected]>
net/9p/usbg: clear stale request context after abort
Chengfeng Ye <[email protected]>
xfrm: retry inexact policy lookup after node reinsertion
Yizhou Zhao <[email protected]>
net/9p/usbg: fix prefix matching in device lookup
Stefano Garzarella <[email protected]>
9p: fix privport option setting wrong RDMA field
SJ Park <[email protected]>
mm/damon/sysfs-schemes: read sysfs_filter->sz_range only once
Ricardo Ribalda <[email protected]>
media: uvcvideo: Force UVC version for Avermedia GC515
Ricardo Ribalda <[email protected]>
media: uvcvideo: Add autosuspend quirk for AVerMedia Live Gamer HD 2
Christian Loehle <[email protected]>
cpufreq: CPPC: Select the frequency-invariance callback per CPU
Jeff Layton <[email protected]>
nfsd: shorten extack string returned with dodgy listener
Darrick J. Wong <[email protected]>
xfs: forcibly reset quota timers when upgrading to bigtime during repair
Darrick J. Wong <[email protected]>
xfs: reinitialize dquot block if non-first dquot can't load
Christian Loehle <[email protected]>
ACPI: CPPC: Accept requests to retain immutable autonomous selection
Christian Loehle <[email protected]>
ACPI: CPPC: Validate FFH register fields before hardware access
Ping-Ke Shih <[email protected]>
wifi: rtw88: TX report with long timeout for non-PCIE devices
Andrew Morton <[email protected]>
block: restore the iterator when rejecting a misaligned bio
SJ Park <[email protected]>
mm/damon/core: remove unreachable damos charge_{target,addr}_from
Yuansheng Yang <[email protected]>
io_uring/rsrc: hold uring_lock across index-alloc put_user
Jens Axboe <[email protected]>
io_uring/poll: don't poll a writer for urgent data
Jens Axboe <[email protected]>
io_uring/poll: don't poll a writer for a read side hangup
Shang En Sim <[email protected]>
io_uring/poll: cancel all matching requests in one pass
Shang En Sim <[email protected]>
io_uring/cancel: count all requests that a CANCEL_ALL cancels
Shakeel Butt <[email protected]>
io_uring/sqpoll: do the return-to-userspace work in the SQPOLL thread
Shuai Liu <[email protected]>
io_uring/sqpoll: don't set IO_SQ_THREAD_SHOULD_STOP on thread exit
Jens Axboe <[email protected]>
io_uring/sqpoll: don't attach to a thread that is canceling
Chris Mason <[email protected]>
io_uring/cancel: drop sqd->lock while SQPOLL waits
Janne Grunau <[email protected]>
wifi: brcmfmac: cfg80211: Report port_authorized for 4-way HS offload
Gael Blivet <[email protected]>
ksmbd: look up stream size by exact xattr name
Chuck Lever <[email protected]>
NFSD: Complete a cld upcall when copying its reply fails
Chuck Lever <[email protected]>
NFSD: Complete a cld upcall when the daemon closes the pipe
Chuck Lever <[email protected]>
NFSD: Move the cld upcall message out of the caller's stack frame
Chuck Lever <[email protected]>
NFSD: Send a meaningful CB_RECALL_ANY keep count
Jeff Layton <[email protected]>
NFSD: stop registering with rpcbind after a failure in listener_set
Jeff Layton <[email protected]>
SUNRPC: report local rpcbind calls that get no answer
Jeff Layton <[email protected]>
NFSD: report listener creation failures through extack
Chuck Lever <[email protected]>
NFSD: map fh_verify() status codes for NFS_ACLv2 replies
Chuck Lever <[email protected]>
NFSD: Move version-specific ACCESS maps into per-version code
Chuck Lever <[email protected]>
NFSD: Replace nfsd_write()'s "stable" argument with "iocb_flags"
Darrick J. Wong <[email protected]>
xfs: improve dirent bounds checking in scrub and repair
Darrick J. Wong <[email protected]>
xfs: refactor directory data block walking loops in scrub
Darrick J. Wong <[email protected]>
xfs: check for buffer overruns when examining local/remote xattr entries
Darrick J. Wong <[email protected]>
xfs: break out xattr entry checks into separate functions
Weiming Shi <[email protected]>
smb/server: prevent file publication after tree disconnect
Jinwang Li <[email protected]>
Bluetooth: L2CAP: Ignore connection responses with wrong ident
Siwei Zhang <[email protected]>
Bluetooth: L2CAP: Only accept connection responses to outstanding requests
Siwei Zhang <[email protected]>
Bluetooth: L2CAP: Reject signalling responses in invalid states
Ashok Raj <[email protected]>
cxl/features: Ensure that count is set before access to ent[] __counted_by()
-------------
Diffstat:
Documentation/ABI/testing/sysfs-fs-f2fs | 2 +- Documentation/admin-guide/pm/intel_idle.rst | 12 +- Documentation/arch/arm64/silicon-errata.rst | 3 +- Documentation/filesystems/overlayfs.rst | 3 +- Documentation/filesystems/resctrl.rst | 87 ++++--- Documentation/hwmon/asus_rog_ryujin.rst | 6 + Documentation/mm/process_addrs.rst | 14 +- Documentation/mm/vmemmap_dedup.rst | 15 +- Makefile | 4 +- arch/arm64/include/asm/sdei.h | 3 +- arch/arm64/include/asm/suspend.h | 2 +- arch/arm64/kernel/entry-common.c | 40 ++- arch/arm64/kernel/machine_kexec_file.c | 2 + arch/arm64/kernel/sdei.c | 59 ++++- arch/arm64/kernel/topology.c | 12 +- arch/arm64/kvm/mmu.c | 129 +++++----- arch/arm64/kvm/pkvm.c | 3 + arch/arm64/kvm/vgic/vgic-mmio-v3.c | 10 + arch/arm64/mm/mmap.c | 4 +- arch/arm64/mm/proc.S | 8 + arch/mips/mm/cex-gen.S | 16 ++ arch/mips/pci/ops-mace.c | 26 +- arch/mips/pci/pci-ip32.c | 9 +- arch/mips/sgi-ip32/ip32-irq.c | 45 +--- arch/openrisc/kernel/or32_ksyms.c | 1 + arch/x86/boot/startup/sme.c | 2 +- arch/x86/entry/syscall_32.c | 4 + arch/x86/entry/syscall_64.c | 26 +- arch/x86/include/asm/checksum_32.h | 2 +- arch/x86/include/asm/vmware.h | 24 +- arch/x86/kernel/acpi/cppc.c | 15 ++ arch/x86/kernel/cpu/bugs.c | 12 +- arch/x86/kernel/cpu/resctrl/internal.h | 4 +- arch/x86/kernel/cpu/resctrl/monitor.c | 4 +- arch/x86/kernel/nmi.c | 8 + arch/x86/kernel/x86_init.c | 2 +- arch/x86/kvm/mmu/mmu.c | 10 + arch/x86/kvm/mmu/paging_tmpl.h | 11 +- arch/x86/kvm/vmx/nested.c | 1 + arch/x86/kvm/x86.c | 33 ++- arch/x86/mm/tlb.c | 16 +- block/bio.c | 3 + block/blk-iocost.c | 3 + block/blk-mq.c | 17 +- block/elevator.c | 32 +-- block/ioctl.c | 4 +- drivers/acpi/battery.c | 12 +- drivers/acpi/cppc_acpi.c | 61 ++++- drivers/acpi/utils.c | 41 +++ drivers/ata/libata-pmp.c | 14 ++ drivers/ata/libata-scsi.c | 25 ++ drivers/block/ublk_drv.c | 1 + drivers/block/virtio_blk.c | 2 +- drivers/bluetooth/btqca.c | 3 +- drivers/char/hw_random/virtio-rng.c | 7 + drivers/clk/nuvoton/clk-ma35d1.c | 7 +- drivers/cpufreq/amd-pstate.c | 25 +- drivers/cpufreq/cppc_cpufreq.c | 26 +- drivers/cxl/core/features.c | 2 +- drivers/dma-buf/dma-buf-mapping.c | 2 +- drivers/dma/qcom/bam_dma.c | 10 +- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 17 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 21 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 41 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 44 +++- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 5 + drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 19 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 16 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 1 - drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 5 +- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 5 +- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 5 +- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 2 + drivers/gpu/drm/amd/amdgpu/ih_v6_0.c | 13 +- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 4 +- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 4 +- drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 41 ++- .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 3 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c | 27 +- .../amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c | 3 + drivers/gpu/drm/amd/display/dc/core/dc.c | 6 +- .../gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 31 +++ drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h | 3 + .../display/dc/link/protocols/link_dp_capability.c | 6 +- .../gpu/drm/amd/display/dc/optc/dcn20/dcn20_optc.c | 7 + .../gpu/drm/amd/display/dc/optc/dcn30/dcn30_optc.h | 18 ++ .../gpu/drm/amd/display/dc/optc/dcn31/dcn31_optc.h | 22 +- .../drm/amd/display/dc/optc/dcn314/dcn314_optc.h | 18 ++ .../gpu/drm/amd/display/dc/optc/dcn32/dcn32_optc.h | 11 + .../gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.h | 11 - .../drm/amd/display/dc/optc/dcn401/dcn401_optc.h | 12 + .../gpu/drm/amd/display/dc/optc/dcn42/dcn42_optc.h | 2 + .../gpu/drm/amd/display/dc/optc/dcn60/dcn60_optc.h | 2 + .../amd/display/dc/resource/dcn32/dcn32_resource.c | 15 +- .../amd/display/dc/resource/dcn32/dcn32_resource.h | 6 + .../display/dc/resource/dcn401/dcn401_resource.h | 6 + .../drm/amd/display/modules/freesync/freesync.c | 6 +- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 20 ++ drivers/gpu/drm/bridge/nwl-dsi.c | 17 +- drivers/gpu/drm/display/drm_dp_helper.c | 3 +- drivers/gpu/drm/drm_crtc.c | 18 +- drivers/gpu/drm/drm_panic.c | 7 +- drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 40 ++- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 6 +- drivers/gpu/drm/i915/display/intel_ddi.c | 2 +- .../gpu/drm/i915/display/intel_display_device.c | 5 +- drivers/gpu/drm/i915/display/intel_dp.c | 4 +- .../gpu/drm/i915/display/intel_dp_aux_backlight.c | 22 +- drivers/gpu/drm/i915/display/intel_plane.c | 11 + drivers/gpu/drm/i915/display/intel_psr.c | 96 ++++---- drivers/gpu/drm/i915/display/intel_psr_regs.h | 4 +- drivers/gpu/drm/i915/display/intel_quirks.c | 24 ++ drivers/gpu/drm/i915/display/intel_quirks.h | 1 + drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- drivers/gpu/drm/loongson/lsdc_gem.c | 14 +- drivers/gpu/drm/loongson/lsdc_plane.c | 2 +- drivers/gpu/drm/loongson/lsdc_ttm.c | 14 +- drivers/gpu/drm/loongson/lsdc_ttm.h | 2 +- drivers/gpu/drm/nouveau/nvkm/core/subdev.c | 1 + .../gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c | 20 ++ drivers/gpu/drm/scheduler/sched_entity.c | 29 ++- drivers/gpu/drm/v3d/v3d_gem.c | 5 +- drivers/gpu/drm/v3d/v3d_sched.c | 2 + drivers/gpu/drm/vc4/vc4_gem.c | 14 +- drivers/gpu/drm/vc4/vc4_hdmi.c | 10 +- drivers/gpu/drm/vc4/vc4_hdmi_phy.c | 5 + drivers/hwmon/aquacomputer_d5next.c | 58 ++++- drivers/hwmon/asus_rog_ryujin.c | 54 +++- drivers/hwmon/asus_wmi_sensors.c | 13 +- drivers/hwmon/chipcap2.c | 196 ++++++++++----- drivers/hwmon/coretemp.c | 13 +- drivers/hwmon/corsair-cpro.c | 3 +- drivers/hwmon/gpd-fan.c | 1 + drivers/hwmon/gpio-fan.c | 7 +- drivers/hwmon/hp-wmi-sensors.c | 29 ++- drivers/hwmon/lm75.c | 9 +- drivers/hwmon/lm87.c | 7 +- drivers/hwmon/nct6683.c | 4 +- drivers/hwmon/peci/dimmtemp.c | 21 +- drivers/hwmon/pmbus/pmbus_core.c | 51 ++-- drivers/hwmon/pmbus/q54sj108a2.c | 2 + drivers/hwmon/sht15.c | 22 +- drivers/hwmon/sht4x.c | 4 +- drivers/hwmon/tmp108.c | 26 +- drivers/idle/intel_idle.c | 11 +- drivers/iommu/amd/init.c | 41 ++- drivers/iommu/amd/iommu.c | 17 +- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 7 + drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 91 +++++-- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 5 + drivers/iommu/iommufd/io_pagetable.c | 2 +- drivers/iommu/iommufd/iova_bitmap.c | 19 +- drivers/iommu/virtio-iommu.c | 6 +- drivers/media/pci/intel/ipu6/ipu6-fw-isys.c | 88 ++++--- drivers/media/pci/intel/ipu6/ipu6-isys-video.c | 4 +- drivers/media/pci/intel/ipu6/ipu6-isys.c | 6 +- drivers/media/pci/intel/ipu6/ipu6-isys.h | 5 +- .../media/platform/microchip/microchip-isc-base.c | 20 +- .../media/platform/microchip/microchip-isc-regs.h | 16 +- drivers/media/platform/microchip/microchip-isc.h | 4 +- .../platform/microchip/microchip-sama5d2-isc.c | 20 +- .../platform/microchip/microchip-sama7g5-isc.c | 20 +- drivers/media/usb/uvc/uvc_driver.c | 20 ++ drivers/mtd/spi-nor/macronix.c | 2 + drivers/net/can/dev/netlink.c | 4 +- drivers/net/can/dev/skb.c | 10 +- drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 7 +- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 33 +++ drivers/net/ethernet/jme.c | 37 ++- drivers/net/ethernet/jme.h | 1 + drivers/net/ethernet/ti/am65-cpsw-nuss.c | 4 +- drivers/net/veth.c | 5 +- drivers/net/vxlan/vxlan_core.c | 14 +- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 7 + .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 +- drivers/net/wireless/realtek/rtw88/mac80211.c | 2 + drivers/net/wireless/realtek/rtw88/reg.h | 2 + drivers/net/wireless/realtek/rtw88/tx.c | 9 +- drivers/net/wireless/realtek/rtw88/tx.h | 3 +- drivers/net/wireless/realtek/rtw88/usb.c | 68 ++++- drivers/net/wireless/realtek/rtw88/usb.h | 5 + drivers/net/wireless/rsi/rsi_91x_core.c | 2 +- drivers/nvme/common/keyring.c | 1 + drivers/nvme/host/core.c | 21 +- drivers/nvme/host/multipath.c | 2 - drivers/nvme/host/pci.c | 2 + drivers/nvme/host/pr.c | 8 +- drivers/nvme/host/rdma.c | 7 +- drivers/nvme/host/tcp.c | 213 +++++++++++++--- drivers/nvme/target/admin-cmd.c | 16 +- drivers/nvme/target/configfs.c | 4 +- drivers/nvme/target/core.c | 8 +- drivers/nvme/target/nvmet.h | 8 + drivers/pci/controller/cadence/pcie-cadence-plat.c | 33 +-- drivers/pci/controller/cadence/pcie-cadence.c | 16 +- drivers/pci/controller/cadence/pcie-cadence.h | 2 - drivers/pci/controller/dwc/pcie-designware.c | 2 + drivers/pci/controller/dwc/pcie-designware.h | 1 + drivers/platform/chrome/cros_ec_ishtp.c | 2 +- drivers/platform/chrome/cros_usbpd_notify.c | 41 +-- drivers/ptp/ptp_sysfs.c | 6 +- drivers/scsi/aic7xxx/aic79xx_core.c | 4 +- drivers/scsi/aic7xxx/aic79xx_osm.h | 26 +- drivers/scsi/aic7xxx/aic7xxx_core.c | 8 +- drivers/scsi/aic7xxx/aic7xxx_pci.c | 20 +- drivers/scsi/scsi_bsg.c | 8 +- drivers/target/target_core_device.c | 18 +- drivers/target/target_core_fabric_lib.c | 10 + drivers/target/target_core_tpg.c | 10 +- drivers/target/target_core_user.c | 5 + .../intel/int340x_thermal/int3403_thermal.c | 3 +- .../intel/int340x_thermal/int340x_thermal_zone.c | 6 +- .../int340x_thermal/processor_thermal_device.c | 2 +- drivers/vdpa/solidrun/snet_ctrl.c | 3 +- drivers/vdpa/vdpa_user/iova_domain.c | 11 +- drivers/vhost/scsi.c | 7 +- drivers/vhost/vdpa.c | 8 +- drivers/vhost/vhost.c | 3 +- drivers/vhost/vringh.c | 27 +- drivers/vhost/vsock.c | 34 ++- fs/9p/v9fs.c | 18 +- fs/9p/vfs_inode.c | 8 + fs/btrfs/ioctl.c | 24 ++ fs/btrfs/sysfs.c | 1 + fs/ceph/addr.c | 6 + fs/erofs/fileio.c | 18 +- fs/ext2/file.c | 3 +- fs/ext2/inode.c | 13 +- fs/f2fs/checkpoint.c | 13 +- fs/f2fs/data.c | 28 ++- fs/f2fs/f2fs.h | 10 +- fs/f2fs/gc.c | 11 +- fs/f2fs/node.c | 75 +++++- fs/f2fs/segment.c | 3 +- fs/f2fs/super.c | 24 ++ fs/f2fs/sysfs.c | 2 + fs/fat/inode.c | 2 + fs/nfsd/nfs2acl.c | 64 ++++- fs/nfsd/nfs3proc.c | 58 ++++- fs/nfsd/nfs3xdr.c | 2 + fs/nfsd/nfs4proc.c | 60 ++++- fs/nfsd/nfs4recover.c | 49 +++- fs/nfsd/nfs4state.c | 24 +- fs/nfsd/nfs4xdr.c | 2 +- fs/nfsd/nfsctl.c | 56 ++++- fs/nfsd/nfsproc.c | 2 +- fs/nfsd/state.h | 2 + fs/nfsd/vfs.c | 108 ++------ fs/nfsd/vfs.h | 21 +- fs/nfsd/xdr3.h | 2 +- fs/notify/inotify/inotify_fsnotify.c | 2 +- fs/ntfs/ea.c | 5 + fs/ntfs3/xattr.c | 25 +- fs/ocfs2/cluster/tcp.c | 5 +- fs/ocfs2/dcache.h | 5 +- fs/ocfs2/dlm/dlmmaster.c | 70 +++++- fs/ocfs2/dlmglue.c | 34 +-- fs/ocfs2/filecheck.c | 2 + fs/ocfs2/journal.c | 15 +- fs/ocfs2/journal.h | 1 + fs/ocfs2/move_extents.c | 70 +++--- fs/ocfs2/super.c | 3 + fs/ocfs2/xattr.c | 120 ++++++++- fs/open.c | 1 + fs/overlayfs/dir.c | 46 ++-- fs/overlayfs/export.c | 4 +- fs/overlayfs/inode.c | 8 + fs/overlayfs/namei.c | 13 +- fs/overlayfs/overlayfs.h | 21 +- fs/overlayfs/readdir.c | 6 +- fs/overlayfs/super.c | 12 +- fs/overlayfs/util.c | 13 +- fs/proc/task_mmu.c | 2 +- fs/smb/server/mgmt/user_session.c | 4 + fs/smb/server/smb2pdu.c | 65 +++-- fs/smb/server/smbacl.c | 43 +++- fs/smb/server/vfs.c | 4 +- fs/smb/server/vfs.h | 2 + fs/smb/server/vfs_cache.c | 58 +++-- fs/udf/balloc.c | 11 +- fs/udf/super.c | 80 +++++- fs/udf/truncate.c | 7 +- fs/xfs/libxfs/xfs_attr_leaf.c | 9 +- fs/xfs/libxfs/xfs_bmap.c | 14 +- fs/xfs/libxfs/xfs_bmap.h | 10 +- fs/xfs/libxfs/xfs_btree.c | 4 +- fs/xfs/scrub/attr.c | 102 ++++++-- fs/xfs/scrub/attr_repair.c | 18 +- fs/xfs/scrub/dir.c | 110 ++++++++- fs/xfs/scrub/dir_repair.c | 100 ++++++-- fs/xfs/scrub/quota_repair.c | 33 ++- fs/xfs/xfs_discard.c | 26 +- fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_healthmon.c | 2 +- fs/xfs/xfs_ioctl32.c | 4 +- fs/xfs/xfs_ioend.c | 2 +- fs/xfs/xfs_iomap.c | 28 ++- fs/xfs/xfs_iomap.h | 3 +- fs/xfs/xfs_pnfs.c | 60 +++-- include/acpi/acpi_bus.h | 7 + include/acpi/cppc_acpi.h | 6 + include/asm-generic/tlb.h | 3 +- include/crypto/mldsa.h | 6 +- include/dt-bindings/clock/nuvoton,ma35d1-clk.h | 3 +- include/linux/blkdev.h | 4 +- include/linux/can/can-ml.h | 3 + include/linux/can/dev.h | 2 +- include/linux/can/skb.h | 4 +- include/linux/damon.h | 10 + include/linux/huge_mm.h | 5 +- include/linux/hugetlb.h | 15 +- include/linux/ksm.h | 6 +- include/linux/memfd.h | 9 + include/linux/mm_types.h | 12 +- include/linux/mmap_lock.h | 39 ++- include/linux/mmu_notifier.h | 3 +- include/linux/mmzone.h | 2 + include/linux/nfs4.h | 6 + include/linux/shmem_fs.h | 15 +- include/linux/srcu.h | 36 +++ include/linux/sunrpc/clnt.h | 3 +- include/linux/sunrpc/svc.h | 7 +- include/linux/userfaultfd_k.h | 2 - include/net/espintcp.h | 5 +- include/net/inet_frag.h | 9 + include/net/netns/can.h | 2 +- include/net/sctp/sm.h | 1 + include/sound/cs35l56.h | 4 + include/sound/hwdep.h | 1 + include/uapi/linux/iommufd.h | 6 + io_uring/cancel.c | 26 +- io_uring/poll.c | 62 ++++- io_uring/rsrc.c | 21 +- io_uring/sqpoll.c | 26 +- kernel/events/core.c | 9 + kernel/fork.c | 20 +- kernel/panic.c | 2 +- kernel/sched/fair.c | 4 +- lib/base64.c | 3 + lib/crypto/Kconfig | 6 +- lib/crypto/mldsa.c | 15 +- lib/crypto/tests/mldsa_kunit.c | 9 + mm/cma.c | 14 +- mm/damon/core.c | 32 ++- mm/damon/sysfs-schemes.c | 8 +- mm/filemap.c | 84 +++---- mm/gup.c | 68 +++-- mm/huge_memory.c | 146 ++++++++--- mm/hugetlb.c | 92 ++++--- mm/hugetlb_vmemmap.c | 8 +- mm/internal.h | 38 ++- mm/khugepaged.c | 75 ++++-- mm/ksm.c | 66 +++-- mm/madvise.c | 9 + mm/memcontrol.c | 5 + mm/memfd.c | 2 + mm/memory-tiers.c | 29 +-- mm/memory.c | 133 ++++++---- mm/mempolicy.c | 4 +- mm/migrate.c | 5 +- mm/mm_init.c | 2 - mm/mmap.c | 8 +- mm/mmap_lock.c | 124 +++++++++- mm/mmu_notifier.c | 24 +- mm/mremap.c | 103 ++++---- mm/nommu.c | 2 +- mm/page-writeback.c | 8 +- mm/page_alloc.c | 30 ++- mm/page_alloc.h | 14 +- mm/rmap.c | 23 +- mm/shmem.c | 141 +++++++---- mm/shmem_quota.c | 28 ++- mm/swapfile.c | 7 +- mm/truncate.c | 13 +- mm/userfaultfd.c | 63 ++--- mm/util.c | 13 + mm/vma.c | 54 ++-- mm/vma_init.c | 3 + mm/vmscan.c | 29 ++- net/9p/trans_usbg.c | 91 +++++-- net/9p/trans_virtio.c | 5 + net/9p/trans_xen.c | 10 + net/batman-adv/bat_iv_ogm.c | 5 + net/batman-adv/distributed-arp-table.c | 1 + net/batman-adv/main.c | 12 +- net/batman-adv/multicast_forw.c | 5 +- net/batman-adv/tp_meter.c | 2 +- net/batman-adv/translation-table.c | 133 ++++++---- net/batman-adv/types.h | 8 +- net/bluetooth/hci_sync.c | 25 +- net/bluetooth/l2cap_core.c | 47 +++- net/can/af_can.c | 56 +++-- net/can/bcm.c | 50 ++-- net/can/gw.c | 7 +- net/can/isotp.c | 236 +++++++++++------- net/can/proc.c | 69 +++--- net/can/raw.c | 274 ++++++++++++--------- net/core/dev.c | 4 +- net/core/filter.c | 23 +- net/core/sock.c | 6 +- net/ipv4/cipso_ipv4.c | 9 +- net/ipv4/inet_connection_sock.c | 6 +- net/ipv4/inet_fragment.c | 5 + net/ipv4/inet_hashtables.c | 2 +- net/ipv4/inet_timewait_sock.c | 4 +- net/ipv4/syncookies.c | 2 +- net/ipv4/tcp_fastopen.c | 2 +- net/ipv4/xfrm4_output.c | 7 +- net/ipv6/addrconf.c | 3 +- net/ipv6/datagram.c | 4 + net/ipv6/inet6_hashtables.c | 2 +- net/ipv6/raw.c | 3 + net/l2tp/l2tp_core.c | 13 +- net/mac80211/tdls.c | 3 +- net/mac80211/tx.c | 2 + net/mptcp/pm_kernel.c | 1 + net/mptcp/subflow.c | 11 + net/qrtr/af_qrtr.c | 53 +++- net/sched/sch_generic.c | 41 ++- net/sched/sch_qfq.c | 3 + net/sched/sch_taprio.c | 5 + net/sctp/sm_make_chunk.c | 14 +- net/sctp/socket.c | 57 ++++- net/smc/smc_rx.c | 39 ++- net/sunrpc/rpcb_clnt.c | 22 +- net/sunrpc/svc.c | 42 +++- net/wireless/reg.c | 3 + net/xfrm/espintcp.c | 43 ++-- net/xfrm/xfrm_interface_core.c | 8 + net/xfrm/xfrm_policy.c | 11 +- rust/kernel/cpufreq.rs | 4 +- sound/core/hwdep.c | 2 + sound/core/ump_convert.c | 2 +- sound/hda/codecs/realtek/alc269.c | 45 +++- sound/hda/codecs/side-codecs/tas2781_hda.c | 27 +- sound/pci/cs46xx/dsp_spos.c | 2 + sound/pci/cs46xx/dsp_spos_scb_lib.c | 3 +- sound/soc/amd/yc/acp6x-mach.c | 7 + sound/soc/codecs/cs35l56-sdw.c | 27 +- sound/soc/codecs/cs35l56-shared.c | 38 +++ sound/soc/codecs/cs35l56.c | 17 ++ sound/soc/codecs/cs35l56.h | 1 + sound/soc/codecs/hdac_hda.c | 25 +- sound/soc/codecs/tas2770.c | 14 +- sound/soc/qcom/qdsp6/q6apm.c | 6 +- sound/soc/qcom/qdsp6/q6prm.c | 3 + sound/soc/sof/intel/hda-codec.c | 23 +- sound/soc/sof/intel/hda-sdw-bpt.c | 6 + sound/usb/bcd2000/bcd2000.c | 20 +- sound/usb/caiaq/input.c | 2 + sound/usb/line6/capture.c | 29 +++ sound/usb/midi.c | 64 +++-- sound/usb/qcom/qc_audio_offload.c | 7 + sound/usb/usx2y/us122l.c | 27 +- sound/usb/usx2y/usX2Yhwdep.c | 5 + sound/usb/usx2y/usb_stream.c | 9 +- sound/usb/usx2y/usbusx2yaudio.c | 43 +++- tools/perf/tests/tool_pmu.c | 79 ++++++ tools/perf/util/evsel.c | 30 ++- tools/perf/util/hwmon_pmu.c | 2 +- tools/perf/util/tool_pmu.c | 2 +- .../filesystems/fscontext_ns/fscontext_ns_test.c | 2 +- tools/testing/selftests/net/fib_nexthops.sh | 40 ++- tools/testing/vma/include/dup.h | 2 +- tools/testing/vma/shared.c | 8 +- 470 files changed, 7038 insertions(+), 2625 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/507 cxl/features: Ensure that count is set before access to ent[] __counted_by()
7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ashok Raj <[email protected]>
[ Upstream commit c1031c2474f73261d8d5e4deef2b5dc20fb964f5 ]
get_supported_features() assigns entries->num_features only after the memcpy() loop that fills entries->ent[] has already run. Since ent[] is __counted_by(num_features), the compiler's bounds instrumentation sees a 0-length array during that loop and FORTIFY_SOURCE trips on the memcpy. Set @num_features right after allocation, before any write into ent[], so the bound is correct for the whole lifetime of the array.
This was found via a fortify panic:
memcpy: detected buffer overflow: 384 byte write of buffer size 0
WARNING: lib/string_helpers.c:1035 at __fortify_report+0x54/0xa0 kernel BUG at lib/string_helpers.c:1043! Call trace: __fortify_panic+0x10/0x18 get_supported_features.isra.0+0x4a0/0x4d0 [cxl_core] devm_cxl_setup_features+0x84/0x120 [cxl_core] cxl_pci_probe+0x254/0x5e0 [cxl_pci]
Same class of bug, same fix shape as commit 6c9d2e87df40 ("cxl/fwctl: Fix __fortify_panic"), which fixed the analogous issue in cxlctl_get_supported_features() but missed this one.
[ dj: Fixed up title typo per Jonathan. ]
--- drivers/cxl/core/features.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/features.c +1 -1
@@ -97,6 +97,7 @@ get_supported_features(struct cxl_features_state *cxlfs)kvmalloc_flex (*entries, ent, count);if (!entries)return NULL ; + entries->num_features = count; struct cxl_mbox_get_sup_feats_out *mbox_out __free(kvfree) =kvmalloc (cxl_mbox->payload_size,GFP_KERNEL );
@@ -174,7 +175,6 @@ get_supported_features(struct cxl_features_state *cxlfs) start += num_entries; }while (remain_feats); - entries->num_features = count; entries->num_user_features = user_feats;return no_free_ptr (entries);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 3/507 Bluetooth: L2CAP: Only accept connection responses to outstanding requests
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siwei Zhang <[email protected]>
commit a518b9a9ef6ee3b18ecdf6ba5360c608aaf969e9 upstream.
Adjusted context as stable does not have the lockdep_assert_held() call and the __must_hold() context analysis annotations.
An outgoing channel waits in BT_CONNECT until security and the feature mask exchange complete, and only then sends its connection request. A peer can answer it before that with a connection response matching our source CID. The channel then moves to BT_CONFIG, completes configuration and becomes connected before security has completed. If security then fails, l2cap_security_cfm() leaves the connected channel alone, so it stays up on a link that did not reach the required security level.
A connection response with a zero source CID is matched by identifier. Another channel can hold the same identifier for a response it still has to send, so the lookup can pick the wrong channel.
Only accept a connection response while our request is outstanding, and only look at such channels when matching by identifier.
--- net/bluetooth/l2cap_core.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
net/bluetooth/l2cap_core.c +28 -3
@@ -158,6 +158,28 @@ static struct l2cap_chan *__l2cap_get_chan_by_ident(struct l2cap_conn *conn,return NULL ; } +/* Our connection request has been sent and is still outstanding */ +static bool l2cap_chan_connect_pending (struct l2cap_chan *chan) +{ +return chan->state ==BT_CONNECT && +test_bit (CONF_CONNECT_PEND , &chan->conf_state); +} + +/* Other channels may hold the same ident for a response they still have +* to send, so only look at channels waiting for a connection response. +*/ +static struct l2cap_chan *__l2cap_get_connect_chan_by_ident (struct l2cap_conn *conn, +u8 ident) +{ +struct l2cap_chan *c; + +list_for_each_entry (c, &conn->chan_l, list) { +if (c->ident == ident &&l2cap_chan_connect_pending (c)) +return c; + } +return NULL ; +} +static struct l2cap_chan *__l2cap_global_chan_by_addr (__le16 psm,bdaddr_t *src,u8 src_type) {
@@ -4298,7 +4320,7 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn,if (!chan)return -EBADSLT ; }else { - chan =__l2cap_get_chan_by_ident (conn, cmd->ident); + chan =__l2cap_get_connect_chan_by_ident (conn, cmd->ident);if (!chan)return -EBADSLT ; }
@@ -4311,8 +4333,11 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn,l2cap_chan_lock (chan); -/* Ignore a late response after the channel has left BT_CONNECT. */ -if (chan->state !=BT_CONNECT ) +/* Only accept a response to a connection request we sent and that +* is still outstanding. A channel waiting in BT_CONNECT for security +* or the feature mask has not sent one yet. +*/ +if (!l2cap_chan_connect_pending (chan)) goto done;switch (result) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2/507 Bluetooth: L2CAP: Reject signalling responses in invalid states
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siwei Zhang <[email protected]>
commit 6320736af7dcb90da6ee9fd651ecc11c564d45b7 upstream.
Adjusted context as stable does not have the lockdep_assert_held() calls, and l2cap_get_chan_by_scid() still returns the channel locked, so l2cap_config_rsp() does not lock it again.
A peer can send configuration messages while an incoming channel is in BT_CONNECT2, before the security or deferred accept gate has completed. A configuration response can then promote the channel to BT_CONNECTED. Configuration responses can also act on channels that are closing, and a late connection response can move a disconnecting channel back to BT_CONFIG.
Accept connection responses only while waiting inBT_CONNECT. Answer configuration requests inBT_CONNECT2, but defer our own request untilBT_CONFIG so configuration cannot complete before
the gate. Ignore configuration responses outsideBT_CONFIG and BT_CONNECTED, and only complete
configuration in BT_CONFIG.
--- net/bluetooth/l2cap_core.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +19 -1
@@ -4311,6 +4311,10 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn,l2cap_chan_lock (chan); +/* Ignore a late response after the channel has left BT_CONNECT. */ +if (chan->state !=BT_CONNECT ) + goto done; +switch (result) {case L2CAP_CR_SUCCESS :if (__l2cap_get_chan_by_dcid (conn, dcid)) {
@@ -4340,6 +4344,7 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn,break ; } +done:l2cap_chan_unlock (chan);l2cap_chan_put (chan);
@@ -4472,7 +4477,13 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, goto unlock; } -if (!test_and_set_bit (CONF_REQ_SENT , &chan->conf_state)) { +/* A channel in BT_CONNECT2 has not passed security or userspace +* accept yet. Answer the peer's request, but hold our own until +* the channel reaches BT_CONFIG: the CONNECT2 -> CONFIG sites send +* it. Connected channels may also need to reconfigure. +*/ +if ((chan->state ==BT_CONFIG || chan->state ==BT_CONNECTED ) && + !test_and_set_bit (CONF_REQ_SENT , &chan->conf_state)) {u8 buf[64 ];l2cap_send_cmd (conn,l2cap_get_ident (conn),L2CAP_CONF_REQ ,l2cap_build_conf_req (chan, buf,sizeof (buf)), buf);
@@ -4520,6 +4531,10 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn,if (!chan)return 0 ; +/* Connected channels may also receive reconfiguration responses. */ +if (chan->state !=BT_CONFIG && chan->state !=BT_CONNECTED ) + goto done; +switch (result) {case L2CAP_CONF_SUCCESS :l2cap_conf_rfc_get (chan, rsp->data, len);
@@ -4587,6 +4602,9 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn,if (test_bit (CONF_OUTPUT_DONE , &chan->conf_state)) {set_default_fcs (chan); +if (chan->state !=BT_CONFIG ) + goto done; +if (chan->mode ==L2CAP_MODE_ERTM || chan->mode ==L2CAP_MODE_STREAMING ) err =l2cap_ertm_init (chan);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 5/507 smb/server: prevent file publication after tree disconnect
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <[email protected]>
[ Upstream commit 2ff3730998b015b5b0a3f28330bee16c648dd114 ]
TREE_DISCONNECT closes the tree's published file handles before marking and removing the tree connection. A concurrent CREATE that already holds a tree reference can therefore publish its file after the close pass. When CREATE drops its reference, the tree can be freed while the published file still points to it.
Mark and remove the tree connection before closing its files, and serialize both new-open and durable-reconnect volatile ID publication with that state transition. An opener is then either published in time for the close pass or rejected after disconnect with STATUS_NETWORK_NAME_DELETED.
Keep a tree reference while a file carries its tree pointer. This protects asynchronous users that can defer the file's final destruction past tree disconnect.
The close pass can race the successful FP_NEW to FP_INITED transition. Take the opening request's file reference atomically with that transition. This keeps the file alive until request completion even if teardown removes the ID immediately.
BUG: KASAN: slab-use-after-free in proc_show_files (fs/smb/server/vfs_cache.c:126)
Read of size 4 at addr ff11000101540f80 by task poc/153
Call Trace:
proc_show_files (fs/smb/server/vfs_cache.c:126)
seq_read_iter (fs/seq_file.c:231)
proc_reg_read_iter (fs/proc/inode.c:299)
vfs_read (fs/read_write.c:574)
ksys_read (fs/read_write.c:716)
do_syscall_64 (arch/x86/entry/syscall_64.c:84)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)Allocated by:
ksmbd_tree_conn_connect (fs/smb/server/mgmt/tree_connect.c:35)
smb2_tree_connect (fs/smb/server/smb2pdu.c:2819)
handle_ksmbd_work (fs/smb/server/server.c:368)Freed by:
kfree (mm/slub.c:6801)
handle_ksmbd_work (fs/smb/server/server.c:332)--- fs/smb/server/smb2pdu.c | 27 ++++++++++++++---- fs/smb/server/vfs_cache.c | 58 ++++++++++++++++++++++++++++----------- 2 files changed, 63 insertions(+), 22 deletions(-)
fs/smb/server/smb2pdu.c +21 -6
@@ -3097,9 +3097,10 @@ int smb2_tree_disconnect(struct ksmbd_work *work) goto err_out; } + err =ksmbd_tree_conn_disconnect (sess, tcon); +ksmbd_close_tree_conn_fds (work); - err =ksmbd_tree_conn_disconnect (sess, tcon);if (err) { rsp->hdr.Status =STATUS_NETWORK_NAME_DELETED ; goto err_out;
@@ -4439,8 +4440,12 @@ int smb2_open(struct ksmbd_work *work) goto err_out2; rc =ksmbd_reopen_durable_fd (work, dh_info.fp); -if (rc) +if (rc) { +if (rc == -ENOTCONN ) + rsp->hdr.Status = +STATUS_NETWORK_NAME_DELETED ; goto err_out2; + } fp = dh_info.fp;
@@ -4874,6 +4879,8 @@ int smb2_open(struct ksmbd_work *work)if (IS_ERR (fp)) {fput (filp); rc =PTR_ERR (fp); +if (rc == -ENOTCONN ) + rsp->hdr.Status =STATUS_NETWORK_NAME_DELETED ; fp =NULL ; goto err_out; }
@@ -5477,11 +5484,20 @@ int smb2_open(struct ksmbd_work *work) err_out2:if (!rc) { -if (!dh_info.replay) +if (!dh_info.replay) { +smb2_complete_request_open (work); rc =ksmbd_update_fstate (&work->sess->file_table, fp,FP_INITED ); -if (!rc) +if (rc == -ENOENT ) + rsp->hdr.Status =STATUS_NETWORK_NAME_DELETED ; +if (!rc) { + work->request_open = fp; + work->request_open_chseq = +smb3_hdr_channel_sequence (&req->hdr); + } + }else { rc =smb2_set_request_open (work, fp, &req->hdr, false, false); + }if (!rc) rc =ksmbd_iov_pin_rsp (work, (void *)rsp, iov_len); }
@@ -5496,8 +5512,7 @@ int smb2_open(struct ksmbd_work *work) rsp->hdr.Status =STATUS_PRIVILEGE_NOT_HELD ; else rsp->hdr.Status = STATUS_ACCESS_DENIED; - } -else if (rc == -ENOENT ) + }else if (rc == -ENOENT && !rsp->hdr.Status) rsp->hdr.Status =STATUS_OBJECT_NAME_INVALID ;else if (rc == -EPERM ) rsp->hdr.Status =STATUS_SHARING_VIOLATION ;
fs/smb/server/vfs_cache.c +42 -16
144 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 6/507 xfs: break out xattr entry checks into separate functions
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
[ Upstream commit 9eb04a6d41c7e474d4665118895c3c2d8e5a2741 ]
We're going to add more xattr entry checking code in xchk_xattr_entry so break these out into separate functions so that we don't go crazy indenting. There's a slight behavior change here where we skip updating the usedmap if we've decided the xattr structure is corrupt.
Stable-dep-of: 91c41f952490 ("xfs: check for buffer overruns when examining local/remote xattr entries")
--- fs/xfs/scrub/attr.c | 90 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 68 insertions(+), 22 deletions(-)
fs/xfs/scrub/attr.c +68 -22
@@ -293,6 +293,66 @@ xchk_xattr_set_map(return ret; } +static unsigned int +xchk_xattr_local_entry ( +struct xchk_da_btree *ds, +int level, +char *buf_end, +struct xfs_attr_leafblock *leaf, +int idx) +{ +struct xfs_attr_leaf_name_local *lentry = +xfs_attr3_leaf_name_local (leaf, idx); +char *name_end; +unsigned int namesize; + + namesize =xfs_attr_leaf_entsize_local (lentry->namelen, +be16_to_cpu (lentry->valuelen)); + name_end = (char *)lentry + namesize; +if (lentry->namelen ==0 ) { +xchk_da_set_corrupt (ds, level); +return 0 ; + } +if (name_end > buf_end) { +xchk_da_set_corrupt (ds, level); +return 0 ; + } + +return namesize; +} + +static unsigned int +xchk_xattr_remote_entry ( +struct xchk_da_btree *ds, +int level, +char *buf_end, +struct xfs_attr_leafblock *leaf, +int idx, +struct xfs_attr_leaf_entry *ent) +{ +struct xfs_attr_leaf_name_remote *rentry = +xfs_attr3_leaf_name_remote (leaf, idx); +char *name_end; +unsigned int namesize; + + namesize =xfs_attr_leaf_entsize_remote (rentry->namelen); + name_end = (char *)rentry + namesize; +if (rentry->namelen ==0 ) { +xchk_da_set_corrupt (ds, level); +return 0 ; + } +if (rentry->valueblk ==0 && !(ent->flags &XFS_ATTR_INCOMPLETE )) { +xchk_da_set_corrupt (ds, level); +return 0 ; + } +if (name_end > buf_end) { +xchk_da_set_corrupt (ds, level); +return 0 ; + } + +return namesize; +} +/* * Check this leaf entry's relations to everything else. * Returns the number of bytes used for the name/value data.
@@ -311,9 +371,6 @@ xchk_xattr_entry( {struct xfs_mount *mp = ds->state->mp;struct xchk_xattr_buf *ab = ds->sc->buf; -char *name_end; -struct xfs_attr_leaf_name_local *lentry; -struct xfs_attr_leaf_name_remote *rentry;unsigned int nameidx;unsigned int namesize;
@@ -333,25 +390,14 @@ xchk_xattr_entry( }/* Check the name information. */ -if (ent->flags &XFS_ATTR_LOCAL ) { - lentry =xfs_attr3_leaf_name_local (leaf, idx); - namesize =xfs_attr_leaf_entsize_local (lentry->namelen, -be16_to_cpu (lentry->valuelen)); - name_end = (char *)lentry + namesize; -if (lentry->namelen ==0 ) -xchk_da_set_corrupt (ds, level); - }else { - rentry =xfs_attr3_leaf_name_remote (leaf, idx); - namesize =xfs_attr_leaf_entsize_remote (rentry->namelen); - name_end = (char *)rentry + namesize; -if (rentry->namelen ==0 ) -xchk_da_set_corrupt (ds, level); -if (rentry->valueblk ==0 && - !(ent->flags &XFS_ATTR_INCOMPLETE )) -xchk_da_set_corrupt (ds, level); - } -if (name_end > buf_end) -xchk_da_set_corrupt (ds, level); +if (ent->flags &XFS_ATTR_LOCAL ) + namesize =xchk_xattr_local_entry (ds, level, buf_end, leaf, + idx); +else + namesize =xchk_xattr_remote_entry (ds, level, buf_end, leaf, + idx, ent); +if (!namesize) +return ;if (!xchk_xattr_set_map (ds->sc, ab->usedmap, nameidx, namesize))xchk_da_set_corrupt (ds, level);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 7/507 xfs: check for buffer overruns when examining local/remote xattr entries
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
[ Upstream commit 91c41f9524906a8ebd2ae68c98a07b4bd5255ddb ]
LOLLM noticed that the xattr scrub and repair code can walk off the end of the buffer if the xattr entry record starts so close to the end of the buffer that there's not even space for the entry structure itself. Strengthen the bounds checking here.
--- fs/xfs/scrub/attr.c | 12 ++++++++++++ fs/xfs/scrub/attr_repair.c | 16 +++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-)
fs/xfs/scrub/attr.c +12 -0
@@ -306,6 +306,12 @@ xchk_xattr_local_entry(char *name_end;unsigned int namesize; + name_end = (char *)lentry + offsetof(typeof(*lentry), nameval[0]); +if (name_end > buf_end) { +xchk_da_set_corrupt (ds, level); +return 0 ; + } + namesize =xfs_attr_leaf_entsize_local (lentry->namelen,be16_to_cpu (lentry->valuelen)); name_end = (char *)lentry + namesize;
@@ -335,6 +341,12 @@ xchk_xattr_remote_entry(char *name_end;unsigned int namesize; + name_end = (char *)rentry + offsetof(typeof(*rentry), name[0]); +if (name_end > buf_end) { +xchk_da_set_corrupt (ds, level); +return 0 ; + } + namesize =xfs_attr_leaf_entsize_remote (rentry->namelen); name_end = (char *)rentry + namesize;if (rentry->namelen ==0 ) {
fs/xfs/scrub/attr_repair.c +13 -3
@@ -285,6 +285,7 @@ xrep_xattr_salvage_local_attr( struct xfs_attr_leaf_name_local *lentry) {struct xchk_xattr_buf *ab = rx->sc->buf; +char *name_end;unsigned char *value;unsigned int valuelen;unsigned int namesize;
@@ -293,10 +294,14 @@ xrep_xattr_salvage_local_attr(* Decode the leaf local entry format. If something seems wrong, we * junk the attribute. */ + name_end = (char *)lentry + offsetof(typeof(*lentry), nameval[0]); +if (name_end > buf_end) +return 0 ; value = &lentry->nameval[lentry->namelen]; valuelen =be16_to_cpu (lentry->valuelen); namesize =xfs_attr_leaf_entsize_local (lentry->namelen, valuelen); -if ((char *)lentry + namesize > buf_end) + name_end = (char *)lentry + namesize; +if (name_end > buf_end)return 0 ;if (!xrep_xattr_want_salvage (rx, ent->flags, lentry->nameval, lentry->namelen, value, valuelen))
@@ -333,8 +338,8 @@ xrep_xattr_salvage_remote_attr( .attr_filter = ent->flags & XFS_ATTR_NSP_ONDISK_MASK, .namelen = rentry->namelen, .name = rentry->name, - .valuelen = be32_to_cpu(rentry->valuelen), }; +char *name_end;unsigned int namesize;int error;
@@ -343,9 +348,14 @@ xrep_xattr_salvage_remote_attr(* junk the attribute. Note that we should never find a zero-length * remote attribute value. */ + name_end = (char *)rentry + offsetof(typeof(*rentry), name[0]); +if (name_end > buf_end) +return 0 ; namesize =xfs_attr_leaf_entsize_remote (rentry->namelen); -if ((char *)rentry + namesize > buf_end) + name_end = (char *)rentry + namesize; +if (name_end > buf_end)return 0 ; + args.valuelen =be32_to_cpu (rentry->valuelen);if (args.valuelen ==0 || !xrep_xattr_want_salvage (rx, ent->flags, rentry->name, rentry->namelen,NULL , args.valuelen))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 4/507 Bluetooth: L2CAP: Ignore connection responses with wrong ident
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinwang Li <[email protected]>
commit a9f9eeb5344fc7dc625e5700ccf09891bc2603b5 upstream.
Adjusted context as stable does not have the lockdep_assert_held() call in l2cap_connect_create_rsp().
L2CAP/COS/CED/BI-28-C requires the IUT to ignore a Connection Response that carries an invalid Identifier.
l2cap_connect_create_rsp() only checks that a connection request is outstanding, not that the response answers it. Add an ident check against the pending request so that a mismatched response is dropped.
--- net/bluetooth/l2cap_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/bluetooth/l2cap_core.c +4 -4
@@ -4333,11 +4333,11 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn,l2cap_chan_lock (chan); -/* Only accept a response to a connection request we sent and that -* is still outstanding. A channel waiting in BT_CONNECT for security -* or the feature mask has not sent one yet. +/* Only accept a response matching a connection request we sent and +* that is still outstanding. A channel waiting in BT_CONNECT for +* security or the feature mask has not sent one yet. */ -if (!l2cap_chan_connect_pending (chan)) +if (!l2cap_chan_connect_pending (chan) || chan->ident != cmd->ident) goto done;switch (result) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 8/507 xfs: refactor directory data block walking loops in scrub
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
[ Upstream commit 19b5653cc870788df71e7fcf2dd7b6131d8868dc ]
Hoist the inner loop code of the directory data block walking code in the directory scrub and repair code to separate functions in preparation for strengthening the validation in a subsequent patch.
Stable-dep-of: 5d470234d04d ("xfs: improve dirent bounds checking in scrub and repair")
--- fs/xfs/scrub/dir.c | 56 ++++++++++++++++++++++++++---- fs/xfs/scrub/dir_repair.c | 73 ++++++++++++++++++++++++++++----------- 2 files changed, 102 insertions(+), 27 deletions(-)
fs/xfs/scrub/dir.c +49 -7
@@ -313,6 +313,45 @@ xchk_dir_actor(return error; } +/* +* Deal with an unused directory entry. Returns a positive number of bytes to +* advance in the directory block, zero to stop processing, or -1 if corruption +* was found. +*/ +static int +xchk_dir_check_unused ( +struct xchk_da_btree *ds, +struct xfs_buf *bp, +unsigned int iter_off, +unsigned int end) +{ +struct xfs_dir2_data_unused *dup = bp->b_addr + iter_off; + +return be16_to_cpu (dup->length); +} + +/* +* Check a directory entry. Returns a positive number of bytes to advance +* in the directory block, zero to stop processing, or -1 if corruption was +* found. +*/ +static int +xchk_dir_check_entry ( +struct xchk_da_btree *ds, +struct xfs_buf *bp, +unsigned int iter_off, +unsigned int end, +struct xfs_dir2_data_entry *dent) +{ +struct xfs_dir2_data_entry *dep = bp->b_addr + iter_off; +struct xfs_mount *mp = ds->state->mp; + +if (dep == dent) +return 0 ; + +return xfs_dir2_data_entsize (mp, dep->namelen); +} +/* Scrub a directory btree record. */ STATIC int xchk_dir_rec(
@@ -389,21 +428,24 @@ xchk_dir_rec( goto out_relse; }for (;;) { -struct xfs_dir2_data_entry *dep = bp->b_addr + iter_off;struct xfs_dir2_data_unused *dup = bp->b_addr + iter_off; +int advance;if (iter_off >= end) {xchk_fblock_set_corrupt (ds->sc,XFS_DATA_FORK , rec_bno); goto out_relse; } -if (be16_to_cpu (dup->freetag) ==XFS_DIR2_DATA_FREE_TAG ) { - iter_off +=be16_to_cpu (dup->length); -continue ; - } -if (dep == dent) +if (dup->freetag ==cpu_to_be16 (XFS_DIR2_DATA_FREE_TAG )) + advance =xchk_dir_check_unused (ds, bp, iter_off, end); +else + advance =xchk_dir_check_entry (ds, bp, iter_off, end, + dent); +if (advance <0 ) + goto out_relse; +if (!advance)break ; - iter_off +=xfs_dir2_data_entsize (mp, dep->namelen); + iter_off += advance; }/* Retrieve the entry, sanity check it, and compare hashes. */
fs/xfs/scrub/dir_repair.c +53 -20
92 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 10/507 NFSD: Replace nfsd_write()s "stable" argument with "iocb_flags"
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 7f7dde9a45dfd9b3c9f35cb24aff9e45669071cc ]
The current nfsd_write() API is not NFS version-agnostic, as it relies on callers to pass an NFSv3 stable_how value to determine the persistence of the requested WRITE. NFSv2 does not use a stable-how value on the wire, and NFSv4 has its own stable_how4 (though stable_how and stable_how4 happen to share the same numeric values).
To remove the dependence on NFSv3-specific XDR values from NFSD's generic VFS APIs, replace nfsd_write()'s stable argument with an argument that passes a set of IOCB flags instead of an XDR-defined value.
The NFSv4 WRITE and COPY paths had been borrowing the NFSv3 stable_how constants for their own on-the-wire stable values, relying on the numeric coincidence noted above. Convert those sites to the stable_how4 enumerators so the v4 code expresses its own protocol's values directly, with no change in behavior.
While here, bound-check the decoded NFSv3 WRITE stable value, as the NFSv4 WRITE decoder already does, and make the nfsd3_writeargs stable field unsigned to suit.
The larger benefit is one less NFSv4 dependency on nfs3.h.
Stable-dep-of: ccfc4db5ab74 ("NFSD: map fh_verify() status codes for NFS_ACLv2 replies")
--- fs/nfsd/nfs3proc.c | 17 ++++++++++++++++- fs/nfsd/nfs3xdr.c | 2 ++ fs/nfsd/nfs4proc.c | 18 ++++++++++++++++-- fs/nfsd/nfs4xdr.c | 2 +- fs/nfsd/nfsproc.c | 2 +- fs/nfsd/vfs.c | 30 ++++++++++-------------------- fs/nfsd/vfs.h | 6 ++++-- fs/nfsd/xdr3.h | 2 +- include/linux/nfs4.h | 6 ++++++ 9 files changed, 57 insertions(+), 28 deletions(-)
fs/nfsd/nfs3proc.c +16 -1
@@ -48,6 +48,20 @@ static bool nfsd3_time_in_range(const struct iattr *iap)return true; } +static int nfsd3_iocb_flags (enum nfs3_stable_how how) +{ +switch (how) { +case NFS_FILE_SYNC : +/* persist data and timestamps */ +return IOCB_DSYNC |IOCB_SYNC ; +case NFS_DATA_SYNC : +/* persist data only */ +return IOCB_DSYNC ; +default : +return 0 ; + } +} +static __be32 nfsd3_map_status (__be32 status) {switch (status) {
@@ -260,7 +274,8 @@ nfsd3_proc_write(struct svc_rqst *rqstp) resp->committed = argp->stable; resp->status =nfsd_write (rqstp, &resp->fh, argp->offset, &argp->payload, &cnt, - resp->committed, resp->verf); +nfsd3_iocb_flags (resp->committed), + resp->verf); resp->count = cnt; resp->status =nfsd3_map_status (resp->status);return rpc_success;
fs/nfsd/nfs3xdr.c +2 -0
@@ -556,6 +556,8 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)return false;if (xdr_stream_decode_u32 (xdr, &args->stable) <0 )return false; +if (args->stable >NFS_FILE_SYNC ) +return false;/* opaque data */ if (xdr_stream_decode_u32 (xdr, &args->len) <0 )
fs/nfsd/nfs4proc.c +16 -2
@@ -69,6 +69,20 @@ MODULE_PARM_DESC(nfsd4_ssc_umount_timeout,#define NFSDDBG_FACILITY NFSDDBG_PROC +static int nfsd4_iocb_flags (enum stable_how4 how) +{ +switch (how) { +case FILE_SYNC4 : +/* persist data and timestamps */ +return IOCB_DSYNC |IOCB_SYNC ; +case DATA_SYNC4 : +/* persist data only */ +return IOCB_DSYNC ; +default : +return 0 ; + } +} +static u32 nfsd_attrmask[] = {NFSD_WRITEABLE_ATTRS_WORD0 ,NFSD_WRITEABLE_ATTRS_WORD1 ,
@@ -1377,7 +1391,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, write->wr_how_written = write->wr_stable_how; status =nfsd_vfs_write (rqstp, &cstate->current_fh, nf, write->wr_offset, &write->wr_payload, - &cnt, write->wr_how_written, + &cnt,nfsd4_iocb_flags (write->wr_how_written), (__be32 *)write->wr_verifier.data);nfsd_file_put (nf);
@@ -1974,7 +1988,7 @@ static void nfsd4_init_copy_res(struct nfsd4_copy *copy, bool sync) { copy->cp_res.wr_stable_how =test_bit (NFSD4_COPY_F_COMMITTED , ©->cp_flags) ? -NFS_FILE_SYNC :NFS_UNSTABLE ; +FILE_SYNC4 :UNSTABLE4 ;nfsd4_copy_set_sync (copy, sync); }
fs/nfsd/nfs4xdr.c +1 -1
@@ -1606,7 +1606,7 @@ nfsd4_decode_write(struct nfsd4_compoundargs *argp, union nfsd4_op_u *u)return nfserr_bad_xdr;if (xdr_stream_decode_u32 (argp->xdr, &write->wr_stable_how) <0 )return nfserr_bad_xdr; -if (write->wr_stable_how >NFS_FILE_SYNC ) +if (write->wr_stable_how >FILE_SYNC4 )return nfserr_bad_xdr;if (xdr_stream_decode_u32 (argp->xdr, &write->wr_buflen) <0 )return nfserr_bad_xdr;
fs/nfsd/nfsproc.c +1 -1
@@ -280,7 +280,7 @@ nfsd_proc_write(struct svc_rqst *rqstp)fh_copy (&resp->fh, &argp->fh); resp->status =nfsd_write (rqstp, &resp->fh, argp->offset, - &argp->payload, &cnt,NFS_DATA_SYNC ,NULL ); + &argp->payload, &cnt,IOCB_DSYNC ,NULL );if (resp->status == nfs_ok) resp->status =fh_getattr (&resp->fh, &resp->stat);else if (resp->status == nfserr_jukebox)
fs/nfsd/vfs.c +10 -20
@@ -1424,7 +1424,7 @@ nfsd_direct_write(struct svc_rqst *rqstp, struct svc_fh *fhp,* @offset: Byte offset of start * @payload: xdr_buf containing the write payload * @cnt: IN: number of bytes to write, OUT: number of bytes actually written -* @stable: An NFS stable_how value +* @iocb_flags: VFS IOCB_* flags expressing the requested write stability * @verf: NFS WRITE verifier * * Upon return, caller must invoke fh_put on @fhp.
@@ -1436,7 +1436,7 @@ __be32 nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct nfsd_file *nf, loff_t offset, const struct xdr_buf *payload, unsigned long *cnt, - int stable, __be32 *verf) + int iocb_flags, __be32 *verf) { struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);struct file *file = nf->nf_file;
@@ -1473,21 +1473,11 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, exp = fhp->fh_export;if (!EX_ISSYNC (exp)) - stable =NFS_UNSTABLE ; + iocb_flags =0 ;init_sync_kiocb (&kiocb, file); kiocb.ki_pos = offset; -if (likely (!fhp->fh_use_wgather)) { -switch (stable) { -case NFS_FILE_SYNC : -/* persist data and timestamps */ - kiocb.ki_flags |=IOCB_DSYNC |IOCB_SYNC ; -break ; -case NFS_DATA_SYNC : -/* persist data only */ - kiocb.ki_flags |=IOCB_DSYNC ; -break ; - } - } +if (likely (!fhp->fh_use_wgather)) + kiocb.ki_flags |= iocb_flags; nvecs =xdr_buf_to_bvec (rqstp->rq_bvec, rqstp->rq_maxpages, payload);if (nvecs <0 ) {
@@ -1528,7 +1518,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, goto out_nfserr; } -if (stable && fhp->fh_use_wgather) { +if (iocb_flags && fhp->fh_use_wgather) { host_err =wait_for_concurrent_writes (file);if (host_err <0 )commit_reset_write_verifier (nn, rqstp, host_err);
@@ -1619,7 +1609,7 @@ __be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp,* @offset: Byte offset of start * @payload: xdr_buf containing the write payload * @cnt: IN: number of bytes to write, OUT: number of bytes actually written -* @stable: An NFS stable_how value +* @iocb_flags: VFS IOCB_* flags expressing the requested write stability * @verf: NFS WRITE verifier * * Upon return, caller must invoke fh_put on @fhp.
@@ -1629,8 +1619,8 @@ __be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp,*/ __be32 nfsd_write (struct svc_rqst *rqstp,struct svc_fh *fhp,loff_t offset, -const struct xdr_buf *payload,unsigned long *cnt,int stable, -__be32 *verf) +const struct xdr_buf *payload,unsigned long *cnt, +int iocb_flags,__be32 *verf) {struct nfsd_file *nf;__be32 err;
@@ -1642,7 +1632,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset, goto out; err =nfsd_vfs_write (rqstp, fhp, nf, offset, payload, cnt, - stable, verf); + iocb_flags, verf);nfsd_file_put (nf); out:trace_nfsd_write_done (rqstp, fhp, offset, *cnt);
fs/nfsd/vfs.h +4 -2
@@ -135,11 +135,13 @@ __be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *eof);__be32 nfsd_write (struct svc_rqst *rqstp,struct svc_fh *fhp,loff_t offset,const struct xdr_buf *payload, -unsigned long *cnt,int stable,__be32 *verf); +unsigned long *cnt,int iocb_flags, +__be32 *verf);__be32 nfsd_vfs_write (struct svc_rqst *rqstp,struct svc_fh *fhp,struct nfsd_file *nf,loff_t offset,const struct xdr_buf *payload, -unsigned long *cnt,int stable,__be32 *verf); +unsigned long *cnt,int iocb_flags, +__be32 *verf);__be32 nfsd_readlink (struct svc_rqst *,struct svc_fh *,char *,int *); __be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *,
fs/nfsd/xdr3.h +1 -1
@@ -39,7 +39,7 @@ struct nfsd3_writeargs {svc_fh fh;__u64 offset;__u32 count; -int stable; +__u32 stable;__u32 len;struct xdr_buf payload; };
include/linux/nfs4.h +6 -0
@@ -263,6 +263,12 @@ enum why_no_delegation4 { /* new to v4.1 */ WND4_IS_DIR = 8, }; +enum stable_how4 { +UNSTABLE4 =0 , +DATA_SYNC4 =1 , +FILE_SYNC4 =2 , +}; +enum lock_type4 {NFS4_UNLOCK_LT =0 ,NFS4_READ_LT =1 ,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 19/507 NFSD: Complete a cld upcall when copying its reply fails
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 8cef2b0a01d28647facc57501a3df7ccd8d13ccd ]
cld_pipe_downcall() removes the matching upcall from cn_list before copying the daemon's reply. When that copy_from_user() faults, the downcall returns -EFAULT without completing the upcall, and a retried write cannot reach it because its xid is no longer on the list. __cld_pipe_upcall() waits on cu_done uninterruptibly, so the nfsd thread that sent the upcall is stuck, and nfsd shutdown hangs behind it. The pipe is mode 0600, so only a broken or hostile nfsdcld can trigger the fault.
Record the fault in the upcall's pipe message and complete it, so the waiter returns the error to its client tracking operation.
--- fs/nfsd/nfs4recover.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nfsd/nfs4recover.c +4 -1
@@ -839,8 +839,11 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)if (status == -EINPROGRESS )return __cld_pipe_inprogress_downcall (cmsg, nn); -if (copy_from_user (&cup->cu_u.cu_msg_v2, src, mlen) !=0 ) +if (copy_from_user (&cup->cu_u.cu_msg_v2, src, mlen) !=0 ) { + cup->cu_pipe_msg.errno = -EFAULT ; +complete (&cup->cu_done);return -EFAULT ; + }complete (&cup->cu_done);return mlen;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 20/507 ksmbd: look up stream size by exact xattr name
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gael Blivet <[email protected]>
[ Upstream commit 10ea20d6584ecdaf2f7505855412a856a88d8934 ]
get_file_stream_info() walks the xattr list from a single ksmbd_vfs_listxattr() and sizes each stream it finds with ksmbd_vfs_casexattr_len(), which matches with strncasecmp(). Linux xattr names are case-sensitive, so two streams differing only in case report each other's size.
The loop already holds the exact name, so query it directly with ksmbd_vfs_xattr_len(), which is what casexattr_len() calls once its search succeeds. Make it non-static and declare it in vfs.h, and drop the comment above it, which describes a different bug and no longer matches the code.
This also drops a full listing per stream: casexattr_len() runs its own listxattr on every call, so enumerating a file with N xattrs cost N listings instead of one.
--- fs/smb/server/smb2pdu.c | 13 ++----------- fs/smb/server/vfs.c | 4 ++-- fs/smb/server/vfs.h | 2 ++ 3 files changed, 6 insertions(+), 13 deletions(-)
fs/smb/server/smb2pdu.c +2 -11
@@ -7097,17 +7097,8 @@ static int get_file_stream_info(struct ksmbd_work *work, streamlen *=2 ;kfree (stream_buf); file_info->StreamNameLength =cpu_to_le32 (streamlen); -/* -* stream_name_len is the byte length of the xattr's *name*, -* not its value -- same class of bug ksmbd_stream_eof() -* (smb2pdu.c) already fixes for EndOfFile/AllocationSize on -* a stream handle; this enumeration path needs the same -* real xattr value length, not the name length reused as a -* size. -*/ - slen =ksmbd_vfs_casexattr_len (file_mnt_idmap (fp->filp), - path->dentry, stream_name, -strlen (stream_name) +1 ,NULL ); + slen =ksmbd_vfs_xattr_len (file_mnt_idmap (fp->filp), + path->dentry, stream_name); ssize = slen <0 ?0 : (loff_t )slen; file_info->StreamSize =cpu_to_le64 (ssize); file_info->StreamAllocationSize =cpu_to_le64 (ssize);
fs/smb/server/vfs.c +2 -2
@@ -902,8 +902,8 @@ ssize_t ksmbd_vfs_listxattr(struct dentry *dentry, char **list)return size; } -static ssize_t ksmbd_vfs_xattr_len (struct mnt_idmap *idmap, -struct dentry *dentry,char *xattr_name) +ssize_t ksmbd_vfs_xattr_len (struct mnt_idmap *idmap, +struct dentry *dentry,char *xattr_name) {return vfs_getxattr (idmap, dentry, xattr_name,NULL ,0 ); }
fs/smb/server/vfs.h +2 -0
@@ -109,6 +109,8 @@ ssize_t ksmbd_vfs_getxattr(struct mnt_idmap *idmap,struct dentry *dentry, char *xattr_name, char **xattr_buf); +ssize_t ksmbd_vfs_xattr_len (struct mnt_idmap *idmap, +struct dentry *dentry,char *xattr_name);ssize_t ksmbd_vfs_casexattr_len (struct mnt_idmap *idmap,struct dentry *dentry,char *attr_name,int attr_name_len,char *actual_name);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 21/507 wifi: brcmfmac: cfg80211: Report port_authorized for 4-way HS offload
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Janne Grunau <[email protected]>
[ Upstream commit 6fff9de5c5b425817588eeed42bd56d665751c13 ]
Since commit 416386060 ("Mark authorization completed on driver indication during 4-way HS offload") [0] wpa_supplicant expects NL80211_CMD_PORT_AUTHORIZED to complete the authentication when the driver supports 4-way handshake offload.
This was apparently never tested with the upstream brcmfmac driver as it does not report this. This broke authentication on Apple silicon devices (BRCM4378, BRMC4387, BRMC4388) and other devices when wpa_supplicant 2.11 was released [1]. This was initially dealt with by reverting the commit in Fedora [2] and other Linux distributions.
Instead of carrying the revert over to wpa_supplicant 2.12 add the expected NL80211_CMD_PORT_AUTHORIZED when the connection is established.
The "Fixes:" tag is not fully accurate as this has only became an issue after userspace changes years after the change. Since the change is expected to be required in all active stable branches for wpa_supplicant 2.11 / 2.12 compatibility it is helpful even though BRCMF_PROFILE_FWSUP_SAE did not exists then.
--- .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +7 -0
@@ -6504,6 +6504,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg,struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;struct brcmf_cfg80211_connect_info *conn_info =cfg_to_conn (cfg);struct cfg80211_connect_resp_params conn_params; +bool authorized;brcmf_dbg (TRACE ,"Enter\n" );
@@ -6528,7 +6529,13 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg, conn_params.req_ie_len = conn_info->req_ie_len; conn_params.resp_ie = conn_info->resp_ie; conn_params.resp_ie_len = conn_info->resp_ie_len; + authorized = completed && + ((profile->use_fwsup ==BRCMF_PROFILE_FWSUP_SAE ) || + (profile->use_fwsup ==BRCMF_PROFILE_FWSUP_PSK ));cfg80211_connect_done (ndev, &conn_params,GFP_KERNEL ); +if (authorized) +cfg80211_port_authorized (ndev, profile->bssid,NULL ,0 , +GFP_KERNEL );brcmf_dbg (CONN ,"Report connect result - connection %s\n" , completed ?"succeeded" :"failed" ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 22/507 io_uring/cancel: drop sqd->lock while SQPOLL waits
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
Commit cb0306c52ffae083a86fb283de67875ae7a9500e upstream.
An exiting SQPOLL thread calls io_uring_cancel_generic() with sqd->lock held, and keeps it across cond_resched() and the sleep until nothing is in flight anymore. A zero-copy send notification can't be canceled and stays pending as long as the peer doesn't read, so the lock is held for as long as a user cares to. io_ring_exit_work() needs it to park the thread, and so do IORING_REGISTER_IOWQ_AFF and IOWQ_MAX_WORKERS. With 64 such rings sharing the thread, every iou_exit slot sleeps on the lock and no ring gets freed for anyone.
Drop the lock around cond_resched() and the sleep, like the main loop of the thread does. Each walk of ctx_list is still under one hold, and nothing is kept across the unlock. The thread drops its io-wq, frees its tctx and clears sqd->thread under one hold after the loop, so whoever holds the lock and finds sqd->thread set can still use them.
--- io_uring/cancel.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
io_uring/cancel.c +22 -1
@@ -650,7 +650,16 @@ __cold void io_uring_cancel_generic(bool cancel_all, struct io_sq_data *sqd) }if (loop) { +/* +* A request that runs in io-wq and doesn't end makes +* each round come here. Don't hold sqd->lock for that +* long either. +*/ +if (sqd) +mutex_unlock (&sqd->lock);cond_resched (); +if (sqd) +mutex_lock (&sqd->lock);continue ; }
@@ -678,8 +687,20 @@ __cold void io_uring_cancel_generic(bool cancel_all, struct io_sq_data *sqd)* avoids a race where a completion comes in before we did * prepare_to_wait(). */ -if (inflight ==tctx_inflight (tctx, !cancel_all)) +if (inflight ==tctx_inflight (tctx, !cancel_all)) { +/* +* A zero-copy notification can't be canceled, and a +* peer that doesn't read keeps it pending. Don't hold +* sqd->lock while waiting for it, or whoever wants the +* lock sleeps as long. No ring is used across this, +* the next round walks ->ctx_list anew. +*/ +if (sqd) +mutex_unlock (&sqd->lock);schedule (); +if (sqd) +mutex_lock (&sqd->lock); + } end_wait:finish_wait (&tctx->wait, &wait); }while (1 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 23/507 io_uring/sqpoll: dont attach to a thread that is canceling
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
Commit 22d9db9fd64a493525d692b32c556875b7254665 upstream.
io_sq_offload_create() refuses to attach a ring to an SQPOLL thread that has already gone, by checking sqd->thread under sqd->lock. Since the thread drops the lock while io_uring_cancel_generic() waits for its requests, that check can run while the thread is on its way out and still see it. The new ring is then added to ctx_list, io_uring_setup() succeeds, the thread finishes canceling and exits without ever having looked at the ring, and io_uring_enter() fails with -EOWNERDEAD.
Only a thread that exits on a fatal signal can be caught like this, as the stop bit is set once the last ring has let go of the sqd, when no fd is left to attach through. A fatal signal is group wide and attaching needs the same thread group, so the attacher is on its way out as well. Still, make the check see it: set the stop bit before canceling, whatever the reason for the exit, and test it when attaching.
--- io_uring/sqpoll.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
io_uring/sqpoll.c +10 -1
@@ -433,6 +433,12 @@ static int io_sq_thread(void *data)if (io_sq_tw_pending ())io_sq_tw (UINT_MAX ); +/* +* Cancelation drops sqd->lock while it waits, and a ring could attach +* to a thread that is on its way out. A fatal signal doesn't set the +* bit, so set it here for io_sq_offload_create() to see. +*/ +set_bit (IO_SQ_THREAD_SHOULD_STOP , &sqd->state);io_uring_cancel_generic (true, sqd);rcu_assign_pointer (sqd->thread,NULL );put_task_struct (current);
@@ -502,7 +508,10 @@ __cold int io_sq_offload_create(struct io_ring_ctx *ctx,list_add (&ctx->sqd_list, &sqd->ctx_list);io_sqd_update_thread_idle (sqd);/* don't attach to a dying SQPOLL thread, would be racy */ - ret = (attached && !sqd->thread) ? -ENXIO :0 ; + ret =0 ; +if (attached && (!sqd->thread || +test_bit (IO_SQ_THREAD_SHOULD_STOP , &sqd->state))) + ret = -ENXIO ;io_sq_thread_unpark (sqd);if (ret <0 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 24/507 io_uring/sqpoll: dont set IO_SQ_THREAD_SHOULD_STOP on thread exit
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Liu <[email protected]>
Commit fca3ff9e2eee7d285585daf51942e0b5e2be354a upstream.
io_sq_thread_stop() carries a WARN_ON_ONCE() asserting that IO_SQ_THREAD_SHOULD_STOP isn't set yet, i.e. that stopping the SQPOLL thread is never attempted twice. Since commit 22d9db9fd64a ("io_uring/sqpoll: don't attach to a thread that is canceling"), the SQPOLL thread itself sets that bit on its way out, so that io_sq_offload_create() won't attach a new ring to a thread that is canceling.
When the thread exits on a fatal signal, the bit is thus set before the ring teardown gets to io_sq_thread_stop(), which now triggers the warning on every such exit:
WARNING: io_uring/sqpoll.c:88 at io_sq_thread_stop Workqueue: iou_exit io_ring_exit_work Call Trace: io_put_sq_data io_sq_thread_finish io_ring_ctx_free io_ring_exit_work
Introduce a separate IO_SQ_THREAD_EXITING bit for the thread marking itself as on its way out, and check it in io_sq_offload_create() along with IO_SQ_THREAD_SHOULD_STOP. IO_SQ_THREAD_SHOULD_STOP regains its original meaning, "a stop has been requested", and the WARN_ON_ONCE() holds again.
Reproduced with an SQPOLL ring and an immediate fatal signal: the warning fires on v7.3.0+ (22d9db9fd64a present) and is gone with this change.
--- io_uring/sqpoll.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
io_uring/sqpoll.c +6 -3
@@ -29,6 +29,7 @@enum {IO_SQ_THREAD_SHOULD_STOP =0 ,IO_SQ_THREAD_SHOULD_PARK , +IO_SQ_THREAD_EXITING , };void io_sq_thread_unpark (struct io_sq_data *sqd)
@@ -436,9 +437,10 @@ static int io_sq_thread(void *data)/* * Cancelation drops sqd->lock while it waits, and a ring could attach * to a thread that is on its way out. A fatal signal doesn't set the -* bit, so set it here for io_sq_offload_create() to see. +* stop bit, so mark the thread as exiting here for +* io_sq_offload_create() to see. */ -set_bit (IO_SQ_THREAD_SHOULD_STOP , &sqd->state); +set_bit (IO_SQ_THREAD_EXITING , &sqd->state);io_uring_cancel_generic (true, sqd);rcu_assign_pointer (sqd->thread,NULL );put_task_struct (current);
@@ -510,7 +512,8 @@ __cold int io_sq_offload_create(struct io_ring_ctx *ctx,/* don't attach to a dying SQPOLL thread, would be racy */ ret =0 ;if (attached && (!sqd->thread || -test_bit (IO_SQ_THREAD_SHOULD_STOP , &sqd->state))) +test_bit (IO_SQ_THREAD_SHOULD_STOP , &sqd->state) || +test_bit (IO_SQ_THREAD_EXITING , &sqd->state))) ret = -ENXIO ;io_sq_thread_unpark (sqd);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 25/507 io_uring/sqpoll: do the return-to-userspace work in the SQPOLL thread
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shakeel Butt <[email protected]>
Commit f013b695506491c5202a412a6568313549c81f50 upstream.
The SQPOLL thread never returns to userspace. io_sq_tw() runs its task_work, but the rest of resume_user_mode_work(), like memory.high reclaim and block cgroup throttling, only runs when the thread exits. So memory.high reclaim only happens inside a charge, with sqd->lock and ctx->uring_lock held, and not at all if the charges can't block.
This used to work. The loop called io_run_task_work(), which does this work since commit b5d3ae202fbf ("io_uring: handle TIF_NOTIFY_RESUME when checking for task_work"). Commit af5d68f8892f ("io_uring/sqpoll:
manage task_work privately") replaced that call with io_sq_tw().
Call resume_user_mode_work() at the top of the loop when TIF_NOTIFY_RESUME is set, with sqd->lock dropped. It runs once per pass, so a pass that charges two or more batches still reclaims inside the charge, as before.
Tested in a VM with memory.high=64M and swap on zram. An SQPOLL ring reads 256M from /dev/zero into untouched memory, 64K at a time. Before, the thread made 337 calls to __mem_cgroup_handle_over_high(), all from inside the charge. After, it makes 704, all from the top of the loop. memory.peak stays at 64M. With 1M reads, 296 of its 385 calls still come from inside the charge. Both runs take about 50% longer, and the extra time is in the handler, which now runs more often. Without memory.high pressure, the test never calls resume_user_mode_work() and the times do not change. Lockdep showed no warnings, also with io_uring_register() racing for sqd->lock.
--- io_uring/sqpoll.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
io_uring/sqpoll.c +12 -0
@@ -349,6 +349,18 @@ static int io_sq_thread(void *data) timeout = jiffies + sqd->sq_thread_idle; } +/* +* The SQPOLL thread never returns to userspace, so do the +* return-to-userspace work, like memory.high reclaim, here. +* It can sleep for a long time, so drop sqd->lock. +*/ +if (test_thread_flag (TIF_NOTIFY_RESUME )) { +mutex_unlock (&sqd->lock); +resume_user_mode_work (NULL ); +mutex_lock (&sqd->lock); + sqd->sq_cpu =raw_smp_processor_id (); + } + cap_entries = !list_is_singular (&sqd->ctx_list);list_for_each_entry (ctx, &sqd->ctx_list, sqd_list) {int ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 26/507 io_uring/cancel: count all requests that a CANCEL_ALL cancels
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shang En Sim <[email protected]>
Commit 21ddbb14f7c3baab50a2a6c13ee375edc2bbe031 upstream.
With IORING_ASYNC_CANCEL_ALL, __io_async_cancel() counts one for each io_try_cancel() call that cancels something. io_futex_cancel() and io_waitid_cancel() cancel every match in one call and return how many, so four futex waits cancelled with CANCEL_ALL give a result of 1.
Add the number that they return.
--- io_uring/cancel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
io_uring/cancel.c +2 -1
@@ -198,7 +198,8 @@ static int __io_async_cancel(struct io_cancel_data *cd,break ;if (!all)return ret; - nr++; +/* futex and waitid return how many they cancelled */ + nr +=max (ret,1 ); }while (1 );/* slow path, try all io-wq's */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 27/507 io_uring/poll: cancel all matching requests in one pass
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shang En Sim <[email protected]>
Commit 9eff9c07e927dcd9c57150cd6fb3d4ec76f00480 upstream.
With IORING_ASYNC_CANCEL_ALL, __io_async_cancel() calls io_try_cancel() until nothing is found, and io_poll_cancel() cancels one request per call, starting each lookup at the beginning of the hash. A cancelled request stays hashed until its task work runs, so every lookup walks past the ones already cancelled. Cancelling K of N pending polls visits about K*N/2 requests in one io_uring_enter(), with uring_lock held.
A single CANCEL_FD|ALL on 80000 polls on one eventfd takes 17.06s, 0.02s with this change. With voluntary preemption the soft lockup watchdog fires:
watchdog: BUG: soft lockup - CPU#1 stuck for 26s! [repro:100] RIP: 0010:io_cancel_req_match+0x19/0xa0 io_poll_cancel+0x73/0x170 io_try_cancel+0x7b/0xf0 __io_async_cancel+0x41/0x110
Walk the hash once and cancel every match, as io_cancel_remove() does for futex and waitid. Cancel by user_data only needs its own bucket. __io_async_cancel() still loops until nothing is found, so a request that io-wq parks in the poll hash meanwhile is still cancelled.
A cancel that matches one request now walks the whole hash twice instead of stopping at the match.
--- io_uring/cancel.c | 2 +- io_uring/poll.c | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-)
io_uring/cancel.c +1 -1
@@ -198,7 +198,7 @@ static int __io_async_cancel(struct io_cancel_data *cd,break ;if (!all)return ret; -/* futex and waitid return how many they cancelled */ +/* poll, futex and waitid return how many they cancelled */ nr +=max (ret,1 ); }while (1 );
io_uring/poll.c +37 -2
@@ -827,12 +827,47 @@ static int io_poll_disarm(struct io_kiocb *req)return 0 ; } +/* +* Cancel every request matching @cd in one pass. Cancelled requests stay +* hashed until their task work runs, so finding them one at a time would +* walk past all the earlier ones on each lookup. +*/ +static int io_poll_cancel_all (struct io_ring_ctx *ctx,struct io_cancel_data *cd) +{ +unsigned int nr_buckets =1U << ctx->cancel_table.hash_bits; +unsigned int i =0 ; +struct hlist_node *tmp; +struct io_kiocb *req; +int nr =0 ; + +if (!(cd->flags & (IORING_ASYNC_CANCEL_FD |IORING_ASYNC_CANCEL_OP | +IORING_ASYNC_CANCEL_ANY ))) { +/* keyed by user_data, so only one bucket can match */ + i =hash_long (cd->data, ctx->cancel_table.hash_bits); + nr_buckets = i +1 ; + } + +for (; i < nr_buckets; i++) { +struct io_hash_bucket *hb = &ctx->cancel_table.hbs[i]; + +hlist_for_each_entry_safe (req, tmp, &hb->list, hash_node) { +if (!io_cancel_req_match (req, cd)) +continue ; +io_poll_cancel_req (req); + nr++; + } + } +return nr ?: -ENOENT ; +} +static int __io_poll_cancel (struct io_ring_ctx *ctx,struct io_cancel_data *cd) {struct io_kiocb *req; -if (cd->flags & (IORING_ASYNC_CANCEL_FD |IORING_ASYNC_CANCEL_OP | -IORING_ASYNC_CANCEL_ANY )) +if (cd->flags & (IORING_ASYNC_CANCEL_ALL |IORING_ASYNC_CANCEL_ANY )) +return io_poll_cancel_all (ctx, cd); + +if (cd->flags & (IORING_ASYNC_CANCEL_FD |IORING_ASYNC_CANCEL_OP )) req =io_poll_file_find (ctx, cd);else req =io_poll_find (ctx, false, cd);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 28/507 io_uring/poll: dont poll a writer for a read side hangup
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
Commit 74c1f1048e4401d6a953ab2299b14ace1ad6a899 upstream.
io_init_poll_iocb() adds EPOLLRDHUP to every poll, including the async poll of a send that waits for buffer space. Once the peer has shut down its sending side, the socket keeps reporting EPOLLRDHUP, so each re-arm in __io_arm_poll_handler() finds a ready mask and the request is issued again. The send still can't make progress, the request burns through APOLL_MAX_RETRY in a few milliseconds and ends up in io-wq.
A send in io-wq blocks until the peer reads, but sendmsg and writev go through ____sys_sendmsg() and sock_write_iter(), which turn O_NONBLOCK into MSG_DONTWAIT, and the application gets -EAGAIN for a request that never asked for a non-blocking send.
Only add EPOLLRDHUP for polls that want to read. A peer that stopped sending is no event for a writer, and a poll that asks for it explicitly still gets it.
--- io_uring/poll.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
io_uring/poll.c +15 -3
@@ -128,12 +128,24 @@ static void io_poll_req_insert(struct io_kiocb *req)hlist_add_head (&req->hash_node, &table->hbs[index].list); } +#define IO_POLL_UNMASK (EPOLLERR|EPOLLHUP|EPOLLNVAL) + +static __poll_t io_poll_unmask (__poll_t events) +{ +/* +* A peer that stopped sending is an event for a reader, but a write +* only poll must stay armed until the file is writable again. +*/ +if (events & (EPOLLIN |EPOLLRDNORM |EPOLLRDBAND )) +return IO_POLL_UNMASK |EPOLLRDHUP ; +return IO_POLL_UNMASK ; +} +static void io_init_poll_iocb (struct io_poll *poll,__poll_t events) { poll->head =NULL ; -#define IO_POLL_UNMASK (EPOLLERR|EPOLLHUP|EPOLLNVAL|EPOLLRDHUP)/* mask in events that we always want/need */ - poll->events = events |IO_POLL_UNMASK ; + poll->events = events |io_poll_unmask (events);INIT_LIST_HEAD (&poll->wait.entry);init_waitqueue_func_entry (&poll->wait, io_poll_wake); }
@@ -1006,7 +1018,7 @@ int io_poll_remove(struct io_kiocb *req, unsigned int issue_flags) poll->events &= ~0xffff ; poll->events |= poll_update->events &0xffff ; - poll->events |=IO_POLL_UNMASK ; + poll->events |=io_poll_unmask (poll->events); }if (poll_update->update_user_data) preq->cqe.user_data = poll_update->new_user_data;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 11/507 NFSD: Move version-specific ACCESS maps into per-version code
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 3423b5f91d80d3a76424e1c9f1d0f95d4dd80101 ]
nfsd_access() owns three static tables that map on-the-wire ACCESS bits to NFSD_MAY flags, and every NFS version shares them. That puts protocol-version specifics in the version-agnostic VFS layer. The NFSv4.2 extended-attribute bits are wedged into the NFSv3 tables under CONFIG_NFSD_V4.
Give each version its own tables in its proc code and pass the matching set into nfsd_access() as a new argument.
Splitting the tables also stops the NFSv2-ACL and NFSv3 ACCESS paths from answering for the NFSv4.2 extended-attribute bits. Both use the NFSv4-augmented table whenever CONFIG_NFSD_V4 is set, so an NFSv3 request that sets an xattr bit has it echoed back in the reply even though those bits are undefined for v3.
Stable-dep-of: ccfc4db5ab74 ("NFSD: map fh_verify() status codes for NFS_ACLv2 replies")
--- fs/nfsd/nfs2acl.c | 46 ++++++++++++++++++++++++++- fs/nfsd/nfs3proc.c | 41 +++++++++++++++++++++++- fs/nfsd/nfs4proc.c | 42 +++++++++++++++++++++++-- fs/nfsd/vfs.c | 78 ++++++++++------------------------------------ fs/nfsd/vfs.h | 15 ++++++++- 5 files changed, 155 insertions(+), 67 deletions(-)
fs/nfsd/nfs2acl.c +45 -1
@@ -15,6 +15,48 @@#define NFSDDBG_FACILITY NFSDDBG_PROC +/* +* These maps are identical to the NFSv3 maps (nfs3proc.c). This enables +* the behavior of the two versions to diverge if needed. +*/ +static const struct nfsd_access_map nfsd2_regaccess[] = { + {NFS3_ACCESS_READ ,NFSD_MAY_READ }, + {NFS3_ACCESS_EXECUTE ,NFSD_MAY_EXEC }, + {NFS3_ACCESS_MODIFY ,NFSD_MAY_WRITE |NFSD_MAY_TRUNC }, + {NFS3_ACCESS_EXTEND ,NFSD_MAY_WRITE }, + {0 ,0 } +}; + +static const struct nfsd_access_map nfsd2_diraccess[] = { + {NFS3_ACCESS_READ ,NFSD_MAY_READ }, + {NFS3_ACCESS_LOOKUP ,NFSD_MAY_EXEC }, + {NFS3_ACCESS_MODIFY ,NFSD_MAY_EXEC |NFSD_MAY_WRITE |NFSD_MAY_TRUNC }, + {NFS3_ACCESS_EXTEND ,NFSD_MAY_EXEC |NFSD_MAY_WRITE }, + {NFS3_ACCESS_DELETE ,NFSD_MAY_REMOVE }, + {0 ,0 } +}; + +/* +* Some clients - Solaris 2.6 at least, make an access call to the NFS +* server to check for access for things like /dev/null (which really, +* NFSD doesn't care about). So NFSD provides simple access checking +* for those objects, looking mainly at mode bits, ignoring read-only +* filesystem checks. +*/ +static const struct nfsd_access_map nfsd2_otheraccess[] = { + {NFS3_ACCESS_READ ,NFSD_MAY_READ }, + {NFS3_ACCESS_EXECUTE ,NFSD_MAY_EXEC }, + {NFS3_ACCESS_MODIFY ,NFSD_MAY_WRITE |NFSD_MAY_LOCAL_ACCESS }, + {NFS3_ACCESS_EXTEND ,NFSD_MAY_WRITE |NFSD_MAY_LOCAL_ACCESS }, + {0 ,0 } +}; + +static const struct nfsd_access_maps nfsd2_access_maps = { + .regular = nfsd2_regaccess, + .directory = nfsd2_diraccess, + .other = nfsd2_otheraccess, +}; +/* * NULL call. */
@@ -180,7 +222,9 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp)fh_copy (&resp->fh, &argp->fh); resp->access = argp->access; - resp->status =nfsd_access (rqstp, &resp->fh, &resp->access,NULL ); + + resp->status =nfsd_access (rqstp, &resp->fh, &nfsd2_access_maps, + &resp->access,NULL );if (resp->status != nfs_ok) goto out; resp->status =fh_getattr (&resp->fh, &resp->stat);
fs/nfsd/nfs3proc.c +40 -1
53 lines not on this page · raw message
fs/nfsd/nfs4proc.c +39 -3
55 lines not on this page · raw message
fs/nfsd/vfs.c +17 -61
100 lines not on this page · raw message
fs/nfsd/vfs.h +14 -1
@@ -37,6 +37,17 @@#define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE)#define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) +struct nfsd_access_map { +u32 access; +int may; +}; + +struct nfsd_access_maps { +const struct nfsd_access_map *regular; +const struct nfsd_access_map *directory; +const struct nfsd_access_map *other; +}; +struct nfsd_file ;/*
@@ -100,7 +111,9 @@ __be32 nfsd_create_locked(struct svc_rqst *, struct svc_fh *,__be32 nfsd_create (struct svc_rqst *,struct svc_fh *,char *name,int len,struct nfsd_attrs *attrs,int type,dev_t rdev,struct svc_fh *res); -__be32 nfsd_access (struct svc_rqst *,struct svc_fh *,u32 *,u32 *); +__be32 nfsd_access (struct svc_rqst *rqstp,struct svc_fh *fhp, +const struct nfsd_access_maps *maps, +u32 *access,u32 *supported);__be32 nfsd_create_setattr (struct svc_rqst *rqstp,struct svc_fh *fhp,struct svc_fh *resfhp,struct nfsd_attrs *iap); __be32 nfsd_commit(struct svc_rqst *rqst, struct svc_fh *fhp,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 29/507 io_uring/poll: dont poll a writer for urgent data
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
Commit edeac4546a71b6c1db4ba006a2dbf7c863f54e9a upstream.
io_arm_poll_handler() starts the mask of every async poll with EPOLLPRI, for a reader and a writer alike. A TCP socket reports EPOLLPRI for as long as urgent data sits unread, so once the peer has sent a byte with MSG_OOB, the async poll of a send that waits for buffer space is ready on every re-arm. The request spins through task_work and __io_arm_poll_handler() until APOLL_MAX_RETRY is used up and io-wq takes it, the same spin that EPOLLRDHUP caused for a half-closed peer.
While it spins, the request is neither in the poll hash nor in io-wq. A cancel issued right after the send gets -ENOENT and the send stays pending, until a later cancel finds it in io-wq.
Only add EPOLLPRI for polls that want to read. Urgent data is an event for a recv, not for a writer.
--- io_uring/poll.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
io_uring/poll.c +3 -2
@@ -739,7 +739,7 @@ int io_arm_apoll(struct io_kiocb *req, unsigned issue_flags, __poll_t mask)int io_arm_poll_handler (struct io_kiocb *req,unsigned issue_flags) {const struct io_issue_def *def = &io_issue_defs[req->opcode]; -__poll_t mask =POLLPRI |POLLERR ; +__poll_t mask =EPOLLERR ;if (!def->pollin && !def->pollout)return IO_APOLL_ABORTED ;
@@ -747,7 +747,8 @@ int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags)return IO_APOLL_ABORTED ;if (def->pollin) { - mask |=EPOLLIN |EPOLLRDNORM ; +/* urgent data is an event for a reader only */ + mask |=EPOLLIN |EPOLLRDNORM |EPOLLPRI ;/* If reading from MSG_ERRQUEUE using recvmsg, ignore POLLIN */ if (req->flags &REQ_F_CLEAR_POLLIN )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 30/507 io_uring/rsrc: hold uring_lock across index-alloc put_user
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuansheng Yang <[email protected]>
Commit d7c7037253f6935af243570635d71b4920b5a4ea upstream.
io_files_update_with_index_alloc() installs a fixed file via io_fixed_fd_install(), which drops ->uring_lock when the request runs on io-wq, then put_user()s the allocated slot back to userspace. If that faults, the error path calls __io_close_fixed() by slot index after re-taking the lock.
The slot can be closed and reused between the install and that cleanup:
another fixed CLOSE plus open/accept/pipe/socket, or a FILES_UPDATE, can put an unrelated file into the same slot. The error path then removes that file instead of the one this request installed, ending an unrelated file's fixed-table reference early. This is a correctness/DoS issue, not a use-after-free: fixed-file requests hold an io_rsrc_node reference, so the node and file stay alive until they are done.
Hold ->uring_lock across __io_fixed_fd_install() and put_user(), and do the failure cleanup with io_fixed_fd_remove() under the same lock. This is the same class as the io_pipe_fixed() fix in a3d7ee11289f. Faulting while holding ->uring_lock is fine, the registration paths already do it.
--- io_uring/rsrc.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
io_uring/rsrc.c +16 -5
@@ -521,11 +521,12 @@ static int io_files_update_with_index_alloc(struct io_kiocb *req, { struct io_rsrc_update *up = io_kiocb_to_cmd(req, struct io_rsrc_update);__s32 __user *fds =u64_to_user_ptr (up->arg); +struct io_ring_ctx *ctx = req->ctx;unsigned int done;struct file *file;int ret, fd; -if (!req->ctx->file_table.data.nr) +if (!ctx->file_table.data.nr)return -ENXIO ;for (done =0 ; done < up->nr_args; done++) {
@@ -539,15 +540,25 @@ static int io_files_update_with_index_alloc(struct io_kiocb *req, ret = -EBADF ;break ; } - ret =io_fixed_fd_install (req, issue_flags, file, -IORING_FILE_INDEX_ALLOC ); -if (ret <0 ) +/* +* Hold the lock across the put_user(), if it's dropped the +* slot can be closed and reused before the error path runs. +*/ +io_ring_submit_lock (ctx, issue_flags); + ret =__io_fixed_fd_install (ctx, file, +IORING_FILE_INDEX_ALLOC ); +if (ret <0 ) { +io_ring_submit_unlock (ctx, issue_flags); +fput (file);break ; + }if (put_user (ret, &fds[done])) { -__io_close_fixed (req->ctx, issue_flags, ret); +io_fixed_fd_remove (ctx, ret); +io_ring_submit_unlock (ctx, issue_flags); ret = -EFAULT ;break ; } +io_ring_submit_unlock (ctx, issue_flags); }if (done)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 31/507 mm/damon/core: remove unreachable damos charge_{target,addr}_from
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: SJ Park <[email protected]>
[ Upstream commit 5695abc4e742b947f586bfb6a080a80ad9957e5d ]
damos_quota->charge_{target,addr}_from saves the target and region the scheme's quota limit is reached. damos_skip_charged_region() skips the target and regions before the point. The target that was assigned to charge_target_from could be dynamically removed from the context by the runtime parameters update (aka commit) feature. In this case, damos_skip_charged_region() cannot find if the point is passed or not, so the scheme is effectively disabled.
Similarly, the user could also remove all the regions of the target using the runtime parameters update feature. It would be uncommon to do that, but it is a supported feature. Because the skip pointer detection logic (damos_skip_charged_region()) works for each region of targets, this result in the logic is entirely skipped and the scheme is effectively disabled again.
The user impact is that the DAMOS scheme could suddenly stop working under certain uses of the runtime parameters update feature. It could surprise users. No crash or leak happens though. Users could also simply work around by re-installing the scheme.
Catch the corner cases in damos_adjust_quota() and reset the pointers.
--- mm/damon/core.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
mm/damon/core.c +22 -0
@@ -3200,6 +3200,26 @@ static void damos_trace_esz(struct damon_ctx *c, struct damos *s,trace_damos_esz (cidx, sidx, quota->esz); } +static void damos_fix_stale_charge_pointers (struct damon_ctx *c, +struct damos *s) +{ +struct damos_quota *quota; +struct damon_target *t; + + quota = &s->quota; +if (!quota->charge_target_from) +return ; +damon_for_each_target (t, c) { +if (t == quota->charge_target_from) { +if (damon_nr_regions (t) >0 ) +return ; +break ; + } + } + quota->charge_target_from =NULL ; + quota->charge_addr_from =0 ; +} +static void damos_adjust_quota (struct damon_ctx *c,struct damos *s) {struct damos_quota *quota = &s->quota;
@@ -3235,6 +3255,8 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)damos_trace_esz (c, s, quota); } +damos_fix_stale_charge_pointers (c, s); +if (!c->ops.get_scheme_score)return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 32/507 block: restore the iterator when rejecting a misaligned bio
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Morton <[email protected]>
commit 40d070cbb1906896d6fd65c39722d2411830ed9f upstream.
bio_iov_iter_get_pages() can extract some iovecs before encountering a misaligned one. It releases the pages and rejects the entire bio, but leaves the supplied iterator advanced.
An iomap direct-I/O caller may subsequently reexpand the iterator's byte count and fall back to buffered I/O. The reexpanded count then includes bytes before the iterator's current segment, potentially causing iterate_iovec() to read beyond the imported iovec array.
In a reproducer using an initial empty iovec followed by 10-byte and 1015-byte segments, writev() returned 1015 instead of 1025 and KASAN reported an 8-byte read beyond the nine-element iovec allocation. Saving and restoring the iterator on the rejected-bio path makes writev() return 1025 and eliminates the KASAN report.
Restore the entire iterator rather than reverting a byte count:
advancing past an empty segment changes its position without consuming any bytes.
Leave successful and partially accepted bio paths unchanged.
[ Backport to 7.3.y: restore the iterator in the existing inline
-EINVAL cleanup, as this tree lacks out_release_pages. ]
--- block/bio.c | 3 +++ 1 file changed, 3 insertions(+)
block/bio.c +3 -0
@@ -1285,6 +1285,7 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter, unsigned mem_align_mask, unsigned len_align_mask) {iov_iter_extraction_t flags =0 ; +struct iov_iter saved_iter;if (WARN_ON_ONCE (bio_flagged (bio,BIO_CLONED )))return -EIO ;
@@ -1303,6 +1304,7 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter,if (bio->bi_bdev &&blk_queue_pci_p2pdma (bio->bi_bdev->bd_disk->queue)) flags |=ITER_ALLOW_P2PDMA ; + saved_iter = *iter; do { ssize_t ret;
@@ -1320,6 +1322,7 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter,bio_release_pages (bio, false);bio_clear_flag (bio,BIO_PAGE_PINNED ); bio->bi_vcnt =0 ; + *iter = saved_iter; }if (!bio->bi_vcnt)return ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 33/507 wifi: rtw88: TX report with long timeout for non-PCIE devices
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ping-Ke Shih <[email protected]>
[ Upstream commit 7cde94dab0e74434ccc0a387d7ad373fb3becda0 ]
Many USB and SDIO devices can't report TX status within 500 ms, and extending to 2500 ms as tested USB/SDIO devices can fix the problem [1]. To avoid adding chip ID one by one, and this change looks harmless. Keep PCIE using short timeout, and others use long timeout.
[1] https://lore.kernel.org/linux-wireless/[email protected]/
[ Adjust the removed condition. This tree has no RTL8723BS support and
lacks commit 4d688f22ebbf ("wifi: rtw88: tx: extend the TX report purge timeout to RTL8723BS"), so the old check has no rtw_is_8723bs() part. The resulting code is the same as upstream. ]
--- drivers/net/wireless/realtek/rtw88/tx.c | 9 +++++---- drivers/net/wireless/realtek/rtw88/tx.h | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtw88/tx.c +5 -4
@@ -196,7 +196,7 @@ void rtw_tx_report_purge_timer(struct timer_list *t)void rtw_tx_report_enqueue (struct rtw_dev *rtwdev,struct sk_buff *skb,u8 sn) {struct rtw_tx_report *tx_report = &rtwdev->tx_report; -unsigned long timeout =RTW_TX_PROBE_TIMEOUT ; +unsigned long timeout;unsigned long flags;u8 *drv_data;
@@ -208,9 +208,10 @@ void rtw_tx_report_enqueue(struct rtw_dev *rtwdev, struct sk_buff *skb, u8 sn)__skb_queue_tail (&tx_report->queue, skb);spin_unlock_irqrestore (&tx_report->q_lock, flags); -if (rtwdev->chip->id ==RTW_CHIP_TYPE_8723D && - rtwdev->hci.type ==RTW_HCI_TYPE_USB ) - timeout =msecs_to_jiffies (2500 ); +if (rtwdev->hci.type ==RTW_HCI_TYPE_PCIE ) + timeout =RTW_TX_PROBE_TIMEOUT_SHORT ; +else + timeout =RTW_TX_PROBE_TIMEOUT_LONG ;mod_timer (&tx_report->purge_timer, jiffies + timeout); }
drivers/net/wireless/realtek/rtw88/tx.h +2 -1
@@ -7,7 +7,8 @@#define RTK_TX_MAX_AGG_NUM_MASK 0x1f -#define RTW_TX_PROBE_TIMEOUT msecs_to_jiffies(500) +#define RTW_TX_PROBE_TIMEOUT_SHORT msecs_to_jiffies(500) +#define RTW_TX_PROBE_TIMEOUT_LONG msecs_to_jiffies(2500)struct rtw_tx_desc {__le32 w0;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 34/507 ACPI: CPPC: Validate FFH register fields before hardware access
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Loehle <[email protected]>
commit 6b016c5c96448c0a5f09328d37f66562d154a5e5 upstream.
The x86 CPPC FFH accessors construct masks and shift values using the firmware's Bit Width and Bit Offset without checking that the field fits in an MSR. A zero-width field or a field extending beyond bit 63 can therefore cause an invalid shift. The safe MSR accessors only handle an access fault, not invalid field arithmetic after a successful read.
Also, the 64-bit GAS address is implicitly narrowed to the 32-bit MSR number. A descriptor with nonzero upper address bits can access a different MSR from the one described by firmware.
The arm64 AMU counter readers have the same unchecked field arithmetic. Validate the field bounds before reading a counter, including both descriptors in the paired counter path.
Dispatch FFH accesses before decoding the GAS Access Size in the common read and write paths. Otherwise, a large access_width can trigger an invalid shift in GET_BIT_WIDTH() before the architecture validates its register. That field has architecture-specific FFH semantics and is not needed by the generic memory/port accessor on this path.
Validate x86 MSR addresses and share the field-bounds checks between related accessors within each architecture.
--- arch/arm64/kernel/topology.c | 12 +++++++++++- arch/x86/kernel/acpi/cppc.c | 15 +++++++++++++++ drivers/acpi/cppc_acpi.c | 10 ++++++---- 3 files changed, 32 insertions(+), 5 deletions(-)
arch/arm64/kernel/topology.c +11 -1
@@ -470,6 +470,12 @@ static void amu_read_core_const_ctrs(void *val)cpu_read_corecnt (&ctrs->corecnt); } +static bool cpc_ffh_reg_valid (const struct cpc_reg *reg) +{ +return reg->bit_width && reg->bit_width <=64 && + reg->bit_offset <=64 - reg->bit_width; +} +static u64 cpc_ffh_extract_bits (const struct cpc_reg *reg,u64 val) { val &= GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
@@ -506,7 +512,8 @@ int cpc_read_ffh_fb_ctrs(int cpu, struct cpc_reg *reg1, u64 *val1,struct amu_ffh_ctrs ctrs;int ret; -if (!is_amu_ctr_reg (reg1) || !is_amu_ctr_reg (reg2)) +if (!is_amu_ctr_reg (reg1) || !is_amu_ctr_reg (reg2) || + !cpc_ffh_reg_valid (reg1) || !cpc_ffh_reg_valid (reg2))return -EINVAL ; ret =counters_read_on_cpu (cpu, amu_read_core_const_ctrs, &ctrs);
@@ -530,6 +537,9 @@ int cpc_read_ffh(int cpu, struct cpc_reg *reg, u64 *val) {int ret = -EOPNOTSUPP ; +if (!cpc_ffh_reg_valid (reg)) +return -EINVAL ; +switch ((u64 )reg->address) {case CPC_FFH_CTR_CORE : ret =counters_read_on_cpu (cpu, cpu_read_corecnt, val);
arch/x86/kernel/acpi/cppc.c +15 -0
@@ -6,6 +6,8 @@#include <linux/bitfield.h> +#include <linux/limits.h> +#include <acpi/cppc_acpi.h> #include <asm/msr.h> #include <asm/processor.h>
@@ -45,10 +47,20 @@ bool cpc_ffh_supported(void)return true; } +static bool cpc_ffh_reg_valid (const struct cpc_reg *reg) +{ +return reg->address <=U32_MAX && reg->bit_width && + reg->bit_width <=64 && + reg->bit_offset <=64 - reg->bit_width; +} +int cpc_read_ffh (int cpunum,struct cpc_reg *reg,u64 *val) {int err; +if (!cpc_ffh_reg_valid (reg)) +return -EINVAL ; + err =rdmsrq_safe_on_cpu (cpunum, reg->address, val);if (!err) { u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
@@ -65,6 +77,9 @@ int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val)u64 rd_val;int err; +if (!cpc_ffh_reg_valid (reg)) +return -EINVAL ; + err =rdmsrq_safe_on_cpu (cpunum, reg->address, &rd_val);if (!err) { u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
drivers/acpi/cppc_acpi.c +6 -4
@@ -1133,6 +1133,9 @@ static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val) } *val =0 ; +if (reg->space_id ==ACPI_ADR_SPACE_FIXED_HARDWARE ) +return cpc_read_ffh (cpu, reg, val); + size =GET_BIT_WIDTH (reg); if (IS_ENABLED(CONFIG_HAS_IOPORT) &&
@@ -1160,8 +1163,6 @@ static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val) }else if (reg->space_id ==ACPI_ADR_SPACE_SYSTEM_MEMORY ) vaddr = reg_res->sys_mem_vaddr; -else if (reg->space_id ==ACPI_ADR_SPACE_FIXED_HARDWARE ) -return cpc_read_ffh (cpu, reg, val);else return acpi_os_read_memory ((acpi_physical_address )reg->address, val, size);
@@ -1208,6 +1209,9 @@ static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val)unsigned long flags;bool locked = false; +if (reg->space_id ==ACPI_ADR_SPACE_FIXED_HARDWARE ) +return cpc_write_ffh (cpu, reg, val); + size =GET_BIT_WIDTH (reg); if (IS_ENABLED(CONFIG_HAS_IOPORT) &&
@@ -1233,8 +1237,6 @@ static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val) }else if (reg->space_id ==ACPI_ADR_SPACE_SYSTEM_MEMORY ) vaddr = reg_res->sys_mem_vaddr; -else if (reg->space_id ==ACPI_ADR_SPACE_FIXED_HARDWARE ) -return cpc_write_ffh (cpu, reg, val);else return acpi_os_write_memory ((acpi_physical_address )reg->address, val, size);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 35/507 ACPI: CPPC: Accept requests to retain immutable autonomous selection
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Loehle <[email protected]>
commit 4bcc60d326c5acaa28c5913259decb22a33a83a1 upstream.
ACPI permits Autonomous Selection Enable to be Integer 1 when the platform always selects performance autonomously. cppc_get_auto_sel() returns that value, but cppc_set_auto_sel() rejects the Integer even when asked to keep autonomous selection enabled. AMD shared-memory initialization consequently fails in active or guided mode after successfully reading the capability.
Accept a request to keep this immutable field enabled without issuing a register access. Expose the immutable encoding to callers, separately from the current value of a writable register.
Before an AMD shared-memory transition to passive mode, reject immutable autonomous selection on any present CPU. Otherwise a guided-to-passive transition ignores the failed disable and reports the wrong mode, while active-to-passive unregisters the working driver before passive policy initialization fails. Check under the driver mode lock before invoking either transition, including known offline CPUs.
Serialize this capability query with descriptor publication and removal. ACPI processor removal drops the descriptor before taking the CPU hotplug write lock, so the caller's cpus_read_lock() alone cannot protect the lookup. Unpublish under the same mutex before releasing a descriptor, including when adding its kobject fails.
The cppc-cpufreq auto_select attribute can also request one while autonomous selection is already enabled. If the subsequent bounds update fails, its rollback requests zero and clears the cached mode regardless of the previous state. For an immutable field the disable request fails, leaving the cached mode wrong. Save and restore the previous mode instead. This also avoids disabling an already-enabled writable control on that error path.
--- drivers/acpi/cppc_acpi.c | 48 ++++++++++++++++++++++++++++++++-- drivers/cpufreq/amd-pstate.c | 25 ++++++++++++++---- drivers/cpufreq/cppc_cpufreq.c | 5 ++-- include/acpi/cppc_acpi.h | 6 +++++ 4 files changed, 75 insertions(+), 9 deletions(-)
drivers/acpi/cppc_acpi.c +46 -2
@@ -36,6 +36,7 @@#include <linux/delay.h> #include <linux/iopoll.h> #include <linux/ktime.h> +#include <linux/mutex.h> #include <linux/rwsem.h> #include <linux/wait.h> #include <linux/topology.h>
@@ -93,6 +94,16 @@ static DEFINE_PER_CPU(int, cpu_pcc_subspace_idx);*/ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr); +/* Protect immutable capability queries against descriptor removal. */ +static DEFINE_MUTEX (cpc_desc_lock); + +static void cpc_set_desc (unsigned int cpu,struct cpc_desc *desc) +{ +mutex_lock (&cpc_desc_lock); +per_cpu (cpc_desc_ptr, cpu) = desc; +mutex_unlock (&cpc_desc_lock); +} +/* pcc mapped address + header size + offset within PCC subspace */ #define GET_PCC_VADDR (offs, pcc_ss_id) (pcc_data[pcc_ss_id]->pcc_channel->shmem + \ 0x8 + (offs))
@@ -999,12 +1010,12 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) }/* Plug PSD data into this CPU's CPC descriptor. */ -per_cpu (cpc_desc_ptr, pr->id) = cpc_ptr; +cpc_set_desc (pr->id, cpc_ptr); ret =kobject_init_and_add (&cpc_ptr->kobj, &cppc_ktype, &cpu_dev->kobj,"acpi_cppc" );if (ret) { -per_cpu (cpc_desc_ptr, pr->id) =NULL ; +cpc_set_desc (pr->id,NULL );kobject_put (&cpc_ptr->kobj); goto out_free; }
@@ -1056,6 +1067,8 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr)if (!cpc_ptr)return ; +cpc_set_desc (pr->id,NULL ); +/* Free all the mapped sys mem areas for this CPU */ for (i =2 ; i < cpc_ptr->num_entries; i++) { addr = cpc_ptr->cpc_regs[i-2 ].sys_mem_vaddr;
@@ -1402,6 +1415,11 @@ static int cppc_set_reg_val(int cpu, enum cppc_regs reg_idx, u64 val) reg = &cpc_desc->cpc_regs[reg_idx]; +/* Integer 1 describes autonomous selection that is always enabled. */ +if (reg_idx ==AUTO_SEL_ENABLE && reg->type ==ACPI_TYPE_INTEGER && + reg->cpc_entry.int_value ==1 ) +return val ==1 ?0 : -EOPNOTSUPP ; +/* if a register is writeable, it must be a buffer and not null */ if ((reg->type !=ACPI_TYPE_BUFFER ) ||IS_NULL_REG (®->cpc_entry.reg)) {pr_debug ("CPC register is not supported\n" );
@@ -1926,6 +1944,32 @@ int cppc_get_auto_sel(int cpu, bool *enable) }EXPORT_SYMBOL_GPL (cppc_get_auto_sel); +/** +* cppc_auto_sel_is_immutable - Check for always-enabled autonomous selection. +* @cpu: CPU whose _CPC descriptor to check. +* +* Context: Process context. +* Return: true for Integer 1, false for a register or an absent descriptor. +*/ +bool cppc_auto_sel_is_immutable (int cpu) +{ +struct cpc_desc *cpc_desc; +struct cpc_register_resource *reg; +bool immutable = false; + +mutex_lock (&cpc_desc_lock); + cpc_desc =per_cpu (cpc_desc_ptr, cpu); +if (cpc_desc) { + reg = &cpc_desc->cpc_regs[AUTO_SEL_ENABLE ]; + immutable = reg->type ==ACPI_TYPE_INTEGER && + reg->cpc_entry.int_value ==1 ; + } +mutex_unlock (&cpc_desc_lock); + +return immutable; +} +EXPORT_SYMBOL_GPL (cppc_auto_sel_is_immutable); +/** * cppc_set_auto_sel - Write autonomous selection register. * @cpu : CPU to which to write register.
drivers/cpufreq/amd-pstate.c +20 -5
@@ -1796,7 +1796,7 @@ EXPORT_SYMBOL_FOR_PSTATE_UT(amd_pstate_get_status);int amd_pstate_update_status (const char *buf,size_t size) { -int mode_idx; +int cpu, mode_idx, ret =0 ;if (size >strlen ("passive" ) || size <strlen ("active" ))return -EINVAL ;
@@ -1805,12 +1805,27 @@ int amd_pstate_update_status(const char *buf, size_t size)if (mode_idx <0 )return mode_idx; -if (mode_state_machine[cppc_state][mode_idx]) { -guard (mutex)(&amd_pstate_driver_lock); -return mode_state_machine[cppc_state][mode_idx](mode_idx); +guard (mutex)(&amd_pstate_driver_lock); + +if (!mode_state_machine[cppc_state][mode_idx]) +return 0 ; + +if (mode_idx ==AMD_PSTATE_PASSIVE && + !cpu_feature_enabled (X86_FEATURE_CPPC )) { +cpus_read_lock (); +/* Check offline CPUs too, before changing or removing the driver. */ +for_each_present_cpu (cpu) { +if (cppc_auto_sel_is_immutable (cpu)) { + ret = -EOPNOTSUPP ; +break ; + } + } +cpus_read_unlock (); +if (ret) +return ret; } -return 0 ; +return mode_state_machine[cppc_state][mode_idx](mode_idx); }EXPORT_SYMBOL_FOR_PSTATE_UT (amd_pstate_update_status);
drivers/cpufreq/cppc_cpufreq.c +3 -2
@@ -890,6 +890,7 @@ static ssize_t store_auto_select(struct cpufreq_policy *policy, const char *buf, size_t count) {struct cppc_cpudata *cpu_data = policy->driver_data; +bool old_auto_sel = cpu_data->perf_ctrls.auto_sel;bool val;int ret;
@@ -918,8 +919,8 @@ static ssize_t store_auto_select(struct cpufreq_policy *policy,if (ret) { cpu_data->perf_ctrls.min_perf = old_min_perf; cpu_data->perf_ctrls.max_perf = old_max_perf; -cppc_set_auto_sel (policy->cpu, false); - cpu_data->perf_ctrls.auto_sel = false; +cppc_set_auto_sel (policy->cpu, old_auto_sel); + cpu_data->perf_ctrls.auto_sel = old_auto_sel;return ret; } }
include/acpi/cppc_acpi.h +6 -0
@@ -188,6 +188,7 @@ extern int cppc_set_epp(int cpu, u64 epp_val);extern int cppc_get_auto_act_window (int cpu,u64 *auto_act_window);extern int cppc_set_auto_act_window (int cpu,u64 auto_act_window);extern int cppc_get_auto_sel (int cpu,bool *enable); +bool cppc_auto_sel_is_immutable (int cpu);extern int cppc_set_auto_sel (int cpu,bool enable);extern int cppc_get_perf_limited (int cpu,u64 *perf_limited);extern int cppc_set_perf_limited (int cpu,u64 bits_to_clear);
@@ -289,6 +290,11 @@ static inline int cppc_get_auto_sel(int cpu, bool *enable) {return -EOPNOTSUPP ; } +static inline bool cppc_auto_sel_is_immutable (int cpu) +{ +return false; +} +static inline int cppc_set_auto_sel (int cpu,bool enable) {return -EOPNOTSUPP ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 36/507 xfs: reinitialize dquot block if non-first dquot cant load
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
[ Upstream commit faa9aa9e846332aaad78096a2cebfeafe68a7776 ]
LOLLM noticed that the early exit logic in xrep_quota_block is defective because it only looks in the first ondisk dquot for corruption that would prevent dquots from loading. We need to scan all the dquots in the block, not just the first one.
Stable-dep-of: 780212c8d810 ("xfs: forcibly reset quota timers when upgrading to bigtime during repair")
--- fs/xfs/scrub/quota_repair.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
fs/xfs/scrub/quota_repair.c +11 -5
@@ -297,7 +297,6 @@ xrep_quota_block( xfs_dqid_t id) {struct xfs_dqblk *dqblk; -struct xfs_disk_dquot *ddq;struct xfs_quotainfo *qi = sc->mp->m_quotainfo;struct xfs_def_quota *defq =xfs_get_defquota (qi, dqtype);struct xfs_buf *bp =NULL ;
@@ -319,14 +318,21 @@ xrep_quota_block(break ;case 0 : dqblk = bp->b_addr; - ddq = &dqblk[0 ].dd_diskdq; + error =0 ;/* * If there's nothing that would impede a dqiterate, we're * done. */ -if ((ddq->d_type &XFS_DQTYPE_REC_MASK ) == dqtype && - id ==be32_to_cpu (ddq->d_id)) { +for (i =0 ; i < qi->qi_dqperchunk; i++, dqblk++) { +struct xfs_disk_dquot *ddq = &dqblk->dd_diskdq; + +if ((ddq->d_type &XFS_DQTYPE_REC_MASK ) != dqtype || + id + i !=be32_to_cpu (ddq->d_id)) + error++; + } + +if (!error) {xfs_trans_brelse (sc->tp, bp);return 0 ; }
@@ -339,7 +345,7 @@ xrep_quota_block( dqblk = bp->b_addr; bp->b_ops = &xfs_dquot_buf_ops;for (i =0 ; i < qi->qi_dqperchunk; i++, dqblk++) { - ddq = &dqblk->dd_diskdq; +struct xfs_disk_dquot *ddq = &dqblk->dd_diskdq;trace_xrep_disk_dquot (sc->mp, dqtype, id + i);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 37/507 xfs: forcibly reset quota timers when upgrading to bigtime during repair
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
[ Upstream commit 780212c8d8105eadb5f56b4c7aafb94937755582 ]
If we decide to upgrade a dquot to BIGTIME as part of repairing it, we should zero out the timer fields so that they are re-evaluated and reset in bigtime format instead of letting through whatever was in there before.
--- fs/xfs/scrub/quota_repair.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
fs/xfs/scrub/quota_repair.c +16 -1
@@ -346,6 +346,8 @@ xrep_quota_block( bp->b_ops = &xfs_dquot_buf_ops;for (i =0 ; i < qi->qi_dqperchunk; i++, dqblk++) {struct xfs_disk_dquot *ddq = &dqblk->dd_diskdq; +bool was_bigtime = + !!(ddq->d_type &XFS_DQTYPE_BIGTIME );trace_xrep_disk_dquot (sc->mp, dqtype, id + i);
@@ -354,8 +356,21 @@ xrep_quota_block( ddq->d_type = dqtype; ddq->d_id =cpu_to_be32 (id + i); -if (xfs_has_bigtime (sc->mp) && ddq->d_id) +if (xfs_has_bigtime (sc->mp) && ddq->d_id) { +/* +* If something was broken with this dquot and it was a +* non-bigtime dquot, we'll grant everyone a fresh +* grace period by zeroing the timer field rather than +* try to interpret what might be garbage. +*/ +if (!was_bigtime) { + ddq->d_btimer =0 ; + ddq->d_itimer =0 ; + ddq->d_rtbtimer =0 ; + } + ddq->d_type |=XFS_DQTYPE_BIGTIME ; + } xrep_quota_fix_timer(sc->mp, ddq, ddq->d_blk_softlimit, ddq->d_bcount, &ddq->d_btimer,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 38/507 nfsd: shorten extack string returned with dodgy listener
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
[ Upstream commit 8d7859d165dbdf6e8d77b76500fc990f26c8310d ]
The kernel test robot reports:
Quoted 1 line
Quoted 1 line
fs/nfsd/nfsctl.c:2253:4: warning: 'snprintf' will always be truncated; specified size is 80, but format string expands to at least 94 [-Wformat-truncation]
Shorten the extack string in this case so that it will fit in 80 chars.
--- fs/nfsd/nfsctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfsctl.c +1 -1
@@ -2248,7 +2248,7 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info) bad_xprt); else if (skipped_rpcb) NL_SET_ERR_MSG_FMT(info->extack, -"cannot create %s listener; rpcbind did not answer earlier, so some listeners are not registered" , +"cannot create %s listener; rpcbind did not answer earlier" , bad_xprt); else NL_SET_ERR_MSG_FMT(info->extack,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 12/507 NFSD: map fh_verify() status codes for NFS_ACLv2 replies
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit ccfc4db5ab740175b9958ea0cf5986957bf4e659 ]
The NFS_ACL v2 protocol shares its status code space with NFSv2, which has no NFSERR_BADHANDLE and no NFSERR_NOFILEHANDLE. An NFS_ACLv2 GETACL, SETACL, GETATTR, or ACCESS request that carries a malformed or empty file handle gets a reply with status 10001 or 10020, values the client cannot interpret.
Commit 1459ad57673b ("nfsd: Move error code mapping to per-version proc code.") removed the version check from fh_verify() that turned those codes into NFSERR_STALE for any version 2 program. The NFSv2 procedures gained nfsd_map_status() in exchange, but the NFS_ACL v2 procedures did not, so the unmapped status reaches the encoder.
Add the same mapping to the NFS_ACL v2 procedures.
--- fs/nfsd/nfs2acl.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
fs/nfsd/nfs2acl.c +18 -0
@@ -57,6 +57,20 @@ static const struct nfsd_access_maps nfsd2_access_maps = { .other = nfsd2_otheraccess, }; +static __be32 nfsacld_map_status (__be32 status) +{ +switch (status) { +case nfserr_nofilehandle: +case nfserr_badhandle: + status = nfserr_stale; +break ; +case nfserr_wrongsec: + status = nfserr_acces; +break ; + } +return status; +} +/* * NULL call. */
@@ -121,6 +135,7 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst *rqstp)/* resp->acl_{access,default} are released in nfssvc_release_getacl. */ out: + resp->status =nfsacld_map_status (resp->status);return rpc_success; fail:
@@ -179,6 +194,7 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst *rqstp) out:/* argp->acl_{access,default} are released in nfsaclsvc_release_setacl. */ + resp->status =nfsacld_map_status (resp->status);return rpc_success; out_drop_lock:
@@ -205,6 +221,7 @@ static __be32 nfsacld_proc_getattr(struct svc_rqst *rqstp) goto out; resp->status =fh_getattr (&resp->fh, &resp->stat); out: + resp->status =nfsacld_map_status (resp->status);return rpc_success; }
@@ -229,6 +246,7 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp) goto out; resp->status =fh_getattr (&resp->fh, &resp->stat); out: + resp->status =nfsacld_map_status (resp->status);return rpc_success; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 39/507 cpufreq: CPPC: Select the frequency-invariance callback per CPU
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Loehle <[email protected]>
commit 21e018235d99bc86249b034c06646df8757b2852 upstream.
cppc_cpufreq_cpu_fie_init() initializes deferred work only for CPUs whose feedback counters use PCC. However, if any CPU in a shared policy uses PCC, it installs the PCC tick callback for the entire policy. With FIE enabled, a non-PCC CPU then queues an uninitialized irq_work and can call a NULL function pointer when that work runs.
Choose the frequency-invariance callback separately for each CPU using the recorded work-initialization state. Processor removal can unpublish the CPC descriptor before callback registration, so querying its counter transport again can incorrectly select direct reads for a PCC CPU.
Register the callbacks after all counter initialization has completed, so a failed initial read for an online CPU cannot leave a partially registered policy. PCC CPUs use their initialized deferred work, while non-PCC CPUs read their own counters directly from the tick.
--- drivers/acpi/cppc_acpi.c | 3 +++ drivers/cpufreq/cppc_cpufreq.c | 21 +++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-)
drivers/acpi/cppc_acpi.c +3 -0
@@ -1633,6 +1633,9 @@ bool cppc_perf_ctrs_in_pcc_cpu(unsigned int cpu) {struct cpc_desc *cpc_desc =per_cpu (cpc_desc_ptr, cpu); +if (!cpc_desc) +return false; +return CPC_IN_PCC (&cpc_desc->cpc_regs[DELIVERED_CTR ]) ||CPC_IN_PCC (&cpc_desc->cpc_regs[REFERENCE_CTR ]) ||CPC_IN_PCC (&cpc_desc->cpc_regs[CTR_WRAP_TIME ]);
drivers/cpufreq/cppc_cpufreq.c +15 -6
@@ -42,6 +42,7 @@ MODULE_PARM_DESC(fie_disabled, "Disable Frequency Invariance Engine (FIE)");/* Frequency invariance support */ struct cppc_freq_invariance {int cpu; +bool pcc_work_initialized;struct irq_work irq_work;struct kthread_work work;struct cppc_perf_fb_ctrs prev_perf_fb_ctrs;
@@ -152,7 +153,7 @@ static struct scale_freq_data cppc_sftd_pcc = {static void cppc_cpufreq_cpu_fie_init (struct cpufreq_policy *policy) { -struct scale_freq_data *sftd = &cppc_sftd; +struct scale_freq_data *sftd;struct cppc_freq_invariance *cppc_fi;int cpu, ret;
@@ -169,7 +170,7 @@ static void cppc_cpufreq_cpu_fie_init(struct cpufreq_policy *policy)kthread_init_work (&cppc_fi->work, cppc_scale_freq_workfn);init_irq_work (&cppc_fi->irq_work, cppc_irq_work); - sftd = &cppc_sftd_pcc; + cppc_fi->pcc_work_initialized = true; } ret =cppc_get_perf_ctrs (cpu, &cppc_fi->prev_perf_fb_ctrs);
@@ -185,8 +186,15 @@ static void cppc_cpufreq_cpu_fie_init(struct cpufreq_policy *policy) } } -/* Register for freq-invariance */ -topology_set_scale_freq_source (sftd, policy->cpus); +/* A shared policy may contain both PCC and non-PCC counters. */ +for_each_cpu (cpu, policy->cpus) { + cppc_fi = &per_cpu (cppc_freq_inv, cpu); +if (cppc_fi->pcc_work_initialized) + sftd = &cppc_sftd_pcc; +else + sftd = &cppc_sftd; +topology_set_scale_freq_source (sftd,cpumask_of (cpu)); + } }/*
@@ -209,11 +217,12 @@ static void cppc_cpufreq_cpu_fie_exit(struct cpufreq_policy *policy)topology_clear_scale_freq_source (SCALE_FREQ_SOURCE_CPPC , policy->related_cpus);for_each_cpu (cpu, policy->related_cpus) { -if (!cppc_perf_ctrs_in_pcc_cpu (cpu)) -continue ; cppc_fi = &per_cpu (cppc_freq_inv, cpu); +if (!cppc_fi->pcc_work_initialized) +continue ;irq_work_sync (&cppc_fi->irq_work);kthread_cancel_work_sync (&cppc_fi->work); + cppc_fi->pcc_work_initialized = false; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 40/507 media: uvcvideo: Add autosuspend quirk for AVerMedia Live Gamer HD 2
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit b79251c881bb39f70c6f6fb30ad5d454b78c9f4a ]
A user has reported that this device gets stuck in a loop where every few seconds it will turn off and turn back on, causing audio devices to disappear and reappear, its LED to flash, spamming dmesg, etc. This only happens when not in use; everything is fine when the video device is actually being used.
They also reported that using the AUTOSUSPEND quirk via module parameters fixes the issue.
Add the device to the quirk list.
ID 07ca:1570 AVerMedia Technologies, Inc. AVerMedia USB Device Negotiated speed: High Speed (480Mbps)
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.10
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 [unknown]
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x07ca AVerMedia Technologies, Inc.
idProduct 0x1570 AVerMedia USB Device
bcdDevice 1.00
iManufacturer 6 AVerMedia iProduct 7 AVerMedia USB Device iSerial 3 53106326013650 bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x01d6
bNumInterfaces 4
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 150mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 14 Video
bFunctionSubClass 3 Video Interface Collection
bFunctionProtocol 0
iFunction 8 AVerMedia Live Gamer HD 2
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 14 Video
bInterfaceSubClass 1 Video Control
bInterfaceProtocol 0
iInterface 8 AVerMedia Live Gamer HD 2
VideoControl Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdUVC 1.00
wTotalLength 0x004d
dwClockFrequency 120.000000MHz
bInCollection 1
baInterfaceNr( 0) 1
VideoControl Interface Descriptor:
bLength 18
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0201 Camera Sensor
bAssocTerminal 0
iTerminal 0
wObjectiveFocalLengthMin 0
wObjectiveFocalLengthMax 0
wOcularFocalLength 0
bControlSize 3
bmControls 0x00000000
VideoControl Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 5 (PROCESSING_UNIT)
Warning: Descriptor too short
bUnitID 3
bSourceID 1
wMaxMultiplier 0
bControlSize 2
bmControls 0x0000000f
Brightness
Contrast
Hue
Saturation
iProcessing 0
bmVideoStandards 0x09
None
SECAM - 625/50
VideoControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 2
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 4
iTerminal 0
VideoControl Interface Descriptor:
bLength 28
bDescriptorType 36
bDescriptorSubtype 6 (EXTENSION_UNIT)
bUnitID 4
guidExtensionCode {c66d125b-0480-0844-8c26-b8363a84de63}
bNumControls 17
bNrInPins 1
baSourceID( 0) 3
bControlSize 3
bmControls( 0) 0x07
bmControls( 1) 0xfe
bmControls( 2) 0x01
iExtension 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 8 AVerMedia Live Gamer HD 2
VideoStreaming Interface Descriptor:
bLength 14
bDescriptorType 36
bDescriptorSubtype 1 (INPUT_HEADER)
bNumFormats 1
wTotalLength 0x00bd
bEndpointAddress 0x89 EP 9 IN
bmInfo 0
bTerminalLink 2
bStillCaptureMethod 0
bTriggerSupport 0
bTriggerUsage 0
bControlSize 1
bmaControls( 0) 0
VideoStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 6 (FORMAT_MJPEG)
bFormatIndex 1
bNumFrameDescriptors 5
bFlags 0
Fixed-size samples: No
bDefaultFrameIndex 1
bAspectRatioX 0
bAspectRatioY 0
bmInterlaceFlags 0x00
Interlaced stream or variable: No
Fields per frame: 1 fields
Field 1 first: No
Field pattern: Field 1 only
bCopyProtect 0
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 1
bmCapabilities 0x00
Still image unsupported
wWidth 640
wHeight 480
dwMinBitRate 294617088
dwMaxBitRate 294912000
dwMaxVideoFrameBufferSize 614400
dwDefaultFrameInterval 166833
bFrameIntervalType 2
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 2
bmCapabilities 0x00
Still image unsupported
wWidth 720
wHeight 480
dwMinBitRate 331444224
dwMaxBitRate 331776000
dwMaxVideoFrameBufferSize 691200
dwDefaultFrameInterval 166833
bFrameIntervalType 2
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 3
bmCapabilities 0x00
Still image unsupported
wWidth 720
wHeight 576
dwMinBitRate 331776000
dwMaxBitRate 331776000
dwMaxVideoFrameBufferSize 829440
dwDefaultFrameInterval 200000
bFrameIntervalType 1
dwFrameInterval( 0) 200000
VideoStreaming Interface Descriptor:
bLength 38
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 4
bmCapabilities 0x00
Still image unsupported
wWidth 1280
wHeight 720
dwMinBitRate 737280000
dwMaxBitRate 884736000
dwMaxVideoFrameBufferSize 1843200
dwDefaultFrameInterval 166666
bFrameIntervalType 3
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
dwFrameInterval( 2) 200000
VideoStreaming Interface Descriptor:
bLength 46
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 5
bmCapabilities 0x00
Still image unsupported
wWidth 1920
wHeight 1080
dwMinBitRate 994332672
dwMaxBitRate 1990656000
dwMaxVideoFrameBufferSize 4147200
dwDefaultFrameInterval 166666
bFrameIntervalType 5
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
dwFrameInterval( 2) 200000
dwFrameInterval( 3) 333333
dwFrameInterval( 4) 333667
VideoStreaming Interface Descriptor:
bLength 6
bDescriptorType 36
bDescriptorSubtype 13 (COLORFORMAT)
bColorPrimaries 1 (BT.709,sRGB)
bTransferCharacteristics 1 (BT.709)
bMatrixCoefficients 4 (SMPTE 170M (BT.601))
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 8 AVerMedia Live Gamer HD 2
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x89 EP 9 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x1400 3x 1024 bytes
bInterval 1
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 2
bInterfaceCount 2
bFunctionClass 1 Audio
bFunctionSubClass 2 Streaming
bFunctionProtocol 0
iFunction 9 AVerMedia Live Gamer HD 2
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 1 Control Device
bInterfaceProtocol 0
iInterface 9 AVerMedia Live Gamer HD 2
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 1.00
wTotalLength 0x003a
bInCollection 1
baInterfaceNr(0) 3
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0602 Digital Audio Interface
bAssocTerminal 0
bNrChannels 1
wChannelConfig 0x0000
iChannelNames 0
iTerminal 0
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 5
wTerminalType 0x0603 Line Connector
bAssocTerminal 0
bNrChannels 1
wChannelConfig 0x0000
iChannelNames 0
iTerminal 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 2
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 3
iTerminal 0
AudioControl Interface Descriptor:
bLength 8
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 3
bSourceID 4
bControlSize 1
bmaControls(0) 0x01
Mute Control
iFeature 0
AudioControl Interface Descriptor:
bLength 8
bDescriptorType 36
bDescriptorSubtype 5 (SELECTOR_UNIT)
bUnitID 4
bNrInPins 2
baSourceID(0) 1
baSourceID(1) 5
iSelector 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 9 AVerMedia Live Gamer HD 2
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 9 AVerMedia Live Gamer HD 2
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 2
bDelay 1 frames
wFormatTag 0x0001 PCM
AudioStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 2
bSubframeSize 2
bBitResolution 16
bSamFreqType 1 Discrete
tSamFreq[ 0] 48000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x8a EP 10 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x00c0 1x 192 bytes
bInterval 4
bRefresh 0
bSynchAddress 0
AudioStreaming Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0x0000
Binary Object Store Descriptor:
bLength 5
bDescriptorType 15
wTotalLength 0x0016
bNumDeviceCaps 2
USB 2.0 Extension Device Capability:
bLength 7
bDescriptorType 16
bDevCapabilityType 2
bmAttributes 0x00000006
BESL Link Power Management (LPM) Supported
SuperSpeed USB Device Capability:
bLength 10
bDescriptorType 16
bDevCapabilityType 3
bmAttributes 0x00
wSpeedsSupported 0x000e
Device can operate at Full Speed (12Mbps)
Device can operate at High Speed (480Mbps) Device can operate at SuperSpeed (5Gbps)
bFunctionalitySupport 1
Lowest fully-functional device speed is Full Speed (12Mbps)
bU1DevExitLat 4 micro seconds
bU2DevExitLat 4 micro seconds
Device Status: 0x0000
(Bus Powered)
--- drivers/media/usb/uvc/uvc_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/media/usb/uvc/uvc_driver.c +9 -0
@@ -2851,6 +2851,15 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth }, +/* AVerMedia Live Gamer HD 2 capture card */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x07ca, + .idProduct = 0x1570, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_DISABLE_AUTOSUSPEND) }, /* ViMicro Vega */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 41/507 media: uvcvideo: Force UVC version for Avermedia GC515
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit 65444446f0c595c0e250368cde88735b59ccc446 ]
The device announces itself as UVC 1.5, but it only accepts UVC 1.1 controls.
The camera can probably be handled by the automatic uvc_version handler, but it is more correct to add a quirk and keep some tracking of what vendors are more or less compliant. Also it might be more robust if we introduce more UVC version-dependent code.
Bus 003 Device 021: ID 07ca:1515 AVerMedia Technologies, Inc. X'tra Go GC515 Negotiated speed: High Speed (480Mbps)
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 [unknown]
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x07ca AVerMedia Technologies, Inc.
idProduct 0x1515 X'tra Go GC515
bcdDevice 0.10
iManufacturer 1 AVerMedia iProduct 2 X'tra Go GC515 iSerial 3 5313180000221 bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x03fd
bNumInterfaces 4
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 500mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 14 Video
bFunctionSubClass 3 Video Interface Collection
bFunctionProtocol 0
iFunction 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 1 Video Control
bInterfaceProtocol 1
iInterface 0
VideoControl Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdUVC 1.50
wTotalLength 0x0059
dwClockFrequency 30.000000MHz
bInCollection 1
baInterfaceNr( 0) 1
VideoControl Interface Descriptor:
bLength 18
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0201 Camera Sensor
bAssocTerminal 0
iTerminal 0
wObjectiveFocalLengthMin 0
wObjectiveFocalLengthMax 0
wOcularFocalLength 0
bControlSize 3
bmControls 0x00000000
VideoControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 2
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 4
iTerminal 0
VideoControl Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 4 (SELECTOR_UNIT)
bUnitID 3
bNrInPins 1
baSource( 0) 1
iSelector 0
VideoControl Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 5 (PROCESSING_UNIT)
bUnitID 4
bSourceID 3
wMaxMultiplier 0
bControlSize 3
bmControls 0x00000000
iProcessing 0
bmVideoStandards 0x00
VideoControl Interface Descriptor:
bLength 29
bDescriptorType 36
bDescriptorSubtype 6 (EXTENSION_UNIT)
bUnitID 5
guidExtensionCode {55be8e1c-2fdb-4f7a-bd8d-b9b1108d20c3}
bNumControls 24
bNrInPins 1
baSourceID( 0) 4
bControlSize 4
bmControls( 0) 0xff
bmControls( 1) 0xff
bmControls( 2) 0xff
bmControls( 3) 0x00
iExtension 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x85 EP 5 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
VideoControl Endpoint Descriptor:
bLength 5
bDescriptorType 37
bDescriptorSubtype 3 (EP_INTERRUPT)
wMaxTransferSize 64
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 1
iInterface 0
VideoStreaming Interface Descriptor:
bLength 16
bDescriptorType 36
bDescriptorSubtype 1 (INPUT_HEADER)
bNumFormats 3
wTotalLength 0x0303
bEndpointAddress 0x81 EP 1 IN
bmInfo 0
bTerminalLink 2
bStillCaptureMethod 1
bTriggerSupport 0
bTriggerUsage 0
bControlSize 1
bmaControls( 0) 4
bmaControls( 1) 4
bmaControls( 2) 0
VideoStreaming Interface Descriptor:
bLength 28
bDescriptorType 36
bDescriptorSubtype 16 (FORMAT_FRAME_BASED)
bFormatIndex 1
bNumFrameDescriptors 8
guidFormat {34363248-0000-0010-8000-00aa00389b71}
bBitsPerPixel 24
bDefaultFrameIndex 1
bAspectRatioX 0
bAspectRatioY 0
bmInterlaceFlags 0x00
Interlaced stream or variable: No
Fields per frame: 2 fields
Field 1 first: No
Field pattern: Field 1 only
bCopyProtect 1
bVariableSize 1
VideoStreaming Interface Descriptor:
bLength 62
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 1
bmCapabilities 0x01
Still image supported
wWidth 1920
wHeight 1080
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 166666
bFrameIntervalType 9
dwBytesPerLine 0
dwFrameInterval( 0) 83333
dwFrameInterval( 1) 83416
dwFrameInterval( 2) 166666
dwFrameInterval( 3) 166833
dwFrameInterval( 4) 200000
dwFrameInterval( 5) 333333
dwFrameInterval( 6) 333667
dwFrameInterval( 7) 400000
dwFrameInterval( 8) 416666
VideoStreaming Interface Descriptor:
bLength 42
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 2
bmCapabilities 0x01
Still image supported
wWidth 3840
wHeight 2160
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 333333
bFrameIntervalType 4
dwBytesPerLine 0
dwFrameInterval( 0) 333333
dwFrameInterval( 1) 333667
dwFrameInterval( 2) 400000
dwFrameInterval( 3) 416666
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 3
bmCapabilities 0x01
Still image supported
wWidth 2560
wHeight 1440
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 166666
bFrameIntervalType 2
dwBytesPerLine 0
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 4
bmCapabilities 0x01
Still image supported
wWidth 1280
wHeight 800
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 166666
bFrameIntervalType 2
dwBytesPerLine 0
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
VideoStreaming Interface Descriptor:
bLength 38
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 5
bmCapabilities 0x01
Still image supported
wWidth 1280
wHeight 720
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 166666
bFrameIntervalType 3
dwBytesPerLine 0
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
dwFrameInterval( 2) 200000
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 6
bmCapabilities 0x01
Still image supported
wWidth 720
wHeight 576
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 200000
bFrameIntervalType 2
dwBytesPerLine 0
dwFrameInterval( 0) 200000
dwFrameInterval( 1) 400000
VideoStreaming Interface Descriptor:
bLength 42
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 7
bmCapabilities 0x01
Still image supported
wWidth 720
wHeight 480
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 166666
bFrameIntervalType 4
dwBytesPerLine 0
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
dwFrameInterval( 2) 333333
dwFrameInterval( 3) 333667
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 8
bmCapabilities 0x01
Still image supported
wWidth 640
wHeight 480
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 166666
bFrameIntervalType 2
dwBytesPerLine 0
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
VideoStreaming Interface Descriptor:
bLength 6
bDescriptorType 36
bDescriptorSubtype 13 (COLORFORMAT)
bColorPrimaries 0 (Unspecified)
bTransferCharacteristics 0 (Unspecified)
bMatrixCoefficients 0 (Unspecified)
VideoStreaming Interface Descriptor:
bLength 28
bDescriptorType 36
bDescriptorSubtype 16 (FORMAT_FRAME_BASED)
bFormatIndex 2
bNumFrameDescriptors 8
guidFormat {43564548-0000-0010-8000-00aa00389b71}
bBitsPerPixel 24
bDefaultFrameIndex 1
bAspectRatioX 0
bAspectRatioY 0
bmInterlaceFlags 0x00
Interlaced stream or variable: No
Fields per frame: 2 fields
Field 1 first: No
Field pattern: Field 1 only
bCopyProtect 1
bVariableSize 1
VideoStreaming Interface Descriptor:
bLength 62
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 1
bmCapabilities 0x01
Still image supported
wWidth 1920
wHeight 1080
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 166666
bFrameIntervalType 9
dwBytesPerLine 0
dwFrameInterval( 0) 83333
dwFrameInterval( 1) 83416
dwFrameInterval( 2) 166666
dwFrameInterval( 3) 166833
dwFrameInterval( 4) 200000
dwFrameInterval( 5) 333333
dwFrameInterval( 6) 333667
dwFrameInterval( 7) 400000
dwFrameInterval( 8) 416666
VideoStreaming Interface Descriptor:
bLength 42
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 2
bmCapabilities 0x01
Still image supported
wWidth 3840
wHeight 2160
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 333333
bFrameIntervalType 4
dwBytesPerLine 0
dwFrameInterval( 0) 333333
dwFrameInterval( 1) 333667
dwFrameInterval( 2) 400000
dwFrameInterval( 3) 416666
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 3
bmCapabilities 0x01
Still image supported
wWidth 2560
wHeight 1440
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 166666
bFrameIntervalType 2
dwBytesPerLine 0
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 4
bmCapabilities 0x01
Still image supported
wWidth 1280
wHeight 800
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 166666
bFrameIntervalType 2
dwBytesPerLine 0
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
VideoStreaming Interface Descriptor:
bLength 38
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 5
bmCapabilities 0x01
Still image supported
wWidth 1280
wHeight 720
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 166666
bFrameIntervalType 3
dwBytesPerLine 0
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
dwFrameInterval( 2) 200000
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 6
bmCapabilities 0x01
Still image supported
wWidth 720
wHeight 576
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 200000
bFrameIntervalType 2
dwBytesPerLine 0
dwFrameInterval( 0) 200000
dwFrameInterval( 1) 400000
VideoStreaming Interface Descriptor:
bLength 42
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 7
bmCapabilities 0x01
Still image supported
wWidth 720
wHeight 480
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 166666
bFrameIntervalType 4
dwBytesPerLine 0
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
dwFrameInterval( 2) 333333
dwFrameInterval( 3) 333667
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 17 (FRAME_FRAME_BASED)
bFrameIndex 8
bmCapabilities 0x01
Still image supported
wWidth 640
wHeight 480
dwMinBitRate 33554432
dwMaxBitRate 268435456
dwDefaultFrameInterval 166666
bFrameIntervalType 2
dwBytesPerLine 0
dwFrameInterval( 0) 166666
dwFrameInterval( 1) 166833
VideoStreaming Interface Descriptor:
bLength 6
bDescriptorType 36
bDescriptorSubtype 13 (COLORFORMAT)
bColorPrimaries 0 (Unspecified)
bTransferCharacteristics 0 (Unspecified)
bMatrixCoefficients 0 (Unspecified)
VideoStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 6 (FORMAT_MJPEG)
bFormatIndex 3
bNumFrameDescriptors 1
bFlags 0
Fixed-size samples: No
bDefaultFrameIndex 1
bAspectRatioX 0
bAspectRatioY 0
bmInterlaceFlags 0x00
Interlaced stream or variable: No
Fields per frame: 1 fields
Field 1 first: No
Field pattern: Field 1 only
bCopyProtect 1
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 1
bmCapabilities 0x01
Still image supported
wWidth 1920
wHeight 1080
dwMinBitRate 314572800
dwMaxBitRate 314572800
dwMaxVideoFrameBufferSize 4147200
dwDefaultFrameInterval 166666
bFrameIntervalType 1
dwFrameInterval( 0) 166666
VideoStreaming Interface Descriptor:
bLength 6
bDescriptorType 36
bDescriptorSubtype 13 (COLORFORMAT)
bColorPrimaries 0 (Unspecified)
bTransferCharacteristics 0 (Unspecified)
bMatrixCoefficients 0 (Unspecified)
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 2
bInterfaceCount 2
bFunctionClass 1 Audio
bFunctionSubClass 2 Streaming
bFunctionProtocol 0
iFunction 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 1 Control Device
bInterfaceProtocol 0
iInterface 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 1.00
wTotalLength 0x0026
bInCollection 1
baInterfaceNr(0) 3
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0602 Digital Audio Interface
bAssocTerminal 0
bNrChannels 2
wChannelConfig 0x0003
Left Front (L)
Right Front (R)
iChannelNames 0
iTerminal 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 2
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 3
iTerminal 0
AudioControl Interface Descriptor:
bLength 8
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 3
bSourceID 1
bControlSize 1
bmaControls(0) 0x03
Mute Control
Volume Control
iFeature 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 2
bDelay 1 frames
wFormatTag 0x0001 PCM
AudioStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 2
bSubframeSize 2
bBitResolution 16
bSamFreqType 1 Discrete
tSamFreq[ 0] 48000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x00c4 1x 196 bytes
bInterval 4
bRefresh 0
bSynchAddress 0
AudioStreaming Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0x0000
--- drivers/media/usb/uvc/uvc_driver.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/media/usb/uvc/uvc_driver.c +11 -0
@@ -2851,6 +2851,17 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = (kernel_ulong_t)&uvc_quirk_fix_bandwidth }, +/* Avermedia GC515 */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x07ca, + .idProduct = 0x1515, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = UVC_PC_PROTOCOL_15, + .driver_info = (kernel_ulong_t)&(const struct uvc_device_info ){ + .uvc_version =0x0110 , + } }, /* AVerMedia Live Gamer HD 2 capture card */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 42/507 mm/damon/sysfs-schemes: read sysfs_filter->sz_range only once
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: SJ Park <[email protected]>
[ Upstream commit af19aff38d6faea35b10f26cca32d0e54f8aea5e ]
DAMON sysfs interface reads the user-provided size range arguments for hugepage_size type DAMOS filter twice. Once for validation, and once again for assignments to the variable that will be passed to the core layer. If the user updates the arguments in parallel, an invalid size range could be passed to the core layer. Avoid it by doing the assignments first, and then validating the assigned variables before passing those to the core layer.
User impact of the bug should be trivial. From the core layer's perspective, the invalid size range is not really invalid. It just works as having a weird size range. No critical issues such as a crash or a leak could happen. And sane users ain't do such parallel arguments update anyway. If they do, such racy behavior is arguably somewhat expected and deserved. That said, there is no reason to keep such races.
--- mm/damon/sysfs-schemes.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
mm/damon/sysfs-schemes.c +2 -3
@@ -2831,12 +2831,11 @@ static int damon_sysfs_add_scheme_filters(struct damos *scheme, }else if (filter->type ==DAMOS_FILTER_TYPE_TARGET ) { filter->target_idx = sysfs_filter->target_idx; }else if (filter->type ==DAMOS_FILTER_TYPE_HUGEPAGE_SIZE ) { -if (sysfs_filter->sz_range.min > - sysfs_filter->sz_range.max) { + filter->sz_range = sysfs_filter->sz_range; +if (filter->sz_range.min > filter->sz_range.max) {damos_destroy_filter (filter);return -EINVAL ; } - filter->sz_range = sysfs_filter->sz_range; }damos_add_filter (scheme, filter);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 43/507 9p: fix privport option setting wrong RDMA field
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Garzarella <[email protected]>
[ Upstream commit 7fb9bd3659051ff74a29387de0023bb8300e4aa7 ]
While reviewing a patch adding vsock transport to 9p, I noticed that since commit 1f3e4142c0eb ("9p: convert to the new mount API"), the Opt_privport case incorrectly sets rdma_opts->port instead of rdma_opts->privport, so mounting with the privport option overwrites the RDMA port number instead of enabling privileged port usage.
Message-ID: <[email protected]>
--- fs/9p/v9fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/9p/v9fs.c +1 -1
@@ -406,7 +406,7 @@ int v9fs_parse_param(struct fs_context *fc, struct fs_parameter *param)break ;case Opt_privport: fd_opts->privport = true; - rdma_opts->port = true; + rdma_opts->privport = true;break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 44/507 net/9p/usbg: fix prefix matching in device lookup
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yizhou Zhao <[email protected]>
[ Upstream commit 9ee83ef8d24f11feb55fd0d222c0ec19f09dbd3f ]
p9_usbg_create() matches the mount source against registered usb9pfs instance tags with strncmp() and the length of the caller supplied source. That accepts any prefix of the registered tag.
For example, a gadget instance tagged "secret_channel" can be selected with "s", "sec", or any other non-empty prefix. Once selected, the instance is marked in use and the client is attached to that transport. This differs from the configfs tag lookup path, which uses strcmp() and therefore requires an exact tag match.
Require an exact tag match in p9_usbg_create() as well.
Message-ID: <[email protected]>
Message-ID: <[email protected]>
--- net/9p/trans_usbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/9p/trans_usbg.c +1 -1
@@ -391,7 +391,7 @@ static int p9_usbg_create(struct p9_client *client, struct fs_context *fc)guard (mutex)(&usb9pfs_lock);list_for_each_entry (dev, &usbg_instance_list, usb9pfs_instance) { -if (!strncmp (devname, dev->tag,strlen (devname))) { +if (!strcmp (devname, dev->tag)) {if (!dev->inuse) { dev->inuse = true; found =1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 45/507 xfrm: retry inexact policy lookup after node reinsertion
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <[email protected]>
[ Upstream commit 868f63c8bfafa9b827168c9126f85264c39c02ec ]
An inexact policy lookup first records pointers to candidate hlist heads and then traverses the lists. A concurrent policy insertion can merge inexact tree nodes between those operations:
lookup policy insertion
------ ----------------
find inexact candidates
save obsolete hlist head
write_seqcount_begin(&bin->count)
merge inexact tree nodes
hlist_del_rcu(&policy->bydst)
reinsert policy->bydst in survivor
write_seqcount_end(&bin->count) evaluate saved candidate list
miss the moved policy
The merge immediately reinserts the same hlist node into the surviving tree node. RCU keeps the policy alive, but it does not provide a consistent view while its list node is moved. A lookup that selected the obsolete list can observe it empty. A lookup already traversing a moved policy can instead follow the next pointer rewritten by the reinsertion. Either case can return an incorrect IPsec policy result.
The per-bin sequence counter already brackets calls to xfrm_policy_inexact_insert_node(), including node merges. The read side, however, currently validates the counter only while searching an individual rb-tree. A successful search returns without validation, and the later candidate-list traversal is outside that read-side section.
Snapshot the per-bin sequence before discovering candidate heads and
validate it after evaluating all candidate lists. Retry the lookup if
the inexact policy tree changes while it is being searched.
--- net/xfrm/xfrm_policy.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
net/xfrm/xfrm_policy.c +9 -2
@@ -2157,6 +2157,7 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,struct xfrm_pol_inexact_bin *bin;struct xfrm_policy *pol, *ret;struct hlist_head *chain; +unsigned int inexact_sequence;unsigned int sequence;int err;
@@ -2191,12 +2192,18 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type, goto skip_inexact; bin =xfrm_policy_inexact_lookup_rcu (net, type, family, dir, if_id); -if (!bin || !xfrm_policy_find_inexact_candidates (&cand, bin, saddr, - daddr)) +if (!bin) + goto skip_inexact; + + inexact_sequence =read_seqcount_begin (&bin->count); +if (!xfrm_policy_find_inexact_candidates (&cand, bin, saddr, daddr)) goto skip_inexact; pol =xfrm_policy_eval_candidates (&cand, ret, fl, type, family, if_id); +if (read_seqcount_retry (&bin->count, inexact_sequence)) + goto retry; +if (pol) { ret = pol;if (IS_ERR (pol))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 46/507 net/9p/usbg: clear stale request context after abort
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <[email protected]>
[ Upstream commit b58943dd690eb9b76c652e735789937a03f3d30c ]
usb9pfs_clear_tx() serializes access to the active TX request with usb9pfs->lock, but leaves in_req->context pointing at the request after p9_client_cb() drops the transport reference. A later teardown path can therefore retrieve the same request after it has been freed:
CPU 0 (p9_usbg_close) CPU 1 (usb9pfs_disable)
lock(usb9pfs->lock)
req = in_req->context
p9_client_cb(client, req)
p9_req_put(client, req)
unlock(usb9pfs->lock)
request reaches zero refs
kmem_cache_free(req)
lock(usb9pfs->lock)
req = in_req->context
read req->t_errThe lock orders the two callbacks, but cannot protect a pointer that remains published after its reference has been released. KASAN reported:
BUG: KASAN: slab-use-after-free in usb9pfs_clear_tx+0x166/0x1b0 Read of size 4 at addr ffff88810e7420f4 by task poc/94 Call Trace: usb9pfs_clear_tx+0x166/0x1b0 usb9pfs_disable+0x1d/0x30 reset_config+0x9d/0x200 __composite_disconnect+0xa7/0x140 Allocated by task 93: kmem_cache_alloc_noprof+0x141/0x370 p9_tag_alloc+0x8f/0x5b0 p9_client_prepare_req+0xff/0x350 p9_client_rpc+0x1a5/0xac0 Freed by task 0: slab_free_after_rcu_debug+0xa6/0x1e0 rcu_core+0x50a/0x1850 Last potentially related work creation: kmem_cache_free+0x1db/0x3d0 p9_req_put+0x164/0x1f0 usb9pfs_clear_tx+0x120/0x1b0 p9_usbg_close+0x7e/0x150
Clear in_req->context after the callback while still holding the lock. This matches the consume-and-clear pattern in usb9pfs_tx_complete(), so subsequent teardown calls return without touching the released request. The existing callback and error ordering remain unchanged.
Message-ID: <[email protected]>
--- net/9p/trans_usbg.c | 1 + 1 file changed, 1 insertion(+)
net/9p/trans_usbg.c +1 -0
@@ -439,6 +439,7 @@ static void usb9pfs_clear_tx(struct f_usb9pfs *usb9pfs) req->t_err = -ECONNRESET ;p9_client_cb (usb9pfs->client, req,REQ_STATUS_ERROR ); + usb9pfs->in_req->context =NULL ; }static void p9_usbg_close (struct p9_client *client)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 47/507 9p/trans_virtio: reject mount tags longer than NAME_MAX at probe
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
[ Upstream commit 5bfef2b6dafe83fe2d8d210d54093a8f48cfc97e ]
p9_virtio_probe() reads a 16-bit mount tag length (tag_len) from the device config and kzalloc()s tag_len + 1 bytes for chan->tag with no upper bound. A malicious or compromised host can present a tag of up to 65535 bytes; that tag is later copied into the single-page sysfs buffer by p9_mount_tag_show() (memcpy(buf, chan->tag, tag_len + 1)), a host-controlled out-of-bounds write of up to ~64 KiB past the PAGE_SIZE attribute buffer.
Reject an overlong tag at probe time. A 9p mount tag is a name-like identifier, so bound it by NAME_MAX (255): that limit is independent of the sysfs/seq_file page size and is far above any legitimate mount tag, which keeps p9_mount_tag_show() safe at the root without hard-coding a seq_file implementation detail.
Message-ID: <[email protected]>
--- net/9p/trans_virtio.c | 5 +++++ 1 file changed, 5 insertions(+)
net/9p/trans_virtio.c +5 -0
@@ -633,6 +633,11 @@ static int p9_virtio_probe(struct virtio_device *vdev) err = -EINVAL ; goto out_free_vq; } +if (tag_len >NAME_MAX ) { +dev_err (&vdev->dev,"mount tag too long (%u bytes)\n" , tag_len); + err = -EINVAL ; + goto out_free_vq; + } tag =kzalloc (tag_len +1 ,GFP_KERNEL );if (!tag) { err = -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 48/507 9p/xen: fix refcount leak in p9_xen_response() on wrong tag
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifei Gao <[email protected]>
[ Upstream commit 4d183e6f153245aca2534e372152583b868dd925 ]
p9_xen_response() looks up the request for an incoming reply with p9_tag_lookup(), which takes a reference on the returned p9_req_t. When the tag does not resolve to a request in REQ_STATUS_SENT, the function warns and continues the loop without dropping that reference, permanently leaking the p9_req_t and its msize buffers. The reply header, including the tag, is supplied by the backend, so a malicious or buggy 9P backend can leak kernel memory on every crafted response.
Drop the reference before continuing.
Message-ID: <[email protected]>
--- net/9p/trans_xen.c | 2 ++ 1 file changed, 2 insertions(+)
net/9p/trans_xen.c +2 -0
@@ -203,6 +203,8 @@ static void p9_xen_response(struct work_struct *work) req =p9_tag_lookup (priv->client, h.tag);if (!req || req->status !=REQ_STATUS_SENT ) {dev_warn (&priv->dev->dev,"Wrong req tag=%x\n" , h.tag); +if (req) +p9_req_put (priv->client, req); cons += h.size;virt_mb (); ring->intf->in_cons = cons;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 13/507 NFSD: report listener creation failures through extack
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
[ Upstream commit 8e590a16853fedd2697a3b0c32b3cbf1a444f7b2 ]
nfsd_nl_listener_set_doit() returns the raw errno from svc_xprt_create_from_sa() and sets no extack. A failed LISTENER_SET therefore tells userland only "Address already in use", or whatever else the transport returned. It never tells userland which entry failed.
Record the attribute and the transport name of the entry whose errno the call returns, and report both after the loop. NL_SET_BAD_ATTR() names the entry, which the message alone cannot do: a request can carry several entries with the same transport name.
The rejections in nfsd_nl_validate_listeners() other than -E2BIG and the unsupported transport name still carry no extack. This patch does not change them.
Stable-dep-of: bf0f3a37e6cc ("NFSD: stop registering with rpcbind after a failure in listener_set")
--- fs/nfsd/nfsctl.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
fs/nfsd/nfsctl.c +17 -1
@@ -2086,7 +2086,9 @@ static int nfsd_nl_validate_listeners(struct genl_info *info)int nfsd_nl_listener_set_doit (struct sk_buff *skb,struct genl_info *info) {struct net *net =genl_info_net (info); +const struct nlattr *bad_attr =NULL ;struct svc_xprt *xprt, *tmp; +const char *bad_xprt =NULL ;const struct nlattr *attr;struct svc_serv *serv;LIST_HEAD (permsocks);
@@ -2205,8 +2207,22 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info) ret =svc_xprt_create_from_sa (serv, xcl_name, net, sa,0 ,current_cred ());/* always save the latest error */ -if (ret <0 ) +if (ret <0 ) { + bad_attr = attr; + bad_xprt = xcl_name; err = ret; + } + } + +/* +* The ack carries the errno of the last entry that failed. Point at +* that entry as well, since several entries can share a transport +* name and the errno alone cannot tell them apart. +*/ +if (err) { +NL_SET_BAD_ATTR (info->extack, bad_attr); +NL_SET_ERR_MSG_FMT (info->extack,"cannot create %s listener" , + bad_xprt); }if (!serv->sv_nrthreads &&list_empty (&nn->nfsd_serv->sv_permsocks))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 49/507 9p: fix caches_show() out-of-bounds write
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Zhang <[email protected]>
[ Upstream commit 2acd800de8827b7cdce8cb5c2c63b8e8608ec8e3 ]
The sysfs show handler for /sys/fs/9p/caches appends cache tags with snprintf(buf + count, limit, ...) and then advances count and limit by the return value. This is incorrect for truncation because snprintf() returns the full would-have-been length, not the number of bytes stored.
Once the accumulated output exceeds PAGE_SIZE, count can advance past the sysfs buffer and limit can become negative. A later iteration then passes an out-of-bounds destination pointer and an oversized size_t into snprintf(), leading to an out-of-bounds write.
Use sysfs_emit_at() for the append instead. It follows the sysfs buffer contract and returns the number of bytes actually stored, so the offset remains bounded even when the output is truncated.
Message-ID: <abfb65f4800634dafb08238bba20cb48797e796f.1781908090.git.zzhan461@ucr.edu>
--- fs/9p/v9fs.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
fs/9p/v9fs.c +5 -11
@@ -17,6 +17,7 @@#include <linux/fs_context.h> #include <linux/slab.h> #include <linux/seq_file.h> +#include <linux/sysfs.h> #include <net/9p/9p.h> #include <net/9p/client.h> #include <net/9p/transport.h>
@@ -617,21 +618,14 @@ static ssize_t caches_show(struct kobject *kobj,struct kobj_attribute *attr, char *buf) { - ssize_t n = 0, count = 0, limit = PAGE_SIZE; + ssize_t count = 0;struct v9fs_session_info *v9ses;spin_lock (&v9fs_sessionlist_lock);list_for_each_entry (v9ses, &v9fs_sessionlist, slist) { -if (v9ses->cachetag) { - n =snprintf (buf + count, limit,"%s\n" , v9ses->cachetag); -if (n <0 ) { - count = n; -break ; - } - - count += n; - limit -= n; - } +if (v9ses->cachetag) + count +=sysfs_emit_at (buf, count,"%s\n" , + v9ses->cachetag); }spin_unlock (&v9fs_sessionlist_lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 14/507 SUNRPC: report local rpcbind calls that get no answer
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
[ Upstream commit 202a557d0c8e65c7fd7fcff2ad2756468d1ab711 ]
A caller that creates many listeners in one operation calls svc_register() once for each of them. Every call waits for the local rpcbind on its own, so a rpcbind that never answers costs the caller one timeout per listener. The caller has no way to learn that the first call already failed.
Split rpcb_register_call() failures by whether rpcbind answered:
- answered: a FALSE reply, or an RPC-level rejection that rpc_decode_header() derives from the reply. -EACCES (FALSE reply or AUTH_ERROR), -EPROTONOSUPPORT, -EPFNOSUPPORT, -EOPNOTSUPP.
- never sent: -ENOMEM, -EMSGSIZE, -ERESTARTSYS.
- no answer: everything else, i.e. transport errors.
Any no-answer error gets represented by -EIO, which is already what the RPC layer reports for most of it: rpc_check_timeout() returns -EIO for a soft timeout without RPC_TASK_TIMEOUT, and call_status() documents -EIO as "shutdown or soft timeout".
Keep a count of the number of rpcbind failures in the serv. Later patches will use that to watch for hard rpcbind failures, and alter their behavior accordingly.
Stable-dep-of: bf0f3a37e6cc ("NFSD: stop registering with rpcbind after a failure in listener_set")
--- include/linux/sunrpc/clnt.h | 3 ++- include/linux/sunrpc/svc.h | 7 +++++-- net/sunrpc/rpcb_clnt.c | 22 ++++++++++++++++--- net/sunrpc/svc.c | 42 ++++++++++++++++++++++++++++++++++++- 4 files changed, 67 insertions(+), 7 deletions(-)
include/linux/sunrpc/clnt.h +2 -1
@@ -199,7 +199,8 @@ struct rpc_xprt *rpc_task_get_xprt(struct rpc_clnt *clnt,int rpcb_create_local (struct net *);void rpcb_put_local (struct net *); -int rpcb_register (struct net *,u32 ,u32 ,int ,unsigned short ); +int rpcb_register (struct net *net,u32 prog,u32 vers,int prot, +unsigned short port); int rpcb_v4_register(struct net *net, const u32 program, const u32 version, const struct sockaddr *address,
include/linux/sunrpc/svc.h +5 -2
@@ -78,6 +78,7 @@ struct svc_serv {unsigned int sv_max_payload;/* datagram payload size */ unsigned int sv_max_mesg;/* max_payload + 1 page for overheads */ unsigned int sv_xdrsize;/* XDR buffer size */ +atomic_t sv_rpcb_failures;/* unanswered rpcbind calls */ struct list_head sv_permsocks;/* all permanent sockets */ struct list_head sv_tempsocks;/* all temporary sockets */ int sv_tmpcnt;/* count of temporary "valid" sockets */
@@ -451,6 +452,7 @@ int sunrpc_set_pool_mode(const char *val);int sunrpc_get_pool_mode (char *val,size_t size);void svc_rpcb_cleanup (struct svc_serv *serv,struct net *net);int svc_bind (struct svc_serv *serv,struct net *net); +unsigned int svc_rpcb_failure_count (struct svc_serv *serv);struct svc_serv *svc_create (struct svc_program *,unsigned int ,int (*threadfn)(void *data)); bool svc_rqst_replace_page(struct svc_rqst *rqstp,
@@ -471,8 +473,9 @@ unsigned int svc_serv_maxthreads(const struct svc_serv *serv);int svc_pool_stats_open (struct svc_info *si,struct file *file);void svc_process (struct svc_rqst *rqstp);void svc_process_bc (struct rpc_rqst *req,struct svc_rqst *rqstp); -int svc_register (const struct svc_serv *,struct net *,const int , -const unsigned short ,const unsigned short ); +int svc_register (struct svc_serv *serv,struct net *net, +const int family,const unsigned short proto, +const unsigned short port);void svc_wake_up (struct svc_serv *);void svc_reserve (struct svc_rqst *rqstp,int space);
net/sunrpc/rpcb_clnt.c +19 -3
@@ -400,7 +400,8 @@ static struct rpc_clnt *rpcb_create(struct net *net, const char *nodename,return rpc_create (&args); } -static int rpcb_register_call (struct sunrpc_net *sn,struct rpc_clnt *clnt,struct rpc_message *msg,bool is_set) +static int rpcb_register_call (struct sunrpc_net *sn,struct rpc_clnt *clnt, +struct rpc_message *msg,bool is_set) {int flags =RPC_TASK_NOCONNECT ;int error, result =0 ;
@@ -410,8 +411,23 @@ static int rpcb_register_call(struct sunrpc_net *sn, struct rpc_clnt *clnt, stru msg->rpc_resp = &result; error =rpc_call_sync (clnt, msg, flags); -if (error <0 ) -return error; +if (error <0 ) { +switch (error) { +/* rpcbind answered; the reply itself carries the error */ +case -EPROTONOSUPPORT : +case -EPFNOSUPPORT : +case -EOPNOTSUPP : +case -EACCES : +/* the call never made it onto the wire */ +case -ENOMEM : +case -EMSGSIZE : +/* the caller is going away; this says nothing about rpcbind */ +case -ERESTARTSYS : +return error; + } +/* anything else, we assume that rpcbind isn't functional */ +return -EIO ; + }if (!result)return -EACCES ;
net/sunrpc/svc.c +41 -1
77 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 15/507 NFSD: stop registering with rpcbind after a failure in listener_set
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
[ Upstream commit bf0f3a37e6ccb78ae80cc6eb2edde4f033c7574c ]
nfsd_nl_listener_set_doit() calls svc_xprt_create_from_sa() once for each requested listener and passes flags of 0, so every listener registers with rpcbind on its own. A rpcbind that accepts the connection and never replies therefore costs one timeout for each entry. With the cap of 1024 entries the request can hold nfsd_mutex for about 34 minutes, which is roughly 17 times the hung-task threshold.
One failure is enough to know that the next call will not fare better. Read svc_rpcb_failure_count() before the create loop, and pass SVC_SOCK_ANONYMOUS for the rest of the request once the count moves.
--- fs/nfsd/nfsctl.c | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-)
fs/nfsd/nfsctl.c +38 -4
@@ -2089,7 +2089,10 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)const struct nlattr *bad_attr =NULL ;struct svc_xprt *xprt, *tmp;const char *bad_xprt =NULL ; +unsigned int rpcb_failures;const struct nlattr *attr; +bool skipped_rpcb = false; +bool bad_rpcb = false;struct svc_serv *serv;LIST_HEAD (permsocks);struct nfsd_net *nn;
@@ -2179,13 +2182,16 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)if (delete)svc_xprt_destroy_all (serv, net, false); + rpcb_failures =svc_rpcb_failure_count (serv); +/* walk list of addrs again, open any that still don't exist */ nlmsg_for_each_attr_type (attr,NFSD_A_SERVER_SOCK_ADDR , info->nlhdr,GENL_HDRLEN , rem) {struct nlattr *tb[NFSD_A_SOCK_MAX +1 ];const char *xcl_name;struct sockaddr *sa; -int ret; +bool hit_rpcb; +int flags, ret;/* validated up front in nfsd_nl_validate_listeners() */ if (nla_parse_nested(tb, NFSD_A_SOCK_MAX, attr,
@@ -2204,12 +2210,27 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)continue ; } - ret =svc_xprt_create_from_sa (serv, xcl_name, net, sa,0 , + flags = skipped_rpcb ?SVC_SOCK_ANONYMOUS :0 ; + ret =svc_xprt_create_from_sa (serv, xcl_name, net, sa, flags,current_cred ()); + + hit_rpcb = false; +if (!skipped_rpcb && +svc_rpcb_failure_count (serv) != rpcb_failures) { + skipped_rpcb = true; + hit_rpcb = true; +if (ret <0 ) + ret =svc_xprt_create_from_sa (serv, xcl_name, + net, sa, +SVC_SOCK_ANONYMOUS , +current_cred ()); + } +/* always save the latest error */ if (ret <0 ) { bad_attr = attr; bad_xprt = xcl_name; + bad_rpcb = hit_rpcb; err = ret; } }
@@ -2221,8 +2242,21 @@ int nfsd_nl_listener_set_doit(struct sk_buff *skb, struct genl_info *info)*/ if (err) {NL_SET_BAD_ATTR (info->extack, bad_attr); -NL_SET_ERR_MSG_FMT (info->extack,"cannot create %s listener" , - bad_xprt); +if (bad_rpcb) +NL_SET_ERR_MSG_FMT (info->extack, +"cannot create %s listener; rpcbind did not answer" , + bad_xprt); +else if (skipped_rpcb) +NL_SET_ERR_MSG_FMT (info->extack, +"cannot create %s listener; rpcbind did not answer earlier, so some listeners are not registered" , + bad_xprt); +else +NL_SET_ERR_MSG_FMT (info->extack, +"cannot create %s listener" , + bad_xprt); + }else if (skipped_rpcb) { +NL_SET_ERR_MSG (info->extack, +"rpcbind did not answer, some listeners are not registered" ); }if (!serv->sv_nrthreads &&list_empty (&nn->nfsd_serv->sv_permsocks))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 16/507 NFSD: Send a meaningful CB_RECALL_ANY keep count
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 9af39c0773ef956039e1ebe9c235532fe6ee1e50 ]
deleg_reaper() sets craa_objects_to_keep to zero on every CB_RECALL_ANY. RFC 8881 Section 20.6.3 defines that field as the number of objects the client may keep, leaving the client to choose which of the excess to return, because the server cannot read lack of recent use as lack of usefulness. Zero asks for every delegation the client holds, including the ones backing files an application still has open.
There is also no reason NFSD has to reclaim the entire delegation working set on the first sign of memory pressure.
Derive the keep count from cl_deleg_count so that each callback asks for one delegation. Both the shrinker and the laundromat re-arm while their condition lasts, so a client with more to give is asked again on the next pass.
The Linux client ignores craa_objects_to_keep and returns unused delegations selected from the type mask alone, so the count changes nothing for it.
--- fs/nfsd/nfs4state.c | 24 ++++++++++++++++++++---- fs/nfsd/state.h | 2 ++ 2 files changed, 22 insertions(+), 4 deletions(-)
fs/nfsd/nfs4state.c +20 -4
@@ -1517,6 +1517,7 @@ hash_delegation_locked(struct nfs4_delegation *dp, struct nfs4_file *fp) dp->dl_stid.sc_type =SC_TYPE_DELEG ;list_add (&dp->dl_perfile, &fp->fi_delegations);list_add (&dp->dl_perclnt, &clp->cl_delegations); + clp->cl_deleg_count++;return 0 ; }
@@ -1548,6 +1549,7 @@ unhash_delegation_locked(struct nfs4_delegation *dp, unsigned short statusmask) ++dp->dl_time;spin_lock (&fp->fi_lock);list_del_init (&dp->dl_perclnt); + dp->dl_stid.sc_client->cl_deleg_count--;list_del_init (&dp->dl_recall_lru);list_del_init (&dp->dl_perfile);spin_unlock (&fp->fi_lock);
@@ -7938,6 +7940,7 @@ deleg_reaper(struct nfsd_net *nn) {struct list_head *pos, *next;struct nfs4_client *clp; +unsigned int count;spin_lock (&nn->client_lock);list_for_each_safe (pos, next, &nn->client_lru) {
@@ -7947,23 +7950,36 @@ deleg_reaper(struct nfsd_net *nn)continue ;if (clp->cl_state !=NFSD4_ACTIVE )continue ; -if (list_empty (&clp->cl_delegations)) -continue ;if (atomic_read (&clp->cl_delegs_in_recall))continue ;if (ktime_get_boottime_seconds () - clp->cl_ra_time <5 )continue ;if (clp->cl_cb_state !=NFSD4_CB_UP )continue ; +/* +* This read races with hash_delegation_locked() and +* unhash_delegation_locked() on other CPUs. A stale +* count only skews the keep value; the next +* laundromat pass sees a more current one. +*/ + count =data_race (READ_ONCE (clp->cl_deleg_count)); +if (!count) +continue ;if (test_and_set_bit (NFSD4_CALLBACK_RUNNING , &clp->cl_ra->ra_cb.cb_flags))continue ;/* release in nfsd4_cb_recall_any_release */ kref_get (&clp->cl_nfsdfs.cl_ref); clp->cl_ra_time =ktime_get_boottime_seconds (); - clp->cl_ra->ra_keep =0 ; +/* +* Ask for a single delegation. Recalling one before it +* is needed costs the client an OPEN when it next +* touches the file. +*/ + clp->cl_ra->ra_keep = count -1 ; clp->cl_ra->ra_bmval[0 ] =BIT (RCA4_TYPE_MASK_RDATA_DLG ) | -BIT (RCA4_TYPE_MASK_WDATA_DLG ); +BIT (RCA4_TYPE_MASK_WDATA_DLG ) | +BIT (RCA4_TYPE_MASK_DIR_DLG );trace_nfsd_cb_recall_any (clp->cl_ra);nfsd4_run_cb (&clp->cl_ra->ra_cb); }
fs/nfsd/state.h +2 -0
@@ -610,6 +610,8 @@ struct nfs4_client {unsigned int cl_state;atomic_t cl_delegs_in_recall; +/* Length of cl_delegations, updated under nn->deleg_lock */ +unsigned int cl_deleg_count;struct nfsd4_cb_recall_any *cl_ra;time64_t cl_ra_time;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 17/507 NFSD: Move the cld upcall message out of the callers stack frame
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit c559b05610557fa3c6c30259261f6dae523b3f23 ]
__cld_pipe_upcall() builds its struct rpc_pipe_msg on the stack and hands it to rpc_queue_upcall(), which links it into a list the pipe owns until the message is released. Only the completion rules keep that frame alive for as long as the pipe refers to it, and the peer that drives those rules is an untrusted userspace daemon. The gss and idmap upcalls do not take that on: each keeps the message in the object it already allocates.
Do the same here and put the message in struct cld_upcall, beside the reply buffer it carries. cld_pipe_destroy_msg() then reaches the upcall from the message directly rather than through msg->data.
Stable-dep-of: 2a83fcb50f3c ("NFSD: Complete a cld upcall when the daemon closes the pipe")
--- fs/nfsd/nfs4recover.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
fs/nfsd/nfs4recover.c +10 -10
@@ -649,6 +649,7 @@ struct cld_upcall {struct completion cu_done;/* daemon has read the whole upcall; protected by cn_lock */ bool cu_inflight; +struct rpc_pipe_msg cu_pipe_msg;union {struct cld_msg_hdr cu_hdr;struct cld_msg cu_msg;
@@ -660,22 +661,22 @@ static int __cld_pipe_upcall(struct rpc_pipe *pipe, void *cmsg, struct nfsd_net *nn) { int ret; -struct rpc_pipe_msg msg; struct cld_upcall *cup = container_of(cmsg, struct cld_upcall, cu_u); +struct rpc_pipe_msg *msg = &cup->cu_pipe_msg; -memset (&msg,0 ,sizeof (msg)); - msg.data = cmsg; - msg.len = nn->client_tracking_ops->msglen; +memset (msg,0 ,sizeof (*msg)); + msg->data = cmsg; + msg->len = nn->client_tracking_ops->msglen; - ret =rpc_queue_upcall (pipe, &msg); + ret =rpc_queue_upcall (pipe, msg);if (ret <0 ) { goto out; }wait_for_completion (&cup->cu_done); -if (msg.errno <0 ) - ret = msg.errno; +if (msg->errno <0 ) + ret = msg->errno; out:return ret; }
@@ -848,9 +849,8 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)static void cld_pipe_destroy_msg (struct rpc_pipe_msg *msg) { -struct cld_msg *cmsg = msg->data; - struct cld_upcall *cup = container_of(cmsg, struct cld_upcall, - cu_u.cu_msg); + struct cld_upcall *cup = container_of(msg, struct cld_upcall, + cu_pipe_msg);struct cld_net *cn = cup->cu_net;/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 18/507 NFSD: Complete a cld upcall when the daemon closes the pipe
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 2a83fcb50f3c25c493cc4389619340fefe9d6ac4 ]
Once nfsdcld has read a whole upcall, rpc_pipe_read() unlinks the message from every pipe list, so the purges in rpc_pipe_release() and rpc_close_pipes() no longer reach it. cld_upcall_ops supplies no .release_pipe callback, and cld_pipe_destroy_msg() returns without completing the upcall because a downcall is expected to follow. A daemon that exits between the read and the write therefore strands its waiter: the nfsd thread sleeps in TASK_UNINTERRUPTIBLE in __cld_pipe_upcall() and never returns, hung task warnings follow, and the server cannot be shut down.
Add a .release_pipe that completes every upcall the daemon has consumed. cu_inflight distinguishes those from upcalls still queued on the pipe, which the framework purges before it calls this callback; cld_pipe_downcall() removes an upcall it accepts from cn_list under the same lock. Neither can be completed twice.
Fail the stranded upcall with -EPIPE rather than the -EAGAIN that makes cld_pipe_upcall() retry. The daemon consumed the request, so whether it acted on it before exiting is unknown.
--- fs/nfsd/nfs4recover.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
fs/nfsd/nfs4recover.c +24 -0
@@ -867,10 +867,34 @@ cld_pipe_destroy_msg(struct rpc_pipe_msg *msg)complete (&cup->cu_done); } +/* +* An upcall the daemon has consumed is off every pipe list, so the +* purge in rpc_pipe_release() and rpc_close_pipes() cannot reach it. +* Release its waiter here instead; no downcall can arrive now. +*/ +static void +cld_release_pipe (struct inode *inode) +{ +struct nfsd_net *nn =net_generic (inode->i_sb->s_fs_info, nfsd_net_id); +struct cld_net *cn = nn->cld_net; +struct cld_upcall *cup; + +spin_lock (&cn->cn_lock); +list_for_each_entry (cup, &cn->cn_list, cu_list) { +if (!cup->cu_inflight) +continue ; + cup->cu_inflight = false; + cup->cu_pipe_msg.errno = -EPIPE ; +complete (&cup->cu_done); + } +spin_unlock (&cn->cn_lock); +} +static const struct rpc_pipe_ops cld_upcall_ops = { .upcall = rpc_pipe_generic_upcall, .downcall = cld_pipe_downcall, .destroy_msg = cld_pipe_destroy_msg, + .release_pipe = cld_release_pipe, }; static int
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 9/507 xfs: improve dirent bounds checking in scrub and repair
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
[ Upstream commit 5d470234d04dae6fe2ca2cf4b9ef277b78c7e05a ]
LOLLM complains that we don't do enough bounds checking of the directory entries in directory blocks when we're looking for errors or trying to salvage entries. Let's improve that with more detailed checks.
--- fs/xfs/scrub/dir.c | 68 +++++++++++++++++++++++++++++++++------ fs/xfs/scrub/dir_repair.c | 37 ++++++++++++++++++--- 2 files changed, 91 insertions(+), 14 deletions(-)
fs/xfs/scrub/dir.c +58 -10
@@ -323,11 +323,24 @@ xchk_dir_check_unused(struct xchk_da_btree *ds, struct xfs_buf *bp, unsigned int iter_off, - unsigned int end) + unsigned int end, + xfs_dablk_t rec_bno) { struct xfs_dir2_data_unused *dup = bp->b_addr + iter_off; +unsigned int advance; + +if (iter_off +sizeof (*dup) > end) { +xchk_fblock_set_corrupt (ds->sc,XFS_DATA_FORK , rec_bno); +return -1 ; + } + + advance =xfs_dir2_data_unusedsize (be16_to_cpu (dup->length)); +if (!advance || iter_off + advance > end) { +xchk_fblock_set_corrupt (ds->sc,XFS_DATA_FORK , rec_bno); +return -1 ; + } -return be16_to_cpu (dup->length); +return advance; }/*
@@ -341,15 +354,31 @@ xchk_dir_check_entry(struct xfs_buf *bp, unsigned int iter_off, unsigned int end, - struct xfs_dir2_data_entry *dent) + struct xfs_dir2_data_entry *dent, + xfs_dablk_t rec_bno) { struct xfs_dir2_data_entry *dep = bp->b_addr + iter_off;struct xfs_mount *mp = ds->state->mp; +unsigned int advance; + +/* must have namelen */ + advance = offsetof(typeof(*dep), name); +if (iter_off + advance >= end) { +xchk_fblock_set_corrupt (ds->sc,XFS_DATA_FORK , rec_bno); +return -1 ; + } + +/* Don't walk off the end of the block. */ + advance =xfs_dir2_data_entsize (mp, dep->namelen); +if (!advance || iter_off + advance > end) { +xchk_fblock_set_corrupt (ds->sc,XFS_DATA_FORK , rec_bno); +return -1 ; + }if (dep == dent)return 0 ; -return xfs_dir2_data_entsize (mp, dep->namelen); +return advance; }/* Scrub a directory btree record. */
@@ -377,6 +406,7 @@ xchk_dir_rec(xfs_dahash_t hash;struct xfs_dir3_icleaf_hdr hdr;unsigned int tag; +bool foundit = false;int error; ASSERT(blk->magic == XFS_DIR2_LEAF1_MAGIC ||
@@ -421,33 +451,44 @@ xchk_dir_rec( dent = bp->b_addr + off;/* Make sure we got a real directory entry. */ - iter_off = geo->data_entry_offset; end =xfs_dir3_data_end_offset (geo, bp->b_addr);if (!end) {xchk_fblock_set_corrupt (ds->sc,XFS_DATA_FORK , rec_bno); goto out_relse; } -for (;;) { + iter_off = geo->data_entry_offset; +while (iter_off < end) {struct xfs_dir2_data_unused *dup = bp->b_addr + iter_off;int advance; -if (iter_off >= end) { +/* must have freetag */ + advance = offsetof(typeof(*dup), length); +if (iter_off + advance >= end) {xchk_fblock_set_corrupt (ds->sc,XFS_DATA_FORK , rec_bno); goto out_relse; }if (dup->freetag ==cpu_to_be16 (XFS_DIR2_DATA_FREE_TAG )) - advance =xchk_dir_check_unused (ds, bp, iter_off, end); + advance =xchk_dir_check_unused (ds, bp, iter_off, end, + rec_bno);else advance =xchk_dir_check_entry (ds, bp, iter_off, end, - dent); + dent, rec_bno);if (advance <0 ) goto out_relse; -if (!advance) +if (!advance) { + foundit = true;break ; + } iter_off += advance; } +/* Hash tree must point to the exact dirent */ +if (!foundit) { +xchk_fblock_set_corrupt (ds->sc,XFS_DATA_FORK , rec_bno); + goto out_relse; + } +/* Retrieve the entry, sanity check it, and compare hashes. */ ino =be64_to_cpu (dent->inumber); hash =be32_to_cpu (ent->hashval);
@@ -459,6 +500,13 @@ xchk_dir_rec( goto out_relse; } +/* Name must not overflow end of block */ +if ((char *)dent->name + dent->namelen > + (char *)bp->b_addr +BBTOB (bp->b_length)) { +xchk_fblock_set_corrupt (ds->sc,XFS_DATA_FORK , rec_bno); + goto out_relse; + } +/* Does the directory hash match? */ dname.name = dent->name; dname.len = dent->namelen;
fs/xfs/scrub/dir_repair.c +33 -4
@@ -473,8 +473,16 @@ xrep_dir_recover_unused( unsigned int end) {struct xfs_dir2_data_unused *dup = bp->b_addr + offset; +unsigned int advance; + +if (offset +sizeof (*dup) > end) +return 0 ; + + advance =xfs_dir2_data_unusedsize (be16_to_cpu (dup->length)); +if (!advance || offset + advance > end) +return 0 ; -return be16_to_cpu (dup->length); +return advance; }/*
@@ -492,11 +500,14 @@ xrep_dir_recover_entry(unsigned int advance;int error; +/* must have namelen */ + advance = offsetof(typeof(*dep), name); +if (offset + advance >= end) +return 0 ; +/* Don't walk off the end of the block. */ advance =xfs_dir2_data_entsize (rd->sc->mp, dep->namelen); -if (!advance) -return 0 ; -if (offset + advance > end) +if (!advance || offset + advance > end)return 0 ;/* Ok, let's save this entry. */
@@ -534,6 +545,11 @@ xrep_dir_recover_data(if (xchk_should_terminate (rd->sc, &error))return error; +/* must have freetag */ + advance = offsetof(typeof(*dup), length); +if (offset + advance >= end) +break ; +if (dup->freetag ==cpu_to_be16 (XFS_DIR2_DATA_FREE_TAG )) advance =xrep_dir_recover_unused (bp, offset, end);else
@@ -565,6 +581,19 @@ xrep_dir_recover_sf( hdr = ifp->if_data; end = (unsigned char *)ifp->if_data + ifp->if_bytes; +/* sf header must be big enough for count/i8count */ +if (!hdr || ifp->if_bytes <2 ) +return 0 ; + +/* and large enough for the parent inumber */ +if (hdr->i8count) { + if (ifp->if_bytes < offsetof(struct xfs_dir2_sf_hdr, parent[8])) +return 0 ; + }else { + if (ifp->if_bytes < offsetof(struct xfs_dir2_sf_hdr, parent[4])) +return 0 ; + } + ino =xfs_dir2_sf_get_parent_ino (hdr);trace_xrep_dir_salvaged_parent (rd->sc->ip, ino);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 51/507 net/9p/usbg: also disable endpoints on p9_usbg_close
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Grzeschik <[email protected]>
[ Upstream commit f81cdb9164806eb2df1e1c6df402e03bff7dde31 ]
The close function has to fully reverse the state change of 9p_create (mount) and the potential call of set_alt(1). This includes to ensure that the usage of the endpoints is not active any more.
Message-ID: <[email protected]>
--- net/9p/trans_usbg.c | 2 ++ 1 file changed, 2 insertions(+)
net/9p/trans_usbg.c +2 -0
@@ -467,6 +467,8 @@ static void p9_usbg_close(struct p9_client *client)mutex_lock (&usb9pfs_lock); dev->inuse = false;mutex_unlock (&usb9pfs_lock); + +disable_usb9pfs (usb9pfs); }static int p9_usbg_request (struct p9_client *client,struct p9_req_t *p9_req)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 60/507 drm/panic: Fix kmsg screen hang on a long log line
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devin Wittmayer <[email protected]>
[ Upstream commit 1ba6405638439a4214783965538b0196c8de8a5b ]
The kmsg panic screen reads the log back one chunk at a time. A record that does not fit in a chunk comes back empty without moving on, so the screen asks for it again forever and the panic never finishes. Every oops logs the list of loaded modules, and on my machine that list does not fit.
Read into a buffer the size printk formats one record into, and stop if a read still comes back empty.
--- drivers/gpu/drm/drm_panic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_panic.c +6 -1
@@ -558,7 +558,8 @@ static void draw_panic_screen_kmsg(struct drm_scanout_buffer *sb)const struct font_desc *font =get_default_font (sb->width, sb->height,NULL ,NULL );struct drm_rect r_screen =DRM_RECT_INIT (0 ,0 , sb->width, sb->height);struct kmsg_dump_iter iter; -char kmsg_buf[512 ]; +/* the size printk formats one record into, too big for the stack */ +static char kmsg_buf[2048 ];size_t kmsg_len;struct drm_panic_line line;int yoffset;
@@ -576,6 +577,10 @@ static void draw_panic_screen_kmsg(struct drm_scanout_buffer *sb)char *start;char *end; +/* a record that does not fit comes back empty, every time */ +if (!kmsg_len) +break ; +/* ignore terminating NUL and newline */ start = kmsg_buf + kmsg_len -2 ; end = kmsg_buf + kmsg_len -1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 61/507 drm/drm_crtc: ensure dma_fence_ops remain valid during device unbind
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: André Draszik <[email protected]>
[ Upstream commit 3be436cbd3d265fe4fcfbb5b650edad7b2108443 ]
In [1], sashiko reported the following issue:
=== snip ===
Looking at how these fences are managed, drm_crtc_create_fence() creates a dma_fence without taking a reference to the drm_device or drm_crtc. Because the sync_file framework exposes this fence to userspace, the fence can outlive the CRTC.
The dma_fence contract requires that data accessed by dma_fence_ops (like get_driver_name) must remain valid for an RCU grace period after the fence is signaled. However, drm_crtc_cleanup() and the subsequent freeing of the device do not wait for an RCU grace period via synchronize_rcu().
If userspace calls ioctl(SYNC_IOC_FILE_INFO) concurrently with a device hot-unplug:
CPU1 (Userspace)sync_file_get_name()
ops = rcu_dereference(fence->ops);
if (!dma_fence_test_signaled_flag())
// Preempted or delayed here
CPU2 (Driver Teardown)
Signals the fence (setting fence->ops = NULL)
Destroys and frees the CRTC without waiting for an RCU grace period
CPU1 (Resumes)
ops->get_driver_name(fence) -> drm_crtc_fence_get_driver_name() crtc = fence_to_crtc(fence); // Casts to the freed CRTC return crtc->dev->driver->name; // Use-after-free
...
Does the CRTC or DRM device need to be kept alive for the RCU grace period, or should the fence hold a proper reference to prevent the use-after-free when get_driver_name() and get_timeline_name() access the freed CRTC structure?
=== snap ===
I believe this to be a correct observation and this patch implements the suggestion of waiting for an RCU grace period before proceeding with destruction of the drm_crtc, so that get_driver_name() and get_timeline_name() can still work.
--- drivers/gpu/drm/drm_crtc.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_crtc.c +12 -3
@@ -493,14 +493,23 @@ EXPORT_SYMBOL(__drmm_crtc_alloc_with_planes);* drm_crtc_cleanup - Clean up the core crtc usage * @crtc: CRTC to cleanup * -* This function cleans up @crtc and removes it from the DRM mode setting -* core. Note that the function does *not* free the crtc structure itself, -* this is the responsibility of the caller. +* This function cleans up @crtc and removes it from the DRM mode setting core, +* after first waiting an RCU grace period to ensure @crtc->dev can safely be +* dereferenced by our dma_fence_ops. +* +* Note that the function does *not* free the crtc structure itself, this is the +* responsibility of the caller. */ void drm_crtc_cleanup (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev; +/* Ensure our dma_fence_ops remain valid for an RCU grace period after +* the fence is signaled. This is necessary because our dma_fence_ops +* dereference crtc->dev. +*/ +synchronize_rcu (); +/* Note that the crtc_list is considered to be static; should we * remove the drm_crtc at runtime we would have to decrement all * the indices on the drm_crtc after us in the crtc_list.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 62/507 drm/drm_crtc: fix race with dma_fence_signal() in ::get_driver_name()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: André Draszik <[email protected]>
[ Upstream commit cb104d395da48d965665fefe8502f71b6e7e3733 ]
Since commit 541c8f2468b9 ("dma-buf: detach fence ops on signal v3"), I'm seeing the BUG_ON() triggering in drm_crtc's fence_to_crtc() via drm_crtc_fence_get_driver_name() regularly:
Call trace:
panic+0x58/0x5c
die+0x160/0x178
bug_brk_handler+0x70/0xa4
call_el1_break_hook+0x3c/0x1a0
do_el1_brk64+0x24/0x74
el1_brk64+0x34/0x54
el1h_64_sync_handler+0x80/0xfc
el1h_64_sync+0x84/0x88
drm_crtc_fence_get_driver_name+0x60/0x68 (P)
sync_file_get_name+0x184/0x45c
sync_file_ioctl+0x404/0xf70
__arm64_sys_ioctl+0x124/0x1dcThis looks to be caused by a code flow similar to the following:
+++ snip +++
thread A thread B
ioctl(SYNC_IOC_FILE_INFO) sync_file_ioctl() sync_file_get_name()dma_fence_signal_timestamp_locked() dma_fence_driver_name()
ops = rcu_dereference(fence->ops)
if (!dma_fence_test_signaled_flag())
ops->get_driver_name(fence) i.e.
drm_crtc_fence_get_driver_name()
test_and_set_bit(SIGNALED)
RCU_INIT_POINTER(fence->ops, NULL)
drm_crtc_fence_get_driver_name()
BUG_ON(rcu_access_pointer(fence->ops)
!= &drm_crtc_fence_ops)+++ snap +++
In other words, a fence's ops pointer can now change to NULL on signal, which wasn't the case before the culprit commit and hence the BUG_ON() triggers.
Simply drop the BUG_ON() as it's usage of fence ops is invalid now, and because using BUG_ON() and friends to take down the system is an unacceptable way to handle a failure.
Note that the adjacent drm_crtc_fence_get_timeline_name() has the same problem and is fixed by this patch as well.
--- drivers/gpu/drm/drm_crtc.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/drm_crtc.c +0 -3
@@ -154,11 +154,8 @@ static void drm_crtc_crc_fini(struct drm_crtc *crtc)#endif } -static const struct dma_fence_ops drm_crtc_fence_ops; -static struct drm_crtc *fence_to_crtc (struct dma_fence *fence) { -BUG_ON (rcu_access_pointer (fence->ops) != &drm_crtc_fence_ops); return container_of(fence->extern_lock, struct drm_crtc, fence_lock); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 63/507 dma-buf: Fix IOVA offset when linking phys vecs to sgt
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yili Zhang <[email protected]>
[ Upstream commit d57e3a7d880d783c64aa29457d78b0e3c5a40e3c ]
The dma_buf_phys_vec_to_sgt() routine links every physical range into the allocated IOVA space at offset zero instead of advancing the offset by the already mapped length. This breaks the THRU_HOST_BRIDGE flow whenever phys_vec contains more than one entry: the second and subsequent dma_iova_link() calls try to install mappings on top of PTEs that already exist, which fails and makes the whole conversion return an error.
Fix it by passing the accumulated mapped_len as the IOVA offset. This matches the pattern used by all other dma_iova_link() callers and is consistent with the rest of the function: dma_iova_sync() and the error path in dma_iova_destroy() both operate on the [0, mapped_len) prefix of the IOVA space, which assumes that the ranges were linked contiguously starting at offset 0.
--- drivers/dma-buf/dma-buf-mapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma-buf/dma-buf-mapping.c +1 -1
@@ -156,7 +156,7 @@ struct sg_table *dma_buf_phys_vec_to_sgt(struct dma_buf_attachment *attach, phys_vec[i].paddr); }else if (dma_use_iova (dma->state)) { ret =dma_iova_link (attach->dev, dma->state, - phys_vec[i].paddr,0 , + phys_vec[i].paddr, mapped_len, phys_vec[i].len, dir,DMA_ATTR_MMIO );if (ret)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 64/507 wifi: mac80211: reload TDLS header pointer after skb_linearize()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weigang He <[email protected]>
[ Upstream commit 35c5a5ea4418571997a7e7af3e7e8922b136f6e6 ]
ieee80211_process_tdls_channel_switch() sets tf = skb->data before it calls skb_linearize(), and reads tf->action_code afterwards.
ieee80211_rx_h_data() queues TDLS channel switch requests and responses to the interface after pulling only offsetof(struct ieee80211_tdls_data, u) bytes, so the skb can still be non-linear when the interface work handles it. Drivers that build paged RX skbs do this for every frame that does not fit into the skb head, e.g. iwlwifi (mvm), which is also the only mac80211 driver that sets NL80211_FEATURE_TDLS_CHANNEL_SWITCH. If the remaining data does not fit into the tailroom, skb_linearize() moves the data to a new head and frees the old one, and the action code is then read from freed memory. Depending on what that memory holds by then, the frame is handled as before or ends in the WARN_ON_ONCE() of the default case.
The frame only has to be a data frame with the TDLS ethertype from an authorized peer, e.g. relayed by the AP from another station in the BSS; the read happens before the sender is checked to be a TDLS peer.
Load tf after skb_linearize(), as the request and response handlers already do.
Found by static analysis tool CodeQL.
--- net/mac80211/tdls.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/tdls.c +2 -1
@@ -2021,7 +2021,7 @@ void ieee80211_process_tdls_channel_switch(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) { - struct ieee80211_tdls_data *tf = (void *)skb->data; + struct ieee80211_tdls_data *tf;struct wiphy *wiphy = sdata->local->hw.wiphy;lockdep_assert_wiphy (wiphy);
@@ -2037,6 +2037,7 @@ ieee80211_process_tdls_channel_switch(struct ieee80211_sub_if_data *sdata,* The packet/size was already validated by mac80211 Rx path, only look * at the action type. */ + tf = (void *)skb->data;switch (tf->action_code) {case WLAN_TDLS_CHANNEL_SWITCH_REQUEST :ieee80211_process_tdls_channel_switch_req (sdata, skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 65/507 wifi: brcmfmac: map msgbuf RX packet IDs bidirectional
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Perlow <[email protected]>
[ Upstream commit 7ed5dce55fa8393972b1bf2bf5af1c818c5e7dc2 ]
Commit f0ba5fd51ff2 ("wifi: brcmfmac: Set DMA direction for msgbuf packet IDs") maps the RX packet ID buffers DMA_FROM_DEVICE. The BCM4364 firmware also reads posted RX buffers, so with VT-d translation enabled every such read faults ("PTE Read access is not set") and the firmware crashes and resets in a loop.
Map the RX pool DMA_BIDIRECTIONAL again, as before that commit. TX keeps DMA_TO_DEVICE.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +1 -1
@@ -1639,7 +1639,7 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)if (!msgbuf->tx_pktids) goto fail; msgbuf->rx_pktids =brcmf_msgbuf_init_pktids (NR_RX_PKTIDS , -DMA_FROM_DEVICE ); +DMA_BIDIRECTIONAL );if (!msgbuf->rx_pktids) goto fail;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 66/507 wifi: rsi: Skip TX aggregation setup for non-QoS frames
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Kazinsky <[email protected]>
[ Upstream commit 71f756a4c064b0312f46617c20893ecc17c332e4 ]
When transmitting a non-QoS unicast frame to a station in AP mode, rsi_core_xmit() assigns IEEE80211_NONQOS_TID (16) to tid. The station lookup succeeds, allowing tid to index start_tx_aggr[], which has only IEEE80211_NUM_TIDS (16) elements. This causes an out-of-bounds read and, if the value read is zero, an out-of-bounds write.
Only access the aggregation state for tids below IEEE80211_NUM_TIDS, excluding the non-QoS sentinel from TX aggregation setup.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/wireless/rsi/rsi_91x_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_core.c +1 -1
@@ -458,7 +458,7 @@ void rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb) tx_params->sta_id =0 ; } -if (rsta) { +if (rsta && tid <IEEE80211_NUM_TIDS ) {/* Start aggregation if not done for this tid */ if (!rsta->start_tx_aggr[tid]) { rsta->start_tx_aggr[tid] = true;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 67/507 wifi: cfg80211: fix out-of-bounds read in valid_rule()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijing Yin <[email protected]>
[ Upstream commit 9d8ec0b5b5295bd23d979d1b2b905de25c36fff2 ]
valid_rule() validates a struct fwdb_rule from the regulatory database firmware file, but bounds checks only the first byte of the structure, the length field itself.
It then uses that length, which comes straight out of the file, to decide whether the optional fields are present, and reads rule->wmm_ptr at offset 18 of the 20-byte structure once the length claims 20 bytes or more.
A rule placed in the last bytes of the file therefore makes the parser read up to 19 bytes past the end of the firmware image. The image comes from vmalloc() in kernel_read_file(), so with the rule at the end of a page the read falls into the guard page and oopses, with no memory debugging enabled.
A length of at least offsetofend(max_bw) but below offsetofend(wmm_ptr) takes the other branch, so valid_rule() returns true having read nothing out of bounds, and the database is accepted. regdb_query_country() does not re-check the rule, and reads rule->start, rule->end, rule->max_bw and rule->cac_timeout off the end of the kmemdup()ed copy.
A malformed regulatory.db is parsed by cfg80211's own request_firmware_nowait() at init time, and on demand from user space through NL80211_CMD_RELOAD_REGDB, which needs CAP_NET_ADMIN but no wireless hardware. Both paths require write access to the firmware search path and CONFIG_CFG80211_REQUIRE_SIGNED_REGDB=n.
Bound the whole declared rule, not just its length field. The existing check on sizeof(rule->len) is still needed, since rule->len has to be shown to be inside the file before it can be read, so the new test goes after it. A rule reaching past the end of the file is now rejected, which fails the database rather than reading out of bounds. That also gives regdb_query_country() the bound it already assumes.
--- net/wireless/reg.c | 3 +++ 1 file changed, 3 insertions(+)
net/wireless/reg.c +3 -0
@@ -679,6 +679,9 @@ static bool valid_rule(const u8 *data, unsigned int size, u16 rule_ptr)/* mandatory fields */ if (rule->len < offsetofend(struct fwdb_rule, max_bw))return false; +/* the rule must lie entirely within the database */ +if ((u8 *)rule + rule->len > data + size) +return false; if (rule->len >= offsetofend(struct fwdb_rule, wmm_ptr)) {u32 wmm_ptr =be16_to_cpu (rule->wmm_ptr) <<2 ;struct fwdb_wmm_rule *wmm;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 68/507 drm/vc4: Publish the output fence outside of job_lock
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
[ Upstream commit 9ee552a42c3905b4547e83173d46413137ec329a ]
job_lock is taken by the V3D interrupt handler, so nesting an IRQ-unsafe lock under it creates an inversion. drm_syncobj_replace_fence() takes drm_syncobj::lock, which other paths acquire with interrupts enabled. For example, a thread interrupted while holding it blocks the handler on job_lock, and the handler can only make progress once the submit path releases job_lock, which it cannot do while waiting for drm_syncobj::lock.
This is reported by lockdep:
[ 188.139076] ========================================================
[ 188.139086] WARNING: possible irq lock inversion dependency detected
[ 188.139096] 7.3.0-rc3-00067-gc4f3feeaf60f #67 Tainted: G C
[ 188.139108] --------------------------------------------------------
[ 188.139116] swapper/0/0 just changed the state of lock:
[ 188.139125] ffff0000054f8ff8 (&vc4->job_lock){-...}-{3:3}, at: vc4_irq+0xa8/0x28c [vc4]
[ 188.139234] but this lock took another, HARDIRQ-unsafe lock in the past:
[ 188.139242] (&syncobj->lock){+.+.}-{3:3}
[ 188.139256] and interrupts could create inverse lock ordering between them.
[ 188.139267] other info that might help us debug this:
[ 188.139275] Possible interrupt unsafe locking scenario:
[ 188.139284] CPU0 CPU1
[ 188.139291] ---- ----
[ 188.139299] lock(&syncobj->lock);
[ 188.139312] local_irq_disable();
[ 188.139320] lock(&vc4->job_lock);
[ 188.139335] lock(&syncobj->lock);
[ 188.139350] <Interrupt>
[ 188.139358] lock(&vc4->job_lock);
[ 188.139372] *** DEADLOCK ***Hand the fence over after job_lock is dropped. The job can complete and drop exec->fence in that window, so take a reference first and publish through the local pointer, as exec may already be gone.
--- drivers/gpu/drm/vc4/vc4_gem.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_gem.c +9 -1
@@ -639,8 +639,11 @@ vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec, fence->seqno = exec->seqno; exec->fence = &fence->base; +/* The job can complete and drop exec->fence as soon as job_lock is +* released, so hold our own reference. +*/ if (out_sync) -drm_syncobj_replace_fence (out_sync, exec->fence); +dma_fence_get (&fence->base);vc4_attach_fences (exec);
@@ -662,6 +665,11 @@ vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec,spin_unlock_irqrestore (&vc4->job_lock, irqflags); +if (out_sync) { +drm_syncobj_replace_fence (out_sync, &fence->base); +dma_fence_put (&fence->base); + } +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 69/507 drm/vc4: Drop the BO reservations outside of job_lock
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
[ Upstream commit 8ef66514d7b993c9fb96a5886f001e3556610c1c ]
vc4_queue_submit() calls drm_exec_fini() with job_lock held and interrupts disabled. Besides unlocking the reservations, drm_exec_fini() frees the object array with kvfree(), which asks for preemptible task context or a non-NMI interrupt, and may reach might_sleep() through vfree().
Considering that an array that exceeds a page can take the vmalloc fallback, call drm_exec_fini() once job_lock is dropped. The reservations are then held across the job kick, which is harmless as nothing in the completion path takes a BO reservation.
Note that vc4_attach_fences() has to stay inside the critical section, as it walks exec, which the job done worker is free to release as soon as job_lock is dropped.
--- drivers/gpu/drm/vc4/vc4_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_gem.c +2 -2
@@ -647,8 +647,6 @@ vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec,vc4_attach_fences (exec); -drm_exec_fini (exec_ctx); -list_add_tail (&exec->head, &vc4->bin_job_list);/* If no bin job was executing and if the render job (if any) has the
@@ -665,6 +663,8 @@ vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec,spin_unlock_irqrestore (&vc4->job_lock, irqflags); +drm_exec_fini (exec_ctx); +if (out_sync) {drm_syncobj_replace_fence (out_sync, &fence->base);dma_fence_put (&fence->base);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 52/507 net/9p/usbg: set client to Disconnected on usb9pfs_disable
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Grzeschik <[email protected]>
[ Upstream commit 795f8eeca01d1c9ca3d9a450385b7745ace4e53a ]
This patch is setting the client status to Disconnected, when the client is still in use. Otherwise a disconnected usb cable would run any use of the mount to faults.
Message-ID: <[email protected]>
--- net/9p/trans_usbg.c | 5 +++++ 1 file changed, 5 insertions(+)
net/9p/trans_usbg.c +5 -0
@@ -751,7 +751,12 @@ static int usb9pfs_set_alt(struct usb_function *f,static void usb9pfs_disable (struct usb_function *f) {struct f_usb9pfs *usb9pfs =func_to_usb9pfs (f); +unsigned long flags; +spin_lock_irqsave (&usb9pfs->lock, flags); +if (usb9pfs->client) + usb9pfs->client->status = Disconnected; +spin_unlock_irqrestore (&usb9pfs->lock, flags);usb9pfs_clear_tx (usb9pfs); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 70/507 lib/crypto: mips: Disable Octeon SHA code on little-endian kernels
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
[ Upstream commit dd2a4edb26e1c78823c50ba10c42f2d3de2e5ec4 ]
Kernels built for the MIPS64-based Cavium Octeon SoCs are normally big-endian, but little-endian builds are also supported. Currently, the SHA-1, SHA-256, and SHA-512 code using the Octeon crypto co-processor is enabled in both builds.
This code is untestable without the hardware. However, based on the code itself, it is implausible that it computes hash values correctly in little-endian builds. Such builds write many incorrect values to COP2:
- SHA-1 and SHA-256: The 64-bit integer that contains the last two 32-bit message words of each block is written to COP2 entirely byte-reflected, due to missing endianness conversion in octeon_sha1_start() and octeon_sha256_start() to compensate for using native 64-bit loads from the message bytes. This differs from all the earlier message words which are written correctly.
Furthermore, the state is written to COP2 with each 32-bit word byte-reflected within each 64-bit integer, due to incorrect use of 64-bit endianness conversion in write_octeon_64bit_hash_dword() when the state is kept in memory in native-endian 32-bit words.
- SHA-512: All the 64-bit message words are written to COP2 byte-reflected, due to missing endianness conversion in write_octeon_64bit_block_sha512() and octeon_sha512_start(). The SHA-512 state words seem to be written correctly.
Big-endian kernels aren't affected by these bugs. These bugs also aren't new; this code has been broken on little-endian ever since it and Octeon little-endian support were first added in v4.1.
Commit d2a948d2db68 ("MIPS: Octeon: Make octeon-md5 driver endian-agnostic") made the MD5 code work on little-endian kernels by adding 64-bit endianness conversions to the COP2 macros used by MD5 (some of which are shared by SHA-1 and SHA-256, despite those algorithms keeping the state words in native-endian instead of MD5's little-endian, causing some of the strange behavior described above). However, SHA-1, SHA-256, and SHA-512 were never fixed to work on little-endian kernels.
Therefore, disable the Octeon SHA-1, SHA-256, and SHA-512 code in little-endian kernels. This causes the generic code that actually computes hash values correctly to be used instead.
--- lib/crypto/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/crypto/Kconfig +3 -3
@@ -237,7 +237,7 @@ config CRYPTO_LIB_SHA1_ARCH depends on CRYPTO_LIB_SHA1 && !UML default y if ARM default y if ARM64 - default y if MIPS && CPU_CAVIUM_OCTEON + default y if MIPS && CPU_CAVIUM_OCTEON && CPU_BIG_ENDIAN default y if PPC default y if S390 default y if SPARC64
@@ -255,7 +255,7 @@ config CRYPTO_LIB_SHA256_ARCH depends on CRYPTO_LIB_SHA256 && !UML default y if ARM && !CPU_V7M default y if ARM64 - default y if MIPS && CPU_CAVIUM_OCTEON + default y if MIPS && CPU_CAVIUM_OCTEON && CPU_BIG_ENDIAN default y if PPC && SPE default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \ RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
@@ -275,7 +275,7 @@ config CRYPTO_LIB_SHA512_ARCH depends on CRYPTO_LIB_SHA512 && !UML default y if ARM && !CPU_V7M default y if ARM64 - default y if MIPS && CPU_CAVIUM_OCTEON + default y if MIPS && CPU_CAVIUM_OCTEON && CPU_BIG_ENDIAN default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \ RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS default y if S390
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 71/507 wifi: mac80211: reinstate IEEE80211_TX_CTL_AMPDU flag in ieee80211_tx_prep_agg()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 25e73f1d6868c759c8eb56cad4e411692c5341b4 ]
The commit 592234e941f1 ("wifi: mac80211: Fix iTXQ AMPDU fragmentation handling") changed the way handling of the IEEE80211_TX_CTL_AMPDU flag is done in mac80211, so the only place it is set is in ieee80211_tx_dequeue().
This means that any frames that are sent to the driver via drv_tx() will no longer have the flag set. In particular, this affects packets going through ieee80211_tx_pending(). Evan reported that this can result in the ath9k driver failing to account such packets in its block ack window, eventually overrunning the window and stalling TX.
Fix this by reinstating the flag in ieee80211_tx_prep_agg() when inside a valid block ack window. This should be harmless for the TXQ path, and will reinstate the previous behaviour for drivers that use the flag as a signal to track the packet in the window.
--- net/mac80211/tx.c | 2 ++ 1 file changed, 2 insertions(+)
net/mac80211/tx.c +2 -0
@@ -1130,6 +1130,7 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx,struct sk_buff *purge_skb =NULL ;if (test_bit (HT_AGG_STATE_OPERATIONAL , &tid_tx->state)) { + info->flags |=IEEE80211_TX_CTL_AMPDU ; reset_agg_timer = true; }else if (test_bit (HT_AGG_STATE_WANT_START , &tid_tx->state)) {/*
@@ -1161,6 +1162,7 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx,if (!tid_tx) {/* do nothing, let packet pass through */ }else if (test_bit (HT_AGG_STATE_OPERATIONAL , &tid_tx->state)) { + info->flags |=IEEE80211_TX_CTL_AMPDU ; reset_agg_timer = true; }else { queued = true;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 72/507 xfrm4: use a full socket for local errors
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fourie Zhang <[email protected]>
[ Upstream commit 5def91015ba7b59de62a81384572da7281b8a033 ]
xfrm4_local_error() passes skb->sk to inet_sk() and ip_local_error() without ensuring it points to a full socket. TCP SYN-ACK skbs can be owned by TCP_NEW_SYN_RECV request sockets.
xfrm4_tunnel_check_size() already checks sk_fullsock() since commit 1620c88887b1 ("xfrm: Fix the usage of skb->sk"), so iptfs_is_too_big() is the only remaining IPv4 caller passing a request socket here: the sk it tests is the listener, while skb->sk is the request socket.
When IP-TFS rejects such an skb because it exceeds its payload MTU, the local error path treats the request socket as a struct inet_sock. KASAN reports a slab-out-of-bounds read in ip_local_error() beyond the request_sock_TCP allocation.
Resolve the skb owner with skb_to_full_sk() before accessing inet_sock state or reporting the error. This maps a request socket to its listener and rejects sockets that cannot be used as full sockets, matching what commit 6973a21ee73c ("ipv6: xfrm: use full sockets in local error paths") did for xfrm6_local_error().
--- net/ipv4/xfrm4_output.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/ipv4/xfrm4_output.c +5 -2
@@ -38,9 +38,12 @@ int xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb)void xfrm4_local_error (struct sk_buff *skb,u32 mtu) { +struct sock *sk =skb_to_full_sk (skb);struct iphdr *hdr; +if (!sk) +return ; + hdr = skb->encapsulation ?inner_ip_hdr (skb) :ip_hdr (skb); -ip_local_error (skb->sk,EMSGSIZE , hdr->daddr, -inet_sk (skb->sk)->inet_dport, mtu); +ip_local_error (sk,EMSGSIZE , hdr->daddr,inet_sk (sk)->inet_dport, mtu); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 73/507 scsi: aic7xxx: Use default settings on the SGI O2 onboard controllers
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Kaloz <[email protected]>
[ Upstream commit 696bdfc58975fbc70d2e2347a74e0b562e7e2494 ]
The SGI O2 firmware runs its onboard aic7880s without the Adaptec BIOS, so scratch RAM holds no settings. The left over BIOS path reads uninitialised bytes, and bad parity panics the boot.
Use the defaults there with host ID 0. ahc_init() keeps the default host ID ahc_pci_config() chose, 7 on other PCI controllers, so only the O2 changes.
--- drivers/scsi/aic7xxx/aic7xxx_core.c | 8 ++++++-- drivers/scsi/aic7xxx/aic7xxx_pci.c | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-)
drivers/scsi/aic7xxx/aic7xxx_core.c +6 -2
@@ -5266,9 +5266,13 @@ ahc_init(struct ahc_softc *ahc)/* * Assume we have a board at this stage and it has been reset. +* PCI controllers keep the host ID ahc_pci_config() chose. */ -if ((ahc->flags &AHC_USEDEFAULTS ) !=0 ) - ahc->our_id = ahc->our_id_b =7 ; +if ((ahc->flags &AHC_USEDEFAULTS ) !=0 ) { +if ((ahc->chip &AHC_PCI ) ==0 ) + ahc->our_id =7 ; + ahc->our_id_b =7 ; + }/* * Default to allowing initiator operations.
drivers/scsi/aic7xxx/aic7xxx_pci.c +19 -1
@@ -701,6 +701,21 @@ ahc_find_pci_device(ahc_dev_softc_t pci)return (NULL ); } +/* +* The SGI O2 firmware runs its onboard controllers, in slots 1 and 2 of the +* root bus, without the Adaptec BIOS and at host ID 0. It leaves no settings +* in scratch RAM, which may still hold power-on contents with bad parity. +*/ +static bool +ahc_pci_sgi_o2_onboard (struct ahc_softc *ahc) +{ +int slot =ahc_get_pci_slot (ahc->dev_softc); + +return IS_ENABLED (CONFIG_SGI_IP32 ) && +ahc_get_pci_bus (ahc->dev_softc) ==0 && + (slot ==1 || slot ==2 ); +} +int ahc_pci_config (struct ahc_softc *ahc,const struct ahc_pci_identity *entry) {
@@ -782,6 +797,9 @@ ahc_pci_config(struct ahc_softc *ahc, const struct ahc_pci_identity *entry) ahc->bus_intr = ahc_pci_intr; ahc->bus_chip_init = ahc_pci_chip_init; +if (ahc_pci_sgi_o2_onboard (ahc)) + ahc->flags |=AHC_NO_BIOS_INIT ; +/* Remember how the card was setup in case there is no SEEPROM */ if ((ahc_inb (ahc,HCNTRL ) &POWRDN ) ==0 ) {ahc_pause (ahc);
@@ -898,7 +916,7 @@ ahc_pci_config(struct ahc_softc *ahc, const struct ahc_pci_identity *entry)* Assume only one connector and always turn * on termination. */ - our_id =0x07 ; + our_id =ahc_pci_sgi_o2_onboard (ahc) ?0 :0x07 ; sxfrctl1 =STPWEN ; }ahc_outb (ahc,SCSICONF , our_id|ENSPCHK |RESET_SCSI );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 74/507 scsi: aic79xx: Fix NULL pointer dereference in device reset
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Luebke <[email protected]>
[ Upstream commit f057a8bfeb6ff89c65e95540b8700a53c66d4a31 ]
Since commit c67e63800446 ("scsi: aic79xx: Do not reference SCSI command when resetting device") the device reset SCB has no SCSI command, but ahd_linux_dev_reset() still sets its residual, and ahd_abort_scbs(), which completes it, sets its status. Seen on an AIC-7902 when a failing disk triggered a device reset, which killed the SCSI error handler:
BUG: kernel NULL pointer dereference, address: 0000009c EIP: ahd_linux_dev_reset.cold+0xee/0x26e
Add NULL command checks to the accessors in aic79xx_osm.h. Also skip autosense for an SCB without a command and complete it with ahd_done() right away: the REQUEST SENSE path can clear SCB_DEVICE_RESET, after which ahd_done() would dereference the missing command.
--- drivers/scsi/aic7xxx/aic79xx_core.c | 4 +++- drivers/scsi/aic7xxx/aic79xx_osm.h | 26 +++++++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-)
drivers/scsi/aic7xxx/aic79xx_core.c +3 -1
@@ -8942,8 +8942,10 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb) }#endif -if (ahd_perform_autosense (scb) ==0 ) +if (ahd_perform_autosense (scb) ==0 ) { +ahd_done (ahd, scb);break ; + } ahd_compile_devinfo(&devinfo, SCB_GET_OUR_ID(scb), SCB_GET_TARGET(ahd, scb),
drivers/scsi/aic7xxx/aic79xx_osm.h +21 -5
@@ -499,6 +499,8 @@ int ahd_linux_show_info(struct seq_file *,struct Scsi_Host *);static inline void ahd_cmd_set_transaction_status (struct scsi_cmnd *cmd,uint32_t status) { +if (!cmd) +return ; cmd->result &= ~(CAM_STATUS_MASK <<16 ); cmd->result |= status <<16 ; }
@@ -512,6 +514,8 @@ void ahd_set_transaction_status(struct scb *scb, uint32_t status)static inline void ahd_cmd_set_scsi_status (struct scsi_cmnd *cmd,uint32_t status) { +if (!cmd) +return ; cmd->result &= ~0xFFFF ; cmd->result |= status; }
@@ -525,6 +529,8 @@ void ahd_set_scsi_status(struct scb *scb, uint32_t status)static inline uint32_t ahd_cmd_get_transaction_status (struct scsi_cmnd *cmd) { +if (!cmd) +return CAM_REQ_INPROG ;return ((cmd->result >>16 ) &CAM_STATUS_MASK ); }
@@ -537,6 +543,8 @@ uint32_t ahd_get_transaction_status(struct scb *scb)static inline uint32_t ahd_cmd_get_scsi_status (struct scsi_cmnd *cmd) { +if (!cmd) +return SAM_STAT_GOOD ;return (cmd->result &0xFFFF ); }
@@ -564,13 +572,16 @@ u_long ahd_get_transfer_length(struct scb *scb)static inline int ahd_get_transfer_dir (struct scb *scb) { +if (!scb->io_ctx) +return DMA_NONE ;return (scb->io_ctx->sc_data_direction); }static inline void ahd_set_residual (struct scb *scb,u_long resid) { -scsi_set_resid (scb->io_ctx, resid); +if (scb->io_ctx) +scsi_set_resid (scb->io_ctx, resid); } static inline
@@ -582,6 +593,8 @@ void ahd_set_sense_residual(struct scb *scb, u_long resid)static inline u_long ahd_get_residual (struct scb *scb) { +if (!scb->io_ctx) +return 0 ;return scsi_get_resid (scb->io_ctx); }
@@ -595,11 +608,12 @@ static inlineint ahd_perform_autosense (struct scb *scb) {/* -* We always perform autosense in Linux. -* On other platforms this is set on a -* per-transaction basis. +* We always perform autosense in Linux, except for the device +* reset SCB, which has no command to return sense data to. */ -return (1 ); +if (!scb->io_ctx) +return 0 ; +return 1 ; } static inline uint32_t
@@ -629,6 +643,8 @@ void ahd_platform_freeze_devq(struct ahd_softc *ahd, struct scb *scb);static inline void ahd_freeze_scb (struct scb *scb) { +if (!scb->io_ctx) +return ;if ((scb->io_ctx->result & (CAM_DEV_QFRZN <<16 )) ==0 ) { scb->io_ctx->result |=CAM_DEV_QFRZN <<16 ; scb->platform_data->dev->qfrozen++;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 75/507 scsi: target: Fix demo-mode dynamic ACL dev-entry UAF vs LUN teardown
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Zhang <[email protected]>
[ Upstream commit 6a6e7d7230cd4e0a6c003bae5b85bf37a1e77b94 ]
A demo-mode (generate_node_acls=1) login that allocates a dynamic NodeACL populates that ACL's per-LUN dev entries in core_tpg_add_node_to_devs() *before* the ACL is linked onto tpg->acl_node_list by target_add_node_acl():
core_tpg_check_initiator_node_acl():
...
core_tpg_add_node_to_devs(acl, tpg, NULL); /* builds deves */
target_add_node_acl(acl); /* only now listed */
The LUN teardown sweep, core_clear_lun_from_tpg(), enumerates only tpg->acl_node_list, so a dev entry whose ACL is still in the window above is invisible to the sweep and is never disabled. It is left on the se_lun->lun_deve_list after core_tpg_remove_lun() frees the se_lun; when the same unpacked_lun is later re-added and the se_lun is reallocated at the same address, the stale dev entry is rediscovered by target_nacl_find_deve() and core_enable_device_list_for_node() corrupts lun_deve_list:
BUG: KASAN: slab-use-after-free ... core_enable_device_list_for_node+0x5ce/0x880 core_tpg_add_node_to_devs+0x169/0x190 core_dev_add_lun+0x146/0x190 target_fabric_port_link+0xe9/0x1b0 configfs_symlink+0x381/0xae0 __x64_sys_symlink+0x55/0x80
The demo-mode login path that drives the ACL/dev-entry creation is reachable by an unauthenticated initiator; the colliding LUN add/remove is a local configfs operation.
Commit 49cb77e297dc ("target: Avoid mappedlun symlink creation during lun shutdown") introduced se_lun->lun_shutdown and guarded the *explicit* ACL MappedLUN path (target_fabric_mappedlun_link()), but the demo-mode automatic path, core_tpg_add_node_to_devs() -> core_enable_device_list_for_node(), was never given the equivalent guard, and the publish-after-populate ordering in core_tpg_check_initiator_node_acl() was left unchanged.
Fix it in three cooperating parts:
1) Publish the dynamic NodeACL onto acl_node_list *before* creating its dev entries, so the teardown sweep can observe them.
2) Refuse to attach a dev entry to an se_lun that is shutting down, checked under nacl->lun_entry_mutex -- the same lock the sweep takes -- so once the sweep has passed an ACL any later enable for that LUN observes lun_shutdown and skips it.
3) In core_enable_device_list_for_node(), insert the new dev entry onto lun->lun_deve_list while still holding nacl->lun_entry_mutex, in both the replace and the new-entry branch. Previously the entry was added to nacl->lun_entry_hlist under the mutex but to lun->lun_deve_list only after dropping it; with the ACL now published early, the sweep could take the mutex in that gap, find the entry on the hlist, core_disable_device_list_for_node() it (list_del() on the not-yet- linked lun_link succeeds and the entry is freed), and then the enable would list_add_tail() the freed entry back onto lun_deve_list. Linking both lists under the mutex makes enable and the sweep mutually exclusive, closing that window.
core_tpg_add_node_to_devs() already ignores the return value of core_enable_device_list_for_node(), so a shutting-down LUN is simply skipped.
--- drivers/target/target_core_device.c | 18 +++++++++++++++--- drivers/target/target_core_tpg.c | 10 +++++++++- 2 files changed, 24 insertions(+), 4 deletions(-)
drivers/target/target_core_device.c +15 -3
@@ -349,6 +349,19 @@ int core_enable_device_list_for_node( new->attach_count++;mutex_lock (&nacl->lun_entry_mutex); +/* +* Do not attach a new dev entry to an se_lun that is being torn down. +* lun_shutdown is set by core_tpg_remove_lun() before its +* core_clear_lun_from_tpg() sweep; checking it here under the same +* nacl->lun_entry_mutex the sweep takes guarantees that once the sweep +* has passed this ACL no dev entry can be left dangling on the +* se_lun->lun_deve_list that is about to be freed. +*/ +if (lun->lun_shutdown) { +mutex_unlock (&nacl->lun_entry_mutex); + ret = -ENODEV ; + goto free_stats; + } orig =target_nacl_find_deve (nacl, mapped_lun);if (orig && orig->se_lun) {struct se_lun *orig_lun = orig->se_lun;
@@ -375,12 +388,12 @@ int core_enable_device_list_for_node( new->se_lun_acl = lun_acl;hlist_del_rcu (&orig->link);hlist_add_head_rcu (&new->link, &nacl->lun_entry_hlist); -mutex_unlock (&nacl->lun_entry_mutex);spin_lock (&lun->lun_deve_lock);list_del (&orig->lun_link);list_add_tail (&new->lun_link, &lun->lun_deve_list);spin_unlock (&lun->lun_deve_lock); +mutex_unlock (&nacl->lun_entry_mutex);kref_put (&orig->pr_kref, target_pr_kref_release);wait_for_completion (&orig->pr_comp);
@@ -393,11 +406,10 @@ int core_enable_device_list_for_node( new->se_lun = lun; new->se_lun_acl = lun_acl;hlist_add_head_rcu (&new->link, &nacl->lun_entry_hlist); -mutex_unlock (&nacl->lun_entry_mutex); -spin_lock (&lun->lun_deve_lock);list_add_tail (&new->lun_link, &lun->lun_deve_list);spin_unlock (&lun->lun_deve_lock); +mutex_unlock (&nacl->lun_entry_mutex);target_luns_data_has_changed (nacl, new, true);return 0 ;
drivers/target/target_core_tpg.c +9 -1
@@ -266,6 +266,15 @@ struct se_node_acl *core_tpg_check_initiator_node_acl(kref_get (&acl->acl_kref); acl->dynamic_node_acl =1 ; +/* +* Publish the dynamic NodeACL on tpg->acl_node_list before creating +* its demo-mode MappedLUN dev entries below, so that a concurrent LUN +* teardown sweep (core_clear_lun_from_tpg(), which walks acl_node_list) +* can observe and disable those dev entries. Otherwise a dev entry can +* be left on an se_lun->lun_deve_list that is about to be freed. +*/ +target_add_node_acl (acl); +/* * Here we only create demo-mode MappedLUNs from the active * TPG LUNs if the fabric is not explicitly asking for
@@ -275,7 +284,6 @@ struct se_node_acl *core_tpg_check_initiator_node_acl( (tpg->se_tpg_tfo->tpg_check_demo_mode_login_only(tpg) != 1))core_tpg_add_node_to_devs (acl, tpg,NULL ); -target_add_node_acl (acl);return acl; }EXPORT_SYMBOL (core_tpg_check_initiator_node_acl);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 76/507 9p/xen: validate the response size from the backend
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yehyeong Lee <[email protected]>
[ Upstream commit 9b4cf60c6b739461c5b4ec9c52587da6b2608786 ]
p9_xen_response() takes the length of an incoming response from the ring -- the first field of the 9p header, which the Xen transport reuses as its framing header -- and uses it to advance the consumer index, but never checks that it is at least the header size or no larger than the number of bytes the backend has actually produced.
A malicious or buggy backend can post a response whose size is smaller than the header (for example 0). The consumer index then never advances, so the response work re-reads the same ring contents instead of making progress. In testing this raced with the teardown that the malformed reply triggers and dereferenced a freed p9_client:
9pfs 9pfs-0: Wrong req tag=ffff
BUG: kernel NULL pointer dereference, address: 0000000000000060 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: Oops: 0000 [#1] SMP NOPTI CPU: 0 UID: 0 PID: 11 Comm: kworker/0:1 Not tainted 7.2.0-rc5 #6 PREEMPT(lazy) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.17.0-0-gb52ca86e094d-prebuilt.qemu.org 04/01/2014 Workqueue: events p9_xen_response RIP: 0010:idr_find+0x4/0x10 RSP: 0018:ffffbf5d80063de8 EFLAGS: 00010202 RAX: 0000000000000001 RBX: ffffa229c21195a0 RCX: ffffa229c2400000 RDX: ffffa229c11c2200 RSI: 000000000000ffff RDI: 0000000000000050 RBP: 000000000000ffff R08: 3fffffffffffdfff R09: ffffffffffffffff R10: 3fffffffffffdfff R11: ffffffff87a60e80 R12: 0000000000000050 R13: 0000000000000000 R14: 000000000000ffff R15: 0000000000100000 FS: 0000000000000000(0000) GS:ffffa22a7661c000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000060 CR3: 000000003ac34002 CR4: 0000000000770ef0 PKRU: 55555554 Call Trace: <TASK> p9_tag_lookup+0x2b/0x90 p9_xen_response+0x17c/0x2e0 process_one_work+0x16a/0x3a0 worker_thread+0x172/0x2e0 kthread+0xdd/0x110 ret_from_fork+0x18b/0x240 ret_from_fork_asm+0x1a/0x30 </TASK> Modules linked in: CR2: 0000000000000060 ---[ end trace 0000000000000000 ]---
Reject a response whose size is outside [sizeof(header), queued] before using it, matching the validation the backend already applies to incoming requests.
Message-ID: <[email protected]>
--- net/9p/trans_xen.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/9p/trans_xen.c +8 -0
@@ -200,6 +200,14 @@ static void p9_xen_response(struct work_struct *work) masked_prod, &masked_cons, XEN_9PFS_RING_SIZE(ring)); +if (h.size <sizeof (h) || + h.size >xen_9pfs_queued (prod, cons, +XEN_9PFS_RING_SIZE (ring))) { +dev_warn_ratelimited (&priv->dev->dev, +"bad response size %u from backend\n" , h.size); +break ; + } + req =p9_tag_lookup (priv->client, h.tag);if (!req || req->status !=REQ_STATUS_SENT ) {dev_warn (&priv->dev->dev,"Wrong req tag=%x\n" , h.tag);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 77/507 9p: dont decrement a server-owned zero nlink
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuanfu Xie <[email protected]>
[ Upstream commit 4e915aa8566173b44146bc46177c85afbe6bdf96 ]
A 9P2000.L server can report nlink=0 for a regular file that still exists. On a cache=loose or cache=fscache mount, lookup stores that value with set_nlink(). A later successful unlink calls v9fs_dec_count(), which still calls drop_nlink() for a non-directory. drop_nlink() warns, and the unsigned link count wraps to 4294967295. fstat() on a descriptor opened before the unlink shows 0 before and 4294967295 after.
The warning on the unpatched kernel, trimmed:
WARNING: fs/inode.c:408 at drop_nlink+0xac/0xd0, CPU#1: trigger/188 CPU: 1 UID: 0 PID: 188 Comm: trigger Tainted: G N 7.3.0-rc4-00537-ga3ff15db6820 #1 PREEMPT(lazy) RIP: 0010:drop_nlink+0xac/0xd0 Call Trace: <TASK> v9fs_remove+0x529/0x750 vfs_unlink+0x2f0/0xbd0 filename_unlinkat+0x340/0x6c0 __x64_sys_unlink+0x46/0x70 do_syscall_64+0xe8/0x4f0 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK> ---[ end trace 0000000000000000 ]---
Directories whose cached nlink is at most 2 already skip this decrement, because the exported filesystem may not maintain nlink (commit ac89b2ef9b559). cache=none skips it as well (commit 574aa0b479947). cache=mmap does not take this path: it sets neither CACHE_META nor CACHE_LOOSE. A regular file on cache=loose or cache=fscache still does. Its count came from GETATTR and may already be zero, so skip the decrement when i_nlink is already 0.
Verified on 7.3-rc4-00537-ga3ff15db6820 with only this change. A server that advertises nlink=0 and accepts the unlink no longer warns, and the open descriptor stays at nlink 0. An honest server on the same mount still goes from 1 to 0. A rejected unlink leaves the count unchanged. cache=none is unchanged. With panic_on_warn the unpatched kernel panics on the warning; the patched kernel does not.
Message-ID: <[email protected]>
--- fs/9p/vfs_inode.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/9p/vfs_inode.c +8 -0
@@ -495,6 +495,12 @@ static int v9fs_at_to_dotl_flags(int flags)* nothing and races with concurrent metadata fetches that may already * have observed the post-unlink value (nlink == 0). * +* The same applies to a regular file whose cached nlink has already been +* driven to zero by the server: in the cached modes the attributes come +* from GETATTR and are applied verbatim, so decrementing a link count the +* server does not maintain only trips the drop_nlink() WARN_ON and +* underflows i_nlink. +* * @inode: inode whose nlink is being dropped */ static void v9fs_dec_count (struct inode *inode)
@@ -503,6 +509,8 @@ static void v9fs_dec_count(struct inode *inode)if (!(v9ses->cache & (CACHE_META |CACHE_LOOSE )))return ; +if (inode->i_nlink ==0 ) +return ;if (!S_ISDIR (inode->i_mode) || inode->i_nlink >2 )drop_nlink (inode); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 78/507 batman-adv: Close OGM aggregation before transmission
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <[email protected]>
[ Upstream commit f91f64a91682c07e6c5f059804e709656364e8a6 ]
The OGM send worker leaves its forwarding packet on forw_bat_list until after batadv_iv_ogm_emit() returns. Aggregation holds forw_bat_list_lock, but emission reads and clones the packet without that lock.
CPU 0 can therefore start emitting a queued packet while CPU 1 takes the list lock, finds the same packet and appends another OGM. The sender can observe the new packet length before the corresponding direct-link flag is set, or clone the skb while its length and payload are being updated. This can transmit an OGM with incorrect flags or inconsistent data.
KCSAN reported:
BUG: KCSAN: data-race in batadv_iv_ogm_queue_add / batadv_iv_send_outstanding_bat_ogm_packet write to 0xffff888100fedcf8 of 2 bytes by interrupt on cpu 1: read to 0xffff888100fedcf8 of 2 bytes by task 70 on cpu 2: value changed: 0x00c0 -> 0x00d8
Mark the aggregate as full under forw_bat_list_lock before emission. This waits for any ongoing append and prevents further aggregation. Emission uses packet_len to walk the OGMs, so all queued packets are still sent. Keep the packet on the list so interface purging can find the worker, wait for it to finish and free the packet.
--- net/batman-adv/bat_iv_ogm.c | 5 +++++ net/batman-adv/types.h | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
net/batman-adv/bat_iv_ogm.c +5 -0
@@ -1909,6 +1909,11 @@ static void batadv_iv_send_outstanding_bat_ogm_packet(struct work_struct *work) goto out; } +/* Mark aggregate as full before forcing emit. */ +spin_lock_bh (&bat_priv->forw_bat_list_lock); + forw_packet->num_packets =BATADV_MAX_AGGREGATION_PACKETS ; +spin_unlock_bh (&bat_priv->forw_bat_list_lock); +batadv_iv_ogm_emit (forw_packet);/* we have to have at least one packet in the queue to determine the
net/batman-adv/types.h +7 -1
@@ -2019,7 +2019,13 @@ struct batadv_forw_packet {/** @direct_link_flags: direct link flags for aggregated OGM packets */ DECLARE_BITMAP (direct_link_flags,BATADV_MAX_AGGREGATION_PACKETS ); -/** @num_packets: counter for aggregated OGMv1 packets */ +/** +* @num_packets: counter for aggregated OGMv1 packets. Set to +* BATADV_MAX_AGGREGATION_PACKETS (independent of the real number of +* aggregated packets) by the send worker to prevent further +* aggregation while the packet is emitted. It must therefore not be +* used to iterate over the aggregated packets +*/ u8 num_packets;/** @delayed_work: work queue callback item for packet sending */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 79/507 lib/crypto: mldsa: Check pk_len before doing pointer arithmetic
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
[ Upstream commit 5c140c870044af2f4b79e87b42d078cf7c318582 ]
Though common in the kernel and benign in practice (not even triggering UBSAN warnings), taking an address past the end of an array is undefined behavior according to the C specification.
Therefore, compute &pk[RHO_LEN] only after pk_len has been validated, since pk_len could be less than RHO_LEN if an incorrectly sized public key is provided.
(Also fix a typo that isn't worth its own commit.)
--- lib/crypto/mldsa.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/crypto/mldsa.c +3 -2
@@ -306,7 +306,7 @@ static const u8 *decode_t1_elem(struct mldsa_ring_elem *out,* Reference: FIPS 204 Algorithm 27, sigDecode. * * This also validates that the coefficients of z are in range, corresponding -* the infinity norm check at the end of Algorithm 8, ML-DSA.Verify_internal. +* to the infinity norm check at the end of Algorithm 8, ML-DSA.Verify_internal. * * Finally, this also converts z to NTT form. */
@@ -533,7 +533,7 @@ int mldsa_verify(enum mldsa_alg alg, const u8 *sig, size_t sig_len,/* For now this just does pure ML-DSA with an empty context string. */ static const u8 msg_prefix[2 ] = {/* dom_sep= */ 0 ,/* ctx_len= */ 0 };const u8 *ctilde;/* The signer's commitment hash */ -const u8 *t1_encoded = &pk[RHO_LEN ];/* Next encoded element of t_1 */ +const u8 *t1_encoded;/* Next encoded element of t_1 */ u8 *h;/* The signer's hint vector, length k * N */ size_t w1_enc_len;
@@ -587,6 +587,7 @@ int mldsa_verify(enum mldsa_alg alg, const u8 *sig, size_t sig_len,* The computation is the same for each of the k rows. Just do each row * before moving on to the next, resulting in only one loop over k. */ + t1_encoded = &pk[RHO_LEN ];for (int i =0 ; i < k; i++) {/* * tmp = NTT(A) * NTT(z) * 2^-32
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 53/507 net/9p/usbg: always reset completion when disconnecting
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Grzeschik <[email protected]>
[ Upstream commit 08c6b9f484a406d9d87c5b2580725d2e0597f3b9 ]
When some tx or rx transfers were pending while closing the connection, the completion handler could catch one pending completion call. To ensure a normal start when mounting again, we have to reset the completion and flush any pending completions.
Message-ID: <[email protected]>
--- net/9p/trans_usbg.c | 2 ++ 1 file changed, 2 insertions(+)
net/9p/trans_usbg.c +2 -0
@@ -469,6 +469,7 @@ static void p9_usbg_close(struct p9_client *client)mutex_unlock (&usb9pfs_lock);disable_usb9pfs (usb9pfs); +reinit_completion (&usb9pfs->send); }static int p9_usbg_request (struct p9_client *client,struct p9_req_t *p9_req)
@@ -758,6 +759,7 @@ static void usb9pfs_disable(struct usb_function *f) usb9pfs->client->status = Disconnected;spin_unlock_irqrestore (&usb9pfs->lock, flags);usb9pfs_clear_tx (usb9pfs); +reinit_completion (&usb9pfs->send); }static struct usb_function *usb9pfs_alloc (struct usb_function_instance *fi)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 80/507 lib/crypto: mldsa: Explicitly check that alg is a valid value
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
[ Upstream commit efb621a57d7e4ce28e12082ba5692231858c4a3a ]
C doesn't guarantee at the language level that an enum actually has one of the declared values.
For robustness, make mldsa_verify() handle invalid values of 'alg'.
No effect on current callers, who always pass a valid value for 'alg'. (Except for the KUnit test case that this commit adds.)
--- include/crypto/mldsa.h | 1 + lib/crypto/mldsa.c | 10 ++++++++-- lib/crypto/tests/mldsa_kunit.c | 9 +++++++++ 3 files changed, 18 insertions(+), 2 deletions(-)
include/crypto/mldsa.h +1 -0
@@ -48,6 +48,7 @@ enum mldsa_alg {* Return: * * 0 if the signature is valid * * -EBADMSG if the signature and/or public key is malformed +* * -EINVAL if @alg is not a valid value * * -EKEYREJECTED if the signature is invalid but otherwise well-formed * * -ENOMEM if out of memory so the validity of the signature is unknown */
lib/crypto/mldsa.c +8 -2
@@ -528,8 +528,8 @@ static size_t encode_w1(u8 out[MAX_W1_ENCODED_LEN],int mldsa_verify (enum mldsa_alg alg,const u8 *sig,size_t sig_len,const u8 *msg,size_t msg_len,const u8 *pk,size_t pk_len) { -const struct mldsa_parameter_set *params = &mldsa_parameter_sets[alg]; -const int k = params->k, l = params->l; +const struct mldsa_parameter_set *params; +int k, l;/* For now this just does pure ML-DSA with an empty context string. */ static const u8 msg_prefix[2 ] = {/* dom_sep= */ 0 ,/* ctx_len= */ 0 };const u8 *ctilde;/* The signer's commitment hash */
@@ -537,6 +537,12 @@ int mldsa_verify(enum mldsa_alg alg, const u8 *sig, size_t sig_len,u8 *h;/* The signer's hint vector, length k * N */ size_t w1_enc_len; +if (alg !=MLDSA44 && alg !=MLDSA65 && alg !=MLDSA87 ) +return -EINVAL ; + params = &mldsa_parameter_sets[alg]; + k = params->k; + l = params->l; +/* Validate the public key and signature lengths. */ if (pk_len != params->pk_len || sig_len != params->sig_len)return -EBADMSG ;
lib/crypto/tests/mldsa_kunit.c +9 -0
@@ -372,6 +372,14 @@ static void test_mldsa_use_hint(struct kunit *test) } } +static void test_mldsa_invalid_alg (struct kunit *test) +{ +KUNIT_ASSERT_EQ (test, -EINVAL , +mldsa_verify (MLDSA44 -1 ,NULL ,0 ,NULL ,0 ,NULL ,0 )); +KUNIT_ASSERT_EQ (test, -EINVAL , +mldsa_verify (MLDSA87 +1 ,NULL ,0 ,NULL ,0 ,NULL ,0 )); +} +static void benchmark_mldsa (struct kunit *test,const struct mldsa_testvector *tv) {
@@ -414,6 +422,7 @@ static struct kunit_case mldsa_kunit_cases[] = {KUNIT_CASE (test_mldsa65),KUNIT_CASE (test_mldsa87),KUNIT_CASE (test_mldsa_use_hint), +KUNIT_CASE (test_mldsa_invalid_alg),KUNIT_CASE (benchmark_mldsa44),KUNIT_CASE (benchmark_mldsa65), KUNIT_CASE(benchmark_mldsa87),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 81/507 lib/crypto: mldsa: Add __must_check to mldsa_verify()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
[ Upstream commit 01ad209f122b7c173477bd60c7997564f9c65961 ]
Signature verification status always must be checked. Add __must_check, for consistency with e.g. the AES-GCM and ChaCha20Poly1305 functions.
No effect on current callers, who always check the return value.
--- include/crypto/mldsa.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
include/crypto/mldsa.h +3 -2
@@ -52,8 +52,9 @@ enum mldsa_alg {* * -EKEYREJECTED if the signature is invalid but otherwise well-formed * * -ENOMEM if out of memory so the validity of the signature is unknown */ -int mldsa_verify (enum mldsa_alg alg,const u8 *sig,size_t sig_len, -const u8 *msg,size_t msg_len,const u8 *pk,size_t pk_len); +int __must_check mldsa_verify (enum mldsa_alg alg,const u8 *sig,size_t sig_len, +const u8 *msg,size_t msg_len,const u8 *pk, +size_t pk_len);#if IS_ENABLED (CONFIG_CRYPTO_LIB_MLDSA_KUNIT_TEST )/* Internal function, exposed only for unit testing */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 82/507 batman-adv: mcast: validate tracker padding before forwarding
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <[email protected]>
[ Upstream commit ea01fff30f631e67ee5f0a2b97855d772b3a35fc ]
A multicast tracker with an even number of destinations needs two padding bytes after its destination list. batadv_mcast_forw_packet() currently only checks that the count field and the addresses fit in the tracker TVLV.
If an unpadded even tracker is compacted to an odd number of destinations, batadv_mcast_forw_shrink_update_headers() includes those missing padding bytes in the amount to remove. The subsequent memmove can then write two bytes past the old packet tail. With no tailroom, this corrupts skb_shared_info.
Include the required padding in the existing tracker length check. This rejects the malformed tracker before either received or locally generated packets can reach the compactor.
--- net/batman-adv/multicast_forw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/batman-adv/multicast_forw.c +4 -1
@@ -950,8 +950,11 @@ static int batadv_mcast_forw_packet(struct batadv_priv *bat_priv, dest = (u8 *)mcast_tracker +sizeof (*mcast_tracker); -/* check if full tracker tvlv is within skb length */ +/* check if full tracker tvlv, including padding, is within skb length */ tvlv_len =sizeof (*mcast_tracker) +ETH_ALEN * num_dests; +if (!(num_dests %2 )) + tvlv_len +=2 ; +if (tvlv_len >skb_network_header_len (skb))return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 83/507 batman-adv: tpmeter: fix u32 truncation of reported bytes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
[ Upstream commit 1025b76d13288a311e8259a0eefde0854fa63c41 ]
When more than 4 GB are transferred by the throughput meter, batadv_tp_batctl_notify() will cut of the upper 32 bit of the u64 counter and thus under-report the actual transferred bytes.
The data type of the temporary storage variable must therefore still continue to use u64.
--- net/batman-adv/tp_meter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/tp_meter.c +1 -1
@@ -221,7 +221,7 @@ static void batadv_tp_batctl_notify(enum batadv_tp_meter_reason reason, unsigned long start_time, u64 total_sent, u32 cookie) { - u32 total_bytes; + u64 total_bytes;u32 test_time;u8 result;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 84/507 batman-adv: dat: initialize orig_node of unfilled candidate slots
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
[ Upstream commit 4eb19a389d74f06901b4cd6f24b996b2e84eaefc ]
batadv_dat_select_candidates() allocates the candidate array without zeroing it. batadv_choose_next_candidate() marks each slot as BATADV_DAT_CANDIDATE_NOT_FOUND but only sets orig_node when an eligible originator was found. In the following rounds, batadv_is_orig_node_eligible() compares res[j].orig_node of all previous slots against the evaluated originator. For slots without candidates, it reads uninitialized memory.
The orig_node has to be cleared together with theBATADV_DAT_CANDIDATE_NOT_FOUND type.
--- net/batman-adv/distributed-arp-table.c | 1 + 1 file changed, 1 insertion(+)
net/batman-adv/distributed-arp-table.c +1 -0
@@ -653,6 +653,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,* NOT_FOUND */ cands[select].type =BATADV_DAT_CANDIDATE_NOT_FOUND ; + cands[select].orig_node =NULL ;/* iterate over the originator list and find the node with the closest * dat_address which has not been selected yet
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 85/507 batman-adv: fix skb leak when hard_iface is being released
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
[ Upstream commit 522e4aece2e96cacbb8a6ae1eec0d4c0dd6f4fed ]
batadv_batman_skb_recv() owns the skb it is given. When the hard_iface refcount already dropped to zero, the function jumped to err_out, which only returned NET_RX_DROP and skipped the kfree_skb() under err_free.
To avoid a leak, free the skb before returning in this case.
--- net/batman-adv/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/batman-adv/main.c +4 -3
@@ -483,8 +483,10 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,* shut down otherwise the packet may trigger de-reference errors * further down in the receive path. */ -if (!kref_get_unless_zero (&hard_iface->refcount)) - goto err_out; +if (!kref_get_unless_zero (&hard_iface->refcount)) { +kfree_skb (skb); +return NET_RX_DROP ; + } skb =skb_share_check (skb,GFP_ATOMIC );
@@ -540,7 +542,6 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,kfree_skb (skb); err_put:batadv_hardif_put (hard_iface); -err_out:return NET_RX_DROP ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 86/507 batman-adv: stop originator purge worker before freeing TT
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
[ Upstream commit f89eda5a9ccf82cba06b085b42ebc4886b8dfe9e ]
batadv_mesh_free() releases the translation tables via batadv_tt_free() before batadv_originator_free() stops orig_work. The purge worker can therefore still run while the TT is torn down. When an originator times out, batadv_purge_orig_ref() calls batadv_tt_global_del_orig(), which loads tt.global_hash and walks all buckets while taking their locks:
CPU0 CPU1
batadv_tt_free() batadv_purge_orig()
batadv_tt_global_del_orig()
hash = ...tt.global_hash;
batadv_tt_global_table_free()
batadv_hash_destroy(hash);
spin_lock_bh(&hash->list_locks[i]);Disable orig_work at the beginning of batadv_mesh_free(), directly after the mesh was marked as deactivating. The second disable_delayed_work_sync() in batadv_originator_free() is harmless because it is free'd anyway.
--- net/batman-adv/main.c | 5 +++++ 1 file changed, 5 insertions(+)
net/batman-adv/main.c +5 -0
@@ -294,6 +294,11 @@ void batadv_mesh_free(struct net_device *mesh_iface)WRITE_ONCE (bat_priv->mesh_state,BATADV_MESH_DEACTIVATING ); +/* the originator purge worker accesses (among others) the TT tables +* and must therefore be stopped before any of them are freed +*/ +disable_delayed_work_sync (&bat_priv->orig_work); +batadv_purge_outstanding_packets (bat_priv,NULL );batadv_tp_stop_all (bat_priv);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 87/507 batman-adv: tt: ignore ROAM flag of received ADD changes
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
[ Upstream commit c5d68abe6e7f1dbd132a602cb696fe1fff0389eb ]
A received TT change (OGM diff or full table response) with the ROAM flag but without DEL is handled by batadv_tt_global_add() like a ROAMING_ADV:
* a newly created global entry gets BATADV_TT_CLIENT_ROAM and is therefore excluded from the global CRC. The sender has it in its local CRC and the receiver has to request the full table again
* batadv_tt_global_purge_local() removes the local entry of the receiver. The receiver's own client is considered as roamed to the sender and frames for it are rerouted
The ROAM flag only has a meaning together with DEL. Drop it on reception to keep it from populating the global table with a temporary ROAMING entry which is not part of the CRC - and therefore causing a CRC mismatch.
--- net/batman-adv/translation-table.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
net/batman-adv/translation-table.c +12 -3
@@ -3408,21 +3408,30 @@ static void _batadv_tt_update_changes(struct batadv_priv *bat_priv, u16 tt_num_changes, u8 ttvn) { int roams; +u8 flags;int i;for (i =0 ; i < tt_num_changes; i++) { -if ((tt_change + i)->flags &BATADV_TT_CLIENT_DEL ) { - roams = (tt_change + i)->flags &BATADV_TT_CLIENT_ROAM ; + flags = (tt_change + i)->flags; + +if (flags &BATADV_TT_CLIENT_DEL ) { + roams = flags &BATADV_TT_CLIENT_ROAM ;batadv_tt_global_del (bat_priv, orig_node, (tt_change + i)->addr,ntohs ((tt_change + i)->vid),"tt removed by changes" , roams); }else { +/* an announced client cannot have roamed away from +* orig_node. Only a ROAMING_ADV is allowed to add a +* global entry with the ROAM flag +*/ + flags &= ~BATADV_TT_CLIENT_ROAM ; +if (!batadv_tt_global_add (bat_priv, orig_node, (tt_change + i)->addr,ntohs ((tt_change + i)->vid), - (tt_change + i)->flags, ttvn)) + flags, ttvn))/* In case of problem while storing a * global_entry, we stop the updating * procedure without committing the
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 88/507 batman-adv: tt: dont drop local events queued during TVLV update
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
[ Upstream commit ed7a0dfdd370acb48be7a281df732c1bebcc7f1d ]
batadv_tt_tvlv_container_update() read the number of local changes without holding changes_list_lock. batadv_tt_local_event() is not serialized by the commit_lock and can queue new events before the changes_list is flushed:
CPU0 CPU1
batadv_tt_tvlv_container_update()
num = ...local_changes;
batadv_tt_local_event()
list_add_tail(...);
...local_changes++;
spin_lock_bh(&...changes_list_lock);
/* only num events copied but all freed */The additional events were freed without ever being sent. Other nodes will only notice this via a CRC mismatch and must request the full table.
The number of changes and the changes_list must therefore be taken atomically. Events queued afterwards then stay in the tt.changes_list for the next TT round.
The changes can no longer be kept for the next round when the TVLV buffer allocation fails. But they would be sent with a skipped TTVN anyway, so the other nodes have to request the full table in this case either way. The last changeset is only dropped in this case when the TTVN was incremented. Without new changes, it still describes the current TTVN.
Previously, the unconsumed changes caused a retry of the TVLV container update in the next commit round. Since the changes are now consumed, the next round would only take the path without changes and wait for BATADV_TT_OGM_APPEND_MAX rounds before updating the container again. Until then, the outdated container with the previous TTVN would still be announced. The ogm_append_cnt is therefore reset on failure to retry the update in the next OGM interval.
This doesn't make the CRC consistent with the announced changeset. The local table modifications are still not serialized with the commit and batadv_tt_local_transition_new() can still make a client part of the CRC for which the event is only part of the next TT round. Such an inconsistency is detected by the CRC check of the other nodes and solved via a full table request.
--- net/batman-adv/translation-table.c | 61 +++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 13 deletions(-)
net/batman-adv/translation-table.c +48 -13
@@ -1006,22 +1006,24 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv,* batadv_tt_tvlv_container_update() - update the translation table tvlv * container after local tt changes have been committed * @bat_priv: the bat priv with all the mesh interface information +* @changes_list: list of committed changes which will be consumed +* @tt_diff_entries_num: number of entries in @changes_list */ -static void batadv_tt_tvlv_container_update (struct batadv_priv *bat_priv) +static void batadv_tt_tvlv_container_update (struct batadv_priv *bat_priv, +struct list_head *changes_list, +int tt_diff_entries_num) {struct batadv_tvlv_tt_change *tt_change;struct batadv_tt_change_node *entry;struct batadv_tvlv_tt_data *tt_data;struct batadv_tt_change_node *safe;int tt_diff_entries_count =0 ; -int tt_diff_entries_num =0 ;bool drop_changes = false;size_t tt_extra_len =0 ;int tt_change_len =0 ;int tt_diff_len;u16 tvlv_len; - tt_diff_entries_num =READ_ONCE (bat_priv->tt.local_changes); tt_diff_len =batadv_tt_len (tt_diff_entries_num);/* if we have too many changes for one packet don't send any
@@ -1039,19 +1041,39 @@ static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv) tvlv_len =batadv_tt_prepare_tvlv_local_data (bat_priv, &tt_data, &tt_change, &tt_diff_len); -if (!tvlv_len) +if (!tvlv_len) { +/* the changes are lost and the other nodes have to request the +* full table. Don't answer TT requests for the new TTVN with +* the stale changeset of the previous TTVN. Without changes, the +* TTVN was not incremented and the last changeset is still valid +*/ +if (drop_changes || tt_diff_entries_num >0 ) { +list_for_each_entry_safe (entry, safe, changes_list, + list) { +list_del (&entry->list); +kmem_cache_free (batadv_tt_change_cache, entry); + } + +spin_lock_bh (&bat_priv->tt.last_changeset_lock); +kfree (bat_priv->tt.last_changeset); + bat_priv->tt.last_changeset =NULL ; + bat_priv->tt.last_changeset_len =0 ; +spin_unlock_bh (&bat_priv->tt.last_changeset_lock); + } + +/* announce the already committed TTVN in the next OGM interval +* instead of waiting for BATADV_TT_OGM_APPEND_MAX idle rounds +*/ +atomic_set (&bat_priv->tt.ogm_append_cnt,0 );return ; + } tt_data->flags =BATADV_TT_OGM_DIFF ;if (!drop_changes && tt_diff_len ==0 ) goto container_register; -spin_lock_bh (&bat_priv->tt.changes_list_lock); -WRITE_ONCE (bat_priv->tt.local_changes,0 ); - -list_for_each_entry_safe (entry, safe, &bat_priv->tt.changes_list, - list) { +list_for_each_entry_safe (entry, safe, changes_list, list) {if (tt_diff_entries_count < tt_diff_entries_num) { memcpy(tt_change + tt_diff_entries_count, &entry->change,
@@ -1061,7 +1083,6 @@ static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv)list_del (&entry->list);kmem_cache_free (batadv_tt_change_cache, entry); } -spin_unlock_bh (&bat_priv->tt.changes_list_lock); tt_extra_len =batadv_tt_len (tt_diff_entries_num - tt_diff_entries_count);
@@ -3892,11 +3913,25 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)*/ static void batadv_tt_local_commit_changes_nolock (struct batadv_priv *bat_priv) { +LIST_HEAD (changes_list); +int changes_num; +lockdep_assert_held (&bat_priv->tt.commit_lock); -if (READ_ONCE (bat_priv->tt.local_changes) ==0 ) { +/* atomically get the list of changes. The TTVN decision and the +* announced changeset must cover the same events. Events queued +* afterwards stay in the tt.changes_list for the next TT round +*/ +spin_lock_bh (&bat_priv->tt.changes_list_lock); +list_splice_init (&bat_priv->tt.changes_list, &changes_list); + changes_num =READ_ONCE (bat_priv->tt.local_changes); +WRITE_ONCE (bat_priv->tt.local_changes,0 ); +spin_unlock_bh (&bat_priv->tt.changes_list_lock); + +if (changes_num ==0 ) {if (!batadv_atomic_dec_not_zero (&bat_priv->tt.ogm_append_cnt)) -batadv_tt_tvlv_container_update (bat_priv); +batadv_tt_tvlv_container_update (bat_priv, &changes_list, + changes_num);return ; }
@@ -3913,7 +3948,7 @@ static void batadv_tt_local_commit_changes_nolock(struct batadv_priv *bat_priv)/* reset the sending counter */ atomic_set (&bat_priv->tt.ogm_append_cnt,BATADV_TT_OGM_APPEND_MAX ); -batadv_tt_tvlv_container_update (bat_priv); +batadv_tt_tvlv_container_update (bat_priv, &changes_list, changes_num); }/**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 89/507 net: jme: keep RX MAC clock enabled for WoL
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Franck Baur <[email protected]>
[ Upstream commit ed9179fc7228315fb745dc3b111bae446e6894d2 ]
On the JMicron JMC250 revision 03, the MAC reset performed during suspend leaves GPREG1_RXCLKOFF set. Although the driver enables Magic Packet detection, the gated RX MAC clock prevents wake-up from ACPI S3.
Keep the RX MAC clock enabled while WoL is armed. Restore the gated clock state immediately after disabling WoL during resume, preserving the RX engine initialization ordering.
Prevent concurrent link-change work from gating the clock again after WoL has been armed. Quiesce interrupt-driven link-change scheduling, synchronize pending interrupts, and cancel outstanding link-change work before programming WoL in suspend and shutdown paths.
Restore the deferred processing state before requesting link reinitialization on resume.
Tested on an ASUS K42JE with JMC250 [197b:0250] rev 03 using a Debian 6.12.111 kernel and an externally built module. ACPI S3 wake with a Magic Packet completed in 19 seconds, while a control without a Magic Packet resumed through the RTC alarm after 123 seconds. Ethernet and SSH recovered after resume.
S4 and S5 wake behaviour has not been validated with this revision.
--- drivers/net/ethernet/jme.c | 37 ++++++++++++++++++++++++++++++++----- drivers/net/ethernet/jme.h | 1 + 2 files changed, 33 insertions(+), 5 deletions(-)
drivers/net/ethernet/jme.c +32 -5
@@ -1502,7 +1502,8 @@ jme_intr_msi(struct jme_adapter *jme, u32 intrstat)* all other events are ignored */ jwrite32 (jme,JME_IEVE , intrstat); -schedule_work (&jme->linkch_task); +if (!test_bit (JME_FLAG_WOL_QUIESCE , &jme->flags)) +schedule_work (&jme->linkch_task); goto out_reenable; }
@@ -1546,7 +1547,8 @@ jme_intr_msi(struct jme_adapter *jme, u32 intrstat)/* * Re-enable interrupt */ -jwrite32f (jme,JME_IENS ,INTR_ENABLE ); +if (!test_bit (JME_FLAG_WOL_QUIESCE , &jme->flags)) +jwrite32f (jme,JME_IENS ,INTR_ENABLE ); } static irqreturn_t
@@ -1892,6 +1894,7 @@ jme_powersave_phy(struct jme_adapter *jme)jme_set_100m_half (jme);if (jme->reg_pmcs & (PMCS_LFEN |PMCS_LREN ))jme_wait_link (jme); +jme_mac_rxclk_on (jme);jme_clear_pm_enable_wol (jme); }else {jme_phy_off (jme);
@@ -3158,6 +3161,21 @@ jme_shutdown(struct pci_dev *pdev)struct net_device *netdev =pci_get_drvdata (pdev);struct jme_adapter *jme =netdev_priv (netdev); +if (netif_running (netdev)) { +set_bit (JME_FLAG_WOL_QUIESCE , &jme->flags); +netif_device_detach (netdev); +netif_stop_queue (netdev); +jme_stop_irq (jme); +synchronize_irq (pdev->irq); +jme_stop_irq (jme); +cancel_work_sync (&jme->linkch_task); +tasklet_disable (&jme->pcc_task); +napi_disable (&jme->napi); +tasklet_disable (&jme->txclean_task); +tasklet_disable (&jme->rxclean_task); +tasklet_disable (&jme->rxempty_task); + } +jme_powersave_phy (jme);pci_pme_active (pdev, true); }
@@ -3172,11 +3190,16 @@ jme_suspend(struct device *dev)if (!netif_running (netdev))return 0 ; -atomic_dec (&jme->link_changing); - +set_bit (JME_FLAG_WOL_QUIESCE , &jme->flags);netif_device_detach (netdev);netif_stop_queue (netdev);jme_stop_irq (jme); +synchronize_irq (jme->pdev->irq); +jme_stop_irq (jme); +cancel_work_sync (&jme->linkch_task); +tasklet_disable (&jme->pcc_task); +napi_disable (&jme->napi); +atomic_dec (&jme->link_changing);tasklet_disable (&jme->txclean_task);tasklet_disable (&jme->rxclean_task);
@@ -3215,6 +3238,7 @@ jme_resume(struct device *dev)return 0 ;jme_clear_pm_disable_wol (jme); +jme_mac_rxclk_off (jme);jme_phy_on (jme);if (test_bit (JME_FLAG_SSET , &jme->flags))jme_set_link_ksettings (netdev, &jme->old_cmd);
@@ -3226,8 +3250,11 @@ jme_resume(struct device *dev)atomic_inc (&jme->link_changing); -jme_reset_link (jme); +napi_enable (&jme->napi); +tasklet_enable (&jme->pcc_task); +clear_bit (JME_FLAG_WOL_QUIESCE , &jme->flags); +jme_reset_link (jme);jme_start_irq (jme);return 0 ;
drivers/net/ethernet/jme.h +1 -0
@@ -450,6 +450,7 @@ enum jme_flags_bits {JME_FLAG_SSET =2 ,JME_FLAG_POLL =5 ,JME_FLAG_SHUTDOWN =6 , + JME_FLAG_WOL_QUIESCE = 7, };#define TX_TIMEOUT (5 * HZ)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 54/507 net/9p/usbg: call disable_usb9pfs() from usb9pfs_disable()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Grzeschik <[email protected]>
[ Upstream commit cd1988cf723c2eae87112b198bf90b0aebfeaf31 ]
usb9pfs_disable() is the usb_function ->disable callback, invoked by the composite gadget core whenever the host resets or unconfigures the gadget. The gadget function API requires this callback to disable its endpoints; every other in-tree function driver does so from its ->disable hook.
usb9pfs_disable() never called disable_usb9pfs(), so the IN/OUT endpoints and their usb_request objects were left active and allocated across a host-driven disable. When the host later reconfigures the device, enable_usb9pfs() calls alloc_requests() again and unconditionally overwrites usb9pfs->in_req/out_req, permanently leaking the previous allocations, while the endpoints themselves are left enabled underneath the function's own idea of being disabled.
Call disable_usb9pfs() before reinit_completion(&usb9pfs->send), mirroring the same sequence already used in p9_usbg_close(). Placing it before the reinit_completion() also ensures usb_ep_disable() has synchronously flushed any requests still queued in hardware before the completion is reset, closing the same race that motivated resetting the completion here in the first place.
Message-ID: <[email protected]>
--- net/9p/trans_usbg.c | 4 ++++ 1 file changed, 4 insertions(+)
net/9p/trans_usbg.c +4 -0
@@ -759,6 +759,10 @@ static void usb9pfs_disable(struct usb_function *f) usb9pfs->client->status = Disconnected;spin_unlock_irqrestore (&usb9pfs->lock, flags);usb9pfs_clear_tx (usb9pfs); + +if (usb9pfs->in_ep->enabled) +disable_usb9pfs (usb9pfs); +reinit_completion (&usb9pfs->send); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 90/507 ipv6: raw: fix use-after-free in rawv6_send_hdrinc()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhou Qiuyue <[email protected]>
[ Upstream commit 66dfb2cacda7faae614d688943d85e75abf7f586 ]
rawv6_send_hdrinc() caches the route before handing the skb to l3mdev_ip6_out(). The VRF output path may replace skb->dst and release the original route, leaving the cached pointer stale.
The function later dereferences that pointer for statistics accounting and as the output device passed to NF_HOOK(). Its RCU read-side critical section starts after l3mdev_ip6_out(), so it cannot prevent the old route from being reclaimed in between.
Reload the route from the current skb destination after l3mdev_ip6_out() returns.
KASAN reports a slab-use-after-free in rawv6_sendmsg(), with the route allocated by ip6_dst_alloc(), freed by dst_destroy() from rcu_core(), and the related RCU callback queued from vrf_l3_out().
--- net/ipv6/raw.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv6/raw.c +3 -0
@@ -654,6 +654,9 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length,if (unlikely (!skb))return 0 ; +/* l3mdev_ip6_out() may have replaced the skb dst. */ + rt =dst_rt6_info (skb_dst (skb)); +/* Acquire rcu_read_lock() in case we need to use rt->rt6i_idev * in the error path. Since skb has been freed, the dst could * have been queued for deletion.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 91/507 drm/vc4: hdmi: power down the BCM2712 PHY when the output is disabled
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dom Cobley <[email protected]>
[ Upstream commit a59a60e6e9e3a1d5177b28577d935d5ee37ace66 ]
vc6_hdmi_phy_disable() is empty, so on BCM2712 the PHY keeps its PLL and TMDS drivers running after the HDMI output is disabled, until the next vc6_hdmi_phy_init(). The TMDS clock is therefore not stopped between two mode sets, which the SCDC clock ratio change requires, and the idle PHY wastes power.
Reset and power down the PHY on disable, as the BCM2711 variant does.
--- drivers/gpu/drm/vc4/vc4_hdmi_phy.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/vc4/vc4_hdmi_phy.c +5 -0
@@ -1197,4 +1197,9 @@ void vc6_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi,void vc6_hdmi_phy_disable (struct vc4_hdmi *vc4_hdmi) { +unsigned long flags; + +spin_lock_irqsave (&vc4_hdmi->hw_lock, flags); +vc6_hdmi_reset_phy (vc4_hdmi); +spin_unlock_irqrestore (&vc4_hdmi->hw_lock, flags); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 92/507 drm/vc4: hdmi: always cancel the scrambling work synchronously
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas Tanure <[email protected]>
[ Upstream commit 2e47848f0d076dec66df3bc403214073cd2214ac ]
The scrambling work re-arms itself every second while a scrambled mode is active. When the output is disabled, the work may be executing at that moment rather than pending, and delayed_work_pending() is then false, so the cancel is skipped. The running instance finishes after the disable, sees the sink report scrambling off, writes the SCDC scrambling and clock ratio bits back on, and queues itself again. The sink is left configured for a scrambled 1/40 link that no longer exists and the work keeps running until the next enable.
cancel_delayed_work_sync() handles both states: it waits for a running instance and blocks it from queueing itself again.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +1 -2
@@ -842,8 +842,7 @@ static void vc4_hdmi_disable_scrambling(struct drm_encoder *encoder) vc4_hdmi->scdc_enabled = false; -if (delayed_work_pending (&vc4_hdmi->scrambling_work)) -cancel_delayed_work_sync (&vc4_hdmi->scrambling_work); +cancel_delayed_work_sync (&vc4_hdmi->scrambling_work);if (!drm_dev_enter (drm, &idx))return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 93/507 drm/vc4: hdmi: enable scrambling before the TMDS clock starts
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas Tanure <[email protected]>
[ Upstream commit 81383bd290a18f06ccf9b0bfb29e1a3ef73d9357 ]
HDMI 2.0 requires a source to suspend the TMDS clock, write the TMDS_Bit_Clock_Ratio bit in the sink's SCDC registers, wait at least 1 ms and only then resume the clock. vc4 does the opposite: the PHY starts at the new rate first, and the SCDC bits are written tens of milliseconds later, at the very end of the enable sequence, together with the source side scrambler. On disable the bits are cleared while the clock is still running.
Some sinks sample the bit only when the clock appears. One HDMI 2.0 sink we tested then sets up its receiver for a 1/10 clock and never
recovers: a Raspberry Pi 5 at 3840x2160@60 shows no picture, while 1080p60 and 4K30 work and other sources work at 4K60 on the same sink. Writing the bit by hand before enabling the output makes the same mode lock every time.
Enable scrambling, on the sink and in the controller, before the PHY is started, and disable it only after the PHY has been stopped. The SCDC helper already waits the required time after writing the ratio bit.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +4 -3
@@ -917,8 +917,6 @@ static void vc4_hdmi_encoder_post_crtc_disable(struct drm_encoder *encoder,spin_unlock_irqrestore (&vc4_hdmi->hw_lock, flags); } -vc4_hdmi_disable_scrambling (encoder); -drm_dev_exit (idx); out:
@@ -946,6 +944,8 @@ static void vc4_hdmi_encoder_post_crtc_powerdown(struct drm_encoder *encoder,if (vc4_hdmi->variant->phy_disable) vc4_hdmi->variant->phy_disable (vc4_hdmi); +vc4_hdmi_disable_scrambling (encoder); +clk_disable_unprepare (vc4_hdmi->pixel_bvb_clock);clk_disable_unprepare (vc4_hdmi->pixel_clock);
@@ -1553,6 +1553,8 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder, goto err_disable_pixel_clock; } +vc4_hdmi_enable_scrambling (encoder); +if (vc4_hdmi->variant->phy_init) vc4_hdmi->variant->phy_init (vc4_hdmi, conn_state);
@@ -1687,7 +1689,6 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder, }vc4_hdmi_recenter_fifo (vc4_hdmi); -vc4_hdmi_enable_scrambling (encoder);drm_dev_exit (idx);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 94/507 sctp: account for chunk padding in sctp_init_cause()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masafumi Suzuki <[email protected]>
[ Upstream commit ed6c53b27be492643da2017c6f8e2732be5edf1a ]
sctp_init_cause() accepts a chunk when skb_tailroom() can hold the cause header and the payload. sctp_addto_chunk() then writes 0-3 bytes of padding before that header so the chunk stays 4-byte aligned. The check does not include the padding, and the following skb_put() calls skb_over_panic() from softirq.
Count the padding sctp_addto_chunk() is about to write. The cause length on the wire stays the header plus the payload.
Found by LLM inspection, triggered and tested the fix.
--- net/sctp/sm_make_chunk.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/sctp/sm_make_chunk.c +8 -1
@@ -136,6 +136,7 @@ int sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code, size_t paylen) {struct sctp_errhdr err; +int chunklen, padlen;__u16 len;/* Cause code constants are now defined in network order. */
@@ -143,7 +144,13 @@ int sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code, len =sizeof (err) + paylen; err.length =htons (len); -if (skb_tailroom (chunk->skb) < len) +/* sctp_addto_chunk() pads the chunk up to a 4-byte boundary before +* appending the cause, so account for that padding here as well. +*/ + chunklen =ntohs (chunk->chunk_hdr->length); + padlen =SCTP_PAD4 (chunklen) - chunklen; + +if (skb_tailroom (chunk->skb) < padlen + len)return -ENOSPC ; chunk->subh.err_hdr =sctp_addto_chunk (chunk,sizeof (err), &err);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 95/507 btrfs: fix chattr failing on nodatasum files that have the compress flag
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hengyu Liang <[email protected]>
[ Upstream commit 16b8f07d1ed50d4a8da468b56484873784dd8f4a ]
Commit cf1afec09e9f ("btrfs: validate properties before setting them") made btrfs_set_prop() validate a property before setting it. For the compression property, the validation fails with -EINVAL when the inode has NODATASUM.
However, chattr writes back all the flags it read from the file, and btrfs_fileattr_set() sets the compression property whenever the new flags include FS_COMPR_FL, even when the compression flags do not change. A file created on a filesystem mounted with nodatasum has NODATASUM and still inherits the compress flag from its directory. As of now, chattr fails on such a file when it changes any other flag.
The issue can be reproduced with:
mkfs.btrfs -f /dev/sdb
mount -o nodatasum /dev/sdb /mnt
mkdir /mnt/dir
chattr +c /mnt/dir
touch /mnt/dir/file
chattr +A /mnt/dir/file
Before commit cf1afec09e9f ("btrfs: validate properties before setting them"), the last command succeeds.
After that commit, it fails with EINVAL.
This patch will make btrfs_fileattr_set() leave the compression flags and the compression property alone when the call changes neither FS_COMPR_FL nor FS_NOCOMP_FL.
--- fs/btrfs/ioctl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/btrfs/ioctl.c +13 -0
@@ -375,6 +375,19 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap, } } +/* +* Callers write back the whole flag set, so only touch the compression +* flags and the compression property if FS_COMPR_FL or FS_NOCOMP_FL +* changes. +*/ +if (!((fsflags ^ old_fsflags) & (FS_COMPR_FL |FS_NOCOMP_FL ))) { +/* 1 item for the inode */ + trans =btrfs_start_transaction (root,1 ); +if (IS_ERR (trans)) +return PTR_ERR (trans); + goto update_flags; + } +/* * The COMPRESS flag can only be changed by users, while the NOCOMPRESS * flag may be changed automatically if compression code won't make
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 55/507 net/9p/usbg: fix out_req buffer leak in disable_usb9pfs
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Grzeschik <[email protected]>
[ Upstream commit 5f9807270c7bda8f86b312ed1a8acd7716600555 ]
usb9pfs->out_req is allocated with alloc_ep_req(), which also allocates the request's data buffer (req->buf). disable_usb9pfs() frees it with plain usb_ep_free_request(), which only frees the usb_request structure itself and leaks req->buf on every close.
Use free_ep_req() instead, matching the allocator, as documented by its own comment ("Requests allocated via alloc_ep_req() *must* be freed by free_ep_req()").
Message-ID: <[email protected]>
--- net/9p/trans_usbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/9p/trans_usbg.c +1 -1
@@ -287,7 +287,7 @@ static void disable_usb9pfs(struct f_usb9pfs *usb9pfs) }if (usb9pfs->out_req) { -usb_ep_free_request (usb9pfs->out_ep, usb9pfs->out_req); +free_ep_req (usb9pfs->out_ep, usb9pfs->out_req); usb9pfs->out_req =NULL ; } dev_dbg(&cdev->gadget->dev, "%s disabled\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 56/507 net/9p/usbg: remove bogus context initialization in alloc_requests
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Grzeschik <[email protected]>
[ Upstream commit bbdb38b2e543ffa72dca5450f2535cf998ef1cdd ]
alloc_requests() initializes usb9pfs->in_req->context to point at the struct f_usb9pfs instance itself. usb9pfs_queue_tx() later overwrites this with the real struct p9_req_t pointer before every transmit, and usb9pfs_tx_complete() clears it back to NULL after each completion, so in_req->context only ever holds a valid p9_req_t once a request has actually been queued.
usb9pfs_clear_tx(), however, can run at any time (mount close, gadget disable) independent of whether a request was ever queued. If it runs before the first usb9pfs_transmit(), it reads the leftover sentinel value, type-confuses the struct f_usb9pfs pointer as a struct p9_req_t, and both writes through it (req->t_err = -ECONNRESET) and hands it to p9_client_cb(), which manipulates req->wq and req->refcount at bogus offsets inside f_usb9pfs. This reliably corrupts memory or panics whenever the transport is torn down before any 9p request has been transmitted, e.g. mounting and immediately unmounting, or a cable disconnect racing the very first request.
usb9pfs->out_req->context is set the same way but is never read by this transport (usb9pfs_rx_complete() identifies the instance via ep->driver_data instead), so it serves no purpose either.
Both endpoints' ->driver_data are already set to usb9pfs in enable_endpoint(), which is what the completion handlers actually use to recover the f_usb9pfs instance. Just drop the leftover ->context assignments; usb_ep_alloc_request()/alloc_ep_req() already return zeroed requests, so in_req->context correctly starts out NULL.
Message-ID: <[email protected]>
--- net/9p/trans_usbg.c | 4 ---- 1 file changed, 4 deletions(-)
net/9p/trans_usbg.c +0 -4
@@ -314,10 +314,6 @@ static int alloc_requests(struct usb_composite_dev *cdev, usb9pfs->in_req->complete = usb9pfs_tx_complete; usb9pfs->out_req->complete = usb9pfs_rx_complete; -/* length will be set in complete routine */ - usb9pfs->in_req->context = usb9pfs; - usb9pfs->out_req->context = usb9pfs; -return 0 ; fail_in:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 57/507 net/9p/usbg: clear stale client pointer on close
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyungjung Joo <[email protected]>
[ Upstream commit a478958f4c1181ff3362f8857b489c2d069f9c7d ]
p9_usbg_close() tears down the client transport, but usb9pfs keeps using usb9pfs->client from asynchronous TX and RX completion handlers. A late completion can therefore dereference a client that has already been freed during mount teardown.
Clear usb9pfs->client under usb9pfs->lock when closing the transport, detach any pending TX request from in_req->context, and make the TX/RX completion handlers bail out once the transport has been detached. This keeps late completions from touching a freed or rebound p9_client.
Message-ID: <[email protected]>
--- net/9p/trans_usbg.c | 61 +++++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 16 deletions(-)
net/9p/trans_usbg.c +45 -16
@@ -149,7 +149,8 @@ static void usb9pfs_tx_complete(struct usb_ep *ep, struct usb_request *req) {struct f_usb9pfs *usb9pfs = ep->driver_data;struct usb_composite_dev *cdev = usb9pfs->function.config->cdev; -struct p9_req_t *p9_tx_req = req->context; +struct p9_client *client; +struct p9_req_t *p9_tx_req;unsigned long flags;/* reset zero packages */
@@ -165,18 +166,25 @@ static void usb9pfs_tx_complete(struct usb_ep *ep, struct usb_request *req) ep->name, req->status, req->actual, req->length);spin_lock_irqsave (&usb9pfs->lock, flags); -WRITE_ONCE (p9_tx_req->status,REQ_STATUS_SENT ); + client = usb9pfs->client; + p9_tx_req = req->context; + req->context =NULL ; -p9_req_put (usb9pfs->client, p9_tx_req); +if (!client || !p9_tx_req) + goto unlock_complete; - req->context =NULL ; +WRITE_ONCE (p9_tx_req->status,REQ_STATUS_SENT ); +p9_req_put (client, p9_tx_req); + +unlock_complete:spin_unlock_irqrestore (&usb9pfs->lock, flags);complete (&usb9pfs->send); } -static struct p9_req_t *usb9pfs_rx_header (struct f_usb9pfs *usb9pfs,void *buf) +static struct p9_req_t *usb9pfs_rx_header (struct f_usb9pfs *usb9pfs, +struct p9_client *client,void *buf) {struct p9_req_t *p9_rx_req;struct p9_fcall rc;
@@ -202,7 +210,7 @@ static struct p9_req_t *usb9pfs_rx_header(struct f_usb9pfs *usb9pfs, void *buf)"mux %p pkt: size: %d bytes tag: %d\n" , usb9pfs, rc.size, rc.tag); - p9_rx_req =p9_tag_lookup (usb9pfs->client, rc.tag); + p9_rx_req =p9_tag_lookup (client, rc.tag);if (!p9_rx_req || p9_rx_req->status !=REQ_STATUS_SENT ) {p9_debug (P9_DEBUG_ERROR ,"Unexpected packet tag %d\n" , rc.tag);return NULL ;
@@ -212,7 +220,7 @@ static struct p9_req_t *usb9pfs_rx_header(struct f_usb9pfs *usb9pfs, void *buf)p9_debug (P9_DEBUG_ERROR ,"requested packet size too big: %d for tag %d with capacity %zd\n" , rc.size, rc.tag, p9_rx_req->rc.capacity); -p9_req_put (usb9pfs->client, p9_rx_req); +p9_req_put (client, p9_rx_req);return NULL ; }
@@ -220,7 +228,7 @@ static struct p9_req_t *usb9pfs_rx_header(struct f_usb9pfs *usb9pfs, void *buf)p9_debug (P9_DEBUG_ERROR ,"No recv fcall for tag %d (req %p), disconnecting!\n" , rc.tag, p9_rx_req); -p9_req_put (usb9pfs->client, p9_rx_req); +p9_req_put (client, p9_rx_req);return NULL ; }
@@ -231,8 +239,10 @@ static void usb9pfs_rx_complete(struct usb_ep *ep, struct usb_request *req) {struct f_usb9pfs *usb9pfs = ep->driver_data;struct usb_composite_dev *cdev = usb9pfs->function.config->cdev; +struct p9_client *client;struct p9_req_t *p9_rx_req;unsigned int req_size = req->actual; +unsigned long flags;int status =REQ_STATUS_RCVD ;if (req->status) {
@@ -241,9 +251,16 @@ static void usb9pfs_rx_complete(struct usb_ep *ep, struct usb_request *req)return ; } - p9_rx_req =usb9pfs_rx_header (usb9pfs, req->buf); -if (!p9_rx_req) +spin_lock_irqsave (&usb9pfs->lock, flags); + client = usb9pfs->client; +if (!client) { +spin_unlock_irqrestore (&usb9pfs->lock, flags);return ; + } + + p9_rx_req =usb9pfs_rx_header (usb9pfs, client, req->buf); +if (!p9_rx_req) + goto out_unlock;if (req_size > p9_rx_req->rc.capacity) { dev_err(&cdev->gadget->dev,
@@ -257,8 +274,11 @@ static void usb9pfs_rx_complete(struct usb_ep *ep, struct usb_request *req) p9_rx_req->rc.size = req_size; -p9_client_cb (usb9pfs->client, p9_rx_req, status); -p9_req_put (usb9pfs->client, p9_rx_req); +p9_client_cb (client, p9_rx_req, status); +p9_req_put (client, p9_rx_req); + +out_unlock: +spin_unlock_irqrestore (&usb9pfs->lock, flags);complete (&usb9pfs->received); }
@@ -412,7 +432,9 @@ static int p9_usbg_create(struct p9_client *client, struct fs_context *fc) client->status = Disconnected; else client->status = Connected; +spin_lock_irq (&usb9pfs->lock); usb9pfs->client = client; +spin_unlock_irq (&usb9pfs->lock); client->trans_mod->maxsize = usb9pfs->buflen;
@@ -423,18 +445,25 @@ static int p9_usbg_create(struct p9_client *client, struct fs_context *fc)static void usb9pfs_clear_tx (struct f_usb9pfs *usb9pfs) { +struct p9_client *client;struct p9_req_t *req; +unsigned long flags; -guard (spinlock_irqsave)(&usb9pfs->lock); +spin_lock_irqsave (&usb9pfs->lock, flags); + client = usb9pfs->client; + usb9pfs->client =NULL ; + req = usb9pfs->in_req ? usb9pfs->in_req->context :NULL ; +if (usb9pfs->in_req) + usb9pfs->in_req->context =NULL ; +spin_unlock_irqrestore (&usb9pfs->lock, flags); - req = usb9pfs->in_req->context; -if (!req) +if (!req || !client)return ;if (!req->t_err) req->t_err = -ECONNRESET ; -p9_client_cb (usb9pfs->client, req,REQ_STATUS_ERROR ); +p9_client_cb (client, req,REQ_STATUS_ERROR ); usb9pfs->in_req->context =NULL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 58/507 xfrm: interface: validate the IP header on xmit
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qihang <[email protected]>
[ Upstream commit 86de3a1118a16dbbbe5fabe9aa20ffb93c072ed5 ]
Packets injected into an xfrm interface (e.g. AF_PACKET on an xfrmi device) reach the xfrm output path without IP header validation, but xfrm4_transport_output() uses iph->ihl for __skb_pull() and memmove() and expects the header to be valid.
vti_tunnel_xmit() already calls pskb_inet_may_pull() before handing packets to the xfrm output path. Do the same in xfrmi_xmit() and perform the header checks ip_rcv_core()/ip6_rcv_core() do on entry to the IP stack: reject wrong IP versions and malformed IPv4 header lengths.
--- net/xfrm/xfrm_interface_core.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/xfrm/xfrm_interface_core.c +8 -0
@@ -531,8 +531,13 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev)memset (&fl,0 ,sizeof (fl)); +if (!pskb_inet_may_pull (skb)) + goto tx_err; +switch (skb->protocol) {case htons (ETH_P_IPV6 ): +if (ipv6_hdr (skb)->version !=6 ) + goto tx_err;memset (IP6CB (skb),0 ,sizeof (*IP6CB (skb)));xfrm_decode_session (dev_net (dev), skb, &fl,AF_INET6 );if (!dst) {
@@ -548,6 +553,9 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev) }break ;case htons (ETH_P_IP ): +if (ip_hdr (skb)->version !=4 ||ip_hdr (skb)->ihl <5 || + !pskb_network_may_pull (skb,ip_hdr (skb)->ihl *4 )) + goto tx_err;memset (IPCB (skb),0 ,sizeof (*IPCB (skb)));xfrm_decode_session (dev_net (dev), skb, &fl,AF_INET );if (!dst) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 59/507 xfrm: espintcp: reorder operations within espintcp_init_sk
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit f9a11716c8445b496e9fafeec7e8412d384d02e2 ]
When enabled on a socket, espintcp sets the socket callbacks to its own before it has finished setting up its context and published it as icsk_ulp_data. Any one of those callbacks that gets called before will dereference a NULL icsk_ulp_data.
Fix this by reording the operations, and add memory barriers to ensure callers will have a struct espintcp_ctx available. Add a few WRITE_ONCE/READ_ONCE too while we're there.
--- include/net/espintcp.h | 5 +++-- net/xfrm/espintcp.c | 43 +++++++++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 19 deletions(-)
include/net/espintcp.h +3 -2
@@ -34,7 +34,8 @@ static inline struct espintcp_ctx *espintcp_getctx(const struct sock *sk) {const struct inet_connection_sock *icsk =inet_csk (sk); -/* RCU is only needed for diag */ -return (__force void *)icsk->icsk_ulp_data; +/* pairs with smp_wmb() in espintcp_init_sk() */ +smp_rmb (); +return (__force void *)READ_ONCE (icsk->icsk_ulp_data); }#endif
net/xfrm/espintcp.c +26 -17
67 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 50/507 net/9p/usbg: Fix use-after-free in disable_usb9pfs()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yizhou Zhao <[email protected]>
[ Upstream commit 6f401e350939442b2ac905f7e5ac952e3802a5d8 ]
disable_usb9pfs() frees the IN and OUT usb_request objects before it disables the corresponding endpoints. If either request is still queued, the later usb_ep_disable() call cancels the endpoint queue and the UDC driver can still access the already freed request.
With dummy_hcd and KASAN, this is reproducible by queueing the OUT request and then disconnecting the configfs gadget:
BUG: KASAN: slab-use-after-free in dummy_disable+0x2b4/0x300 Read of size 8 at addr ffff888009702400 by task sh/1 usb_ep_disable+0x8e/0x1f0 usb9pfs_func_unbind+0x193/0x350 gadget_dev_desc_UDC_store+0x135/0x280
dummy_free_request() also warns because the request is freed while its queue entry is still linked.
Disable both endpoints before freeing the request objects. This lets usb_ep_disable() cancel any queued transfers and invoke the completion callback while the request storage is still valid. The request objects are then freed only after they have been removed from the endpoint queues.
Message-ID: <[email protected]>
--- net/9p/trans_usbg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/9p/trans_usbg.c +3 -3
@@ -278,6 +278,9 @@ static void disable_usb9pfs(struct f_usb9pfs *usb9pfs)struct usb_composite_dev *cdev = usb9pfs->function.config->cdev; +disable_ep (cdev, usb9pfs->in_ep); +disable_ep (cdev, usb9pfs->out_ep); +if (usb9pfs->in_req) {usb_ep_free_request (usb9pfs->in_ep, usb9pfs->in_req); usb9pfs->in_req =NULL ;
@@ -287,9 +290,6 @@ static void disable_usb9pfs(struct f_usb9pfs *usb9pfs)usb_ep_free_request (usb9pfs->out_ep, usb9pfs->out_req); usb9pfs->out_req =NULL ; } - -disable_ep (cdev, usb9pfs->in_ep); -disable_ep (cdev, usb9pfs->out_ep);dev_dbg (&cdev->gadget->dev,"%s disabled\n" , usb9pfs->function.name); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 97/507 btrfs: prevent deleting the wrong subvolume by ID
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: guolingxing <[email protected]>
[ Upstream commit 1960146913b31b288ed2cd607d103ee3b41681d4 ]
When deleting a subvolume by ID, btrfs_ioctl_snap_destroy() first resolves the requested ID to a name, then looks up that name again under the parent directory lock.
A concurrent rename can change which subvolume is associated with the name between these operations. Since the deletion path does not verify the ID of the resolved subvolume, it can delete a different subvolume while leaving the requested one intact.
This was reproduced by repeatedly exchanging the names of two subvolumes using renameat2(RENAME_EXCHANGE) while deleting one of them by ID. The wrong subvolume was deleted in 9 out of 14 independent tests.
Fix this by checking that the resolved subvolume ID matches the requested ID while holding the parent directory lock. Return -EAGAIN on a mismatch so that userspace can retry the operation instead of being told that the requested subvolume does not exist.
--- fs/btrfs/ioctl.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/btrfs/ioctl.c +11 -0
@@ -2393,6 +2393,17 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, inode =d_inode (dentry); dest =BTRFS_I (inode)->root; + +/* +* A concurrent rename may have changed which subvolume the name +* refers to. Verify that the resolved ID still matches the requested ID. +*/ +if (destroy_v2 && (vol_args2->flags &BTRFS_SUBVOL_SPEC_BY_ID ) && +btrfs_root_id (dest) != vol_args2->subvolid) { + ret = -EAGAIN ; + goto out_end_removing; + } +if (!capable (CAP_SYS_ADMIN )) {/* * Regular user. Only allow this with a special mount
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 106/507 ALSA: us122l: Add missing NULL check in usb_stream_hwdep_mmap()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <[email protected]>
[ Upstream commit f5d3eb483fed59fc0f3b059b8b6a32cedc922360 ]
usb_stream_hwdep_mmap() reads us122l->sk.s and dereferences it without checking for NULL. The stream object is released by usb_stream_free(), which is reached through us122l_stop() both when the device is disconnected and when us122l_start() fails, and it leaves us122l->sk.s set to NULL. The hwdep file stays usable after that, so a later mmap()
KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017] RIP: 0010:usb_stream_hwdep_mmap+0x107/0x890 sound/usb/usx2y/us122l.c:182
crashes while reading s->read_size, which sits at offset 0x10.
That NULL is an expected state for this field: usb_stream_hwdep_vm_fault(), usb_stream_hwdep_poll(), usb_stream_hwdep_ioctl(), usb_stream_stop() and usb_stream_free() all test it before use. Only the mmap callback misses the check, so let it return -ENODEV, matching what the other hwdep mapping in usx2yhwdeppcm.c does when its shared buffer has not been allocated.
--- sound/usb/usx2y/us122l.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/usx2y/us122l.c +2 -0
@@ -179,6 +179,8 @@ static int usb_stream_hwdep_mmap(struct snd_hwdep *hw, offset = area->vm_pgoff <<PAGE_SHIFT ;guard (mutex)(&us122l->mutex); s = us122l->sk.s; +if (!s) +return -ENODEV ; read = offset < s->read_size;if (read) {if (area->vm_flags &VM_WRITE )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 107/507 ALSA: us122l: Fix NULL dereference at hwdep open and release
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <[email protected]>
[ Upstream commit 820e0050866942b5498488496462d12c6ce1c7a9 ]
usb_stream_hwdep_open() and usb_stream_hwdep_release() pass the result of usb_ifnum_to_if() straight to usb_autopm_get_interface() and usb_autopm_put_interface(), without checking it for NULL.
usb_ifnum_to_if() returns NULL once the device is gone, since usb_disable_device() clears udev->actconfig on disconnect. The hwdep file can outlive the disconnect: the card is released with snd_card_free_when_closed(), so a process that keeps the character device open reaches the driver's release callback after the USB configuration has been dropped, and interface_to_usbdev() then dereferences the NULL interface at offsetof(struct device, parent). The open callback has the same problem when it races with the disconnect.
Check both lookups and fail the open with -ENODEV; in release, skip the runtime PM put when the interface is already gone and still run the rest of the per-file cleanup. Move the us122l->first bookkeeping after the checks so that a failed open no longer leaves a stale file pointer behind.
--- sound/usb/usx2y/us122l.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
sound/usb/usx2y/us122l.c +17 -8
@@ -129,19 +129,26 @@ static const struct vm_operations_struct usb_stream_hwdep_vm_ops = {static int usb_stream_hwdep_open (struct snd_hwdep *hw,struct file *file) {struct us122l *us122l = hw->private_data; -struct usb_interface *iface; +struct usb_interface *iface, *iface0 =NULL ;if (hw->used >=2 )return -EBUSY ; -if (!us122l->first) - us122l->first = file; -if (us122l->is_us144) { - iface =usb_ifnum_to_if (us122l->dev,0 ); -usb_autopm_get_interface (iface); + iface0 =usb_ifnum_to_if (us122l->dev,0 ); +if (!iface0) +return -ENODEV ; } + iface =usb_ifnum_to_if (us122l->dev,1 ); +if (!iface) +return -ENODEV ; + +if (!us122l->first) + us122l->first = file; + +if (iface0) +usb_autopm_get_interface (iface0);usb_autopm_get_interface (iface);return 0 ; }
@@ -153,10 +160,12 @@ static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file)if (us122l->is_us144) { iface =usb_ifnum_to_if (us122l->dev,0 ); -usb_autopm_put_interface (iface); +if (iface) +usb_autopm_put_interface (iface); } iface =usb_ifnum_to_if (us122l->dev,1 ); -usb_autopm_put_interface (iface); +if (iface) +usb_autopm_put_interface (iface);if (us122l->first == file) us122l->first =NULL ;guard (mutex)(&us122l->mutex);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 108/507 ALSA: usx2y: Initialize idle URBs before submitting streams
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <[email protected]>
[ Upstream commit ceb0d8c22473933099b46cec70639d0f1f7c68ad ]
usb_stream_start() submits the first two capture and playback URBs and only afterwards assigns sk->idle_inurb, sk->idle_outurb, sk->completed_inurb and sk->completed_outurb to the remaining two URBs of each direction.
A transfer can complete as soon as usb_submit_urb() has been called, so the completion handler i_capture_start() or i_playback_start() may run before those pointers are set. While the stream is still being synchronized (state below usb_stream_sync1), stream_start() then calls playback_prep_freqn(sk, sk->idle_outurb) with sk->idle_outurb still NULL, and the packet descriptors are written through that NULL pointer:
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000018: 0000 [#1] SMP KASAN KASAN: null-ptr-deref in range [0x00000000000000c0-0x00000000000000c7] RIP: 0010:playback_prep_freqn+0x11c/0x4a0 sound/usb/usx2y/usb_stream.c:33 Call Trace: <IRQ> stream_start+0x5dc/0x8d0 sound/usb/usx2y/usb_stream.c:596 i_capture_start+0x3da/0x710 sound/usb/usx2y/usb_stream.c:654 __usb_hcd_giveback_urb+0x238/0x550 drivers/usb/core/hcd.c:1657 usb_giveback_urb_bh+0x20b/0x530 drivers/usb/core/hcd.c:1691 tasklet_hi_action+0xa/0x20 kernel/softirq.c:994 handle_softirqs+0x16f/0x440 kernel/softirq.c:645 </IRQ>
The four URBs referenced by these pointers are allocated long before and do not depend on any transfer state, so assign them before the submit loop. Keeping the assignment inside the retry path also restores a well-defined URB rotation when the start frame mismatch handling kills and resubmits the streams.
--- sound/usb/usx2y/usb_stream.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
sound/usb/usx2y/usb_stream.c +4 -5
@@ -682,6 +682,10 @@ int usb_stream_start(struct usb_stream_kernel *sk) s->sync_packet =-1 ; s->inpacket_head =-1 ; sk->iso_frame_balance =0 ; + sk->idle_inurb = sk->inurb[USB_STREAM_NURBS -2 ]; + sk->idle_outurb = sk->outurb[USB_STREAM_NURBS -2 ]; + sk->completed_inurb = sk->inurb[USB_STREAM_NURBS -1 ]; + sk->completed_outurb = sk->outurb[USB_STREAM_NURBS -1 ]; ++try;for (u =0 ; u <2 ; u++) {struct urb *inurb = sk->inurb[u];
@@ -739,11 +743,6 @@ int usb_stream_start(struct usb_stream_kernel *sk)return -EFAULT ; } - sk->idle_inurb = sk->inurb[USB_STREAM_NURBS -2 ]; - sk->idle_outurb = sk->outurb[USB_STREAM_NURBS -2 ]; - sk->completed_inurb = sk->inurb[USB_STREAM_NURBS -1 ]; - sk->completed_outurb = sk->outurb[USB_STREAM_NURBS -1 ]; -/* wait, check */ {int wait_ms =3000 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 109/507 ALSA: hwdep: Serialize DSP load requests
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <[email protected]>
[ Upstream commit aee83c204f80d56b4d55f53acdb8594308ddcd4a ]
The check of the loaded DSP indices and the call of the driver's dsp_load callback in snd_hwdep_dsp_load() are not serialized. A hwdep file descriptor can be shared among threads, or inherited across fork, so two SNDRV_HWDEP_IOCTL_DSP_LOAD requests for the same index can both observe the index as unloaded and enter the driver's callback concurrently, even though the device itself is opened exclusively.
This breaks the assumption behind hw->dsp_loaded that a firmware index is loaded only once. For example, snd-usb-usx2y hits WARN_ON(usx2y->as04.buffer) in usx2y_async_seq04_init() and may allocate the US-428 sequence URBs twice.
Serialize the check, the callback invocation and the bookkeeping with a per-hwdep mutex, so that the second request returns -EBUSY.
--- include/sound/hwdep.h | 1 + sound/core/hwdep.c | 2 ++ 2 files changed, 3 insertions(+)
include/sound/hwdep.h +1 -0
@@ -57,6 +57,7 @@ struct snd_hwdep {struct mutex open_mutex;int used;/* reference counter */ +struct mutex dsp_mutex;/* serializes DSP load requests */ unsigned int dsp_loaded;/* bit fields of loaded dsp indices */ unsigned int exclusive:1; /* exclusive access mode */ };
sound/core/hwdep.c +2 -0
@@ -212,6 +212,7 @@ static int snd_hwdep_dsp_load(struct snd_hwdep *hw,return -ENXIO ;if (info->index >=32 )return -EINVAL ; +guard (mutex)(&hw->dsp_mutex);/* check whether the dsp was already loaded */ if (hw->dsp_loaded & (1u << info->index))return -EBUSY ;
@@ -380,6 +381,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,init_waitqueue_head (&hwdep->open_wait);mutex_init (&hwdep->open_mutex); +mutex_init (&hwdep->dsp_mutex); hwdep->card = card; hwdep->device = device;if (id)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 110/507 bpf: Fix skb_pull() BUG in __bpf_redirect_neigh()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 23503acb214cbefaf3945d05ab9667ff11ae3de9 ]
The issue:
This is a follow-up to the short link-layer header fixes from Eric. After vlan pop_eth, a privileged SCHED_ACT BPF program can call bpf_skb_change_head(skb, 1, 0) and then bpf_redirect_neigh().
__bpf_redirect_neigh() calls skb_pull(skb, sizeof(*ethh)) after checking only that mac_header < network_header. Nothing verifies that the MAC header is long enough, that it is linear, or that the IP header the redirect goes on to read is linear either.
A SCHED_ACT BPF program can do:
bpf_skb_change_head(skb, 1, 0);
bpf_redirect_neigh(lo, NULL, 0, 0);after vlan pop_eth. The skb then has mac_len == 1 and only one byte of linear data; skb_pull(ETH_HLEN) trips the skb->len < skb->data_len BUG in __skb_pull():
kernel BUG at ./include/linux/skbuff.h:2839!
RIP: skb_pull+0x40/0x50
Call Trace: skb_do_redirect -> packet_xmit -> packet_sendmsg Kernel panic - not syncing: Fatal exception in interrupt
The v4 and v6 paths read ip_hdr() and ipv6_hdr() as soon as the MAC header is gone. On the AF_PACKET frame below that leaves headlen == 0 after the pull, so the network header sits at skb->tail and the route lookup reads ip4h->protocol, ip4h->saddr and ip4h->daddr past the linear area.
The Fix:
Use skb_network_offset(), which is the MAC header span, instead of skb->mac_len. mac_len is zero for locally generated tc egress and netkit packets, while the span still rejects the one-byte header produced by pop_eth + bpf_skb_change_head(skb, 1, 0). The single check also covers the mac_header >= network_header test it replaces.
Use pskb_may_pull() to make the Ethernet header linear before it is read or pulled, and to make the IP header linear in both the v4 and the v6 path before ip_hdr()/ipv6_hdr() is read. The header pointers are taken after the pull, since pskb_may_pull() may reallocate skb->head.
Conditions to recreate the bug:
On x86-64 with 4 KiB pages, enable CONFIG_PACKET, CONFIG_BPF_SYSCALL, CONFIG_NET_SCH_INGRESS, CONFIG_NET_CLS_MATCHALL, CONFIG_NET_ACT_VLAN and CONFIG_NET_ACT_BPF. Run as root with BPF loading, network administration and raw-packet privileges. Bring lo up and attach a SCHED_ACT program that calls bpf_skb_change_head(skb, 1, 0), then returns bpf_redirect_neigh(skb->ifindex, NULL, 0, 0):
ip link set lo up
tc qdisc add dev lo clsact
tc filter add dev lo egress matchall action vlan pop_eth pipe \
action bpf object-file neigh_chghead.o section action
Send an untagged ETH_P_IP frame of ETH_HLEN + 8192 bytes through an AF_PACKET/SOCK_RAW socket bound to lo, without PACKET_VNET_HDR or PACKET_QDISC_BYPASS. Use a unicast destination MAC. The sender's skb has a 14-byte linear Ethernet prefix and a fragmented payload; pop_eth removes that prefix and change_head restores only one linear byte. The unfixed neighbor redirect then tries to pull 14 bytes and BUGs.
Sending the same frame without pop_eth and change_head leaves the IP header in the frags, which is the route lookup reading past skb->tail.
--- net/core/filter.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
net/core/filter.c +14 -7
@@ -2271,9 +2271,13 @@ static int bpf_out_neigh_v6(struct net *net, struct sk_buff *skb,static int __bpf_redirect_neigh_v6 (struct sk_buff *skb,struct net_device *dev,struct bpf_nh_params *nh) { -const struct ipv6hdr *ip6h =ipv6_hdr (skb);struct net *net =dev_net (dev);int err, ret =NET_XMIT_DROP ; +const struct ipv6hdr *ip6h; + +if (unlikely (!pskb_may_pull (skb,sizeof (*ip6h)))) + goto out_drop; + ip6h =ipv6_hdr (skb);if (!nh) {struct dst_entry *dst;
@@ -2380,9 +2384,13 @@ static int bpf_out_neigh_v4(struct net *net, struct sk_buff *skb,static int __bpf_redirect_neigh_v4 (struct sk_buff *skb,struct net_device *dev,struct bpf_nh_params *nh) { -const struct iphdr *ip4h =ip_hdr (skb);struct net *net =dev_net (dev);int err, ret =NET_XMIT_DROP ; +const struct iphdr *ip4h; + +if (unlikely (!pskb_may_pull (skb,sizeof (*ip4h)))) + goto out_drop; + ip4h =ip_hdr (skb);if (!nh) { struct flowi4 fl4 = {
@@ -2432,15 +2440,14 @@ static int __bpf_redirect_neigh_v4(struct sk_buff *skb, struct net_device *dev,static int __bpf_redirect_neigh (struct sk_buff *skb,struct net_device *dev,struct bpf_nh_params *nh) { -struct ethhdr *ethh =eth_hdr (skb); - -if (unlikely (skb->mac_header >= skb->network_header)) +if (unlikely (skb_network_offset (skb) <ETH_HLEN || + !pskb_may_pull (skb,ETH_HLEN ))) goto out;bpf_push_mac_rcsum (skb); -if (is_multicast_ether_addr (ethh->h_dest)) +if (is_multicast_ether_addr (eth_hdr (skb)->h_dest)) goto out; -skb_pull (skb,sizeof (*ethh)); +skb_pull (skb,ETH_HLEN );skb_unset_mac_header (skb);skb_reset_network_header (skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 111/507 ksmbd: require DELETE access for delete-on-close opens
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Bridges <[email protected]>
[ Upstream commit 1dd91081ba3c692565f9c1f884149178d5a06d1e ]
smb2_open() accepts FILE_DELETE_ON_CLOSE on an existing file without DELETE in DesiredAccess. When the request asks only for FILE_READ_ATTRIBUTES or READ_CONTROL, it also skips inode_permission() and the parent directory MAY_WRITE | MAY_EXEC check that delete-on-close is meant to get. The file is then marked for deletion by a caller who could not delete it.
The unlink happens later, in __ksmbd_inode_close(), when the last handle on the inode is closed, and it runs with the credentials of that handle. If the caller closes last, the unlink fails. If another user who can write the parent directory, such as the file's owner, still has the file open, the file is deleted when that user closes it. Until then new opens of the file fail with STATUS_DELETE_PENDING. So a user with only search permission on a directory can delete a file in it, or block opens of it, while the owner has it open.
A MAXIMUM_ALLOWED open that also requests DELETE has the same problem. The requested access is replaced with the maximal access, which does not include DELETE when the caller cannot write the parent directory, and the later permission checks are skipped as already done.
MS-FSA 2.1.5.1 requires an open with FILE_DELETE_ON_CLOSE and without DELETE in DesiredAccess to fail with STATUS_INVALID_PARAMETER, and Samba does the same. Add that check to the CreateOptions validation, using the generic-mapped DesiredAccess so that GENERIC_ALL still qualifies. This also refuses MAXIMUM_ALLOWED with FILE_DELETE_ON_CLOSE but no explicit DELETE, as MS-FSA and Samba do. When MAXIMUM_ALLOWED is requested with DELETE but the maximal access does not include DELETE, fail with STATUS_ACCESS_DENIED. With DELETE requested, delete-on-close opens go through the existing parent directory check.
--- fs/smb/server/smb2pdu.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
fs/smb/server/smb2pdu.c +15 -0
@@ -4508,6 +4508,14 @@ int smb2_open(struct ksmbd_work *work) goto err_out2; } } + +/* MS-FSA 2.1.5.1: delete-on-close requires DELETE access */ +if (req->CreateOptions &FILE_DELETE_ON_CLOSE_LE && + !(smb_map_generic_desired_access (req->DesiredAccess) & +FILE_DELETE_LE )) { + rc = -EINVAL ; + goto err_out2; + } } if (le32_to_cpu(req->CreateDisposition) >
@@ -4777,6 +4785,13 @@ int smb2_open(struct ksmbd_work *work) maximal_access = daccess; } +/* MAXIMUM_ALLOWED may not have granted the requested DELETE */ +if (req->CreateOptions &FILE_DELETE_ON_CLOSE_LE && + !(daccess &FILE_DELETE_LE )) { + rc = -EACCES ; + goto err_out; + } + open_flags = smb2_create_open_flags(file_present, daccess, req->CreateDisposition, &may_flags,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 112/507 ksmbd: enforce the read-only share flag when creating a stream
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Bridges <[email protected]>
[ Upstream commit 09139429fab3a5114c18d7c15fb161511d4d66c9 ]
When a share is read-only, smb2_open() rejects opens that would create or truncate a file. Creating a named stream on an existing file with streams_xattr sets neither O_CREAT nor O_TRUNC, so it passes this check, and smb2_set_stream_name_xattr() then creates the stream. On a Time Machine share, opening a missing AFP_AfpInfo stream also writes one. A user who can write a file at the filesystem level can therefore add streams to it through a read-only share.
Do not create a stream or synthesize AFP_AfpInfo when the share is not writable. Existing streams still open normally, and a missing stream opened with FILE_OPEN still returns STATUS_OBJECT_NAME_NOT_FOUND.
--- fs/smb/server/smb2pdu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/smb/server/smb2pdu.c +5 -1
@@ -3453,7 +3453,8 @@ static noinline int smb2_set_stream_name_xattr(const struct path *path,if (fp->cdoption ==FILE_OPEN_LE ) {if (!strcmp (stream_name,"AFP_AfpInfo" ) &&test_share_config_flag (fp->tcon->share_conf, -KSMBD_SHARE_FLAG_TIME_MACHINE )) { +KSMBD_SHARE_FLAG_TIME_MACHINE ) && +test_tree_conn_flag (fp->tcon,KSMBD_TREE_CONN_FLAG_WRITABLE )) {/* * Synthesize an empty AFP_AfpInfo xattr on first access. * type=0/creator=0 tells macOS to use the file extension
@@ -3479,6 +3480,9 @@ static noinline int smb2_set_stream_name_xattr(const struct path *path,return -EBADF ; } +if (!test_tree_conn_flag (fp->tcon,KSMBD_TREE_CONN_FLAG_WRITABLE )) +return -EACCES ; + rc =ksmbd_vfs_setxattr (idmap, path, xattr_stream_name,NULL ,0 ,0 , false);if (rc <0 )pr_err ("Failed to store XATTR stream name :%d\n" , rc);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 113/507 ksmbd: revert fsids on durable reconnect and replay failure
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Bridges <[email protected]>
[ Upstream commit 539223f18026448f67d33d09719c355b91db7fd0 ]
On a durable handle reconnect or a request replay, smb2_open() switches to the SMB user's fsids before calling ksmbd_vfs_getattr(). If that call fails, the code jumps to err_out2 and skips ksmbd_revert_fsids() at err_out1. The user's credentials then stay installed on the shared ksmbd worker. Later work on that worker, including other users' requests, runs with the first user's fsuid, fsgid and supplementary groups. ksmbd_free_work_struct() also warns, because work->saved_cred is still set.
Jump to err_out1 instead. No path is held at this point, so skipping the path_put() at err_out is correct.
--- fs/smb/server/smb2pdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/smb/server/smb2pdu.c +2 -2
@@ -4432,7 +4432,7 @@ int smb2_open(struct ksmbd_work *work) file_info =FILE_OPENED ; rc =ksmbd_vfs_getattr (&fp->filp->f_path, &stat);if (rc) - goto err_out2; + goto err_out1; goto reconnected_fp; }
@@ -4462,7 +4462,7 @@ int smb2_open(struct ksmbd_work *work) rc =ksmbd_vfs_getattr (&fp->filp->f_path, &stat);if (rc) - goto err_out2; + goto err_out1; goto reconnected_fp; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 114/507 ksmbd: fix NULL pointer dereference in session_user_name() and session_account_type()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Blessed Kimani <[email protected]>
[ Upstream commit d13da43938d15b0b719827d8f2b32df8eaec5def ]
session_user_name() and session_account_type() dereference session->user without checking for NULL. A session can be published and exposed via the procfs session interface before authentication completes, during which session->user is NULL:
show_proc_session() -> session_user_name(sess)
-> user_guest(session->user) -> NULL->flags -> oops
Guard both functions by treating a NULL session->user as an explicit not-yet-authenticated state rather than dereferencing it.
--- fs/smb/server/mgmt/user_session.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/smb/server/mgmt/user_session.c +4 -0
@@ -89,6 +89,8 @@ static const char *session_state_string(struct ksmbd_session *session)static const char *session_user_name (struct ksmbd_session *session) { +if (!session->user) +return "(Unauthenticated)" ;if (user_guest (session->user))return "(Guest)" ;else if (ksmbd_anonymous_user (session->user))
@@ -98,6 +100,8 @@ static const char *session_user_name(struct ksmbd_session *session)static const char *session_account_type (struct ksmbd_session *session) { +if (!session->user) +return "unauthenticated" ;if (user_guest (session->user))return "guest" ;if (ksmbd_anonymous_user (session->user))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 115/507 rust: cpufreq: fix `undocumented_unsafe_blocks` in `PolicyCpu::from_cpu()`
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miguel Ojeda <[email protected]>
[ Upstream commit 62a40c72905be262e9e10790008d505ed0be6c0f ]
For Rust <= 1.86, Clippy triggers after commit 02c5d7bfa872 ("rust:
cpufreq: reject NULL from cpufreq_cpu_get()"):
warning: unsafe block missing a safety comment
--> rust/kernel/cpufreq.rs:700:26
|
700 | NonNull::new(unsafe { bindings::cpufreq_cpu_get(u32::from(cpu)) }).ok_or(ENODEV)?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider adding a safety comment on the preceding line
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#undocumented_unsafe_blocks
= note: requested on the command line with `-W clippy::undocumented-unsafe-blocks`Thus clean it up.
--- rust/kernel/cpufreq.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
rust/kernel/cpufreq.rs +2 -2
@@ -696,8 +696,8 @@ fn clear_data<T: ForeignOwnable>(&mut self) -> Option<T> { impl<'a> PolicyCpu<'a> { fn from_cpu(cpu: CpuId) -> Result<Self> { // SAFETY: It is safe to call `cpufreq_cpu_get` for any valid CPU. - let ptr = - NonNull::new(unsafe { bindings::cpufreq_cpu_get(u32::from(cpu)) }).ok_or(ENODEV)?; + let ptr = unsafe { bindings::cpufreq_cpu_get(u32::from(cpu)) }; + let ptr = NonNull::new(ptr).ok_or(ENODEV)?; Ok(Self( // SAFETY: `ptr` is non-NULL and `cpufreq_cpu_get()` took a reference on it, so it is
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 98/507 ptp: fix use-after-free in extts_fifo_show() reading tsevqs unlocked
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Zhang <[email protected]>
[ Upstream commit 603a0c40d414ea12509fc45f2b930449a8d4aad2 ]
extts_fifo_show() walks ptp->tsevqs with list_count_nodes() and then list_first_entry() without holding ptp->tsevqs_lock, the spinlock that "protects tsevqs from concurrent access". Every other accessor of the list honours it: ptp_open() (list_add_tail), ptp_release() (list_del followed by kfree of the per-fd queue), ptp_clock_release() and ptp_clock_event() all take tsevqs_lock. extts_fifo_show() is the only one that does not.
A per-fd timestamp queue is appended to tsevqs on open("/dev/ptpN") and removed and freed on close(), both under tsevqs_lock:
scoped_guard(spinlock_irq, &ptp->tsevqs_lock) list_del(&queue->qlist); bitmap_free(queue->mask); kfree(queue);
So a read of /sys/class/ptp/ptpN/fifo running concurrently with a close() of a /dev/ptpN fd can have list_count_nodes() walk into the queue that close() is removing and freeing, dereferencing freed memory (use-after-free) or a poisoned list pointer.
Take tsevqs_lock around the list walk. The fifo only ever draws from the first queue, which is the registration-time queue created in ptp_clock_register() and freed only in ptp_clock_release(); that cannot run while the sysfs attribute is being read, so the dequeue from queue->buf under queue->lock may stay outside tsevqs_lock and the lock order is unchanged.
--- drivers/ptp/ptp_sysfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/ptp/ptp_sysfs.c +5 -1
@@ -80,13 +80,17 @@ static ssize_t extts_fifo_show(struct device *dev,size_t qcnt;int cnt =0 ; +spin_lock_irqsave (&ptp->tsevqs_lock, flags); cnt =list_count_nodes (&ptp->tsevqs); -if (cnt <=0 ) +if (cnt <=0 ) { +spin_unlock_irqrestore (&ptp->tsevqs_lock, flags); goto out; + }/* The sysfs fifo will always draw from the fist queue */ queue = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue, qlist); +spin_unlock_irqrestore (&ptp->tsevqs_lock, flags);memset (&event,0 ,sizeof (event));spin_lock_irqsave (&queue->lock, flags);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 116/507 ASoC: SOF: Intel: hda-sdw-bpt: Stop active DMA before closing BPT streams
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lee Jones <[email protected]>
[ Upstream commit 348bc756d912dd8f47fd36c167075717951a515e ]
When sdw_enable_stream() fails in intel_ace2x_bpt_send_async() after hda_sdw_bpt_send_async() has already started the TX and RX DMA streams, intel_ace2x_bpt_close_stream() invokes hda_sdw_bpt_close() directly without calling hda_sdw_bpt_wait(). As a result, hda_sdw_bpt_dma_deprepare() tears down the DMA buffers and BDL while the DMA hardware is still running.
Disable any running TX or RX BPT DMA stream at the start of hda_sdw_bpt_close() before unmapping channels and depreparing DMA resources.
--- sound/soc/sof/intel/hda-sdw-bpt.c | 6 ++++++ 1 file changed, 6 insertions(+)
sound/soc/sof/intel/hda-sdw-bpt.c +6 -0
@@ -456,6 +456,12 @@ int hda_sdw_bpt_close(struct device *dev, int link_id, struct hdac_ext_stream *bint ret;int ret1; +if (bpt_rx_stream &&hdac_stream (bpt_rx_stream)->running) +hda_sdw_bpt_dma_disable (dev, bpt_rx_stream); + +if (bpt_tx_stream &&hdac_stream (bpt_tx_stream)->running) +hda_sdw_bpt_dma_disable (dev, bpt_tx_stream); +/* * In the case of SoundWire we need to reset the PCMSyCM registers. * Need to continue depreparing the DMA buffers even if this fails.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 117/507 x86/bugs: Select the BHI mitigation based on the attack vector properly
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 3457b3bcd344005af894876cab4e634cabdcbb62 ]
The BHI mitigation selection is inconsistent with the documentation (attack_vector_controls.rst), which lists BHI under both the user->kernel and guest->host attack vectors. bhi_select_mitigation() only enables it when CPU_MITIGATE_GUEST_HOST is set; otherwise it selects BHI_MITIGATION_OFF, even if CPU_MITIGATE_USER_KERNEL is set.
As a result, a kernel compiled with KVM disabled gets BHI automatically disabled, since CPU_MITIGATE_GUEST_HOST defaults to off without KVM. This is a bug, given that CPU_MITIGATE_USER_KERNEL still needs it: on affected Intel CPUs these kernels lose BHI_DIS_S or the BHB clearing loop by default. Booting with mitigations=auto,no_guest_host has the same effect.
Select BHI_MITIGATION_ON whenever user->kernel is mitigated, and keep BHI_MITIGATION_VMEXIT_ONLY for the guest->host-only case.
[ bp: Clarify commit title. ]
--- arch/x86/kernel/cpu/bugs.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
arch/x86/kernel/cpu/bugs.c +5 -7
@@ -2088,14 +2088,12 @@ static void __init bhi_select_mitigation(void)if (bhi_mitigation !=BHI_MITIGATION_AUTO )return ; -if (cpu_attack_vector_mitigated (CPU_MITIGATE_GUEST_HOST )) { -if (cpu_attack_vector_mitigated (CPU_MITIGATE_USER_KERNEL )) - bhi_mitigation =BHI_MITIGATION_ON ; -else - bhi_mitigation =BHI_MITIGATION_VMEXIT_ONLY ; - }else { +if (cpu_attack_vector_mitigated (CPU_MITIGATE_USER_KERNEL )) + bhi_mitigation =BHI_MITIGATION_ON ; +else if (cpu_attack_vector_mitigated (CPU_MITIGATE_GUEST_HOST )) + bhi_mitigation =BHI_MITIGATION_VMEXIT_ONLY ; +else bhi_mitigation =BHI_MITIGATION_OFF ; - } }static void __init bhi_update_mitigation (void )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 118/507 x86/csum: Relax the len and proto constraints in 32-bit csum_ipv6_magic()
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit f01a394fe2a00d3cb4cf2cda279c58604a2540ad ]
Building an i386 allmodconfig kernel with clang fails since allmodconfig started building netfilter with GCOV profiling:
In file included from net/netfilter/nf_synproxy_core.c:7:
In file included from ./include/linux/skbuff.h:26:
In file included from ./include/net/checksum.h:21:
In file included from ./arch/x86/include/asm/checksum.h:9:
./arch/x86/include/asm/checksum_32.h:149:6: error: inline assembly requires more registers than available
The csum_ipv6_magic() asm needs five registers at once: the early-clobber sum plus register-only inputs for saddr, daddr, htonl(len) and htonl(proto). With frame pointers enabled, six general purpose registers are left to choose from.
In synproxy_send_tcp_ipv6(), the GCOV instrumentation lets clang's machine scheduler move the copies of two incoming register arguments, EDX and ECX, below the asm.
Both registers then stay live across the asm, which leaves four registers for its five operands. This is LLVM issue #206307. The error goes away without either GCOV or frame pointers, and it reproduces with clang 19-22.
Neither len nor proto has to be in a register: ADCL also takes a 32-bit memory or immediate source operand. Use "g" for both, so the asm needs at most three registers whatever the caller looks like.
ASM_INPUT_G, which normally replaces "g" to avoid clang's poor handling of it, is not enough here. It expands to "ir" for clang, so callers that pass a variable protocol, like nf_ip6_checksum(), would still need five registers. With "g", clang passes a non-constant len or proto through the stack and still turns constants into immediates.
[ bp: Make Rosen Penev the author because of a previous identical submission
https://lore.kernel.org/all/[email protected]/ and Sasha graciously agreeing and giving his much more detailed commit message explaining the background of why this exists. ]
--- arch/x86/include/asm/checksum_32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/checksum_32.h +1 -1
@@ -159,7 +159,7 @@ static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr, "adcl $0, %0 ;\n" : "=&r" (sum) : "r" (saddr), "r" (daddr), - "r" (htonl(len)), "r" (htonl(proto)), "0" (sum) + "g" (htonl(len)), "g" (htonl(proto)), "0" (sum) : "memory");return csum_fold (sum);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 119/507 drm/i915/psr: Clear selective fetch area when duplicating plane state
In reply to Greg Kroah-Hartman7.3-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jouni Högander <[email protected]>
[ Upstream commit cbe565475988d3b22dc36f13c14d9f0eec1685cd ]
We are currently not clearing selective fetch area when duplicating plane state. This is causing problem when plane is re-used for another purpose. Fix this by clearing selective fetch area when duplicating plane state.
Now as the state is cleared we need to ensure we have consistent selective fetch area in plane state on full update. Earlier this was relying on selective fetch area being copied from old state on state duplicate. Now this isn't true anymore as we are clearing it. Tackle this by setting full plane area as selective fetch area for each plane on full update. Rename the label as skip_su_area_calc as the loop setting the plane selective fetch area is not skipped anymore.
Move also psr2_sel_fetch_pipe_state_supported check after psr2_su_area initialization. The loop is run on full update as well now and it needs initialized psr2_su_area. Clip_area_update is only touching rect height and x1/x2 are left untouched.
Don't set the area at all for planes not intersecting with the selective update area. It is already zero sized after plane state duplicate.
--- drivers/gpu/drm/i915/display/intel_plane.c | 1 + drivers/gpu/drm/i915/display/intel_psr.c | 24 ++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/display/intel_plane.c +1 -0
@@ -140,6 +140,7 @@ intel_plane_duplicate_state(struct drm_plane *plane) intel_state->dpt_vma =NULL ; intel_state->fence_id =-1 ; intel_state->damage =DRM_RECT_INIT (0 ,0 ,0 ,0 ); + intel_state->psr2_sel_fetch_area =DRM_RECT_INIT (0 ,0 ,0 ,0 );/* add reference to fb */ if (intel_state->hw.fb)
drivers/gpu/drm/i915/display/intel_psr.c +11 -13
@@ -2913,16 +2913,16 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,if (!crtc_state->enable_psr2_sel_fetch)return 0 ; -if (!psr2_sel_fetch_pipe_state_supported (crtc_state)) { - full_update = true; - goto skip_sel_fetch_set_loop; - } - crtc_state->psr2_su_area.x1 =0 ; crtc_state->psr2_su_area.y1 =-1 ; crtc_state->psr2_su_area.x2 =drm_rect_width (&display_area); crtc_state->psr2_su_area.y2 =-1 ; +if (!psr2_sel_fetch_pipe_state_supported (crtc_state)) { + full_update = true; + goto skip_su_area_calc; + } +/* * Calculate minimal selective fetch area of each plane and calculate * the pipe damaged area.
@@ -3006,7 +3006,7 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, }if (full_update) - goto skip_sel_fetch_set_loop; + goto skip_su_area_calc;intel_psr_apply_su_area_workarounds (crtc_state);
@@ -3042,6 +3042,11 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,break ; }while (su_area_changed); +skip_su_area_calc: +if (full_update) +clip_area_update (&crtc_state->psr2_su_area, &display_area, + &display_area); +/* * Now that we have the pipe damaged area check if it intersect with * every plane, if it does set the plane selective fetch area.
@@ -3058,8 +3063,6 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, inter = crtc_state->psr2_su_area; sel_fetch_area = &new_plane_state->psr2_sel_fetch_area;if (!drm_rect_intersect (&inter, &new_plane_state->uapi.dst)) { - sel_fetch_area->y1 =-1 ; - sel_fetch_area->y2 =-1 ;/* * if plane sel fetch was previously enabled -> * disable it
@@ -3099,11 +3102,6 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, } } -skip_sel_fetch_set_loop: -if (full_update) -clip_area_update (&crtc_state->psr2_su_area, &display_area, - &display_area); -psr2_man_trk_ctl_calc (crtc_state, full_update); crtc_state->pipe_srcsz_early_tpt =psr2_pipe_srcsz_early_tpt_calc (crtc_state, full_update);
Signature · 1 line
2.53.0