6.1.135-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainercover 6.1.135-rc1 review
This is the start of the stable review cycle for the 6.1.135 release. There are 291 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 25 Apr 2025 14:25:27 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.135-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.1.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.1.135-rc1
WangYuli <[email protected]>
MIPS: ds1287: Match ds1287_set_base_clock() function types
WangYuli <[email protected]>
MIPS: cevt-ds1287: Add missing ds1287.h include
WangYuli <[email protected]>
MIPS: dec: Declare which_prom() as static
Jan Stancek <[email protected]>
sign-file,extract-cert: use pkcs11 provider for OPENSSL MAJOR >= 3
Jan Stancek <[email protected]>
sign-file,extract-cert: avoid using deprecated ERR_get_error_line()
Jan Stancek <[email protected]>
sign-file,extract-cert: move common SSL helper functions to a header
Kirill A. Shutemov <[email protected]>
mm: fix apply_to_existing_page_range()
Li Nan <[email protected]>
blk-iocost: do not WARN if iocg was already offlined
Yu Kuai <[email protected]>
blk-cgroup: support to track if policy is online
Xu Kuohai <[email protected]>
bpf: Prevent tail call between progs attached to different hooks
Andrii Nakryiko <[email protected]>
bpf: avoid holding freeze_mutex during mmap operation
Haisu Wang <[email protected]>
btrfs: fix the length of reserved qgroup to free
Jakub Kicinski <[email protected]>
net/sched: act_mirred: don't override retval if we already lost the skb
Paulo Alcantara <[email protected]>
cifs: use origin fullpath for automounts
ChenXiaoSong <[email protected]>
smb/server: fix potential null-ptr-deref of lease_ctx_info in smb2_open()
WangYuli <[email protected]>
nvmet-fc: Remove unused functions
Greg Kroah-Hartman <[email protected]>
Revert "LoongArch: BPF: Fix off-by-one error in build_prologue()"
Mickaël Salaün <[email protected]>
landlock: Add the errata interface
Hersen Wu <[email protected]>
drm/amd/display: Stop amdgpu_dm initialize when link nums greater than max_links
Greg Kroah-Hartman <[email protected]>
Revert "Xen/swiotlb: mark xen_swiotlb_fixup() __init"
Johannes Thumshirn <[email protected]>
btrfs: zoned: fix zone finishing with missing devices
Johannes Thumshirn <[email protected]>
btrfs: zoned: fix zone activation with missing devices
Boris Burkov <[email protected]>
btrfs: fix qgroup reserve leaks in cow_file_range
Yuli Wang <[email protected]>
LoongArch: Eliminate superfluous get_numa_distances_cnt()
Nathan Lynch <[email protected]>
powerpc/rtas: Prevent Spectre v1 gadget construction in sys_rtas()
Ard Biesheuvel <[email protected]>
x86/pvh: Call C code via the kernel virtual mapping
Maksim Davydov <[email protected]>
x86/split_lock: Fix the delayed detection logic
Alex Williamson <[email protected]>
mm: Fix is_zero_page() usage in try_grab_page()
Kunihiko Hayashi <[email protected]>
misc: pci_endpoint_test: Fix 'irq_type' to convey the correct type
Kunihiko Hayashi <[email protected]>
misc: pci_endpoint_test: Fix displaying 'irq_type' after 'request_irq' error
Kunihiko Hayashi <[email protected]>
misc: pci_endpoint_test: Avoid issue of interrupts remaining after request_irq error
Matthieu Baerts (NGI0) <[email protected]>
mptcp: sockopt: fix getting freebind & transparent
Arnd Bergmann <[email protected]>
media: mediatek: vcodec: mark vdec_vp9_slice_map_counts_eob_coef noinline
Nathan Chancellor <[email protected]>
kbuild: Add '-fno-builtin-wcslen'
Rafael J. Wysocki <[email protected]>
cpufreq: Reference count policy in cpufreq_update_limits()
Mark Rutland <[email protected]>
KVM: arm64: Eagerly switch ZCR_EL{1,2}Fuad Tabba <[email protected]>
KVM: arm64: Calculate cptr_el2 traps on activating traps
Mark Rutland <[email protected]>
KVM: arm64: Mark some header functions as inline
Mark Rutland <[email protected]>
KVM: arm64: Refactor exit handlers
Mark Rutland <[email protected]>
KVM: arm64: Remove VHE host restore of CPACR_EL1.SMEN
Mark Rutland <[email protected]>
KVM: arm64: Remove VHE host restore of CPACR_EL1.ZEN
Mark Rutland <[email protected]>
KVM: arm64: Remove host FPSIMD saving for non-protected KVM
Mark Rutland <[email protected]>
KVM: arm64: Unconditionally save+flush host FPSIMD/SVE/SME state
Mark Brown <[email protected]>
arm64/fpsimd: Stop using TIF_SVE to manage register saving in KVM
Mark Brown <[email protected]>
arm64/fpsimd: Have KVM explicitly say which FP registers to save
Mark Brown <[email protected]>
arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE
Mark Brown <[email protected]>
KVM: arm64: Discard any SVE state when entering KVM guests
Pavel Begunkov <[email protected]>
io_uring/net: fix accept multishot handling
Jani Nikula <[email protected]>
drm/i915/gvt: fix unterminated-string-initialization warning
Rolf Eike Beer <[email protected]>
drm/sti: remove duplicate object names
Chris Bainbridge <[email protected]>
drm/nouveau: prime: fix ttm_bo_delayed_delete oops
Matthew Auld <[email protected]>
drm/amdgpu/dma_buf: fix page_link check
Denis Arefev <[email protected]>
drm/amd/pm/powerplay/hwmgr/vega20_thermal: Prevent division by zero
Denis Arefev <[email protected]>
drm/amd/pm/swsmu/smu13/smu_v13_0: Prevent division by zero
Denis Arefev <[email protected]>
drm/amd/pm/powerplay/hwmgr/smu7_thermal: Prevent division by zero
Denis Arefev <[email protected]>
drm/amd/pm/smu11: Prevent division by zero
Denis Arefev <[email protected]>
drm/amd/pm/powerplay: Prevent division by zero
Denis Arefev <[email protected]>
drm/amd/pm: Prevent division by zero
Mario Limonciello <[email protected]>
drm/amd: Handle being compiled without SI or CIK support better
Akhil P Oommen <[email protected]>
drm/msm/a6xx: Fix stale rpmh votes from GPU
Nikita Zhandarovich <[email protected]>
drm/repaper: fix integer overflows in repeat functions
Kan Liang <[email protected]>
perf/x86/intel/uncore: Fix the scale of IIO free running counters on SPR
Kan Liang <[email protected]>
perf/x86/intel/uncore: Fix the scale of IIO free running counters on ICX
Kan Liang <[email protected]>
perf/x86/intel/uncore: Fix the scale of IIO free running counters on SNR
Dapeng Mi <[email protected]>
perf/x86/intel: Allow to update user space GPRs from PEBS records
Sharath Srinivasan <[email protected]>
RDMA/cma: Fix workqueue crash in cma_netevent_work_handler
Peter Griffin <[email protected]>
scsi: ufs: exynos: Ensure consistent phy reference counts
Chandrakanth Patil <[email protected]>
scsi: megaraid_sas: Block zero-length ATA VPD inquiry
Xiangsheng Hou <[email protected]>
virtiofs: add filesystem context source name check
Steven Rostedt <[email protected]>
tracing: Fix filter string testing
Peter Collingbourne <[email protected]>
string: Add load_unaligned_zeropad() code path to sized_strscpy()
Chunjie Zhu <[email protected]>
smb3 client: fix open hardlink on deferred close file error
Nathan Chancellor <[email protected]>
riscv: Avoid fortify warning in syscall_get_arguments()
Namjae Jeon <[email protected]>
ksmbd: fix the warning from __kernel_write_iter
Denis Arefev <[email protected]>
ksmbd: Prevent integer overflow in calculation of deadtime
Sean Heelan <[email protected]>
ksmbd: Fix dangling pointer in krb_authenticate
Vishal Moola (Oracle) <[email protected]>
mm: fix filemap_get_folios_contig returning batches of identical folios
Baoquan He <[email protected]>
mm/gup: fix wrongly calculated returned value in fault_in_safe_writeable()
Thomas Weißschuh <[email protected]>
loop: LOOP_SET_FD: send uevents for partitions
Thomas Weißschuh <[email protected]>
loop: properly send KOBJ_CHANGED uevent for disk device
Edward Adam Davis <[email protected]>
isofs: Prevent the use of too small fid
Thadeu Lima de Souza Cascardo <[email protected]>
i2c: cros-ec-tunnel: defer probe if parent EC is not present
Vasiliy Kovalev <[email protected]>
hfs/hfsplus: fix slab-out-of-bounds in hfs_bnode_read_key
Herbert Xu <[email protected]>
crypto: caam/qi - Fix drv_ctx refcount bug
Rafael J. Wysocki <[email protected]>
cpufreq: Avoid using inconsistent policy->min and policy->max
Johannes Kimmel <[email protected]>
btrfs: correctly escape subvol in btrfs_show_options()
Li Lingfeng <[email protected]>
nfsd: decrease sc_count directly if fail to queue dl_recall
Eric Biggers <[email protected]>
nfs: add missing selections of CONFIG_CRC32
Jeff Layton <[email protected]>
nfs: move nfs_fhandle_hash to common include file
Denis Arefev <[email protected]>
asus-laptop: Fix an uninitialized variable
Srinivas Kandagatla <[email protected]>
ASoC: codecs:lpass-wsa-macro: Fix logic of enabling vi channels
Srinivas Kandagatla <[email protected]>
ASoC: codecs:lpass-wsa-macro: Fix vi feedback rate
Alex Williamson <[email protected]>
Revert "PCI: Avoid reset when disabled via sysfs"
Andreas Gruenbacher <[email protected]>
writeback: fix false warning in inode_to_wb()
Rafael J. Wysocki <[email protected]>
cpufreq/sched: Fix the usage of CPUFREQ_NEED_UPDATE_LIMITS
WangYuli <[email protected]>
riscv: KGDB: Remove ".option norvc/.option rvc" for kgdb_compiled_break
WangYuli <[email protected]>
riscv: KGDB: Do not inline arch_kgdb_breakpoint()
Björn Töpel <[email protected]>
riscv: Properly export reserved regions in /proc/iomem
Sagi Maimon <[email protected]>
ptp: ocp: fix start time alignment in ptp_ocp_signal_set
Vladimir Oltean <[email protected]>
net: dsa: avoid refcount warnings when ds->ops->tag_8021q_vlan_del() fails
Vladimir Oltean <[email protected]>
net: dsa: mv88e6xxx: fix -ENOENT when deleting VLANs and MST is unsupported
Vladimir Oltean <[email protected]>
net: dsa: mv88e6xxx: avoid unregistering devlink regions which were never registered
Jonas Gorski <[email protected]>
net: bridge: switchdev: do not notify new brentries as changed
Jonas Gorski <[email protected]>
net: b53: enable BPDU reception for management port
Abdun Nihaal <[email protected]>
cxgb4: fix memory leak in cxgb4_init_ethtool_filters() error path
Ilya Maximets <[email protected]>
net: openvswitch: fix nested key length validation in the set() action
Matt Johnston <[email protected]>
net: mctp: Set SOCK_RCU_FREE
Matthew Wilcox (Oracle) <[email protected]>
test suite: use %zu to print size_t
Christopher S M Hall <[email protected]>
igc: cleanup PTP module if probe fails
Christopher S M Hall <[email protected]>
igc: handle the IGC_PTP_ENABLED flag correctly
Christopher S M Hall <[email protected]>
igc: move ktime snapshot into PTM retry loop
Christopher S M Hall <[email protected]>
igc: fix PTM cycle trigger logic
Johannes Berg <[email protected]>
Revert "wifi: mac80211: Update skb's control block key in ieee80211_tx_dequeue()"
Frédéric Danis <[email protected]>
Bluetooth: l2cap: Check encryption key size on incoming connection
Dan Carpenter <[email protected]>
Bluetooth: btrtl: Prevent potential NULL dereference
Luiz Augusto von Dentz <[email protected]>
Bluetooth: hci_event: Fix sending MGMT_EV_DEVICE_FOUND for invalid address
Shay Drory <[email protected]>
RDMA/core: Silence oversized kvmalloc() warning
Chengchang Tang <[email protected]>
RDMA/hns: Fix wrong maximum DMA segment size
Yue Haibing <[email protected]>
RDMA/usnic: Fix passing zero to PTR_ERR in usnic_ib_pci_probe()
Zheng Qixing <[email protected]>
md/md-bitmap: fix stats collection for external bitmaps
Yu Kuai <[email protected]>
md/raid10: fix missing discard IO accounting
Miaoqian Lin <[email protected]>
scsi: iscsi: Fix missing scsi_host_put() in error path
Abdun Nihaal <[email protected]>
wifi: wl1251: fix memory leak in wl1251_tx_work
Remi Pommarel <[email protected]>
wifi: mac80211: Purge vif txq in ieee80211_do_stop()
Remi Pommarel <[email protected]>
wifi: mac80211: Update skb's control block key in ieee80211_tx_dequeue()
Abdun Nihaal <[email protected]>
wifi: at76c50x: fix use after free access in at76_disconnect
Xingui Yang <[email protected]>
scsi: hisi_sas: Enable force phy when SATA disk directly connected
Kaixin Wang <[email protected]>
HSI: ssi_protocol: Fix use after free vulnerability in ssi_protocol Driver Due to Race Condition
Arseniy Krasnov <[email protected]>
Bluetooth: hci_uart: Fix another race during initialization
Myrrh Periwinkle <[email protected]>
x86/e820: Fix handling of subpage regions when calculating nosave ranges in e820__register_nosave_regions()
Nathan Chancellor <[email protected]>
ACPI: platform-profile: Fix CFI violation when accessing sysfs files
Douglas Anderson <[email protected]>
arm64: errata: Add newer ARM cores to the spectre_bhb_loop_affected() lists
Geliang Tang <[email protected]>
selftests: mptcp: close fd_in before returning in main_loop
Stephan Gerhold <[email protected]>
pinctrl: qcom: Clear latched interrupt status when changing IRQ type
Ma Ke <[email protected]>
PCI: Fix reference leak in pci_alloc_child_bus()
Stanimir Varbanov <[email protected]>
PCI: brcmstb: Fix missing of_node_put() in brcm_pcie_probe()
Zijun Hu <[email protected]>
of/irq: Fix device node refcount leakages in of_irq_init()
Zijun Hu <[email protected]>
of/irq: Fix device node refcount leakage in API irq_of_parse_and_map()
Zijun Hu <[email protected]>
of/irq: Fix device node refcount leakages in of_irq_count()
Zijun Hu <[email protected]>
of/irq: Fix device node refcount leakage in API of_irq_parse_raw()
Zijun Hu <[email protected]>
of/irq: Fix device node refcount leakage in API of_irq_parse_one()
Fedor Pchelkin <[email protected]>
ntb: use 64-bit arithmetic for the MSI doorbell mask
Sean Christopherson <[email protected]>
KVM: x86: Acquire SRCU in KVM_GET_MP_STATE to protect guest memory accesses
Joshua Washington <[email protected]>
gve: handle overflow when reporting TX consumed descriptors
Krzysztof Kozlowski <[email protected]>
gpio: zynq: Fix wakeup source leaks on device unbind
Guixin Liu <[email protected]>
gpio: tegra186: fix resource handling in ACPI probe path
zhoumin <[email protected]>
ftrace: Add cond_resched() to ftrace_graph_set_hash()
Mikulas Patocka <[email protected]>
dm-verity: fix prefetch-vs-suspend race
Mikulas Patocka <[email protected]>
dm-integrity: set ti->error on memory allocation failure
Mikulas Patocka <[email protected]>
dm-ebs: fix prefetch-vs-suspend race
Tom Lendacky <[email protected]>
crypto: ccp - Fix check for the primary ASP device
Taniya Das <[email protected]>
clk: qcom: gdsc: Set retain_ff before moving to HW CTRL
Bryan O'Donoghue <[email protected]>
clk: qcom: gdsc: Capture pm_genpd_add_subdomain result code
Bryan O'Donoghue <[email protected]>
clk: qcom: gdsc: Release pm subdomains in reverse add order
Roman Smirnov <[email protected]>
cifs: fix integer overflow in match_server()
Alexandra Diupina <[email protected]>
cifs: avoid NULL pointer dereference in dbg call
Trevor Woerner <[email protected]>
thermal/drivers/rockchip: Add missing rk3328 mapping entry
Ricardo Cañuelo Navarro <[email protected]>
sctp: detect and prevent references to a freed transport in sendmsg
Shuai Xue <[email protected]>
mm/hwpoison: do not send SIGBUS to processes with recovered clean pages
Mathieu Desnoyers <[email protected]>
mm: add missing release barrier on PGDAT_RECLAIM_LOCKED unlock
David Hildenbrand <[email protected]>
mm/rmap: reject hugetlb folios in folio_make_device_exclusive()
Ryan Roberts <[email protected]>
sparc/mm: disable preemption in lazy mmu mode
Filipe Manana <[email protected]>
btrfs: fix non-empty delayed iputs list on unmount due to compressed write workers
Chen-Yu Tsai <[email protected]>
arm64: dts: mediatek: mt8173: Fix disp-pwm compatible string
Zhenhua Huang <[email protected]>
arm64: mm: Correct the update of max_pfn
Wentao Liang <[email protected]>
mtd: rawnand: Add status chack in r852_ready()
Wentao Liang <[email protected]>
mtd: inftlcore: Add error check for inftl_read_oob()
Matthieu Baerts (NGI0) <[email protected]>
mptcp: only inc MPJoinAckHMacFailure for HMAC failures
Gang Yan <[email protected]>
mptcp: fix NULL pointer in can_accept_new_subflow
T Pratham <[email protected]>
lib: scatterlist: fix sg_split_phys to preserve original scatterlist offsets
Boqun Feng <[email protected]>
locking/lockdep: Decrease nr_unused_locks if lock unused in zap_class()
Chenyuan Yang <[email protected]>
mfd: ene-kb3930: Fix a potential NULL pointer dereference
Jan Kara <[email protected]>
jbd2: remove wrong sb->s_sequence check
Manjunatha Venkatesh <[email protected]>
i3c: Add NULL pointer check in i3c_master_queue_ibi()
Stanley Chu <[email protected]>
i3c: master: svc: Use readsb helper for reading MDB
Steve French <[email protected]>
smb311 client: fix missing tcon check when mounting with linux/posix extensions
Chenyuan Yang <[email protected]>
soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe()
Si-Wei Liu <[email protected]>
vdpa/mlx5: Fix oversized null mkey longer than 32bit
Artem Sadovnikov <[email protected]>
ext4: fix off-by-one error in do_split
Jeff Hugo <[email protected]>
bus: mhi: host: Fix race between unprepare and queue_buf
Alexey Klimov <[email protected]>
ASoC: qdsp6: q6asm-dai: fix q6asm_dai_compr_set_params error path
Srinivas Kandagatla <[email protected]>
ASoC: qdsp6: q6apm-dai: fix capture pipeline overruns.
Srinivas Kandagatla <[email protected]>
ASoC: qdsp6: q6apm-dai: set 10 ms period and buffer alignment.
Jens Axboe <[email protected]>
io_uring/kbuf: reject zero sized provided buffers
Gavrilov Ilia <[email protected]>
wifi: mac80211: fix integer overflow in hwmp_route_info_get()
Haoxiang Li <[email protected]>
wifi: mt76: Add check for devm_kstrdup()
Alexandre Torgue <[email protected]>
clocksource/drivers/stm32-lptimer: Use wakeup capable instead of init wakeup
Jiasheng Jiang <[email protected]>
mtd: Replace kcalloc() with devm_kcalloc()
Marek Behún <[email protected]>
net: dsa: mv88e6xxx: workaround RGMII transmit delay erratum for 6320 family
Jiasheng Jiang <[email protected]>
mtd: Add check for devm_kcalloc()
Matthieu Baerts (NGI0) <[email protected]>
mptcp: sockopt: fix getting IPV6_V6ONLY
Vikash Garodia <[email protected]>
media: venus: hfi_parser: refactor hfi packet parsing logic
Vikash Garodia <[email protected]>
media: venus: hfi_parser: add check to avoid out of bound access
Sakari Ailus <[email protected]>
media: i2c: ov7251: Introduce 1 ms delay between regulators and en GPIO
Sakari Ailus <[email protected]>
media: i2c: ov7251: Set enable GPIO low in probe
Sakari Ailus <[email protected]>
media: i2c: ccs: Set the device's runtime PM status correctly in probe
Sakari Ailus <[email protected]>
media: i2c: ccs: Set the device's runtime PM status correctly in remove
Karina Yankevich <[email protected]>
media: v4l2-dv-timings: prevent possible overflow in v4l2_detect_gtf()
Jiasheng Jiang <[email protected]>
media: platform: stm32: Add check for clk_enable()
Murad Masimov <[email protected]>
media: streamzap: prevent processing IR data on URB failure
Jonathan McDowell <[email protected]>
tpm, tpm_tis: Fix timeout handling when waiting for TPM status
Kamal Dasu <[email protected]>
mtd: rawnand: brcmnand: fix PM resume warning
Miquel Raynal <[email protected]>
spi: cadence-qspi: Fix probe on AM62A LP SK
Will Deacon <[email protected]>
KVM: arm64: Tear down vGIC on failed vCPU creation
Douglas Anderson <[email protected]>
arm64: errata: Add KRYO 2XX/3XX/4XX silver cores to Spectre BHB safe list
Douglas Anderson <[email protected]>
arm64: errata: Assume that unknown CPUs _are_ vulnerable to Spectre BHB
Douglas Anderson <[email protected]>
arm64: errata: Add QCOM_KRYO_4XX_GOLD to the spectre_bhb_k24_list
Douglas Anderson <[email protected]>
arm64: cputype: Add MIDR_CORTEX_A76AE
Jan Beulich <[email protected]>
xenfs/xensyms: respect hypervisor's "next" indication
Yuan Can <[email protected]>
media: siano: Fix error handling in smsdvb_module_init()
Matthew Majewski <[email protected]>
media: vim2m: print device name after registering device
Vikash Garodia <[email protected]>
media: venus: hfi: add check to handle incorrect queue size
Vikash Garodia <[email protected]>
media: venus: hfi: add a check to handle OOB in sfr region
Niklas Söderlund <[email protected]>
media: i2c: adv748x: Fix test pattern selection mask
Jann Horn <[email protected]>
ext4: don't treat fhandle lookup of ea_inode as FS corruption
Willem de Bruijn <[email protected]>
bpf: support SKF_NET_OFF and SKF_LL_OFF on skb frags
Uwe Kleine-König <[email protected]>
pwm: fsl-ftm: Handle clk_get_rate() returning 0
Uwe Kleine-König <[email protected]>
pwm: rcar: Improve register calculation
Josh Poimboeuf <[email protected]>
pwm: mediatek: Prevent divide-by-zero in pwm_mediatek_config()
Jonathan McDowell <[email protected]>
tpm, tpm_tis: Workaround failed command reception on Infineon devices
Ayush Jain <[email protected]>
ktest: Fix Test Failures Due to Missing LOG_FILE Directories
Leonid Arapov <[email protected]>
fbdev: omapfb: Add 'plane' value check
Christian König <[email protected]>
drm/amdgpu: grab an additional reference on the gang fence v2
Ryo Takakura <[email protected]>
PCI: vmd: Make vmd_dev::cfg_lock a raw_spinlock_t type
Wentao Liang <[email protected]>
drm/amdgpu: handle amdgpu_cgs_create_device() errors in amd_powerplay_create()
AngeloGioacchino Del Regno <[email protected]>
drm/mediatek: mtk_dpi: Explicitly manage TVD clock in power on/off
AngeloGioacchino Del Regno <[email protected]>
drm/mediatek: mtk_dpi: Move the input_2p_en bit to platform data
Philip Yang <[email protected]>
drm/amdkfd: Fix pqm_destroy_queue race with GPU reset
Philip Yang <[email protected]>
drm/amdkfd: Fix mode1 reset crash issue
David Yat Sin <[email protected]>
drm/amdkfd: clamp queue size to minimum
Lucas De Marchi <[email protected]>
drivers: base: devres: Allow to release group on device release
Luca Ceresoli <[email protected]>
drm/bridge: panel: forbid initializing a panel with unknown connector type
Andrew Wyatt <[email protected]>
drm: panel-orientation-quirks: Add quirk for OneXPlayer Mini (Intel)
Andrew Wyatt <[email protected]>
drm: panel-orientation-quirks: Add new quirk for GPD Win 2
Andrew Wyatt <[email protected]>
drm: panel-orientation-quirks: Add quirk for AYA NEO Slide
Andrew Wyatt <[email protected]>
drm: panel-orientation-quirks: Add quirks for AYA NEO Flip DS and KB
Andrew Wyatt <[email protected]>
drm: panel-orientation-quirks: Add support for AYANEO 2S
Zhikai Zhai <[email protected]>
drm/amd/display: Update Cursor request mode to the beginning prefetch always
Abhinav Kumar <[email protected]>
drm: allow encoder mode_set even when connectors change for crtc
Dmitry Baryshkov <[email protected]>
Bluetooth: qca: simplify WCN399x NVM loading
Arseniy Krasnov <[email protected]>
Bluetooth: hci_uart: fix race during initialization
Gabriele Paoloni <[email protected]>
tracing: fix return value in __ftrace_event_enable_disable for TRACE_REG_UNREGISTER
Stanislav Fomichev <[email protected]>
net: vlan: don't propagate flags on open
Icenowy Zheng <[email protected]>
wifi: mt76: mt76x2u: add TP-Link TL-WDN6200 ID to device table
Kai Mäkisara <[email protected]>
scsi: st: Fix array overflow in st_setup()
Bhupesh <[email protected]>
ext4: ignore xattrs past end
Ojaswin Mujoo <[email protected]>
ext4: protect ext4_release_dquot against freezing
Daniel Kral <[email protected]>
ahci: add PCI ID for Marvell 88SE9215 SATA Controller
Chao Yu <[email protected]>
f2fs: fix to avoid out-of-bounds access in f2fs_truncate_inode_blocks()
Niklas Cassel <[email protected]>
ata: libata-eh: Do not use ATAPI DMA for a device limited to PIO mode
Edward Adam Davis <[email protected]>
jfs: add sanity check for agwidth in dbMount
Edward Adam Davis <[email protected]>
jfs: Prevent copying of nlink with value 0 from disk inode
Rand Deeb <[email protected]>
fs/jfs: Prevent integer overflow in AG size calculation
Rand Deeb <[email protected]>
fs/jfs: cast inactags to s64 to prevent potential overflow
Zhongqiu Han <[email protected]>
jfs: Fix uninit-value access of imap allocated in the diMount() function
Jason Xing <[email protected]>
page_pool: avoid infinite loop to schedule delayed worker
Chao Yu <[email protected]>
f2fs: don't retry IO for corrupted data scenario
keenplify <[email protected]>
ASoC: amd: Add DMI quirk for ACP6X mic support
Ricard Wanderlof <[email protected]>
ALSA: usb-audio: Fix CME quirk for UF series keyboards
Kaustabh Chakraborty <[email protected]>
mmc: dw_mmc: add a quirk for accessing 64-bit FIFOs in two halves
Shengjiu Wang <[email protected]>
ASoC: fsl_audmix: register card device depends on 'dais' property
Maxim Mikityanskiy <[email protected]>
ALSA: hda: intel: Add Lenovo IdeaPad Z570 to probe denylist
Maxim Mikityanskiy <[email protected]>
ALSA: hda: intel: Fix Optimus when GPU has no sound
Tomasz Pakuła <[email protected]>
HID: pidff: Fix null pointer dereference in pidff_find_fields
Tomasz Pakuła <[email protected]>
HID: pidff: Do not send effect envelope if it's empty
Tomasz Pakuła <[email protected]>
HID: pidff: Convert infinite length from Linux API to PID standard
Kees Cook <[email protected]>
xen/mcelog: Add __nonstring annotations for unterminated strings
Douglas Anderson <[email protected]>
arm64: cputype: Add QCOM_CPU_PART_KRYO_3XX_GOLD
Mark Rutland <[email protected]>
perf: arm_pmu: Don't disable counter in armpmu_add()
Max Grobecker <[email protected]>
x86/cpu: Don't clear X86_FEATURE_LAHF_LM flag in init_amd_k8() on AMD when running in a virtual machine
Zhongqiu Han <[email protected]>
pm: cpupower: bench: Prevent NULL dereference on malloc failure
Trond Myklebust <[email protected]>
umount: Allow superblock owners to force umount
Mateusz Guzik <[email protected]>
fs: consistently deref the files table with rcu_dereference_raw()
Louis-Alexis Eyraud <[email protected]>
iommu/mediatek: Fix NULL pointer deference in mtk_iommu_device_group
Florian Westphal <[email protected]>
nft_set_pipapo: fix incorrect avx2 match of 5th field octet
Arnaud Lecomte <[email protected]>
net: ppp: Add bound checking for skb data on ppp_sync_txmung
Ido Schimmel <[email protected]>
ipv6: Align behavior across nexthops during path selection
Octavian Purdila <[email protected]>
net_sched: sch_sfq: move the limit validation
Octavian Purdila <[email protected]>
net_sched: sch_sfq: use a temporary work area for validating configuration
Daniel Wagner <[email protected]>
nvmet-fcloop: swap list_add_tail arguments
Wentao Liang <[email protected]>
ata: sata_sx4: Add error handling in pdc20621_i2c_read()
Maxime Chevallier <[email protected]>
net: ethtool: Don't call .cleanup_data when prepare_data fails
Toke Høiland-Jørgensen <[email protected]>
tc: Ensure we have enough buffer space when sending filter netlink notifications
Pedro Tammela <[email protected]>
net/sched: cls_api: conditional notification of events
Victor Nogueira <[email protected]>
rtnl: add helper to check if a notification is needed
Jamal Hadi Salim <[email protected]>
rtnl: add helper to check if rtnl group has listeners
Jakub Kicinski <[email protected]>
net: tls: explicitly disallow disconnect
Cong Wang <[email protected]>
codel: remove sch->q.qlen check before qdisc_tree_reduce_backlog()
Tung Nguyen <[email protected]>
tipc: fix memory leak in tipc_link_xmit
Henry Martin <[email protected]>
ata: pata_pxa: Fix potential NULL pointer dereference in pxa_ata_probe()
Edward Liaw <[email protected]>
selftests/futex: futex_waitv wouldblock test should fail
-------------
Diffstat:
MAINTAINERS | 1 + Makefile | 7 +- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 6 +- arch/arm64/include/asm/cputype.h | 4 + arch/arm64/include/asm/fpsimd.h | 4 +- arch/arm64/include/asm/kvm_host.h | 19 +- arch/arm64/include/asm/kvm_hyp.h | 1 + arch/arm64/include/asm/processor.h | 7 + arch/arm64/include/asm/spectre.h | 1 - arch/arm64/kernel/fpsimd.c | 69 +++++-- arch/arm64/kernel/process.c | 2 + arch/arm64/kernel/proton-pack.c | 208 +++++++++++---------- arch/arm64/kernel/ptrace.c | 3 + arch/arm64/kernel/signal.c | 7 +- arch/arm64/kvm/arm.c | 7 +- arch/arm64/kvm/fpsimd.c | 92 +++------ arch/arm64/kvm/hyp/entry.S | 5 + arch/arm64/kvm/hyp/include/hyp/switch.h | 106 +++++++---- arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 +- arch/arm64/kvm/hyp/nvhe/pkvm.c | 17 +- arch/arm64/kvm/hyp/nvhe/switch.c | 91 +++++---- arch/arm64/kvm/hyp/vhe/switch.c | 12 +- arch/arm64/kvm/reset.c | 3 + arch/arm64/mm/mmu.c | 3 +- arch/loongarch/kernel/acpi.c | 12 -- arch/loongarch/net/bpf_jit.c | 2 - arch/loongarch/net/bpf_jit.h | 5 - arch/mips/dec/prom/init.c | 2 +- arch/mips/include/asm/ds1287.h | 2 +- arch/mips/kernel/cevt-ds1287.c | 1 + arch/powerpc/kernel/rtas.c | 4 + arch/riscv/include/asm/kgdb.h | 9 +- arch/riscv/include/asm/syscall.h | 7 +- arch/riscv/kernel/kgdb.c | 6 + arch/riscv/kernel/setup.c | 36 +++- arch/sparc/mm/tlb.c | 5 +- arch/x86/events/intel/ds.c | 8 +- arch/x86/events/intel/uncore_snbep.c | 107 +---------- arch/x86/kernel/cpu/amd.c | 2 +- arch/x86/kernel/cpu/intel.c | 20 +- arch/x86/kernel/e820.c | 17 +- arch/x86/kvm/x86.c | 4 + arch/x86/platform/pvh/head.S | 7 +- block/blk-cgroup.c | 24 ++- block/blk-cgroup.h | 1 + block/blk-iocost.c | 7 +- certs/Makefile | 2 +- certs/extract-cert.c | 138 +++++++------- drivers/acpi/platform_profile.c | 20 +- drivers/ata/ahci.c | 2 + drivers/ata/libata-eh.c | 11 +- drivers/ata/pata_pxa.c | 6 + drivers/ata/sata_sx4.c | 13 +- drivers/base/devres.c | 7 + drivers/block/loop.c | 7 +- drivers/bluetooth/btqca.c | 13 +- drivers/bluetooth/btrtl.c | 2 + drivers/bluetooth/hci_ldisc.c | 19 +- drivers/bluetooth/hci_uart.h | 1 + drivers/bus/mhi/host/main.c | 16 +- drivers/char/tpm/tpm_tis_core.c | 20 +- drivers/char/tpm/tpm_tis_core.h | 1 + drivers/clk/qcom/gdsc.c | 61 +++--- drivers/clocksource/timer-stm32-lp.c | 4 +- drivers/cpufreq/cpufreq.c | 40 +++- drivers/crypto/caam/qi.c | 6 +- drivers/crypto/ccp/sp-pci.c | 15 +- drivers/gpio/gpio-tegra186.c | 25 +-- drivers/gpio/gpio-zynq.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 +- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 44 +++-- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 + drivers/gpu/drm/amd/amdkfd/kfd_process.c | 17 ++ .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 +- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 22 +-- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hubp.c | 2 +- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 5 + .../gpu/drm/amd/pm/powerplay/hwmgr/smu7_thermal.c | 4 +- .../drm/amd/pm/powerplay/hwmgr/vega10_thermal.c | 4 +- .../drm/amd/pm/powerplay/hwmgr/vega20_thermal.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 3 + drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 2 +- drivers/gpu/drm/drm_atomic_helper.c | 2 +- drivers/gpu/drm/drm_panel.c | 5 +- drivers/gpu/drm/drm_panel_orientation_quirks.c | 46 ++++- drivers/gpu/drm/i915/gvt/opregion.c | 7 +- drivers/gpu/drm/mediatek/mtk_dpi.c | 23 ++- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 82 ++++---- drivers/gpu/drm/nouveau/nouveau_bo.c | 3 + drivers/gpu/drm/nouveau/nouveau_gem.c | 3 - drivers/gpu/drm/sti/Makefile | 2 - drivers/gpu/drm/tiny/repaper.c | 4 +- drivers/hid/usbhid/hid-pidff.c | 60 ++++-- drivers/hsi/clients/ssi_protocol.c | 1 + drivers/i2c/busses/i2c-cros-ec-tunnel.c | 3 + drivers/i3c/master.c | 3 + drivers/i3c/master/svc-i3c-master.c | 2 +- drivers/infiniband/core/cma.c | 4 +- drivers/infiniband/core/umem_odp.c | 6 +- drivers/infiniband/hw/hns/hns_roce_main.c | 2 +- drivers/infiniband/hw/usnic/usnic_ib_main.c | 14 +- drivers/iommu/mtk_iommu.c | 26 +-- drivers/md/dm-ebs-target.c | 7 + drivers/md/dm-integrity.c | 3 + drivers/md/dm-verity-target.c | 8 + drivers/md/md-bitmap.c | 5 +- drivers/md/raid10.c | 1 + drivers/media/common/siano/smsdvb-main.c | 2 + drivers/media/i2c/adv748x/adv748x.h | 2 +- drivers/media/i2c/ccs/ccs-core.c | 6 +- drivers/media/i2c/ov7251.c | 4 +- .../mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c | 3 +- drivers/media/platform/qcom/venus/hfi_parser.c | 100 +++++++--- drivers/media/platform/qcom/venus/hfi_venus.c | 18 +- drivers/media/platform/st/stm32/dma2d/dma2d.c | 3 +- drivers/media/rc/streamzap.c | 68 ++++--- drivers/media/test-drivers/vim2m.c | 6 +- drivers/media/v4l2-core/v4l2-dv-timings.c | 4 +- drivers/mfd/ene-kb3930.c | 2 +- drivers/misc/pci_endpoint_test.c | 6 +- drivers/mmc/host/dw_mmc.c | 94 +++++++++- drivers/mmc/host/dw_mmc.h | 27 +++ drivers/mtd/inftlcore.c | 9 +- drivers/mtd/mtdpstore.c | 12 +- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +- drivers/mtd/nand/raw/r852.c | 3 + drivers/net/dsa/b53/b53_common.c | 10 + drivers/net/dsa/mv88e6xxx/chip.c | 30 ++- drivers/net/dsa/mv88e6xxx/devlink.c | 3 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 1 + drivers/net/ethernet/google/gve/gve_ethtool.c | 4 +- drivers/net/ethernet/intel/igc/igc_defines.h | 1 + drivers/net/ethernet/intel/igc/igc_main.c | 1 + drivers/net/ethernet/intel/igc/igc_ptp.c | 93 +++++---- drivers/net/ppp/ppp_synctty.c | 5 + drivers/net/wireless/atmel/at76c50x-usb.c | 2 +- drivers/net/wireless/mediatek/mt76/eeprom.c | 4 + drivers/net/wireless/mediatek/mt76/mt76x2/usb.c | 1 + drivers/net/wireless/ti/wl1251/tx.c | 4 +- drivers/ntb/ntb_transport.c | 2 +- drivers/nvme/target/fc.c | 14 -- drivers/nvme/target/fcloop.c | 2 +- drivers/of/irq.c | 78 ++++---- drivers/pci/controller/pcie-brcmstb.c | 13 +- drivers/pci/controller/vmd.c | 12 +- drivers/pci/pci.c | 4 - drivers/pci/probe.c | 5 +- drivers/perf/arm_pmu.c | 8 +- drivers/pinctrl/qcom/pinctrl-msm.c | 12 +- drivers/platform/x86/asus-laptop.c | 9 +- drivers/ptp/ptp_ocp.c | 1 + drivers/pwm/pwm-fsl-ftm.c | 6 + drivers/pwm/pwm-mediatek.c | 8 +- drivers/pwm/pwm-rcar.c | 24 +-- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 9 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 14 +- drivers/scsi/megaraid/megaraid_sas_base.c | 9 +- drivers/scsi/megaraid/megaraid_sas_fusion.c | 5 +- drivers/scsi/scsi_transport_iscsi.c | 7 +- drivers/scsi/st.c | 2 +- drivers/soc/samsung/exynos-chipid.c | 2 + drivers/spi/spi-cadence-quadspi.c | 6 + drivers/thermal/rockchip_thermal.c | 1 + drivers/ufs/host/ufs-exynos.c | 6 + drivers/vdpa/mlx5/core/mr.c | 7 +- drivers/video/fbdev/omap2/omapfb/dss/dispc.c | 6 +- drivers/xen/swiotlb-xen.c | 2 +- drivers/xen/xenfs/xensyms.c | 4 +- fs/Kconfig | 1 + fs/btrfs/disk-io.c | 12 ++ fs/btrfs/inode.c | 6 +- fs/btrfs/super.c | 3 +- fs/btrfs/zoned.c | 6 + fs/ext4/inode.c | 68 +++++-- fs/ext4/namei.c | 2 +- fs/ext4/super.c | 17 ++ fs/ext4/xattr.c | 11 +- fs/f2fs/inode.c | 4 + fs/f2fs/node.c | 9 +- fs/file.c | 26 ++- fs/fuse/virtio_fs.c | 3 + fs/hfs/bnode.c | 6 + fs/hfsplus/bnode.c | 6 + fs/isofs/export.c | 2 +- fs/jbd2/journal.c | 1 - fs/jfs/jfs_dmap.c | 10 +- fs/jfs/jfs_imap.c | 4 +- fs/namespace.c | 3 +- fs/nfs/Kconfig | 2 +- fs/nfs/internal.h | 22 --- fs/nfs/nfs4session.h | 4 - fs/nfsd/Kconfig | 1 + fs/nfsd/nfs4state.c | 2 +- fs/nfsd/nfsfh.h | 7 - fs/smb/client/cifs_dfs_ref.c | 34 +++- fs/smb/client/cifsproto.h | 23 +++ fs/smb/client/connect.c | 2 + fs/smb/client/dir.c | 21 ++- fs/smb/client/file.c | 28 +++ fs/smb/client/fs_context.c | 5 + fs/smb/client/smb2misc.c | 9 +- fs/smb/server/oplock.c | 2 +- fs/smb/server/smb2pdu.c | 6 +- fs/smb/server/transport_ipc.c | 7 +- fs/smb/server/vfs.c | 3 +- include/linux/backing-dev.h | 1 + include/linux/bpf.h | 1 + include/linux/nfs.h | 13 ++ include/linux/rtnetlink.h | 22 +++ include/linux/tpm.h | 1 + include/net/sctp/structs.h | 3 +- include/uapi/linux/kfd_ioctl.h | 2 + include/uapi/linux/landlock.h | 2 + include/xen/interface/xen-mca.h | 2 +- io_uring/kbuf.c | 2 + io_uring/net.c | 2 + kernel/bpf/core.c | 19 +- kernel/bpf/syscall.c | 17 +- kernel/locking/lockdep.c | 3 + kernel/sched/cpufreq_schedutil.c | 18 +- kernel/trace/ftrace.c | 1 + kernel/trace/trace_events.c | 4 +- kernel/trace/trace_events_filter.c | 4 +- lib/sg_split.c | 2 - lib/string.c | 13 +- mm/filemap.c | 1 + mm/gup.c | 6 +- mm/memory-failure.c | 11 +- mm/memory.c | 4 +- mm/rmap.c | 2 +- mm/vmscan.c | 2 +- net/8021q/vlan_dev.c | 31 +-- net/bluetooth/hci_event.c | 5 +- net/bluetooth/l2cap_core.c | 3 +- net/bridge/br_vlan.c | 4 +- net/core/filter.c | 80 ++++---- net/core/page_pool.c | 8 +- net/dsa/tag_8021q.c | 2 +- net/ethtool/netlink.c | 8 +- net/ipv6/route.c | 8 +- net/mac80211/iface.c | 3 + net/mac80211/mesh_hwmp.c | 14 +- net/mctp/af_mctp.c | 3 + net/mptcp/sockopt.c | 28 +++ net/mptcp/subflow.c | 19 +- net/netfilter/nft_set_pipapo_avx2.c | 3 +- net/openvswitch/flow_netlink.c | 3 +- net/sched/act_mirred.c | 20 +- net/sched/cls_api.c | 74 ++++++-- net/sched/sch_codel.c | 5 +- net/sched/sch_fq_codel.c | 6 +- net/sched/sch_sfq.c | 66 +++++-- net/sctp/socket.c | 22 ++- net/sctp/transport.c | 2 + net/tipc/link.c | 1 + net/tls/tls_main.c | 6 + scripts/sign-file.c | 132 ++++++------- scripts/ssl-common.h | 32 ++++ security/landlock/errata.h | 87 +++++++++ security/landlock/setup.c | 30 +++ security/landlock/setup.h | 3 + security/landlock/syscalls.c | 22 ++- sound/pci/hda/hda_intel.c | 44 ++++- sound/soc/amd/yc/acp6x-mach.c | 7 + sound/soc/codecs/lpass-wsa-macro.c | 139 +++++++++----- sound/soc/fsl/fsl_audmix.c | 16 +- sound/soc/qcom/qdsp6/q6apm-dai.c | 9 +- sound/soc/qcom/qdsp6/q6asm-dai.c | 19 +- sound/usb/midi.c | 80 +++++++- tools/power/cpupower/bench/parse.c | 4 + tools/testing/ktest/ktest.pl | 8 + tools/testing/radix-tree/linux.c | 4 +- .../futex/functional/futex_wait_wouldblock.c | 2 +- tools/testing/selftests/landlock/base_test.c | 46 ++++- tools/testing/selftests/net/mptcp/mptcp_connect.c | 7 +- 278 files changed, 2913 insertions(+), 1414 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/291 selftests/futex: futex_waitv wouldblock test should fail
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Liaw <[email protected]>
[ Upstream commit 7d50e00fef2832e98d7e06bbfc85c1d66ee110ca ]
Testcase should fail if -EWOULDBLOCK is not returned when expected value differs from actual value from the waiter.
--- .../testing/selftests/futex/functional/futex_wait_wouldblock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/futex/functional/futex_wait_wouldblock.c +1 -1
@@ -98,7 +98,7 @@ int main(int argc, char *argv[])info ("Calling futex_waitv on f1: %u @ %p with val=%u\n" , f1, &f1, f1+1 ); res =futex_waitv (&waitv,1 ,0 , &to,CLOCK_MONOTONIC );if (!res || errno !=EWOULDBLOCK ) { -ksft_test_result_pass ("futex_waitv returned: %d %s\n" , +ksft_test_result_fail ("futex_waitv returned: %d %s\n" , res ? errno : res, res ?strerror (errno) :"" ); ret =RET_FAIL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 2/291 ata: pata_pxa: Fix potential NULL pointer dereference in pxa_ata_probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Martin <[email protected]>
[ Upstream commit ad320e408a8c95a282ab9c05cdf0c9b95e317985 ]
devm_ioremap() returns NULL on error. Currently, pxa_ata_probe() does not check for this case, which can result in a NULL pointer dereference.
Add NULL check after devm_ioremap() to prevent this issue.
--- drivers/ata/pata_pxa.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/ata/pata_pxa.c +6 -0
@@ -223,10 +223,16 @@ static int pxa_ata_probe(struct platform_device *pdev) ap->ioaddr.cmd_addr =devm_ioremap (&pdev->dev, cmd_res->start,resource_size (cmd_res)); +if (!ap->ioaddr.cmd_addr) +return -ENOMEM ; ap->ioaddr.ctl_addr =devm_ioremap (&pdev->dev, ctl_res->start,resource_size (ctl_res)); +if (!ap->ioaddr.ctl_addr) +return -ENOMEM ; ap->ioaddr.bmdma_addr =devm_ioremap (&pdev->dev, dma_res->start,resource_size (dma_res)); +if (!ap->ioaddr.bmdma_addr) +return -ENOMEM ;/* * Adjust register offsets
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 3/291 tipc: fix memory leak in tipc_link_xmit
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tung Nguyen <[email protected]>
[ Upstream commit 69ae94725f4fc9e75219d2d69022029c5b24bc9a ]
In case the backlog transmit queue for system-importance messages is overloaded, tipc_link_xmit() returns -ENOBUFS but the skb list is not purged. This leads to memory leak and failure when a skb is allocated.
This commit fixes this issue by purging the skb list before tipc_link_xmit() returns.
--- net/tipc/link.c | 1 + 1 file changed, 1 insertion(+)
net/tipc/link.c +1 -0
@@ -1068,6 +1068,7 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list,if (unlikely (l->backlog[imp].len >= l->backlog[imp].limit)) {if (imp ==TIPC_SYSTEM_IMPORTANCE ) {pr_warn ("%s<%s>, link overflow" , link_rst_msg, l->name); +__skb_queue_purge (list);return -ENOBUFS ; } rc =link_schedule_user (l, hdr);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 4/291 codel: remove sch->q.qlen check before qdisc_tree_reduce_backlog()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit 342debc12183b51773b3345ba267e9263bdfaaef ]
After making all ->qlen_notify() callbacks idempotent, now it is safe to remove the check of qlen!=0 from both fq_codel_dequeue() and codel_qdisc_dequeue().
--- net/sched/sch_codel.c | 5 +---- net/sched/sch_fq_codel.c | 6 ++---- 2 files changed, 3 insertions(+), 8 deletions(-)
net/sched/sch_codel.c +1 -4
@@ -95,10 +95,7 @@ static struct sk_buff *codel_qdisc_dequeue(struct Qdisc *sch) &q->stats, qdisc_pkt_len, codel_get_enqueue_time, drop_func, dequeue_func); -/* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, -* or HTB crashes. Defer it for next round. -*/ -if (q->stats.drop_count && sch->q.qlen) { +if (q->stats.drop_count) {qdisc_tree_reduce_backlog (sch, q->stats.drop_count, q->stats.drop_len); q->stats.drop_count =0 ; q->stats.drop_len =0 ;
net/sched/sch_fq_codel.c +2 -4
@@ -314,10 +314,8 @@ static struct sk_buff *fq_codel_dequeue(struct Qdisc *sch) }qdisc_bstats_update (sch, skb); flow->deficit -=qdisc_pkt_len (skb); -/* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, -* or HTB crashes. Defer it for next round. -*/ -if (q->cstats.drop_count && sch->q.qlen) { + +if (q->cstats.drop_count) {qdisc_tree_reduce_backlog (sch, q->cstats.drop_count, q->cstats.drop_len); q->cstats.drop_count =0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 5/291 net: tls: explicitly disallow disconnect
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 5071a1e606b30c0c11278d3c6620cd6a24724cf6 ]
syzbot discovered that it can disconnect a TLS socket and then run into all sort of unexpected corner cases. I have a vague recollection of Eric pointing this out to us a long time ago. Supporting disconnect is really hard, for one thing if offload is enabled we'd need to wait for all packets to be _acked_. Disconnect is not commonly used, disallow it.
The immediate problem syzbot run into is the warning in the strp, but that's just the easiest bug to trigger:
WARNING: CPU: 0 PID: 5834 at net/tls/tls_strp.c:486 tls_strp_msg_load+0x72e/0xa80 net/tls/tls_strp.c:486 RIP: 0010:tls_strp_msg_load+0x72e/0xa80 net/tls/tls_strp.c:486 Call Trace: <TASK> tls_rx_rec_wait+0x280/0xa60 net/tls/tls_sw.c:1363 tls_sw_recvmsg+0x85c/0x1c30 net/tls/tls_sw.c:2043 inet6_recvmsg+0x2c9/0x730 net/ipv6/af_inet6.c:678 sock_recvmsg_nosec net/socket.c:1023 [inline] sock_recvmsg+0x109/0x280 net/socket.c:1045 __sys_recvfrom+0x202/0x380 net/socket.c:2237
--- net/tls/tls_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/tls/tls_main.c +6 -0
@@ -900,6 +900,11 @@ static int tls_setsockopt(struct sock *sk, int level, int optname,return do_tls_setsockopt (sk, optname, optval, optlen); } +static int tls_disconnect (struct sock *sk,int flags) +{ +return -EOPNOTSUPP ; +} +struct tls_context *tls_ctx_create (struct sock *sk) {struct inet_connection_sock *icsk =inet_csk (sk);
@@ -995,6 +1000,7 @@ static void build_protos(struct proto prot[TLS_NUM_CONFIG][TLS_NUM_CONFIG], prot[TLS_BASE ][TLS_BASE ] = *base; prot[TLS_BASE ][TLS_BASE ].setsockopt = tls_setsockopt; prot[TLS_BASE ][TLS_BASE ].getsockopt = tls_getsockopt; + prot[TLS_BASE ][TLS_BASE ].disconnect = tls_disconnect; prot[TLS_BASE ][TLS_BASE ].close = tls_sk_proto_close; prot[TLS_SW ][TLS_BASE ] = prot[TLS_BASE ][TLS_BASE ];
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 6/291 rtnl: add helper to check if rtnl group has listeners
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit c5e2a973448d958feb7881e4d875eac59fdeff3d ]
As of today, rtnl code creates a new skb and unconditionally fills and broadcasts it to the relevant group. For most operations this is okay and doesn't waste resources in general.
When operations are done without the rtnl_lock, as in tc-flower, such skb allocation, message fill and no-op broadcasting can happen in all cores of the system, which contributes to system pressure and wastes precious cpu cycles when no one will receive the built message.
Introduce this helper so rtnetlink operations can simply check if someone is listening and then proceed if necessary.
Stable-dep-of: 369609fc6272 ("tc: Ensure we have enough buffer space when sending filter netlink notifications")
--- include/linux/rtnetlink.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/linux/rtnetlink.h +7 -0
@@ -138,4 +138,11 @@ extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,extern void rtnl_offload_xstats_notify (struct net_device *dev); +static inline int rtnl_has_listeners (const struct net *net,u32 group) +{ +struct sock *rtnl = net->rtnl; + +return netlink_has_listeners (rtnl, group); +} +#endif /* __LINUX_RTNETLINK_H */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 7/291 rtnl: add helper to check if a notification is needed
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Victor Nogueira <[email protected]>
[ Upstream commit 8439109b76a3c405808383bf9dd532fc4b9c2dbd ]
Building on the rtnl_has_listeners helper, add the rtnl_notify_needed helper to check if we can bail out early in the notification routines.
Stable-dep-of: 369609fc6272 ("tc: Ensure we have enough buffer space when sending filter netlink notifications")
--- include/linux/rtnetlink.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
include/linux/rtnetlink.h +15 -0
@@ -145,4 +145,19 @@ static inline int rtnl_has_listeners(const struct net *net, u32 group) return netlink_has_listeners(rtnl, group); } +/** +* rtnl_notify_needed - check if notification is needed +* @net: Pointer to the net namespace +* @nlflags: netlink ingress message flags +* @group: rtnl group +* +* Based on the ingress message flags and rtnl group, returns true +* if a notification is needed, false otherwise. +*/ +static inline bool +rtnl_notify_needed (const struct net *net,u16 nlflags,u32 group) +{ +return (nlflags &NLM_F_ECHO ) ||rtnl_has_listeners (net, group); +} +#endif /* __LINUX_RTNETLINK_H */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 8/291 net/sched: cls_api: conditional notification of events
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pedro Tammela <[email protected]>
[ Upstream commit 93775590b1ee98bf2976b1f4a1ed24e9ff76170f ]
As of today tc-filter/chain events are unconditionally built and sent to RTNLGRP_TC. As with the introduction of rtnl_notify_needed we can check before-hand if they are really needed. This will help to alleviate system pressure when filters are concurrently added without the rtnl lock as in tc-flower.
Stable-dep-of: 369609fc6272 ("tc: Ensure we have enough buffer space when sending filter netlink notifications")
--- net/sched/cls_api.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
net/sched/cls_api.c +12 -0
@@ -1885,6 +1885,9 @@ static int tfilter_notify(struct net *net, struct sk_buff *oskb,u32 portid = oskb ?NETLINK_CB (oskb).portid :0 ;int err =0 ; +if (!unicast && !rtnl_notify_needed (net, n->nlmsg_flags,RTNLGRP_TC )) +return 0 ; + skb =alloc_skb (NLMSG_GOODSIZE ,GFP_KERNEL );if (!skb)return -ENOBUFS ;
@@ -1914,6 +1917,9 @@ static int tfilter_del_notify(struct net *net, struct sk_buff *oskb,u32 portid = oskb ?NETLINK_CB (oskb).portid :0 ;int err; +if (!rtnl_notify_needed (net, n->nlmsg_flags,RTNLGRP_TC )) +return tp->ops->delete (tp, fh, last, rtnl_held, extack); + skb =alloc_skb (NLMSG_GOODSIZE ,GFP_KERNEL );if (!skb)return -ENOBUFS ;
@@ -2731,6 +2737,9 @@ static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb,struct sk_buff *skb;int err =0 ; +if (!unicast && !rtnl_notify_needed (net, flags,RTNLGRP_TC )) +return 0 ; + skb =alloc_skb (NLMSG_GOODSIZE ,GFP_KERNEL );if (!skb)return -ENOBUFS ;
@@ -2760,6 +2769,9 @@ static int tc_chain_notify_delete(const struct tcf_proto_ops *tmplt_ops,struct net *net = block->net;struct sk_buff *skb; +if (!rtnl_notify_needed (net, flags,RTNLGRP_TC )) +return 0 ; + skb =alloc_skb (NLMSG_GOODSIZE ,GFP_KERNEL );if (!skb)return -ENOBUFS ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 9/291 tc: Ensure we have enough buffer space when sending filter netlink notifications
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 369609fc6272c2f6ad666ba4fd913f3baf32908f ]
The tfilter_notify() and tfilter_del_notify() functions assume that NLMSG_GOODSIZE is always enough to dump the filter chain. This is not always the case, which can lead to silent notify failures (because the return code of tfilter_notify() is not always checked). In particular, this can lead to NLM_F_ECHO not being honoured even though an action succeeds, which forces userspace to create workarounds[0].
Fix this by increasing the message size if dumping the filter chain into the allocated skb fails. Use the size of the incoming skb as a size hint if set, so we can start at a larger value when appropriate.
To trigger this, run the following commands:
# ip link add type veth # tc qdisc replace dev veth0 root handle 1: fq_codel # tc -echo filter add dev veth0 parent 1: u32 match u32 0 0 $(for i in $(seq 32); do echo action pedit munge ip dport set 22; done)
Before this fix, tc just returns:
Not a filter(cmd 2)
After the fix, we get the correct echo:
added filter dev veth0 parent 1: protocol all pref 49152 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 terminal flowid not_in_hw
match 00000000/00000000 at 0
action order 1: pedit action pass keys 1
index 1 ref 1 bind 1
key #0 at 20: val 00000016 mask ffff0000
[repeated 32 times]
[0] https://github.com/openvswitch/ovs/commit/106ef21860c935e5e0017a88bf42b94025c4e511
--- net/sched/cls_api.c | 66 ++++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 21 deletions(-)
net/sched/cls_api.c +45 -21
@@ -1824,6 +1824,7 @@ static int tcf_fill_node(struct net *net, struct sk_buff *skb,struct tcmsg *tcm;struct nlmsghdr *nlh;unsigned char *b =skb_tail_pointer (skb); +int ret = -EMSGSIZE ; nlh =nlmsg_put (skb, portid, seq, event,sizeof (*tcm), flags);if (!nlh)
@@ -1868,11 +1869,45 @@ static int tcf_fill_node(struct net *net, struct sk_buff *skb,return skb->len; +cls_op_not_supp: + ret = -EOPNOTSUPP ; out_nlmsg_trim: nla_put_failure: -cls_op_not_supp:nlmsg_trim (skb, b); -return -1 ; +return ret; +} + +static struct sk_buff *tfilter_notify_prep (struct net *net, +struct sk_buff *oskb, +struct nlmsghdr *n, +struct tcf_proto *tp, +struct tcf_block *block, +struct Qdisc *q,u32 parent, +void *fh,int event, +u32 portid,bool rtnl_held, +struct netlink_ext_ack *extack) +{ +unsigned int size = oskb ?max (NLMSG_GOODSIZE , oskb->len) :NLMSG_GOODSIZE ; +struct sk_buff *skb; +int ret; + +retry: + skb =alloc_skb (size,GFP_KERNEL ); +if (!skb) +return ERR_PTR (-ENOBUFS ); + + ret =tcf_fill_node (net, skb, tp, block, q, parent, fh, portid, + n->nlmsg_seq, n->nlmsg_flags, event, false, + rtnl_held, extack); +if (ret <=0 ) { +kfree_skb (skb); +if (ret == -EMSGSIZE ) { + size +=NLMSG_GOODSIZE ; + goto retry; + } +return ERR_PTR (-EINVAL ); + } +return skb; } static int tfilter_notify(struct net *net, struct sk_buff *oskb,
@@ -1888,16 +1923,10 @@ static int tfilter_notify(struct net *net, struct sk_buff *oskb,if (!unicast && !rtnl_notify_needed (net, n->nlmsg_flags,RTNLGRP_TC ))return 0 ; - skb =alloc_skb (NLMSG_GOODSIZE ,GFP_KERNEL ); -if (!skb) -return -ENOBUFS ; - -if (tcf_fill_node (net, skb, tp, block, q, parent, fh, portid, - n->nlmsg_seq, n->nlmsg_flags, event, - false, rtnl_held, extack) <=0 ) { -kfree_skb (skb); -return -EINVAL ; - } + skb =tfilter_notify_prep (net, oskb, n, tp, block, q, parent, fh, event, + portid, rtnl_held, extack); +if (IS_ERR (skb)) +return PTR_ERR (skb);if (unicast) err =rtnl_unicast (skb, net, portid);
@@ -1920,16 +1949,11 @@ static int tfilter_del_notify(struct net *net, struct sk_buff *oskb,if (!rtnl_notify_needed (net, n->nlmsg_flags,RTNLGRP_TC ))return tp->ops->delete (tp, fh, last, rtnl_held, extack); - skb =alloc_skb (NLMSG_GOODSIZE ,GFP_KERNEL ); -if (!skb) -return -ENOBUFS ; - -if (tcf_fill_node (net, skb, tp, block, q, parent, fh, portid, - n->nlmsg_seq, n->nlmsg_flags,RTM_DELTFILTER , - false, rtnl_held, extack) <=0 ) { + skb =tfilter_notify_prep (net, oskb, n, tp, block, q, parent, fh, +RTM_DELTFILTER , portid, rtnl_held, extack); +if (IS_ERR (skb)) {NL_SET_ERR_MSG (extack,"Failed to build del event notification" ); -kfree_skb (skb); -return -EINVAL ; +return PTR_ERR (skb); } err = tp->ops->delete (tp, fh, last, rtnl_held, extack);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 10/291 net: ethtool: Dont call .cleanup_data when prepare_data fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxime Chevallier <[email protected]>
[ Upstream commit 4f038a6a02d20859a3479293cbf172b0f14cbdd6 ]
There's a consistent pattern where the .cleanup_data() callback is called when .prepare_data() fails, when it should really be called to clean after a successful .prepare_data() as per the documentation.
Rewrite the error-handling paths to make sure we don't cleanup un-prepared data.
--- net/ethtool/netlink.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/ethtool/netlink.c +5 -3
@@ -384,7 +384,7 @@ static int ethnl_default_doit(struct sk_buff *skb, struct genl_info *info) ret = ops->prepare_data (req_info, reply_data, info);rtnl_unlock ();if (ret <0 ) - goto err_cleanup; + goto err_dev; ret = ops->reply_size (req_info, reply_data);if (ret <0 ) goto err_cleanup;
@@ -442,7 +442,7 @@ static int ethnl_default_dump_one(struct sk_buff *skb, struct net_device *dev, ret = ctx->ops->prepare_data (ctx->req_info, ctx->reply_data,NULL );rtnl_unlock ();if (ret <0 ) - goto out; + goto out_cancel; ret =ethnl_fill_reply_header (skb, dev, ctx->ops->hdr_attr);if (ret <0 ) goto out;
@@ -451,6 +451,7 @@ static int ethnl_default_dump_one(struct sk_buff *skb, struct net_device *dev, out:if (ctx->ops->cleanup_data) ctx->ops->cleanup_data (ctx->reply_data); +out_cancel: ctx->reply_data->dev =NULL ;if (ret <0 )genlmsg_cancel (skb, ehdr);
@@ -636,7 +637,7 @@ static void ethnl_default_notify(struct net_device *dev, unsigned int cmd,ethnl_init_reply_data (reply_data, ops, dev); ret = ops->prepare_data (req_info, reply_data,NULL );if (ret <0 ) - goto err_cleanup; + goto err_rep; ret = ops->reply_size (req_info, reply_data);if (ret <0 ) goto err_cleanup;
@@ -671,6 +672,7 @@ static void ethnl_default_notify(struct net_device *dev, unsigned int cmd, err_cleanup:if (ops->cleanup_data) ops->cleanup_data (reply_data); +err_rep:kfree (reply_data);kfree (req_info);return ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 11/291 ata: sata_sx4: Add error handling in pdc20621_i2c_read()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 8d46a27085039158eb5e253ab8a35a0e33b5e864 ]
The function pdc20621_prog_dimm0() calls the function pdc20621_i2c_read() but does not handle the error if the read fails. This could lead to process with invalid data. A proper implementation can be found in /source/drivers/ata/sata_sx4.c, pdc20621_prog_dimm_global(). As mentioned in its commit: bb44e154e25125bef31fa956785e90fccd24610b, the variable spd0 might be used uninitialized when pdc20621_i2c_read() fails.
Add error handling to pdc20621_i2c_read(). If a read operation fails, an error message is logged via dev_err(), and return a negative error code.
Add error handling to pdc20621_prog_dimm0() in pdc20621_dimm_init(), and return a negative error code if pdc20621_prog_dimm0() fails.
--- drivers/ata/sata_sx4.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/ata/sata_sx4.c +10 -3
@@ -1118,9 +1118,14 @@ static int pdc20621_prog_dimm0(struct ata_host *host) mmio +=PDC_CHIP0_OFS ;for (i =0 ; i <ARRAY_SIZE (pdc_i2c_read_data); i++) -pdc20621_i2c_read (host,PDC_DIMM0_SPD_DEV_ADDRESS , - pdc_i2c_read_data[i].reg, - &spd0[pdc_i2c_read_data[i].ofs]); +if (!pdc20621_i2c_read (host,PDC_DIMM0_SPD_DEV_ADDRESS , + pdc_i2c_read_data[i].reg, + &spd0[pdc_i2c_read_data[i].ofs])) { +dev_err (host->dev, +"Failed in i2c read at index %d: device=%#x, reg=%#x\n" , + i,PDC_DIMM0_SPD_DEV_ADDRESS , pdc_i2c_read_data[i].reg); +return -EIO ; + } data |= (spd0[4 ] -8 ) | ((spd0[21 ] !=0 ) <<3 ) | ((spd0[3 ]-11 ) <<4 ); data |= ((spd0[17] / 4) << 6) | ((spd0[5] / 2) << 7) |
@@ -1285,6 +1290,8 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)/* Programming DIMM0 Module Control Register (index_CID0:80h) */ size =pdc20621_prog_dimm0 (host); +if (size <0 ) +return size;dev_dbg (host->dev,"Local DIMM Size = %dMB\n" , size);/* Programming DIMM Module Global Control Register (index_CID0:88h) */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 12/291 nvmet-fcloop: swap list_add_tail arguments
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit 2b5f0c5bc819af2b0759a8fcddc1b39102735c0f ]
The newly element to be added to the list is the first argument of list_add_tail. This fix is missing dcfad4ab4d67 ("nvmet-fcloop: swap the list_add_tail arguments").
--- drivers/nvme/target/fcloop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/fcloop.c +1 -1
@@ -478,7 +478,7 @@ fcloop_t2h_xmt_ls_rsp(struct nvme_fc_local_port *localport,if (targetport) { tport = targetport->private;spin_lock (&tport->lock); -list_add_tail (&tport->ls_list, &tls_req->ls_list); +list_add_tail (&tls_req->ls_list, &tport->ls_list);spin_unlock (&tport->lock);queue_work (nvmet_wq, &tport->ls_work); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 13/291 net_sched: sch_sfq: use a temporary work area for validating configuration
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Octavian Purdila <[email protected]>
[ Upstream commit 8c0cea59d40cf6dd13c2950437631dd614fbade6 ]
Many configuration parameters have influence on others (e.g. divisor -> flows -> limit, depth -> limit) and so it is difficult to correctly do all of the validation before applying the configuration. And if a validation error is detected late it is difficult to roll back a partially applied configuration.
To avoid these issues use a temporary work area to update and validate the configuration and only then apply the configuration to the internal state.
Stable-dep-of: b3bf8f63e617 ("net_sched: sch_sfq: move the limit validation")
--- net/sched/sch_sfq.c | 56 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 12 deletions(-)
net/sched/sch_sfq.c +44 -12
@@ -631,6 +631,15 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt,struct red_parms *p =NULL ;struct sk_buff *to_free =NULL ;struct sk_buff *tail =NULL ; +unsigned int maxflows; +unsigned int quantum; +unsigned int divisor; +int perturb_period; +u8 headdrop; +u8 maxdepth; +int limit; +u8 flags; +if (opt->nla_len <nla_attr_size (sizeof (*ctl)))return -EINVAL ;
@@ -656,36 +665,59 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt,NL_SET_ERR_MSG_MOD (extack,"invalid limit" );return -EINVAL ; } +sch_tree_lock (sch); + + limit = q->limit; + divisor = q->divisor; + headdrop = q->headdrop; + maxdepth = q->maxdepth; + maxflows = q->maxflows; + perturb_period = q->perturb_period; + quantum = q->quantum; + flags = q->flags; + +/* update and validate configuration */ if (ctl->quantum) - q->quantum = ctl->quantum; -WRITE_ONCE (q->perturb_period, ctl->perturb_period *HZ ); + quantum = ctl->quantum; + perturb_period = ctl->perturb_period *HZ ;if (ctl->flows) - q->maxflows =min_t (u32, ctl->flows,SFQ_MAX_FLOWS ); + maxflows =min_t (u32, ctl->flows,SFQ_MAX_FLOWS );if (ctl->divisor) { - q->divisor = ctl->divisor; - q->maxflows =min_t (u32, q->maxflows, q->divisor); + divisor = ctl->divisor; + maxflows =min_t (u32, maxflows, divisor); }if (ctl_v1) {if (ctl_v1->depth) - q->maxdepth =min_t (u32, ctl_v1->depth,SFQ_MAX_DEPTH ); + maxdepth =min_t (u32, ctl_v1->depth,SFQ_MAX_DEPTH );if (p) { -swap (q->red_parms, p); -red_set_parms (q->red_parms, +red_set_parms (p, ctl_v1->qth_min, ctl_v1->qth_max, ctl_v1->Wlog, ctl_v1->Plog, ctl_v1->Scell_log,NULL , ctl_v1->max_P); } - q->flags = ctl_v1->flags; - q->headdrop = ctl_v1->headdrop; + flags = ctl_v1->flags; + headdrop = ctl_v1->headdrop; }if (ctl->limit) { - q->limit =min_t (u32, ctl->limit, q->maxdepth * q->maxflows); - q->maxflows =min_t (u32, q->maxflows, q->limit); + limit =min_t (u32, ctl->limit, maxdepth * maxflows); + maxflows =min_t (u32, maxflows, limit); } +/* commit configuration */ + q->limit = limit; + q->divisor = divisor; + q->headdrop = headdrop; + q->maxdepth = maxdepth; + q->maxflows = maxflows; +WRITE_ONCE (q->perturb_period, perturb_period); + q->quantum = quantum; + q->flags = flags; +if (p) +swap (q->red_parms, p); + qlen = sch->q.qlen;while (sch->q.qlen > q->limit) { dropped +=sfq_drop (sch, &to_free);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 14/291 net_sched: sch_sfq: move the limit validation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Octavian Purdila <[email protected]>
[ Upstream commit b3bf8f63e6179076b57c9de660c9f80b5abefe70 ]
It is not sufficient to directly validate the limit on the data that the user passes as it can be updated based on how the other parameters are changed.
Move the check at the end of the configuration update process to also catch scenarios where the limit is indirectly updated, for example with the following configurations:
tc qdisc add dev dummy0 handle 1: root sfq limit 2 flows 1 depth 1 tc qdisc add dev dummy0 handle 1: root sfq limit 2 flows 1 divisor 1
This fixes the following syzkaller reported crash:
------------[ cut here ]------------ UBSAN: array-index-out-of-bounds in net/sched/sch_sfq.c:203:6 index 65535 is out of range for type 'struct sfq_head[128]' CPU: 1 UID: 0 PID: 3037 Comm: syz.2.16 Not tainted 6.14.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x201/0x300 lib/dump_stack.c:120 ubsan_epilogue lib/ubsan.c:231 [inline] __ubsan_handle_out_of_bounds+0xf5/0x120 lib/ubsan.c:429 sfq_link net/sched/sch_sfq.c:203 [inline] sfq_dec+0x53c/0x610 net/sched/sch_sfq.c:231 sfq_dequeue+0x34e/0x8c0 net/sched/sch_sfq.c:493 sfq_reset+0x17/0x60 net/sched/sch_sfq.c:518 qdisc_reset+0x12e/0x600 net/sched/sch_generic.c:1035 tbf_reset+0x41/0x110 net/sched/sch_tbf.c:339 qdisc_reset+0x12e/0x600 net/sched/sch_generic.c:1035 dev_reset_queue+0x100/0x1b0 net/sched/sch_generic.c:1311 netdev_for_each_tx_queue include/linux/netdevice.h:2590 [inline] dev_deactivate_many+0x7e5/0xe70 net/sched/sch_generic.c:1375
--- net/sched/sch_sfq.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/sched/sch_sfq.c +6 -4
@@ -661,10 +661,6 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt,if (!p)return -ENOMEM ; } -if (ctl->limit ==1 ) { -NL_SET_ERR_MSG_MOD (extack,"invalid limit" ); -return -EINVAL ; - }sch_tree_lock (sch);
@@ -705,6 +701,12 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt, limit =min_t (u32, ctl->limit, maxdepth * maxflows); maxflows =min_t (u32, maxflows, limit); } +if (limit ==1 ) { +sch_tree_unlock (sch); +kfree (p); +NL_SET_ERR_MSG_MOD (extack,"invalid limit" ); +return -EINVAL ; + }/* commit configuration */ q->limit = limit;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 15/291 ipv6: Align behavior across nexthops during path selection
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 6933cd4714861eea6848f18396a119d741f25fc3 ]
A nexthop is only chosen when the calculated multipath hash falls in the nexthop's hash region (i.e., the hash is smaller than the nexthop's hash threshold) and when the nexthop is assigned a non-negative score by rt6_score_route().
Commit 4d0ab3a6885e ("ipv6: Start path selection from the first nexthop") introduced an unintentional difference between the first nexthop and the rest when the score is negative.
When the first nexthop matches, but has a negative score, the code will currently evaluate subsequent nexthops until one is found with a non-negative score. On the other hand, when a different nexthop matches, but has a negative score, the code will fallback to the nexthop with which the selection started ('match').
Align the behavior across all nexthops and fallback to 'match' when the first nexthop matches, but has a negative score.
--- net/ipv6/route.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/ipv6/route.c +4 -4
@@ -474,10 +474,10 @@ void fib6_select_path(const struct net *net, struct fib6_result *res, goto out; hash = fl6->mp_hash; -if (hash <=atomic_read (&first->fib6_nh->fib_nh_upper_bound) && -rt6_score_route (first->fib6_nh, first->fib6_flags, oif, - strict) >=0 ) { - match = first; +if (hash <=atomic_read (&first->fib6_nh->fib_nh_upper_bound)) { +if (rt6_score_route (first->fib6_nh, first->fib6_flags, oif, + strict) >=0 ) + match = first; goto out; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 16/291 net: ppp: Add bound checking for skb data on ppp_sync_txmung
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaud Lecomte <[email protected]>
[ Upstream commit aabc6596ffb377c4c9c8f335124b92ea282c9821 ]
Ensure we have enough data in linear buffer from skb before accessing initial bytes. This prevents potential out-of-bounds accesses when processing short packets.
When ppp_sync_txmung receives an incoming package with an empty payload:
(remote) gef➤ p *(struct pppoe_hdr *) (skb->head + skb->network_header)
$18 = {
type = 0x1,
ver = 0x1,
code = 0x0,
sid = 0x2,
length = 0x0,
tag = 0xffff8880371cdb96
}from the skb struct (trimmed)
tail = 0x16,
end = 0x140,
head = 0xffff88803346f400 "4",
data = 0xffff88803346f416 ":\377",
truesize = 0x380,
len = 0x0,
data_len = 0x0,
mac_len = 0xe,
hdr_len = 0x0,it is not safe to access data[2].
--- drivers/net/ppp/ppp_synctty.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ppp/ppp_synctty.c +5 -0
@@ -515,6 +515,11 @@ ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *skb)unsigned char *data;int islcp; +/* Ensure we can safely access protocol field and LCP code */ +if (!pskb_may_pull (skb,3 )) { +kfree_skb (skb); +return NULL ; + } data = skb->data; proto =get_unaligned_be16 (data);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 17/291 nft_set_pipapo: fix incorrect avx2 match of 5th field octet
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit e042ed950d4e176379ba4c0722146cd96fb38aa2 ]
Given a set element like:
icmpv6 . dead:beef:00ff::1
The value of 'ff' is irrelevant, any address will be matched as long as the other octets are the same.
This is because of too-early register clobbering:
ymm7 is reloaded with new packet data (pkt[9]) but it still holds data of an earlier load that wasn't processed yet.
The existing tests in nft_concat_range.sh selftests do exercise this code path, but do not trigger incorrect matching due to the network prefix limitation.
--- net/netfilter/nft_set_pipapo_avx2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nft_set_pipapo_avx2.c +2 -1
@@ -994,8 +994,9 @@ static int nft_pipapo_avx2_lookup_8b_16(unsigned long *map, unsigned long *fill,NFT_PIPAPO_AVX2_BUCKET_LOAD8 (5 , lt,8 , pkt[8 ], bsize);NFT_PIPAPO_AVX2_AND (6 ,2 ,3 ); +NFT_PIPAPO_AVX2_AND (3 ,4 ,7 );NFT_PIPAPO_AVX2_BUCKET_LOAD8 (7 , lt,9 , pkt[9 ], bsize); -NFT_PIPAPO_AVX2_AND (0 ,4 ,5 ); +NFT_PIPAPO_AVX2_AND (0 ,3 ,5 );NFT_PIPAPO_AVX2_BUCKET_LOAD8 (1 , lt,10 , pkt[10 ], bsize);NFT_PIPAPO_AVX2_AND (2 ,6 ,7 );NFT_PIPAPO_AVX2_BUCKET_LOAD8 (3 , lt,11 , pkt[11 ], bsize);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 18/291 iommu/mediatek: Fix NULL pointer deference in mtk_iommu_device_group
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Louis-Alexis Eyraud <[email protected]>
[ Upstream commit 38e8844005e6068f336a3ad45451a562a0040ca1 ]
Currently, mtk_iommu calls during probe iommu_device_register before the hw_list from driver data is initialized. Since iommu probing issue fix, it leads to NULL pointer dereference in mtk_iommu_device_group when hw_list is accessed with list_first_entry (not null safe).
So, change the call order to ensure iommu_device_register is called after the driver data are initialized.
--- drivers/iommu/mtk_iommu.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/iommu/mtk_iommu.c +13 -13
@@ -1268,15 +1268,6 @@ static int mtk_iommu_probe(struct platform_device *pdev)platform_set_drvdata (pdev, data);mutex_init (&data->mutex); - ret =iommu_device_sysfs_add (&data->iommu, dev,NULL , -"mtk-iommu.%pa" , &ioaddr); -if (ret) - goto out_link_remove; - - ret =iommu_device_register (&data->iommu, &mtk_iommu_ops, dev); -if (ret) - goto out_sysfs_remove; -if (MTK_IOMMU_HAS_FLAG (data->plat_data,SHARE_PGTABLE )) {list_add_tail (&data->list, data->plat_data->hw_list); data->hw_list = data->plat_data->hw_list;
@@ -1286,19 +1277,28 @@ static int mtk_iommu_probe(struct platform_device *pdev) data->hw_list = &data->hw_list_head; } + ret =iommu_device_sysfs_add (&data->iommu, dev,NULL , +"mtk-iommu.%pa" , &ioaddr); +if (ret) + goto out_list_del; + + ret =iommu_device_register (&data->iommu, &mtk_iommu_ops, dev); +if (ret) + goto out_sysfs_remove; +if (MTK_IOMMU_IS_TYPE (data->plat_data,MTK_IOMMU_TYPE_MM )) { ret =component_master_add_with_match (dev, &mtk_iommu_com_ops, match);if (ret) - goto out_list_del; + goto out_device_unregister; }return ret; -out_list_del: -list_del (&data->list); +out_device_unregister:iommu_device_unregister (&data->iommu); out_sysfs_remove:iommu_device_sysfs_remove (&data->iommu); -out_link_remove: +out_list_del: +list_del (&data->list);if (MTK_IOMMU_IS_TYPE (data->plat_data,MTK_IOMMU_TYPE_MM ))device_link_remove (data->smicomm_dev, dev); out_runtime_disable:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 19/291 fs: consistently deref the files table with rcu_dereference_raw()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mateusz Guzik <[email protected]>
[ Upstream commit f381640e1bd4f2de7ccafbfe8703d33c3718aad9 ]
... except when the table is known to be only used by one thread.
A file pointer can get installed at any moment despite the ->file_lock being held since the following:8a81252b774b53e6 ("fs/file.c: don't acquire files->file_lock in fd_install()")
Accesses subject to such a race can in principle suffer load tearing.
While here redo the comment in dup_fd -- it only covered a race against files showing up, still assuming fd_install() takes the lock.
--- fs/file.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
fs/file.c +17 -9
@@ -362,17 +362,25 @@ struct files_struct *dup_fd(struct files_struct *oldf, struct fd_range *punch_ho old_fds = old_fdt->fd; new_fds = new_fdt->fd; +/* +* We may be racing against fd allocation from other threads using this +* files_struct, despite holding ->file_lock. +* +* alloc_fd() might have already claimed a slot, while fd_install() +* did not populate it yet. Note the latter operates locklessly, so +* the file can show up as we are walking the array below. +* +* At the same time we know no files will disappear as all other +* operations take the lock. +* +* Instead of trying to placate userspace racing with itself, we +* ref the file if we see it and mark the fd slot as unused otherwise. +*/ for (i = open_files; i !=0 ; i--) { -struct file *f = *old_fds++; +struct file *f =rcu_dereference_raw (*old_fds++);if (f) {get_file (f); }else { -/* -* The fd may be claimed in the fd bitmap but not yet -* instantiated in the files array if a sibling thread -* is partway through open(). So make sure that this -* fd is available to the new process. -*/ __clear_open_fd (open_files - i, new_fdt); }rcu_assign_pointer (*new_fds++, f);
@@ -625,7 +633,7 @@ static struct file *pick_file(struct files_struct *files, unsigned fd)return NULL ; fd =array_index_nospec (fd, fdt->max_fds); - file = fdt->fd[fd]; + file =rcu_dereference_raw (fdt->fd[fd]);if (file) {rcu_assign_pointer (fdt->fd[fd],NULL );__put_unused_fd (files, fd);
@@ -1093,7 +1101,7 @@ __releases(&files->file_lock)*/ fdt =files_fdtable (files); fd =array_index_nospec (fd, fdt->max_fds); - tofree = fdt->fd[fd]; + tofree =rcu_dereference_raw (fdt->fd[fd]);if (!tofree &&fd_is_open (fd, fdt)) goto Ebusy;get_file (file);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 20/291 umount: Allow superblock owners to force umount
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit e1ff7aa34dec7e650159fd7ca8ec6af7cc428d9f ]
Loosen the permission check on forced umount to allow users holding CAP_SYS_ADMIN privileges in namespaces that are privileged with respect to the userns that originally mounted the filesystem.
--- fs/namespace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/namespace.c +2 -1
@@ -1777,6 +1777,7 @@ static void warn_mandlock(void)static int can_umount (const struct path *path,int flags) {struct mount *mnt =real_mount (path->mnt); +struct super_block *sb = path->dentry->d_sb;if (!may_mount ())return -EPERM ;
@@ -1786,7 +1787,7 @@ static int can_umount(const struct path *path, int flags)return -EINVAL ;if (mnt->mnt.mnt_flags &MNT_LOCKED )/* Check optimistically */ return -EINVAL ; -if (flags &MNT_FORCE && !capable (CAP_SYS_ADMIN )) +if (flags &MNT_FORCE && !ns_capable (sb->s_user_ns,CAP_SYS_ADMIN ))return -EPERM ;return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 21/291 pm: cpupower: bench: Prevent NULL dereference on malloc failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhongqiu Han <[email protected]>
[ Upstream commit 208baa3ec9043a664d9acfb8174b332e6b17fb69 ]
If malloc returns NULL due to low memory, 'config' pointer can be NULL. Add a check to prevent NULL dereference.
--- tools/power/cpupower/bench/parse.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/power/cpupower/bench/parse.c +4 -0
@@ -120,6 +120,10 @@ FILE *prepare_output(const char *dirname)struct config *prepare_default_config () {struct config *config =malloc (sizeof (struct config )); +if (!config) { +perror ("malloc" ); +return NULL ; + }dprintf ("loading defaults\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 22/291 x86/cpu: Dont clear X86_FEATURE_LAHF_LM flag in init_amd_k8() on AMD when running in a virtual machine
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Grobecker <[email protected]>
[ Upstream commit a4248ee16f411ac1ea7dfab228a6659b111e3d65 ]
When running in a virtual machine, we might see the original hardware CPU vendor string (i.e. "AuthenticAMD"), but a model and family ID set by the hypervisor. In case we run on AMD hardware and the hypervisor sets a model ID < 0x14, the LAHF cpu feature is eliminated from the the list of CPU capabilities present to circumvent a bug with some BIOSes in conjunction with AMD K8 processors.
Parsing the flags list from /proc/cpuinfo seems to be happening mostly in bash scripts and prebuilt Docker containers, as it does not need to have additionals tools present – even though more reliable ways like using "kcpuid", which calls the CPUID instruction instead of parsing a list, should be preferred. Scripts, that use /proc/cpuinfo to determine if the current CPU is "compliant" with defined microarchitecture levels like x86-64-v2 will falsely claim the CPU is incapable of modern CPU instructions when "lahf_lm" is missing in that flags list.
This can prevent some docker containers from starting or build scripts to create unoptimized binaries.
Admittably, this is more a small inconvenience than a severe bug in the kernel and the shoddy scripts that rely on parsing /proc/cpuinfo
should be fixed instead.
This patch adds an additional check to see if we're running inside a virtual machine (X86_FEATURE_HYPERVISOR is present), which, to my understanding, can't be present on a real K8 processor as it was introduced only with the later/other Athlon64 models.
Example output with the "lahf_lm" flag missing in the flags list (should be shown between "hypervisor" and "abm"):
$ cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 6
model name : Common KVM processor
stepping : 1
microcode : 0x1000065
cpu MHz : 2599.998
cache size : 512 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp
lm rep_good nopl cpuid extd_apicid tsc_known_freq pni
pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt
tsc_deadline_timer aes xsave avx f16c hypervisor abm
3dnowprefetch vmmcall bmi1 avx2 bmi2 xsaveopt... while kcpuid shows the feature to be present in the CPU:
# kcpuid -d | grep lahf
lahf_lm - LAHF/SAHF available in 64-bit mode[ mingo: Updated the comment a bit, incorporated Boris's review feedback. ]
--- arch/x86/kernel/cpu/amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/amd.c +1 -1
@@ -787,7 +787,7 @@ static void init_amd_k8(struct cpuinfo_x86 *c)* (model = 0x14) and later actually support it. * (AMD Erratum #110, docId: 25759). */ -if (c->x86_model <0x14 &&cpu_has (c,X86_FEATURE_LAHF_LM )) { +if (c->x86_model <0x14 &&cpu_has (c,X86_FEATURE_LAHF_LM ) && !cpu_has (c,X86_FEATURE_HYPERVISOR )) {clear_cpu_cap (c,X86_FEATURE_LAHF_LM );if (!rdmsrl_amd_safe (0xc001100d , &value)) { value &= ~BIT_64 (32 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 23/291 perf: arm_pmu: Dont disable counter in armpmu_add()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
[ Upstream commit dcca27bc1eccb9abc2552aab950b18a9742fb8e7 ]
Currently armpmu_add() tries to handle a newly-allocated counter having a stale associated event, but this should not be possible, and if this were to happen the current mitigation is insufficient and potentially expensive. It would be better to warn if we encounter the impossible case.
Calls to pmu::add() and pmu::del() are serialized by the core perf code, and armpmu_del() clears the relevant slot in pmu_hw_events::events[] before clearing the bit in pmu_hw_events::used_mask such that the counter can be reallocated. Thus when armpmu_add() allocates a counter index from pmu_hw_events::used_mask, it should not be possible to observe a stale even in pmu_hw_events::events[] unless either pmu_hw_events::used_mask or pmu_hw_events::events[] have been corrupted.
If this were to happen, we'd end up with two events with the same event->hw.idx, which would clash with each other during reprogramming, deletion, etc, and produce bogus results. Add a WARN_ON_ONCE() for this case so that we can detect if this ever occurs in practice.
That possiblity aside, there's no need to call arm_pmu::disable(event) for the new event. The PMU reset code initialises the counter in a disabled state, and armpmu_del() will disable the counter before it can be reused. Remove the redundant disable.
--- drivers/perf/arm_pmu.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/perf/arm_pmu.c +3 -5
@@ -340,12 +340,10 @@ armpmu_add(struct perf_event *event, int flags)if (idx <0 )return idx; -/* -* If there is an event in the counter we are going to use then make -* sure it is disabled. -*/ +/* The newly-allocated counter should be empty */ +WARN_ON_ONCE (hw_events->events[idx]); + event->hw.idx = idx; - armpmu->disable (event); hw_events->events[idx] = event; hwc->state =PERF_HES_STOPPED |PERF_HES_UPTODATE ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 24/291 arm64: cputype: Add QCOM_CPU_PART_KRYO_3XX_GOLD
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 401c3333bb2396aa52e4121887a6f6a6e2f040bc ]
Add a definition for the Qualcomm Kryo 300-series Gold cores.
--- arch/arm64/include/asm/cputype.h | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/include/asm/cputype.h +2 -0
@@ -119,6 +119,7 @@#define QCOM_CPU_PART_KRYO 0x200#define QCOM_CPU_PART_KRYO_2XX_GOLD 0x800#define QCOM_CPU_PART_KRYO_2XX_SILVER 0x801 +#define QCOM_CPU_PART_KRYO_3XX_GOLD 0x802#define QCOM_CPU_PART_KRYO_3XX_SILVER 0x803#define QCOM_CPU_PART_KRYO_4XX_GOLD 0x804#define QCOM_CPU_PART_KRYO_4XX_SILVER 0x805
@@ -188,6 +189,7 @@#define MIDR_QCOM_KRYO MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO)#define MIDR_QCOM_KRYO_2XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_GOLD)#define MIDR_QCOM_KRYO_2XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_SILVER) +#define MIDR_QCOM_KRYO_3XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_GOLD)#define MIDR_QCOM_KRYO_3XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_SILVER)#define MIDR_QCOM_KRYO_4XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_GOLD)#define MIDR_QCOM_KRYO_4XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_SILVER)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 25/291 xen/mcelog: Add __nonstring annotations for unterminated strings
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 1c3dfc7c6b0f551fdca3f7c1f1e4c73be8adb17d ]
When a character array without a terminating NUL character has a static initializer, GCC 15's -Wunterminated-string-initialization will only warn if the array lacks the "nonstring" attribute[1]. Mark the arrays with __nonstring to and correctly identify the char array as "not a C string" and thereby eliminate the warning.
Message-ID: <[email protected]>
--- include/xen/interface/xen-mca.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/xen/interface/xen-mca.h +1 -1
@@ -372,7 +372,7 @@ struct xen_mce {#define XEN_MCE_LOG_LEN 32struct xen_mce_log { -char signature[12 ];/* "MACHINECHECK" */ + char signature[12] __nonstring; /* "MACHINECHECK" */unsigned len;/* = XEN_MCE_LOG_LEN */ unsigned next; unsigned flags;
Signature · 13 lines
2.39.5
um: ntf-flags
-
- name: type
+ name: ndm-type
type: u8
enum: rtm-type
-
--
2.39.5Greg Kroah-Hartman
maintainerPATCH 26/291 HID: pidff: Convert infinite length from Linux API to PID standard
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 37e0591fe44dce39d1ebc7a82d5b6e4dba1582eb ]
Software uses 0 as de-facto infinite lenght on Linux FF apis (SDL), Linux doesn't actually define anythi as of now, while USB PID defines NULL (0xffff). Most PID devices do not expect a 0-length effect and can't interpret it as infinite. This change fixes Force Feedback for most PID compliant devices.
As most games depend on updating the values of already playing infinite effects, this is crucial to ensure they will actually work.
Previously, users had to rely on third-party software to do this conversion and make their PID devices usable.
--- drivers/hid/usbhid/hid-pidff.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/hid/usbhid/hid-pidff.c +7 -1
@@ -21,6 +21,7 @@#include "usbhid.h" #define PID_EFFECTS_MAX 64 +#define PID_INFINITE 0xffff/* Report usage table used to put reports into an array */
@@ -301,7 +302,12 @@ static void pidff_set_effect_report(struct pidff_device *pidff, pidff->block_load[PID_EFFECT_BLOCK_INDEX ].value[0 ]; pidff->set_effect_type->value[0 ] = pidff->create_new_effect_type->value[0 ]; - pidff->set_effect[PID_DURATION ].value[0 ] = effect->replay.length; + +/* Convert infinite length from Linux API (0) +to PID standard (NULL) if needed */ + pidff->set_effect[PID_DURATION ].value[0 ] = + effect->replay.length ==0 ?PID_INFINITE : effect->replay.length; + pidff->set_effect[PID_TRIGGER_BUTTON ].value[0 ] = effect->trigger.button; pidff->set_effect[PID_TRIGGER_REPEAT_INT ].value[0 ] = effect->trigger.interval;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 27/291 HID: pidff: Do not send effect envelope if its empty
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 8876fc1884f5b39550c8387ff3176396c988541d ]
Envelope struct is always initialized, but the envelope itself is optional as described in USB PID Device class definition 1.0.
5.1.1.1 Type Specific Block Offsets
...
4) Effects that do not use Condition Blocks use 1 Parameter Block and an *optional* Envelope Block.
Sending out "empty" envelope breaks force feedback on some devices with games that use SINE effect + offset to emulate constant force effect, as well as generally breaking Constant/Periodic effects. One of the affected brands is Moza Racing.
This change prevents the envelope from being sent if it contains all 0 values while keeping the old behavior of only sending it, if it differs from the old one.
Changes in v6:
- Simplify the checks to make them clearer
- Fix possible null pointer dereference while calling pidff_needs_set_envelope
--- drivers/hid/usbhid/hid-pidff.c | 42 +++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 18 deletions(-)
drivers/hid/usbhid/hid-pidff.c +24 -18
@@ -262,10 +262,22 @@ static void pidff_set_envelope_report(struct pidff_device *pidff,static int pidff_needs_set_envelope (struct ff_envelope *envelope,struct ff_envelope *old) { -return envelope->attack_level != old->attack_level || - envelope->fade_level != old->fade_level || +bool needs_new_envelope; + needs_new_envelope = envelope->attack_level !=0 || + envelope->fade_level !=0 || + envelope->attack_length !=0 || + envelope->fade_length !=0 ; + +if (!needs_new_envelope) +return false; + +if (!old) +return needs_new_envelope; + +return envelope->attack_level != old->attack_level || + envelope->fade_level != old->fade_level || envelope->attack_length != old->attack_length || - envelope->fade_length != old->fade_length; + envelope->fade_length != old->fade_length; }/*
@@ -580,11 +592,9 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,pidff_set_effect_report (pidff, effect);if (!old ||pidff_needs_set_constant (effect, old))pidff_set_constant_force_report (pidff, effect); -if (!old || -pidff_needs_set_envelope (&effect->u.constant.envelope, - &old->u.constant.envelope)) -pidff_set_envelope_report (pidff, - &effect->u.constant.envelope); +if (pidff_needs_set_envelope (&effect->u.constant.envelope, + old ? &old->u.constant.envelope :NULL )) +pidff_set_envelope_report (pidff, &effect->u.constant.envelope);break ;case FF_PERIODIC :
@@ -619,11 +629,9 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,pidff_set_effect_report (pidff, effect);if (!old ||pidff_needs_set_periodic (effect, old))pidff_set_periodic_report (pidff, effect); -if (!old || -pidff_needs_set_envelope (&effect->u.periodic.envelope, - &old->u.periodic.envelope)) -pidff_set_envelope_report (pidff, - &effect->u.periodic.envelope); +if (pidff_needs_set_envelope (&effect->u.periodic.envelope, + old ? &old->u.periodic.envelope :NULL )) +pidff_set_envelope_report (pidff, &effect->u.periodic.envelope);break ;case FF_RAMP :
@@ -637,11 +645,9 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,pidff_set_effect_report (pidff, effect);if (!old ||pidff_needs_set_ramp (effect, old))pidff_set_ramp_force_report (pidff, effect); -if (!old || -pidff_needs_set_envelope (&effect->u.ramp.envelope, - &old->u.ramp.envelope)) -pidff_set_envelope_report (pidff, - &effect->u.ramp.envelope); +if (pidff_needs_set_envelope (&effect->u.ramp.envelope, + old ? &old->u.ramp.envelope :NULL )) +pidff_set_envelope_report (pidff, &effect->u.ramp.envelope);break ;case FF_SPRING :
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 28/291 HID: pidff: Fix null pointer dereference in pidff_find_fields
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 22a05462c3d0eee15154faf8d13c49e6295270a5 ]
This function triggered a null pointer dereference if used to search for a report that isn't implemented on the device. This happened both for optional and required reports alike.
The same logic was applied to pidff_find_special_field and although pidff_init_fields should return an error earlier if one of the required reports is missing, future modifications could change this logic and resurface this possible null pointer dereference again.
LKML bug report:
https://lore.kernel.org/all/CAL-gK7f5=R0nrrQdPtaZZr1fd-cdAMbDMuZ_NLA8vM0SX+nGSw@mail.gmail.com
--- drivers/hid/usbhid/hid-pidff.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/hid/usbhid/hid-pidff.c +10 -0
@@ -770,6 +770,11 @@ static void pidff_set_autocenter(struct input_dev *dev, u16 magnitude)static int pidff_find_fields (struct pidff_usage *usage,const u8 *table,struct hid_report *report,int count,int strict) { +if (!report) { +pr_debug ("pidff_find_fields, null report\n" ); +return -1 ; + } +int i, j, k, found;for (k =0 ; k < count; k++) {
@@ -883,6 +888,11 @@ static int pidff_reports_ok(struct pidff_device *pidff)static struct hid_field *pidff_find_special_field (struct hid_report *report,int usage,int enforce_min) { +if (!report) { +pr_debug ("pidff_find_special_field, null report\n" ); +return NULL ; + } +int i;for (i =0 ; i < report->maxfield; i++) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 29/291 ALSA: hda: intel: Fix Optimus when GPU has no sound
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxim Mikityanskiy <[email protected]>
[ Upstream commit 2b360ba9a4936486380bc30d1eabceb40a714d98 ]
quirk_nvidia_hda() forcefully enables HDA controller on all NVIDIA GPUs, because some buggy BIOSes leave it disabled. However, some dual-GPU laptops do not have a functional HDA controller in DGPU, and BIOS disables it on purpose. After quirk_nvidia_hda() reenables this dummy HDA controller, attempting to probe it fails at azx_first_init(), which is too late to cancel the probe, as it happens in azx_probe_continue().
The sna_hda_intel driver calls azx_free() and stops the chip, however, it stays probed, and from the runtime PM point of view, the device remains active (it was set as active by the PCI subsystem on probe). It prevents vga_switcheroo from turning off the DGPU, because pci_create_device_link() syncs power management for video and audio devices.
Affected devices should be added to driver_denylist to prevent them from probing early. This patch helps identify such devices by printing a warning, and also forces the device to the suspended state to allow vga_switcheroo turn off DGPU.
--- sound/pci/hda/hda_intel.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
sound/pci/hda/hda_intel.c +14 -1
@@ -1366,8 +1366,21 @@ static void azx_free(struct azx *chip)if (use_vga_switcheroo (hda)) {if (chip->disabled && hda->probe_continued)snd_hda_unlock_devices (&chip->bus); -if (hda->vga_switcheroo_registered) +if (hda->vga_switcheroo_registered) {vga_switcheroo_unregister_client (chip->pci); + +/* Some GPUs don't have sound, and azx_first_init fails, +* leaving the device probed but non-functional. As long +* as it's probed, the PCI subsystem keeps its runtime +* PM status as active. Force it to suspended (as we +* actually stop the chip) to allow GPU to suspend via +* vga_switcheroo, and print a warning. +*/ +dev_warn (&pci->dev,"GPU sound probed, but not operational: please add a quirk to driver_denylist\n" ); +pm_runtime_disable (&pci->dev); +pm_runtime_set_suspended (&pci->dev); +pm_runtime_enable (&pci->dev); + } }if (bus->chip_init) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 31/291 ASoC: fsl_audmix: register card device depends on dais property
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shengjiu Wang <[email protected]>
[ Upstream commit 294a60e5e9830045c161181286d44ce669f88833 ]
In order to make the audmix device linked by audio graph card, make 'dais' property to be optional.
If 'dais' property exists, then register the imx-audmix card driver. otherwise, it should be linked by audio graph card.
--- sound/soc/fsl/fsl_audmix.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
sound/soc/fsl/fsl_audmix.c +11 -5
@@ -492,11 +492,17 @@ static int fsl_audmix_probe(struct platform_device *pdev) goto err_disable_pm; } - priv->pdev =platform_device_register_data (dev,"imx-audmix" ,0 ,NULL ,0 ); -if (IS_ERR (priv->pdev)) { - ret =PTR_ERR (priv->pdev); -dev_err (dev,"failed to register platform: %d\n" , ret); - goto err_disable_pm; +/* +* If dais property exist, then register the imx-audmix card driver. +* otherwise, it should be linked by audio graph card. +*/ +if (of_find_property (pdev->dev.of_node,"dais" ,NULL )) { + priv->pdev =platform_device_register_data (dev,"imx-audmix" ,0 ,NULL ,0 ); +if (IS_ERR (priv->pdev)) { + ret =PTR_ERR (priv->pdev); +dev_err (dev,"failed to register platform: %d\n" , ret); + goto err_disable_pm; + } }return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 32/291 mmc: dw_mmc: add a quirk for accessing 64-bit FIFOs in two halves
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kaustabh Chakraborty <[email protected]>
[ Upstream commit 57c0902f8bec51add5a1eb908d8b876592725d81 ]
In certain DW MMC implementations (such as in some Exynos7870 controllers), 64-bit read/write is not allowed from a 64-bit FIFO. Add a quirk which facilitates accessing the 64-bit FIFO registers in two 32-bit halves.
--- drivers/mmc/host/dw_mmc.c | 94 ++++++++++++++++++++++++++++++++++++++- drivers/mmc/host/dw_mmc.h | 27 +++++++++++ 2 files changed, 119 insertions(+), 2 deletions(-)
drivers/mmc/host/dw_mmc.c +92 -2
@@ -2574,6 +2574,91 @@ static void dw_mci_pull_data64(struct dw_mci *host, void *buf, int cnt) } } +static void dw_mci_push_data64_32 (struct dw_mci *host,void *buf,int cnt) +{ +struct mmc_data *data = host->data; +int init_cnt = cnt; + +/* try and push anything in the part_buf */ +if (unlikely (host->part_buf_count)) { +int len =dw_mci_push_part_bytes (host, buf, cnt); + + buf += len; + cnt -= len; + +if (host->part_buf_count ==8 ) { +mci_fifo_l_writeq (host->fifo_reg, host->part_buf); + host->part_buf_count =0 ; + } + } +#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS +if (unlikely ((unsigned long )buf &0x7 )) { +while (cnt >=8 ) { +u64 aligned_buf[16 ]; +int len =min (cnt &-8 , (int )sizeof (aligned_buf)); +int items = len >>3 ; +int i; +/* memcpy from input buffer into aligned buffer */ +memcpy (aligned_buf, buf, len); + buf += len; + cnt -= len; +/* push data from aligned buffer into fifo */ +for (i =0 ; i < items; ++i) +mci_fifo_l_writeq (host->fifo_reg, aligned_buf[i]); + } + } else +#endif + { +u64 *pdata = buf; + +for (; cnt >=8 ; cnt -=8 ) +mci_fifo_l_writeq (host->fifo_reg, *pdata++); + buf = pdata; + } +/* put anything remaining in the part_buf */ +if (cnt) { +dw_mci_set_part_bytes (host, buf, cnt); +/* Push data if we have reached the expected data length */ +if ((data->bytes_xfered + init_cnt) == + (data->blksz * data->blocks)) +mci_fifo_l_writeq (host->fifo_reg, host->part_buf); + } +} + +static void dw_mci_pull_data64_32 (struct dw_mci *host,void *buf,int cnt) +{ +#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS +if (unlikely ((unsigned long )buf &0x7 )) { +while (cnt >=8 ) { +/* pull data from fifo into aligned buffer */ +u64 aligned_buf[16 ]; +int len =min (cnt &-8 , (int )sizeof (aligned_buf)); +int items = len >>3 ; +int i; + +for (i =0 ; i < items; ++i) + aligned_buf[i] =mci_fifo_l_readq (host->fifo_reg); + +/* memcpy from aligned buffer into output buffer */ +memcpy (buf, aligned_buf, len); + buf += len; + cnt -= len; + } + } else +#endif + { +u64 *pdata = buf; + +for (; cnt >=8 ; cnt -=8 ) + *pdata++ =mci_fifo_l_readq (host->fifo_reg); + buf = pdata; + } +if (cnt) { + host->part_buf =mci_fifo_l_readq (host->fifo_reg); +dw_mci_pull_final_bytes (host, buf, cnt); + } +} +static void dw_mci_pull_data (struct dw_mci *host,void *buf,int cnt) {int len;
@@ -3374,8 +3459,13 @@ int dw_mci_probe(struct dw_mci *host) width =16 ; host->data_shift =1 ; }else if (i ==2 ) { - host->push_data = dw_mci_push_data64; - host->pull_data = dw_mci_pull_data64; +if ((host->quirks &DW_MMC_QUIRK_FIFO64_32 )) { + host->push_data = dw_mci_push_data64_32; + host->pull_data = dw_mci_pull_data64_32; + }else { + host->push_data = dw_mci_push_data64; + host->pull_data = dw_mci_pull_data64; + } width =64 ; host->data_shift =3 ; }else {
drivers/mmc/host/dw_mmc.h +27 -0
@@ -280,6 +280,8 @@ struct dw_mci_board {/* Support for longer data read timeout */ #define DW_MMC_QUIRK_EXTENDED_TMOUT BIT(0) +/* Force 32-bit access to the FIFO */ +#define DW_MMC_QUIRK_FIFO64_32 BIT(1)#define DW_MMC_240A 0x240a#define DW_MMC_280A 0x280a
@@ -471,6 +473,31 @@ struct dw_mci_board {#define mci_fifo_writel (__value, __reg) __raw_writel(__reg, __value)#define mci_fifo_writeq (__value, __reg) __raw_writeq(__reg, __value) +/* +* Some dw_mmc devices have 64-bit FIFOs, but expect them to be +* accessed using two 32-bit accesses. If such controller is used +* with a 64-bit kernel, this has to be done explicitly. +*/ +static inline u64 mci_fifo_l_readq (void __iomem *addr) +{ +u64 ans; +u32 proxy[2 ]; + + proxy[0 ] =mci_fifo_readl (addr); + proxy[1 ] =mci_fifo_readl (addr +4 ); +memcpy (&ans, proxy,8 ); +return ans; +} + +static inline void mci_fifo_l_writeq (void __iomem *addr,u64 value) +{ +u32 proxy[2 ]; + +memcpy (proxy, &value,8 ); +mci_fifo_writel (addr, proxy[0 ]); +mci_fifo_writel (addr +4 , proxy[1 ]); +} +/* Register access macros */ #define mci_readl (dev, reg) \ readl_relaxed((dev)->regs + SDMMC_##reg)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 33/291 ALSA: usb-audio: Fix CME quirk for UF series keyboards
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricard Wanderlof <[email protected]>
[ Upstream commit c2820405ba55a38932aa2177f026b70064296663 ]
Fix quirk for CME master keyboards so it not only handles sysex but also song position pointer, MIDI timing clock, start and stop messages, and active sensing. All of these can be output by the CME UF series master keyboards.
Tested with a CME UF6 in a desktop Linux environment as well as on the Zynthian Raspberry Pi based platform.
--- sound/usb/midi.c | 80 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 6 deletions(-)
sound/usb/midi.c +74 -6
@@ -489,16 +489,84 @@ static void ch345_broken_sysex_input(struct snd_usb_midi_in_endpoint *ep,/* * CME protocol: like the standard protocol, but SysEx commands are sent as a -* single USB packet preceded by a 0x0F byte. +* single USB packet preceded by a 0x0F byte, as are system realtime +* messages and MIDI Active Sensing. +* Also, multiple messages can be sent in the same packet. */ static void snd_usbmidi_cme_input (struct snd_usb_midi_in_endpoint *ep,uint8_t *buffer,int buffer_length) { -if (buffer_length <2 || (buffer[0 ] &0x0f ) !=0x0f ) -snd_usbmidi_standard_input (ep, buffer, buffer_length); -else -snd_usbmidi_input_data (ep, buffer[0 ] >>4 , - &buffer[1 ], buffer_length -1 ); +int remaining = buffer_length; + +/* +* CME send sysex, song position pointer, system realtime +* and active sensing using CIN 0x0f, which in the standard +* is only intended for single byte unparsed data. +* So we need to interpret these here before sending them on. +* By default, we assume single byte data, which is true +* for system realtime (midi clock, start, stop and continue) +* and active sensing, and handle the other (known) cases +* separately. +* In contrast to the standard, CME does not split sysex +* into multiple 4-byte packets, but lumps everything together +* into one. In addition, CME can string multiple messages +* together in the same packet; pressing the Record button +* on an UF6 sends a sysex message directly followed +* by a song position pointer in the same packet. +* For it to have any reasonable meaning, a sysex message +* needs to be at least 3 bytes in length (0xf0, id, 0xf7), +* corresponding to a packet size of 4 bytes, and the ones sent +* by CME devices are 6 or 7 bytes, making the packet fragments +* 7 or 8 bytes long (six or seven bytes plus preceding CN+CIN byte). +* For the other types, the packet size is always 4 bytes, +* as per the standard, with the data size being 3 for SPP +* and 1 for the others. +* Thus all packet fragments are at least 4 bytes long, so we can +* skip anything that is shorter; this also conveniantly skips +* packets with size 0, which CME devices continuously send when +* they have nothing better to do. +* Another quirk is that sometimes multiple messages are sent +* in the same packet. This has been observed for midi clock +* and active sensing i.e. 0x0f 0xf8 0x00 0x00 0x0f 0xfe 0x00 0x00, +* but also multiple note ons/offs, and control change together +* with MIDI clock. Similarly, some sysex messages are followed by +* the song position pointer in the same packet, and occasionally +* additionally by a midi clock or active sensing. +* We handle this by looping over all data and parsing it along the way. +*/ +while (remaining >=4 ) { +int source_length =4 ;/* default */ + +if ((buffer[0 ] &0x0f ) ==0x0f ) { +int data_length =1 ;/* default */ + +if (buffer[1 ] ==0xf0 ) { +/* Sysex: Find EOX and send on whole message. */ +/* To kick off the search, skip the first +* two bytes (CN+CIN and SYSEX (0xf0). +*/ +uint8_t *tmp_buf = buffer +2 ; +int tmp_length = remaining -2 ; + +while (tmp_length >1 && *tmp_buf !=0xf7 ) { + tmp_buf++; + tmp_length--; + } + data_length = tmp_buf - buffer; + source_length = data_length +1 ; + }else if (buffer[1 ] ==0xf2 ) { +/* Three byte song position pointer */ + data_length =3 ; + } +snd_usbmidi_input_data (ep, buffer[0 ] >>4 , + &buffer[1 ], data_length); + }else { +/* normal channel events */ +snd_usbmidi_standard_input (ep, buffer, source_length); + } + buffer += source_length; + remaining -= source_length; + } }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 34/291 ASoC: amd: Add DMI quirk for ACP6X mic support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: keenplify <[email protected]>
[ Upstream commit 309b367eafc8e162603cd29189da6db770411fea ]
Some AMD laptops with ACP6X do not expose the DMIC properly on Linux. Adding a DMI quirk enables mic functionality.
Similar to Bugzilla #218402, this issue affects multiple users.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -479,6 +479,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_VERSION, "pang13"), } }, + { + .driver_data = &acp6x_card, + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Micro-Star International Co., Ltd."), + DMI_MATCH(DMI_PRODUCT_NAME, "Bravo 15 C7UCX"), + } + }, {} };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 35/291 f2fs: dont retry IO for corrupted data scenario
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 1534747d3170646ddeb9ea5f7caaac90359707cf ]
F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942] F2FS-fs (dm-105): inconsistent node block, nid:430, node_footer[nid:2198964142,ino:598252782,ofs:118300154,cpver:5409237455940746069,blkaddr:2125070942]
If node block is loaded successfully, but its content is inconsistent, it doesn't need to retry IO.
--- fs/f2fs/inode.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/f2fs/inode.c +4 -0
@@ -695,8 +695,12 @@ void f2fs_update_inode_page(struct inode *inode)if (err == -ENOENT )return ; +if (err == -EFSCORRUPTED ) + goto stop_checkpoint; +if (err == -ENOMEM || ++count <=DEFAULT_RETRY_IO_COUNT ) goto retry; +stop_checkpoint:f2fs_stop_checkpoint (sbi, false,STOP_CP_REASON_UPDATE_INODE );return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 36/291 page_pool: avoid infinite loop to schedule delayed worker
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Xing <[email protected]>
[ Upstream commit 43130d02baa137033c25297aaae95fd0edc41654 ]
We noticed the kworker in page_pool_release_retry() was waken up repeatedly and infinitely in production because of the buggy driver causing the inflight less than 0 and warning us in page_pool_inflight()[1].
Since the inflight value goes negative, it means we should not expect the whole page_pool to get back to work normally.
This patch mitigates the adverse effect by not rescheduling the kworker when detecting the inflight negative in page_pool_release_retry().
[1]
[Mon Feb 10 20:36:11 2025] ------------[ cut here ]------------ [Mon Feb 10 20:36:11 2025] Negative(-51446) inflight packet-pages ... [Mon Feb 10 20:36:11 2025] Call Trace: [Mon Feb 10 20:36:11 2025] page_pool_release_retry+0x23/0x70 [Mon Feb 10 20:36:11 2025] process_one_work+0x1b1/0x370 [Mon Feb 10 20:36:11 2025] worker_thread+0x37/0x3a0 [Mon Feb 10 20:36:11 2025] kthread+0x11a/0x140 [Mon Feb 10 20:36:11 2025] ? process_one_work+0x370/0x370 [Mon Feb 10 20:36:11 2025] ? __kthread_cancel_work+0x40/0x40 [Mon Feb 10 20:36:11 2025] ret_from_fork+0x35/0x40 [Mon Feb 10 20:36:11 2025] ---[ end trace ebffe800f33e7e34 ]---
Note: before this patch, the above calltrace would flood the dmesg due to repeated reschedule of release_dw kworker.
--- net/core/page_pool.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/core/page_pool.c +7 -1
@@ -841,7 +841,13 @@ static void page_pool_release_retry(struct work_struct *wq)int inflight; inflight =page_pool_release (pool); -if (!inflight) +/* In rare cases, a driver bug may cause inflight to go negative. +* Don't reschedule release if inflight is 0 or negative. +* - If 0, the page_pool has been destroyed +* - if negative, we will never recover +* in both cases no reschedule is necessary. +*/ +if (inflight <=0 )return ;/* Periodic warning */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 37/291 jfs: Fix uninit-value access of imap allocated in the diMount() function
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhongqiu Han <[email protected]>
[ Upstream commit 9629d7d66c621671d9a47afe27ca9336bfc8a9ea ]
syzbot reports that hex_dump_to_buffer is using uninit-value:
=====================================================
BUG: KMSAN: uninit-value in hex_dump_to_buffer+0x888/0x1100 lib/hexdump.c:171 hex_dump_to_buffer+0x888/0x1100 lib/hexdump.c:171 print_hex_dump+0x13d/0x3e0 lib/hexdump.c:276 diFree+0x5ba/0x4350 fs/jfs/jfs_imap.c:876 jfs_evict_inode+0x510/0x550 fs/jfs/inode.c:156 evict+0x723/0xd10 fs/inode.c:796 iput_final fs/inode.c:1946 [inline] iput+0x97b/0xdb0 fs/inode.c:1972 txUpdateMap+0xf3e/0x1150 fs/jfs/jfs_txnmgr.c:2367 txLazyCommit fs/jfs/jfs_txnmgr.c:2664 [inline] jfs_lazycommit+0x627/0x11d0 fs/jfs/jfs_txnmgr.c:2733 kthread+0x6b9/0xef0 kernel/kthread.c:464 ret_from_fork+0x6d/0x90 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
Uninit was created at:
slab_post_alloc_hook mm/slub.c:4121 [inline] slab_alloc_node mm/slub.c:4164 [inline] __kmalloc_cache_noprof+0x8e3/0xdf0 mm/slub.c:4320 kmalloc_noprof include/linux/slab.h:901 [inline] diMount+0x61/0x7f0 fs/jfs/jfs_imap.c:105 jfs_mount+0xa8e/0x11d0 fs/jfs/jfs_mount.c:176 jfs_fill_super+0xa47/0x17c0 fs/jfs/super.c:523 get_tree_bdev_flags+0x6ec/0x910 fs/super.c:1636 get_tree_bdev+0x37/0x50 fs/super.c:1659 jfs_get_tree+0x34/0x40 fs/jfs/super.c:635 vfs_get_tree+0xb1/0x5a0 fs/super.c:1814 do_new_mount+0x71f/0x15e0 fs/namespace.c:3560 path_mount+0x742/0x1f10 fs/namespace.c:3887 do_mount fs/namespace.c:3900 [inline] __do_sys_mount fs/namespace.c:4111 [inline] __se_sys_mount+0x71f/0x800 fs/namespace.c:4088 __x64_sys_mount+0xe4/0x150 fs/namespace.c:4088 x64_sys_call+0x39bf/0x3c30 arch/x86/include/generated/asm/syscalls_64.h:166 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f =====================================================
The reason is that imap is not properly initialized after memory allocation. It will cause the snprintf() function to write uninitialized data into linebuf within hex_dump_to_buffer().
Fix this by using kzalloc instead of kmalloc to clear its content at the beginning in diMount().
--- fs/jfs/jfs_imap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/jfs_imap.c +1 -1
@@ -102,7 +102,7 @@ int diMount(struct inode *ipimap)* allocate/initialize the in-memory inode map control structure */ /* allocate the in-memory inode map control structure. */ - imap =kmalloc (sizeof (struct inomap ),GFP_KERNEL ); + imap =kzalloc (sizeof (struct inomap ),GFP_KERNEL );if (imap ==NULL )return -ENOMEM ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 38/291 fs/jfs: cast inactags to s64 to prevent potential overflow
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rand Deeb <[email protected]>
[ Upstream commit 70ca3246ad201b53a9f09380b3f29d8bac320383 ]
The expression "inactags << bmp->db_agl2size" in the function dbFinalizeBmap() is computed using int operands. Although the values (inactags and db_agl2size) are derived from filesystem parameters and are usually small, there is a theoretical risk that the shift could overflow a 32-bit int if extreme values occur.
According to the C standard, shifting a signed 32-bit int can lead to undefined behavior if the result exceeds its range. In our case, an overflow could miscalculate free blocks, potentially leading to erroneous filesystem accounting.
To ensure the arithmetic is performed in 64-bit space, we cast "inactags" to s64 before shifting. This defensive fix prevents any risk of overflow and complies with kernel coding best practices.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/jfs/jfs_dmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/jfs/jfs_dmap.c +2 -2
@@ -3666,8 +3666,8 @@ void dbFinalizeBmap(struct inode *ipbmap)* system size is not a multiple of the group size). */ inactfree = (inactags && ag_rem) ? - ((inactags -1 ) << bmp->db_agl2size) + ag_rem - : inactags << bmp->db_agl2size; + (((s64 )inactags -1 ) << bmp->db_agl2size) + ag_rem + : ((s64 )inactags << bmp->db_agl2size);/* determine how many free blocks are in the active * allocation groups plus the average number of free blocks
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 39/291 fs/jfs: Prevent integer overflow in AG size calculation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rand Deeb <[email protected]>
[ Upstream commit 7fcbf789629cdb9fbf4e2172ce31136cfed11e5e ]
The JFS filesystem calculates allocation group (AG) size using 1 << l2agsize in dbExtendFS(). When l2agsize exceeds 31 (possible with >2TB aggregates on 32-bit systems), this 32-bit shift operation causes undefined behavior and improper AG sizing.
On 32-bit architectures:
- Left-shifting 1 by 32+ bits results in 0 due to integer overflow
- This creates invalid AG sizes (0 or garbage values) in sbi->bmap->db_agsize
- Subsequent block allocations would reference invalid AG structures
- Could lead to:
- Filesystem corruption during extend operations
- Kernel crashes due to invalid memory accesses
- Security vulnerabilities via malformed on-disk structures
Fix by casting to s64 before shifting:bmp->db_agsize = (s64)1 << l2agsize;
This ensures 64-bit arithmetic even on 32-bit architectures. The cast matches the data type of db_agsize (s64) and follows similar patterns in JFS block calculation code.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/jfs/jfs_dmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/jfs_dmap.c +1 -1
@@ -3403,7 +3403,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) oldl2agsize = bmp->db_agl2size; bmp->db_agl2size = l2agsize; - bmp->db_agsize =1 << l2agsize; + bmp->db_agsize = (s64 )1 << l2agsize;/* compute new number of AG */ agno = bmp->db_numag;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 40/291 jfs: Prevent copying of nlink with value 0 from disk inode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit b61e69bb1c049cf507e3c654fa3dc1568231bd07 ]
syzbot report a deadlock in diFree. [1]
When calling "ioctl$LOOP_SET_STATUS64", the offset value passed in is 4, which does not match the mounted loop device, causing the mapping of the mounted loop device to be invalidated.
When creating the directory and creating the inode of iag in diReadSpecial(), read the page of fixed disk inode (AIT) in raw mode in read_metapage(), the metapage data it returns is corrupted, which causes the nlink value of 0 to be assigned to the iag inode when executing copy_from_dinode(), which ultimately causes a deadlock when entering diFree().
To avoid this, first check the nlink value of dinode before setting iag inode.
[1]
WARNING: possible recursive locking detected
6.12.0-rc7-syzkaller-00212-g4a5df3796467 #0 Not tainted
--------------------------------------------
syz-executor301/5309 is trying to acquire lock:ffff888044548920 (&(imap->im_aglock[index])){+.+.}-{3:3}, at: diFree+0x37c/0x2fb0 fs/jfs/jfs_imap.c:889
but task is already holding lock:ffff888044548920 (&(imap->im_aglock[index])){+.+.}-{3:3}, at: diAlloc+0x1b6/0x1630
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&(imap->im_aglock[index]));
lock(&(imap->im_aglock[index]));
*** DEADLOCK ***
May be due to missing lock nesting notation
5 locks held by syz-executor301/5309:
#0: ffff8880422a4420 (sb_writers#9){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:515 #1: ffff88804755b390 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:850 [inline] #1: ffff88804755b390 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: filename_create+0x260/0x540 fs/namei.c:4026 #2: ffff888044548920 (&(imap->im_aglock[index])){+.+.}-{3:3}, at: diAlloc+0x1b6/0x1630
#3: ffff888044548890 (&imap->im_freelock){+.+.}-{3:3}, at: diNewIAG fs/jfs/jfs_imap.c:2460 [inline] #3: ffff888044548890 (&imap->im_freelock){+.+.}-{3:3}, at: diAllocExt fs/jfs/jfs_imap.c:1905 [inline] #3: ffff888044548890 (&imap->im_freelock){+.+.}-{3:3}, at: diAllocAG+0x4b7/0x1e50 fs/jfs/jfs_imap.c:1669 #4: ffff88804755a618 (&jfs_ip->rdwrlock/1){++++}-{3:3}, at: diNewIAG fs/jfs/jfs_imap.c:2477 [inline] #4: ffff88804755a618 (&jfs_ip->rdwrlock/1){++++}-{3:3}, at: diAllocExt fs/jfs/jfs_imap.c:1905 [inline] #4: ffff88804755a618 (&jfs_ip->rdwrlock/1){++++}-{3:3}, at: diAllocAG+0x869/0x1e50 fs/jfs/jfs_imap.c:1669
stack backtrace: CPU: 0 UID: 0 PID: 5309 Comm: syz-executor301 Not tainted 6.12.0-rc7-syzkaller-00212-g4a5df3796467 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_deadlock_bug+0x483/0x620 kernel/locking/lockdep.c:3037 check_deadlock kernel/locking/lockdep.c:3089 [inline] validate_chain+0x15e2/0x5920 kernel/locking/lockdep.c:3891 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 diFree+0x37c/0x2fb0 fs/jfs/jfs_imap.c:889 jfs_evict_inode+0x32d/0x440 fs/jfs/inode.c:156 evict+0x4e8/0x9b0 fs/inode.c:725 diFreeSpecial fs/jfs/jfs_imap.c:552 [inline] duplicateIXtree+0x3c6/0x550 fs/jfs/jfs_imap.c:3022 diNewIAG fs/jfs/jfs_imap.c:2597 [inline] diAllocExt fs/jfs/jfs_imap.c:1905 [inline] diAllocAG+0x17dc/0x1e50 fs/jfs/jfs_imap.c:1669 diAlloc+0x1d2/0x1630 fs/jfs/jfs_imap.c:1590 ialloc+0x8f/0x900 fs/jfs/jfs_inode.c:56 jfs_mkdir+0x1c5/0xba0 fs/jfs/namei.c:225 vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4257 do_mkdirat+0x264/0x3a0 fs/namei.c:4280 __do_sys_mkdirat fs/namei.c:4295 [inline] __se_sys_mkdirat fs/namei.c:4293 [inline] __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4293 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
--- fs/jfs/jfs_imap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/jfs_imap.c +1 -1
@@ -456,7 +456,7 @@ struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary) dp += inum %8 ;/* 8 inodes per 4K page */ /* copy on-disk inode to in-memory inode */ -if ((copy_from_dinode (dp, ip)) !=0 ) { +if ((copy_from_dinode (dp, ip) !=0 ) || (ip->i_nlink ==0 )) {/* handle bad return by returning NULL for ip */ set_nlink (ip,1 );/* Don't want iput() deleting it */ iput (ip);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 41/291 jfs: add sanity check for agwidth in dbMount
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit ddf2846f22e8575d6b4b6a66f2100f168b8cd73d ]
The width in dmapctl of the AG is zero, it trigger a divide error when calculating the control page level in dbAllocAG.
To avoid this issue, add a check for agwidth in dbAllocAG.
--- fs/jfs/jfs_dmap.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/jfs/jfs_dmap.c +4 -0
@@ -204,6 +204,10 @@ int dbMount(struct inode *ipbmap) bmp->db_aglevel =le32_to_cpu (dbmp_le->dn_aglevel); bmp->db_agheight =le32_to_cpu (dbmp_le->dn_agheight); bmp->db_agwidth =le32_to_cpu (dbmp_le->dn_agwidth); +if (!bmp->db_agwidth) { + err = -EINVAL ; + goto err_release_metapage; + } bmp->db_agstart =le32_to_cpu (dbmp_le->dn_agstart); bmp->db_agl2size =le32_to_cpu (dbmp_le->dn_agl2size); if (bmp->db_agl2size > L2MAXL2SIZE - L2MAXAG ||
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 42/291 ata: libata-eh: Do not use ATAPI DMA for a device limited to PIO mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
[ Upstream commit 91ec84f8eaddbc93d7c62e363d68aeb7b89879c7 ]
atapi_eh_request_sense() currently uses ATAPI DMA if the SATA controller has ATA_FLAG_PIO_DMA (PIO cmds via DMA) set.
However, ATA_FLAG_PIO_DMA is a flag that can be set by a low-level driver on a port at initialization time, before any devices are scanned.
If a controller detects a connected device that only supports PIO, we set the flag ATA_DFLAG_PIO.
Modify atapi_eh_request_sense() to not use ATAPI DMA if the connected device only supports PIO.
--- drivers/ata/libata-eh.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/ata/libata-eh.c +9 -2
@@ -1510,8 +1510,15 @@ unsigned int atapi_eh_request_sense(struct ata_device *dev, tf.flags |=ATA_TFLAG_ISADDR |ATA_TFLAG_DEVICE ; tf.command =ATA_CMD_PACKET ; -/* is it pointless to prefer PIO for "safety reasons"? */ -if (ap->flags &ATA_FLAG_PIO_DMA ) { +/* +* Do not use DMA if the connected device only supports PIO, even if the +* port prefers PIO commands via DMA. +* +* Ideally, we should call atapi_check_dma() to check if it is safe for +* the LLD to use DMA for REQUEST_SENSE, but we don't have a qc. +* Since we can't check the command, perhaps we should only use pio? +*/ +if ((ap->flags &ATA_FLAG_PIO_DMA ) && !(dev->flags &ATA_DFLAG_PIO )) { tf.protocol =ATAPI_PROT_DMA ; tf.feature |=ATAPI_PKT_DMA ; }else {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 43/291 f2fs: fix to avoid out-of-bounds access in f2fs_truncate_inode_blocks()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit e6494977bd4a83862118a05f57a8df40256951c0 ]
syzbot reports an UBSAN issue as below:
------------[ cut here ]------------ UBSAN: array-index-out-of-bounds in fs/f2fs/node.h:381:10 index 18446744073709550692 is out of range for type '__le32[5]' (aka 'unsigned int[5]') CPU: 0 UID: 0 PID: 5318 Comm: syz.0.0 Not tainted 6.14.0-rc3-syzkaller-00060-g6537cfb395f3 #0 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 ubsan_epilogue lib/ubsan.c:231 [inline] __ubsan_handle_out_of_bounds+0x121/0x150 lib/ubsan.c:429 get_nid fs/f2fs/node.h:381 [inline] f2fs_truncate_inode_blocks+0xa5e/0xf60 fs/f2fs/node.c:1181 f2fs_do_truncate_blocks+0x782/0x1030 fs/f2fs/file.c:808 f2fs_truncate_blocks+0x10d/0x300 fs/f2fs/file.c:836 f2fs_truncate+0x417/0x720 fs/f2fs/file.c:886 f2fs_file_write_iter+0x1bdb/0x2550 fs/f2fs/file.c:5093 aio_write+0x56b/0x7c0 fs/aio.c:1633 io_submit_one+0x8a7/0x18a0 fs/aio.c:2052 __do_sys_io_submit fs/aio.c:2111 [inline] __se_sys_io_submit+0x171/0x2e0 fs/aio.c:2081 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f238798cde9
index 18446744073709550692 (decimal, unsigned long long) = 0xfffffffffffffc64 (hexadecimal, unsigned long long) = -924 (decimal, long long)
In f2fs_truncate_inode_blocks(), UBSAN detects that get_nid() tries to access .i_nid[-924], it means both offset[0] and level should zero.
The possible case should be in f2fs_do_truncate_blocks(), we try to truncate inode size to zero, however, dn.ofs_in_node is zero and dn.node_page is not an inode page, so it fails to truncate inode page, and then pass zeroed free_from to f2fs_truncate_inode_blocks(), result in this issue.
if (dn.ofs_in_node || IS_INODE(dn.node_page)) {
f2fs_truncate_data_blocks_range(&dn, count);
free_from += count;
}I guess the reason why dn.node_page is not an inode page could be: there are multiple nat entries share the same node block address, once the node block address was reused, f2fs_get_node_page() may load a non-inode block.
Let's add a sanity check for such condition to avoid out-of-bounds access issue.
--- fs/f2fs/node.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/f2fs/node.c +8 -1
@@ -1112,7 +1112,14 @@ int f2fs_truncate_inode_blocks(struct inode *inode, pgoff_t from)trace_f2fs_truncate_inode_blocks_enter (inode, from); level =get_node_path (inode, from, offset, noffset); -if (level <0 ) { +if (level <=0 ) { +if (!level) { + level = -EFSCORRUPTED ; +f2fs_err (sbi,"%s: inode ino=%lx has corrupted node block, from:%lu addrs:%u" , + __func__, inode->i_ino, + from,ADDRS_PER_INODE (inode)); +set_sbi_flag (sbi,SBI_NEED_FSCK ); + }trace_f2fs_truncate_inode_blocks_exit (inode, level);return level; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 44/291 ahci: add PCI ID for Marvell 88SE9215 SATA Controller
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Kral <[email protected]>
[ Upstream commit 885251dc35767b1c992f6909532ca366c830814a ]
Add support for Marvell Technology Group Ltd. 88SE9215 SATA 6 Gb/s controller, which is e.g. used in the DAWICONTROL DC-614e RAID bus controller and was not automatically recognized before.
Tested with a DAWICONTROL DC-614e RAID bus controller.
--- drivers/ata/ahci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/ata/ahci.c +2 -0
@@ -592,6 +592,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3), .driver_data = board_ahci_yes_fbs }, + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9215), + .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230), .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9235),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 45/291 ext4: protect ext4_release_dquot against freezing
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ojaswin Mujoo <[email protected]>
[ Upstream commit 530fea29ef82e169cd7fe048c2b7baaeb85a0028 ]
Protect ext4_release_dquot against freezing so that we don't try to start a transaction when FS is frozen, leading to warnings.
Further, avoid taking the freeze protection if a transaction is already running so that we don't need end up in a deadlock as described in
46e294efc355 ext4: fix deadlock with fs freezing and EA inodes
--- fs/ext4/super.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
fs/ext4/super.c +17 -0
@@ -6810,12 +6810,25 @@ static int ext4_release_dquot(struct dquot *dquot) {int ret, err;handle_t *handle; +bool freeze_protected = false; + +/* +* Trying to sb_start_intwrite() in a running transaction +* can result in a deadlock. Further, running transactions +* are already protected from freezing. +*/ +if (!ext4_journal_current_handle ()) { +sb_start_intwrite (dquot->dq_sb); + freeze_protected = true; + } handle =ext4_journal_start (dquot_to_inode (dquot),EXT4_HT_QUOTA ,EXT4_QUOTA_DEL_BLOCKS (dquot->dq_sb));if (IS_ERR (handle)) {/* Release dquot anyway to avoid endless cycle in dqput() */ dquot_release (dquot); +if (freeze_protected) +sb_end_intwrite (dquot->dq_sb);return PTR_ERR (handle); } ret =dquot_release (dquot);
@@ -6826,6 +6839,10 @@ static int ext4_release_dquot(struct dquot *dquot) err =ext4_journal_stop (handle);if (!ret) ret = err; + +if (freeze_protected) +sb_end_intwrite (dquot->dq_sb); +return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 46/291 ext4: ignore xattrs past end
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bhupesh <[email protected]>
[ Upstream commit c8e008b60492cf6fd31ef127aea6d02fd3d314cd ]
Once inside 'ext4_xattr_inode_dec_ref_all' we should ignore xattrs entries past the 'end' entry.
This fixes the following KASAN reported issue:
==================================================================
BUG: KASAN: slab-use-after-free in ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 Read of size 4 at addr ffff888012c120c4 by task repro/2065 CPU: 1 UID: 0 PID: 2065 Comm: repro Not tainted 6.13.0-rc2+ #11 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x1fd/0x300 ? tcp_gro_dev_warn+0x260/0x260 ? _printk+0xc0/0x100 ? read_lock_is_recursive+0x10/0x10 ? irq_work_queue+0x72/0xf0 ? __virt_addr_valid+0x17b/0x4b0 print_address_description+0x78/0x390 print_report+0x107/0x1f0 ? __virt_addr_valid+0x17b/0x4b0 ? __virt_addr_valid+0x3ff/0x4b0 ? __phys_addr+0xb5/0x160 ? ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 kasan_report+0xcc/0x100 ? ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 ? ext4_xattr_delete_inode+0xd30/0xd30 ? __ext4_journal_ensure_credits+0x5f0/0x5f0 ? __ext4_journal_ensure_credits+0x2b/0x5f0 ? inode_update_timestamps+0x410/0x410 ext4_xattr_delete_inode+0xb64/0xd30 ? ext4_truncate+0xb70/0xdc0 ? ext4_expand_extra_isize_ea+0x1d20/0x1d20 ? __ext4_mark_inode_dirty+0x670/0x670 ? ext4_journal_check_start+0x16f/0x240 ? ext4_inode_is_fast_symlink+0x2f2/0x3a0 ext4_evict_inode+0xc8c/0xff0 ? ext4_inode_is_fast_symlink+0x3a0/0x3a0 ? do_raw_spin_unlock+0x53/0x8a0 ? ext4_inode_is_fast_symlink+0x3a0/0x3a0 evict+0x4ac/0x950 ? proc_nr_inodes+0x310/0x310 ? trace_ext4_drop_inode+0xa2/0x220 ? _raw_spin_unlock+0x1a/0x30 ? iput+0x4cb/0x7e0 do_unlinkat+0x495/0x7c0 ? try_break_deleg+0x120/0x120 ? 0xffffffff81000000 ? __check_object_size+0x15a/0x210 ? strncpy_from_user+0x13e/0x250 ? getname_flags+0x1dc/0x530 __x64_sys_unlinkat+0xc8/0xf0 do_syscall_64+0x65/0x110 entry_SYSCALL_64_after_hwframe+0x67/0x6f RIP: 0033:0x434ffd Code: 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 8 RSP: 002b:00007ffc50fa7b28 EFLAGS: 00000246 ORIG_RAX: 0000000000000107 RAX: ffffffffffffffda RBX: 00007ffc50fa7e18 RCX: 0000000000434ffd RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000005 RBP: 00007ffc50fa7be0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffc50fa7e08 R14: 00000000004bbf30 R15: 0000000000000001 </TASK> The buggy address belongs to the object at ffff888012c12000 which belongs to the cache filp of size 360
The buggy address is located 196 bytes inside of
freed 360-byte region [ffff888012c12000, ffff888012c12168)
The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12c12 head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x40(head|node=0|zone=0) page_type: f5(slab) raw: 0000000000000040 ffff888000ad7640 ffffea0000497a00 dead000000000004 raw: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000
head: 0000000000000040 ffff888000ad7640 ffffea0000497a00 dead000000000004
head: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000
head: 0000000000000001 ffffea00004b0481 ffffffffffffffff 0000000000000000
head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888012c11f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888012c12000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
Quoted 1 line
ffff888012c12080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888012c12100: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
ffff888012c12180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
--- fs/ext4/xattr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/ext4/xattr.c +10 -1
@@ -1127,15 +1127,24 @@ ext4_xattr_inode_dec_ref_all(handle_t *handle, struct inode *parent, {struct inode *ea_inode;struct ext4_xattr_entry *entry; +struct ext4_iloc iloc;bool dirty = false;unsigned int ea_ino;int err;int credits; +void *end; + +if (block_csum) + end = (void *)bh->b_data + bh->b_size; +else { +ext4_get_inode_loc (parent, &iloc); + end = (void *)ext4_raw_inode (&iloc) +EXT4_SB (parent->i_sb)->s_inode_size; + }/* One credit for dec ref on ea_inode, one for orphan list addition, */ credits =2 + extra_credits; -for (entry = first; !IS_LAST_ENTRY (entry); +for (entry = first; (void *)entry < end && !IS_LAST_ENTRY (entry); entry =EXT4_XATTR_NEXT (entry)) {if (!entry->e_value_inum)continue ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 47/291 scsi: st: Fix array overflow in st_setup()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Mäkisara <[email protected]>
[ Upstream commit a018d1cf990d0c339fe0e29b762ea5dc10567d67 ]
Change the array size to follow parms size instead of a fixed value.
--- drivers/scsi/st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/st.c +1 -1
@@ -4112,7 +4112,7 @@ static void validate_options(void)*/ static int __init st_setup (char *str) { -int i, len, ints[5 ]; +int i, len, ints[ARRAY_SIZE (parms) +1 ];char *stp; stp =get_options (str,ARRAY_SIZE (ints), ints);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 48/291 wifi: mt76: mt76x2u: add TP-Link TL-WDN6200 ID to device table
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Icenowy Zheng <[email protected]>
[ Upstream commit 06cccc2ebbe6c8a20f714f3a0ff3ff489d3004bb ]
The TP-Link TL-WDN6200 "Driverless" version cards use a MT7612U chipset.
Add the USB ID to mt76x2u driver.
--- drivers/net/wireless/mediatek/mt76/mt76x2/usb.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt76x2/usb.c +1 -0
@@ -21,6 +21,7 @@ static const struct usb_device_id mt76x2u_device_table[] = { { USB_DEVICE(0x0846, 0x9053) }, /* Netgear A6210 */ { USB_DEVICE(0x045e, 0x02e6) }, /* XBox One Wireless Adapter */ { USB_DEVICE(0x045e, 0x02fe) }, /* XBox One Wireless Adapter */ + { USB_DEVICE(0x2357, 0x0137) }, /* TP-Link TL-WDN6200 */ { }, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 49/291 net: vlan: dont propagate flags on open
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit 27b918007d96402aba10ed52a6af8015230f1793 ]
With the device instance lock, there is now a possibility of a deadlock:
[ 1.211455] ============================================
[ 1.211571] WARNING: possible recursive locking detected
[ 1.211687] 6.14.0-rc5-01215-g032756b4ca7a-dirty #5 Not tainted
[ 1.211823] --------------------------------------------
[ 1.211936] ip/184 is trying to acquire lock:
[ 1.212032] ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_set_allmulti+0x4e/0xb0
[ 1.212207]
[ 1.212207] but task is already holding lock:
[ 1.212332] ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_open+0x50/0xb0
[ 1.212487]
[ 1.212487] other info that might help us debug this:
[ 1.212626] Possible unsafe locking scenario:
[ 1.212626]
[ 1.212751] CPU0
[ 1.212815] ----
[ 1.212871] lock(&dev->lock);
[ 1.212944] lock(&dev->lock);
[ 1.213016]
[ 1.213016] *** DEADLOCK ***
[ 1.213016]
[ 1.213143] May be due to missing lock nesting notation
[ 1.213143]
[ 1.213294] 3 locks held by ip/184:
[ 1.213371] #0: ffffffff838b53e0 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_nets_lock+0x1b/0xa0
[ 1.213543] #1: ffffffff84e5fc70 (&net->rtnl_mutex){+.+.}-{4:4}, at: rtnl_nets_lock+0x37/0xa0
[ 1.213727] #2: ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_open+0x50/0xb0
[ 1.213895]
[ 1.213895] stack backtrace:
[ 1.213991] CPU: 0 UID: 0 PID: 184 Comm: ip Not tainted 6.14.0-rc5-01215-g032756b4ca7a-dirty #5
[ 1.213993] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.16.3-1-1 04/01/2014
[ 1.213994] Call Trace:
[ 1.213995] <TASK>
[ 1.213996] dump_stack_lvl+0x8e/0xd0
[ 1.214000] print_deadlock_bug+0x28b/0x2a0
[ 1.214020] lock_acquire+0xea/0x2a0
[ 1.214027] __mutex_lock+0xbf/0xd40
[ 1.214038] dev_set_allmulti+0x4e/0xb0 # real_dev->flags & IFF_ALLMULTI
[ 1.214040] vlan_dev_open+0xa5/0x170 # ndo_open on vlandev
[ 1.214042] __dev_open+0x145/0x270
[ 1.214046] __dev_change_flags+0xb0/0x1e0
[ 1.214051] netif_change_flags+0x22/0x60 # IFF_UP vlandev
[ 1.214053] dev_change_flags+0x61/0xb0 # for each device in group from dev->vlan_info
[ 1.214055] vlan_device_event+0x766/0x7c0 # on netdevsim0
[ 1.214058] notifier_call_chain+0x78/0x120
[ 1.214062] netif_open+0x6d/0x90
[ 1.214064] dev_open+0x5b/0xb0 # locks netdevsim0
[ 1.214066] bond_enslave+0x64c/0x1230
[ 1.214075] do_set_master+0x175/0x1e0 # on netdevsim0
[ 1.214077] do_setlink+0x516/0x13b0
[ 1.214094] rtnl_newlink+0xaba/0xb80
[ 1.214132] rtnetlink_rcv_msg+0x440/0x490
[ 1.214144] netlink_rcv_skb+0xeb/0x120
[ 1.214150] netlink_unicast+0x1f9/0x320
[ 1.214153] netlink_sendmsg+0x346/0x3f0
[ 1.214157] __sock_sendmsg+0x86/0xb0
[ 1.214160] ____sys_sendmsg+0x1c8/0x220
[ 1.214164] ___sys_sendmsg+0x28f/0x2d0
[ 1.214179] __x64_sys_sendmsg+0xef/0x140
[ 1.214184] do_syscall_64+0xec/0x1d0
[ 1.214190] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 1.214191] RIP: 0033:0x7f2d1b4a7e56Device setup:
netdevsim0 (down)
^ ^
bond netdevsim1.100@netdevsim1 allmulticast=on (down)
When we enslave the lower device (netdevsim0) which has a vlan, we propagate vlan's allmuti/promisc flags during ndo_open. This causes (re)locking on of the real_dev.
Propagate allmulti/promisc on flags change, not on the open. There is a slight semantics change that vlans that are down now propagate the flags, but this seems unlikely to result in the real issues.
Reproducer:
echo 0 1 > /sys/bus/netdevsim/new_device
dev_path=$(ls -d /sys/bus/netdevsim/devices/netdevsim0/net/*) dev=$(echo $dev_path | rev | cut -d/ -f1 | rev)
ip link set dev $dev name netdevsim0
ip link set dev netdevsim0 up
ip link add link netdevsim0 name netdevsim0.100 type vlan id 100 ip link set dev netdevsim0.100 allmulticast on down ip link add name bond1 type bond mode 802.3ad
ip link set dev netdevsim0 down
ip link set dev netdevsim0 master bond1
ip link set dev bond1 up
ip link show
--- net/8021q/vlan_dev.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-)
net/8021q/vlan_dev.c +4 -27
@@ -272,17 +272,6 @@ static int vlan_dev_open(struct net_device *dev) goto out; } -if (dev->flags &IFF_ALLMULTI ) { - err =dev_set_allmulti (real_dev,1 ); -if (err <0 ) - goto del_unicast; - } -if (dev->flags &IFF_PROMISC ) { - err =dev_set_promiscuity (real_dev,1 ); -if (err <0 ) - goto clear_allmulti; - } -ether_addr_copy (vlan->real_dev_addr, real_dev->dev_addr);if (vlan->flags &VLAN_FLAG_GVRP )
@@ -296,12 +285,6 @@ static int vlan_dev_open(struct net_device *dev)netif_carrier_on (dev);return 0 ; -clear_allmulti: -if (dev->flags &IFF_ALLMULTI ) -dev_set_allmulti (real_dev,-1 ); -del_unicast: -if (!ether_addr_equal (dev->dev_addr, real_dev->dev_addr)) -dev_uc_del (real_dev, dev->dev_addr); out:netif_carrier_off (dev);return err;
@@ -314,10 +297,6 @@ static int vlan_dev_stop(struct net_device *dev)dev_mc_unsync (real_dev, dev);dev_uc_unsync (real_dev, dev); -if (dev->flags &IFF_ALLMULTI ) -dev_set_allmulti (real_dev,-1 ); -if (dev->flags &IFF_PROMISC ) -dev_set_promiscuity (real_dev,-1 );if (!ether_addr_equal (dev->dev_addr, real_dev->dev_addr))dev_uc_del (real_dev, dev->dev_addr);
@@ -474,12 +453,10 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change) {struct net_device *real_dev =vlan_dev_priv (dev)->real_dev; -if (dev->flags &IFF_UP ) { -if (change &IFF_ALLMULTI ) -dev_set_allmulti (real_dev, dev->flags &IFF_ALLMULTI ?1 :-1 ); -if (change &IFF_PROMISC ) -dev_set_promiscuity (real_dev, dev->flags &IFF_PROMISC ?1 :-1 ); - } +if (change &IFF_ALLMULTI ) +dev_set_allmulti (real_dev, dev->flags &IFF_ALLMULTI ?1 :-1 ); +if (change &IFF_PROMISC ) +dev_set_promiscuity (real_dev, dev->flags &IFF_PROMISC ?1 :-1 ); }static void vlan_dev_set_rx_mode (struct net_device *vlan_dev)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 50/291 tracing: fix return value in __ftrace_event_enable_disable for TRACE_REG_UNREGISTER
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriele Paoloni <[email protected]>
[ Upstream commit 0c588ac0ca6c22b774d9ad4a6594681fdfa57d9d ]
When __ftrace_event_enable_disable invokes the class callback to unregister the event, the return value is not reported up to the caller, hence leading to event unregister failures being silently ignored.
This patch assigns the ret variable to the invocation of the event unregister callback, so that its return value is stored and reported to the caller, and it raises a warning in case of error.
--- kernel/trace/trace_events.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/trace_events.c +3 -1
@@ -776,7 +776,9 @@ static int __ftrace_event_enable_disable(struct trace_event_file *file,clear_bit (EVENT_FILE_FL_RECORDED_TGID_BIT , &file->flags); } - call->class->reg (call,TRACE_REG_UNREGISTER , file); + ret = call->class->reg (call,TRACE_REG_UNREGISTER , file); + +WARN_ON_ONCE (ret); }/* If in SOFT_MODE, just set the SOFT_DISABLE_BIT, else clear it */ if (file->flags &EVENT_FILE_FL_SOFT_MODE )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 51/291 Bluetooth: hci_uart: fix race during initialization
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arseniy Krasnov <[email protected]>
[ Upstream commit 366ceff495f902182d42b6f41525c2474caf3f9a ]
'hci_register_dev()' calls power up function, which is executed by kworker - 'hci_power_on()'. This function does access to bluetooth chip using callbacks from 'hci_ldisc.c', for example 'hci_uart_send_frame()'. Now 'hci_uart_send_frame()' checks 'HCI_UART_PROTO_READY' bit set, and if not - it fails. Problem is that 'HCI_UART_PROTO_READY' is set after 'hci_register_dev()', and there is tiny chance that 'hci_power_on()' will be executed before setting this bit. In that case HCI init logic fails.
Patch moves setting of 'HCI_UART_PROTO_READY' before calling function 'hci_uart_register_dev()'.
--- drivers/bluetooth/hci_ldisc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_ldisc.c +2 -1
@@ -709,12 +709,13 @@ static int hci_uart_set_proto(struct hci_uart *hu, int id) hu->proto = p; +set_bit (HCI_UART_PROTO_READY , &hu->flags); + err =hci_uart_register_dev (hu);if (err) {return err; } -set_bit (HCI_UART_PROTO_READY , &hu->flags);return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 52/291 Bluetooth: qca: simplify WCN399x NVM loading
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 1cc41b5092e3aa511454ec882c525af311bee631 ]
The WCN399x code has two separate cases for loading the NVM data. In preparation to adding support for WCN3950, which also requires similar quirk, split the "variant" to be specified explicitly and merge two snprintfs into a single one.
--- drivers/bluetooth/btqca.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/bluetooth/btqca.c +6 -7
@@ -807,6 +807,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, const char *firmware_name) {struct qca_fw_config config = {}; +const char *variant ="" ;int err;u8 rom_ver =0 ;u32 soc_ver;
@@ -901,13 +902,11 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,case QCA_WCN3990 :case QCA_WCN3991 :case QCA_WCN3998 : -if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) { -snprintf (config.fwname,sizeof (config.fwname), -"qca/crnv%02xu.bin" , rom_ver); - }else { -snprintf (config.fwname,sizeof (config.fwname), -"qca/crnv%02x.bin" , rom_ver); - } +if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) + variant ="u" ; + +snprintf (config.fwname,sizeof (config.fwname), +"qca/crnv%02x%s.bin" , rom_ver, variant);break ;case QCA_WCN3988 : snprintf(config.fwname, sizeof(config.fwname),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 53/291 drm: allow encoder mode_set even when connectors change for crtc
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abhinav Kumar <[email protected]>
[ Upstream commit 7e182cb4f5567f53417b762ec0d679f0b6f0039d ]
In certain use-cases, a CRTC could switch between two encoders and because the mode being programmed on the CRTC remains the same during this switch, the CRTC's mode_changed remains false. In such cases, the encoder's mode_set also gets skipped.
Skipping mode_set on the encoder for such cases could cause an issue because even though the same CRTC mode was being used, the encoder type could have changed like the CRTC could have switched from a real time encoder to a writeback encoder OR vice-versa.
Allow encoder's mode_set to happen even when connectors changed on a CRTC and not just when the mode changed.
--- drivers/gpu/drm/drm_atomic_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +1 -1
@@ -1389,7 +1389,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) mode = &new_crtc_state->mode; adjusted_mode = &new_crtc_state->adjusted_mode; -if (!new_crtc_state->mode_changed) +if (!new_crtc_state->mode_changed && !new_crtc_state->connectors_changed)continue ; drm_dbg_atomic(dev, "modeset on [ENCODER:%d:%s]\n",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 54/291 drm/amd/display: Update Cursor request mode to the beginning prefetch always
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhikai Zhai <[email protected]>
[ Upstream commit 4a4077b4b63a8404efd6d37fc2926f03fb25bace ]
[Why]
The double buffer cursor registers is updated by the cursor vupdate event. There is a gap between vupdate and cursor data fetch if cursor fetch data reletive to cursor position. Cursor corruption will happen if we update the cursor surface in this gap.
[How]
Modify the cursor request mode to the beginning prefetch always and avoid wraparound calculation issues.
--- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 22 ++++++++----------- .../gpu/drm/amd/display/dc/dcn31/dcn31_hubp.c | 2 +- 2 files changed, 10 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +9 -13
@@ -1947,20 +1947,11 @@ static void delay_cursor_until_vupdate(struct dc *dc, struct pipe_ctx *pipe_ctx) dc->hwss.get_position (&pipe_ctx,1 , &position); vpos = position.vertical_count; -/* Avoid wraparound calculation issues */ - vupdate_start += stream->timing.v_total; - vupdate_end += stream->timing.v_total; - vpos += stream->timing.v_total; -if (vpos <= vupdate_start) {/* VPOS is in VACTIVE or back porch. */ lines_to_vupdate = vupdate_start - vpos; - }else if (vpos > vupdate_end) { -/* VPOS is in the front porch. */ -return ; }else { -/* VPOS is in VUPDATE. */ - lines_to_vupdate =0 ; + lines_to_vupdate = stream->timing.v_total - vpos + vupdate_start; }/* Calculate time until VUPDATE in microseconds. */
@@ -1968,13 +1959,18 @@ static void delay_cursor_until_vupdate(struct dc *dc, struct pipe_ctx *pipe_ctx) stream->timing.h_total *10000u / stream->timing.pix_clk_100hz; us_to_vupdate = lines_to_vupdate * us_per_line; +/* Stall out until the cursor update completes. */ +if (vupdate_end < vupdate_start) + vupdate_end += stream->timing.v_total; + +/* Position is in the range of vupdate start and end*/ +if (lines_to_vupdate > stream->timing.v_total - vupdate_end + vupdate_start) + us_to_vupdate =0 ; +/* 70 us is a conservative estimate of cursor update time*/ if (us_to_vupdate >70 )return ; -/* Stall out until the cursor update completes. */ -if (vupdate_end < vupdate_start) - vupdate_end += stream->timing.v_total; us_vupdate = (vupdate_end - vupdate_start +1 ) * us_per_line;udelay (us_to_vupdate + us_vupdate); }
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hubp.c +1 -1
@@ -44,7 +44,7 @@ void hubp31_set_unbounded_requesting(struct hubp *hubp, bool enable)struct dcn20_hubp *hubp2 =TO_DCN20_HUBP (hubp);REG_UPDATE (DCHUBP_CNTL ,HUBP_UNBOUNDED_REQ_MODE , enable); -REG_UPDATE (CURSOR_CONTROL ,CURSOR_REQ_MODE , enable); +REG_UPDATE (CURSOR_CONTROL ,CURSOR_REQ_MODE ,1 ); }void hubp31_soft_reset (struct hubp *hubp,bool reset)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 55/291 drm: panel-orientation-quirks: Add support for AYANEO 2S
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Wyatt <[email protected]>
[ Upstream commit eb8f1e3e8ee10cff591d4a47437dfd34d850d454 ]
AYANEO 2S uses the same panel and orientation as the AYANEO 2.
Update the AYANEO 2 DMI match to also match AYANEO 2S.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_panel_orientation_quirks.c +2 -2
@@ -184,10 +184,10 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T103HAF"), }, .driver_data = (void *)&lcd800x1280_rightside_up, - }, { /* AYA NEO AYANEO 2 */ + }, { /* AYA NEO AYANEO 2/2S */ .matches = {DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), - DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYANEO 2"), + DMI_MATCH(DMI_PRODUCT_NAME, "AYANEO 2"), }, .driver_data = (void *)&lcd1200x1920_rightside_up, }, { /* AYA NEO 2021 */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 56/291 drm: panel-orientation-quirks: Add quirks for AYA NEO Flip DS and KB
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Wyatt <[email protected]>
[ Upstream commit 529741c331da1fbf54f86c6ec3a4558b9b0b16dc ]
The AYA NEO Flip DS and KB both use a 1080x1920 portrait LCD panel. The Flip DS additionally uses a 640x960 portrait LCD panel as a second display.
Add DMI matches to correctly rotate these panels.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +18 -0
@@ -93,6 +93,12 @@ static const struct drm_dmi_panel_orientation_data onegx1_pro = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd640x960_leftside_up = { + .width =640 , + .height =960 , + .orientation =DRM_MODE_PANEL_ORIENTATION_LEFT_UP , +}; +static const struct drm_dmi_panel_orientation_data lcd720x1280_rightside_up = { .width =720 , .height =1280 ,
@@ -202,6 +208,18 @@ static const struct dmi_system_id orientation_data[] = { DMI_MATCH(DMI_PRODUCT_NAME, "AIR"), }, .driver_data = (void *)&lcd1080x1920_leftside_up, + }, { /* AYA NEO Flip DS Bottom Screen */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "FLIP DS"), + }, + .driver_data = (void *)&lcd640x960_leftside_up, + }, { /* AYA NEO Flip KB/DS Top Screen */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "FLIP"), + }, + .driver_data = (void *)&lcd1080x1920_leftside_up, }, { /* AYA NEO Founder */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYA NEO"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 57/291 drm: panel-orientation-quirks: Add quirk for AYA NEO Slide
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Wyatt <[email protected]>
[ Upstream commit 132c89ef8872e602cfb909377815111d121fe8d7 ]
The AYANEO Slide uses a 1080x1920 portrait LCD panel. This is the same panel used on the AYANEO Air Plus, but the DMI data is too different to match both with one entry.
Add a DMI match to correctly rotate the panel on the AYANEO Slide.
This also covers the Antec Core HS, which is a rebranded AYANEO Slide with the exact same hardware and DMI strings.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -244,6 +244,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_MATCH(DMI_BOARD_NAME, "KUN"), }, .driver_data = (void *)&lcd1600x2560_rightside_up, + }, { /* AYA NEO SLIDE */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "SLIDE"), + }, + .driver_data = (void *)&lcd1080x1920_leftside_up, }, { /* AYN Loki Max */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ayn"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 58/291 drm: panel-orientation-quirks: Add new quirk for GPD Win 2
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Wyatt <[email protected]>
[ Upstream commit a860eb9c6ba6cdbf32e3e01a606556e5a90a2931 ]
Some GPD Win 2 units shipped with the correct DMI strings.
Add a DMI match to correctly rotate the panel on these units.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -339,6 +339,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), }, .driver_data = (void *)&gpd_win2, + }, { /* GPD Win 2 (correct DMI strings) */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"GPD" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"WIN2" ) + }, + .driver_data = (void *)&lcd720x1280_rightside_up, }, { /* GPD Win 3 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "GPD"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 59/291 drm: panel-orientation-quirks: Add quirk for OneXPlayer Mini (Intel)
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Wyatt <[email protected]>
[ Upstream commit b24dcc183583fc360ae0f0899e286a68f46abbd0 ]
The Intel model of the OneXPlayer Mini uses a 1200x1920 portrait LCD panel. The DMI strings are the same as the OneXPlayer, which already has a DMI quirk, but the panel is different.
Add a DMI match to correctly rotate this panel.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +12 -0
@@ -129,6 +129,12 @@ static const struct drm_dmi_panel_orientation_data lcd1080x1920_rightside_up = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd1200x1920_leftside_up = { + .width =1200 , + .height =1920 , + .orientation =DRM_MODE_PANEL_ORIENTATION_LEFT_UP , +}; +static const struct drm_dmi_panel_orientation_data lcd1200x1920_rightside_up = { .width =1200 , .height =1920 ,
@@ -473,6 +479,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONE XPLAYER"), }, .driver_data = (void *)&lcd1600x2560_leftside_up, + }, { /* OneXPlayer Mini (Intel) */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"ONE-NETBOOK TECHNOLOGY CO., LTD." ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONE XPLAYER"), + }, + .driver_data = (void *)&lcd1200x1920_leftside_up, }, { /* OrangePi Neo */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "OrangePi"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 60/291 drm/bridge: panel: forbid initializing a panel with unknown connector type
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Ceresoli <[email protected]>
[ Upstream commit b296955b3a740ecc8b3b08e34fd64f1ceabb8fb4 ]
Having an DRM_MODE_CONNECTOR_Unknown connector type is considered bad, and drm_panel_bridge_add_typed() and derivatives are deprecated for this.
drm_panel_init() won't prevent initializing a panel with a DRM_MODE_CONNECTOR_Unknown connector type. Luckily there are no in-tree users doing it, so take this as an opportinuty to document a valid connector type must be passed.
Returning an error if this rule is violated is not possible because drm_panel_init() is a void function. Add at least a warning to make any violations noticeable, especially to non-upstream drivers.
--- drivers/gpu/drm/drm_panel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_panel.c +4 -1
@@ -49,7 +49,7 @@ static LIST_HEAD(panel_list);* @dev: parent device of the panel * @funcs: panel operations * @connector_type: the connector type (DRM_MODE_CONNECTOR_*) corresponding to -* the panel interface +* the panel interface (must NOT be DRM_MODE_CONNECTOR_Unknown) * * Initialize the panel structure for subsequent registration with * drm_panel_add().
@@ -57,6 +57,9 @@ static LIST_HEAD(panel_list);void drm_panel_init (struct drm_panel *panel,struct device *dev,const struct drm_panel_funcs *funcs,int connector_type) { +if (connector_type == DRM_MODE_CONNECTOR_Unknown) +DRM_WARN ("%s: %s: a valid connector type is required!\n" , __func__,dev_name (dev)); +INIT_LIST_HEAD (&panel->list); panel->dev = dev; panel->funcs = funcs;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 61/291 drivers: base: devres: Allow to release group on device release
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas De Marchi <[email protected]>
[ Upstream commit 8e1ddfada4530939a8cb64ee9251aef780474274 ]
When releasing a device, if the release action causes a group to be released, a warning is emitted because it can't find the group. This happens because devres_release_all() moves the entire list to a todo list and also move the group markers. Considering r* normal resource nodes and g1 a group resource node:
g1 -----------. v v r1 -> r2 -> g1[0] -> r3-> g[1] -> r4
After devres_release_all(), dev->devres_head becomes empty and the todo list it iterates on becomes:
g1 v r1 -> r2 -> r3-> r4 -> g1[0]
When a call to component_del() is made and takes down the aggregate device, a warning like this happen:
RIP: 0010:devres_release_group+0x362/0x530 ... Call Trace: <TASK> component_unbind+0x156/0x380 component_unbind_all+0x1d0/0x270 mei_component_master_unbind+0x28/0x80 [mei_hdcp] take_down_aggregate_device+0xc1/0x160 component_del+0x1c6/0x3e0 intel_hdcp_component_fini+0xf1/0x170 [xe] xe_display_fini+0x1e/0x40 [xe]
Because the devres group corresponding to the hdcp component cannot be found. Just ignore this corner case: if the dev->devres_head is empty and the caller is trying to remove a group, it's likely in the process of device cleanup so just ignore it instead of warning.
--- drivers/base/devres.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/base/devres.c +7 -0
@@ -684,6 +684,13 @@ int devres_release_group(struct device *dev, void *id)spin_unlock_irqrestore (&dev->devres_lock, flags);release_nodes (dev, &todo); + }else if (list_empty (&dev->devres_head)) { +/* +* dev is probably dying via devres_release_all(): groups +* have already been removed and are on the process of +* being released - don't touch and don't warn. +*/ +spin_unlock_irqrestore (&dev->devres_lock, flags); }else {WARN_ON (1 );spin_unlock_irqrestore (&dev->devres_lock, flags);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 62/291 drm/amdkfd: clamp queue size to minimum
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Yat Sin <[email protected]>
[ Upstream commit e90711946b53590371ecce32e8fcc381a99d6333 ]
If queue size is less than minimum, clamp it to minimum to prevent underflow when writing queue mqd.
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++++++++++ include/uapi/linux/kfd_ioctl.h | 2 ++ 2 files changed, 12 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +10 -0
@@ -208,6 +208,11 @@ static int set_queue_properties_from_user(struct queue_properties *q_properties,return -EINVAL ; } +if (args->ring_size <KFD_MIN_QUEUE_RING_SIZE ) { + args->ring_size =KFD_MIN_QUEUE_RING_SIZE ; +pr_debug ("Size lower. clamped to KFD_MIN_QUEUE_RING_SIZE" ); + } +if (!access_ok ((const void __user *) args->read_pointer_address,sizeof (uint32_t ))) {pr_err ("Can't access read pointer\n" );
@@ -464,6 +469,11 @@ static int kfd_ioctl_update_queue(struct file *filp, struct kfd_process *p,return -EINVAL ; } +if (args->ring_size <KFD_MIN_QUEUE_RING_SIZE ) { + args->ring_size =KFD_MIN_QUEUE_RING_SIZE ; +pr_debug ("Size lower. clamped to KFD_MIN_QUEUE_RING_SIZE" ); + } + properties.queue_address = args->ring_base_address; properties.queue_size = args->ring_size; properties.queue_percent = args->queue_percentage;
include/uapi/linux/kfd_ioctl.h +2 -0
@@ -55,6 +55,8 @@ struct kfd_ioctl_get_version_args {#define KFD_MAX_QUEUE_PERCENTAGE 100#define KFD_MAX_QUEUE_PRIORITY 15 +#define KFD_MIN_QUEUE_RING_SIZE 1024 +struct kfd_ioctl_create_queue_args {__u64 ring_base_address;/* to KFD */ __u64 write_pointer_address;/* from KFD */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 63/291 drm/amdkfd: Fix mode1 reset crash issue
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philip Yang <[email protected]>
[ Upstream commit f0b4440cdc1807bb6ec3dce0d6de81170803569b ]
If HW scheduler hangs and mode1 reset is used to recover GPU, KFD signal user space to abort the processes. After process abort exit, user queues still use the GPU to access system memory before h/w is reset while KFD cleanup worker free system memory and free VRAM.
There is use-after-free race bug that KFD allocate and reuse the freed system memory, and user queue write to the same system memory to corrupt the data structure and cause driver crash.
To fix this race, KFD cleanup worker terminate user queues, then flush reset_domain wq to wait for any GPU ongoing reset complete, and then free outstanding BOs.
--- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +17 -0
@@ -36,6 +36,7 @@#include <linux/pm_runtime.h> #include "amdgpu_amdkfd.h" #include "amdgpu.h" +#include "amdgpu_reset.h" struct mm_struct ;
@@ -1114,6 +1115,17 @@ static void kfd_process_remove_sysfs(struct kfd_process *p) p->kobj =NULL ; } +/* +* If any GPU is ongoing reset, wait for reset complete. +*/ +static void kfd_process_wait_gpu_reset_complete (struct kfd_process *p) +{ +int i; + +for (i =0 ; i < p->n_pdds; i++) +flush_workqueue (p->pdds[i]->dev->adev->reset_domain->wq); +} +/* No process locking is needed in this function, because the process * is not findable any more. We must assume that no other thread is * using it any more, otherwise we couldn't safely free the process
@@ -1127,6 +1139,11 @@ static void kfd_process_wq_release(struct work_struct *work)kfd_process_dequeue_from_all_devices (p);pqm_uninit (&p->pqm); +/* +* If GPU in reset, user queues may still running, wait for reset complete. +*/ +kfd_process_wait_gpu_reset_complete (p); +/* Signal the eviction fence after user mode queues are * destroyed. This allows any BOs to be freed without * triggering pointless evictions or waiting for fences.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 64/291 drm/amdkfd: Fix pqm_destroy_queue race with GPU reset
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philip Yang <[email protected]>
[ Upstream commit 7919b4cad5545ed93778f11881ceee72e4dbed66 ]
If GPU in reset, destroy_queue return -EIO, pqm_destroy_queue should delete the queue from process_queue_list and free the resource.
--- drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1 -1
@@ -429,7 +429,7 @@ int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid)pr_err ("Pasid 0x%x destroy queue %d failed, ret %d\n" , pqm->process->pasid, pqn->q->properties.queue_id, retval); -if (retval != -ETIME ) +if (retval != -ETIME && retval != -EIO ) goto err_destroy_queue; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 65/291 drm/mediatek: mtk_dpi: Move the input_2p_en bit to platform data
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit c90876a695dd83e76680b88b40067275a5982811 ]
In preparation for adding support for MT8195's HDMI reserved DPI instance, move the input_2p_en bit for DP_INTF to platform data.
While at it, remove the input_2pixel member from platform data as having this bit implies that the 2pixel feature must be enabled.
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/mediatek/mtk_dpi.c +7 -7
@@ -125,14 +125,14 @@ struct mtk_dpi_yc_limit {* @is_ck_de_pol: Support CK/DE polarity. * @swap_input_support: Support input swap function. * @support_direct_pin: IP supports direct connection to dpi panels. -* @input_2pixel: Input pixel of dp_intf is 2 pixel per round, so enable this -* config to enable this feature. * @dimension_mask: Mask used for HWIDTH, HPORCH, VSYNC_WIDTH and VSYNC_PORCH * (no shift). * @hvsize_mask: Mask of HSIZE and VSIZE mask (no shift). * @channel_swap_shift: Shift value of channel swap. * @yuv422_en_bit: Enable bit of yuv422. * @csc_enable_bit: Enable bit of CSC. +* @input_2p_en_bit: Enable bit for input two pixel per round feature. +* If present, implies that the feature must be enabled. * @pixels_per_iter: Quantity of transferred pixels per iteration. */ struct mtk_dpi_conf {
@@ -145,12 +145,12 @@ struct mtk_dpi_conf {bool is_ck_de_pol;bool swap_input_support;bool support_direct_pin; -bool input_2pixel;u32 dimension_mask;u32 hvsize_mask;u32 channel_swap_shift;u32 yuv422_en_bit;u32 csc_enable_bit; +u32 input_2p_en_bit;u32 pixels_per_iter; };
@@ -602,9 +602,9 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,mtk_dpi_dual_edge (dpi);mtk_dpi_config_disable_edge (dpi); } -if (dpi->conf->input_2pixel) { -mtk_dpi_mask (dpi,DPI_CON ,DPINTF_INPUT_2P_EN , -DPINTF_INPUT_2P_EN ); +if (dpi->conf->input_2p_en_bit) { +mtk_dpi_mask (dpi,DPI_CON , dpi->conf->input_2p_en_bit, + dpi->conf->input_2p_en_bit); }mtk_dpi_sw_reset (dpi, false);
@@ -952,12 +952,12 @@ static const struct mtk_dpi_conf mt8195_dpintf_conf = { .output_fmts = mt8195_output_fmts, .num_output_fmts = ARRAY_SIZE(mt8195_output_fmts), .pixels_per_iter = 4, - .input_2pixel = true, .dimension_mask = DPINTF_HPW_MASK, .hvsize_mask = DPINTF_HSIZE_MASK, .channel_swap_shift = DPINTF_CH_SWAP, .yuv422_en_bit = DPINTF_YUV422_EN, .csc_enable_bit = DPINTF_CSC_ENABLE, + .input_2p_en_bit = DPINTF_INPUT_2P_EN, };static int mtk_dpi_probe (struct platform_device *pdev)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 66/291 drm/mediatek: mtk_dpi: Explicitly manage TVD clock in power on/off
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 473c33f5ce651365468503c76f33158aaa1c7dd2 ]
In preparation for adding support for MT8195's HDMI reserved DPI, add calls to clk_prepare_enable() / clk_disable_unprepare() for the TVD clock: in this particular case, the aforementioned clock is not (and cannot be) parented to neither pixel or engine clocks hence it won't get enabled automatically by the clock framework.
Please note that on all of the currently supported MediaTek platforms, the TVD clock is always a parent of either pixel or engine clocks, and this means that the common clock framework is already enabling this clock before the children. On such platforms, this commit will only increase the refcount of the TVD clock without any functional change.
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/mediatek/mtk_dpi.c +9 -0
@@ -463,6 +463,7 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi)mtk_dpi_disable (dpi);clk_disable_unprepare (dpi->pixel_clk); +clk_disable_unprepare (dpi->tvd_clk);clk_disable_unprepare (dpi->engine_clk); }
@@ -479,6 +480,12 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi) goto err_refcount; } + ret =clk_prepare_enable (dpi->tvd_clk); +if (ret) { +dev_err (dpi->dev,"Failed to enable tvd pll: %d\n" , ret); + goto err_engine; + } + ret =clk_prepare_enable (dpi->pixel_clk);if (ret) {dev_err (dpi->dev,"Failed to enable pixel clock: %d\n" , ret);
@@ -488,6 +495,8 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi)return 0 ; err_pixel: +clk_disable_unprepare (dpi->tvd_clk); +err_engine:clk_disable_unprepare (dpi->engine_clk); err_refcount: dpi->refcount--;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 67/291 drm/amdgpu: handle amdgpu_cgs_create_device() errors in amd_powerplay_create()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 1435e895d4fc967d64e9f5bf81e992ac32f5ac76 ]
Add error handling to propagate amdgpu_cgs_create_device() failures to the caller. When amdgpu_cgs_create_device() fails, release hwmgr and return -ENOMEM to prevent null pointer dereference.
[v1]->[v2]: Change error code from -EINVAL to -ENOMEM. Free hwmgr.
--- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +5 -0
@@ -51,6 +51,11 @@ static int amd_powerplay_create(struct amdgpu_device *adev) hwmgr->adev = adev; hwmgr->not_vf = !amdgpu_sriov_vf (adev); hwmgr->device =amdgpu_cgs_create_device (adev); +if (!hwmgr->device) { +kfree (hwmgr); +return -ENOMEM ; + } +mutex_init (&hwmgr->msg_lock); hwmgr->chip_family = adev->family; hwmgr->chip_id = adev->asic_type;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 68/291 PCI: vmd: Make vmd_dev::cfg_lock a raw_spinlock_t type
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryo Takakura <[email protected]>
[ Upstream commit 18056a48669a040bef491e63b25896561ee14d90 ]
The access to the PCI config space via pci_ops::read and pci_ops::write is a low-level hardware access. The functions can be accessed with disabled interrupts even on PREEMPT_RT. The pci_lock is a raw_spinlock_t for this purpose.
A spinlock_t becomes a sleeping lock on PREEMPT_RT, so it cannot be acquired with disabled interrupts. The vmd_dev::cfg_lock is accessed in the same context as the pci_lock.
Make vmd_dev::cfg_lock a raw_spinlock_t type so it can be used with interrupts disabled.
This was reported as:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 Call Trace: rt_spin_lock+0x4e/0x130 vmd_pci_read+0x8d/0x100 [vmd] pci_user_read_config_byte+0x6f/0xe0 pci_read_config+0xfe/0x290 sysfs_kf_bin_read+0x68/0x90
[bhelgaas: add back report info from
https://lore.kernel.org/lkml/[email protected]/]
--- drivers/pci/controller/vmd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pci/controller/vmd.c +6 -6
@@ -110,7 +110,7 @@ struct vmd_irq_list {struct vmd_dev {struct pci_dev *dev; -spinlock_t cfg_lock; +raw_spinlock_t cfg_lock;void __iomem *cfgbar;int msix_count;
@@ -387,7 +387,7 @@ static int vmd_pci_read(struct pci_bus *bus, unsigned int devfn, int reg,if (!addr)return -EFAULT ; -spin_lock_irqsave (&vmd->cfg_lock, flags); +raw_spin_lock_irqsave (&vmd->cfg_lock, flags);switch (len) {case 1 : *value =readb (addr);
@@ -402,7 +402,7 @@ static int vmd_pci_read(struct pci_bus *bus, unsigned int devfn, int reg, ret = -EINVAL ;break ; } -spin_unlock_irqrestore (&vmd->cfg_lock, flags); +raw_spin_unlock_irqrestore (&vmd->cfg_lock, flags);return ret; }
@@ -422,7 +422,7 @@ static int vmd_pci_write(struct pci_bus *bus, unsigned int devfn, int reg,if (!addr)return -EFAULT ; -spin_lock_irqsave (&vmd->cfg_lock, flags); +raw_spin_lock_irqsave (&vmd->cfg_lock, flags);switch (len) {case 1 :writeb (value, addr);
@@ -440,7 +440,7 @@ static int vmd_pci_write(struct pci_bus *bus, unsigned int devfn, int reg, ret = -EINVAL ;break ; } -spin_unlock_irqrestore (&vmd->cfg_lock, flags); +raw_spin_unlock_irqrestore (&vmd->cfg_lock, flags);return ret; }
@@ -958,7 +958,7 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)if (features &VMD_FEAT_OFFSET_FIRST_VECTOR ) vmd->first_vec =1 ; -spin_lock_init (&vmd->cfg_lock); +raw_spin_lock_init (&vmd->cfg_lock);pci_set_drvdata (dev, vmd); err =vmd_enable_domain (vmd, features);if (err)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 69/291 drm/amdgpu: grab an additional reference on the gang fence v2
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
[ Upstream commit 0d9a95099dcb05b5f4719c830d15bf4fdcad0dc2 ]
We keep the gang submission fence around in adev, make sure that it stays alive.
v2: fix memory leak on retry
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -1
@@ -6186,6 +6186,7 @@ struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev, {struct dma_fence *old =NULL ; +dma_fence_get (gang); do { dma_fence_put(old); rcu_read_lock();
@@ -6195,12 +6196,19 @@ struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev,if (old == gang)break ; -if (!dma_fence_is_signaled (old)) +if (!dma_fence_is_signaled (old)) { +dma_fence_put (gang);return old; + } }while (cmpxchg ((struct dma_fence __force **)&adev->gang_submit, old, gang) != old); +/* +* Drop it once for the exchanged reference in adev and once for the +* thread local reference acquired in amdgpu_device_get_gang(). +*/ +dma_fence_put (old);dma_fence_put (old);return NULL ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 70/291 fbdev: omapfb: Add plane value check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leonid Arapov <[email protected]>
[ Upstream commit 3e411827f31db7f938a30a3c7a7599839401ec30 ]
Function dispc_ovl_setup is not intended to work with the value OMAP_DSS_WB of the enum parameter plane.
The value of this parameter is initialized in dss_init_overlays and in the current state of the code it cannot take this value so it's not a real problem.
For the purposes of defensive coding it wouldn't be superfluous to check the parameter value, because some functions down the call stack process this value correctly and some not.
For example, in dispc_ovl_setup_global_alpha it may lead to buffer overflow.
Add check for this value.
Found by Linux Verification Center (linuxtesting.org) with SVACE static analysis tool.
--- drivers/video/fbdev/omap2/omapfb/dss/dispc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/video/fbdev/omap2/omapfb/dss/dispc.c +5 -1
@@ -2749,9 +2749,13 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, bool mem_to_mem) {int r; -enum omap_overlay_caps caps =dss_feat_get_overlay_caps (plane); +enum omap_overlay_caps caps;enum omap_channel channel; +if (plane ==OMAP_DSS_WB ) +return -EINVAL ; + + caps =dss_feat_get_overlay_caps (plane); channel =dispc_ovl_get_channel_out (plane); DSSDBG("dispc_ovl_setup %d, pa %pad, pa_uv %pad, sw %d, %d,%d, %dx%d ->"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 71/291 ktest: Fix Test Failures Due to Missing LOG_FILE Directories
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ayush Jain <[email protected]>
[ Upstream commit 5a1bed232781d356f842576daacc260f0d0c8d2e ]
Handle missing parent directories for LOG_FILE path to prevent test failures. If the parent directories don't exist, create them to ensure the tests proceed successfully.
--- tools/testing/ktest/ktest.pl | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/testing/ktest/ktest.pl +8 -0
@@ -4282,6 +4282,14 @@ if (defined($opt{"LOG_FILE"})) { if ($opt{"CLEAR_LOG"}) { unlink $opt{"LOG_FILE"}; } + + if (! -e $opt{"LOG_FILE"} && $opt{"LOG_FILE"} =~ m,^(.*/),) { + my $dir = $1; + if (! -d $dir) { + mkpath($dir) or die "Failed to create directories '$dir': $!"; + print "\nThe log directory $dir did not exist, so it was created.\n"; + } + } open(LOG, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}"; LOG->autoflush(1); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 72/291 tpm, tpm_tis: Workaround failed command reception on Infineon devices
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan McDowell <[email protected]>
[ Upstream commit de9e33df7762abbfc2a1568291f2c3a3154c6a9d ]
Some Infineon devices have a issue where the status register will get stuck with a quick REQUEST_USE / COMMAND_READY sequence. This is not simply a matter of requiring a longer timeout; the work around is to retry the command submission. Add appropriate logic to do this in the send path.
This is fixed in later firmware revisions, but those are not always available, and cannot generally be easily updated from outside a firmware environment.
Testing has been performed with a simple repeated loop of doing a TPM2_CC_GET_CAPABILITY for TPM_CAP_PROP_MANUFACTURER using the Go code at:
https://the.earth.li/~noodles/tpm-stuff/timeout-reproducer-simple.go
It can take several hours to reproduce, and several million operations.
--- drivers/char/tpm/tpm_tis_core.c | 17 ++++++++++++++--- drivers/char/tpm/tpm_tis_core.h | 1 + include/linux/tpm.h | 1 + 3 files changed, 16 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm_tis_core.c +14 -3
@@ -433,7 +433,10 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)if (wait_for_tpm_stat (chip,TPM_STS_VALID , chip->timeout_c, &priv->int_queue, false) <0 ) { - rc = -ETIME ; +if (test_bit (TPM_TIS_STATUS_VALID_RETRY , &priv->flags)) + rc = -EAGAIN ; +else + rc = -ETIME ; goto out_err; } status =tpm_tis_status (chip);
@@ -450,7 +453,10 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)if (wait_for_tpm_stat (chip,TPM_STS_VALID , chip->timeout_c, &priv->int_queue, false) <0 ) { - rc = -ETIME ; +if (test_bit (TPM_TIS_STATUS_VALID_RETRY , &priv->flags)) + rc = -EAGAIN ; +else + rc = -ETIME ; goto out_err; } status =tpm_tis_status (chip);
@@ -505,9 +511,11 @@ static int tpm_tis_send_main(struct tpm_chip *chip, const u8 *buf, size_t len)if (rc >=0 )/* Data transfer done successfully */ break ; -else if (rc != -EIO ) +else if (rc != -EAGAIN && rc != -EIO )/* Data transfer failed, not recoverable */ return rc; + +usleep_range (priv->timeout_min, priv->timeout_max); } rc =tpm_tis_verify_crc (priv, len, buf);
@@ -1044,6 +1052,9 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, priv->timeout_max =TIS_TIMEOUT_MAX_ATML ; } +if (priv->manufacturer_id ==TPM_VID_IFX ) +set_bit (TPM_TIS_STATUS_VALID_RETRY , &priv->flags); +if (is_bsw ()) { priv->ilb_base_addr =ioremap (INTEL_LEGACY_BLK_BASE_ADDR ,ILB_REMAP_SIZE );
drivers/char/tpm/tpm_tis_core.h +1 -0
@@ -88,6 +88,7 @@ enum tpm_tis_flags {TPM_TIS_INVALID_STATUS =1 ,TPM_TIS_DEFAULT_CANCELLATION =2 ,TPM_TIS_IRQ_TESTED =3 , + TPM_TIS_STATUS_VALID_RETRY = 4, }; struct tpm_tis_data {
include/linux/tpm.h +1 -0
@@ -271,6 +271,7 @@ enum tpm2_cc_attrs {#define TPM_VID_WINBOND 0x1050#define TPM_VID_STM 0x104A#define TPM_VID_ATML 0x1114 +#define TPM_VID_IFX 0x15D1enum tpm_chip_flags {TPM_CHIP_FLAG_BOOTSTRAPPED =BIT (0 ),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 73/291 pwm: mediatek: Prevent divide-by-zero in pwm_mediatek_config()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 7ca59947b5fcf94e7ea4029d1bd0f7c41500a161 ]
With CONFIG_COMPILE_TEST && !CONFIG_HAVE_CLK, pwm_mediatek_config() has a divide-by-zero in the following line:
do_div(resolution, clk_get_rate(pc->clk_pwms[pwm->hwpwm]));
due to the fact that the !CONFIG_HAVE_CLK version of clk_get_rate() returns zero.
This is presumably just a theoretical problem: COMPILE_TEST overrides the dependency on RALINK which would select COMMON_CLK. Regardless it's a good idea to check for the error explicitly to avoid divide-by-zero.
Fixes the following warning:
drivers/pwm/pwm-mediatek.o: warning: objtool: .text: unexpected end of section
--- drivers/pwm/pwm-mediatek.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/pwm/pwm-mediatek.c +6 -2
@@ -120,21 +120,25 @@ static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm,struct pwm_mediatek_chip *pc =to_pwm_mediatek_chip (chip);u32 clkdiv =0 , cnt_period, cnt_duty, reg_width =PWMDWIDTH , reg_thres =PWMTHRES ; +unsigned long clk_rate;u64 resolution;int ret; ret =pwm_mediatek_clk_enable (chip, pwm); -if (ret <0 )return ret; + clk_rate =clk_get_rate (pc->clk_pwms[pwm->hwpwm]); +if (!clk_rate) +return -EINVAL ; +/* Make sure we use the bus clock and not the 26MHz clock */ if (pc->soc->has_ck_26m_sel)writel (0 , pc->regs +PWM_CK_26M_SEL );/* Using resolution in picosecond gets accuracy higher */ resolution = (u64 )NSEC_PER_SEC *1000 ; -do_div (resolution,clk_get_rate (pc->clk_pwms[pwm->hwpwm])); +do_div (resolution, clk_rate); cnt_period =DIV_ROUND_CLOSEST_ULL ((u64 )period_ns *1000 , resolution);while (cnt_period >8191 ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 74/291 pwm: rcar: Improve register calculation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit e7327c193014a4d8666e9c1cda09cf2c060518e8 ]
There were several issues in the function rcar_pwm_set_counter():
- The u64 values period_ns and duty_ns were cast to int on function call which might loose bits on 32 bit architectures.
Fix: Make parameters to rcar_pwm_set_counter() u64
- The algorithm divided by the result of a division which looses precision.
Fix: Make use of mul_u64_u64_div_u64()
- The calculated values were just masked to fit the respective register fields which again might loose bits.
Fix: Explicitly check for overlow
Implement the respective fixes.
A side effect of fixing the 2nd issue is that there is no division by 0 if clk_get_rate() returns 0.
[ukleinek: Added an explicit #include <linux/bitfield.h> to please the 0day build bot]
--- drivers/pwm/pwm-rcar.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/pwm/pwm-rcar.c +13 -11
@@ -8,6 +8,7 @@* - The hardware cannot generate a 0% duty cycle. */ +#include <linux/bitfield.h> #include <linux/clk.h> #include <linux/err.h> #include <linux/io.h>
@@ -103,23 +104,24 @@ static void rcar_pwm_set_clock_control(struct rcar_pwm_chip *rp,rcar_pwm_write (rp, value,RCAR_PWMCR ); } -static int rcar_pwm_set_counter (struct rcar_pwm_chip *rp,int div,int duty_ns, -int period_ns) +static int rcar_pwm_set_counter (struct rcar_pwm_chip *rp,int div,u64 duty_ns, +u64 period_ns) { -unsigned long long one_cycle, tmp;/* 0.01 nanoseconds */ +unsigned long long tmp;unsigned long clk_rate =clk_get_rate (rp->clk);u32 cyc, ph; - one_cycle =NSEC_PER_SEC *100ULL << div; -do_div (one_cycle, clk_rate); +/* div <= 24 == RCAR_PWM_MAX_DIVISION, so the shift doesn't overflow. */ + tmp =mul_u64_u64_div_u64 (period_ns, clk_rate, (u64 )NSEC_PER_SEC << div); +if (tmp >FIELD_MAX (RCAR_PWMCNT_CYC0_MASK )) + tmp =FIELD_MAX (RCAR_PWMCNT_CYC0_MASK ); - tmp = period_ns *100ULL ; -do_div (tmp, one_cycle); - cyc = (tmp <<RCAR_PWMCNT_CYC0_SHIFT ) &RCAR_PWMCNT_CYC0_MASK ; + cyc =FIELD_PREP (RCAR_PWMCNT_CYC0_MASK , tmp); - tmp = duty_ns *100ULL ; -do_div (tmp, one_cycle); - ph = tmp &RCAR_PWMCNT_PH0_MASK ; + tmp =mul_u64_u64_div_u64 (duty_ns, clk_rate, (u64 )NSEC_PER_SEC << div); +if (tmp >FIELD_MAX (RCAR_PWMCNT_PH0_MASK )) + tmp =FIELD_MAX (RCAR_PWMCNT_PH0_MASK ); + ph =FIELD_PREP (RCAR_PWMCNT_PH0_MASK , tmp);/* Avoid prohibited setting */ if (cyc ==0 || ph ==0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 75/291 pwm: fsl-ftm: Handle clk_get_rate() returning 0
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 928446a5302eee30ebb32075c0db5dda5a138fb7 ]
Considering that the driver doesn't enable the used clocks (and also that clk_get_rate() returns 0 if CONFIG_HAVE_CLK is unset) better check the return value of clk_get_rate() for being non-zero before dividing by it.
--- drivers/pwm/pwm-fsl-ftm.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/pwm/pwm-fsl-ftm.c +6 -0
@@ -123,6 +123,9 @@ static unsigned int fsl_pwm_ticks_to_ns(struct fsl_pwm_chip *fpc,unsigned long long exval; rate =clk_get_rate (fpc->clk[fpc->period.clk_select]); +if (rate >> fpc->period.clk_ps ==0 ) +return 0 ; + exval = ticks; exval *=1000000000UL ;do_div (exval, rate >> fpc->period.clk_ps);
@@ -195,6 +198,9 @@ static unsigned int fsl_pwm_calculate_duty(struct fsl_pwm_chip *fpc,unsigned int period = fpc->period.mod_period +1 ;unsigned int period_ns =fsl_pwm_ticks_to_ns (fpc, period); +if (!period_ns) +return 0 ; + duty = (unsigned long long )duty_ns * period;do_div (duty, period_ns);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 76/291 bpf: support SKF_NET_OFF and SKF_LL_OFF on skb frags
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
[ Upstream commit d4bac0288a2b444e468e6df9cb4ed69479ddf14a ]
Classic BPF socket filters with SKB_NET_OFF and SKB_LL_OFF fail to read when these offsets extend into frags.
This has been observed with iwlwifi and reproduced with tun with IFF_NAPI_FRAGS. The below straightforward socket filter on UDP port, applied to a RAW socket, will silently miss matching packets.
const int offset_proto = offsetof(struct ip6_hdr, ip6_nxt);
const int offset_dport = sizeof(struct ip6_hdr) + offsetof(struct udphdr, dest);
struct sock_filter filter_code[] = {
BPF_STMT(BPF_LD + BPF_B + BPF_ABS, SKF_AD_OFF + SKF_AD_PKTTYPE),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, PACKET_HOST, 0, 4),
BPF_STMT(BPF_LD + BPF_B + BPF_ABS, SKF_NET_OFF + offset_proto),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 2),
BPF_STMT(BPF_LD + BPF_H + BPF_ABS, SKF_NET_OFF + offset_dport),This is unexpected behavior. Socket filter programs should be consistent regardless of environment. Silent misses are particularly concerning as hard to detect.
Use skb_copy_bits for offsets outside linear, same as done for non-SKF_(LL|NET) offsets.
Offset is always positive after subtracting the reference threshold SKB_(LL|NET)_OFF, so is always >= skb_(mac|network)_offset. The sum of the two is an offset against skb->data, and may be negative, but it cannot point before skb->head, as skb_(mac|network)_offset would too.
This appears to go back to when frag support was introduced to sk_run_filter in linux-2.4.4, before the introduction of git.
The amount of code change and 8/16/32 bit duplication are unfortunate. But any attempt I made to be smarter saved very few LoC while complicating the code.
--- net/core/filter.c | 80 ++++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 36 deletions(-)
net/core/filter.c +44 -36
@@ -212,24 +212,36 @@ BPF_CALL_3(bpf_skb_get_nlattr_nest, struct sk_buff *, skb, u32, a, u32, x)return 0 ; } +static int bpf_skb_load_helper_convert_offset (const struct sk_buff *skb,int offset) +{ +if (likely (offset >=0 )) +return offset; + +if (offset >=SKF_NET_OFF ) +return offset -SKF_NET_OFF +skb_network_offset (skb); + +if (offset >=SKF_LL_OFF &&skb_mac_header_was_set (skb)) +return offset -SKF_LL_OFF +skb_mac_offset (skb); + +return INT_MIN ; +} + BPF_CALL_4(bpf_skb_load_helper_8, const struct sk_buff *, skb, const void *, data, int, headlen, int, offset) { -u8 tmp, *ptr; +u8 tmp;const int len =sizeof (tmp); -if (offset >=0 ) { -if (headlen - offset >= len) -return *(u8 *)(data + offset); -if (!skb_copy_bits (skb, offset, &tmp,sizeof (tmp))) -return tmp; - }else { - ptr =bpf_internal_load_pointer_neg_helper (skb, offset, len); -if (likely (ptr)) -return *(u8 *)ptr; - } + offset =bpf_skb_load_helper_convert_offset (skb, offset); +if (offset ==INT_MIN ) +return -EFAULT ; -return -EFAULT ; +if (headlen - offset >= len) +return *(u8 *)(data + offset); +if (!skb_copy_bits (skb, offset, &tmp,sizeof (tmp))) +return tmp; +else +return -EFAULT ; } BPF_CALL_2(bpf_skb_load_helper_8_no_cache, const struct sk_buff *, skb,
@@ -242,21 +254,19 @@ BPF_CALL_2(bpf_skb_load_helper_8_no_cache, const struct sk_buff *, skb, BPF_CALL_4(bpf_skb_load_helper_16, const struct sk_buff *, skb, const void *, data, int, headlen, int, offset) { -__be16 tmp, *ptr; +__be16 tmp;const int len =sizeof (tmp); -if (offset >=0 ) { -if (headlen - offset >= len) -return get_unaligned_be16 (data + offset); -if (!skb_copy_bits (skb, offset, &tmp,sizeof (tmp))) -return be16_to_cpu (tmp); - }else { - ptr =bpf_internal_load_pointer_neg_helper (skb, offset, len); -if (likely (ptr)) -return get_unaligned_be16 (ptr); - } + offset =bpf_skb_load_helper_convert_offset (skb, offset); +if (offset ==INT_MIN ) +return -EFAULT ; -return -EFAULT ; +if (headlen - offset >= len) +return get_unaligned_be16 (data + offset); +if (!skb_copy_bits (skb, offset, &tmp,sizeof (tmp))) +return be16_to_cpu (tmp); +else +return -EFAULT ; } BPF_CALL_2(bpf_skb_load_helper_16_no_cache, const struct sk_buff *, skb,
@@ -269,21 +279,19 @@ BPF_CALL_2(bpf_skb_load_helper_16_no_cache, const struct sk_buff *, skb, BPF_CALL_4(bpf_skb_load_helper_32, const struct sk_buff *, skb, const void *, data, int, headlen, int, offset) { -__be32 tmp, *ptr; +__be32 tmp;const int len =sizeof (tmp); -if (likely (offset >=0 )) { -if (headlen - offset >= len) -return get_unaligned_be32 (data + offset); -if (!skb_copy_bits (skb, offset, &tmp,sizeof (tmp))) -return be32_to_cpu (tmp); - }else { - ptr =bpf_internal_load_pointer_neg_helper (skb, offset, len); -if (likely (ptr)) -return get_unaligned_be32 (ptr); - } + offset =bpf_skb_load_helper_convert_offset (skb, offset); +if (offset ==INT_MIN ) +return -EFAULT ; -return -EFAULT ; +if (headlen - offset >= len) +return get_unaligned_be32 (data + offset); +if (!skb_copy_bits (skb, offset, &tmp,sizeof (tmp))) +return be32_to_cpu (tmp); +else +return -EFAULT ; } BPF_CALL_2(bpf_skb_load_helper_32_no_cache, const struct sk_buff *, skb,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 77/291 ext4: dont treat fhandle lookup of ea_inode as FS corruption
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
[ Upstream commit 642335f3ea2b3fd6dba03e57e01fa9587843a497 ]
A file handle that userspace provides to open_by_handle_at() can legitimately contain an outdated inode number that has since been reused for another purpose - that's why the file handle also contains a generation number.
But if the inode number has been reused for an ea_inode, check_igot_inode() will notice, __ext4_iget() will go through ext4_error_inode(), and if the inode was newly created, it will also be marked as bad by iget_failed(). This all happens before the point where the inode generation is checked.
ext4_error_inode() is supposed to only be used on filesystem corruption; it should not be used when userspace just got unlucky with a stale file handle. So when this happens, let __ext4_iget() just return an error.
--- fs/ext4/inode.c | 68 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 20 deletions(-)
fs/ext4/inode.c +48 -20
@@ -4776,22 +4776,43 @@ static inline void ext4_inode_set_iversion_queried(struct inode *inode, u64 val)inode_set_iversion_queried (inode, val); } -static const char *check_igot_inode (struct inode *inode,ext4_iget_flags flags) - +static int check_igot_inode (struct inode *inode,ext4_iget_flags flags, +const char *function,unsigned int line) { +const char *err_str; +if (flags &EXT4_IGET_EA_INODE ) { -if (!(EXT4_I (inode)->i_flags &EXT4_EA_INODE_FL )) -return "missing EA_INODE flag" ; +if (!(EXT4_I (inode)->i_flags &EXT4_EA_INODE_FL )) { + err_str ="missing EA_INODE flag" ; + goto error; + }if (ext4_test_inode_state (inode,EXT4_STATE_XATTR ) || -EXT4_I (inode)->i_file_acl) -return "ea_inode with extended attributes" ; +EXT4_I (inode)->i_file_acl) { + err_str ="ea_inode with extended attributes" ; + goto error; + } }else { -if ((EXT4_I (inode)->i_flags &EXT4_EA_INODE_FL )) -return "unexpected EA_INODE flag" ; +if ((EXT4_I (inode)->i_flags &EXT4_EA_INODE_FL )) { +/* +* open_by_handle_at() could provide an old inode number +* that has since been reused for an ea_inode; this does +* not indicate filesystem corruption +*/ +if (flags &EXT4_IGET_HANDLE ) +return -ESTALE ; + err_str ="unexpected EA_INODE flag" ; + goto error; + } + } +if (is_bad_inode (inode) && !(flags &EXT4_IGET_BAD )) { + err_str ="unexpected bad inode w/o EXT4_IGET_BAD" ; + goto error; } -if (is_bad_inode (inode) && !(flags &EXT4_IGET_BAD )) -return "unexpected bad inode w/o EXT4_IGET_BAD" ; -return NULL ; +return 0 ; + +error: +ext4_error_inode (inode, function, line,0 , err_str); +return -EFSCORRUPTED ; } struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
@@ -4803,7 +4824,6 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,struct ext4_inode_info *ei;struct ext4_super_block *es =EXT4_SB (sb)->s_es;struct inode *inode; -const char *err_str;journal_t *journal =EXT4_SB (sb)->s_journal;long ret;loff_t size;
@@ -4832,10 +4852,10 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,if (!inode)return ERR_PTR (-ENOMEM );if (!(inode->i_state &I_NEW )) { -if ((err_str =check_igot_inode (inode, flags)) !=NULL ) { -ext4_error_inode (inode, function, line,0 , err_str); + ret =check_igot_inode (inode, flags, function, line); +if (ret) {iput (inode); -return ERR_PTR (-EFSCORRUPTED ); +return ERR_PTR (ret); }return inode; }
@@ -5107,13 +5127,21 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, ret = -EFSCORRUPTED ; goto bad_inode; } -if ((err_str =check_igot_inode (inode, flags)) !=NULL ) { -ext4_error_inode (inode, function, line,0 , err_str); - ret = -EFSCORRUPTED ; - goto bad_inode; + ret =check_igot_inode (inode, flags, function, line); +/* +* -ESTALE here means there is nothing inherently wrong with the inode, +* it's just not an inode we can return for an fhandle lookup. +*/ +if (ret == -ESTALE ) { +brelse (iloc.bh); +unlock_new_inode (inode); +iput (inode); +return ERR_PTR (-ESTALE ); } - +if (ret) + goto bad_inode;brelse (iloc.bh); +unlock_new_inode (inode);return inode;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 78/291 media: i2c: adv748x: Fix test pattern selection mask
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Söderlund <[email protected]>
commit 9e38acacb9d809b97a0bdc5c76e725355a47158a upstream.
The mask to select the test-pattern in register ADV748X_SDP_FRP is incorrect, it's the lower 3 bits which controls the pattern. The GENMASK() macro is used incorrectly and the generated mask is 0x0e instead of 0x07.
The result is that not all test patterns are selectable, and that in some cases the wrong test pattern is activated. Fix this by correcting the GENMASK().
--- drivers/media/i2c/adv748x/adv748x.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/adv748x/adv748x.h +1 -1
@@ -322,7 +322,7 @@ struct adv748x_state {/* Free run pattern select */ #define ADV748X_SDP_FRP 0x14 -#define ADV748X_SDP_FRP_MASK GENMASK(3, 1) +#define ADV748X_SDP_FRP_MASK GENMASK(2, 0)/* Saturation */ #define ADV748X_SDP_SD_SAT_U 0xe3/* user_map_rw_reg_e3 */
Greg Kroah-Hartman
maintainerPATCH 79/291 media: venus: hfi: add a check to handle OOB in sfr region
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vikash Garodia <[email protected]>
commit f4b211714bcc70effa60c34d9fa613d182e3ef1e upstream.
sfr->buf_size is in shared memory and can be modified by malicious user. OOB write is possible when the size is made higher than actual sfr data buffer. Cap the size to allocated size for such cases.
--- drivers/media/platform/qcom/venus/hfi_venus.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/venus/hfi_venus.c +10 -2
@@ -1053,18 +1053,26 @@ static void venus_sfr_print(struct venus {struct device *dev = hdev->core->dev;struct hfi_sfr *sfr = hdev->sfr.kva; +u32 size;void *p;if (!sfr)return ; - p =memchr (sfr->data,'\0' , sfr->buf_size); + size = sfr->buf_size; +if (!size) +return ; + +if (size >ALIGNED_SFR_SIZE ) + size =ALIGNED_SFR_SIZE ; + + p =memchr (sfr->data,'\0' , size);/* * SFR isn't guaranteed to be NULL terminated since SYS_ERROR indicates * that Venus is in the process of crashing. */ if (!p) - sfr->data[sfr->buf_size -1 ] ='\0' ; + sfr->data[size -1 ] ='\0' ;dev_err_ratelimited (dev,"SFR message from FW: %s\n" , sfr->data); }
Greg Kroah-Hartman
maintainerPATCH 80/291 media: venus: hfi: add check to handle incorrect queue size
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vikash Garodia <[email protected]>
commit 69baf245b23e20efda0079238b27fc63ecf13de1 upstream.
qsize represents size of shared queued between driver and video firmware. Firmware can modify this value to an invalid large value. In such situation, empty_space will be bigger than the space actually available. Since new_wr_idx is not checked, so the following code will result in an OOB write.
...
qsize = qhdr->q_size
if (wr_idx >= rd_idx)
empty_space = qsize - (wr_idx - rd_idx)
....
if (new_wr_idx < qsize) {
memcpy(wr_ptr, packet, dwords << 2) --> OOB write
Add check to ensure qsize is within the allocated size while reading and writing packets into the queue.
--- drivers/media/platform/qcom/venus/hfi_venus.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/platform/qcom/venus/hfi_venus.c +6 -0
@@ -187,6 +187,9 @@ static int venus_write_queue(struct venu/* ensure rd/wr indices's are read from memory */ rmb (); +if (qsize >IFACEQ_QUEUE_SIZE /4 ) +return -EINVAL ; +if (wr_idx >= rd_idx) empty_space = qsize - (wr_idx - rd_idx);else
@@ -255,6 +258,9 @@ static int venus_read_queue(struct venus wr_idx = qhdr->write_idx; qsize = qhdr->q_size; +if (qsize >IFACEQ_QUEUE_SIZE /4 ) +return -EINVAL ; +/* make sure data is valid before using it */ rmb ();
Greg Kroah-Hartman
maintainerPATCH 81/291 media: vim2m: print device name after registering device
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Majewski <[email protected]>
commit 143d75583f2427f3a97dba62413c4f0604867ebf upstream.
Move the v4l2_info() call displaying the video device name after the device is actually registered.
This fixes a bug where the driver was always displaying "/dev/video0" since it was reading from the vfd before it was registered.
--- drivers/media/test-drivers/vim2m.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/test-drivers/vim2m.c +3 -3
@@ -1316,9 +1316,6 @@ static int vim2m_probe(struct platform_d vfd->v4l2_dev = &dev->v4l2_dev;video_set_drvdata (vfd, dev); -v4l2_info (&dev->v4l2_dev, -"Device registered as /dev/video%d\n" , vfd->num); -platform_set_drvdata (pdev, dev); dev->m2m_dev =v4l2_m2m_init (&m2m_ops);
@@ -1345,6 +1342,9 @@ static int vim2m_probe(struct platform_d goto error_m2m; } +v4l2_info (&dev->v4l2_dev, +"Device registered as /dev/video%d\n" , vfd->num); +#ifdef CONFIG_MEDIA_CONTROLLER ret =v4l2_m2m_register_media_controller (dev->m2m_dev, vfd,MEDIA_ENT_F_PROC_VIDEO_SCALER );
Greg Kroah-Hartman
maintainerPATCH 82/291 media: siano: Fix error handling in smsdvb_module_init()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Can <[email protected]>
commit 734ac57e47b3bdd140a1119e2c4e8e6f8ef8b33d upstream.
The smsdvb_module_init() returns without checking the retval from smscore_register_hotplug().
If the smscore_register_hotplug() failed, the module failed to install, leaving the smsdvb_debugfs not unregistered.
--- drivers/media/common/siano/smsdvb-main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/common/siano/smsdvb-main.c +2 -0
@@ -1243,6 +1243,8 @@ static int __init smsdvb_module_init(voismsdvb_debugfs_register (); rc =smscore_register_hotplug (smsdvb_hotplug); +if (rc) +smsdvb_debugfs_unregister ();pr_debug ("\n" );
Greg Kroah-Hartman
maintainerPATCH 83/291 xenfs/xensyms: respect hypervisors "next" indication
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Beulich <[email protected]>
commit 5c4e79e29a9fe4ea132118ac40c2bc97cfe23077 upstream.
The interface specifies the symnum field as an input and output; the hypervisor sets it to the next sequential symbol's index. xensyms_next() incrementing the position explicitly (and xensyms_next_sym() decrementing it to "rewind") is only correct as long as the sequence of symbol indexes is non-sparse. Use the hypervisor-supplied value instead to update the position in xensyms_next(), and use the saved incoming index in xensyms_next_sym().
Message-ID: <[email protected]>
--- drivers/xen/xenfs/xensyms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/xen/xenfs/xensyms.c +2 -2
@@ -48,7 +48,7 @@ static int xensyms_next_sym(struct xensyreturn -ENOMEM ;set_xen_guest_handle (symdata->name, xs->name); - symdata->symnum--;/* Rewind */ + symdata->symnum = symnum;/* Rewind */ ret =HYPERVISOR_platform_op (&xs->op);if (ret <0 )
@@ -78,7 +78,7 @@ static void *xensyms_next(struct seq_fil {struct xensyms *xs = (struct xensyms *)m->private; - xs->op.u.symdata.symnum = ++(*pos); + *pos = xs->op.u.symdata.symnum;if (xensyms_next_sym (xs))return NULL ;
Greg Kroah-Hartman
maintainerPATCH 84/291 arm64: cputype: Add MIDR_CORTEX_A76AE
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit a9b5bd81b294d30a747edd125e9f6aef2def7c79 upstream.
Quoted 1 line
From the TRM,
MIDR_CORTEX_A76AEhas a partnum of 0xDOE and an
implementor of 0x41 (ARM). Add the values.
--- arch/arm64/include/asm/cputype.h | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/include/asm/cputype.h +2 -0
@@ -75,6 +75,7 @@#define ARM_CPU_PART_CORTEX_A76 0xD0B#define ARM_CPU_PART_NEOVERSE_N1 0xD0C#define ARM_CPU_PART_CORTEX_A77 0xD0D +#define ARM_CPU_PART_CORTEX_A76AE 0xD0E#define ARM_CPU_PART_NEOVERSE_V1 0xD40#define ARM_CPU_PART_CORTEX_A78 0xD41#define ARM_CPU_PART_CORTEX_A78AE 0xD42
@@ -152,6 +153,7 @@#define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76)#define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1)#define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77) +#define MIDR_CORTEX_A76AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76AE)#define MIDR_NEOVERSE_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V1)#define MIDR_CORTEX_A78 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78)#define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE)
Greg Kroah-Hartman
maintainerPATCH 85/291 arm64: errata: Add QCOM_KRYO_4XX_GOLD to the spectre_bhb_k24_list
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit ed1ce841245d8febe3badf51c57e81c3619d0a1d upstream.
Qualcomm Kryo 400-series Gold cores have a derivative of an ARM Cortex A76 in them. Since A76 needs Spectre mitigation via looping then the Kyro 400-series Gold cores also need Spectre mitigation via looping.
Qualcomm has confirmed that the proper "k" value for Kryo 400-series Gold cores is 24.
--- arch/arm64/kernel/proton-pack.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kernel/proton-pack.c +1 -0
@@ -878,6 +878,7 @@ u8 spectre_bhb_loop_affected(int scope)MIDR_ALL_VERSIONS (MIDR_CORTEX_A76 ),MIDR_ALL_VERSIONS (MIDR_CORTEX_A77 ),MIDR_ALL_VERSIONS (MIDR_NEOVERSE_N1 ), + MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_GOLD), {}, };static const struct midr_range spectre_bhb_k11_list[] = {
Greg Kroah-Hartman
maintainerPATCH 86/291 arm64: errata: Assume that unknown CPUs _are_ vulnerable to Spectre BHB
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit e403e8538359d8580cbee1976ff71813e947101e upstream.
The code for detecting CPUs that are vulnerable to Spectre BHB was based on a hardcoded list of CPU IDs that were known to be affected. Unfortunately, the list mostly only contained the IDs of standard ARM cores. The IDs for many cores that are minor variants of the standard ARM cores (like many Qualcomm Kyro CPUs) weren't listed. This led the code to assume that those variants were not affected.
Flip the code on its head and instead assume that a core is vulnerable if it doesn't have CSV2_3 but is unrecognized as being safe. This involves creating a "Spectre BHB safe" list.
As of right now, the only CPU IDs added to the "Spectre BHB safe" list are ARM Cortex A35, A53, A55, A510, and A520. This list was created by looking for cores that weren't listed in ARM's list [1] as per review feedback on v2 of this patch [2]. Additionally Brahma A53 is added as per mailing list feedback [3].
NOTE: this patch will not actually _mitigate_ anyone, it will simply cause them to report themselves as vulnerable. If any cores in the system are reported as vulnerable but not mitigated then the whole system will be reported as vulnerable though the system will attempt to mitigate with the information it has about the known cores.
[1] https://developer.arm.com/Arm%20Security%20Center/Spectre-BHB
[2] https://lore.kernel.org/r/20241219175128.GA25477@willie-the-truck
[3] https://lore.kernel.org/r/[email protected]
--- arch/arm64/include/asm/spectre.h | 1 arch/arm64/kernel/proton-pack.c | 201 +++++++++++++++++++-------------------- 2 files changed, 101 insertions(+), 101 deletions(-)
arch/arm64/include/asm/spectre.h +0 -1
@@ -96,7 +96,6 @@ enum mitigation_state arm64_get_meltdownenum mitigation_state arm64_get_spectre_bhb_state (void );bool is_spectre_bhb_affected (const struct arm64_cpu_capabilities *entry,int scope); -u8 spectre_bhb_loop_affected (int scope);void spectre_bhb_enable_mitigation (const struct arm64_cpu_capabilities *__unused);#endif /* __ASSEMBLY__ */ #endif /* __ASM_SPECTRE_H */
arch/arm64/kernel/proton-pack.c +101 -100
265 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 87/291 arm64: errata: Add KRYO 2XX/3XX/4XX silver cores to Spectre BHB safe list
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit 0c9fc6e652cd5aed48c5f700c32b7642bea7f453 upstream.
Qualcomm has confirmed that, much like Cortex A53 and A55, KRYO 2XX/3XX/4XX silver cores are unaffected by Spectre BHB. Add them to the safe list.
--- arch/arm64/kernel/proton-pack.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/kernel/proton-pack.c +3 -0
@@ -866,6 +866,9 @@ static bool is_spectre_bhb_safe(int scopMIDR_ALL_VERSIONS (MIDR_CORTEX_A510 ),MIDR_ALL_VERSIONS (MIDR_CORTEX_A520 ),MIDR_ALL_VERSIONS (MIDR_BRAHMA_B53 ), +MIDR_ALL_VERSIONS (MIDR_QCOM_KRYO_2XX_SILVER ), +MIDR_ALL_VERSIONS (MIDR_QCOM_KRYO_3XX_SILVER ), + MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_SILVER), {}, };static bool all_safe = true;
Greg Kroah-Hartman
maintainerPATCH 88/291 KVM: arm64: Tear down vGIC on failed vCPU creation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 250f25367b58d8c65a1b060a2dda037eea09a672 upstream.
If kvm_arch_vcpu_create() fails to share the vCPU page with the hypervisor, we propagate the error back to the ioctl but leave the vGIC vCPU data initialised. Note only does this leak the corresponding memory when the vCPU is destroyed but it can also lead to use-after-free if the redistributor device handling tries to walk into the vCPU.
Add the missing cleanup to kvm_arch_vcpu_create(), ensuring that the vGIC vCPU structures are destroyed on error.
--- arch/arm64/kvm/arm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/kvm/arm.c +5 -1
@@ -371,7 +371,11 @@ int kvm_arch_vcpu_create(struct kvm_vcpuif (err)return err; -return kvm_share_hyp (vcpu, vcpu +1 ); + err =kvm_share_hyp (vcpu, vcpu +1 ); +if (err) +kvm_vgic_vcpu_destroy (vcpu); + +return err; }void kvm_arch_vcpu_postcreate (struct kvm_vcpu *vcpu)
Greg Kroah-Hartman
maintainerPATCH 89/291 spi: cadence-qspi: Fix probe on AM62A LP SK
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal <[email protected]>
commit b8665a1b49f5498edb7b21d730030c06b7348a3c upstream.
In 2020, there's been an unnoticed change which rightfully attempted to report probe deferrals upon DMA absence by checking the return value of dma_request_chan_by_mask(). By doing so, it also reported errors which were simply ignored otherwise, likely on purpose.
This change actually turned a void return into an error code. Hence, not only the -EPROBE_DEFER error codes but all error codes got reported to the callers, now failing to probe in the absence of Rx DMA channel, despite the fact that DMA seems to not be supported natively by many implementations.
Looking at the history, this change probably led to:ad2775dc3fc5 ("spi: cadence-quadspi: Disable the DAC for Intel LGM SoC") f724c296f2f2 ("spi: cadence-quadspi: fix Direct Access Mode disable for SoCFPGA")
In my case, the AM62A LP SK core octo-SPI node from TI does not advertise any DMA channel, hinting that there is likely no support for it, but yet when the support for the am654 compatible was added, DMA seemed to be used, so just discarding its use with the CQSPI_DISABLE_DAC_MODE quirk for this compatible does not seem the correct approach.
Let's get change the return condition back to:
- return a probe deferral error if we get one
- ignore the return value otherwise
The "error" log level was however likely too high for something that is expected to fail, so let's lower it arbitrarily to the info level.
--- drivers/spi/spi-cadence-quadspi.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/spi/spi-cadence-quadspi.c +6 -0
@@ -1509,6 +1509,12 @@ static int cqspi_request_mmap_dma(structint ret =PTR_ERR (cqspi->rx_chan); cqspi->rx_chan =NULL ; +if (ret == -ENODEV ) { +/* DMA support is not mandatory */ +dev_info (&cqspi->pdev->dev,"No Rx DMA available\n" ); +return 0 ; + } +return dev_err_probe (&cqspi->pdev->dev, ret,"No Rx DMA available\n" ); }init_completion (&cqspi->rx_dma_complete);
Greg Kroah-Hartman
maintainerPATCH 90/291 mtd: rawnand: brcmnand: fix PM resume warning
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kamal Dasu <[email protected]>
commit ddc210cf8b8a8be68051ad958bf3e2cef6b681c2 upstream.
Fixed warning on PM resume as shown below caused due to uninitialized struct nand_operation that checks chip select field :
WARN_ON(op->cs >= nanddev_ntargets(&chip->base)
[ 14.588522] ------------[ cut here ]------------ [ 14.588529] WARNING: CPU: 0 PID: 1392 at drivers/mtd/nand/raw/internals.h:139 nand_reset_op+0x1e0/0x1f8 [ 14.588553] Modules linked in: bdc udc_core [ 14.588579] CPU: 0 UID: 0 PID: 1392 Comm: rtcwake Tainted: G W 6.14.0-rc4-g5394eea10651 #16 [ 14.588590] Tainted: [W]=WARN [ 14.588593] Hardware name: Broadcom STB (Flattened Device Tree) [ 14.588598] Call trace: [ 14.588604] dump_backtrace from show_stack+0x18/0x1c [ 14.588622] r7:00000009 r6:0000008b r5:60000153 r4:c0fa558c [ 14.588625] show_stack from dump_stack_lvl+0x70/0x7c [ 14.588639] dump_stack_lvl from dump_stack+0x18/0x1c [ 14.588653] r5:c08d40b0 r4:c1003cb0 [ 14.588656] dump_stack from __warn+0x84/0xe4 [ 14.588668] __warn from warn_slowpath_fmt+0x18c/0x194 [ 14.588678] r7:c08d40b0 r6:c1003cb0 r5:00000000 r4:00000000 [ 14.588681] warn_slowpath_fmt from nand_reset_op+0x1e0/0x1f8 [ 14.588695] r8:70c40dff r7:89705f41 r6:36b4a597 r5:c26c9444 r4:c26b0048 [ 14.588697] nand_reset_op from brcmnand_resume+0x13c/0x150 [ 14.588714] r9:00000000 r8:00000000 r7:c24f8010 r6:c228a3f8 r5:c26c94bc r4:c26b0040 [ 14.588717] brcmnand_resume from platform_pm_resume+0x34/0x54 [ 14.588735] r5:00000010 r4:c0840a50 [ 14.588738] platform_pm_resume from dpm_run_callback+0x5c/0x14c [ 14.588757] dpm_run_callback from device_resume+0xc0/0x324 [ 14.588776] r9:c24f8054 r8:c24f80a0 r7:00000000 r6:00000000 r5:00000010 r4:c24f8010 [ 14.588779] device_resume from dpm_resume+0x130/0x160 [ 14.588799] r9:c22539e4 r8:00000010 r7:c22bebb0 r6:c24f8010 r5:c22539dc r4:c22539b0 [ 14.588802] dpm_resume from dpm_resume_end+0x14/0x20 [ 14.588822] r10:c2204e40 r9:00000000 r8:c228a3fc r7:00000000 r6:00000003 r5:c228a414 [ 14.588826] r4:00000010 [ 14.588828] dpm_resume_end from suspend_devices_and_enter+0x274/0x6f8 [ 14.588848] r5:c228a414 r4:00000000 [ 14.588851] suspend_devices_and_enter from pm_suspend+0x228/0x2bc [ 14.588868] r10:c3502910 r9:c3501f40 r8:00000004 r7:c228a438 r6:c0f95e18 r5:00000000 [ 14.588871] r4:00000003 [ 14.588874] pm_suspend from state_store+0x74/0xd0 [ 14.588889] r7:c228a438 r6:c0f934c8 r5:00000003 r4:00000003 [ 14.588892] state_store from kobj_attr_store+0x1c/0x28 [ 14.588913] r9:00000000 r8:00000000 r7:f09f9f08 r6:00000004 r5:c3502900 r4:c0283250 [ 14.588916] kobj_attr_store from sysfs_kf_write+0x40/0x4c [ 14.588936] r5:c3502900 r4:c0d92a48 [ 14.588939] sysfs_kf_write from kernfs_fop_write_iter+0x104/0x1f0 [ 14.588956] r5:c3502900 r4:c3501f40 [ 14.588960] kernfs_fop_write_iter from vfs_write+0x250/0x420 [ 14.588980] r10:c0e14b48 r9:00000000 r8:c25f5780 r7:00443398 r6:f09f9f68 r5:c34f7f00 [ 14.588983] r4:c042a88c [ 14.588987] vfs_write from ksys_write+0x74/0xe4 [ 14.589005] r10:00000004 r9:c25f5780 r8:c02002fA0 r7:00000000 r6:00000000 r5:c34f7f00 [ 14.589008] r4:c34f7f00 [ 14.589011] ksys_write from sys_write+0x10/0x14 [ 14.589029] r7:00000004 r6:004421c0 r5:00443398 r4:00000004 [ 14.589032] sys_write from ret_fast_syscall+0x0/0x5c [ 14.589044] Exception stack(0xf09f9fa8 to 0xf09f9ff0) [ 14.589050] 9fa0: 00000004 00443398 00000004 00443398 00000004 00000001 [ 14.589056] 9fc0: 00000004 00443398 004421c0 00000004 b6ecbd58 00000008 bebfbc38 0043eb78 [ 14.589062] 9fe0: 00440eb0 bebfbaf8 b6de18a0 b6e579e8 [ 14.589065] ---[ end trace 0000000000000000 ]---
The fix uses the higher level nand_reset(chip, chipnr); where chipnr = 0, when doing PM resume operation in compliance with the controller support for single die nand chip. Switching from nand_reset_op() to nand_reset() implies more than just setting the cs field op->cs, it also reconfigures the data interface (ie. the timings). Tested and confirmed the NAND chip is in sync timing wise with host after the fix.
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1 -1
@@ -2968,7 +2968,7 @@ static int brcmnand_resume(struct devicebrcmnand_save_restore_cs_config (host,1 );/* Reset the chip, required by some chips after power-up */ -nand_reset_op (chip); +nand_reset (chip,0 ); }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 91/291 tpm, tpm_tis: Fix timeout handling when waiting for TPM status
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan McDowell <[email protected]>
commit 7146dffa875cd00e7a7f918e1fce79c7593ac1fa upstream.
The change to only use interrupts to handle supported status changes introduced an issue when it is necessary to poll for the status. Rather than checking for the status after sleeping the code now sleeps after the check. This means a correct, but slower, status change on the part of the TPM can be missed, resulting in a spurious timeout error, especially on a more loaded system. Switch back to sleeping *then* checking. An up front check of the status has been done at the start of the function, so this does not cause an additional delay when the status is already what we're looking for.
--- drivers/char/tpm/tpm_tis_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/char/tpm/tpm_tis_core.c +1 -2
@@ -104,11 +104,10 @@ again:return 0 ;/* process status changes without irq support */ do { +usleep_range (priv->timeout_min, priv->timeout_max); status = chip->ops->status (chip);if ((status & mask) == mask)return 0 ; -usleep_range (priv->timeout_min, - priv->timeout_max); }while (time_before (jiffies, stop));return -ETIME ; }
Greg Kroah-Hartman
maintainerPATCH 92/291 media: streamzap: prevent processing IR data on URB failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Murad Masimov <[email protected]>
commit 549f6d348167fb2f7800ed7c8d4bce9630c74498 upstream.
If streamzap_callback() receives an urb with any non-critical error status, i.e. any error code other than -ECONNRESET, -ENOENT or -ESHUTDOWN, it will try to process IR data, ignoring a possible transfer failure.
Make streamzap_callback() process IR data only when urb->status is 0. Move processing logic to a separate function to make code cleaner and more similar to the URB completion handlers in other RC drivers.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- drivers/media/rc/streamzap.c | 68 ++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 30 deletions(-)
drivers/media/rc/streamzap.c +38 -30
@@ -138,39 +138,10 @@ static void sz_push_half_space(struct stsz_push_full_space (sz, value &SZ_SPACE_MASK ); } -/* -* streamzap_callback - usb IRQ handler callback -* -* This procedure is invoked on reception of data from -* the usb remote. -*/ -static void streamzap_callback (struct urb *urb) +static void sz_process_ir_data (struct streamzap_ir *sz,int len) { -struct streamzap_ir *sz;unsigned int i; -int len; - -if (!urb) -return ; - - sz = urb->context; - len = urb->actual_length; - -switch (urb->status) { -case -ECONNRESET : -case -ENOENT : -case -ESHUTDOWN : -/* -* this urb is terminated, clean up. -* sz might already be invalid at this point -*/ -dev_err (sz->dev,"urb terminated, status: %d\n" , urb->status); -return ; -default : -break ; - } -dev_dbg (sz->dev,"%s: received urb, len %d\n" , __func__, len);for (i =0 ; i < len; i++) {dev_dbg (sz->dev,"sz->buf_in[%d]: %x\n" , i, (unsigned char )sz->buf_in[i]);
@@ -219,6 +190,43 @@ static void streamzap_callback(struct ur }ir_raw_event_handle (sz->rdev); +} + +/* +* streamzap_callback - usb IRQ handler callback +* +* This procedure is invoked on reception of data from +* the usb remote. +*/ +static void streamzap_callback (struct urb *urb) +{ +struct streamzap_ir *sz; +int len; + +if (!urb) +return ; + + sz = urb->context; + len = urb->actual_length; + +switch (urb->status) { +case 0 : +dev_dbg (sz->dev,"%s: received urb, len %d\n" , __func__, len); +sz_process_ir_data (sz, len); +break ; +case -ECONNRESET : +case -ENOENT : +case -ESHUTDOWN : +/* +* this urb is terminated, clean up. +* sz might already be invalid at this point +*/ +dev_err (sz->dev,"urb terminated, status: %d\n" , urb->status); +return ; +default : +break ; + } +usb_submit_urb (urb,GFP_ATOMIC ); }
Greg Kroah-Hartman
maintainerPATCH 93/291 media: platform: stm32: Add check for clk_enable()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
commit f883f34b6a46b1a09d44d7f94c3cd72fe0e8f93b upstream.
Add check for the return value of clk_enable() to gurantee the success.
--- drivers/media/platform/st/stm32/dma2d/dma2d.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/st/stm32/dma2d/dma2d.c +2 -1
@@ -492,7 +492,8 @@ static void device_run(void *prv) dst->sequence = frm_cap->sequence++;v4l2_m2m_buf_copy_metadata (src, dst, true); -clk_enable (dev->gate); +if (clk_enable (dev->gate)) + goto end;dma2d_config_fg (dev, frm_out,vb2_dma_contig_plane_dma_addr (&src->vb2_buf,0 ));
Greg Kroah-Hartman
maintainerPATCH 94/291 media: v4l2-dv-timings: prevent possible overflow in v4l2_detect_gtf()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karina Yankevich <[email protected]>
commit 3edd1fc48d2c045e8259561797c89fe78f01717e upstream.
In v4l2_detect_gtf(), it seems safer to cast the 32-bit image_width variable to the 64-bit type u64 before multiplying to avoid a possible overflow. The resulting object code even seems to look better, at least on x86_64.
Found by Linux Verification Center (linuxtesting.org) with Svace.
[Sergey: rewrote the patch subject/descripition]
--- drivers/media/v4l2-core/v4l2-dv-timings.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/v4l2-core/v4l2-dv-timings.c +2 -2
@@ -764,7 +764,7 @@ bool v4l2_detect_gtf(unsigned int frame_u64 num;u32 den; - num = ((image_width *GTF_D_C_PRIME * (u64 )hfreq) - + num = (((u64 )image_width *GTF_D_C_PRIME * hfreq) - ((u64 )image_width *GTF_D_M_PRIME *1000 )); den = (hfreq * (100 -GTF_D_C_PRIME ) +GTF_D_M_PRIME *1000 ) * (2 *GTF_CELL_GRAN );
@@ -774,7 +774,7 @@ bool v4l2_detect_gtf(unsigned int frame_u64 num;u32 den; - num = ((image_width *GTF_S_C_PRIME * (u64 )hfreq) - + num = (((u64 )image_width *GTF_S_C_PRIME * hfreq) - ((u64 )image_width *GTF_S_M_PRIME *1000 )); den = (hfreq * (100 -GTF_S_C_PRIME ) +GTF_S_M_PRIME *1000 ) * (2 *GTF_CELL_GRAN );
Greg Kroah-Hartman
maintainerPATCH 95/291 media: i2c: ccs: Set the devices runtime PM status correctly in remove
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit e04604583095faf455b3490b004254a225fd60d4 upstream.
Set the device's runtime PM status to suspended in device removal only if it wasn't suspended already.
--- drivers/media/i2c/ccs/ccs-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/i2c/ccs/ccs-core.c +3 -2
@@ -3674,9 +3674,10 @@ static void ccs_remove(struct i2c_clientv4l2_async_unregister_subdev (subdev);pm_runtime_disable (&client->dev); -if (!pm_runtime_status_suspended (&client->dev)) +if (!pm_runtime_status_suspended (&client->dev)) {ccs_power_off (&client->dev); -pm_runtime_set_suspended (&client->dev); +pm_runtime_set_suspended (&client->dev); + }for (i =0 ; i < sensor->ssds_used; i++) {v4l2_device_unregister_subdev (&sensor->ssds[i].sd);
Greg Kroah-Hartman
maintainerPATCH 96/291 media: i2c: ccs: Set the devices runtime PM status correctly in probe
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 80704d14f1bd3628f578510e0a88b66824990ef6 upstream.
Set the device's runtime PM status to suspended in probe error paths where it was previously set to active.
--- drivers/media/i2c/ccs/ccs-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/i2c/ccs/ccs-core.c +1 -0
@@ -3642,6 +3642,7 @@ static int ccs_probe(struct i2c_client * out_disable_runtime_pm:pm_runtime_put_noidle (&client->dev);pm_runtime_disable (&client->dev); +pm_runtime_set_suspended (&client->dev); out_media_entity_cleanup:media_entity_cleanup (&sensor->src->sd.entity);
Greg Kroah-Hartman
maintainerPATCH 97/291 media: i2c: ov7251: Set enable GPIO low in probe
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit a1963698d59cec83df640ded343af08b76c8e9c5 upstream.
Set the enable GPIO low when acquiring it.
--- drivers/media/i2c/ov7251.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov7251.c +1 -1
@@ -1675,7 +1675,7 @@ static int ov7251_probe(struct i2c_clienreturn PTR_ERR (ov7251->analog_regulator); } - ov7251->enable_gpio =devm_gpiod_get (dev,"enable" ,GPIOD_OUT_HIGH ); + ov7251->enable_gpio =devm_gpiod_get (dev,"enable" ,GPIOD_OUT_LOW );if (IS_ERR (ov7251->enable_gpio)) {dev_err (dev,"cannot get enable gpio\n" );return PTR_ERR (ov7251->enable_gpio);
Greg Kroah-Hartman
maintainerPATCH 98/291 media: i2c: ov7251: Introduce 1 ms delay between regulators and en GPIO
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 3d391292cdd53984ec1b9a1f6182a62a62751e03 upstream.
Lift the xshutdown (enable) GPIO 1 ms after enabling the regulators, as required by the sensor's power-up sequence.
--- drivers/media/i2c/ov7251.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/ov7251.c +2 -0
@@ -922,6 +922,8 @@ static int ov7251_set_power_on(struct dereturn ret; } +usleep_range (1000 ,1100 ); +gpiod_set_value_cansleep (ov7251->enable_gpio,1 );/* wait at least 65536 external clock cycles */
Greg Kroah-Hartman
maintainerPATCH 99/291 media: venus: hfi_parser: add check to avoid out of bound access
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vikash Garodia <[email protected]>
commit 172bf5a9ef70a399bb227809db78442dc01d9e48 upstream.
There is a possibility that init_codecs is invoked multiple times during manipulated payload from video firmware. In such case, if codecs_count can get incremented to value more than MAX_CODEC_NUM, there can be OOB access. Reset the count so that it always starts from beginning.
--- drivers/media/platform/qcom/venus/hfi_parser.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/qcom/venus/hfi_parser.c +2 -0
@@ -19,6 +19,8 @@ static void init_codecs(struct venus_corstruct hfi_plat_caps *caps = core->caps, *cap;unsigned long bit; + core->codecs_count =0 ; +if (hweight_long (core->dec_codecs) +hweight_long (core->enc_codecs) >MAX_CODEC_NUM )return ;
Greg Kroah-Hartman
maintainerPATCH 100/291 media: venus: hfi_parser: refactor hfi packet parsing logic
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vikash Garodia <[email protected]>
commit 9edaaa8e3e15aab1ca413ab50556de1975bcb329 upstream.
words_count denotes the number of words in total payload, while data points to payload of various property within it. When words_count reaches last word, data can access memory beyond the total payload. This can lead to OOB access. With this patch, the utility api for handling individual properties now returns the size of data consumed. Accordingly remaining bytes are calculated before parsing the payload, thereby eliminates the OOB access possibilities.
--- drivers/media/platform/qcom/venus/hfi_parser.c | 98 ++++++++++++++++++------- 1 file changed, 72 insertions(+), 26 deletions(-)
drivers/media/platform/qcom/venus/hfi_parser.c +72 -26
@@ -64,7 +64,7 @@ fill_buf_mode(struct hfi_plat_caps *cap, cap->cap_bufs_mode_dynamic = true; } -static void +static int parse_alloc_mode (struct venus_core *core,u32 codecs,u32 domain,void *data) {struct hfi_buffer_alloc_mode_supported *mode = data;
@@ -72,7 +72,7 @@ parse_alloc_mode(struct venus_core *coreu32 *type;if (num_entries >MAX_ALLOC_MODE_ENTRIES ) -return ; +return -EINVAL ; type = mode->data;
@@ -84,6 +84,8 @@ parse_alloc_mode(struct venus_core *core type++; } + +return sizeof (*mode); } static void fill_profile_level(struct hfi_plat_caps *cap, const void *data,
@@ -98,7 +100,7 @@ static void fill_profile_level(struct hf cap->num_pl += num; } -static void +static int parse_profile_level (struct venus_core *core,u32 codecs,u32 domain,void *data) {struct hfi_profile_level_supported *pl = data;
@@ -106,12 +108,14 @@ parse_profile_level(struct venus_core *cstruct hfi_profile_level pl_arr[HFI_MAX_PROFILE_COUNT ] = {};if (pl->profile_count >HFI_MAX_PROFILE_COUNT ) -return ; +return -EINVAL ;memcpy (pl_arr, proflevel, pl->profile_count *sizeof (*proflevel));for_each_codec (core->caps,ARRAY_SIZE (core->caps), codecs, domain, fill_profile_level, pl_arr, pl->profile_count); + +return pl->profile_count *sizeof (*proflevel) +sizeof (u32); } static void
@@ -126,7 +130,7 @@ fill_caps(struct hfi_plat_caps *cap, con cap->num_caps += num; } -static void +static int parse_caps (struct venus_core *core,u32 codecs,u32 domain,void *data) {struct hfi_capabilities *caps = data;
@@ -135,12 +139,14 @@ parse_caps(struct venus_core *core, u32struct hfi_capability caps_arr[MAX_CAP_ENTRIES ] = {};if (num_caps >MAX_CAP_ENTRIES ) -return ; +return -EINVAL ;memcpy (caps_arr, cap, num_caps *sizeof (*cap));for_each_codec (core->caps,ARRAY_SIZE (core->caps), codecs, domain, fill_caps, caps_arr, num_caps); + +return sizeof (*caps); } static void fill_raw_fmts(struct hfi_plat_caps *cap, const void *fmts,
@@ -155,7 +161,7 @@ static void fill_raw_fmts(struct hfi_pla cap->num_fmts += num_fmts; } -static void +static int parse_raw_formats (struct venus_core *core,u32 codecs,u32 domain,void *data) {struct hfi_uncompressed_format_supported *fmt = data;
@@ -164,7 +170,8 @@ parse_raw_formats(struct venus_core *corstruct raw_formats rawfmts[MAX_FMT_ENTRIES ] = {};u32 entries = fmt->format_entries;unsigned int i =0 ; -u32 num_planes; +u32 num_planes =0 ; +u32 size;while (entries) { num_planes = pinfo->num_planes;
@@ -174,7 +181,7 @@ parse_raw_formats(struct venus_core *cor i++;if (i >=MAX_FMT_ENTRIES ) -return ; +return -EINVAL ;if (pinfo->num_planes >MAX_PLANES )break ;
@@ -186,9 +193,13 @@ parse_raw_formats(struct venus_core *corfor_each_codec (core->caps,ARRAY_SIZE (core->caps), codecs, domain, fill_raw_fmts, rawfmts, i); + size = fmt->format_entries * (sizeof (*constr) * num_planes +2 *sizeof (u32)) + +2 *sizeof (u32); + +return size; } -static void parse_codecs (struct venus_core *core,void *data) +static int parse_codecs (struct venus_core *core,void *data) {struct hfi_codec_supported *codecs = data;
@@ -200,21 +211,27 @@ static void parse_codecs(struct venus_co core->dec_codecs &= ~HFI_VIDEO_CODEC_SPARK ; core->enc_codecs &= ~HFI_VIDEO_CODEC_HEVC ; } + +return sizeof (*codecs); } -static void parse_max_sessions (struct venus_core *core,const void *data) +static int parse_max_sessions (struct venus_core *core,const void *data) {const struct hfi_max_sessions_supported *sessions = data; core->max_sessions_supported = sessions->max_sessions; + +return sizeof (*sessions); } -static void parse_codecs_mask (u32 *codecs,u32 *domain,void *data) +static int parse_codecs_mask (u32 *codecs,u32 *domain,void *data) {struct hfi_codec_mask_supported *mask = data; *codecs = mask->codecs; *domain = mask->video_domains; + +return sizeof (*mask); }static void parser_init (struct venus_inst *inst,u32 *codecs,u32 *domain)
@@ -283,8 +300,9 @@ static int hfi_platform_parser(struct veu32 hfi_parser (struct venus_core *core,struct venus_inst *inst,void *buf,u32 size) { -unsigned int words_count = size >>2 ; -u32 *word = buf, *data, codecs =0 , domain =0 ; +u32 *words = buf, *payload, codecs =0 , domain =0 ; +u32 *frame_size = buf + size; +u32 rem_bytes = size;int ret; ret =hfi_platform_parser (core, inst);
@@ -301,38 +319,66 @@ u32 hfi_parser(struct venus_core *core,memset (core->caps,0 ,sizeof (core->caps)); } -while (words_count) { - data = word +1 ; +while (words < frame_size) { + payload = words +1 ; -switch (*word) { +switch (*words) {case HFI_PROPERTY_PARAM_CODEC_SUPPORTED : -parse_codecs (core, data); +if (rem_bytes <=sizeof (struct hfi_codec_supported )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_codecs (core, payload); +if (ret <0 ) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; +init_codecs (core);break ;case HFI_PROPERTY_PARAM_MAX_SESSIONS_SUPPORTED : -parse_max_sessions (core, data); +if (rem_bytes <=sizeof (struct hfi_max_sessions_supported )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_max_sessions (core, payload);break ;case HFI_PROPERTY_PARAM_CODEC_MASK_SUPPORTED : -parse_codecs_mask (&codecs, &domain, data); +if (rem_bytes <=sizeof (struct hfi_codec_mask_supported )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_codecs_mask (&codecs, &domain, payload);break ;case HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SUPPORTED : -parse_raw_formats (core, codecs, domain, data); +if (rem_bytes <=sizeof (struct hfi_uncompressed_format_supported )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_raw_formats (core, codecs, domain, payload);break ;case HFI_PROPERTY_PARAM_CAPABILITY_SUPPORTED : -parse_caps (core, codecs, domain, data); +if (rem_bytes <=sizeof (struct hfi_capabilities )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_caps (core, codecs, domain, payload);break ;case HFI_PROPERTY_PARAM_PROFILE_LEVEL_SUPPORTED : -parse_profile_level (core, codecs, domain, data); +if (rem_bytes <=sizeof (struct hfi_profile_level_supported )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_profile_level (core, codecs, domain, payload);break ;case HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE_SUPPORTED : -parse_alloc_mode (core, codecs, domain, data); +if (rem_bytes <=sizeof (struct hfi_buffer_alloc_mode_supported )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_alloc_mode (core, codecs, domain, payload);break ;default : + ret =sizeof (u32);break ; } - word++; - words_count--; +if (ret <0 ) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + words += ret /sizeof (u32); + rem_bytes -= ret; }if (!core->max_sessions_supported)
Greg Kroah-Hartman
maintainerPATCH 101/291 mptcp: sockopt: fix getting IPV6_V6ONLY
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 8c39633759885b6ff85f6d96cf445560e74df5e8 upstream.
When adding a socket option support in MPTCP, both the get and set parts are supposed to be implemented.
IPV6_V6ONLY support for the setsockopt part has been added a while ago, but it looks like the get part got forgotten. It should have been present as a way to verify a setting has been set as expected, and not to act differently from TCP or any other socket types.
Not supporting this getsockopt(IPV6_V6ONLY) blocks some apps which want to check the default value, before doing extra actions. On Linux, the default value is 0, but this can be changed with the net.ipv6.bindv6only sysctl knob. On Windows, it is set to 1 by default. So supporting the get part, like for all other socket options, is important.
Everything was in place to expose it, just the last step was missing. Only new code is added to cover this specific getsockopt(), that seems safe.
--- net/mptcp/sockopt.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
net/mptcp/sockopt.c +16 -0
@@ -1271,6 +1271,20 @@ static int mptcp_getsockopt_v4(struct mpreturn -EOPNOTSUPP ; } +static int mptcp_getsockopt_v6 (struct mptcp_sock *msk,int optname, +char __user *optval,int __user *optlen) +{ +struct sock *sk = (void *)msk; + +switch (optname) { +case IPV6_V6ONLY : +return mptcp_put_int_option (msk, optval, optlen, + sk->sk_ipv6only); + } + +return -EOPNOTSUPP ; +} +static int mptcp_getsockopt_sol_mptcp (struct mptcp_sock *msk,int optname,char __user *optval,int __user *optlen) {
@@ -1308,6 +1322,8 @@ int mptcp_getsockopt(struct sock *sk, inif (level ==SOL_IP )return mptcp_getsockopt_v4 (msk, optname, optval, option); +if (level ==SOL_IPV6 ) +return mptcp_getsockopt_v6 (msk, optname, optval, option);if (level ==SOL_TCP )return mptcp_getsockopt_sol_tcp (msk, optname, optval, option);if (level ==SOL_MPTCP )
Greg Kroah-Hartman
maintainerPATCH 102/291 mtd: Add check for devm_kcalloc()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
commit 2aee30bb10d7bad0a60255059c9ce1b84cf0130e upstream.
Add a check for devm_kcalloc() to ensure successful allocation.
--- drivers/mtd/mtdpstore.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/mtdpstore.c +3 -0
@@ -423,6 +423,9 @@ static void mtdpstore_notify_add(struct longcnt =BITS_TO_LONGS (div_u64 (mtd->size, mtd->erasesize)); cxt->badmap =kcalloc (longcnt,sizeof (long ),GFP_KERNEL ); +if (!cxt->rmmap || !cxt->usedmap || !cxt->badmap) +return ; +/* just support dmesg right now */ cxt->dev.flags =PSTORE_FLAGS_DMESG ; cxt->dev.zone.read = mtdpstore_read;
Greg Kroah-Hartman
maintainerPATCH 103/291 net: dsa: mv88e6xxx: workaround RGMII transmit delay erratum for 6320 family
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
commit 1ebc8e1ef906db9c08e9abe9776d85ddec837725 upstream.
Implement the workaround for erratum
3.3 RGMII timing may be out of spec when transmit delay is enabled
for the 6320 family, which says:
When transmit delay is enabled via Port register 1 bit 14 = 1, duty cycle may be out of spec. Under very rare conditions this may cause the attached device receive CRC errors.
--- drivers/net/dsa/mv88e6xxx/chip.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/dsa/mv88e6xxx/chip.c +17 -0
@@ -3694,6 +3694,21 @@ static int mv88e6xxx_stats_setup(structreturn mv88e6xxx_g1_stats_clear (chip); } +static int mv88e6320_setup_errata (struct mv88e6xxx_chip *chip) +{ +u16 dummy; +int err; + +/* Workaround for erratum +* 3.3 RGMII timing may be out of spec when transmit delay is enabled +*/ + err =mv88e6xxx_port_hidden_write (chip,0 ,0xf ,0x7 ,0xe000 ); +if (err) +return err; + +return mv88e6xxx_port_hidden_read (chip,0 ,0xf ,0x7 , &dummy); +} +/* Check if the errata has already been applied. */ static bool mv88e6390_setup_errata_applied (struct mv88e6xxx_chip *chip) {
@@ -5110,6 +5125,7 @@ static const struct mv88e6xxx_ops mv88e6static const struct mv88e6xxx_ops mv88e6320_ops = {/* MV88E6XXX_FAMILY_6320 */ + .setup_errata = mv88e6320_setup_errata, .ieee_pri_map = mv88e6085_g1_ieee_pri_map, .ip_pri_map = mv88e6085_g1_ip_pri_map, .irl_init_all = mv88e6352_g2_irl_init_all,
@@ -5157,6 +5173,7 @@ static const struct mv88e6xxx_ops mv88e6static const struct mv88e6xxx_ops mv88e6321_ops = {/* MV88E6XXX_FAMILY_6320 */ + .setup_errata = mv88e6320_setup_errata, .ieee_pri_map = mv88e6085_g1_ieee_pri_map, .ip_pri_map = mv88e6085_g1_ip_pri_map, .irl_init_all = mv88e6352_g2_irl_init_all,
Greg Kroah-Hartman
maintainerPATCH 104/291 mtd: Replace kcalloc() with devm_kcalloc()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
commit 1b61a59876f0eafc19b23007c522ee407f55dbec upstream.
Replace kcalloc() with devm_kcalloc() to prevent memory leaks in case of errors.
--- drivers/mtd/mtdpstore.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mtd/mtdpstore.c +3 -6
@@ -417,11 +417,11 @@ static void mtdpstore_notify_add(struct } longcnt =BITS_TO_LONGS (div_u64 (mtd->size, info->kmsg_size)); - cxt->rmmap =kcalloc (longcnt,sizeof (long ),GFP_KERNEL ); - cxt->usedmap =kcalloc (longcnt,sizeof (long ),GFP_KERNEL ); + cxt->rmmap =devm_kcalloc (&mtd->dev, longcnt,sizeof (long ),GFP_KERNEL ); + cxt->usedmap =devm_kcalloc (&mtd->dev, longcnt,sizeof (long ),GFP_KERNEL ); longcnt =BITS_TO_LONGS (div_u64 (mtd->size, mtd->erasesize)); - cxt->badmap =kcalloc (longcnt,sizeof (long ),GFP_KERNEL ); + cxt->badmap =devm_kcalloc (&mtd->dev, longcnt,sizeof (long ),GFP_KERNEL );if (!cxt->rmmap || !cxt->usedmap || !cxt->badmap)return ;
@@ -530,9 +530,6 @@ static void mtdpstore_notify_remove(strumtdpstore_flush_removed (cxt);unregister_pstore_device (&cxt->dev); -kfree (cxt->badmap); -kfree (cxt->usedmap); -kfree (cxt->rmmap); cxt->mtd =NULL ; cxt->index =-1 ; }
Greg Kroah-Hartman
maintainerPATCH 105/291 clocksource/drivers/stm32-lptimer: Use wakeup capable instead of init wakeup
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Torgue <[email protected]>
commit 96bf4b89a6ab22426ad83ef76e66c72a5a8daca0 upstream.
"wakeup-source" property describes a device which has wakeup capability but should not force this device as a wakeup source.
Rule: add
--- drivers/clocksource/timer-stm32-lp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clocksource/timer-stm32-lp.c +1 -3
@@ -168,9 +168,7 @@ static int stm32_clkevent_lp_probe(struc }if (of_property_read_bool (pdev->dev.parent->of_node,"wakeup-source" )) { - ret =device_init_wakeup (&pdev->dev, true); -if (ret) - goto out_clk_disable; +device_set_wakeup_capable (&pdev->dev, true); ret =dev_pm_set_wake_irq (&pdev->dev, irq);if (ret)
Greg Kroah-Hartman
maintainerPATCH 106/291 wifi: mt76: Add check for devm_kstrdup()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
commit 4bc1da524b502999da28d287de4286c986a1af57 upstream.
Add check for the return value of devm_kstrdup() in mt76_get_of_data_from_mtd() to catch potential exception.
--- drivers/net/wireless/mediatek/mt76/eeprom.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/mediatek/mt76/eeprom.c +4 -0
@@ -90,6 +90,10 @@ int mt76_get_of_eeprom(struct mt76_dev *#ifdef CONFIG_NL80211_TESTMODE dev->test_mtd.name =devm_kstrdup (dev->dev, part,GFP_KERNEL ); +if (!dev->test_mtd.name) { + ret = -ENOMEM ; + goto out_put_node; + } dev->test_mtd.offset = offset;#endif
Greg Kroah-Hartman
maintainerPATCH 107/291 wifi: mac80211: fix integer overflow in hwmp_route_info_get()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gavrilov Ilia <[email protected]>
commit d00c0c4105e5ab8a6a13ed23d701cceb285761fa upstream.
Since the new_metric and last_hop_metric variables can reach the MAX_METRIC(0xffffffff) value, an integer overflow may occur when multiplying them by 10/9. It can lead to incorrect behavior.
Found by InfoTeCS on behalf of Linux Verification Center (linuxtesting.org) with SVACE.
--- net/mac80211/mesh_hwmp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/mac80211/mesh_hwmp.c +10 -4
@@ -365,6 +365,12 @@ u32 airtime_link_metric_get(struct ieee8return (u32 )result; } +/* Check that the first metric is at least 10% better than the second one */ +static bool is_metric_better (u32 x,u32 y) +{ +return (x < y) && (x < (y - x /10 )); +} +/** * hwmp_route_info_get - Update routing info to originator and transmitter *
@@ -455,8 +461,8 @@ static u32 hwmp_route_info_get(struct ie (mpath->sn == orig_sn && (rcu_access_pointer (mpath->next_hop) != sta ? -mult_frac (new_metric,10 ,9 ) : - new_metric) >= mpath->metric)) { + !is_metric_better (new_metric, mpath->metric) : + new_metric >= mpath->metric))) { process = false; fresh_info = false; }
@@ -526,8 +532,8 @@ static u32 hwmp_route_info_get(struct ieif ((mpath->flags &MESH_PATH_FIXED ) || ((mpath->flags &MESH_PATH_ACTIVE ) && ((rcu_access_pointer (mpath->next_hop) != sta ? -mult_frac (last_hop_metric,10 ,9 ) : - last_hop_metric) > mpath->metric))) + !is_metric_better (last_hop_metric, mpath->metric) : + last_hop_metric > mpath->metric)))) fresh_info = false; }else { mpath =mesh_path_add (sdata, ta);
Greg Kroah-Hartman
maintainerPATCH 108/291 io_uring/kbuf: reject zero sized provided buffers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit cf960726eb65e8d0bfecbcce6cf95f47b1ffa6cc upstream.
This isn't fixing a real issue, but there's also zero point in going through group and buffer setup, when the buffers are going to be rejected once attempted to get used.
--- io_uring/kbuf.c | 2 ++ 1 file changed, 2 insertions(+)
io_uring/kbuf.c +2 -0
@@ -336,6 +336,8 @@ int io_provide_buffers_prep(struct io_ki p->nbufs = tmp; p->addr =READ_ONCE (sqe->addr); p->len =READ_ONCE (sqe->len); +if (!p->len) +return -EINVAL ;if (check_mul_overflow ((unsigned long )p->len, (unsigned long )p->nbufs, &size))
Greg Kroah-Hartman
maintainerPATCH 109/291 ASoC: qdsp6: q6apm-dai: set 10 ms period and buffer alignment.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <[email protected]>
commit 3107019501842c27334554ba9d6583b1f200f61f upstream.
DSP expects the periods to be aligned to fragment sizes, currently setting up to hw constriants on periods bytes is not going to work correctly as we can endup with periods sizes aligned to 32 bytes however not aligned to fragment size.
Update the constriants to use fragment size, and also set at step of 10ms for period size to accommodate DSP requirements of 10ms latency.
--- sound/soc/qcom/qdsp6/q6apm-dai.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/qcom/qdsp6/q6apm-dai.c +3 -2
@@ -292,13 +292,14 @@ static int q6apm_dai_open(struct snd_soc } } - ret =snd_pcm_hw_constraint_step (runtime,0 ,SNDRV_PCM_HW_PARAM_PERIOD_BYTES ,32 ); +/* setup 10ms latency to accommodate DSP restrictions */ + ret =snd_pcm_hw_constraint_step (runtime,0 ,SNDRV_PCM_HW_PARAM_PERIOD_SIZE ,480 );if (ret <0 ) {dev_err (dev,"constraint for period bytes step ret = %d\n" , ret); goto err; } - ret =snd_pcm_hw_constraint_step (runtime,0 ,SNDRV_PCM_HW_PARAM_BUFFER_BYTES ,32 ); + ret =snd_pcm_hw_constraint_step (runtime,0 ,SNDRV_PCM_HW_PARAM_BUFFER_SIZE ,480 );if (ret <0 ) {dev_err (dev,"constraint for buffer bytes step ret = %d\n" , ret); goto err;
Greg Kroah-Hartman
maintainerPATCH 110/291 ASoC: qdsp6: q6apm-dai: fix capture pipeline overruns.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <[email protected]>
commit 5d01ed9b9939b4c726be74db291a982bc984c584 upstream.
Period sizes less than 6k for capture path triggers overruns in the dsp capture pipeline.
Change the period size and number of periods to value which DSP is happy with.
--- sound/soc/qcom/qdsp6/q6apm-dai.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/qcom/qdsp6/q6apm-dai.c +2 -2
@@ -24,8 +24,8 @@#define PLAYBACK_MIN_PERIOD_SIZE 128#define CAPTURE_MIN_NUM_PERIODS 2#define CAPTURE_MAX_NUM_PERIODS 8 -#define CAPTURE_MAX_PERIOD_SIZE 4096 -#define CAPTURE_MIN_PERIOD_SIZE 320 +#define CAPTURE_MAX_PERIOD_SIZE 65536 +#define CAPTURE_MIN_PERIOD_SIZE 6144#define BUFFER_BYTES_MAX (PLAYBACK_MAX_NUM_PERIODS * PLAYBACK_MAX_PERIOD_SIZE)#define BUFFER_BYTES_MIN (PLAYBACK_MIN_NUM_PERIODS * PLAYBACK_MIN_PERIOD_SIZE)#define SID_MASK_DEFAULT 0xF
Greg Kroah-Hartman
maintainerPATCH 111/291 ASoC: qdsp6: q6asm-dai: fix q6asm_dai_compr_set_params error path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Klimov <[email protected]>
commit 7eccc86e90f04a0d758d16c08627a620ac59604d upstream.
In case of attempts to compress playback something, for instance, when audio routing is not set up correctly, the audio DSP is left in inconsistent state because we are not doing the correct things in the error path of q6asm_dai_compr_set_params().
So, when routing is not set up and compress playback is attempted the following errors are present (simplified log):
q6routing routing: Routing not setup for MultiMedia-1 Session q6asm-dai dais: Stream reg failed ret:-22
q6asm-dai dais: ASoC error (-22): at snd_soc_component_compr_set_params() on 17300000.remoteproc:glink-edge:apr:service@7:dais
After setting the correct routing the compress playback will always fail:
q6asm-dai dais: cmd = 0x10db3 returned error = 0x9
q6asm-dai dais: DSP returned error[9]
q6asm-dai dais: q6asm_open_write failed
q6asm-dai dais: ASoC error (-22): at snd_soc_component_compr_set_params() on 17300000.remoteproc:glink-edge:apr:service@7:dais
0x9 here means "Operation is already processed". The CMD_OPEN here was sent the second time hence DSP responds that it was already done.
Turns out the CMD_CLOSE should be sent after the q6asm_open_write() succeeded but something failed after that, for instance, routing setup.
Fix this by slightly reworking the error path inq6asm_dai_compr_set_params().
Tested on QRB5165 RB5 and SDM845 RB3 boards.
--- sound/soc/qcom/qdsp6/q6asm-dai.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
sound/soc/qcom/qdsp6/q6asm-dai.c +13 -6
@@ -902,9 +902,7 @@ static int q6asm_dai_compr_set_params(stif (ret <0 ) {dev_err (dev,"q6asm_open_write failed\n" ); -q6asm_audio_client_free (prtd->audio_client); - prtd->audio_client =NULL ; -return ret; + goto open_err; } }
@@ -913,7 +911,7 @@ static int q6asm_dai_compr_set_params(st prtd->session_id, dir);if (ret) {dev_err (dev,"Stream reg failed ret:%d\n" , ret); -return ret; + goto q6_err; } ret = __q6asm_dai_compr_set_codec_params(component, stream,
@@ -921,7 +919,7 @@ static int q6asm_dai_compr_set_params(st prtd->stream_id);if (ret) {dev_err (dev,"codec param setup failed ret:%d\n" , ret); -return ret; + goto q6_err; } ret = q6asm_map_memory_regions(dir, prtd->audio_client, prtd->phys,
@@ -930,12 +928,21 @@ static int q6asm_dai_compr_set_params(stif (ret <0 ) {dev_err (dev,"Buffer Mapping failed ret:%d\n" , ret); -return -ENOMEM ; + ret = -ENOMEM ; + goto q6_err; } prtd->state =Q6ASM_STREAM_RUNNING ;return 0 ; + +q6_err: +q6asm_cmd (prtd->audio_client, prtd->stream_id,CMD_CLOSE ); + +open_err: +q6asm_audio_client_free (prtd->audio_client); + prtd->audio_client =NULL ; +return ret; } static int q6asm_dai_compr_set_metadata(struct snd_soc_component *component,
Greg Kroah-Hartman
maintainerPATCH 112/291 bus: mhi: host: Fix race between unprepare and queue_buf
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Hugo <[email protected]>
commit 0686a818d77a431fc3ba2fab4b46bbb04e8c9380 upstream.
A client driver may use mhi_unprepare_from_transfer() to quiesce incoming data during the client driver's tear down. The client driver might also be processing data at the same time, resulting in a call to mhi_queue_buf() which will invoke mhi_gen_tre(). If mhi_gen_tre() runs after mhi_unprepare_from_transfer() has torn down the channel, a panic will occur due to an invalid dereference leading to a page fault.
This occurs because mhi_gen_tre() does not verify the channel state after locking it. Fix this by having mhi_gen_tre() confirm the channel state is valid, or return error to avoid accessing deinitialized data.
--- drivers/bus/mhi/host/main.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/bus/mhi/host/main.c +10 -6
@@ -1201,11 +1201,16 @@ int mhi_gen_tre(struct mhi_controller *mstruct mhi_ring_element *mhi_tre;struct mhi_buf_info *buf_info;int eot, eob, chain, bei; -int ret; +int ret =0 ;/* Protect accesses for reading and incrementing WP */ write_lock_bh (&mhi_chan->lock); +if (mhi_chan->ch_state !=MHI_CH_STATE_ENABLED ) { + ret = -ENODEV ; + goto out; + } + buf_ring = &mhi_chan->buf_ring; tre_ring = &mhi_chan->tre_ring;
@@ -1223,10 +1228,8 @@ int mhi_gen_tre(struct mhi_controller *mif (!info->pre_mapped) { ret = mhi_cntrl->map_single (mhi_cntrl, buf_info); -if (ret) { -write_unlock_bh (&mhi_chan->lock); -return ret; - } +if (ret) + goto out; } eob = !!(flags &MHI_EOB );
@@ -1243,9 +1246,10 @@ int mhi_gen_tre(struct mhi_controller *mmhi_add_ring_element (mhi_cntrl, tre_ring);mhi_add_ring_element (mhi_cntrl, buf_ring); +out:write_unlock_bh (&mhi_chan->lock); -return 0 ; +return ret; } int mhi_queue_buf(struct mhi_device *mhi_dev, enum dma_data_direction dir,
Greg Kroah-Hartman
maintainerPATCH 113/291 ext4: fix off-by-one error in do_split
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Sadovnikov <[email protected]>
commit 94824ac9a8aaf2fb3c54b4bdde842db80ffa555d upstream.
Syzkaller detected a use-after-free issue in ext4_insert_dentry that was caused by out-of-bounds access due to incorrect splitting in do_split.
BUG: KASAN: use-after-free in ext4_insert_dentry+0x36a/0x6d0 fs/ext4/namei.c:2109 Write of size 251 at addr ffff888074572f14 by task syz-executor335/5847 CPU: 0 UID: 0 PID: 5847 Comm: syz-executor335 Not tainted 6.12.0-rc6-syzkaller-00318-ga9cda7c0ffed #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189 __asan_memcpy+0x40/0x70 mm/kasan/shadow.c:106 ext4_insert_dentry+0x36a/0x6d0 fs/ext4/namei.c:2109 add_dirent_to_buf+0x3d9/0x750 fs/ext4/namei.c:2154 make_indexed_dir+0xf98/0x1600 fs/ext4/namei.c:2351 ext4_add_entry+0x222a/0x25d0 fs/ext4/namei.c:2455 ext4_add_nondir+0x8d/0x290 fs/ext4/namei.c:2796 ext4_symlink+0x920/0xb50 fs/ext4/namei.c:3431 vfs_symlink+0x137/0x2e0 fs/namei.c:4615 do_symlinkat+0x222/0x3a0 fs/namei.c:4641 __do_sys_symlink fs/namei.c:4662 [inline] __se_sys_symlink fs/namei.c:4660 [inline] __x64_sys_symlink+0x7a/0x90 fs/namei.c:4660 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK>
The following loop is located right above 'if' statement.
for (i = count-1; i >= 0; i--) {
/* is more than half of this entry in 2nd half of the block? */
if (size + map[i].size/2 > blocksize/2)
break;
size += map[i].size;
move++;
}'i' in this case could go down to -1, in which case sum of active entries wouldn't exceed half the block size, but previous behaviour would also do split in half if sum would exceed at the very last block, which in case of having too many long name files in a single block could lead to out-of-bounds access and following use-after-free.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- fs/ext4/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/namei.c +1 -1
@@ -2041,7 +2041,7 @@ static struct ext4_dir_entry_2 *do_split* split it in half by count; each resulting block will have at least * half the space free. */ -if (i >0 ) +if (i >=0 ) split = count - move;else split = count/2 ;
Greg Kroah-Hartman
maintainerPATCH 114/291 vdpa/mlx5: Fix oversized null mkey longer than 32bit
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Si-Wei Liu <[email protected]>
commit a6097e0a54a5c24f8d577ffecbc35289ae281c2e upstream.
create_user_mr() has correct code to count the number of null keys used to fill in a hole for the memory map. However, fill_indir() does not follow the same to cap the range up to the 1GB limit correspondingly. Fill in more null keys for the gaps in between, so that null keys are correctly populated.
Message-Id: <[email protected]>
--- drivers/vdpa/mlx5/core/mr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/vdpa/mlx5/core/mr.c +5 -2
@@ -166,9 +166,12 @@ again: klm->bcount =cpu_to_be32 (klm_bcount (dmr->end - dmr->start)); preve = dmr->end; }else { +u64 bcount =min_t (u64, dmr->start - preve,MAX_KLM_SIZE ); + klm->key =cpu_to_be32 (mvdev->res.null_mkey); - klm->bcount =cpu_to_be32 (klm_bcount (dmr->start - preve)); - preve = dmr->start; + klm->bcount =cpu_to_be32 (klm_bcount (bcount)); + preve += bcount; + goto again; } }
Greg Kroah-Hartman
maintainerPATCH 115/291 soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenyuan Yang <[email protected]>
commit c8222ef6cf29dd7cad21643228f96535cc02b327 upstream.
soc_dev_attr->revision could be NULL, thus,
a pointer check is added to prevent potential NULL pointer dereference. This is similar to the fix in commit 3027e7b15b02
("ice: Fix some null pointer dereference issues in ice_ptp.c").
This issue is found by our static analysis tool.
--- drivers/soc/samsung/exynos-chipid.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/soc/samsung/exynos-chipid.c +2 -0
@@ -131,6 +131,8 @@ static int exynos_chipid_probe(struct pl soc_dev_attr->revision =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%x" , soc_info.revision); +if (!soc_dev_attr->revision) +return -ENOMEM ; soc_dev_attr->soc_id =product_id_to_soc_id (soc_info.product_id);if (!soc_dev_attr->soc_id) {pr_err ("Unknown SoC\n" );
Greg Kroah-Hartman
maintainerPATCH 116/291 smb311 client: fix missing tcon check when mounting with linux/posix extensions
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit b365b9d404b7376c60c91cd079218bfef11b7822 upstream.
When mounting the same share twice, once with the "linux" mount parameter (or equivalently "posix") and then once without (or e.g. with "nolinux"), we were incorrectly reusing the same tree connection for both mounts. This meant that the first mount of the share on the client, would cause subsequent mounts of that same share on the same client to ignore that mount parm ("linux" vs. "nolinux") and incorrectly reuse the same tcon.
--- fs/smb/client/connect.c | 2 ++ 1 file changed, 2 insertions(+)
fs/smb/client/connect.c +2 -0
@@ -2417,6 +2417,8 @@ static int match_tcon(struct cifs_tcon *return 0 ;if (tcon->nodelete != ctx->nodelete)return 0 ; +if (tcon->posix_extensions != ctx->linux_ext) +return 0 ;return 1 ; }
Greg Kroah-Hartman
maintainerPATCH 117/291 i3c: master: svc: Use readsb helper for reading MDB
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanley Chu <[email protected]>
commit c06acf7143bddaa3c0f7bedd8b99e48f6acb85c3 upstream.
The target can send the MDB byte followed by additional data bytes. The readl on MRDATAB reads one actual byte, but the readsl advances the destination pointer by 4 bytes. This causes the subsequent payload to be copied to wrong position in the destination buffer.
--- drivers/i3c/master/svc-i3c-master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i3c/master/svc-i3c-master.c +1 -1
@@ -368,7 +368,7 @@ static int svc_i3c_master_handle_ibi(str slot->len < SVC_I3C_FIFO_SIZE) { mdatactrl =readl (master->regs +SVC_I3C_MDATACTRL ); count =SVC_I3C_MDATACTRL_RXCOUNT (mdatactrl); -readsl (master->regs +SVC_I3C_MRDATAB , buf, count); +readsb (master->regs +SVC_I3C_MRDATAB , buf, count); slot->len += count; buf += count; }
Greg Kroah-Hartman
maintainerPATCH 118/291 i3c: Add NULL pointer check in i3c_master_queue_ibi()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manjunatha Venkatesh <[email protected]>
commit bd496a44f041da9ef3afe14d1d6193d460424e91 upstream.
The I3C master driver may receive an IBI from a target device that has not been probed yet. In such cases, the master calls i3c_master_queue_ibi() to queue an IBI work task, leading to "Unable to handle kernel read from unreadable memory" and resulting in a kernel panic.
Typical IBI handling flow:
1. The I3C master scans target devices and probes their respective drivers.
2. The target device driver calls i3c_device_request_ibi() to enable IBI and assigns dev->ibi = ibi.
3. The I3C master receives an IBI from the target device and calls i3c_master_queue_ibi() to queue the target device driver’s IBI handler task.
However, since target device events are asynchronous to the I3C probe sequence, step 3 may occur before step 2, causing dev->ibi to be NULL, leading to a kernel panic.
Add a NULL pointer check in i3c_master_queue_ibi() to prevent accessing an uninitialized dev->ibi, ensuring stability.
--- drivers/i3c/master.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/i3c/master.c +3 -0
@@ -2495,6 +2495,9 @@ static void i3c_master_unregister_i3c_de*/ void i3c_master_queue_ibi (struct i3c_dev_desc *dev,struct i3c_ibi_slot *slot) { +if (!dev->ibi || !slot) +return ; +atomic_inc (&dev->ibi->pending_ibis);queue_work (dev->common.master->wq, &slot->work); }
Greg Kroah-Hartman
maintainerPATCH 119/291 jbd2: remove wrong sb->s_sequence check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit e6eff39dd0fe4190c6146069cc16d160e71d1148 upstream.
Journal emptiness is not determined by sb->s_sequence == 0 but rather by sb->s_start == 0 (which is set a few lines above). Furthermore 0 is a valid transaction ID so the check can spuriously trigger. Remove the invalid WARN_ON.
--- fs/jbd2/journal.c | 1 - 1 file changed, 1 deletion(-)
fs/jbd2/journal.c +0 -1
@@ -1711,7 +1711,6 @@ int jbd2_journal_update_sb_log_tail(jour/* Log is no longer empty */ write_lock (&journal->j_state_lock); -WARN_ON (!sb->s_sequence); journal->j_flags &= ~JBD2_FLUSHED ;write_unlock (&journal->j_state_lock);
Greg Kroah-Hartman
maintainerPATCH 120/291 mfd: ene-kb3930: Fix a potential NULL pointer dereference
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenyuan Yang <[email protected]>
commit 4cdf1d2a816a93fa02f7b6b5492dc7f55af2a199 upstream.
The off_gpios could be NULL. Add missing check in the kb3930_probe(). This is similar to the issue fixed in commit b1ba8bcb2d1f ("backlight: hx8357: Fix potential NULL pointer dereference").
This was detected by our static analysis tool.
--- drivers/mfd/ene-kb3930.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/ene-kb3930.c +1 -1
@@ -162,7 +162,7 @@ static int kb3930_probe(struct i2c_cliendevm_gpiod_get_array_optional (dev,"off" ,GPIOD_IN );if (IS_ERR (ddata->off_gpios))return PTR_ERR (ddata->off_gpios); -if (ddata->off_gpios->ndescs <2 ) { +if (ddata->off_gpios && ddata->off_gpios->ndescs <2 ) {dev_err (dev,"invalid off-gpios property\n" );return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 121/291 locking/lockdep: Decrease nr_unused_locks if lock unused in zap_class()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boqun Feng <[email protected]>
commit 495f53d5cca0f939eaed9dca90b67e7e6fb0e30c upstream.
Currently, when a lock class is allocated, nr_unused_locks will be increased by 1, until it gets used: nr_unused_locks will be decreased by 1 in mark_lock(). However, one scenario is missed: a lock class may be zapped without even being used once. This could result into a situation that nr_unused_locks != 0 but no unused lock class is active in the system, and when cat /proc/lockdep_stats, a WARN_ON() will be triggered in a CONFIG_DEBUG_LOCKDEP=y kernel:
[...] DEBUG_LOCKS_WARN_ON(debug_atomic_read(nr_unused_locks) != nr_unused)
[...] WARNING: CPU: 41 PID: 1121 at kernel/locking/lockdep_proc.c:283 lockdep_stats_show+0xba9/0xbd0
And as a result, lockdep will be disabled after this.
Therefore, nr_unused_locks needs to be accounted correctly at zap_class() time.
--- kernel/locking/lockdep.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/locking/lockdep.c +3 -0
@@ -6021,6 +6021,9 @@ static void zap_class(struct pending_frehlist_del_rcu (&class->hash_entry);WRITE_ONCE (class->key,NULL );WRITE_ONCE (class->name,NULL ); +/* Class allocated but not used, -1 in nr_unused_locks */ +if (class->usage_mask ==0 ) +debug_atomic_dec (nr_unused_locks); nr_lock_classes--;__clear_bit (class - lock_classes, lock_classes_in_use);if (class - lock_classes == max_lock_class_idx)
Greg Kroah-Hartman
maintainerPATCH 122/291 lib: scatterlist: fix sg_split_phys to preserve original scatterlist offsets
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: T Pratham <[email protected]>
commit 8b46fdaea819a679da176b879e7b0674a1161a5e upstream.
The split_sg_phys function was incorrectly setting the offsets of all scatterlist entries (except the first) to 0. Only the first scatterlist entry's offset and length needs to be modified to account for the skip. Setting the rest entries' offsets to 0 could lead to incorrect data access.
I am using this function in a crypto driver that I'm currently developing (not yet sent to mailing list). During testing, it was observed that the output scatterlists (except the first one) contained incorrect garbage data.
I narrowed this issue down to the call of sg_split(). Upon debugging inside this function, I found that this resetting of offset is the cause of the problem, causing the subsequent scatterlists to point to incorrect memory locations in a page. By removing this code, I am obtaining expected data in all the split output scatterlists. Thus, this was indeed causing observable runtime effects!
This patch removes the offending code, ensuring that the page offsets in the input scatterlist are preserved in the output scatterlist.
--- lib/sg_split.c | 2 -- 1 file changed, 2 deletions(-)
lib/sg_split.c +0 -2
@@ -88,8 +88,6 @@ static void sg_split_phys(struct sg_spliif (!j) { out_sg->offset += split->skip_sg0; out_sg->length -= split->skip_sg0; - }else { - out_sg->offset =0 ; }sg_dma_address (out_sg) =0 ;sg_dma_len (out_sg) =0 ;
Greg Kroah-Hartman
maintainerPATCH 123/291 mptcp: fix NULL pointer in can_accept_new_subflow
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gang Yan <[email protected]>
commit 443041deb5ef6a1289a99ed95015ec7442f141dc upstream.
When testing valkey benchmark tool with MPTCP, the kernel panics in 'mptcp_can_accept_new_subflow' because subflow_req->msk is NULL.
Call trace: mptcp_can_accept_new_subflow (./net/mptcp/subflow.c:63 (discriminator 4)) (P) subflow_syn_recv_sock (./net/mptcp/subflow.c:854) tcp_check_req (./net/ipv4/tcp_minisocks.c:863) tcp_v4_rcv (./net/ipv4/tcp_ipv4.c:2268) ip_protocol_deliver_rcu (./net/ipv4/ip_input.c:207) ip_local_deliver_finish (./net/ipv4/ip_input.c:234) ip_local_deliver (./net/ipv4/ip_input.c:254) ip_rcv_finish (./net/ipv4/ip_input.c:449) ...
According to the debug log, the same req received two SYN-ACK in a very short time, very likely because the client retransmits the syn ack due to multiple reasons.
Even if the packets are transmitted with a relevant time interval, they can be processed by the server on different CPUs concurrently). The 'subflow_req->msk' ownership is transferred to the subflow the first, and there will be a risk of a null pointer dereference here.
This patch fixes this issue by moving the 'subflow_req->msk' under the own_req == true conditional.
Note that the !msk check in subflow_hmac_valid() can be dropped, because the same check already exists under the own_req mpj branch where the code has been moved to.
--- net/mptcp/subflow.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
net/mptcp/subflow.c +8 -7
@@ -643,8 +643,6 @@ static bool subflow_hmac_valid(const str subflow_req =mptcp_subflow_rsk (req); msk = subflow_req->msk; -if (!msk) -return false; subflow_generate_hmac(msk->remote_key, msk->local_key, subflow_req->remote_nonce,
@@ -739,12 +737,8 @@ static struct sock *subflow_syn_recv_soc }else if (subflow_req->mp_join) {mptcp_get_options (skb, &mp_opt); -if (!(mp_opt.suboptions &OPTION_MPTCP_MPJ_ACK ) || - !subflow_hmac_valid (req, &mp_opt) || - !mptcp_can_accept_new_subflow (subflow_req->msk)) { -SUBFLOW_REQ_INC_STATS (req,MPTCP_MIB_JOINACKMAC ); +if (!(mp_opt.suboptions &OPTION_MPTCP_MPJ_ACK )) fallback = true; - } } create_child:
@@ -793,6 +787,13 @@ create_child:subflow_add_reset_reason (skb,MPTCP_RST_EPROHIBIT ); goto dispose_child; } + +if (!subflow_hmac_valid (req, &mp_opt) || + !mptcp_can_accept_new_subflow (subflow_req->msk)) { +SUBFLOW_REQ_INC_STATS (req,MPTCP_MIB_JOINACKMAC ); +subflow_add_reset_reason (skb,MPTCP_RST_EPROHIBIT ); + goto dispose_child; + }/* move the msk reference ownership to the subflow */ subflow_req->msk =NULL ;
Greg Kroah-Hartman
maintainerPATCH 124/291 mptcp: only inc MPJoinAckHMacFailure for HMAC failures
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 21c02e8272bc95ba0dd44943665c669029b42760 upstream.
Recently, during a debugging session using local MPTCP connections, I noticed MPJoinAckHMacFailure was not zero on the server side. The counter was in fact incremented when the PM rejected new subflows, because the 'subflow' limit was reached.
The fix is easy, simply dissociating the two cases: only the HMAC validation check should increase MPTCP_MIB_JOINACKMAC counter.
--- net/mptcp/subflow.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/mptcp/subflow.c +6 -2
@@ -788,12 +788,16 @@ create_child: goto dispose_child; } -if (!subflow_hmac_valid (req, &mp_opt) || - !mptcp_can_accept_new_subflow (subflow_req->msk)) { +if (!subflow_hmac_valid (req, &mp_opt)) {SUBFLOW_REQ_INC_STATS (req,MPTCP_MIB_JOINACKMAC );subflow_add_reset_reason (skb,MPTCP_RST_EPROHIBIT ); goto dispose_child; } + +if (!mptcp_can_accept_new_subflow (owner)) { +subflow_add_reset_reason (skb,MPTCP_RST_EPROHIBIT ); + goto dispose_child; + }/* move the msk reference ownership to the subflow */ subflow_req->msk =NULL ;
Greg Kroah-Hartman
maintainerPATCH 125/291 mtd: inftlcore: Add error check for inftl_read_oob()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit d027951dc85cb2e15924c980dc22a6754d100c7c upstream.
In INFTL_findwriteunit(), the return value of inftl_read_oob() need to be checked. A proper implementation can be found in INFTL_deleteblock(). The status will be set as SECTOR_IGNORE to break from the while-loop correctly if the inftl_read_oob() fails.
--- drivers/mtd/inftlcore.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/mtd/inftlcore.c +5 -4
@@ -482,10 +482,11 @@ static inline u16 INFTL_findwriteunit(st silly =MAX_LOOPS ;while (thisEUN <= inftl->lastEUN) { -inftl_read_oob (mtd, (thisEUN * inftl->EraseSize) + - blockofs,8 , &retlen, (char *)&bci); - - status = bci.Status | bci.Status1; +if (inftl_read_oob (mtd, (thisEUN * inftl->EraseSize) + + blockofs,8 , &retlen, (char *)&bci) <0 ) + status =SECTOR_IGNORE ; +else + status = bci.Status | bci.Status1;pr_debug ("INFTL: status of block %d in EUN %d is %x\n" , block , writeEUN, status);
Greg Kroah-Hartman
maintainerPATCH 126/291 mtd: rawnand: Add status chack in r852_ready()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit b79fe1829975556854665258cf4d2476784a89db upstream.
In r852_ready(), the dev get from r852_get_dev() need to be checked. An unstable device should not be ready. A proper implementation can be found in r852_read_byte(). Add a status check and return 0 when it is unstable.
--- drivers/mtd/nand/raw/r852.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/nand/raw/r852.c +3 -0
@@ -387,6 +387,9 @@ static int r852_wait(struct nand_chip *cstatic int r852_ready (struct nand_chip *chip) {struct r852_device *dev =r852_get_dev (nand_to_mtd (chip)); +if (dev->card_unstable) +return 0 ; +return !(r852_read_reg (dev,R852_CARD_STA ) &R852_CARD_STA_BUSY ); }
Greg Kroah-Hartman
maintainerPATCH 127/291 arm64: mm: Correct the update of max_pfn
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhenhua Huang <[email protected]>
commit 89f43e1ce6f60d4f44399059595ac47f7a90a393 upstream.
Hotplugged memory can be smaller than the original memory. For example, on my target:
root@genericarmv8:~# cat /sys/kernel/debug/memblock/memory 0: 0x0000000064005000..0x0000000064023fff 0 NOMAP 1: 0x0000000064400000..0x00000000647fffff 0 NOMAP 2: 0x0000000068000000..0x000000006fffffff 0 DRV_MNG 3: 0x0000000088800000..0x0000000094ffefff 0 NONE 4: 0x0000000094fff000..0x0000000094ffffff 0 NOMAP max_pfn will affect read_page_owner. Therefore, it should first compare and then select the larger value for max_pfn.
--- arch/arm64/mm/mmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/mm/mmu.c +2 -1
@@ -1578,7 +1578,8 @@ int arch_add_memory(int nid, u64 start,__remove_pgd_mapping (swapper_pg_dir,__phys_to_virt (start), size); else { - max_pfn =PFN_UP (start + size); +/* Address of hotplugged memory can be smaller */ + max_pfn =max (max_pfn,PFN_UP (start + size)); max_low_pfn = max_pfn; }
Greg Kroah-Hartman
maintainerPATCH 128/291 arm64: dts: mediatek: mt8173: Fix disp-pwm compatible string
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 46ad36002088eff8fc5cae200aa42ae9f9310ddd upstream.
The MT8173 disp-pwm device should have only one compatible string, based on the following DT validation error:
arch/arm64/boot/dts/mediatek/mt8173-elm.dtb: pwm@1401e000: compatible: 'oneOf' conditional failed, one must be fixed:
['mediatek,mt8173-disp-pwm', 'mediatek,mt6595-disp-pwm'] is too long
'mediatek,mt8173-disp-pwm' is not one of ['mediatek,mt6795-disp-pwm', 'mediatek,mt8167-disp-pwm']
'mediatek,mt8173-disp-pwm' is not one of ['mediatek,mt8186-disp-pwm', 'mediatek,mt8188-disp-pwm', 'mediatek,mt8192-disp-pwm', 'mediatek,mt8195-disp-pwm', 'mediatek,mt8365-disp-pwm'] 'mediatek,mt8173-disp-pwm' was expected
'mediatek,mt8183-disp-pwm' was expected
from schema $id: http://devicetree.org/schemas/pwm/mediatek,pwm-disp.yaml#
arch/arm64/boot/dts/mediatek/mt8173-elm.dtb: pwm@1401f000: compatible: 'oneOf' conditional failed, one must be fixed:
['mediatek,mt8173-disp-pwm', 'mediatek,mt6595-disp-pwm'] is too long
'mediatek,mt8173-disp-pwm' is not one of ['mediatek,mt6795-disp-pwm', 'mediatek,mt8167-disp-pwm']
'mediatek,mt8173-disp-pwm' is not one of ['mediatek,mt8186-disp-pwm', 'mediatek,mt8188-disp-pwm', 'mediatek,mt8192-disp-pwm', 'mediatek,mt8195-disp-pwm', 'mediatek,mt8365-disp-pwm'] 'mediatek,mt8173-disp-pwm' was expected
'mediatek,mt8183-disp-pwm' was expected
from schema $id: http://devicetree.org/schemas/pwm/mediatek,pwm-disp.yaml#
Drop the extra "mediatek,mt6595-disp-pwm" compatible string.
--- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt8173.dtsi +2 -4
@@ -1247,8 +1247,7 @@ }; pwm0: pwm@1401e000 { - compatible = "mediatek,mt8173-disp-pwm", - "mediatek,mt6595-disp-pwm"; + compatible = "mediatek,mt8173-disp-pwm"; reg = <0 0x1401e000 0 0x1000>; #pwm-cells = <2>; clocks = <&mmsys CLK_MM_DISP_PWM026M>,
@@ -1258,8 +1257,7 @@ }; pwm1: pwm@1401f000 { - compatible = "mediatek,mt8173-disp-pwm", - "mediatek,mt6595-disp-pwm"; + compatible = "mediatek,mt8173-disp-pwm"; reg = <0 0x1401f000 0 0x1000>; #pwm-cells = <2>; clocks = <&mmsys CLK_MM_DISP_PWM126M>,
Greg Kroah-Hartman
maintainerPATCH 129/291 btrfs: fix non-empty delayed iputs list on unmount due to compressed write workers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 4c782247b89376a83fa132f7d45d6977edae0629 upstream.
At close_ctree() after we have ran delayed iputs either through explicitly calling btrfs_run_delayed_iputs() or later during the call to btrfs_commit_super() or btrfs_error_commit_super(), we assert that the delayed iputs list is empty.
When we have compressed writes this assertion may fail because delayed iputs may have been added to the list after we last ran delayed iputs. This happens like this:
1) We have a compressed write bio executing;
2) We enter close_ctree() and flush the fs_info->endio_write_workers queue which is the queue used for running ordered extent completion;
3) The compressed write bio finishes and enters btrfs_finish_compressed_write_work(), where it calls btrfs_finish_ordered_extent() which in turn calls btrfs_queue_ordered_fn(), which queues a work item in the fs_info->endio_write_workers queue that we have flushed before;
4) At close_ctree() we proceed, run all existing delayed iputs and call btrfs_commit_super() (which also runs delayed iputs), but before we run the following assertion below:
ASSERT(list_empty(&fs_info->delayed_iputs))
A delayed iput is added by the step below...
5) The ordered extent completion job queued in step 3 runs and results in creating a delayed iput when dropping the last reference of the ordered extent (a call to btrfs_put_ordered_extent() made from btrfs_finish_one_ordered());
6) At this point the delayed iputs list is not empty, so the assertion at close_ctree() fails.
Fix this by flushing the fs_info->compressed_write_workers queue at close_ctree() before flushing the fs_info->endio_write_workers queue, respecting the queue dependency as the later is responsible for the execution of ordered extent completion.
--- fs/btrfs/disk-io.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
fs/btrfs/disk-io.c +12 -0
@@ -4662,6 +4662,18 @@ void __cold close_ctree(struct btrfs_fs_btrfs_flush_workqueue (fs_info->delalloc_workers);/* +* When finishing a compressed write bio we schedule a work queue item +* to finish an ordered extent - btrfs_finish_compressed_write_work() +* calls btrfs_finish_ordered_extent() which in turns does a call to +* btrfs_queue_ordered_fn(), and that queues the ordered extent +* completion either in the endio_write_workers work queue or in the +* fs_info->endio_freespace_worker work queue. We flush those queues +* below, so before we flush them we must flush this queue for the +* workers of compressed writes. +*/ +flush_workqueue (fs_info->compressed_write_workers); + +/* * After we parked the cleaner kthread, ordered extents may have * completed and created new delayed iputs. If one of the async reclaim * tasks is running and in the RUN_DELAYED_IPUTS flush state, then we
Greg Kroah-Hartman
maintainerPATCH 130/291 sparc/mm: disable preemption in lazy mmu mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryan Roberts <[email protected]>
commit a1d416bf9faf4f4871cb5a943614a07f80a7d70f upstream.
Since commit 38e0edb15bd0 ("mm/apply_to_range: call pte function with lazy updates") it's been possible for arch_[enter|leave]_lazy_mmu_mode() to be called without holding a page table lock (for the kernel mappings case), and therefore it is possible that preemption may occur while in the lazy mmu mode. The Sparc lazy mmu implementation is not robust to preemption since it stores the lazy mode state in a per-cpu structure and does not attempt to manage that state on task switch.
Powerpc had the same issue and fixed it by explicitly disabling preemption in arch_enter_lazy_mmu_mode() and re-enabling in arch_leave_lazy_mmu_mode(). See commit b9ef323ea168 ("powerpc/64s:
Disable preemption in hash lazy mmu mode").
Given Sparc's lazy mmu mode is based on powerpc's, let's fix it in the same way here.
--- arch/sparc/mm/tlb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/sparc/mm/tlb.c +4 -1
@@ -52,8 +52,10 @@ out:void arch_enter_lazy_mmu_mode (void ) { -struct tlb_batch *tb =this_cpu_ptr (&tlb_batch); +struct tlb_batch *tb; +preempt_disable (); + tb =this_cpu_ptr (&tlb_batch); tb->active =1 ; }
@@ -64,6 +66,7 @@ void arch_leave_lazy_mmu_mode(void)if (tb->tlb_nr)flush_tlb_pending (); tb->active =0 ; +preempt_enable (); } static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr,
Greg Kroah-Hartman
maintainerPATCH 131/291 mm/rmap: reject hugetlb folios in folio_make_device_exclusive()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit bc3fe6805cf09a25a086573a17d40e525208c5d8 upstream.
Even though FOLL_SPLIT_PMD on hugetlb now always fails with -EOPNOTSUPP, let's add a safety net in case FOLL_SPLIT_PMD usage would ever be reworked.
In particular, before commit 9cb28da54643 ("mm/gup: handle hugetlb in the generic follow_page_mask code"), GUP(FOLL_SPLIT_PMD) would just have returned a page. In particular, hugetlb folios that are not PMD-sized would never have been prone to FOLL_SPLIT_PMD.
hugetlb folios can be anonymous, and page_make_device_exclusive_one() is not really prepared for handling them at all. So let's spell that out.
--- mm/rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/rmap.c +1 -1
@@ -2306,7 +2306,7 @@ static bool folio_make_device_exclusive(* Restrict to anonymous folios for now to avoid potential writeback * issues. */ -if (!folio_test_anon (folio)) +if (!folio_test_anon (folio) ||folio_test_hugetlb (folio))return false;rmap_walk (folio, &rwc);
Greg Kroah-Hartman
maintainerPATCH 132/291 mm: add missing release barrier on PGDAT_RECLAIM_LOCKED unlock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathieu Desnoyers <[email protected]>
commit c0ebbb3841e07c4493e6fe351698806b09a87a37 upstream.
The PGDAT_RECLAIM_LOCKED bit is used to provide mutual exclusion of node reclaim for struct pglist_data using a single bit.
It is "locked" with a test_and_set_bit (similarly to a try lock) which provides full ordering with respect to loads and stores done within __node_reclaim().
It is "unlocked" with clear_bit(), which does not provide any ordering with respect to loads and stores done before clearing the bit.
The lack of clear_bit() memory ordering with respect to stores within __node_reclaim() can cause a subsequent CPU to fail to observe stores from a prior node reclaim. This is not an issue in practice on TSO (e.g. x86), but it is an issue on weakly-ordered architectures (e.g. arm64).
Fix this by using clear_bit_unlock rather than clear_bit to clear PGDAT_RECLAIM_LOCKED with a release memory ordering semantic.
This provides stronger memory ordering (release rather than relaxed).
--- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmscan.c +1 -1
@@ -7729,7 +7729,7 @@ int node_reclaim(struct pglist_data *pgdreturn NODE_RECLAIM_NOSCAN ; ret =__node_reclaim (pgdat, gfp_mask, order); -clear_bit (PGDAT_RECLAIM_LOCKED , &pgdat->flags); +clear_bit_unlock (PGDAT_RECLAIM_LOCKED , &pgdat->flags);if (!ret)count_vm_event (PGSCAN_ZONE_RECLAIM_FAILED );
Greg Kroah-Hartman
maintainerPATCH 133/291 mm/hwpoison: do not send SIGBUS to processes with recovered clean pages
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
commit aaf99ac2ceb7c974f758a635723eeaf48596388e upstream.
When an uncorrected memory error is consumed there is a race between the CMCI from the memory controller reporting an uncorrected error with a UCNA signature, and the core reporting and SRAR signature machine check when the data is about to be consumed.
- Background: why *UN*corrected errors tied to *C*MCI in Intel platform [1]
Prior to Icelake memory controllers reported patrol scrub events that detected a previously unseen uncorrected error in memory by signaling a broadcast machine check with an SRAO (Software Recoverable Action Optional) signature in the machine check bank. This was overkill because it's not an urgent problem that no core is on the verge of consuming that bad data. It's also found that multi SRAO UCE may cause nested MCE interrupts and finally become an IERR.
Hence, Intel downgrades the machine check bank signature of patrol scrub from SRAO to UCNA (Uncorrected, No Action required), and signal changed to #CMCI. Just to add to the confusion, Linux does take an action (in uc_decode_notifier()) to try to offline the page despite the UC*NA* signature name.
- Background: why #CMCI and #MCE race when poison is consuming in Intel platform [1]
Having decided that CMCI/UCNA is the best action for patrol scrub errors, the memory controller uses it for reads too. But the memory controller is executing asynchronously from the core, and can't tell the difference between a "real" read and a speculative read. So it will do CMCI/UCNA if an error is found in any read.
Thus:
1) Core is clever and thinks address A is needed soon, issues a speculative read.
2) Core finds it is going to use address A soon after sending the read request
3) The CMCI from the memory controller is in a race with MCE from the core that will soon try to retire the load from address A.
Quite often (because speculation has got better) the CMCI from the memory controller is delivered before the core is committed to the instruction reading address A, so the interrupt is taken, and Linux offlines the page (marking it as poison).
- Why user process is killed for instr case
Commit 046545a661af ("mm/hwpoison: fix error page recovered but reported "not recovered"") tries to fix noise message "Memory error not recovered" and skips duplicate SIGBUSs due to the race. But it also introduced a bug that kill_accessing_process() return -EHWPOISON for instr case, as result, kill_me_maybe() send a SIGBUS to user process.
If the CMCI wins that race, the page is marked poisoned when uc_decode_notifier() calls memory_failure(). For dirty pages, memory_failure() invokes try_to_unmap() with the TTU_HWPOISON flag, converting the PTE to a hwpoison entry. As a result, kill_accessing_process():
- call walk_page_range() and return 1 regardless of whether try_to_unmap() succeeds or fails,
- call kill_proc() to make sure a SIGBUS is sent
- return -EHWPOISON to indicate that SIGBUS is already sent to the process and kill_me_maybe() doesn't have to send it again.
However, for clean pages, the TTU_HWPOISON flag is cleared, leaving the PTE unchanged and not converted to a hwpoison entry. Conversely, for clean pages where PTE entries are not marked as hwpoison, kill_accessing_process() returns -EFAULT, causing kill_me_maybe() to send a SIGBUS.
Console log looks like this:
Memory failure: 0x827ca68: corrupted page was clean: dropped without side effects
Memory failure: 0x827ca68: recovery action for clean LRU page: Recovered
Memory failure: 0x827ca68: already hardware poisoned
mce: Memory error not recoveredTo fix it, return 0 for "corrupted page was clean", preventing an unnecessary SIGBUS to user process.
[1] https://lore.kernel.org/lkml/[email protected]/T/#mba94f1305b3009dd340ce4114d3221fe810d1871
--- mm/memory-failure.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
mm/memory-failure.c +8 -3
@@ -764,12 +764,17 @@ static int kill_accessing_process(structmmap_read_lock (p->mm); ret =walk_page_range (p->mm,0 ,TASK_SIZE , &hwp_walk_ops, (void *)&priv); +/* +* ret = 1 when CMCI wins, regardless of whether try_to_unmap() +* succeeds or fails, then kill the process with SIGBUS. +* ret = 0 when poison page is a clean page and it's dropped, no +* SIGBUS is needed. +*/ if (ret ==1 && priv.tk.addr)kill_proc (&priv.tk, pfn, flags); -else - ret =0 ;mmap_read_unlock (p->mm); -return ret >0 ? -EHWPOISON : -EFAULT ; + +return ret >0 ? -EHWPOISON :0 ; }static const char *action_name[] = {
Greg Kroah-Hartman
maintainerPATCH 134/291 sctp: detect and prevent references to a freed transport in sendmsg
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Cañuelo Navarro <[email protected]>
commit f1a69a940de58b16e8249dff26f74c8cc59b32be upstream.
sctp_sendmsg() re-uses associations and transports when possible by doing a lookup based on the socket endpoint and the message destination address, and then sctp_sendmsg_to_asoc() sets the selected transport in all the message chunks to be sent.
There's a possible race condition if another thread triggers the removal of that selected transport, for instance, by explicitly unbinding an address with setsockopt(SCTP_SOCKOPT_BINDX_REM), after the chunks have been set up and before the message is sent. This can happen if the send buffer is full, during the period when the sender thread temporarily releases the socket lock in sctp_wait_for_sndbuf().
This causes the access to the transport data in sctp_outq_select_transport(), when the association outqueue is flushed, to result in a use-after-free read.
This change avoids this scenario by having sctp_transport_free() signal the freeing of the transport, tagging it as "dead". In order to do this, the patch restores the "dead" bit in struct sctp_transport, which was removed in
commit 47faa1e4c50e ("sctp: remove the dead field of sctp_transport").
Then, in the scenario where the sender thread has released the socket lock in sctp_wait_for_sndbuf(), the bit is checked again after re-acquiring the socket lock to detect the deletion. This is done while holding a reference to the transport to prevent it from being freed in the process.
If the transport was deleted while the socket lock was relinquished, sctp_sendmsg_to_asoc() will return -EAGAIN to let userspace retry the send.
The bug was found by a private syzbot instance (see the error report [1] and the C reproducer that triggers it [2]).
--- include/net/sctp/structs.h | 3 ++- net/sctp/socket.c | 22 ++++++++++++++-------- net/sctp/transport.c | 2 ++ 3 files changed, 18 insertions(+), 9 deletions(-)
include/net/sctp/structs.h +2 -1
@@ -777,6 +777,7 @@ struct sctp_transport {/* Reference counting. */ refcount_t refcnt; + __u32 dead:1,/* RTO-Pending : A flag used to track if one of the DATA * chunks sent to this address is currently being * used to compute a RTT. If this flag is 0,
@@ -786,7 +787,7 @@ struct sctp_transport {* calculation completes (i.e. the DATA chunk * is SACK'd) clear this flag. */ - __u32 rto_pending:1, + rto_pending:1,/* * hb_sent : a flag that signals that we have a pending
net/sctp/socket.c +14 -8
@@ -70,8 +70,9 @@/* Forward declarations for internal helper functions. */ static bool sctp_writeable (const struct sock *sk);static void sctp_wfree (struct sk_buff *skb); -static int sctp_wait_for_sndbuf (struct sctp_association *asoc,long *timeo_p, -size_t msg_len); +static int sctp_wait_for_sndbuf (struct sctp_association *asoc, +struct sctp_transport *transport, +long *timeo_p,size_t msg_len);static int sctp_wait_for_packet (struct sock *sk,int *err,long *timeo_p);static int sctp_wait_for_connect (struct sctp_association *,long *timeo_p);static int sctp_wait_for_accept (struct sock *sk,long timeo);
@@ -1826,7 +1827,7 @@ static int sctp_sendmsg_to_asoc(struct sif (sctp_wspace (asoc) <=0 || !sk_wmem_schedule (sk, msg_len)) { timeo =sock_sndtimeo (sk, msg->msg_flags &MSG_DONTWAIT ); - err =sctp_wait_for_sndbuf (asoc, &timeo, msg_len); + err =sctp_wait_for_sndbuf (asoc, transport, &timeo, msg_len);if (err) goto err;if (unlikely (sinfo->sinfo_stream >= asoc->stream.outcnt)) {
@@ -9203,8 +9204,9 @@ void sctp_sock_rfree(struct sk_buff *skb/* Helper function to wait for space in the sndbuf. */ -static int sctp_wait_for_sndbuf (struct sctp_association *asoc,long *timeo_p, -size_t msg_len) +static int sctp_wait_for_sndbuf (struct sctp_association *asoc, +struct sctp_transport *transport, +long *timeo_p,size_t msg_len) {struct sock *sk = asoc->base.sk;long current_timeo = *timeo_p;
@@ -9214,7 +9216,9 @@ static int sctp_wait_for_sndbuf(struct spr_debug ("%s: asoc:%p, timeo:%ld, msg_len:%zu\n" , __func__, asoc, *timeo_p, msg_len); -/* Increment the association's refcnt. */ +/* Increment the transport and association's refcnt. */ +if (transport) +sctp_transport_hold (transport);sctp_association_hold (asoc);/* Wait on the association specific sndbuf space. */
@@ -9223,7 +9227,7 @@ static int sctp_wait_for_sndbuf(struct s TASK_INTERRUPTIBLE);if (asoc->base.dead) goto do_dead; -if (!*timeo_p) +if ((!*timeo_p) || (transport && transport->dead)) goto do_nonblock;if (sk->sk_err || asoc->state >=SCTP_STATE_SHUTDOWN_PENDING ) goto do_error;
@@ -9248,7 +9252,9 @@ static int sctp_wait_for_sndbuf(struct s out:finish_wait (&asoc->wait, &wait); -/* Release the association's refcnt. */ +/* Release the transport and association's refcnt. */ +if (transport) +sctp_transport_put (transport);sctp_association_put (asoc);return err;
net/sctp/transport.c +2 -0
@@ -117,6 +117,8 @@ fail:*/ void sctp_transport_free (struct sctp_transport *transport) { + transport->dead =1 ; +/* Try to delete the heartbeat timer. */ if (del_timer (&transport->hb_timer))sctp_transport_put (transport);
Greg Kroah-Hartman
maintainerPATCH 135/291 thermal/drivers/rockchip: Add missing rk3328 mapping entry
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trevor Woerner <[email protected]>
commit ee022e5cae052e0c67ca7c5fec0f2e7bc897c70e upstream.
The mapping table for the rk3328 is missing the entry for -25C which is found in the TRM section 9.5.2 "Temperature-to-code mapping".
NOTE: the kernel uses the tsadc_q_sel=1'b1 mode which is defined as:
4096-<code in table>. Whereas the table in the TRM gives the code "3774" for -25C, the kernel uses 4096-3774=322.
[Dragan Simic] : "After going through the RK3308 and RK3328 TRMs, as
well as through the downstream kernel code, it seems we may have some troubles at our hands. Let me explain, please.
To sum it up, part 1 of the RK3308 TRM v1.1 says on page 538 that the equation for the output when tsadc_q_sel equals 1 is (4096 - tsadc_q), while part 1 of the RK3328 TRM v1.2 says that the output equation is (1024 - tsadc_q) in that case.
The downstream kernel code, however, treats the RK3308 and RK3328 tables and their values as being the same. It even mentions 1024 as the "offset" value in a comment block for the rk_tsadcv3_control() function, just like the upstream code does, which is obviously wrong "offset" value when correlated with the table on page 544 of part 1 of the RK3308 TRM v1.1.
With all this in mind, it's obvious that more work is needed to make it clear where's the actual mistake (it could be that the TRM is wrong), which I'll volunteer for as part of the SoC binning project. In the meantime, this patch looks fine as-is to me, by offering what's a clear improvement to the current state of the upstream code"
--- drivers/thermal/rockchip_thermal.c | 1 + 1 file changed, 1 insertion(+)
drivers/thermal/rockchip_thermal.c +1 -0
@@ -373,6 +373,7 @@ static const struct tsadc_table rk3328_c {296, -40000}, {304, -35000}, {313, -30000}, + {322, -25000}, {331, -20000}, {340, -15000}, {349, -10000},
Greg Kroah-Hartman
maintainerPATCH 136/291 cifs: avoid NULL pointer dereference in dbg call
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandra Diupina <[email protected]>
commit b4885bd5935bb26f0a414ad55679a372e53f9b9b upstream.
cifs_server_dbg() implies server to be non-NULL so move call under condition to avoid NULL pointer dereference.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/smb/client/smb2misc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/smb/client/smb2misc.c +5 -4
@@ -814,11 +814,12 @@ smb2_handle_cancelled_close(struct cifs_WARN_ONCE (tcon->tc_count <0 ,"tcon refcount is negative" );spin_unlock (&cifs_tcp_ses_lock); -if (tcon->ses) +if (tcon->ses) { server = tcon->ses->server; - -cifs_server_dbg (FYI ,"tid=0x%x: tcon is closing, skipping async close retry of fid %llu %llu\n" , - tcon->tid, persistent_fid, volatile_fid); +cifs_server_dbg (FYI , +"tid=0x%x: tcon is closing, skipping async close retry of fid %llu %llu\n" , + tcon->tid, persistent_fid, volatile_fid); + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 137/291 cifs: fix integer overflow in match_server()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Smirnov <[email protected]>
commit 2510859475d7f46ed7940db0853f3342bf1b65ee upstream.
The echo_interval is not limited in any way during mounting, which makes it possible to write a large number to it. This can cause an overflow when multiplying ctx->echo_interval by HZ in match_server().
Add constraints for echo_interval to smb3_fs_context_parse_param().
Found by Linux Verification Center (linuxtesting.org) with Svace.
--- fs/smb/client/fs_context.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/smb/client/fs_context.c +5 -0
@@ -1111,6 +1111,11 @@ static int smb3_fs_context_parse_param(s ctx->closetimeo =HZ * result.uint_32;break ;case Opt_echo_interval: +if (result.uint_32 <SMB_ECHO_INTERVAL_MIN || + result.uint_32 >SMB_ECHO_INTERVAL_MAX ) { +cifs_errorf (fc,"echo interval is out of bounds\n" ); + goto cifs_parse_mount_err; + } ctx->echo_interval = result.uint_32;break ;case Opt_snapshot:
Greg Kroah-Hartman
maintainerPATCH 138/291 clk: qcom: gdsc: Release pm subdomains in reverse add order
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bryan O'Donoghue <[email protected]>
commit 0e6dfde439df0bb977cddd3cf7fff150a084a9bf upstream.
gdsc_unregister() should release subdomains in the reverse order to the order in which those subdomains were added.
I've made this patch a standalone patch because it facilitates a subsequent fix to stable.
--- drivers/clk/qcom/gdsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gdsc.c +1 -1
@@ -523,7 +523,7 @@ void gdsc_unregister(struct gdsc_desc *dsize_t num = desc->num;/* Remove subdomains */ -for (i =0 ; i < num; i++) { +for (i = num -1 ; i >=0 ; i--) {if (!scs[i])continue ;if (scs[i]->parent)
Greg Kroah-Hartman
maintainerPATCH 139/291 clk: qcom: gdsc: Capture pm_genpd_add_subdomain result code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bryan O'Donoghue <[email protected]>
commit 65a733464553ea192797b889d1533a1a37216f32 upstream.
Adding a new clause to this if/else I noticed the existing usage of pm_genpd_add_subdomain() wasn't capturing and returning the result code.
pm_genpd_add_subdomain() returns an int and can fail. Capture that result code and throw it up the call stack if something goes wrong.
--- drivers/clk/qcom/gdsc.c | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-)
drivers/clk/qcom/gdsc.c +27 -13
@@ -463,6 +463,23 @@ err_disable_supply:return ret; } +static void gdsc_pm_subdomain_remove (struct gdsc_desc *desc,size_t num) +{ +struct device *dev = desc->dev; +struct gdsc **scs = desc->scs; +int i; + +/* Remove subdomains */ +for (i = num -1 ; i >=0 ; i--) { +if (!scs[i]) +continue ; +if (scs[i]->parent) +pm_genpd_remove_subdomain (scs[i]->parent, &scs[i]->pd); +else if (!IS_ERR_OR_NULL (dev->pm_domain)) +pm_genpd_remove_subdomain (pd_to_genpd (dev->pm_domain), &scs[i]->pd); + } +} +int gdsc_register (struct gdsc_desc *desc,struct reset_controller_dev *rcdev,struct regmap *regmap) {
@@ -507,30 +524,27 @@ int gdsc_register(struct gdsc_desc *descif (!scs[i])continue ;if (scs[i]->parent) -pm_genpd_add_subdomain (scs[i]->parent, &scs[i]->pd); + ret =pm_genpd_add_subdomain (scs[i]->parent, &scs[i]->pd);else if (!IS_ERR_OR_NULL (dev->pm_domain)) -pm_genpd_add_subdomain (pd_to_genpd (dev->pm_domain), &scs[i]->pd); + ret =pm_genpd_add_subdomain (pd_to_genpd (dev->pm_domain), &scs[i]->pd); +if (ret) + goto err_pm_subdomain_remove; }return of_genpd_add_provider_onecell (dev->of_node, data); + +err_pm_subdomain_remove: +gdsc_pm_subdomain_remove (desc, i); + +return ret; }void gdsc_unregister (struct gdsc_desc *desc) { -int i;struct device *dev = desc->dev; -struct gdsc **scs = desc->scs;size_t num = desc->num; -/* Remove subdomains */ -for (i = num -1 ; i >=0 ; i--) { -if (!scs[i]) -continue ; -if (scs[i]->parent) -pm_genpd_remove_subdomain (scs[i]->parent, &scs[i]->pd); -else if (!IS_ERR_OR_NULL (dev->pm_domain)) -pm_genpd_remove_subdomain (pd_to_genpd (dev->pm_domain), &scs[i]->pd); - } +gdsc_pm_subdomain_remove (desc, num);of_genpd_del_provider (dev->of_node); }
Greg Kroah-Hartman
maintainerPATCH 140/291 clk: qcom: gdsc: Set retain_ff before moving to HW CTRL
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taniya Das <[email protected]>
commit 25708f73ff171bb4171950c9f4be5aa8504b8459 upstream.
Enable the retain_ff_enable bit of GDSCR only if the GDSC is already ON. Once the GDSCR moves to HW control, SW no longer can determine the state of the GDSCR and setting the retain_ff bit could destroy all the register contents we intended to save.
Therefore, move the retain_ff configuration before switching the GDSC to HW trigger mode.
--- drivers/clk/qcom/gdsc.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/clk/qcom/gdsc.c +11 -10
@@ -290,6 +290,9 @@ static int gdsc_enable(struct generic_pm*/ udelay (1 ); +if (sc->flags &RETAIN_FF_ENABLE ) +gdsc_retain_ff_on (sc); +/* Turn on HW trigger mode if supported */ if (sc->flags &HW_CTRL ) { ret =gdsc_hwctrl (sc, true);
@@ -306,9 +309,6 @@ static int gdsc_enable(struct generic_pmudelay (1 ); } -if (sc->flags &RETAIN_FF_ENABLE ) -gdsc_retain_ff_on (sc); -return 0 ; }
@@ -418,13 +418,6 @@ static int gdsc_init(struct gdsc *sc) goto err_disable_supply; } -/* Turn on HW trigger mode if supported */ -if (sc->flags &HW_CTRL ) { - ret =gdsc_hwctrl (sc, true); -if (ret <0 ) - goto err_disable_supply; - } -/* * Make sure the retain bit is set if the GDSC is already on, * otherwise we end up turning off the GDSC and destroying all
@@ -432,6 +425,14 @@ static int gdsc_init(struct gdsc *sc)*/ if (sc->flags &RETAIN_FF_ENABLE )gdsc_retain_ff_on (sc); + +/* Turn on HW trigger mode if supported */ +if (sc->flags &HW_CTRL ) { + ret =gdsc_hwctrl (sc, true); +if (ret <0 ) + goto err_disable_supply; + } + }else if (sc->flags &ALWAYS_ON ) {/* If ALWAYS_ON GDSCs are not ON, turn them ON */ gdsc_enable (&sc->pd);
Greg Kroah-Hartman
maintainerPATCH 141/291 crypto: ccp - Fix check for the primary ASP device
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Lendacky <[email protected]>
commit 07bb097b92b987db518e72525b515d77904e966e upstream.
Currently, the ASP primary device check does not have support for PCI domains, and, as a result, when the system is configured with PCI domains (PCI segments) the wrong device can be selected as primary. This results in commands submitted to the device timing out and failing. The device check also relies on specific device and function assignments that may not hold in the future.
Fix the primary ASP device check to include support for PCI domains and to perform proper checking of the Bus/Device/Function positions.
--- drivers/crypto/ccp/sp-pci.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/crypto/ccp/sp-pci.c +9 -6
@@ -179,14 +179,17 @@ static bool sp_pci_is_master(struct sp_d pdev_new =to_pci_dev (dev_new); pdev_cur =to_pci_dev (dev_cur); -if (pdev_new->bus->number < pdev_cur->bus->number) -return true; +if (pci_domain_nr (pdev_new->bus) !=pci_domain_nr (pdev_cur->bus)) +return pci_domain_nr (pdev_new->bus) <pci_domain_nr (pdev_cur->bus); -if (PCI_SLOT (pdev_new->devfn) <PCI_SLOT (pdev_cur->devfn)) -return true; +if (pdev_new->bus->number != pdev_cur->bus->number) +return pdev_new->bus->number < pdev_cur->bus->number; -if (PCI_FUNC (pdev_new->devfn) <PCI_FUNC (pdev_cur->devfn)) -return true; +if (PCI_SLOT (pdev_new->devfn) !=PCI_SLOT (pdev_cur->devfn)) +return PCI_SLOT (pdev_new->devfn) <PCI_SLOT (pdev_cur->devfn); + +if (PCI_FUNC (pdev_new->devfn) !=PCI_FUNC (pdev_cur->devfn)) +return PCI_FUNC (pdev_new->devfn) <PCI_FUNC (pdev_cur->devfn);return false; }
Greg Kroah-Hartman
maintainerPATCH 142/291 dm-ebs: fix prefetch-vs-suspend race
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 9c565428788fb9b49066f94ab7b10efc686a0a4c upstream.
There's a possible race condition in dm-ebs - dm bufio prefetch may be in progress while the device is suspended. Fix this by calling dm_bufio_client_reset in the postsuspend hook.
--- drivers/md/dm-ebs-target.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/md/dm-ebs-target.c +7 -0
@@ -389,6 +389,12 @@ static int ebs_map(struct dm_target *ti,return DM_MAPIO_REMAPPED ; } +static void ebs_postsuspend (struct dm_target *ti) +{ +struct ebs_c *ec = ti->private; +dm_bufio_client_reset (ec->bufio); +} +static void ebs_status (struct dm_target *ti,status_type_t type,unsigned int status_flags,char *result,unsigned int maxlen) {
@@ -446,6 +452,7 @@ static struct target_type ebs_target = { .ctr = ebs_ctr, .dtr = ebs_dtr, .map = ebs_map, + .postsuspend = ebs_postsuspend, .status = ebs_status, .io_hints = ebs_io_hints, .prepare_ioctl = ebs_prepare_ioctl,
Greg Kroah-Hartman
maintainerPATCH 143/291 dm-integrity: set ti->error on memory allocation failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 00204ae3d6712ee053353920e3ce2b00c35ef75b upstream.
The dm-integrity target didn't set the error string when memory allocation failed. This patch fixes it.
--- drivers/md/dm-integrity.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/md/dm-integrity.c +3 -0
@@ -4546,16 +4546,19 @@ try_smaller_buffer: ic->recalc_bitmap =dm_integrity_alloc_page_list (n_bitmap_pages);if (!ic->recalc_bitmap) { + ti->error ="Could not allocate memory for bitmap" ; r = -ENOMEM ; goto bad; } ic->may_write_bitmap =dm_integrity_alloc_page_list (n_bitmap_pages);if (!ic->may_write_bitmap) { + ti->error ="Could not allocate memory for bitmap" ; r = -ENOMEM ; goto bad; } ic->bbs =kvmalloc_array (ic->n_bitmap_blocks,sizeof (struct bitmap_block_status ),GFP_KERNEL );if (!ic->bbs) { + ti->error ="Could not allocate memory for bitmap" ; r = -ENOMEM ; goto bad; }
Greg Kroah-Hartman
maintainerPATCH 144/291 dm-verity: fix prefetch-vs-suspend race
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 2de510fccbca3d1906b55f4be5f1de83fa2424ef upstream.
There's a possible race condition in dm-verity - the prefetch work item may race with suspend and it is possible that prefetch continues to run while the device is suspended. Fix this by calling flush_workqueue and dm_bufio_client_reset in the postsuspend hook.
--- drivers/md/dm-verity-target.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/md/dm-verity-target.c +8 -0
@@ -823,6 +823,13 @@ static int verity_map(struct dm_target *return DM_MAPIO_SUBMITTED ; } +static void verity_postsuspend (struct dm_target *ti) +{ +struct dm_verity *v = ti->private; +flush_workqueue (v->verify_wq); +dm_bufio_client_reset (v->bufio); +} +/* * Status: V (valid) or C (corruption found) */
@@ -1542,6 +1549,7 @@ static struct target_type verity_target .ctr = verity_ctr, .dtr = verity_dtr, .map = verity_map, + .postsuspend = verity_postsuspend, .status = verity_status, .prepare_ioctl = verity_prepare_ioctl, .iterate_devices = verity_iterate_devices,
Greg Kroah-Hartman
maintainerPATCH 145/291 ftrace: Add cond_resched() to ftrace_graph_set_hash()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: zhoumin <[email protected]>
commit 42ea22e754ba4f2b86f8760ca27f6f71da2d982c upstream.
When the kernel contains a large number of functions that can be traced, the loop in ftrace_graph_set_hash() may take a lot of time to execute. This may trigger the softlockup watchdog.
Add cond_resched() within the loop to allow the kernel to remain responsive even when processing a large number of functions.
This matches the cond_resched() that is used in other locations of the code that iterates over all functions that can be traced.
--- kernel/trace/ftrace.c | 1 + 1 file changed, 1 insertion(+)
kernel/trace/ftrace.c +1 -0
@@ -6522,6 +6522,7 @@ ftrace_graph_set_hash(struct ftrace_hash } } } +cond_resched (); }while_for_each_ftrace_rec (); out:mutex_unlock (&ftrace_lock);
Greg Kroah-Hartman
maintainerPATCH 146/291 gpio: tegra186: fix resource handling in ACPI probe path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guixin Liu <[email protected]>
commit 8323f3a69de6f6e96bf22f32dd8e2920766050c2 upstream.
When the Tegra186 GPIO controller is probed through ACPI matching, the driver emits two error messages during probing:
"tegra186-gpio NVDA0508:00: invalid resource (null)" "tegra186-gpio NVDA0508:00: invalid resource (null)"
Fix this by getting resource first and then do the ioremap.
--- drivers/gpio/gpio-tegra186.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/gpio/gpio-tegra186.c +14 -13
@@ -753,6 +753,7 @@ static int tegra186_gpio_probe(struct plstruct gpio_irq_chip *irq;struct tegra_gpio *gpio;struct device_node *np; +struct resource *res;char **names;int err;
@@ -772,19 +773,19 @@ static int tegra186_gpio_probe(struct pl gpio->num_banks++;/* get register apertures */ - gpio->secure =devm_platform_ioremap_resource_byname (pdev,"security" ); -if (IS_ERR (gpio->secure)) { - gpio->secure =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (gpio->secure)) -return PTR_ERR (gpio->secure); - } - - gpio->base =devm_platform_ioremap_resource_byname (pdev,"gpio" ); -if (IS_ERR (gpio->base)) { - gpio->base =devm_platform_ioremap_resource (pdev,1 ); -if (IS_ERR (gpio->base)) -return PTR_ERR (gpio->base); - } + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"security" ); +if (!res) + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + gpio->secure =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (gpio->secure)) +return PTR_ERR (gpio->secure); + + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"gpio" ); +if (!res) + res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); + gpio->base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (gpio->base)) +return PTR_ERR (gpio->base); err =platform_irq_count (pdev);if (err <0 )
Greg Kroah-Hartman
maintainerPATCH 147/291 gpio: zynq: Fix wakeup source leaks on device unbind
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit c5672e310ad971d408752fce7596ed27adc6008f upstream.
Device can be unbound, so driver must also release memory for the wakeup source.
--- drivers/gpio/gpio-zynq.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-zynq.c +1 -0
@@ -1012,6 +1012,7 @@ static int zynq_gpio_remove(struct platf ret =pm_runtime_get_sync (&pdev->dev);if (ret <0 )dev_warn (&pdev->dev,"pm_runtime_get_sync() Failed\n" ); +device_init_wakeup (&pdev->dev,0 );gpiochip_remove (&gpio->chip);clk_disable_unprepare (gpio->clk);device_set_wakeup_capable (&pdev->dev,0 );
Greg Kroah-Hartman
maintainerPATCH 148/291 gve: handle overflow when reporting TX consumed descriptors
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joshua Washington <[email protected]>
commit 15970e1b23f5c25db88c613fddf9131de086f28e upstream.
When the tx tail is less than the head (in cases of wraparound), the TX consumed descriptor statistic in DQ will be reported as UINT32_MAX - head + tail, which is incorrect. Mask the difference of head and tail according to the ring size when reporting the statistic.
--- drivers/net/ethernet/google/gve/gve_ethtool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/google/gve/gve_ethtool.c +3 -1
@@ -327,7 +327,9 @@ gve_get_ethtool_stats(struct net_device*/ data[i++] =0 ; data[i++] =0 ; - data[i++] = tx->dqo_tx.tail - tx->dqo_tx.head; + data[i++] = + (tx->dqo_tx.tail - tx->dqo_tx.head) & + tx->mask; } do { start =
Greg Kroah-Hartman
maintainerPATCH 149/291 KVM: x86: Acquire SRCU in KVM_GET_MP_STATE to protect guest memory accesses
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit ef01cac401f18647d62720cf773d7bb0541827da upstream.
Acquire a lock on kvm->srcu when userspace is getting MP state to handle a rather extreme edge case where "accepting" APIC events, i.e. processing pending INIT or SIPI, can trigger accesses to guest memory. If the vCPU is in L2 with INIT *and* a TRIPLE_FAULT request pending, then getting MP state will trigger a nested VM-Exit by way of ->check_nested_events(), and emuating the nested VM-Exit can access guest memory.
The splat was originally hit by syzkaller on a Google-internal kernel, and reproduced on an upstream kernel by hacking the triple_fault_event_test selftest to stuff a pending INIT, store an MSR on VM-Exit (to generate a memory access on VMX), and do vcpu_mp_state_get() to trigger the scenario.
=============================
WARNING: suspicious RCU usage 6.14.0-rc3-b112d356288b-vmx/pi_lockdep_false_pos-lock #3 Not tainted
-----------------------------
include/linux/kvm_host.h:1058 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
1 lock held by triple_fault_ev/1256:
#0: ffff88810df5a330 (&vcpu->mutex){+.+.}-{4:4}, at: kvm_vcpu_ioctl+0x8b/0x9a0 [kvm]
stack backtrace: CPU: 11 UID: 1000 PID: 1256 Comm: triple_fault_ev Not tainted 6.14.0-rc3-b112d356288b-vmx #3 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 Call Trace: <TASK> dump_stack_lvl+0x7f/0x90 lockdep_rcu_suspicious+0x144/0x190 kvm_vcpu_gfn_to_memslot+0x156/0x180 [kvm] kvm_vcpu_read_guest+0x3e/0x90 [kvm] read_and_check_msr_entry+0x2e/0x180 [kvm_intel] __nested_vmx_vmexit+0x550/0xde0 [kvm_intel] kvm_check_nested_events+0x1b/0x30 [kvm] kvm_apic_accept_events+0x33/0x100 [kvm] kvm_arch_vcpu_ioctl_get_mpstate+0x30/0x1d0 [kvm] kvm_vcpu_ioctl+0x33e/0x9a0 [kvm] __x64_sys_ioctl+0x8b/0xb0 do_syscall_64+0x6c/0x170 entry_SYSCALL_64_after_hwframe+0x4b/0x53 </TASK>
Message-ID: <[email protected]>
--- arch/x86/kvm/x86.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kvm/x86.c +4 -0
@@ -11460,6 +11460,8 @@ int kvm_arch_vcpu_ioctl_get_mpstate(struif (kvm_mpx_supported ())kvm_load_guest_fpu (vcpu); +kvm_vcpu_srcu_read_lock (vcpu); + r =kvm_apic_accept_events (vcpu);if (r <0 ) goto out;
@@ -11473,6 +11475,8 @@ int kvm_arch_vcpu_ioctl_get_mpstate(stru mp_state->mp_state = vcpu->arch.mp_state; out: +kvm_vcpu_srcu_read_unlock (vcpu); +if (kvm_mpx_supported ())kvm_put_guest_fpu (vcpu);vcpu_put (vcpu);
Greg Kroah-Hartman
maintainerPATCH 150/291 ntb: use 64-bit arithmetic for the MSI doorbell mask
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit fd5625fc86922f36bedee5846fefd647b7e72751 upstream.
msi_db_mask is of type 'u64', still the standard 'int' arithmetic is performed to compute its value.
While most of the ntb_hw drivers actually don't utilize the higher 32 bits of the doorbell mask now, this may be the case for Switchtec - see switchtec_ntb_init_db().
Found by Linux Verification Center (linuxtesting.org) with SVACE static analysis tool.
--- drivers/ntb/ntb_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/ntb_transport.c +1 -1
@@ -1351,7 +1351,7 @@ static int ntb_transport_probe(struct nt qp_count =ilog2 (qp_bitmap);if (nt->use_msi) { qp_count -=1 ; - nt->msi_db_mask =1 << qp_count; + nt->msi_db_mask =BIT_ULL (qp_count);ntb_db_clear_mask (ndev, nt->msi_db_mask); }
Greg Kroah-Hartman
maintainerPATCH 151/291 of/irq: Fix device node refcount leakage in API of_irq_parse_one()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 0cb58d6c7b558a69957fabe159bfb184196e1e8d upstream.
of_irq_parse_one(@int_gen_dev, i, ...) will leak refcount of @i_th_phandle
int_gen_dev {
...
interrupts-extended = ..., <&i_th_phandle ...>, ...;
...
};Refcount of @i_th_phandle is increased by of_parse_phandle_with_args() but is not decreased by API of_irq_parse_one() before return, so causes refcount leakage.
Rework the refcounting to use __free() cleanup and simplify the code to have a single call to of_irq_parse_raw().
Also add comments about refcount of node @out_irq->np got by the API.
--- drivers/of/irq.c | 59 +++++++++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 32 deletions(-)
drivers/of/irq.c +27 -32
@@ -16,6 +16,7 @@#define pr_fmt (fmt) "OF: " fmt +#include <linux/cleanup.h> #include <linux/device.h> #include <linux/errno.h> #include <linux/list.h>
@@ -339,10 +340,12 @@ EXPORT_SYMBOL_GPL(of_irq_parse_raw);* This function resolves an interrupt for a node by walking the interrupt tree, * finding which interrupt controller node it is attached to, and returning the * interrupt specifier that can be used to retrieve a Linux IRQ number. +* +* Note: refcount of node @out_irq->np is increased by 1 on success. */ int of_irq_parse_one (struct device_node *device,int index,struct of_phandle_args *out_irq) { -struct device_node *p; + struct device_node __free(device_node) *p = NULL;const __be32 *addr;u32 intsize;int i, res, addr_len;
@@ -367,41 +370,33 @@ int of_irq_parse_one(struct device_node/* Try the new-style interrupts-extended first */ res =of_parse_phandle_with_args (device,"interrupts-extended" ,"#interrupt-cells" , index, out_irq); -if (!res) -return of_irq_parse_raw (addr_buf, out_irq); - -/* Look for the interrupt parent. */ - p =of_irq_find_parent (device); -if (p ==NULL ) -return -EINVAL ; - -/* Get size of interrupt specifier */ -if (of_property_read_u32 (p,"#interrupt-cells" , &intsize)) { - res = -EINVAL ; - goto out; - } - -pr_debug (" parent=%pOF, intsize=%d\n" , p, intsize); +if (!res) { + p = out_irq->np; + }else { +/* Look for the interrupt parent. */ + p =of_irq_find_parent (device); +/* Get size of interrupt specifier */ +if (!p ||of_property_read_u32 (p,"#interrupt-cells" , &intsize)) +return -EINVAL ; + +pr_debug (" parent=%pOF, intsize=%d\n" , p, intsize); + +/* Copy intspec into irq structure */ + out_irq->np = p; + out_irq->args_count = intsize; +for (i =0 ; i < intsize; i++) { + res =of_property_read_u32_index (device,"interrupts" , + (index * intsize) + i, + out_irq->args + i); +if (res) +return res; + } -/* Copy intspec into irq structure */ - out_irq->np = p; - out_irq->args_count = intsize; -for (i =0 ; i < intsize; i++) { - res =of_property_read_u32_index (device,"interrupts" , - (index * intsize) + i, - out_irq->args + i); -if (res) - goto out; +pr_debug (" intspec=%d\n" , *out_irq->args); } -pr_debug (" intspec=%d\n" , *out_irq->args); - -/* Check if there are any interrupt-map translations to process */ - res =of_irq_parse_raw (addr_buf, out_irq); - out: -of_node_put (p); -return res; +return of_irq_parse_raw (addr_buf, out_irq); }EXPORT_SYMBOL_GPL (of_irq_parse_one);
Greg Kroah-Hartman
maintainerPATCH 152/291 of/irq: Fix device node refcount leakage in API of_irq_parse_raw()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit ff93e7213d6cc8d9a7b0bc64f70ed26094e168f3 upstream.
if the node @out_irq->np got by of_irq_parse_raw() is a combo node which consists of both controller and nexus, namely, of_irq_parse_raw() returns due to condition (@ipar == @newpar), then the node's refcount was increased twice, hence causes refcount leakage.
Fix by putting @out_irq->np refcount before returning due to the condition. Also add comments about refcount of node @out_irq->np got by the API.
--- drivers/of/irq.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/of/irq.c +8 -0
@@ -166,6 +166,8 @@ const __be32 *of_irq_parse_imap_parent(c* the specifier for each map, and then returns the translated map. * * Return: 0 on success and a negative number on error +* +* Note: refcount of node @out_irq->np is increased by 1 on success. */ int of_irq_parse_raw (const __be32 *addr,struct of_phandle_args *out_irq) {
@@ -311,6 +313,12 @@ int of_irq_parse_raw(const __be32 *addr, addrsize = (imap - match_array) - intsize;if (ipar == newpar) { +/* +* We got @ipar's refcount, but the refcount was +* gotten again by of_irq_parse_imap_parent() via its +* alias @newpar. +*/ +of_node_put (ipar);pr_debug ("%pOF interrupt-map entry to self\n" , ipar);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 153/291 of/irq: Fix device node refcount leakages in of_irq_count()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit bbf71f44aaf241d853759a71de7e7ebcdb89be3d upstream.
of_irq_count() invokes of_irq_parse_one() to count IRQs, and successful invocation of the later will get device node @irq.np refcount, but the former does not put the refcount before next iteration invocation, hence causes device node refcount leakages.
Fix by putting @irq.np refcount before the next iteration invocation.
--- drivers/of/irq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/of/irq.c +3 -1
@@ -503,8 +503,10 @@ int of_irq_count(struct device_node *devstruct of_phandle_args irq;int nr =0 ; -while (of_irq_parse_one (dev, nr, &irq) ==0 ) +while (of_irq_parse_one (dev, nr, &irq) ==0 ) { +of_node_put (irq.np); nr++; + }return nr; }
Greg Kroah-Hartman
maintainerPATCH 154/291 of/irq: Fix device node refcount leakage in API irq_of_parse_and_map()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 962a2805e47b933876ba0e4c488d9e89ced2dd29 upstream.
In irq_of_parse_and_map(), refcount of device node @oirq.np was got by successful of_irq_parse_one() invocation, but it does not put the refcount before return, so causes @oirq.np refcount leakage.
Fix by putting @oirq.np refcount before return.
--- drivers/of/irq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/of/irq.c +5 -1
@@ -39,11 +39,15 @@unsigned int irq_of_parse_and_map (struct device_node *dev,int index) {struct of_phandle_args oirq; +unsigned int ret;if (of_irq_parse_one (dev, index, &oirq))return 0 ; -return irq_create_of_mapping (&oirq); + ret =irq_create_of_mapping (&oirq); +of_node_put (oirq.np); + +return ret; }EXPORT_SYMBOL_GPL (irq_of_parse_and_map);
Greg Kroah-Hartman
maintainerPATCH 155/291 of/irq: Fix device node refcount leakages in of_irq_init()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 708124d9e6e7ac5ebf927830760679136b23fdf0 upstream.
of_irq_init() will leak interrupt controller device node refcounts in two places as explained below:
1) Leak refcounts of both @desc->dev and @desc->interrupt_parent when suffers @desc->irq_init_cb() failure.
2) Leak refcount of @desc->interrupt_parent when cleans up list @intc_desc_list in the end.
Refcounts of both @desc->dev and @desc->interrupt_parent were got in the first loop, but of_irq_init() does not put them before kfree(@desc) in places mentioned above, so causes refcount leakages.
Fix by putting refcounts involved before kfree(@desc).
--- drivers/of/irq.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/of/irq.c +3 -0
@@ -627,6 +627,8 @@ void __init of_irq_init(const struct of_ __func__, desc->dev, desc->dev, desc->interrupt_parent);of_node_clear_flag (desc->dev,OF_POPULATED ); +of_node_put (desc->interrupt_parent); +of_node_put (desc->dev);kfree (desc);continue ; }
@@ -657,6 +659,7 @@ void __init of_irq_init(const struct of_ err:list_for_each_entry_safe (desc, temp_desc, &intc_desc_list, list) {list_del (&desc->list); +of_node_put (desc->interrupt_parent);of_node_put (desc->dev);kfree (desc); }
Greg Kroah-Hartman
maintainerPATCH 156/291 PCI: brcmstb: Fix missing of_node_put() in brcm_pcie_probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanimir Varbanov <[email protected]>
commit 2df181e1aea4628a8fd257f866026625d0519627 upstream.
A call to of_parse_phandle() is incrementing the refcount, and as such, the of_node_put() must be called when the reference is no longer needed.
Thus, refactor the existing code and add a missing of_node_put() call following the check to ensure that "msi_np" matches "pcie->np" and after MSI initialization, but only if the MSI support is enabled system-wide.
--- drivers/pci/controller/pcie-brcmstb.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/pci/controller/pcie-brcmstb.c +9 -4
@@ -1488,7 +1488,7 @@ static struct pci_ops brcm7425_pcie_opsstatic int brcm_pcie_probe (struct platform_device *pdev) { -struct device_node *np = pdev->dev.of_node, *msi_np; +struct device_node *np = pdev->dev.of_node;struct pci_host_bridge *bridge;const struct pcie_cfg_data *data;struct brcm_pcie *pcie;
@@ -1563,9 +1563,14 @@ static int brcm_pcie_probe(struct platfo goto fail; } - msi_np =of_parse_phandle (pcie->np,"msi-parent" ,0 ); -if (pci_msi_enabled () && msi_np == pcie->np) { - ret =brcm_pcie_enable_msi (pcie); +if (pci_msi_enabled ()) { +struct device_node *msi_np =of_parse_phandle (pcie->np,"msi-parent" ,0 ); + +if (msi_np == pcie->np) + ret =brcm_pcie_enable_msi (pcie); + +of_node_put (msi_np); +if (ret) {dev_err (pcie->dev,"probe of internal MSI failed" ); goto fail;
Greg Kroah-Hartman
maintainerPATCH 157/291 PCI: Fix reference leak in pci_alloc_child_bus()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ma Ke <[email protected]>
commit 1f2768b6a3ee77a295106e3a5d68458064923ede upstream.
If device_register(&child->dev) fails, call put_device() to explicitly release child->dev, per the comment at device_register().
Found by code review.
--- drivers/pci/probe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/pci/probe.c +4 -1
@@ -1141,7 +1141,10 @@ static struct pci_bus *pci_alloc_child_b add_dev:pci_set_bus_msi_domain (child); ret =device_register (&child->dev); -WARN_ON (ret <0 ); +if (WARN_ON (ret <0 )) { +put_device (&child->dev); +return NULL ; + }pcibios_add_bus (child);
Greg Kroah-Hartman
maintainerPATCH 158/291 pinctrl: qcom: Clear latched interrupt status when changing IRQ type
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit e225128c3f8be879e7d4eb71a25949e188b420ae upstream.
When submitting the TLMM test driver, Bjorn reported that some of the test cases are failing for GPIOs that not are backed by PDC (i.e. "non-wakeup" GPIOs that are handled directly in pinctrl-msm). Basically, lingering latched interrupt state is still being delivered at IRQ request time, e.g.:
ok 1 tlmm_test_silent_rising
tlmm_test_silent_falling: ASSERTION FAILED at drivers/pinctrl/qcom/tlmm-test.c:178 Expected atomic_read(&priv->intr_count) == 0, but
atomic_read(&priv->intr_count) == 1 (0x1)
not ok 2 tlmm_test_silent_falling
tlmm_test_silent_low: ASSERTION FAILED at drivers/pinctrl/qcom/tlmm-test.c:178
Expected atomic_read(&priv->intr_count) == 0, but
atomic_read(&priv->intr_count) == 1 (0x1) not ok 3 tlmm_test_silent_low
ok 4 tlmm_test_silent_high
Whether to report interrupts that came in while the IRQ was unclaimed doesn't seem to be well-defined in the Linux IRQ API. However, looking closer at these specific cases, we're actually reporting events that do not match the interrupt type requested by the driver:
1. After "ok 1 tlmm_test_silent_rising", the GPIO is in low state and configured for IRQF_TRIGGER_RISING.
2. (a) In preparation for "tlmm_test_silent_falling", the GPIO is switched to high state. The rising interrupt gets latched.
(b) The GPIO is re-configured for IRQF_TRIGGER_FALLING, but the latched interrupt isn't cleared.
(c) The IRQ handler is called for the latched interrupt, but there wasn't any falling edge.
3. (a) For "tlmm_test_silent_low", the GPIO remains in high state.
(b) The GPIO is re-configured for IRQF_TRIGGER_LOW. This seems to result in a phantom interrupt that gets latched.
(c) The IRQ handler is called for the latched interrupt, but the GPIO isn't in low state.
4. (a) For "tlmm_test_silent_high", the GPIO is switched to low state.
(b) This doesn't result in a latched interrupt, because RAW_STATUS_EN was cleared when masking the level-triggered interrupt.
Fix this by clearing the interrupt state whenever making any changes to the interrupt configuration. This includes previously disabled interrupts, but also any changes to interrupt polarity or detection type.
With this change, all 16 test cases are now passing for the non-wakeup GPIOs in the TLMM.
--- drivers/pinctrl/qcom/pinctrl-msm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pinctrl/qcom/pinctrl-msm.c +6 -6
@@ -1006,8 +1006,7 @@ static int msm_gpio_irq_set_type(structstruct msm_pinctrl *pctrl =gpiochip_get_data (gc);const struct msm_pingroup *g;unsigned long flags; -bool was_enabled; -u32 val; +u32 val, oldval;if (msm_gpio_needs_dual_edge_parent_workaround (d, type)) {set_bit (d->hwirq, pctrl->dual_edge_irqs);
@@ -1067,8 +1066,7 @@ static int msm_gpio_irq_set_type(struct* internal circuitry of TLMM, toggling the RAW_STATUS * could cause the INTR_STATUS to be set for EDGE interrupts. */ - val =msm_readl_intr_cfg (pctrl, g); - was_enabled = val &BIT (g->intr_raw_status_bit); + val = oldval =msm_readl_intr_cfg (pctrl, g); val |=BIT (g->intr_raw_status_bit);if (g->intr_detection_width ==2 ) { val &= ~(3 << g->intr_detection_bit);
@@ -1121,9 +1119,11 @@ static int msm_gpio_irq_set_type(struct/* * The first time we set RAW_STATUS_EN it could trigger an interrupt. * Clear the interrupt. This is safe because we have -* IRQCHIP_SET_TYPE_MASKED. +* IRQCHIP_SET_TYPE_MASKED. When changing the interrupt type, we could +* also still have a non-matching interrupt latched, so clear whenever +* making changes to the interrupt configuration. */ -if (!was_enabled) +if (val != oldval)msm_ack_intr_status (pctrl, g);if (test_bit (d->hwirq, pctrl->dual_edge_irqs))
Greg Kroah-Hartman
maintainerPATCH 159/291 selftests: mptcp: close fd_in before returning in main_loop
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geliang Tang <[email protected]>
commit c183165f87a486d5879f782c05a23c179c3794ab upstream.
The file descriptor 'fd_in' is opened when cfg_input is configured, but not closed in main_loop(), this patch fixes it.
--- tools/testing/selftests/net/mptcp/mptcp_connect.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +5 -2
@@ -1213,7 +1213,7 @@ again:/* close the client socket open only if we are not going to reconnect */ ret =copyfd_io (fd_in, fd,1 ,0 );if (ret) -return ret; + goto out;if (cfg_truncate >0 ) {shutdown (fd,SHUT_WR );
@@ -1233,7 +1233,10 @@ again:close (fd); } -return 0 ; +out: +if (cfg_input) +close (fd_in); +return ret; }int parse_proto (const char *proto)
Greg Kroah-Hartman
maintainerPATCH 160/291 arm64: errata: Add newer ARM cores to the spectre_bhb_loop_affected() lists
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit a5951389e58d2e816eed3dbec5877de9327fd881 upstream.
When comparing to the ARM list [1], it appears that several ARM cores were missing from the lists in spectre_bhb_loop_affected(). Add them.
NOTE: for some of these cores it may not matter since other ways of clearing the BHB may be used (like the CLRBHB instruction or ECBHB), but it still seems good to have all the info from ARM's whitepaper included.
[1] https://developer.arm.com/Arm%20Security%20Center/Spectre-BHB
--- arch/arm64/kernel/proton-pack.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
arch/arm64/kernel/proton-pack.c +14 -1
@@ -888,6 +888,14 @@ static u8 spectre_bhb_loop_affected(void {u8 k =0 ; +static const struct midr_range spectre_bhb_k132_list[] = { +MIDR_ALL_VERSIONS (MIDR_CORTEX_X3 ), +MIDR_ALL_VERSIONS (MIDR_NEOVERSE_V2 ), + }; +static const struct midr_range spectre_bhb_k38_list[] = { +MIDR_ALL_VERSIONS (MIDR_CORTEX_A715 ), +MIDR_ALL_VERSIONS (MIDR_CORTEX_A720 ), + };static const struct midr_range spectre_bhb_k32_list[] = {MIDR_ALL_VERSIONS (MIDR_CORTEX_A78 ),MIDR_ALL_VERSIONS (MIDR_CORTEX_A78AE ),
@@ -901,6 +909,7 @@ static u8 spectre_bhb_loop_affected(void };static const struct midr_range spectre_bhb_k24_list[] = {MIDR_ALL_VERSIONS (MIDR_CORTEX_A76 ), +MIDR_ALL_VERSIONS (MIDR_CORTEX_A76AE ),MIDR_ALL_VERSIONS (MIDR_CORTEX_A77 ),MIDR_ALL_VERSIONS (MIDR_NEOVERSE_N1 ),MIDR_ALL_VERSIONS (MIDR_QCOM_KRYO_4XX_GOLD ),
@@ -916,7 +925,11 @@ static u8 spectre_bhb_loop_affected(void {}, }; -if (is_midr_in_range_list (read_cpuid_id (), spectre_bhb_k32_list)) +if (is_midr_in_range_list (read_cpuid_id (), spectre_bhb_k132_list)) + k =132 ; +else if (is_midr_in_range_list (read_cpuid_id (), spectre_bhb_k38_list)) + k =38 ; +else if (is_midr_in_range_list (read_cpuid_id (), spectre_bhb_k32_list)) k =32 ;else if (is_midr_in_range_list (read_cpuid_id (), spectre_bhb_k24_list)) k =24 ;