5.10.180-rc1 review
Subsystems (8)
Greg Kroah-Hartman
maintainercover 5.10.180-rc1 review
This is the start of the stable review cycle for the 5.10.180 release. There are 381 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 Wed, 17 May 2023 16:16:37 +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/v5.x/stable-review/patch-5.10.180-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-5.10.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.10.180-rc1
Aurabindo Pillai <[email protected]>
drm/amd/display: Fix hang when skipping modeset
Tetsuo Handa <[email protected]>
mm/page_alloc: fix potential deadlock on zonelist_update_seq seqlock
Tian Tao <[email protected]>
drm/exynos: move to use request_irq by IRQF_NO_AUTOEN flag
Tetsuo Handa <[email protected]>
printk: declare printk_deferred_{enter,safe}() in include/linux/printk.h
Rishabh Bhatnagar <[email protected]>
KVM: x86: move guest_pv_has out of user_access section
Rishabh Bhatnagar <[email protected]>
KVM: x86: do not report preemption if the steal time cache is stale
Rishabh Bhatnagar <[email protected]>
KVM: x86: revalidate steal time cache if MSR value changes
Rishabh Bhatnagar <[email protected]>
KVM: x86: do not set st->preempted when going back to user space
Rishabh Bhatnagar <[email protected]>
KVM: x86: Remove obsolete disabling of page faults in kvm_arch_vcpu_put()
Rishabh Bhatnagar <[email protected]>
KVM: Fix steal time asm constraints
Rishabh Bhatnagar <[email protected]>
KVM: x86: Fix recording of guest steal time / preempted status
Rishabh Bhatnagar <[email protected]>
KVM: x86: Ensure PV TLB flush tracepoint reflects KVM behavior
Christoph Böhmwalder <[email protected]>
drbd: correctly submit flush bio on barrier
Ilpo Järvinen <[email protected]>
serial: 8250: Fix serial8250_tx_empty() race with DMA Tx
Theodore Ts'o <[email protected]>
ext4: fix invalid free tracking in ext4_xattr_move_to_block()
Theodore Ts'o <[email protected]>
ext4: remove a BUG_ON in ext4_mb_release_group_pa()
Theodore Ts'o <[email protected]>
ext4: bail out of ext4_xattr_ibody_get() fails for any reason
Theodore Ts'o <[email protected]>
ext4: add bounds checking in get_max_inline_xattr_value_size()
Theodore Ts'o <[email protected]>
ext4: fix deadlock when converting an inline directory in nojournal mode
Theodore Ts'o <[email protected]>
ext4: improve error recovery code paths in __ext4_remount()
Baokun Li <[email protected]>
ext4: check iomap type only if ext4_iomap_begin() does not fail
Jan Kara <[email protected]>
ext4: fix data races when using cached status extents
Tudor Ambarus <[email protected]>
ext4: avoid a potential slab-out-of-bounds in ext4_group_desc_csum
Ye Bin <[email protected]>
ext4: fix WARNING in mb_find_extent
Paolo Bonzini <[email protected]>
KVM: x86: do not report a vCPU as preempted outside instruction boundaries
Vitaly Kuznetsov <[email protected]>
KVM: x86: hyper-v: Avoid calling kvm_make_vcpus_request_mask() with vcpu_mask==NULL
Ping Cheng <[email protected]>
HID: wacom: insert timestamp to packed Bluetooth (BT) events
Ping Cheng <[email protected]>
HID: wacom: Set a default resolution for older tablets
Guchun Chen <[email protected]>
drm/amdgpu: disable sdma ecc irq only when sdma RAS is enabled in suspend
Guchun Chen <[email protected]>
drm/amdgpu/gfx: disable gfx9 cp_ecc_error_irq only when enabling legacy gfx ras
Hamza Mahfooz <[email protected]>
drm/amdgpu: fix an amdgpu_irq_put() issue in gmc_v9_0_hw_fini()
James Cowgill <[email protected]>
drm/panel: otm8009a: Set backlight parent to panel device
Jaegeuk Kim <[email protected]>
f2fs: fix potential corruption when moving a directory
Krzysztof Kozlowski <[email protected]>
ARM: dts: s5pv210: correct MIPI CSIS clock name
Krzysztof Kozlowski <[email protected]>
ARM: dts: exynos: fix WM8960 clock name in Itop Elite
Mathieu Poirier <[email protected]>
remoteproc: st: Call of_node_put() on iteration error
Mathieu Poirier <[email protected]>
remoteproc: stm32: Call of_node_put() on iteration error
Randy Dunlap <[email protected]>
sh: nmi_debug: fix return value of __setup handler
Randy Dunlap <[email protected]>
sh: init: use OF_EARLY_FLATTREE for early init
Randy Dunlap <[email protected]>
sh: mcount.S: fix build error when PRINTK is not enabled
Randy Dunlap <[email protected]>
sh: math-emu: fix macro redefined warning
Jan Kara <[email protected]>
inotify: Avoid reporting event with invalid wd
Andrey Avdeev <[email protected]>
platform/x86: touchscreen_dmi: Add info for the Dexp Ursus KX210i
Hans de Goede <[email protected]>
platform/x86: touchscreen_dmi: Add upside-down quirk for GDIX1002 ts on the Juno Tablet
Pawel Witek <[email protected]>
cifs: fix pcchunk length type in smb2_copychunk_range
Anastasia Belova <[email protected]>
btrfs: print-tree: parent bytenr must be aligned to sector size
Josef Bacik <[email protected]>
btrfs: don't free qgroup space unless specified
Filipe Manana <[email protected]>
btrfs: fix btrfs_prev_leaf() to not return the same key twice
Yang Jihong <[email protected]>
perf symbols: Fix return incorrect build_id size in elf_read_build_id()
Christophe JAILLET <[email protected]>
crypto: sun8i-ss - Fix a test in sun8i_ss_setup_ivs()
Markus Elfring <[email protected]>
perf map: Delete two variable initialisations before null pointer checks in sort__sym_from_cmp()
Arnaldo Carvalho de Melo <[email protected]>
perf pmu: zfree() expects a pointer to a pointer to zero it after freeing its contents
Kajol Jain <[email protected]>
perf vendor events power9: Remove UTF-8 characters from JSON files
Florian Fainelli <[email protected]>
net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop()
Wei Fang <[email protected]>
net: enetc: check the index of the SFI rather than the handle
Wenliang Wang <[email protected]>
virtio_net: suppress cpu stall when free_unused_bufs
Xuan Zhuo <[email protected]>
virtio_net: split free_unused_bufs()
Arınç ÜNAL <[email protected]>
net: dsa: mt7530: fix corrupt frames using trgmii on 40 MHz XTAL MT7621
Ruliang Lin <[email protected]>
ALSA: caiaq: input: Add error handling for unsupported input methods in snd_usb_caiaq_input_init
Chia-I Wu <[email protected]>
drm/amdgpu: add a missing lock for AMDGPU_SCHED
Kuniyuki Iwashima <[email protected]>
af_packet: Don't send zero-byte data in packet_sendmsg_spkt().
Shannon Nelson <[email protected]>
ionic: remove noise from ethtool rxnfc error msg
Subbaraya Sundeep <[email protected]>
octeontx2-vf: Detach LF resources on probe cleanup
Subbaraya Sundeep <[email protected]>
octeontx2-pf: Disable packet I/O for graceful exit
David Howells <[email protected]>
rxrpc: Fix hard call timeout units
Andy Moreton <[email protected]>
sfc: Fix module EEPROM reporting for QSFP modules
Victor Nogueira <[email protected]>
net/sched: act_mirred: Add carrier check
Christophe JAILLET <[email protected]>
watchdog: dw_wdt: Fix the error handling path of dw_wdt_drv_probe()
Maxim Korotkov <[email protected]>
writeback: fix call of incorrect macro
Angelo Dureghello <[email protected]>
net: dsa: mv88e6xxx: add mv88e6321 rsvd2cpu
Cong Wang <[email protected]>
sit: update dev->needed_headroom in ipip6_tunnel_bind_dev()
Vlad Buslov <[email protected]>
net/sched: cls_api: remove block_cb from driver_list before freeing
Cosmo Chou <[email protected]>
net/ncsi: clear Tx enable mode when handling a Config required AEN
Zheng Wang <[email protected]>
scsi: qedi: Fix use after free bug in qedi_remove()
Yeongjin Gil <[email protected]>
dm verity: fix error handling for check_at_most_once on FEC
Akilesh Kailash <[email protected]>
dm verity: skip redundant verity_handle_err() on I/O errors
Tanmay Shah <[email protected]>
mailbox: zynqmp: Fix counts of child nodes
Christophe JAILLET <[email protected]>
mailbox: zynq: Switch to flexible array to simplify code
Jeremi Piotrowski <[email protected]>
crypto: ccp - Clear PSP interrupt status register before calling handler
Tze-nan Wu <[email protected]>
ring-buffer: Ensure proper resetting of atomic variables in ring_buffer_reset_online_cpus
Ilpo Järvinen <[email protected]>
tty: Prevent writing chars during tcsetattr TCSADRAIN/FLUSH
Greg Kroah-Hartman <[email protected]>
tty: clean include/linux/tty.h up
Greg Kroah-Hartman <[email protected]>
tty: move some tty-only functions to drivers/tty/tty.h
Greg Kroah-Hartman <[email protected]>
tty: move some internal tty lock enums and functions out of tty.h
Greg Kroah-Hartman <[email protected]>
tty: audit: move some local functions out of tty.h
Greg Kroah-Hartman <[email protected]>
tty: create internal tty.h file
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: deactivate anonymous set from preparation phase
Shin'ichiro Kawasaki <[email protected]>
scsi: target: core: Avoid smp_processor_id() in preemptible code
Vincent Guittot <[email protected]>
arm64: dts: qcom: sdm845: correct dynamic power coefficients - again
Miles Chen <[email protected]>
sound/oss/dmasound: fix 'dmasound_setup' defined but not used
Thomas Gleixner <[email protected]>
debugobject: Ensure pool refill (again)
Ard Biesheuvel <[email protected]>
arm64: Stash shadow stack pointer in the task struct on interrupt
Ard Biesheuvel <[email protected]>
arm64: Always load shadow stack pointer directly from the task struct
Adrian Hunter <[email protected]>
perf intel-pt: Fix CYC timestamps after standalone CBR
Adrian Hunter <[email protected]>
perf auxtrace: Fix address filter entire kernel size
Mike Snitzer <[email protected]>
dm ioctl: fix nested locking in table_clear() to remove deadlock concern
Mikulas Patocka <[email protected]>
dm flakey: fix a crash with invalid table line
Mike Snitzer <[email protected]>
dm integrity: call kmem_cache_destroy() in dm_integrity_init() error path
Mike Snitzer <[email protected]>
dm clone: call kmem_cache_destroy() in dm_clone_init() error path
Hugh Dickins <[email protected]>
ia64: fix an addr to taddr in huge_pte_offset()
Stefan Haberland <[email protected]>
s390/dasd: fix hanging blockdevice after request requeue
Qu Wenruo <[email protected]>
btrfs: scrub: reject unsupported scrub flags
Peng Liu <[email protected]>
scripts/gdb: fix lx-timerlist for Python3
Marc Dionne <[email protected]>
afs: Fix updating of i_size with dv jump from server
Matthias Schiffer <[email protected]>
mfd: tqmx86: Correct board names for TQMxE39x
Matthias Schiffer <[email protected]>
mfd: tqmx86: Specify IO port register range more precisely
Matthias Schiffer <[email protected]>
mfd: tqmx86: Add support for TQMx110EB and TQMxE40x
Matthias Schiffer <[email protected]>
mfd: tqmx86: Remove incorrect TQMx90UC board ID
Matthias Schiffer <[email protected]>
mfd: tqmx86: Do not access I2C_DETECT register through io_base
Kang Chen <[email protected]>
thermal/drivers/mediatek: Use devm_of_iomap to avoid resource leak in mtk_thermal_probe
Claudiu Beznea <[email protected]>
dmaengine: at_xdmac: do not enable all cyclic channels
Shunsuke Mie <[email protected]>
dmaengine: dw-edma: Fix to enable to issue dma request on DMA processing
Shunsuke Mie <[email protected]>
dmaengine: dw-edma: Fix to change for continuous transfer
Gaosheng Cui <[email protected]>
phy: tegra: xusb: Add missing tegra_xusb_port_unregister for usb2_port and ulpi_port
AngeloGioacchino Del Regno <[email protected]>
pwm: mtk-disp: Disable shadow registers before setting backlight values
Jitao Shi <[email protected]>
pwm: mtk-disp: Adjust the clocks to avoid them mismatch
Uwe Kleine-König <[email protected]>
pwm: mtk-disp: Don't check the return code of pwmchip_remove()
H. Nikolaus Schaller <[email protected]>
leds: tca6507: Fix error handling of using fwnode_property_read_string
Christophe JAILLET <[email protected]>
dmaengine: mv_xor_v2: Fix an error code.
Randy Dunlap <[email protected]>
leds: TI_LMU_COMMON: select REGMAP instead of depending on it
Ye Bin <[email protected]>
ext4: fix use-after-free read in ext4_find_extent for bigalloc + inline
Stafford Horne <[email protected]>
openrisc: Properly store r31 to pt_regs on unhandled exceptions
Qinrun Dai <[email protected]>
clocksource/drivers/davinci: Fix memory leak in davinci_timer_register when init fails
Mark Zhang <[email protected]>
RDMA/mlx5: Use correct device num_ports when modify DC
Dai Ngo <[email protected]>
SUNRPC: remove the maximum number of retries in call_bind_status
Mark Bloch <[email protected]>
RDMA/mlx5: Fix flow counter query via DEVX
Miaoqian Lin <[email protected]>
Input: raspberrypi-ts - fix refcount leak in rpi_ts_probe
Nicolas Saenz Julienne <[email protected]>
input: raspberrypi-ts: Release firmware handle when not needed
Nicolas Saenz Julienne <[email protected]>
firmware: raspberrypi: Introduce devm_rpi_firmware_get()
Trond Myklebust <[email protected]>
NFSv4.1: Always send a RECLAIM_COMPLETE after establishing lease
Patrick Kelsey <[email protected]>
IB/hfi1: Fix bugs with non-PAGE_SIZE-end multi-iovec user SDMA requests
Mike Marciniszyn <[email protected]>
IB/hfi1: Add additional usdma traces
Mike Marciniszyn <[email protected]>
IB/hfi1: Add AIP tx traces
Patrick Kelsey <[email protected]>
IB/hfi1: Fix SDMA mmu_rb_node not being evicted in LRU order
Saravanan Vajravel <[email protected]>
RDMA/srpt: Add a check for valid 'mad_agent' pointer
Mark Zhang <[email protected]>
RDMA/cm: Trace icm_send_rej event before the cm state is reset
Tetsuo Handa <[email protected]>
RDMA/siw: Remove namespace check from siw_netdev_event()
Clément Léger <[email protected]>
clk: add missing of_node_put() in "assigned-clocks" property parsing
Sebastian Reichel <[email protected]>
power: supply: generic-adc-battery: fix unit scaling
Martin Blumenstingl <[email protected]>
rtc: meson-vrtc: Use ktime_get_real_ts64() to get the current time
Dan Carpenter <[email protected]>
RDMA/mlx4: Prevent shift wrapping in set_user_sq_size()
Krzysztof Kozlowski <[email protected]>
rtc: omap: include header for omap_rtc_power_off_program prototype
Petr Mladek <[email protected]>
workqueue: Fix hung time report of worker pools
Lai Jiangshan <[email protected]>
workqueue: Rename "delayed" (delayed by active management) to "inactive"
Natalia Petrova <[email protected]>
RDMA/rdmavt: Delete unnecessary NULL check
Daniil Dulov <[email protected]>
RDMA/siw: Fix potential page_array out of range access
Claudiu Beznea <[email protected]>
clk: at91: clk-sam9x60-pll: fix return value check
Yang Jihong <[email protected]>
perf/core: Fix hardlockup failure caused by perf throttle
Nathan Lynch <[email protected]>
powerpc/rtas: use memmove for potentially overlapping buffer copy
Randy Dunlap <[email protected]>
macintosh: via-pmu-led: requires ATA to be set
Randy Dunlap <[email protected]>
powerpc/sysdev/tsi108: fix resource printk format warnings
Randy Dunlap <[email protected]>
powerpc/wii: fix resource printk format warnings
Randy Dunlap <[email protected]>
powerpc/mpc512x: fix resource printk format warning
Liang He <[email protected]>
macintosh/windfarm_smu_sat: Add missing of_node_put()
Jishnu Prakash <[email protected]>
spmi: Add a check for remove callback when removing a SPMI driver
Philipp Hortmann <[email protected]>
staging: rtl8192e: Fix W_DISABLE# does not work after stop/start
Florian Fainelli <[email protected]>
serial: 8250: Add missing wakeup event reporting
Shenwei Wang <[email protected]>
tty: serial: fsl_lpuart: adjust buffer length to the intended size
Dan Carpenter <[email protected]>
firmware: stratix10-svc: Fix an NULL vs IS_ERR() bug in probe
Chunfeng Yun <[email protected]>
usb: mtu3: fix kernel panic at qmu transfer done irq handler
Yinhao Hu <[email protected]>
usb: chipidea: fix missing goto in ci_hdrc_probe
Jon Hunter <[email protected]>
usb: gadget: tegra-xudc: Fix crash in vbus_draw
John Paul Adrian Glaubitz <[email protected]>
sh: sq: Fix incorrect element size for allocating bitmap buffer
Kevin Brodsky <[email protected]>
uapi/linux/const.h: prefer ISO-friendly __typeof__
Lars-Peter Clausen <[email protected]>
i2c: cadence: cdns_i2c_master_xfer(): Fix runtime PM leak on error path
Dhruva Gole <[email protected]>
spi: cadence-quadspi: fix suspend-resume implementations
Liliang Ye <[email protected]>
ASoC: fsl_mqs: move of_node_put() to the correct location
Suzuki K Poulose <[email protected]>
coresight: etm_pmu: Set the module field
Florian Fainelli <[email protected]>
scripts/gdb: bail early if there are no generic PD
Florian Fainelli <[email protected]>
scripts/gdb: bail early if there are no clocks
Randy Dunlap <[email protected]>
ia64: salinfo: placate defined-but-not-used warning
Randy Dunlap <[email protected]>
ia64: mm/contig: fix section mismatch warning/error
Kuppuswamy Sathyanarayanan <[email protected]>
PCI/EDR: Clear Device Status after EDR error recovery
Miquel Raynal <[email protected]>
of: Fix modalias string generation
Dae R. Jeong <[email protected]>
vmci_host: fix a race condition in vmci_host_poll() causing GPF
Christophe Leroy <[email protected]>
spi: fsl-spi: Fix CPM/QE mode Litte Endian
Uwe Kleine-König <[email protected]>
spi: qup: Don't skip cleanup in remove's error path
Randy Dunlap <[email protected]>
linux/vt_buffer.h: allow either builtin or modular for macros
Cristian Ciocaltea <[email protected]>
ASoC: es8316: Handle optional IRQ assignment
Hans de Goede <[email protected]>
ASoC: es8316: Use IRQF_NO_AUTOEN when requesting the IRQ
H. Nikolaus Schaller <[email protected]>
PCI: imx6: Install the fault handler only on compatible match
Zheng Wang <[email protected]>
usb: gadget: udc: renesas_usb3: Fix use after free bug in renesas_usb3_remove due to race condition
Uwe Kleine-König <[email protected]>
spi: imx: Don't skip cleanup in remove's error path
Minghao Chi <[email protected]>
spi: spi-imx: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
Krzysztof Kozlowski <[email protected]>
iio: light: max44009: add missing OF device matching
Marco Pagani <[email protected]>
fpga: bridge: fix kernel-doc parameter description
Prashanth K <[email protected]>
usb: dwc3: gadget: Change condition for processing suspend event
Wolfram Sang <[email protected]>
usb: host: xhci-rcar: remove leftover quirk handling
John Stultz <[email protected]>
pstore: Revert pmsg_lock back to a normal mutex
Randy Dunlap <[email protected]>
ipmi: ASPEED_BT_IPMI_BMC: select REGMAP_MMIO instead of depending on it
Kuniyuki Iwashima <[email protected]>
tcp/udp: Fix memleaks of sk and zerocopy skbs with TX timestamp.
Gencen Gan <[email protected]>
net: amd: Fix link leak when verifying config failed
Kuniyuki Iwashima <[email protected]>
netlink: Use copy_to_user() for optval in netlink_getsockopt().
Liu Jian <[email protected]>
Revert "Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work"
Ziyang Xuan <[email protected]>
ipv4: Fix potential uninit variable access bug in __ip_make_skb()
Davide Caratti <[email protected]>
net/sched: sch_fq: fix integer overflow of "credit"
Florian Westphal <[email protected]>
netfilter: nf_tables: don't write table validation state without mutex
Stanislav Fomichev <[email protected]>
bpf: Don't EFAULT for getsockopt with optval=NULL
Joe Damato <[email protected]>
ixgbe: Enable setting RSS table to default values
Joe Damato <[email protected]>
ixgbe: Allow flow hash to be set via ethtool
Johannes Berg <[email protected]>
wifi: iwlwifi: fw: fix memory leak in debugfs
Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: check firmware response size
Emmanuel Grumbach <[email protected]>
wifi: iwlwifi: make the loop for card preparation effective
Jan Kara <[email protected]>
jdb2: Don't refuse invalidation of already invalidated buffers
Tom Rix <[email protected]>
wifi: iwlwifi: fw: move memset before early return
Daniel Gabay <[email protected]>
wifi: iwlwifi: yoyo: Fix possible division by zero
Yu Kuai <[email protected]>
md/raid10: fix memleak of md thread
Yu Kuai <[email protected]>
md/raid10: fix memleak for 'conf->bio_split'
Yu Kuai <[email protected]>
md/raid10: fix leak of 'r10bio->remaining' for recovery
Daniel Borkmann <[email protected]>
bpf, sockmap: Revert buggy deadlock fix in the sockhash and sockmap
Ming Lei <[email protected]>
nvme-fcloop: fix "inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage"Keith Busch <[email protected]>
nvme: fix async event trace event
Michael Kelley <[email protected]>
nvme: handle the persistent internal error AER
Xin Liu <[email protected]>
bpf, sockmap: fix deadlocks in the sockhash and sockmap
Sebastian Reichel <[email protected]>
net: ethernet: stmmac: dwmac-rk: fix optional phy regulator handling
Shuchang Li <[email protected]>
scsi: lpfc: Fix ioremap issues in lpfc_sli4_pci_mem_setup()
Chao Yu <[email protected]>
f2fs: fix to avoid use-after-free for cached IPU bio
Kal Conley <[email protected]>
xsk: Fix unaligned descriptor validation
Herbert Xu <[email protected]>
crypto: drbg - Only fail when jent is unavailable in FIPS mode
Nicolai Stange <[email protected]>
crypto: drbg - make drbg_prepare_hrng() handle jent instantiation errors
Quentin Monnet <[email protected]>
bpftool: Fix bug for long instructions in program CFG dumps
YiFei Zhu <[email protected]>
selftests/bpf: Wait for receive in cg_storage_multi test
Simon Horman <[email protected]>
net: qrtr: correct types of trace event parameters
Wei Chen <[email protected]>
wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_reg()
Wei Chen <[email protected]>
wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_rfreg()
Suman Anna <[email protected]>
crypto: sa2ul - Select CRYPTO_DES
Christophe JAILLET <[email protected]>
crypto: caam - Clear some memory in instantiate_rng
Yangtao Li <[email protected]>
f2fs: compress: fix to call f2fs_wait_on_page_writeback() in f2fs_write_raw_pages()
Jaegeuk Kim <[email protected]>
f2fs: apply zone capacity to all zone type
Jaegeuk Kim <[email protected]>
f2fs: enforce single zone capacity
Yangtao Li <[email protected]>
f2fs: handle dqget error in f2fs_transfer_project_quota()
Danila Chernetsov <[email protected]>
scsi: megaraid: Fix mega_cmd_done() CMDID_INT_CMDS
Mike Christie <[email protected]>
scsi: target: iscsit: Fix TAS handling during conn cleanup
Mike Christie <[email protected]>
scsi: target: Fix multiple LUN_RESET handling
Mike Christie <[email protected]>
scsi: target: Make state_list per CPU
David Disseldorp <[email protected]>
scsi: target: Rename cmd.bad_sector to cmd.sense_info
David Disseldorp <[email protected]>
scsi: target: Rename struct sense_info to sense_detail
Eric Dumazet <[email protected]>
net/packet: convert po->auxdata to an atomic flag
Eric Dumazet <[email protected]>
net/packet: convert po->origdev to an atomic flag
Eric Dumazet <[email protected]>
net/packet: annotate accesses to po->xmit
Vadim Fedorenko <[email protected]>
vlan: partially enable SIOCSHWTSTAMP in container
Luis Gerhorst <[email protected]>
bpf: Remove misleading spec_v1 check on var-offset stack read
Alexander Mikhalitsyn <[email protected]>
scm: fix MSG_CTRUNC setting condition for SO_PASSSEC
Andrii Nakryiko <[email protected]>
bpf: fix precision propagation verbose logging
Andrii Nakryiko <[email protected]>
bpf: take into account liveness when propagating precision
Martin Blumenstingl <[email protected]>
wifi: rtw88: mac: Return the original error from rtw_mac_power_switch()
Martin Blumenstingl <[email protected]>
wifi: rtw88: mac: Return the original error from rtw_pwr_seq_parser()
Luis Gerhorst <[email protected]>
tools: bpftool: Remove invalid \' json escape
Fedor Pchelkin <[email protected]>
wifi: ath6kl: reduce WARN to dev_dbg() in callback
Dan Carpenter <[email protected]>
wifi: ath5k: fix an off by one check in ath5k_eeprom_read_freq_list()
Fedor Pchelkin <[email protected]>
wifi: ath9k: hif_usb: fix memory leak of remain_skbs
Alexey V. Vissarionov <[email protected]>
wifi: ath6kl: minor fix for allocation size
Sebastian Andrzej Siewior <[email protected]>
tick/common: Align tick period with the HZ tick.
Thomas Gleixner <[email protected]>
tick: Get rid of tick_period
Thomas Gleixner <[email protected]>
tick/sched: Optimize tick_do_update_jiffies64() further
Yunfeng Ye <[email protected]>
tick/sched: Reduce seqcount held scope in tick_do_update_jiffies64()
Thomas Gleixner <[email protected]>
tick/sched: Use tick_next_period for lockless quick check
Ville Syrjälä <[email protected]>
drm/i915: Make intel_get_crtc_new_encoder() less oopsy
Thomas Gleixner <[email protected]>
debugobject: Prevent init race with static objects
Sumit Garg <[email protected]>
arm64: kgdb: Set PSTATE.SS to 1 to re-enable single-step
Saurabh Sengar <[email protected]>
x86/ioapic: Don't return 0 from arch_dynirq_lower_bound()
YAN SHI <[email protected]>
regulator: stm32-pwr: fix of_iomap leak
Michał Krawczyk <[email protected]>
media: venus: dec: Fix handling of the start cmd
Fritz Koenig <[email protected]>
media: venus: vdec: Handle DRC after drain
Alexandre Courbot <[email protected]>
media: venus: preserve DRC state across seeks
Stanimir Varbanov <[email protected]>
media: venus: vdec: Make decoder return LAST flag for sufficient event
Stanimir Varbanov <[email protected]>
media: venus: vdec: Fix non reliable setting of LAST flag
Florian Fainelli <[email protected]>
media: rc: gpio-ir-recv: Fix support for wake-up
Miaoqian Lin <[email protected]>
media: rcar_fdp1: Fix refcount leak in probe and remove function
Tang Bin <[email protected]>
media: rcar_fdp1: Fix the correct variable assignments
Cai Huoqing <[email protected]>
media: rcar_fdp1: Make use of the helper function devm_platform_ioremap_resource()
Mauro Carvalho Chehab <[email protected]>
media: rcar_fdp1: fix pm_runtime_get_sync() usage count
Mauro Carvalho Chehab <[email protected]>
media: rcar_fdp1: simplify error check logic at fdp_open()
Zheng Wang <[email protected]>
media: saa7134: fix use after free bug in saa7134_finidev due to race condition
Zheng Wang <[email protected]>
media: dm1105: Fix use after free bug in dm1105_remove due to race condition
Zheng Wang <[email protected]>
media: rkvdec: fix use after free bug in rkvdec_remove
Uros Bizjak <[email protected]>
x86/apic: Fix atomic update of offset in reserve_eilvt_offset()
Douglas Anderson <[email protected]>
regulator: core: Avoid lockdep reports when resolving supplies
Douglas Anderson <[email protected]>
regulator: core: Consistently set mutex_owner when using ww_mutex_lock_slow()
Harshit Mogalapalli <[email protected]>
drm/lima/lima_drv: Add missing unwind goto in lima_pdev_probe()
H. Nikolaus Schaller <[email protected]>
ARM: dts: gta04: fix excess dma channel usage
Georgii Kruglov <[email protected]>
mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data
Roger Pau Monne <[email protected]>
ACPI: processor: Fix evaluating _PDC method when running as Xen dom0
Adam Skladowski <[email protected]>
drm: msm: adreno: Disable preemption on Adreno 510
Johan Hovold <[email protected]>
drm/msm/adreno: drop bogus pm_runtime_set_active()
Rob Clark <[email protected]>
drm/msm/adreno: Defer enabling runpm until hw_init()
Laurent Pinchart <[email protected]>
media: max9286: Free control handler
Adam Ford <[email protected]>
drm/bridge: adv7533: Fix adv7533_mode_valid for adv7533 and adv7535
Mukesh Ojha <[email protected]>
firmware: qcom_scm: Clear download bit during reboot
Jiasheng Jiang <[email protected]>
media: bdisp: Add missing check for create_workqueue
Muralidhara M K <[email protected]>
x86/MCE/AMD: Use an u64 for bank_map
Manivannan Sadhasivam <[email protected]>
ARM: dts: qcom: ipq8064: Fix the PCI I/O port range
Christian Marangi <[email protected]>
ARM: dts: qcom: ipq8064: reduce pci IO size to 64K
Manivannan Sadhasivam <[email protected]>
ARM: dts: qcom: ipq4019: Fix the PCI I/O port range
Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: msm8996: Fix the PCI I/O port range
Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: ipq8074: Fix the PCI I/O port range
Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: msm8998: Fix the PCI I/O port range
Manivannan Sadhasivam <[email protected]>
arm64: dts: qcom: sdm845: Fix the PCI I/O port range
Dmitry Baryshkov <[email protected]>
arm64: dts: qcom: sdm845: correct dynamic power coefficients
Konrad Dybcio <[email protected]>
arm64: dts: qcom: msm8998: Fix stm-stimulus-base reg name
Qiuxu Zhuo <[email protected]>
EDAC/skx: Fix overflows on the DRAM row address mapping arrays
Vinod Polimera <[email protected]>
drm/msm/disp/dpu: check for crtc enable rather than crtc active to release shared resources
Geert Uytterhoeven <[email protected]>
arm64: dts: renesas: r8a774c0: Remove bogus voltages from OPP table
Geert Uytterhoeven <[email protected]>
arm64: dts: renesas: r8a77990: Remove bogus voltages from OPP table
Miaoqian Lin <[email protected]>
soc: ti: pm33xx: Fix refcount leak in am33xx_pm_probe
Tony Lindgren <[email protected]>
soc: ti: pm33xx: Enable basic PM runtime support for genpd
Dom Cobley <[email protected]>
drm/probe-helper: Cancel previous job before starting new one
Maíra Canal <[email protected]>
drm/vgem: add missing mutex_destroy
Rob Clark <[email protected]>
drm/rockchip: Drop unbalanced obj unref
Jingbo Xu <[email protected]>
erofs: fix potential overflow calculating xattr_isize
Gao Xiang <[email protected]>
erofs: stop parsing non-compact HEAD index if clusterofs is invalid
Lino Sanfilippo <[email protected]>
tpm, tpm_tis: Claim locality when interrupts are reenabled on resume
Lino Sanfilippo <[email protected]>
tpm, tpm: Implement usage counter for locality
Lino Sanfilippo <[email protected]>
tpm, tpm_tis: Claim locality before writing interrupt registers
Lino Sanfilippo <[email protected]>
tpm, tpm_tis: Disable interrupts if tpm_tis_probe_irq() failed
Lino Sanfilippo <[email protected]>
tpm, tpm_tis: Claim locality before writing TPM_INT_ENABLE register
Lino Sanfilippo <[email protected]>
tpm, tpm_tis: Do not skip reset of original interrupt vector
Paul Moore <[email protected]>
selinux: ensure av_permissions.h is built when needed
Ondrej Mosnacek <[email protected]>
selinux: fix Makefile dependencies of flask.h
Ilpo Järvinen <[email protected]>
selftests/resctrl: Check for return value after write_schemata()
Ilpo Järvinen <[email protected]>
selftests/resctrl: Return NULL if malloc_and_init_memory() did not alloc mem
Zqiang <[email protected]>
rcu: Fix missing TICK_DEP_MASK_RCU_EXP dependency check
Quentin Schulz <[email protected]>
clk: rockchip: rk3399: allow clk_cifout to force clk_cifout_src to reparent
Bitterblue Smith <[email protected]>
wifi: rtl8xxxu: RTL8192EU always needs full init
Tanmay Shah <[email protected]>
mailbox: zynqmp: Fix typo in IPI documentation
Tanmay Shah <[email protected]>
mailbox: zynqmp: Fix IPI isr handling
Li Nan <[email protected]>
md/raid10: fix null-ptr-deref in raid10_sync_request
Ryusuke Konishi <[email protected]>
nilfs2: fix infinite loop in nilfs_mdt_get_block()
Ryusuke Konishi <[email protected]>
nilfs2: do not write dirty data after degenerating to read-only
Helge Deller <[email protected]>
parisc: Fix argument pointer in real64_call_asm()
Randy Dunlap <[email protected]>
sound/oss/dmasound: fix build when drivers are mixed =y/=m
Mårten Lindahl <[email protected]>
ubifs: Free memory for tmpfile name
Wang YanQing <[email protected]>
ubi: Fix return value overwrite issue in try_write_vid_and_data()
Zhihao Cheng <[email protected]>
ubifs: Fix memleak when insert_old_idx() failed
Zhihao Cheng <[email protected]>
Revert "ubifs: dirty_cow_znode: Fix memleak in error handling path"
Kishon Vijay Abraham I <[email protected]>
iommu/amd: Fix "Guest Virtual APIC Table Root Pointer" configuration in IRTE
Reid Tonking <[email protected]>
i2c: omap: Fix standard mode false ACK readings
Baokun Li <[email protected]>
writeback, cgroup: fix null-ptr-deref write in bdi_split_work_to_wbs
Zhang Zhengming <[email protected]>
relayfs: fix out-of-bounds access in relay_file_read
Sean Christopherson <[email protected]>
KVM: nVMX: Emulate NOPs in L2, and PAUSE if it's not intercepted
Roberto Sassu <[email protected]>
reiserfs: Add security prefix to xattr name in reiserfs_security_write()
Zheng Yejian <[email protected]>
rcu: Avoid stack overflow due to __rcu_irq_enter_check_tick() being kprobe-ed
Jonathan McDowell <[email protected]>
crypto: safexcel - Cleanup ring IRQ workqueues on load failure
Toke Høiland-Jørgensen <[email protected]>
crypto: api - Demote BUG_ON() in crypto_unregister_alg() to a WARN_ON()
Johannes Berg <[email protected]>
ring-buffer: Sync IRQ works before buffer destruction
Heiner Kallweit <[email protected]>
pwm: meson: Fix g12a ao clk81 name
Heiner Kallweit <[email protected]>
pwm: meson: Fix axg ao mux parents
Kees Cook <[email protected]>
kheaders: Use array declaration instead of char
Zhang Yuchen <[email protected]>
ipmi: fix SSIF not responding under certain cond.
Corey Minyard <[email protected]>
ipmi:ssif: Add send_retries increment
Jiaxun Yang <[email protected]>
MIPS: fw: Allow firmware to pass a empty env
Joel Fernandes (Google) <[email protected]>
tick/nohz: Fix cpu_is_hotpluggable() by checking with nohz subsystem
Johan Hovold <[email protected]>
xhci: fix debugfs register accesses while suspended
Nuno Sá <[email protected]>
staging: iio: resolver: ads1210: fix config mode
Harshad Shirwadkar <[email protected]>
ext4: use ext4_journal_start/stop for fast commit transactions
Eric Biggers <[email protected]>
blk-crypto: make blk_crypto_evict_key() more robust
Eric Biggers <[email protected]>
blk-crypto: make blk_crypto_evict_key() return void
Eric Biggers <[email protected]>
blk-mq: release crypto keyslot before reporting I/O complete
Arnaldo Carvalho de Melo <[email protected]>
perf sched: Cast PTHREAD_STACK_MIN to int as it may turn into sysconf(__SC_THREAD_STACK_MIN_VALUE)
Thomas Gleixner <[email protected]>
posix-cpu-timers: Implement the missing timer_wait_running callback
Chris Packham <[email protected]>
hwmon: (adt7475) Use device_property APIs when configuring polarity
Babu Moger <[email protected]>
hwmon: (k10temp) Check range scale when CUR_TEMP register is read-write
Johan Hovold <[email protected]>
USB: dwc3: fix runtime pm imbalance on unbind
Johan Hovold <[email protected]>
USB: dwc3: fix runtime pm imbalance on probe errors
Randy Dunlap <[email protected]>
IMA: allow/fix UML builds
Manivannan Sadhasivam <[email protected]>
PCI: qcom: Fix the incorrect register usage in v2.7.0 config
Lukas Wunner <[email protected]>
PCI: pciehp: Fix AB-BA deadlock between reset_lock and device_lock
Jiri Slaby (SUSE) <[email protected]>
wireguard: timers: cast enum limits members to int in prints
Vladimir Oltean <[email protected]>
asm-generic/io.h: suppress endianness warnings for readq() and writeq()
Hans de Goede <[email protected]>
ASoC: Intel: bytcr_rt5640: Add quirk for the Acer Iconia One 7 B1-750
Patrik Dahlström <[email protected]>
iio: adc: palmas_gpadc: fix NULL dereference on rmmod
Eugene Huang <[email protected]>
ASOC: Intel: sof_sdw: add quirk for Intel 'Rooks County' NUC M15
Stephen Boyd <[email protected]>
driver core: Don't require dynamic_debug for initcall_debug probe timing
Arınç ÜNAL <[email protected]>
USB: serial: option: add UNISOC vendor and TOZED LT70C product
Thomas Gleixner <[email protected]>
x86/fpu: Prevent FPU state corruption
Ruihan Li <[email protected]>
bluetooth: Perform careful capability checks in hci_sock_ioctl()
Daniel Vetter <[email protected]>
drm/fb-helper: set x/yres_virtual in drm_fb_helper_check_var
Jisoo Jang <[email protected]>
wifi: brcmfmac: slab-out-of-bounds read in brcmf_get_assoc_ies()
Dan Carpenter <[email protected]>
KVM: arm64: Fix buffer overflow in kvm_arm_set_fw_reg()
William Breathitt Gray <[email protected]>
counter: 104-quad-8: Fix race condition between FLAG and CNTR reads
Kuniyuki Iwashima <[email protected]>
seccomp: Move copy_seccomp() to no failure path.
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/dts/exynos4412-itop-elite.dts | 2 +- arch/arm/boot/dts/omap3-gta04.dtsi | 16 + arch/arm/boot/dts/qcom-ipq4019.dtsi | 4 +- arch/arm/boot/dts/qcom-ipq8064.dtsi | 12 +- arch/arm/boot/dts/s5pv210.dtsi | 2 +- arch/arm64/boot/dts/qcom/ipq8074.dtsi | 12 +- arch/arm64/boot/dts/qcom/msm8996.dtsi | 12 +- arch/arm64/boot/dts/qcom/msm8998.dtsi | 4 +- arch/arm64/boot/dts/qcom/sdm845.dtsi | 30 +- arch/arm64/boot/dts/renesas/r8a774c0.dtsi | 3 - arch/arm64/boot/dts/renesas/r8a77990.dtsi | 3 - arch/arm64/include/asm/debug-monitors.h | 1 + arch/arm64/include/asm/scs.h | 7 +- arch/arm64/kernel/debug-monitors.c | 5 + arch/arm64/kernel/entry.S | 12 +- arch/arm64/kernel/head.S | 2 +- arch/arm64/kernel/kgdb.c | 2 + arch/arm64/kvm/psci.c | 2 + arch/ia64/kernel/salinfo.c | 2 +- arch/ia64/mm/contig.c | 2 +- arch/ia64/mm/hugetlbpage.c | 2 +- arch/mips/fw/lib/cmdline.c | 2 +- arch/openrisc/kernel/entry.S | 6 +- arch/parisc/kernel/real2.S | 5 +- arch/powerpc/kernel/rtas.c | 2 +- arch/powerpc/platforms/512x/clock-commonclk.c | 2 +- arch/powerpc/platforms/embedded6xx/flipper-pic.c | 2 +- arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 2 +- arch/powerpc/platforms/embedded6xx/wii.c | 4 +- arch/powerpc/sysdev/tsi108_pci.c | 5 +- arch/sh/Kconfig.debug | 2 +- arch/sh/kernel/cpu/sh4/sq.c | 2 +- arch/sh/kernel/head_32.S | 6 +- arch/sh/kernel/nmi_debug.c | 4 +- arch/sh/kernel/setup.c | 4 +- arch/sh/math-emu/sfp-util.h | 4 - arch/x86/include/asm/kvm_host.h | 5 +- arch/x86/kernel/apic/apic.c | 5 +- arch/x86/kernel/apic/io_apic.c | 14 +- arch/x86/kernel/cpu/mce/amd.c | 14 +- arch/x86/kernel/fpu/core.c | 67 +-- arch/x86/kvm/hyperv.c | 15 +- arch/x86/kvm/svm/svm.c | 2 + arch/x86/kvm/vmx/vmx.c | 16 + arch/x86/kvm/x86.c | 164 ++++-- block/blk-core.c | 7 + block/blk-crypto-internal.h | 25 +- block/blk-crypto.c | 69 ++- block/blk-merge.c | 2 + block/blk-mq.c | 2 +- block/keyslot-manager.c | 43 +- crypto/algapi.c | 4 +- crypto/drbg.c | 16 +- drivers/acpi/processor_pdc.c | 11 + drivers/base/cpu.c | 3 +- drivers/base/dd.c | 7 +- drivers/block/drbd/drbd_receiver.c | 2 +- drivers/bluetooth/btsdio.c | 1 - drivers/char/ipmi/Kconfig | 3 +- drivers/char/ipmi/ipmi_ssif.c | 8 +- drivers/char/tpm/tpm_tis_core.c | 135 +++-- drivers/char/tpm/tpm_tis_core.h | 2 + drivers/clk/at91/clk-sam9x60-pll.c | 2 +- drivers/clk/clk-conf.c | 12 +- drivers/clk/rockchip/clk-rk3399.c | 2 +- drivers/clocksource/timer-davinci.c | 30 +- drivers/counter/104-quad-8.c | 28 +- drivers/crypto/Kconfig | 1 + .../crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 2 +- drivers/crypto/caam/ctrl.c | 6 +- drivers/crypto/ccp/psp-dev.c | 6 +- drivers/crypto/inside-secure/safexcel.c | 37 +- drivers/dma/at_xdmac.c | 5 +- drivers/dma/dw-edma/dw-edma-core.c | 27 +- drivers/dma/mv_xor_v2.c | 2 +- drivers/edac/skx_base.c | 4 +- drivers/firmware/qcom_scm.c | 3 +- drivers/firmware/raspberrypi.c | 29 + drivers/firmware/stratix10-svc.c | 4 +- drivers/fpga/fpga-bridge.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 6 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 - drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 +- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 3 + drivers/gpu/drm/bridge/adv7511/adv7533.c | 23 +- drivers/gpu/drm/drm_fb_helper.c | 3 + drivers/gpu/drm/drm_probe_helper.c | 5 +- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 7 +- drivers/gpu/drm/i915/display/intel_display.c | 2 +- drivers/gpu/drm/lima/lima_drv.c | 6 +- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 8 +- drivers/gpu/drm/msm/adreno/adreno_device.c | 7 +- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +- drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 3 - drivers/gpu/drm/vgem/vgem_fence.c | 1 + drivers/hid/wacom_wac.c | 38 +- drivers/hid/wacom_wac.h | 1 + drivers/hwmon/adt7475.c | 6 +- drivers/hwmon/k10temp.c | 4 +- drivers/hwtracing/coresight/coresight-etm-perf.c | 1 + drivers/i2c/busses/i2c-cadence.c | 6 +- drivers/i2c/busses/i2c-omap.c | 2 +- drivers/iio/adc/palmas_gpadc.c | 2 +- drivers/iio/light/max44009.c | 13 +- drivers/infiniband/core/cm.c | 3 +- drivers/infiniband/hw/hfi1/ipoib_tx.c | 19 +- drivers/infiniband/hw/hfi1/mmu_rb.c | 73 +-- drivers/infiniband/hw/hfi1/mmu_rb.h | 8 +- drivers/infiniband/hw/hfi1/sdma.c | 21 +- drivers/infiniband/hw/hfi1/sdma.h | 16 +- drivers/infiniband/hw/hfi1/sdma_txreq.h | 1 + drivers/infiniband/hw/hfi1/trace_mmu.h | 4 - drivers/infiniband/hw/hfi1/trace_tx.h | 179 ++++++ drivers/infiniband/hw/hfi1/user_sdma.c | 612 +++++++++++++-------- drivers/infiniband/hw/hfi1/user_sdma.h | 6 +- drivers/infiniband/hw/hfi1/verbs.c | 4 +- drivers/infiniband/hw/hfi1/vnic_sdma.c | 1 + drivers/infiniband/hw/mlx4/qp.c | 8 +- drivers/infiniband/hw/mlx5/devx.c | 31 +- drivers/infiniband/hw/mlx5/qp.c | 2 +- drivers/infiniband/sw/rdmavt/qp.c | 2 - drivers/infiniband/sw/siw/siw_main.c | 3 - drivers/infiniband/sw/siw/siw_qp_tx.c | 2 +- drivers/infiniband/ulp/isert/ib_isert.c | 4 +- drivers/infiniband/ulp/srpt/ib_srpt.c | 23 +- drivers/input/touchscreen/raspberrypi-ts.c | 3 +- drivers/iommu/amd/amd_iommu_types.h | 4 +- drivers/leds/Kconfig | 2 +- drivers/leds/leds-tca6507.c | 5 +- drivers/macintosh/Kconfig | 1 + drivers/macintosh/windfarm_smu_sat.c | 1 + drivers/mailbox/zynqmp-ipi-mailbox.c | 19 +- drivers/md/dm-clone-target.c | 1 + drivers/md/dm-flakey.c | 4 +- drivers/md/dm-integrity.c | 8 +- drivers/md/dm-ioctl.c | 7 +- drivers/md/dm-verity-target.c | 17 +- drivers/md/raid10.c | 74 +-- drivers/media/i2c/max9286.c | 1 + drivers/media/pci/dm1105/dm1105.c | 1 + drivers/media/pci/saa7134/saa7134-ts.c | 1 + drivers/media/pci/saa7134/saa7134-vbi.c | 1 + drivers/media/pci/saa7134/saa7134-video.c | 1 + drivers/media/platform/qcom/venus/core.h | 6 +- drivers/media/platform/qcom/venus/helpers.c | 6 + drivers/media/platform/qcom/venus/vdec.c | 120 ++-- drivers/media/platform/rcar_fdp1.c | 50 +- drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 2 + drivers/media/rc/gpio-ir-recv.c | 2 + drivers/mfd/tqmx86.c | 76 ++- drivers/misc/vmw_vmci/vmci_host.c | 8 +- drivers/mmc/host/sdhci-of-esdhc.c | 24 +- drivers/mtd/ubi/eba.c | 19 +- drivers/net/dsa/mt7530.c | 4 +- drivers/net/dsa/mv88e6xxx/chip.c | 1 + drivers/net/ethernet/amd/nmclan_cs.c | 2 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 1 - drivers/net/ethernet/freescale/enetc/enetc_qos.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 23 +- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 11 +- .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 2 +- .../net/ethernet/pensando/ionic/ionic_ethtool.c | 2 +- drivers/net/ethernet/sfc/mcdi_port_common.c | 11 +- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 14 +- drivers/net/virtio_net.c | 43 +- drivers/net/wireguard/timers.c | 8 +- drivers/net/wireless/ath/ath5k/eeprom.c | 2 +- drivers/net/wireless/ath/ath6kl/bmi.c | 2 +- drivers/net/wireless/ath/ath6kl/htc_pipe.c | 4 +- drivers/net/wireless/ath/ath9k/hif_usb.c | 19 + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 5 + drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 4 +- drivers/net/wireless/intel/iwlwifi/fw/debugfs.c | 4 +- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 6 + drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 10 + drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 3 +- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 1 + drivers/net/wireless/realtek/rtlwifi/debug.c | 12 +- drivers/net/wireless/realtek/rtw88/mac.c | 8 +- drivers/nvme/host/core.c | 34 +- drivers/nvme/host/trace.h | 15 +- drivers/nvme/target/fcloop.c | 48 +- drivers/of/device.c | 7 +- drivers/pci/controller/dwc/pci-imx6.c | 7 + drivers/pci/controller/dwc/pcie-qcom.c | 8 +- drivers/pci/hotplug/pciehp_pci.c | 15 + drivers/pci/pcie/edr.c | 1 + drivers/phy/tegra/xusb.c | 2 + drivers/platform/x86/touchscreen_dmi.c | 41 ++ drivers/power/supply/generic-adc-battery.c | 3 + drivers/pwm/pwm-meson.c | 6 +- drivers/pwm/pwm-mtk-disp.c | 98 ++-- drivers/regulator/core.c | 93 +++- drivers/regulator/stm32-pwr.c | 7 +- drivers/remoteproc/st_remoteproc.c | 5 +- drivers/remoteproc/stm32_rproc.c | 6 +- drivers/rtc/rtc-meson-vrtc.c | 4 +- drivers/rtc/rtc-omap.c | 1 + drivers/s390/block/dasd.c | 2 +- drivers/scsi/lpfc/lpfc_init.c | 10 +- drivers/scsi/megaraid.c | 1 + drivers/scsi/qedi/qedi_main.c | 3 + drivers/soc/ti/pm33xx.c | 22 +- drivers/spi/spi-cadence-quadspi.c | 19 +- drivers/spi/spi-fsl-spi.c | 12 +- drivers/spi/spi-imx.c | 14 +- drivers/spi/spi-qup.c | 22 +- drivers/spmi/spmi.c | 3 +- drivers/staging/iio/resolver/ad2s1210.c | 2 +- drivers/staging/media/rkvdec/rkvdec.c | 2 + drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 + drivers/target/iscsi/iscsi_target.c | 16 +- drivers/target/target_core_device.c | 17 +- drivers/target/target_core_sbc.c | 2 +- drivers/target/target_core_tmr.c | 164 +++--- drivers/target/target_core_transport.c | 59 +- drivers/target/tcm_fc/tfc_cmd.c | 2 +- drivers/thermal/mtk_thermal.c | 14 +- drivers/tty/n_gsm.c | 1 + drivers/tty/n_hdlc.c | 1 + drivers/tty/n_tty.c | 1 + drivers/tty/pty.c | 1 + drivers/tty/serial/8250/8250.h | 12 + drivers/tty/serial/8250/8250_port.c | 16 +- drivers/tty/serial/fsl_lpuart.c | 2 +- drivers/tty/tty.h | 117 ++++ drivers/tty/tty_audit.c | 1 + drivers/tty/tty_baudrate.c | 1 + drivers/tty/tty_buffer.c | 2 +- drivers/tty/tty_io.c | 5 +- drivers/tty/tty_ioctl.c | 48 +- drivers/tty/tty_jobctrl.c | 1 + drivers/tty/tty_ldisc.c | 1 + drivers/tty/tty_mutex.c | 1 + drivers/tty/tty_port.c | 1 + drivers/usb/chipidea/core.c | 2 +- drivers/usb/dwc3/core.c | 15 +- drivers/usb/dwc3/gadget.c | 11 +- drivers/usb/gadget/udc/renesas_usb3.c | 1 + drivers/usb/gadget/udc/tegra-xudc.c | 2 +- drivers/usb/host/xhci-debugfs.c | 1 + drivers/usb/host/xhci-rcar.c | 3 - drivers/usb/mtu3/mtu3_qmu.c | 5 +- drivers/usb/serial/option.c | 6 + drivers/watchdog/dw_wdt.c | 7 +- drivers/xen/pcpu.c | 20 + fs/afs/inode.c | 1 + fs/btrfs/block-rsv.c | 3 +- fs/btrfs/ctree.c | 32 +- fs/btrfs/ioctl.c | 5 + fs/btrfs/print-tree.c | 6 +- fs/cifs/smb2ops.c | 2 +- fs/erofs/internal.h | 2 +- fs/erofs/zmap.c | 4 + fs/ext4/acl.c | 2 - fs/ext4/balloc.c | 25 + fs/ext4/extents.c | 5 +- fs/ext4/extents_status.c | 30 +- fs/ext4/file.c | 4 - fs/ext4/inline.c | 17 +- fs/ext4/inode.c | 9 +- fs/ext4/ioctl.c | 8 +- fs/ext4/mballoc.c | 6 +- fs/ext4/super.c | 19 +- fs/ext4/xattr.c | 5 +- fs/f2fs/compress.c | 6 + fs/f2fs/data.c | 5 +- fs/f2fs/f2fs.h | 2 +- fs/f2fs/file.c | 15 +- fs/f2fs/namei.c | 16 +- fs/f2fs/segment.c | 76 +-- fs/f2fs/segment.h | 6 + fs/f2fs/super.c | 33 +- fs/fs-writeback.c | 19 +- fs/jbd2/journal.c | 2 + fs/jbd2/transaction.c | 3 + fs/nfs/nfs4state.c | 4 + fs/nilfs2/bmap.c | 16 +- fs/nilfs2/segment.c | 5 +- fs/notify/inotify/inotify_fsnotify.c | 11 +- fs/pstore/pmsg.c | 7 +- fs/reiserfs/xattr_security.c | 8 +- fs/ubifs/dir.c | 1 + fs/ubifs/tnc.c | 144 +++-- include/asm-generic/io.h | 4 +- include/linux/blk-crypto.h | 4 +- include/linux/mailbox/zynqmp-ipi-message.h | 2 +- include/linux/mlx5/mlx5_ifc.h | 3 +- include/linux/netfilter/nfnetlink.h | 1 - include/linux/nvme.h | 4 + include/linux/posix-timers.h | 17 +- include/linux/printk.h | 19 + include/linux/sunrpc/sched.h | 3 +- include/linux/tick.h | 2 + include/linux/tty.h | 97 ---- include/linux/vt_buffer.h | 2 +- include/linux/workqueue.h | 4 +- include/net/netfilter/nf_tables.h | 1 + include/net/scm.h | 13 +- include/net/xsk_buff_pool.h | 9 +- include/soc/bcm2835/raspberrypi-firmware.h | 8 + include/target/target_core_base.h | 16 +- include/trace/events/qrtr.h | 33 +- include/trace/events/timer.h | 3 +- include/uapi/linux/btrfs.h | 1 + include/uapi/linux/const.h | 2 +- include/xen/xen.h | 11 + kernel/bpf/cgroup.c | 9 +- kernel/bpf/verifier.c | 26 +- kernel/events/core.c | 4 +- kernel/fork.c | 17 +- kernel/kheaders.c | 10 +- kernel/rcu/tree.c | 1 + kernel/relay.c | 3 +- kernel/time/posix-cpu-timers.c | 81 ++- kernel/time/posix-timers.c | 4 + kernel/time/tick-broadcast.c | 2 +- kernel/time/tick-common.c | 20 +- kernel/time/tick-internal.h | 1 - kernel/time/tick-sched.c | 110 ++-- kernel/trace/ring_buffer.c | 20 +- kernel/workqueue.c | 67 +-- lib/debugobjects.c | 141 +++-- mm/backing-dev.c | 11 +- mm/page_alloc.c | 16 + net/8021q/vlan_dev.c | 2 +- net/bluetooth/hci_sock.c | 9 +- net/core/skbuff.c | 3 + net/ipv4/ip_output.c | 16 +- net/ipv6/sit.c | 8 +- net/ncsi/ncsi-aen.c | 1 + net/netfilter/nf_tables_api.c | 20 +- net/netfilter/nfnetlink.c | 2 - net/netfilter/nft_dynset.c | 2 +- net/netfilter/nft_lookup.c | 2 +- net/netfilter/nft_objref.c | 2 +- net/netlink/af_netlink.c | 75 +-- net/packet/af_packet.c | 32 +- net/packet/diag.c | 4 +- net/packet/internal.h | 26 +- net/rxrpc/sendmsg.c | 2 +- net/sched/act_mirred.c | 2 +- net/sched/cls_api.c | 1 + net/sched/sch_fq.c | 6 +- net/sunrpc/clnt.c | 3 - net/sunrpc/sched.c | 1 - net/xdp/xsk_queue.h | 1 + scripts/gdb/linux/clk.py | 2 + scripts/gdb/linux/genpd.py | 4 +- scripts/gdb/linux/timerlist.py | 4 +- scripts/gdb/linux/utils.py | 5 +- security/integrity/ima/Kconfig | 2 +- security/selinux/Makefile | 4 +- sound/oss/dmasound/dmasound.h | 6 - sound/oss/dmasound/dmasound_core.c | 26 +- sound/soc/codecs/es8316.c | 17 +- sound/soc/fsl/fsl_mqs.c | 15 +- sound/soc/intel/boards/bytcr_rt5640.c | 12 + sound/soc/intel/boards/sof_sdw.c | 11 + sound/usb/caiaq/input.c | 1 + tools/bpf/bpftool/json_writer.c | 3 - tools/bpf/bpftool/xlated_dumper.c | 7 + tools/perf/builtin-sched.c | 2 +- .../perf/pmu-events/arch/powerpc/power9/other.json | 4 +- .../pmu-events/arch/powerpc/power9/pipeline.json | 2 +- tools/perf/util/auxtrace.c | 5 +- .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 + tools/perf/util/pmu.c | 2 +- tools/perf/util/sort.c | 3 +- tools/perf/util/symbol-elf.c | 2 +- .../selftests/bpf/prog_tests/cg_storage_multi.c | 8 +- tools/testing/selftests/resctrl/fill_buf.c | 2 + tools/testing/selftests/resctrl/mba_test.c | 7 +- 379 files changed, 3626 insertions(+), 2091 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/381 seccomp: Move copy_seccomp() to no failure path.
From: Kuniyuki Iwashima <[email protected]>
commit a1140cb215fa13dcec06d12ba0c3ee105633b7c4 upstream.
Our syzbot instance reported memory leaks in do_seccomp() [0], similar to the report [1]. It shows that we miss freeing struct seccomp_filter and some objects included in it.
We can reproduce the issue with the program below [2] which calls one seccomp() and two clone() syscalls.
The first clone()d child exits earlier than its parent and sends a signal to kill it during the second clone(), more precisely before the fatal_signal_pending() test in copy_process(). When the parent receives the signal, it has to destroy the embryonic process and return -EINTR to user space. In the failure path, we have to call seccomp_filter_release() to decrement the filter's refcount.
Initially, we called it in free_task() called from the failure path, but the commit 3a15fb6ed92c ("seccomp: release filter after task is fully dead") moved it to release_task() to notify user space as early as possible that the filter is no longer used.
To keep the change and current seccomp refcount semantics, let's move copy_seccomp() just after the signal check and add a WARN_ON_ONCE() in free_task() for future debugging.
[0]:
unreferenced object 0xffff8880063add00 (size 256):
comm "repro_seccomp", pid 230, jiffies 4294687090 (age 9.914s) hex dump (first 32 bytes):
01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................ ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
backtrace:
do_seccomp (./include/linux/slab.h:600 ./include/linux/slab.h:733 kernel/seccomp.c:666 kernel/seccomp.c:708 kernel/seccomp.c:1871 kernel/seccomp.c:1991)
do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
unreferenced object 0xffffc90000035000 (size 4096):
comm "repro_seccomp", pid 230, jiffies 4294687090 (age 9.915s)
hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
__vmalloc_node_range (mm/vmalloc.c:3226)
__vmalloc_node (mm/vmalloc.c:3261 (discriminator 4))
bpf_prog_alloc_no_stats (kernel/bpf/core.c:91)
bpf_prog_alloc (kernel/bpf/core.c:129)
bpf_prog_create_from_user (net/core/filter.c:1414)
do_seccomp (kernel/seccomp.c:671 kernel/seccomp.c:708 kernel/seccomp.c:1871 kernel/seccomp.c:1991)
do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
unreferenced object 0xffff888003fa1000 (size 1024):
comm "repro_seccomp", pid 230, jiffies 4294687090 (age 9.915s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
bpf_prog_alloc_no_stats (./include/linux/slab.h:600 ./include/linux/slab.h:733 kernel/bpf/core.c:95)
bpf_prog_alloc (kernel/bpf/core.c:129)
bpf_prog_create_from_user (net/core/filter.c:1414)
do_seccomp (kernel/seccomp.c:671 kernel/seccomp.c:708 kernel/seccomp.c:1871 kernel/seccomp.c:1991)
do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
unreferenced object 0xffff888006360240 (size 16):
comm "repro_seccomp", pid 230, jiffies 4294687090 (age 9.915s)
hex dump (first 16 bytes):
01 00 37 00 76 65 72 6c e0 83 01 06 80 88 ff ff ..7.verl........
backtrace:
bpf_prog_store_orig_filter (net/core/filter.c:1137)
bpf_prog_create_from_user (net/core/filter.c:1428)
do_seccomp (kernel/seccomp.c:671 kernel/seccomp.c:708 kernel/seccomp.c:1871 kernel/seccomp.c:1991)
do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
unreferenced object 0xffff8880060183e0 (size 8):
comm "repro_seccomp", pid 230, jiffies 4294687090 (age 9.915s)
hex dump (first 8 bytes):
06 00 00 00 00 00 ff 7f ........
backtrace:
kmemdup (mm/util.c:129)
bpf_prog_store_orig_filter (net/core/filter.c:1144)
bpf_prog_create_from_user (net/core/filter.c:1428)
do_seccomp (kernel/seccomp.c:671 kernel/seccomp.c:708 kernel/seccomp.c:1871 kernel/seccomp.c:1991)
do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)[1]: https://syzkaller.appspot.com/bug?id=2809bb0ac77ad9aa3f4afe42d6a610aba594a987
[2]:
#define _GNU_SOURCE
#include <sched.h>
#include <signal.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <linux/filter.h>
#include <linux/seccomp.h>
void main(void)
{
struct sock_filter filter[] = {
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW),
};
struct sock_fprog fprog = {
.len = sizeof(filter) / sizeof(filter[0]),
.filter = filter,
};
long i, pid;
syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, 0, &fprog);
for (i = 0; i < 2; i++) {
pid = syscall(__NR_clone, CLONE_NEWNET | SIGKILL, NULL, NULL, 0);
if (pid == 0)
return;
}
}--- kernel/fork.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
kernel/fork.c +11 -6
@@ -441,6 +441,9 @@ void put_task_stack(struct task_struct *void free_task (struct task_struct *tsk) { +#ifdef CONFIG_SECCOMP +WARN_ON_ONCE (tsk->seccomp.filter); +#endif scs_release (tsk);#ifndef CONFIG_THREAD_INFO_IN_TASK
@@ -2248,12 +2251,6 @@ static __latent_entropy struct task_struspin_lock (¤t->sighand->siglock); -/* -* Copy seccomp details explicitly here, in case they were changed -* before holding sighand lock. -*/ -copy_seccomp (p); -rseq_fork (p, clone_flags);/* Don't start children in a dying pid namespace */
@@ -2268,6 +2265,14 @@ static __latent_entropy struct task_stru goto bad_fork_cancel_cgroup; } +/* No more failure paths after this point. */ + +/* +* Copy seccomp details explicitly here, in case they were changed +* before holding sighand lock. +*/ +copy_seccomp (p); +init_task_pid_links (p);if (likely (p->pid)) {ptrace_init_task (p, (clone_flags &CLONE_PTRACE ) || trace);
Greg Kroah-Hartman
maintainerPATCH 2/381 counter: 104-quad-8: Fix race condition between FLAG and CNTR reads
In reply to Greg Kroah-HartmanFrom: William Breathitt Gray <[email protected]>
commit 4aa3b75c74603c3374877d5fd18ad9cc3a9a62ed upstream.
The Counter (CNTR) register is 24 bits wide, but we can have an effective 25-bit count value by setting bit 24 to the XOR of the Borrow flag and Carry flag. The flags can be read from the FLAG register, but a race condition exists: the Borrow flag and Carry flag are instantaneous and could change by the time the count value is read from the CNTR register.
Since the race condition could result in an incorrect 25-bit count value, remove support for 25-bit count values from this driver; hard-coded maximum count values are replaced by a LS7267_CNTR_MAX define for consistency and clarity.
--- drivers/counter/104-quad-8.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-)
drivers/counter/104-quad-8.c +4 -24
@@ -62,10 +62,6 @@ struct quad8_iio {#define QUAD8_REG_CHAN_OP 0x11#define QUAD8_REG_INDEX_INPUT_LEVELS 0x16#define QUAD8_DIFF_ENCODER_CABLE_STATUS 0x17 -/* Borrow Toggle flip-flop */ -#define QUAD8_FLAG_BT BIT(0) -/* Carry Toggle flip-flop */ -#define QUAD8_FLAG_CT BIT(1)/* Error flag */ #define QUAD8_FLAG_E BIT(4)/* Up/Down flag */
@@ -104,9 +100,6 @@ static int quad8_read_raw(struct iio_dev {struct quad8_iio *const priv =iio_priv (indio_dev);const int base_offset = priv->base +2 * chan->channel; -unsigned int flags; -unsigned int borrow; -unsigned int carry;int i;switch (mask) {
@@ -117,12 +110,7 @@ static int quad8_read_raw(struct iio_devreturn IIO_VAL_INT ; } - flags =inb (base_offset +1 ); - borrow = flags &QUAD8_FLAG_BT ; - carry = !!(flags &QUAD8_FLAG_CT ); - -/* Borrow XOR Carry effectively doubles count range */ - *val = (borrow ^ carry) <<24 ; + *val =0 ;mutex_lock (&priv->lock);
@@ -643,17 +631,9 @@ static int quad8_count_read(struct count {struct quad8_iio *const priv = counter->priv;const int base_offset = priv->base +2 * count->id; -unsigned int flags; -unsigned int borrow; -unsigned int carry;int i; - flags =inb (base_offset +1 ); - borrow = flags &QUAD8_FLAG_BT ; - carry = !!(flags &QUAD8_FLAG_CT ); - -/* Borrow XOR Carry effectively doubles count range */ - *val = (unsigned long )(borrow ^ carry) <<24 ; + *val =0 ;mutex_lock (&priv->lock);
@@ -1198,8 +1178,8 @@ static ssize_t quad8_count_ceiling_read(mutex_unlock (&priv->lock); -/* By default 0x1FFFFFF (25 bits unsigned) is maximum count */ -return sprintf (buf,"33554431\n" ); +/* By default 0xFFFFFF (24 bits unsigned) is maximum count */ +return sprintf (buf,"16777215\n" ); } static ssize_t quad8_count_ceiling_write(struct counter_device *counter,
Greg Kroah-Hartman
maintainerPATCH 3/381 KVM: arm64: Fix buffer overflow in kvm_arm_set_fw_reg()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit a25bc8486f9c01c1af6b6c5657234b2eee2c39d6 upstream.
The KVM_REG_SIZE() comes from the ioctl and it can be a power of two between 0-32768 but if it is more than sizeof(long) this will corrupt memory.
--- arch/arm64/kvm/psci.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/kvm/psci.c +2 -0
@@ -499,6 +499,8 @@ int kvm_arm_set_fw_reg(struct kvm_vcpu *u64 val;int wa_level; +if (KVM_REG_SIZE (reg->id) !=sizeof (val)) +return -ENOENT ;if (copy_from_user (&val, uaddr,KVM_REG_SIZE (reg->id)))return -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 4/381 wifi: brcmfmac: slab-out-of-bounds read in brcmf_get_assoc_ies()
In reply to Greg Kroah-HartmanFrom: Jisoo Jang <[email protected]>
commit 0da40e018fd034d87c9460123fa7f897b69fdee7 upstream.
Fix a slab-out-of-bounds read that occurs in kmemdup() called from brcmf_get_assoc_ies().
The bug could occur when assoc_info->req_len, data from a URB provided by a USB device, is bigger than the size of buffer which is defined as WL_EXTRA_BUF_MAX.
Add the size check for req_len/resp_len of assoc_info.
Found by a modified version of syzkaller.
[ 46.592467][ T7] ================================================================== [ 46.594687][ T7] BUG: KASAN: slab-out-of-bounds in kmemdup+0x3e/0x50 [ 46.596572][ T7] Read of size 3014656 at addr ffff888019442000 by task kworker/0:1/7 [ 46.598575][ T7] [ 46.599157][ T7] CPU: 0 PID: 7 Comm: kworker/0:1 Tainted: G O 5.14.0+ #145 [ 46.601333][ T7] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014 [ 46.604360][ T7] Workqueue: events brcmf_fweh_event_worker [ 46.605943][ T7] Call Trace: [ 46.606584][ T7] dump_stack_lvl+0x8e/0xd1 [ 46.607446][ T7] print_address_description.constprop.0.cold+0x93/0x334 [ 46.608610][ T7] ? kmemdup+0x3e/0x50 [ 46.609341][ T7] kasan_report.cold+0x79/0xd5 [ 46.610151][ T7] ? kmemdup+0x3e/0x50 [ 46.610796][ T7] kasan_check_range+0x14e/0x1b0 [ 46.611691][ T7] memcpy+0x20/0x60 [ 46.612323][ T7] kmemdup+0x3e/0x50 [ 46.612987][ T7] brcmf_get_assoc_ies+0x967/0xf60 [ 46.613904][ T7] ? brcmf_notify_vif_event+0x3d0/0x3d0 [ 46.614831][ T7] ? lock_chain_count+0x20/0x20 [ 46.615683][ T7] ? mark_lock.part.0+0xfc/0x2770 [ 46.616552][ T7] ? lock_chain_count+0x20/0x20 [ 46.617409][ T7] ? mark_lock.part.0+0xfc/0x2770 [ 46.618244][ T7] ? lock_chain_count+0x20/0x20 [ 46.619024][ T7] brcmf_bss_connect_done.constprop.0+0x241/0x2e0 [ 46.620019][ T7] ? brcmf_parse_configure_security.isra.0+0x2a0/0x2a0 [ 46.620818][ T7] ? __lock_acquire+0x181f/0x5790 [ 46.621462][ T7] brcmf_notify_connect_status+0x448/0x1950 [ 46.622134][ T7] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 46.622736][ T7] ? brcmf_cfg80211_join_ibss+0x7b0/0x7b0 [ 46.623390][ T7] ? find_held_lock+0x2d/0x110 [ 46.623962][ T7] ? brcmf_fweh_event_worker+0x19f/0xc60 [ 46.624603][ T7] ? mark_held_locks+0x9f/0xe0 [ 46.625145][ T7] ? lockdep_hardirqs_on_prepare+0x3e0/0x3e0 [ 46.625871][ T7] ? brcmf_cfg80211_join_ibss+0x7b0/0x7b0 [ 46.626545][ T7] brcmf_fweh_call_event_handler.isra.0+0x90/0x100 [ 46.627338][ T7] brcmf_fweh_event_worker+0x557/0xc60 [ 46.627962][ T7] ? brcmf_fweh_call_event_handler.isra.0+0x100/0x100 [ 46.628736][ T7] ? rcu_read_lock_sched_held+0xa1/0xd0 [ 46.629396][ T7] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 46.629970][ T7] ? lockdep_hardirqs_on_prepare+0x273/0x3e0 [ 46.630649][ T7] process_one_work+0x92b/0x1460 [ 46.631205][ T7] ? pwq_dec_nr_in_flight+0x330/0x330 [ 46.631821][ T7] ? rwlock_bug.part.0+0x90/0x90 [ 46.632347][ T7] worker_thread+0x95/0xe00 [ 46.632832][ T7] ? __kthread_parkme+0x115/0x1e0 [ 46.633393][ T7] ? process_one_work+0x1460/0x1460 [ 46.633957][ T7] kthread+0x3a1/0x480 [ 46.634369][ T7] ? set_kthread_struct+0x120/0x120 [ 46.634933][ T7] ret_from_fork+0x1f/0x30 [ 46.635431][ T7] [ 46.635687][ T7] Allocated by task 7: [ 46.636151][ T7] kasan_save_stack+0x1b/0x40 [ 46.636628][ T7] __kasan_kmalloc+0x7c/0x90 [ 46.637108][ T7] kmem_cache_alloc_trace+0x19e/0x330 [ 46.637696][ T7] brcmf_cfg80211_attach+0x4a0/0x4040 [ 46.638275][ T7] brcmf_attach+0x389/0xd40 [ 46.638739][ T7] brcmf_usb_probe+0x12de/0x1690 [ 46.639279][ T7] usb_probe_interface+0x2aa/0x760 [ 46.639820][ T7] really_probe+0x205/0xb70 [ 46.640342][ T7] __driver_probe_device+0x311/0x4b0 [ 46.640876][ T7] driver_probe_device+0x4e/0x150 [ 46.641445][ T7] __device_attach_driver+0x1cc/0x2a0 [ 46.642000][ T7] bus_for_each_drv+0x156/0x1d0 [ 46.642543][ T7] __device_attach+0x23f/0x3a0 [ 46.643065][ T7] bus_probe_device+0x1da/0x290 [ 46.643644][ T7] device_add+0xb7b/0x1eb0 [ 46.644130][ T7] usb_set_configuration+0xf59/0x16f0 [ 46.644720][ T7] usb_generic_driver_probe+0x82/0xa0 [ 46.645295][ T7] usb_probe_device+0xbb/0x250 [ 46.645786][ T7] really_probe+0x205/0xb70 [ 46.646258][ T7] __driver_probe_device+0x311/0x4b0 [ 46.646804][ T7] driver_probe_device+0x4e/0x150 [ 46.647387][ T7] __device_attach_driver+0x1cc/0x2a0 [ 46.647926][ T7] bus_for_each_drv+0x156/0x1d0 [ 46.648454][ T7] __device_attach+0x23f/0x3a0 [ 46.648939][ T7] bus_probe_device+0x1da/0x290 [ 46.649478][ T7] device_add+0xb7b/0x1eb0 [ 46.649936][ T7] usb_new_device.cold+0x49c/0x1029 [ 46.650526][ T7] hub_event+0x1c98/0x3950 [ 46.650975][ T7] process_one_work+0x92b/0x1460 [ 46.651535][ T7] worker_thread+0x95/0xe00 [ 46.651991][ T7] kthread+0x3a1/0x480 [ 46.652413][ T7] ret_from_fork+0x1f/0x30 [ 46.652885][ T7] [ 46.653131][ T7] The buggy address belongs to the object at ffff888019442000 [ 46.653131][ T7] which belongs to the cache kmalloc-2k of size 2048 [ 46.654669][ T7] The buggy address is located 0 bytes inside of [ 46.654669][ T7] 2048-byte region [ffff888019442000, ffff888019442800) [ 46.656137][ T7] The buggy address belongs to the page: [ 46.656720][ T7] page:ffffea0000651000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x19440 [ 46.657792][ T7] head:ffffea0000651000 order:3 compound_mapcount:0 compound_pincount:0 [ 46.658673][ T7] flags: 0x100000000010200(slab|head|node=0|zone=1) [ 46.659422][ T7] raw: 0100000000010200 0000000000000000 dead000000000122 ffff888100042000 [ 46.660363][ T7] raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000 [ 46.661236][ T7] page dumped because: kasan: bad access detected [ 46.661956][ T7] page_owner tracks the page as allocated [ 46.662588][ T7] page last allocated via order 3, migratetype Unmovable, gfp_mask 0x52a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 7, ts 31136961085, free_ts 0 [ 46.664271][ T7] prep_new_page+0x1aa/0x240 [ 46.664763][ T7] get_page_from_freelist+0x159a/0x27c0 [ 46.665340][ T7] __alloc_pages+0x2da/0x6a0 [ 46.665847][ T7] alloc_pages+0xec/0x1e0 [ 46.666308][ T7] allocate_slab+0x380/0x4e0 [ 46.666770][ T7] ___slab_alloc+0x5bc/0x940 [ 46.667264][ T7] __slab_alloc+0x6d/0x80 [ 46.667712][ T7] kmem_cache_alloc_trace+0x30a/0x330 [ 46.668299][ T7] brcmf_usbdev_qinit.constprop.0+0x50/0x470 [ 46.668885][ T7] brcmf_usb_probe+0xc97/0x1690 [ 46.669438][ T7] usb_probe_interface+0x2aa/0x760 [ 46.669988][ T7] really_probe+0x205/0xb70 [ 46.670487][ T7] __driver_probe_device+0x311/0x4b0 [ 46.671031][ T7] driver_probe_device+0x4e/0x150 [ 46.671604][ T7] __device_attach_driver+0x1cc/0x2a0 [ 46.672192][ T7] bus_for_each_drv+0x156/0x1d0 [ 46.672739][ T7] page_owner free stack trace missing [ 46.673335][ T7] [ 46.673620][ T7] Memory state around the buggy address: [ 46.674213][ T7] ffff888019442700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 46.675083][ T7] ffff888019442780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 46.675994][ T7] >ffff888019442800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 46.676875][ T7] ^ [ 46.677323][ T7] ffff888019442880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 46.678190][ T7] ffff888019442900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 46.679052][ T7] ================================================================== [ 46.679945][ T7] Disabling lock debugging due to kernel taint [ 46.680725][ T7] Kernel panic - not syncing:
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +5 -0
@@ -5834,6 +5834,11 @@ static s32 brcmf_get_assoc_ies(struct br (struct brcmf_cfg80211_assoc_ielen_le *)cfg->extra_buf; req_len =le32_to_cpu (assoc_info->req_len); resp_len =le32_to_cpu (assoc_info->resp_len); +if (req_len >WL_EXTRA_BUF_MAX || resp_len >WL_EXTRA_BUF_MAX ) { +bphy_err (drvr,"invalid lengths in assoc info: req %u resp %u\n" , + req_len, resp_len); +return -EINVAL ; + }if (req_len) { err = brcmf_fil_iovar_data_get(ifp, "assoc_req_ies", cfg->extra_buf,
Greg Kroah-Hartman
maintainerPATCH 5/381 drm/fb-helper: set x/yres_virtual in drm_fb_helper_check_var
In reply to Greg Kroah-HartmanFrom: Daniel Vetter <[email protected]>
commit 1935f0deb6116dd785ea64d8035eab0ff441255b upstream.
Drivers are supposed to fix this up if needed if they don't outright reject it. Uncovered by 6c11df58fd1a ("fbmem: Check virtual screen sizes in fb_set_var()").
--- drivers/gpu/drm/drm_fb_helper.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +3 -0
@@ -1299,6 +1299,9 @@ int drm_fb_helper_check_var(struct fb_vareturn -EINVAL ; } + var->xres_virtual = fb->width; + var->yres_virtual = fb->height; +/* * Workaround for SDL 1.2, which is known to be setting all pixel format * fields values to zero in some cases. We treat this situation as a
Greg Kroah-Hartman
maintainerPATCH 6/381 bluetooth: Perform careful capability checks in hci_sock_ioctl()
In reply to Greg Kroah-HartmanFrom: Ruihan Li <[email protected]>
commit 25c150ac103a4ebeed0319994c742a90634ddf18 upstream.
Previously, capability was checked using capable(), which verified that the caller of the ioctl system call had the required capability. In addition, the result of the check would be stored in the HCI_SOCK_TRUSTED flag, making it persistent for the socket.
However, malicious programs can abuse this approach by deliberately sharing an HCI socket with a privileged task. The HCI socket will be marked as trusted when the privileged task occasionally makes an ioctl call.
This problem can be solved by using sk_capable() to check capability, which ensures that not only the current task but also the socket opener has the specified capability, thus reducing the risk of privilege escalation through the previously identified vulnerability.
--- net/bluetooth/hci_sock.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/bluetooth/hci_sock.c +8 -1
@@ -996,7 +996,14 @@ static int hci_sock_ioctl(struct socketif (hci_sock_gen_cookie (sk)) {struct sk_buff *skb; -if (capable (CAP_NET_ADMIN )) +/* Perform careful checks before setting the HCI_SOCK_TRUSTED +* flag. Make sure that not only the current task but also +* the socket opener has the required capability, since +* privileged programs can be tricked into making ioctl calls +* on HCI sockets, and the socket should not be marked as +* trusted simply because the ioctl caller is privileged. +*/ +if (sk_capable (sk,CAP_NET_ADMIN ))hci_sock_set_flag (sk,HCI_SOCK_TRUSTED );/* Send event to monitor */
Greg Kroah-Hartman
maintainerPATCH 7/381 x86/fpu: Prevent FPU state corruption
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 59f5ede3bc0f00eb856425f636dab0c10feb06d8 upstream.
The FPU usage related to task FPU management is either protected by disabling interrupts (switch_to, return to user) or via fpregs_lock() which is a wrapper around local_bh_disable(). When kernel code wants to use the FPU then it has to check whether it is possible by calling irq_fpu_usable().
But the condition in irq_fpu_usable() is wrong. It allows FPU to be used when:
!in_interrupt() || interrupted_user_mode() || interrupted_kernel_fpu_idle()
The latter is checking whether some other context already uses FPU in the kernel, but if that's not the case then it allows FPU to be used unconditionally even if the calling context interrupted a fpregs_lock() critical region. If that happens then the FPU state of the interrupted context becomes corrupted.
Allow in kernel FPU usage only when no other context has in kernel FPU usage and either the calling context is not hard interrupt context or the hard interrupt did not interrupt a local bottomhalf disabled region.
It's hard to find a proper Fixes tag as the condition was broken in one way or the other for a very long time and the eager/lazy FPU changes caused a lot of churn. Picked something remotely connected from the history.
This survived undetected for quite some time as FPU usage in interrupt context is rare, but the recent changes to the random code unearthed it at least on a kernel which had FPU debugging enabled. There is probably a higher rate of silent corruption as not all issues can be detected by the FPU debugging code. This will be addressed in a subsequent change.
--- arch/x86/kernel/fpu/core.c | 67 +++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 41 deletions(-)
arch/x86/kernel/fpu/core.c +26 -41
@@ -25,17 +25,7 @@*/ union fpregs_state init_fpstate__read_mostly ; -/* -* Track whether the kernel is using the FPU state -* currently. -* -* This flag is used: -* -* - by IRQ context code to potentially use the FPU -* if it's unused. -* -* - to debug kernel_fpu_begin()/end() correctness -*/ +/* Track in-kernel FPU usage */ static DEFINE_PER_CPU(bool, in_kernel_fpu);/*
@@ -43,42 +33,37 @@ static DEFINE_PER_CPU(bool, in_kernel_fp*/ DEFINE_PER_CPU(struct fpu *, fpu_fpregs_owner_ctx); -static bool kernel_fpu_disabled (void ) -{ -return this_cpu_read (in_kernel_fpu); -} - -static bool interrupted_kernel_fpu_idle (void ) -{ -return !kernel_fpu_disabled (); -} - -/* -* Were we in user mode (or vm86 mode) when we were -* interrupted? -* -* Doing kernel_fpu_begin/end() is ok if we are running -* in an interrupt context from user mode - we'll just -* save the FPU state as required. -*/ -static bool interrupted_user_mode (void ) -{ -struct pt_regs *regs =get_irq_regs (); -return regs &&user_mode (regs); -} -/* * Can we use the FPU in kernel mode with the * whole "kernel_fpu_begin/end()" sequence? -* -* It's always ok in process context (ie "not interrupt") -* but it is sometimes ok even from an irq. */ bool irq_fpu_usable (void ) { -return !in_interrupt () || -interrupted_user_mode () || -interrupted_kernel_fpu_idle (); +if (WARN_ON_ONCE (in_nmi ())) +return false; + +/* In kernel FPU usage already active? */ +if (this_cpu_read (in_kernel_fpu)) +return false; + +/* +* When not in NMI or hard interrupt context, FPU can be used in: +* +* - Task context except from within fpregs_lock()'ed critical +* regions. +* +* - Soft interrupt processing context which cannot happen +* while in a fpregs_lock()'ed critical region. +*/ +if (!in_irq ()) +return true; + +/* +* In hard interrupt context it's safe when soft interrupts +* are enabled, which means the interrupt did not hit in +* a fpregs_lock()'ed critical region. +*/ +return !softirq_count (); }EXPORT_SYMBOL (irq_fpu_usable);
Greg Kroah-Hartman
maintainerPATCH 8/381 USB: serial: option: add UNISOC vendor and TOZED LT70C product
In reply to Greg Kroah-HartmanFrom: Arınç ÜNAL <[email protected]>
commit a095edfc15f0832e046ae23964e249ef5c95af87 upstream.
Add UNISOC vendor ID and TOZED LT70-C modem which is based from UNISOC SL8563. The modem supports the NCM mode. Interface 0 is used for running the AT commands. Interface 12 is the ADB interface.
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 6 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1782 ProdID=4055 Rev=04.04 S: Manufacturer=Unisoc Phone S: Product=Unisoc Phone S: SerialNumber=<redacted> C: #Ifs=14 Cfg#= 1 Atr=c0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0d Prot=00 Driver=cdc_ncm E: Ad=82(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#=10 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#=11 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8c(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#=12 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=09(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8d(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#=13 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=0a(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0d Prot=00 Driver=cdc_ncm E: Ad=84(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 3 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 4 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0d Prot=00 Driver=cdc_ncm E: Ad=86(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 5 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 6 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0d Prot=00 Driver=cdc_ncm E: Ad=88(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 7 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 9 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/serial/option.c +6 -0
@@ -595,6 +595,11 @@ static void option_instat_callback(struc#define SIERRA_VENDOR_ID 0x1199#define SIERRA_PRODUCT_EM9191 0x90d3 +/* UNISOC (Spreadtrum) products */ +#define UNISOC_VENDOR_ID 0x1782 +/* TOZED LT70-C based on UNISOC SL8563 uses UNISOC's vendor ID */ +#define TOZED_PRODUCT_LT70C 0x4055 +/* Device flags */ /* Highest interface number which can be used with NCTRL() and RSVD() */
@@ -2225,6 +2230,7 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(OPPO_VENDOR_ID, OPPO_PRODUCT_R11, 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) }, { } /* Terminating entry */ };MODULE_DEVICE_TABLE (usb, option_ids);
Greg Kroah-Hartman
maintainerPATCH 9/381 driver core: Dont require dynamic_debug for initcall_debug probe timing
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
commit e2f06aa885081e1391916367f53bad984714b4db upstream.
Don't require the use of dynamic debug (or modification of the kernel to add a #define DEBUG to the top of this file) to get the printk message about driver probe timing. This printk is only emitted when initcall_debug is enabled on the kernel commandline, and it isn't immediately obvious that you have to do something else to debug boot timing issues related to driver probe. Add a comment too so it doesn't get converted back to pr_debug().
--- drivers/base/dd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/base/dd.c +6 -1
@@ -677,7 +677,12 @@ static int really_probe_debug(struct dev calltime =ktime_get (); ret =really_probe (dev, drv); rettime =ktime_get (); -pr_debug ("probe of %s returned %d after %lld usecs\n" , +/* +* Don't change this to pr_debug() because that requires +* CONFIG_DYNAMIC_DEBUG and we want a simple 'initcall_debug' on the +* kernel commandline to print this all the time at the debug level. +*/ +printk (KERN_DEBUG "probe of %s returned %d after %lld usecs\n" ,dev_name (dev), ret,ktime_us_delta (rettime, calltime));return ret; }
Greg Kroah-Hartman
maintainerPATCH 10/381 ASOC: Intel: sof_sdw: add quirk for Intel Rooks County NUC M15
In reply to Greg Kroah-HartmanFrom: Eugene Huang <[email protected]>
[ Upstream commit 3c728b1bc5b99c5275ac5c7788ef814c0e51ef54 ]
Same quirks as the 'Bishop County' NUC M15, except the rt711 is in the 'JD2 100K' jack detection mode.
--- sound/soc/intel/boards/sof_sdw.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/soc/intel/boards/sof_sdw.c +11 -0
@@ -175,6 +175,17 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {SOF_SDW_PCH_DMIC | SOF_RT711_JD_SRC_JD2), }, + { +/* NUC15 'Rooks County' LAPRC510 and LAPRC710 skews */ + .callback = sof_sdw_quirk_cb, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Intel(R) Client Systems" ), + DMI_MATCH(DMI_PRODUCT_NAME, "LAPRC"), + }, + .driver_data = (void *)(SOF_SDW_TGL_HDMI | +SOF_SDW_PCH_DMIC | + RT711_JD2_100K), + }, /* TigerLake-SDCA devices */ { .callback = sof_sdw_quirk_cb,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 11/381 iio: adc: palmas_gpadc: fix NULL dereference on rmmod
In reply to Greg Kroah-HartmanFrom: Patrik Dahlström <[email protected]>
[ Upstream commit 49f76c499d38bf67803438eee88c8300d0f6ce09 ]
Calling dev_to_iio_dev() on a platform device pointer is undefined and will make adc NULL.
--- drivers/iio/adc/palmas_gpadc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/palmas_gpadc.c +1 -1
@@ -628,7 +628,7 @@ static int palmas_gpadc_probe(struct platform_device *pdev)static int palmas_gpadc_remove (struct platform_device *pdev) { -struct iio_dev *indio_dev =dev_to_iio_dev (&pdev->dev); +struct iio_dev *indio_dev =dev_get_drvdata (&pdev->dev);struct palmas_gpadc *adc =iio_priv (indio_dev);if (adc->wakeup1_enable || adc->wakeup2_enable)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 12/381 ASoC: Intel: bytcr_rt5640: Add quirk for the Acer Iconia One 7 B1-750
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit e38c5e80c3d293a883c6f1d553f2146ec0bda35e ]
The Acer Iconia One 7 B1-750 tablet mostly works fine with the defaults for an Bay Trail CR tablet. Except for the internal mic, instead of an analog mic on IN3 a digital mic on DMIC1 is uses.
Add a quirk with these settings for this tablet.
--- sound/soc/intel/boards/bytcr_rt5640.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/soc/intel/boards/bytcr_rt5640.c +12 -0
@@ -393,6 +393,18 @@ static int byt_rt5640_aif1_hw_params(struct snd_pcm_substream *substream,/* Please keep this list alphabetically sorted */ static const struct dmi_system_id byt_rt5640_quirk_table[] = { + {/* Acer Iconia One 7 B1-750 */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"Insyde" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"VESPA2" ), + }, + .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | +BYT_RT5640_JD_SRC_JD1_IN4P | +BYT_RT5640_OVCD_TH_1500UA | +BYT_RT5640_OVCD_SF_0P75 | +BYT_RT5640_SSP0_AIF1 | +BYT_RT5640_MCLK_EN ), + }, {/* Acer Iconia Tab 8 W1-810 */ .matches = {DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"Acer" ),
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 13/381 asm-generic/io.h: suppress endianness warnings for readq() and writeq()
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit d564fa1ff19e893e2971d66e5c8f49dc1cdc8ffc ]
Commit c1d55d50139b ("asm-generic/io.h: Fix sparse warnings on big-endian architectures") missed fixing the 64-bit accessors.
Arnd explains in the attached link why the casts are necessary, even if __raw_readq() and __raw_writeq() do not take endian-specific types.
--- include/asm-generic/io.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/asm-generic/io.h +2 -2
@@ -190,7 +190,7 @@ static inline u64 readq(const volatile void __iomem *addr)u64 val;__io_br (); - val =__le64_to_cpu (__raw_readq (addr)); + val =__le64_to_cpu ((__le64 __force )__raw_readq (addr));__io_ar (val);return val; }
@@ -233,7 +233,7 @@ static inline void writel(u32 value, volatile void __iomem *addr)static inline void writeq (u64 value,volatile void __iomem *addr) {__io_bw (); -__raw_writeq (__cpu_to_le64 (value), addr); +__raw_writeq ((u64 __force )__cpu_to_le64 (value), addr);__io_aw (); }#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 14/381 wireguard: timers: cast enum limits members to int in prints
In reply to Greg Kroah-HartmanFrom: Jiri Slaby (SUSE) <[email protected]>
commit 2d4ee16d969c97996e80e4c9cb6de0acaff22c9f upstream.
Since gcc13, each member of an enum has the same type as the enum. And that is inherited from its members. Provided "REKEY_AFTER_MESSAGES = 1ULL << 60", the named type is unsigned long.
This generates warnings with gcc-13:
error: format '%d' expects argument of type 'int', but argument 6 has type 'long unsigned int'
Cast those particular enum members to int when printing them.
--- drivers/net/wireguard/timers.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireguard/timers.c +4 -4
@@ -46,7 +46,7 @@ static void wg_expired_retransmit_handshif (peer->timer_handshake_attempts >MAX_TIMER_HANDSHAKES ) {pr_debug ("%s: Handshake for peer %llu (%pISpfsc) did not complete after %d attempts, giving up\n" , peer->device->dev->name, peer->internal_id, - &peer->endpoint.addr,MAX_TIMER_HANDSHAKES +2 ); + &peer->endpoint.addr, (int )MAX_TIMER_HANDSHAKES +2 );del_timer (&peer->timer_send_keepalive);/* We drop all packets without a keypair and don't try again,
@@ -64,7 +64,7 @@ static void wg_expired_retransmit_handsh ++peer->timer_handshake_attempts;pr_debug ("%s: Handshake for peer %llu (%pISpfsc) did not complete after %d seconds, retrying (try %d)\n" , peer->device->dev->name, peer->internal_id, - &peer->endpoint.addr,REKEY_TIMEOUT , + &peer->endpoint.addr, (int )REKEY_TIMEOUT , peer->timer_handshake_attempts +1 );/* We clear the endpoint address src address, in case this is
@@ -94,7 +94,7 @@ static void wg_expired_new_handshake(strpr_debug ("%s: Retrying handshake with peer %llu (%pISpfsc) because we stopped hearing back after %d seconds\n" , peer->device->dev->name, peer->internal_id, - &peer->endpoint.addr,KEEPALIVE_TIMEOUT +REKEY_TIMEOUT ); + &peer->endpoint.addr, (int )(KEEPALIVE_TIMEOUT +REKEY_TIMEOUT ));/* We clear the endpoint address src address, in case this is the cause * of trouble. */
@@ -126,7 +126,7 @@ static void wg_queued_expired_zero_key_mpr_debug ("%s: Zeroing out all keys for peer %llu (%pISpfsc), since we haven't received a new one in %d seconds\n" , peer->device->dev->name, peer->internal_id, - &peer->endpoint.addr,REJECT_AFTER_TIME *3 ); + &peer->endpoint.addr, (int )REJECT_AFTER_TIME *3 );wg_noise_handshake_clear (&peer->handshake);wg_noise_keypairs_clear (&peer->keypairs);wg_peer_put (peer);
Greg Kroah-Hartman
maintainerPATCH 15/381 PCI: pciehp: Fix AB-BA deadlock between reset_lock and device_lock
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit f5eff5591b8f9c5effd25c92c758a127765f74c1 upstream.
In 2013, commits
2e35afaefe64 ("PCI: pciehp: Add reset_slot() method") 608c388122c7 ("PCI: Add slot reset option to pci_dev_reset()")
amended PCIe hotplug to mask Presence Detect Changed events during a Secondary Bus Reset. The reset thus no longer causes gratuitous slot bringdown and bringup.
However the commits neglected to serialize reset with code paths reading slot registers. For instance, a slot bringup due to an earlier hotplug event may see the Presence Detect State bit cleared during a concurrent Secondary Bus Reset.
In 2018, commit
5b3f7b7d062b ("PCI: pciehp: Avoid slot access during reset")
retrofitted the missing locking. It introduced a reset_lock which serializes a Secondary Bus Reset with other parts of pciehp.
Unfortunately the locking turns out to be overzealous: reset_lock is held for the entire enumeration and de-enumeration of hotplugged devices, including driver binding and unbinding.
Driver binding and unbinding acquires device_lock while the reset_lock of the ancestral hotplug port is held. A concurrent Secondary Bus Reset acquires the ancestral reset_lock while already holding the device_lock. The asymmetric locking order in the two code paths can lead to AB-BA deadlocks.
Michael Haeuptle reports such deadlocks on simultaneous hot-removal and vfio release (the latter implies a Secondary Bus Reset):
pciehp_ist() # down_read(reset_lock)
pciehp_handle_presence_or_link_change()
pciehp_disable_slot()
__pciehp_disable_slot()
remove_board()
pciehp_unconfigure_device()
pci_stop_and_remove_bus_device()
pci_stop_bus_device()
pci_stop_dev()
device_release_driver()
device_release_driver_internal()
__device_driver_lock() # device_lock() SYS_munmap()
vfio_device_fops_release()
vfio_device_group_close()
vfio_device_close()
vfio_device_last_close()
vfio_pci_core_close_device()
vfio_pci_core_disable() # device_lock()
__pci_reset_function_locked()
pci_reset_bus_function()
pci_dev_reset_slot_function()
pci_reset_hotplug_slot()
pciehp_reset_slot() # down_write(reset_lock)
Ian May reports the same deadlock on simultaneous hot-removal and an AER-induced Secondary Bus Reset:
aer_recover_work_func()
pcie_do_recovery()
aer_root_reset()
pci_bus_error_reset()
pci_slot_reset()
pci_slot_lock() # device_lock()
pci_reset_hotplug_slot()
pciehp_reset_slot() # down_write(reset_lock)
Fix by releasing the reset_lock during driver binding and unbinding, thereby splitting and shrinking the critical section.
Driver binding and unbinding is protected by the device_lock() and thus serialized with a Secondary Bus Reset. There's no need to additionally protect it with the reset_lock. However, pciehp does not bind and unbind devices directly, but rather invokes PCI core functions which also perform certain enumeration and de-enumeration steps.
The reset_lock's purpose is to protect slot registers, not enumeration and de-enumeration of hotplugged devices. That would arguably be the job of the PCI core, not the PCIe hotplug driver. After all, an AER-induced Secondary Bus Reset may as well happen during boot-time enumeration of the PCI hierarchy and there's no locking to prevent that either.
Exempting *de-enumeration* from the reset_lock is relatively harmless:
A concurrent Secondary Bus Reset may foil config space accesses such as PME interrupt disablement. But if the device is physically gone, those accesses are pointless anyway. If the device is physically present and only logically removed through an Attention Button press or the sysfs "power" attribute, PME interrupts as well as DMA cannot come through because pciehp_unconfigure_device() disables INTx and Bus Master bits. That's still protected by the reset_lock in the present commit.
Exempting *enumeration* from the reset_lock also has limited impact:
The exempted call to pci_bus_add_device() may perform device accesses through pcibios_bus_add_device() and pci_fixup_device() which are now no longer protected from a concurrent Secondary Bus Reset. Otherwise there should be no impact.
In essence, the present commit seeks to fix the AB-BA deadlocks while still retaining a best-effort reset protection for enumeration and de-enumeration of hotplugged devices -- until a general solution is implemented in the PCI core.
--- drivers/pci/hotplug/pciehp_pci.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/pci/hotplug/pciehp_pci.c +15 -0
@@ -63,7 +63,14 @@ int pciehp_configure_device(struct contrpci_assign_unassigned_bridge_resources (bridge);pcie_bus_configure_settings (parent); + +/* +* Release reset_lock during driver binding +* to avoid AB-BA deadlock with device_lock. +*/ +up_read (&ctrl->reset_lock);pci_bus_add_devices (parent); +down_read_nested (&ctrl->reset_lock, ctrl->depth); out:pci_unlock_rescan_remove ();
@@ -104,7 +111,15 @@ void pciehp_unconfigure_device(struct colist_for_each_entry_safe_reverse (dev, temp, &parent->devices, bus_list) {pci_dev_get (dev); + +/* +* Release reset_lock during driver unbinding +* to avoid AB-BA deadlock with device_lock. +*/ +up_read (&ctrl->reset_lock);pci_stop_and_remove_bus_device (dev); +down_read_nested (&ctrl->reset_lock, ctrl->depth); +/* * Ensure that no new Requests will be generated from * the device.
Greg Kroah-Hartman
maintainerPATCH 16/381 PCI: qcom: Fix the incorrect register usage in v2.7.0 config
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
commit 2542e16c392508800f1d9037feee881a9c444951 upstream.
Qcom PCIe IP version v2.7.0 and its derivatives don't contain the PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT register. Instead, they have the new PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2 register. So fix the incorrect register usage which is modifying a different register.
Also in this IP version, this register change doesn't depend on MSI being enabled. So remove that check also.
--- drivers/pci/controller/dwc/pcie-qcom.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/pci/controller/dwc/pcie-qcom.c +3 -5
@@ -1210,11 +1210,9 @@ static int qcom_pcie_init_2_7_0(struct q val |=BIT (4 );writel (val, pcie->parf +PCIE20_PARF_MHI_CLOCK_RESET_CTRL ); -if (IS_ENABLED (CONFIG_PCI_MSI )) { - val =readl (pcie->parf +PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT ); - val |=BIT (31 ); -writel (val, pcie->parf +PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT ); - } + val =readl (pcie->parf +PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2 ); + val |=BIT (31 ); +writel (val, pcie->parf +PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2 );return 0 ; err_disable_clocks:
Greg Kroah-Hartman
maintainerPATCH 17/381 IMA: allow/fix UML builds
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 644f17412f5acf01a19af9d04a921937a2bc86c6 upstream.
UML supports HAS_IOMEM since 0bbadafdc49d (um: allow disabling NO_IOMEM).
Current IMA build on UML fails on allmodconfig (with TCG_TPM=m):
ld: security/integrity/ima/ima_queue.o: in function `ima_add_template_entry':
ima_queue.c:(.text+0x2d9): undefined reference to `tpm_pcr_extend'
ld: security/integrity/ima/ima_init.o: in function `ima_init':
ima_init.c:(.init.text+0x43f): undefined reference to `tpm_default_chip'
ld: security/integrity/ima/ima_crypto.o: in function `ima_calc_boot_aggregate_tfm':
ima_crypto.c:(.text+0x1044): undefined reference to `tpm_pcr_read'
ld: ima_crypto.c:(.text+0x10d8): undefined reference to `tpm_pcr_read'
Modify the IMA Kconfig entry so that it selects TCG_TPM if HAS_IOMEM is set, regardless of the UML Kconfig setting.
This updates TCG_TPM from =m to =y and fixes the linker errors.
--- security/integrity/ima/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/ima/Kconfig +1 -1
@@ -8,7 +8,7 @@ config IMA select CRYPTO_HMAC select CRYPTO_SHA1 select CRYPTO_HASH_INFO - select TCG_TPM if HAS_IOMEM && !UML + select TCG_TPM if HAS_IOMEM select TCG_TIS if TCG_TPM && X86 select TCG_CRB if TCG_TPM && ACPI select TCG_IBMVTPM if TCG_TPM && PPC_PSERIES
Greg Kroah-Hartman
maintainerPATCH 18/381 USB: dwc3: fix runtime pm imbalance on probe errors
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 9a8ad10c9f2e0925ff26308ec6756b93fc2f4977 upstream.
Make sure not to suspend the device when probe fails to avoid disabling clocks and phys multiple times.
--- drivers/usb/dwc3/core.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/usb/dwc3/core.c +5 -9
@@ -1567,13 +1567,11 @@ static int dwc3_probe(struct platform_despin_lock_init (&dwc->lock);mutex_init (&dwc->mutex); +pm_runtime_get_noresume (dev);pm_runtime_set_active (dev);pm_runtime_use_autosuspend (dev);pm_runtime_set_autosuspend_delay (dev,DWC3_DEFAULT_AUTOSUSPEND_DELAY );pm_runtime_enable (dev); - ret =pm_runtime_get_sync (dev); -if (ret <0 ) - goto err1;pm_runtime_forbid (dev);
@@ -1633,12 +1631,10 @@ err3:dwc3_free_event_buffers (dwc); err2: -pm_runtime_allow (&pdev->dev); - -err1: -pm_runtime_put_sync (&pdev->dev); -pm_runtime_disable (&pdev->dev); - +pm_runtime_allow (dev); +pm_runtime_disable (dev); +pm_runtime_set_suspended (dev); +pm_runtime_put_noidle (dev); disable_clks:clk_bulk_disable_unprepare (dwc->num_clks, dwc->clks); assert_reset:
Greg Kroah-Hartman
maintainerPATCH 19/381 USB: dwc3: fix runtime pm imbalance on unbind
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 44d257e9012ee8040e41d224d0e5bfb5ef5427ea upstream.
Make sure to balance the runtime PM usage count on driver unbind by adding back the pm_runtime_allow() call that had been erroneously removed.
--- drivers/usb/dwc3/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc3/core.c +1 -0
@@ -1655,6 +1655,7 @@ static int dwc3_remove(struct platform_ddwc3_core_exit (dwc);dwc3_ulpi_exit (dwc); +pm_runtime_allow (&pdev->dev);pm_runtime_disable (&pdev->dev);pm_runtime_put_noidle (&pdev->dev);pm_runtime_set_suspended (&pdev->dev);
Greg Kroah-Hartman
maintainerPATCH 20/381 hwmon: (k10temp) Check range scale when CUR_TEMP register is read-write
In reply to Greg Kroah-HartmanFrom: Babu Moger <[email protected]>
commit 0c072385348e3ac5229145644055d3e2afb5b3db upstream.
Spec says, when CUR_TEMP_TJ_SEL == 3 and CUR_TEMP_RANGE_SEL == 0, it should use RangeUnadjusted is 0, which is (CurTmp*0.125 -49) C. The CUR_TEMP register is read-write when CUR_TEMP_TJ_SEL == 3 (bit 17-16).
Add the check to detect it.
Sensors command's output before the patch.
$sensors
k10temp-pci-00c3
Adapter: PCI adapter
Tctl: +76.6°C <- Wrong value Tccd1: +26.5°C Tccd2: +27.5°C Tccd3: +27.2°C Tccd4: +27.5°C Tccd5: +26.0°C Tccd6: +26.2°C Tccd7: +25.0°C Tccd8: +26.5°C
Sensors command's output after the patch.
$sensors
k10temp-pci-00c3
Adapter: PCI adapter
Tctl: +28.8°C <- corrected value Tccd1: +27.5°C Tccd2: +28.5°C Tccd3: +28.5°C Tccd4: +28.5°C Tccd5: +27.0°C Tccd6: +27.5°C Tccd7: +27.0°C Tccd8: +27.5°C
--- drivers/hwmon/k10temp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hwmon/k10temp.c +3 -1
@@ -74,6 +74,7 @@ static DEFINE_MUTEX(nb_smu_ind_mutex);#define ZEN_CUR_TEMP_SHIFT 21#define ZEN_CUR_TEMP_RANGE_SEL_MASK BIT(19) +#define ZEN_CUR_TEMP_TJ_SEL_MASK GENMASK(17, 16)#define ZEN_SVI_BASE 0x0005A000
@@ -173,7 +174,8 @@ static long get_raw_temp(struct k10temp_ data->read_tempreg (data->pdev, ®val); temp = (regval >>ZEN_CUR_TEMP_SHIFT ) *125 ; -if (regval & data->temp_adjust_mask) +if ((regval & data->temp_adjust_mask) || + (regval &ZEN_CUR_TEMP_TJ_SEL_MASK ) ==ZEN_CUR_TEMP_TJ_SEL_MASK ) temp -=49000 ;return temp; }
Greg Kroah-Hartman
maintainerPATCH 21/381 hwmon: (adt7475) Use device_property APIs when configuring polarity
In reply to Greg Kroah-HartmanFrom: Chris Packham <[email protected]>
commit 2a8e41ad337508fc5d598c0f9288890214f8e318 upstream.
On DT unaware platforms of_property_read_u32_array() returns -ENOSYS which wasn't handled by the code treating adi,pwm-active-state as optional. Update the code to use device_property_read_u32_array() which deals gracefully with DT unaware platforms.
--- drivers/hwmon/adt7475.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hwmon/adt7475.c +3 -3
@@ -1515,9 +1515,9 @@ static int adt7475_set_pwm_polarity(struint ret, i;u8 val; - ret =of_property_read_u32_array (client->dev.of_node, -"adi,pwm-active-state" , states, -ARRAY_SIZE (states)); + ret =device_property_read_u32_array (&client->dev, +"adi,pwm-active-state" , states, +ARRAY_SIZE (states));if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 22/381 posix-cpu-timers: Implement the missing timer_wait_running callback
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit f7abf14f0001a5a47539d9f60bbdca649e43536b upstream.
For some unknown reason the introduction of the timer_wait_running callback missed to fixup posix CPU timers, which went unnoticed for almost four years. Marco reported recently that the WARN_ON() in timer_wait_running() triggers with a posix CPU timer test case.
Posix CPU timers have two execution models for expiring timers depending on CONFIG_POSIX_CPU_TIMERS_TASK_WORK:
1) If not enabled, the expiry happens in hard interrupt context so spin waiting on the remote CPU is reasonably time bound.
Implement an empty stub function for that case.
2) If enabled, the expiry happens in task work before returning to user space or guest mode. The expired timers are marked as firing and moved from the timer queue to a local list head with sighand lock held. Once the timers are moved, sighand lock is dropped and the expiry happens in fully preemptible context. That means the expiring task can be scheduled out, migrated, interrupted etc. So spin waiting on it is more than suboptimal.
The timer wheel has a timer_wait_running() mechanism for RT, which uses a per CPU timer-base expiry lock which is held by the expiry code and the task waiting for the timer function to complete blocks on that lock.
This does not work in the same way for posix CPU timers as there is no timer base and expiry for process wide timers can run on any task belonging to that process, but the concept of waiting on an expiry lock can be used too in a slightly different way:
- Add a mutex to struct posix_cputimers_work. This struct is per task and used to schedule the expiry task work from the timer interrupt.
- Add a task_struct pointer to struct cpu_timer which is used to store a the task which runs the expiry. That's filled in when the task moves the expired timers to the local expiry list. That's not affecting the size of the k_itimer union as there are bigger union members already
- Let the task take the expiry mutex around the expiry function
- Let the waiter acquire a task reference with rcu_read_lock() held and block on the expiry mutex
This avoids spin-waiting on a task which might not even be on a CPU and works nicely for RT too.
--- include/linux/posix-timers.h | 17 +++++--- kernel/time/posix-cpu-timers.c | 81 +++++++++++++++++++++++++++++++++-------- kernel/time/posix-timers.c | 4 ++ 3 files changed, 82 insertions(+), 20 deletions(-)
include/linux/posix-timers.h +11 -6
@@ -4,6 +4,7 @@#include <linux/spinlock.h> #include <linux/list.h> +#include <linux/mutex.h> #include <linux/alarmtimer.h> #include <linux/timerqueue.h> #include <linux/task_work.h>
@@ -63,16 +64,18 @@ static inline int clockid_to_fd(const cl* cpu_timer - Posix CPU timer representation for k_itimer * @node: timerqueue node to queue in the task/sig * @head: timerqueue head on which this timer is queued -* @task: Pointer to target task +* @pid: Pointer to target task PID * @elist: List head for the expiry list * @firing: Timer is currently firing +* @handling: Pointer to the task which handles expiry */ struct cpu_timer { -struct timerqueue_node node; -struct timerqueue_head *head; -struct pid *pid; -struct list_head elist; -int firing; +struct timerqueue_node node; +struct timerqueue_head *head; +struct pid *pid; +struct list_head elist; +int firing; +struct task_struct __rcu *handling; }; static inline bool cpu_timer_enqueue(struct timerqueue_head *head,
@@ -129,10 +132,12 @@ struct posix_cputimers {/** * posix_cputimers_work - Container for task work based posix CPU timer expiry * @work: The task work to be scheduled +* @mutex: Mutex held around expiry in context of this task work * @scheduled: @work has been scheduled already, no further processing */ struct posix_cputimers_work {struct callback_head work; +struct mutex mutex;unsigned int scheduled; };
kernel/time/posix-cpu-timers.c +67 -14
127 lines not on this page · raw message
kernel/time/posix-timers.c +4 -0
@@ -846,6 +846,10 @@ static struct k_itimer *timer_wait_runnircu_read_lock ();unlock_timer (timer, *flags); +/* +* kc->timer_wait_running() might drop RCU lock. So @timer +* cannot be touched anymore after the function returns! +*/ if (!WARN_ON_ONCE (!kc->timer_wait_running)) kc->timer_wait_running (timer);
Greg Kroah-Hartman
maintainerPATCH 23/381 perf sched: Cast PTHREAD_STACK_MIN to int as it may turn into sysconf(__SC_THREAD_STACK_MIN_VALUE)
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
commit d08c84e01afa7a7eee6badab25d5420fa847f783 upstream.
In fedora rawhide the PTHREAD_STACK_MIN define may end up expanded to a sysconf() call, and that will return 'long int', breaking the build:
45 fedora:rawhide : FAIL gcc version 11.1.1 20210623 (Red Hat 11.1.1-6) (GCC)
builtin-sched.c: In function 'create_tasks':
/git/perf-5.14.0-rc1/tools/include/linux/kernel.h:43:24: error: comparison of distinct pointer types lacks a cast [-Werror]
43 | (void) (&_max1 == &_max2); \
| ^~
builtin-sched.c:673:34: note: in expansion of macro 'max'
673 | (size_t) max(16 * 1024, PTHREAD_STACK_MIN));
| ^~~
cc1: all warnings being treated as errors
$ grep __sysconf /usr/include/*/*.h /usr/include/bits/pthread_stack_min-dynamic.h:extern long int __sysconf (int __name) __THROW; /usr/include/bits/pthread_stack_min-dynamic.h:# define PTHREAD_STACK_MIN __sysconf (__SC_THREAD_STACK_MIN_VALUE) /usr/include/bits/time.h:extern long int __sysconf (int); /usr/include/bits/time.h:# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */ $
So cast it to int to cope with that.
--- tools/perf/builtin-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-sched.c +1 -1
@@ -670,7 +670,7 @@ static void create_tasks(struct perf_sch err =pthread_attr_init (&attr);BUG_ON (err); err =pthread_attr_setstacksize (&attr, - (size_t )max (16 *1024 ,PTHREAD_STACK_MIN )); + (size_t )max (16 *1024 , (int )PTHREAD_STACK_MIN ));BUG_ON (err); err =pthread_mutex_lock (&sched->start_work_mutex);BUG_ON (err);
Greg Kroah-Hartman
maintainerPATCH 24/381 blk-mq: release crypto keyslot before reporting I/O complete
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 9cd1e566676bbcb8a126acd921e4e194e6339603 upstream.
Once all I/O using a blk_crypto_key has completed, filesystems can call blk_crypto_evict_key(). However, the block layer currently doesn't call blk_crypto_put_keyslot() until the request is being freed, which happens after upper layers have been told (via bio_endio()) the I/O has completed. This causes a race condition where blk_crypto_evict_key() can see 'slot_refs != 0' without there being an actual bug.
This makes __blk_crypto_evict_key() hit the 'WARN_ON_ONCE(atomic_read(&slot->slot_refs) != 0)' and return without doing anything, eventually causing a use-after-free in blk_crypto_reprogram_all_keys(). (This is a very rare bug and has only been seen when per-file keys are being used with fscrypt.)
There are two options to fix this: either release the keyslot before bio_endio() is called on the request's last bio, or make __blk_crypto_evict_key() ignore slot_refs. Let's go with the first solution, since it preserves the ability to report bugs (via WARN_ON_ONCE) where a key is evicted while still in-use.
--- block/blk-core.c | 7 +++++++ block/blk-crypto-internal.h | 25 +++++++++++++++++++++---- block/blk-crypto.c | 24 ++++++++++++------------ block/blk-merge.c | 2 ++ block/blk-mq.c | 2 +- 5 files changed, 43 insertions(+), 17 deletions(-)
block/blk-core.c +7 -0
@@ -1444,6 +1444,13 @@ bool blk_update_request(struct request * req->q->integrity.profile->complete_fn (req, nr_bytes);#endif +/* +* Upper layers may call blk_crypto_evict_key() anytime after the last +* bio_endio(). Therefore, the keyslot must be released before that. +*/ +if (blk_crypto_rq_has_keyslot (req) && nr_bytes >=blk_rq_bytes (req)) +__blk_crypto_rq_put_keyslot (req); +if (unlikely (error && !blk_rq_is_passthrough (req) && !(req->rq_flags &RQF_QUIET )))print_req_error (req, error, __func__);
block/blk-crypto-internal.h +21 -4
@@ -60,6 +60,11 @@ static inline bool blk_crypto_rq_is_encrreturn rq->crypt_ctx; } +static inline bool blk_crypto_rq_has_keyslot (struct request *rq) +{ +return rq->crypt_keyslot; +} +#else /* CONFIG_BLK_INLINE_ENCRYPTION */ static inline bool bio_crypt_rq_ctx_compatible(struct request *rq,
@@ -93,6 +98,11 @@ static inline bool blk_crypto_rq_is_encr return false; } +static inline bool blk_crypto_rq_has_keyslot (struct request *rq) +{ +return false; +} +#endif /* CONFIG_BLK_INLINE_ENCRYPTION */ void __bio_crypt_advance (struct bio *bio,unsigned int bytes);
@@ -127,14 +137,21 @@ static inline bool blk_crypto_bio_prep(sreturn true; } -blk_status_t __blk_crypto_init_request (struct request *rq); -static inline blk_status_t blk_crypto_init_request (struct request *rq) +blk_status_t __blk_crypto_rq_get_keyslot (struct request *rq); +static inline blk_status_t blk_crypto_rq_get_keyslot (struct request *rq) {if (blk_crypto_rq_is_encrypted (rq)) -return __blk_crypto_init_request (rq); +return __blk_crypto_rq_get_keyslot (rq);return BLK_STS_OK ; } +void __blk_crypto_rq_put_keyslot (struct request *rq); +static inline void blk_crypto_rq_put_keyslot (struct request *rq) +{ +if (blk_crypto_rq_has_keyslot (rq)) +__blk_crypto_rq_put_keyslot (rq); +} +void __blk_crypto_free_request (struct request *rq);static inline void blk_crypto_free_request (struct request *rq) {
@@ -173,7 +190,7 @@ static inline blk_status_t blk_crypto_in {if (blk_crypto_rq_is_encrypted (rq)) -return blk_crypto_init_request (rq); +return blk_crypto_rq_get_keyslot (rq);return BLK_STS_OK ; }
block/blk-crypto.c +12 -12
@@ -216,26 +216,26 @@ static bool bio_crypt_check_alignment(streturn true; } -blk_status_t __blk_crypto_init_request (struct request *rq) +blk_status_t __blk_crypto_rq_get_keyslot (struct request *rq) {return blk_ksm_get_slot_for_key (rq->q->ksm, rq->crypt_ctx->bc_key, &rq->crypt_keyslot); } -/** -* __blk_crypto_free_request - Uninitialize the crypto fields of a request. -* -* @rq: The request whose crypto fields to uninitialize. -* -* Completely uninitializes the crypto fields of a request. If a keyslot has -* been programmed into some inline encryption hardware, that keyslot is -* released. The rq->crypt_ctx is also freed. -*/ -void __blk_crypto_free_request (struct request *rq) +void __blk_crypto_rq_put_keyslot (struct request *rq) {blk_ksm_put_slot (rq->crypt_keyslot); + rq->crypt_keyslot =NULL ; +} + +void __blk_crypto_free_request (struct request *rq) +{ +/* The keyslot, if one was needed, should have been released earlier. */ +if (WARN_ON_ONCE (rq->crypt_keyslot)) +__blk_crypto_rq_put_keyslot (rq); +mempool_free (rq->crypt_ctx, bio_crypt_ctx_pool); -blk_crypto_rq_set_defaults (rq); + rq->crypt_ctx =NULL ; }/**
block/blk-merge.c +2 -0
@@ -801,6 +801,8 @@ static struct request *attempt_merge(strif (!blk_discard_mergable (req))elv_merge_requests (q, req, next); +blk_crypto_rq_put_keyslot (next); +/* * 'next' is going away, so update stats accordingly */
block/blk-mq.c +1 -1
@@ -2193,7 +2193,7 @@ blk_qc_t blk_mq_submit_bio(struct bio *bblk_mq_bio_to_request (rq, bio, nr_segs); - ret =blk_crypto_init_request (rq); + ret =blk_crypto_rq_get_keyslot (rq);if (ret !=BLK_STS_OK ) { bio->bi_status = ret;bio_endio (bio);
Greg Kroah-Hartman
maintainerPATCH 25/381 blk-crypto: make blk_crypto_evict_key() return void
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 70493a63ba04f754f7a7dd53a4fcc82700181490 upstream.
blk_crypto_evict_key() is only called in contexts such as inode eviction where failure is not an option. So there is nothing the caller can do with errors except log them. (dm-table.c does "use" the error code, but only to pass on to upper layers, so it doesn't really count.)
Just make blk_crypto_evict_key() return void and log errors itself.
--- block/blk-crypto.c | 22 ++++++++++------------ include/linux/blk-crypto.h | 4 ++-- 2 files changed, 12 insertions(+), 14 deletions(-)
block/blk-crypto.c +10 -12
@@ -13,6 +13,7 @@#include <linux/blkdev.h> #include <linux/keyslot-manager.h> #include <linux/module.h> +#include <linux/ratelimit.h> #include <linux/slab.h> #include "blk-crypto-internal.h"
@@ -393,19 +394,16 @@ int blk_crypto_start_using_key(const str* Upper layers (filesystems) must call this function to ensure that a key is * evicted from any hardware that it might have been programmed into. The key * must not be in use by any in-flight IO when this function is called. -* -* Return: 0 on success or if key is not present in the q's ksm, -err on error. */ -int blk_crypto_evict_key (struct request_queue *q, -const struct blk_crypto_key *key) +void blk_crypto_evict_key (struct request_queue *q, +const struct blk_crypto_key *key) { -if (blk_ksm_crypto_cfg_supported (q->ksm, &key->crypto_cfg)) -return blk_ksm_evict_key (q->ksm, key); +int err; -/* -* If the request queue's associated inline encryption hardware didn't -* have support for the key, then the key might have been programmed -* into the fallback keyslot manager, so try to evict from there. -*/ -return blk_crypto_fallback_evict_key (key); +if (blk_ksm_crypto_cfg_supported (q->ksm, &key->crypto_cfg)) + err =blk_ksm_evict_key (q->ksm, key); +else + err =blk_crypto_fallback_evict_key (key); +if (err) +pr_warn_ratelimited ("error %d evicting key\n" , err); }
include/linux/blk-crypto.h +2 -2
@@ -97,8 +97,8 @@ int blk_crypto_init_key(struct blk_cryptint blk_crypto_start_using_key (const struct blk_crypto_key *key,struct request_queue *q); -int blk_crypto_evict_key (struct request_queue *q, -const struct blk_crypto_key *key); +void blk_crypto_evict_key (struct request_queue *q, +const struct blk_crypto_key *key);bool blk_crypto_config_supported (struct request_queue *q,const struct blk_crypto_config *cfg);
Greg Kroah-Hartman
maintainerPATCH 26/381 blk-crypto: make blk_crypto_evict_key() more robust
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 5c7cb94452901a93e90c2230632e2c12a681bc92 upstream.
If blk_crypto_evict_key() sees that the key is still in-use (due to a bug) or that ->keyslot_evict failed, it currently just returns while leaving the key linked into the keyslot management structures.
However, blk_crypto_evict_key() is only called in contexts such as inode eviction where failure is not an option. So actually the caller proceeds with freeing the blk_crypto_key regardless of the return value of blk_crypto_evict_key().
These two assumptions don't match, and the result is that there can be a use-after-free in blk_crypto_reprogram_all_keys() after one of these errors occurs. (Note, these errors *shouldn't* happen; we're just talking about what happens if they do anyway.)
Fix this by making blk_crypto_evict_key() unlink the key from the keyslot management structures even on failure.
Also improve some comments.
--- block/blk-crypto.c | 29 +++++++++++++++++++++-------- block/keyslot-manager.c | 43 +++++++++++++++++++++---------------------- 2 files changed, 42 insertions(+), 30 deletions(-)
block/blk-crypto.c +21 -8
@@ -385,15 +385,20 @@ int blk_crypto_start_using_key(const str }/** -* blk_crypto_evict_key() - Evict a key from any inline encryption hardware -* it may have been programmed into -* @q: The request queue who's associated inline encryption hardware this key -* might have been programmed into -* @key: The key to evict +* blk_crypto_evict_key() - Evict a blk_crypto_key from a request_queue +* @q: a request_queue on which I/O using the key may have been done +* @key: the key to evict * -* Upper layers (filesystems) must call this function to ensure that a key is -* evicted from any hardware that it might have been programmed into. The key -* must not be in use by any in-flight IO when this function is called. +* For a given request_queue, this function removes the given blk_crypto_key +* from the keyslot management structures and evicts it from any underlying +* hardware keyslot(s) or blk-crypto-fallback keyslot it may have been +* programmed into. +* +* Upper layers must call this before freeing the blk_crypto_key. It must be +* called for every request_queue the key may have been used on. The key must +* no longer be in use by any I/O when this function is called. +* +* Context: May sleep. */ void blk_crypto_evict_key (struct request_queue *q,const struct blk_crypto_key *key)
@@ -404,6 +409,14 @@ void blk_crypto_evict_key(struct request err =blk_ksm_evict_key (q->ksm, key); else err =blk_crypto_fallback_evict_key (key); +/* +* An error can only occur here if the key failed to be evicted from a +* keyslot (due to a hardware or driver issue) or is allegedly still in +* use by I/O (due to a kernel bug). Even in these cases, the key is +* still unlinked from the keyslot management structures, and the caller +* is allowed and expected to free it right away. There's nothing +* callers can do to handle errors, so just log them and return void. +*/ if (err)pr_warn_ratelimited ("error %d evicting key\n" , err); }
block/keyslot-manager.c +21 -22
65 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 27/381 ext4: use ext4_journal_start/stop for fast commit transactions
In reply to Greg Kroah-HartmanFrom: Harshad Shirwadkar <[email protected]>
commit 2729cfdcfa1cc49bef5a90d046fa4a187fdfcc69 upstream.
This patch drops all calls to ext4_fc_start_update() and ext4_fc_stop_update(). To ensure that there are no ongoing journal updates during fast commit, we also make jbd2_fc_begin_commit() lock journal for updates. This way we don't have to maintain two different transaction start stop APIs for fast commit and full commit. This patch doesn't remove the functions altogether since in future we want to have inode level locking for fast commits.
--- fs/ext4/acl.c | 2 -- fs/ext4/extents.c | 2 -- fs/ext4/file.c | 4 ---- fs/ext4/inode.c | 7 +------ fs/ext4/ioctl.c | 8 +------- fs/jbd2/journal.c | 2 ++ 6 files changed, 4 insertions(+), 21 deletions(-)
fs/ext4/acl.c +0 -2
@@ -242,7 +242,6 @@ retry: handle =ext4_journal_start (inode,EXT4_HT_XATTR , credits);if (IS_ERR (handle))return PTR_ERR (handle); -ext4_fc_start_update (inode);if ((type ==ACL_TYPE_ACCESS ) && acl) { error =posix_acl_update_mode (inode, &mode, &acl);
@@ -260,7 +259,6 @@ retry: } out_stop:ext4_journal_stop (handle); -ext4_fc_stop_update (inode);if (error == -ENOSPC &&ext4_should_retry_alloc (inode->i_sb, &retries)) goto retry;return error;
fs/ext4/extents.c +0 -2
@@ -4694,7 +4694,6 @@ long ext4_fallocate(struct file *file, i FALLOC_FL_INSERT_RANGE))return -EOPNOTSUPP ; -ext4_fc_start_update (inode);inode_lock (inode); ret =ext4_convert_inline_data (inode);inode_unlock (inode);
@@ -4764,7 +4763,6 @@ out:inode_unlock (inode);trace_ext4_fallocate_exit (inode, offset, max_blocks, ret); exit: -ext4_fc_stop_update (inode);return ret; }
fs/ext4/file.c +0 -4
@@ -260,7 +260,6 @@ static ssize_t ext4_buffered_write_iter(if (iocb->ki_flags &IOCB_NOWAIT )return -EOPNOTSUPP ; -ext4_fc_start_update (inode);inode_lock (inode); ret =ext4_write_checks (iocb, from);if (ret <=0 )
@@ -272,7 +271,6 @@ static ssize_t ext4_buffered_write_iter( out:inode_unlock (inode); -ext4_fc_stop_update (inode);if (likely (ret >0 )) { iocb->ki_pos += ret; ret =generic_write_sync (iocb, ret);
@@ -559,9 +557,7 @@ static ssize_t ext4_dio_write_iter(struc goto out; } -ext4_fc_start_update (inode); ret =ext4_orphan_add (handle, inode); -ext4_fc_stop_update (inode);if (ret) {ext4_journal_stop (handle); goto out;
fs/ext4/inode.c +1 -6
@@ -5437,7 +5437,7 @@ int ext4_setattr(struct dentry *dentry,if (error)return error; } -ext4_fc_start_update (inode); +if ((ia_valid &ATTR_UID && !uid_eq (attr->ia_uid, inode->i_uid)) || (ia_valid &ATTR_GID && !gid_eq (attr->ia_gid, inode->i_gid))) {handle_t *handle;
@@ -5461,7 +5461,6 @@ int ext4_setattr(struct dentry *dentry,if (error) {ext4_journal_stop (handle); -ext4_fc_stop_update (inode);return error; }/* Update corresponding info in inode so that everything is in
@@ -5473,7 +5472,6 @@ int ext4_setattr(struct dentry *dentry, error =ext4_mark_inode_dirty (handle, inode);ext4_journal_stop (handle);if (unlikely (error)) { -ext4_fc_stop_update (inode);return error; } }
@@ -5488,12 +5486,10 @@ int ext4_setattr(struct dentry *dentry,struct ext4_sb_info *sbi =EXT4_SB (inode->i_sb);if (attr->ia_size > sbi->s_bitmap_maxbytes) { -ext4_fc_stop_update (inode);return -EFBIG ; } }if (!S_ISREG (inode->i_mode)) { -ext4_fc_stop_update (inode);return -EINVAL ; }
@@ -5619,7 +5615,6 @@ err_out:ext4_std_error (inode->i_sb, error);if (!error) error = rc; -ext4_fc_stop_update (inode);return error; }
fs/ext4/ioctl.c +1 -7
@@ -1322,13 +1322,7 @@ out:long ext4_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) { -long ret; - -ext4_fc_start_update (file_inode (filp)); - ret =__ext4_ioctl (filp, cmd, arg); -ext4_fc_stop_update (file_inode (filp)); - -return ret; +return __ext4_ioctl (filp, cmd, arg); }#ifdef CONFIG_COMPAT
fs/jbd2/journal.c +2 -0
@@ -757,6 +757,7 @@ int jbd2_fc_begin_commit(journal_t *jour } journal->j_flags |=JBD2_FAST_COMMIT_ONGOING ;write_unlock (&journal->j_state_lock); +jbd2_journal_lock_updates (journal);return 0 ; }
@@ -768,6 +769,7 @@ EXPORT_SYMBOL(jbd2_fc_begin_commit);*/ static int __jbd2_fc_end_commit (journal_t *journal,tid_t tid,bool fallback) { +jbd2_journal_unlock_updates (journal);if (journal->j_fc_cleanup_callback) journal->j_fc_cleanup_callback (journal,0 );write_lock (&journal->j_state_lock);
Greg Kroah-Hartman
maintainerPATCH 28/381 staging: iio: resolver: ads1210: fix config mode
In reply to Greg Kroah-HartmanFrom: Nuno Sá <[email protected]>
commit 16313403d873ff17a587818b61f84c8cb4971cef upstream.
As stated in the device datasheet [1], bits a0 and a1 have to be set to 1 for the configuration mode.
[1]: https://www.analog.com/media/en/technical-documentation/data-sheets/ad2s1210.pdf
--- drivers/staging/iio/resolver/ad2s1210.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/resolver/ad2s1210.c +1 -1
@@ -101,7 +101,7 @@ struct ad2s1210_state {static const int ad2s1210_mode_vals[4 ][2 ] = { [MOD_POS ] = {0 ,0 }, [MOD_VEL ] = {0 ,1 }, - [MOD_CONFIG ] = {1 ,0 }, + [MOD_CONFIG ] = {1 ,1 }, }; static inline void ad2s1210_set_mode(enum ad2s1210_mode mode,
Greg Kroah-Hartman
maintainerPATCH 29/381 xhci: fix debugfs register accesses while suspended
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 735baf1b23458f71a8b15cb924af22c9ff9cd125 upstream.
Wire up the debugfs regset device pointer so that the controller is resumed before accessing registers to avoid crashing or locking up if it happens to be runtime suspended.
--- drivers/usb/host/xhci-debugfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/xhci-debugfs.c +1 -0
@@ -133,6 +133,7 @@ static void xhci_debugfs_regset(struct x regset->regs = regs; regset->nregs = nregs; regset->base = hcd->regs + base; + regset->dev = hcd->self.controller;debugfs_create_regset32 ((const char *)rgs->name,0444 , parent, regset); }
Greg Kroah-Hartman
maintainerPATCH 30/381 tick/nohz: Fix cpu_is_hotpluggable() by checking with nohz subsystem
In reply to Greg Kroah-HartmanFrom: Joel Fernandes (Google) <[email protected]>
commit 58d7668242647e661a20efe065519abd6454287e upstream.
For CONFIG_NO_HZ_FULL systems, the tick_do_timer_cpu cannot be offlined. However, cpu_is_hotpluggable() still returns true for those CPUs. This causes torture tests that do offlining to end up trying to offline this CPU causing test failures. Such failure happens on all architectures.
Fix the repeated error messages thrown by this (even if the hotplug errors are harmless) by asking the opinion of the nohz subsystem on whether the CPU can be hotplugged.
[ Apply Frederic Weisbecker feedback on refactoring tick_nohz_cpu_down(). ]
For drivers/base/ portion:
--- drivers/base/cpu.c | 3 ++- include/linux/tick.h | 2 ++ kernel/time/tick-sched.c | 11 ++++++++--- 3 files changed, 12 insertions(+), 4 deletions(-)
drivers/base/cpu.c +2 -1
@@ -489,7 +489,8 @@ static const struct attribute_group *cpubool cpu_is_hotpluggable (unsigned cpu) {struct device *dev =get_cpu_device (cpu); - return dev && container_of(dev, struct cpu, dev)->hotpluggable; + return dev && container_of(dev, struct cpu, dev)->hotpluggable + &&tick_nohz_cpu_hotpluggable (cpu); }EXPORT_SYMBOL_GPL (cpu_is_hotpluggable);
include/linux/tick.h +2 -0
@@ -211,6 +211,7 @@ extern void tick_nohz_dep_set_signal(str enum tick_dep_bits bit);extern void tick_nohz_dep_clear_signal (struct signal_struct *signal,enum tick_dep_bits bit); +extern bool tick_nohz_cpu_hotpluggable (unsigned int cpu);/* * The below are tick_nohz_[set,clear]_dep() wrappers that optimize off-cases
@@ -275,6 +276,7 @@ static inline void tick_nohz_full_add_cpstatic inline void tick_nohz_dep_set_cpu (int cpu,enum tick_dep_bits bit) { }static inline void tick_nohz_dep_clear_cpu (int cpu,enum tick_dep_bits bit) { } +static inline bool tick_nohz_cpu_hotpluggable (unsigned int cpu) {return true; }static inline void tick_dep_set (enum tick_dep_bits bit) { }static inline void tick_dep_clear (enum tick_dep_bits bit) { }
kernel/time/tick-sched.c +8 -3
@@ -426,7 +426,7 @@ void __init tick_nohz_full_setup(cpumask tick_nohz_full_running = true; } -static int tick_nohz_cpu_down (unsigned int cpu) +bool tick_nohz_cpu_hotpluggable (unsigned int cpu) {/* * The tick_do_timer_cpu CPU handles housekeeping duty (unbound
@@ -434,8 +434,13 @@ static int tick_nohz_cpu_down(unsigned i* CPUs. It must remain online when nohz full is enabled. */ if (tick_nohz_full_running && tick_do_timer_cpu == cpu) -return -EBUSY ; -return 0 ; +return false; +return true; +} + +static int tick_nohz_cpu_down (unsigned int cpu) +{ +return tick_nohz_cpu_hotpluggable (cpu) ?0 : -EBUSY ; }void __init tick_nohz_init (void )
Greg Kroah-Hartman
maintainerPATCH 31/381 MIPS: fw: Allow firmware to pass a empty env
In reply to Greg Kroah-HartmanFrom: Jiaxun Yang <[email protected]>
commit ee1809ed7bc456a72dc8410b475b73021a3a68d5 upstream.
fw_getenv will use env entry to determine style of env, however it is legal for firmware to just pass a empty list.
Check if first entry exist before running strchr to avoid null pointer dereference.
--- arch/mips/fw/lib/cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/fw/lib/cmdline.c +1 -1
@@ -53,7 +53,7 @@ char *fw_getenv(char *envname) {char *result =NULL ; -if (_fw_envp !=NULL ) { +if (_fw_envp !=NULL &&fw_envp (0 ) !=NULL ) {/* * Return a pointer to the given environment variable. * YAMON uses "name", "value" pairs, while U-Boot uses
Greg Kroah-Hartman
maintainerPATCH 32/381 ipmi:ssif: Add send_retries increment
In reply to Greg Kroah-HartmanFrom: Corey Minyard <[email protected]>
commit 6ce7995a43febe693d4894033c6e29314970646a upstream.
A recent change removed an increment of send_retries, re-add it.
--- drivers/char/ipmi/ipmi_ssif.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_ssif.c +3 -1
@@ -564,8 +564,10 @@ static void retry_timeout(struct timer_lif (waiting)start_get (ssif_info); -if (resend) +if (resend) {start_resend (ssif_info); +ssif_inc_stat (ssif_info, send_retries); + } }static void watch_timeout (struct timer_list *t)
Greg Kroah-Hartman
maintainerPATCH 33/381 ipmi: fix SSIF not responding under certain cond.
In reply to Greg Kroah-HartmanFrom: Zhang Yuchen <[email protected]>
commit 6d2555cde2918409b0331560e66f84a0ad4849c6 upstream.
The ipmi communication is not restored after a specific version of BMC is upgraded on our server.
The ipmi driver does not respond after printing the following log:
ipmi_ssif: Invalid response getting flags: 1c 1
I found that after entering this branch, ssif_info->ssif_state always holds SSIF_GETTING_FLAGS and never return to IDLE.
As a result, the driver cannot be loaded, because the driver status is checked during the unload process and must be IDLE in shutdown_ssif():
while (ssif_info->ssif_state != SSIF_IDLE)
schedule_timeout(1);The process trigger this problem is:
1. One msg timeout and next msg start send, and call ssif_set_need_watch().
2. ssif_set_need_watch()->watch_timeout()->start_flag_fetch() change ssif_state to SSIF_GETTING_FLAGS.
3. In msg_done_handler() ssif_state == SSIF_GETTING_FLAGS, if an error message is received, the second branch does not modify the ssif_state.
4. All retry action need IS_SSIF_IDLE() == True. Include retry action in watch_timeout(), msg_done_handler(). Sending msg does not work either. SSIF_IDLE is also checked in start_next_msg().
5. The only thing that can be triggered in the SSIF driver is watch_timeout(), after destory_user(), this timer will stop too.
So, if enter this branch, the ssif_state will remain SSIF_GETTING_FLAGS and can't send msg, no timer started, can't unload.
We did a comparative test before and after adding this patch, and the result is effective.
Message-Id: <[email protected]>
--- drivers/char/ipmi/ipmi_ssif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_ssif.c +2 -2
@@ -794,9 +794,9 @@ static void msg_done_handler(struct ssif }else if (data[0 ] != (IPMI_NETFN_APP_REQUEST |1 ) <<2 || data[1 ] !=IPMI_GET_MSG_FLAGS_CMD ) {/* -* Don't abort here, maybe it was a queued -* response to a previous command. +* Recv error response, give up. */ + ssif_info->ssif_state =SSIF_IDLE ;ipmi_ssif_unlock_cond (ssif_info, flags); dev_warn(&ssif_info->client->dev, "Invalid response getting flags: %x %x\n",
Greg Kroah-Hartman
maintainerPATCH 34/381 kheaders: Use array declaration instead of char
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
commit b69edab47f1da8edd8e7bfdf8c70f51a2a5d89fb upstream.
Under CONFIG_FORTIFY_SOURCE, memcpy() will check the size of destination and source buffers. Defining kernel_headers_data as "char" would trip this check. Since these addresses are treated as byte arrays, define them as arrays (as done everywhere else).
This was seen with:
$ cat /sys/kernel/kheaders.tar.xz >> /dev/null
detected buffer overflow in memcpy
kernel BUG at lib/string_helpers.c:1027!
...
RIP: 0010:fortify_panic+0xf/0x20 [...] Call Trace: <TASK> ikheaders_read+0x45/0x50 [kheaders] kernfs_fop_read_iter+0x1a4/0x2f0 ...
--- kernel/kheaders.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/kheaders.c +5 -5
@@ -26,15 +26,15 @@ asm (" .popsection \n" ); -extern char kernel_headers_data; -extern char kernel_headers_data_end; +extern char kernel_headers_data[]; +extern char kernel_headers_data_end[];static ssize_t ikheaders_read (struct file *file,struct kobject *kobj,struct bin_attribute *bin_attr,char *buf,loff_t off,size_t len) { -memcpy (buf, &kernel_headers_data + off, len); +memcpy (buf, &kernel_headers_data[off], len);return len; }
@@ -48,8 +48,8 @@ static struct bin_attribute kheaders_attstatic int __init ikheaders_init (void ) { - kheaders_attr.size = (&kernel_headers_data_end - - &kernel_headers_data); + kheaders_attr.size = (kernel_headers_data_end - + kernel_headers_data);return sysfs_create_bin_file (kernel_kobj, &kheaders_attr); }
Greg Kroah-Hartman
maintainerPATCH 35/381 pwm: meson: Fix axg ao mux parents
In reply to Greg Kroah-HartmanFrom: Heiner Kallweit <[email protected]>
commit eb411c0cf59ae6344b34bc6f0d298a22b300627e upstream.
This fix is basically the same as 9bce02ef0dfa ("pwm: meson: Fix the G12A AO clock parents order"). Vendor driver referenced there has xtal as first parent also for axg ao. In addition fix the name of the aoclk81 clock. Apparently name aoclk81 as used by the vendor driver was changed when mainlining the axg clock driver.
--- drivers/pwm/pwm-meson.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-meson.c +1 -1
@@ -424,7 +424,7 @@ static const struct meson_pwm_data pwm_a };static const char *const pwm_axg_ao_parent_names[] = { -"aoclk81" ,"xtal" ,"fclk_div4" ,"fclk_div5" +"xtal" ,"axg_ao_clk81" ,"fclk_div4" ,"fclk_div5" };static const struct meson_pwm_data pwm_axg_ao_data = {
Greg Kroah-Hartman
maintainerPATCH 36/381 pwm: meson: Fix g12a ao clk81 name
In reply to Greg Kroah-HartmanFrom: Heiner Kallweit <[email protected]>
commit 9e4fa80ab7ef9eb4f7b1ea9fc31e0eb040e85e25 upstream.
Fix the name of the aoclk81 clock. Apparently name aoclk81 as used by the vendor driver was changed when mainlining the g12a clock driver.
--- drivers/pwm/pwm-meson.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-meson.c +2 -2
@@ -433,7 +433,7 @@ static const struct meson_pwm_data pwm_a };static const char *const pwm_g12a_ao_ab_parent_names[] = { -"xtal" ,"aoclk81" ,"fclk_div4" ,"fclk_div5" +"xtal" ,"g12a_ao_clk81" ,"fclk_div4" ,"fclk_div5" };static const struct meson_pwm_data pwm_g12a_ao_ab_data = {
@@ -442,7 +442,7 @@ static const struct meson_pwm_data pwm_g };static const char *const pwm_g12a_ao_cd_parent_names[] = { -"xtal" ,"aoclk81" , +"xtal" ,"g12a_ao_clk81" , };static const struct meson_pwm_data pwm_g12a_ao_cd_data = {
Greg Kroah-Hartman
maintainerPATCH 37/381 ring-buffer: Sync IRQ works before buffer destruction
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit 675751bb20634f981498c7d66161584080cc061e upstream.
If something was written to the buffer just before destruction, it may be possible (maybe not in a real system, but it did happen in ARCH=um with time-travel) to destroy the ringbuffer before the IRQ work ran, leading this KASAN report (or a crash without KASAN):
BUG: KASAN: slab-use-after-free in irq_work_run_list+0x11a/0x13a
Read of size 8 at addr 000000006d640a48 by task swapper/0
CPU: 0 PID: 0 Comm: swapper Tainted: G W O 6.3.0-rc1 #7
Stack:
60c4f20f 0c203d48 41b58ab3 60f224fc
600477fa 60f35687 60c4f20f 601273dd
00000008 6101eb00 6101eab0 615be548
Call Trace:
[<60047a58>] show_stack+0x25e/0x282
[<60c609e0>] dump_stack_lvl+0x96/0xfd
[<60c50d4c>] print_report+0x1a7/0x5a8
[<603078d3>] kasan_report+0xc1/0xe9
[<60308950>] __asan_report_load8_noabort+0x1b/0x1d
[<60232844>] irq_work_run_list+0x11a/0x13a
[<602328b4>] irq_work_tick+0x24/0x34
[<6017f9dc>] update_process_times+0x162/0x196
[<6019f335>] tick_sched_handle+0x1a4/0x1c3
[<6019fd9e>] tick_sched_timer+0x79/0x10c
[<601812b9>] __hrtimer_run_queues.constprop.0+0x425/0x695
[<60182913>] hrtimer_interrupt+0x16c/0x2c4
[<600486a3>] um_timer+0x164/0x183
[...]
Allocated by task 411:
save_stack_trace+0x99/0xb5
stack_trace_save+0x81/0x9b
kasan_save_stack+0x2d/0x54
kasan_set_track+0x34/0x3e
kasan_save_alloc_info+0x25/0x28
____kasan_kmalloc+0x8b/0x97
__kasan_kmalloc+0x10/0x12
__kmalloc+0xb2/0xe8
load_elf_phdrs+0xee/0x182
[...]
The buggy address belongs to the object at 000000006d640800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 584 bytes inside of
freed 1024-byte region [000000006d640800, 000000006d640c00)Add the appropriate irq_work_sync() so the work finishes before the buffers are destroyed.
Prior to the commit in the Fixes tag below, there was only a single global IRQ work, so this issue didn't exist.
--- kernel/trace/ring_buffer.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/trace/ring_buffer.c +4 -0
@@ -1644,6 +1644,8 @@ static void rb_free_cpu_buffer(struct ristruct list_head *head = cpu_buffer->pages;struct buffer_page *bpage, *tmp; +irq_work_sync (&cpu_buffer->irq_work.work); +free_buffer_page (cpu_buffer->reader_page);if (head) {
@@ -1750,6 +1752,8 @@ ring_buffer_free(struct trace_buffer *bucpuhp_state_remove_instance (CPUHP_TRACE_RB_PREPARE , &buffer->node); +irq_work_sync (&buffer->irq_work.work); +for_each_buffer_cpu (buffer, cpu)rb_free_cpu_buffer (buffer->buffers[cpu]);
Greg Kroah-Hartman
maintainerPATCH 38/381 crypto: api - Demote BUG_ON() in crypto_unregister_alg() to a WARN_ON()
In reply to Greg Kroah-HartmanFrom: Toke Høiland-Jørgensen <[email protected]>
commit a543ada7db729514ddd3ba4efa45f4c7b802ad85 upstream.
The crypto_unregister_alg() function expects callers to ensure that any algorithm that is unregistered has a refcnt of exactly 1, and issues a BUG_ON() if this is not the case. However, there are in fact drivers that will call crypto_unregister_alg() without ensuring that the refcnt has been lowered first, most notably on system shutdown. This causes the BUG_ON() to trigger, which prevents a clean shutdown and hangs the system.
To avoid such hangs on shutdown, demote the BUG_ON() in crypto_unregister_alg() to a WARN_ON() with early return. Cc stable because this problem was observed on a 6.2 kernel, cf the link below.
--- crypto/algapi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
crypto/algapi.c +3 -1
@@ -456,7 +456,9 @@ void crypto_unregister_alg(struct cryptoif (WARN (ret,"Algorithm %s is not registered" , alg->cra_driver_name))return ; -BUG_ON (refcount_read (&alg->cra_refcnt) !=1 ); +if (WARN_ON (refcount_read (&alg->cra_refcnt) !=1 )) +return ; +if (alg->cra_destroy) alg->cra_destroy (alg);
Greg Kroah-Hartman
maintainerPATCH 39/381 crypto: safexcel - Cleanup ring IRQ workqueues on load failure
In reply to Greg Kroah-HartmanFrom: Jonathan McDowell <[email protected]>
commit ca25c00ccbc5f942c63897ed23584cfc66e8ec81 upstream.
A failure loading the safexcel driver results in the following warning on boot, because the IRQ affinity has not been correctly cleaned up. Ensure we clean up the affinity and workqueues on a failure to load the driver.
crypto-safexcel: probe of f2800000.crypto failed with error -2
------------[ cut here ]------------ WARNING: CPU: 1 PID: 232 at kernel/irq/manage.c:1913 free_irq+0x300/0x340 Modules linked in: hwmon mdio_i2c crypto_safexcel(+) md5 sha256_generic libsha256 authenc libdes omap_rng rng_core nft_masq nft_nat nft_chain_nat nf_nat nft_ct nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables libcrc32c nfnetlink fuse autofs4 CPU: 1 PID: 232 Comm: systemd-udevd Tainted: G W 6.1.6-00002-g9d4898824677 #3 Hardware name: MikroTik RB5009 (DT) pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : free_irq+0x300/0x340 lr : free_irq+0x2e0/0x340
sp : ffff800008fa3890
x29: ffff800008fa3890 x28: 0000000000000000 x27: 0000000000000000
x26: ffff8000008e6dc0 x25: ffff000009034cac x24: ffff000009034d50
x23: 0000000000000000 x22: 000000000000004a x21: ffff0000093e0d80
x20: ffff000009034c00 x19: ffff00000615fc00 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 000075f5c1584c5e
x14: 0000000000000017 x13: 0000000000000000 x12: 0000000000000040
x11: ffff000000579b60 x10: ffff000000579b62 x9 : ffff800008bbe370 x8 : ffff000000579dd0 x7 : 0000000000000000 x6 : ffff000000579e18 x5 : ffff000000579da8 x4 : ffff800008ca0000 x3 : ffff800008ca0188 x2 : 0000000013033204 x1 : ffff000009034c00 x0 : ffff8000087eadf0
Call trace: free_irq+0x300/0x340 devm_irq_release+0x14/0x20 devres_release_all+0xa0/0x100 device_unbind_cleanup+0x14/0x60 really_probe+0x198/0x2d4 __driver_probe_device+0x74/0xdc driver_probe_device+0x3c/0x110 __driver_attach+0x8c/0x190 bus_for_each_dev+0x6c/0xc0 driver_attach+0x20/0x30 bus_add_driver+0x148/0x1fc driver_register+0x74/0x120 __platform_driver_register+0x24/0x30 safexcel_init+0x48/0x1000 [crypto_safexcel] do_one_initcall+0x4c/0x1b0 do_init_module+0x44/0x1cc load_module+0x1724/0x1be4 __do_sys_finit_module+0xbc/0x110 __arm64_sys_finit_module+0x1c/0x24 invoke_syscall+0x44/0x110 el0_svc_common.constprop.0+0xc0/0xe0 do_el0_svc+0x20/0x80 el0_svc+0x14/0x4c el0t_64_sync_handler+0xb0/0xb4 el0t_64_sync+0x148/0x14c ---[ end trace 0000000000000000 ]---
--- drivers/crypto/inside-secure/safexcel.c | 37 +++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-)
drivers/crypto/inside-secure/safexcel.c +27 -10
@@ -1634,19 +1634,23 @@ static int safexcel_probe_generic(void * &priv->ring[i].rdr);if (ret) {dev_err (dev,"Failed to initialize rings\n" ); -return ret; + goto err_cleanup_rings; } priv->ring[i].rdr_req =devm_kcalloc (dev,EIP197_DEFAULT_RING_SIZE ,sizeof (*priv->ring[i].rdr_req),GFP_KERNEL ); -if (!priv->ring[i].rdr_req) -return -ENOMEM ; +if (!priv->ring[i].rdr_req) { + ret = -ENOMEM ; + goto err_cleanup_rings; + } ring_irq =devm_kzalloc (dev,sizeof (*ring_irq),GFP_KERNEL ); -if (!ring_irq) -return -ENOMEM ; +if (!ring_irq) { + ret = -ENOMEM ; + goto err_cleanup_rings; + } ring_irq->priv = priv; ring_irq->ring = i;
@@ -1660,7 +1664,8 @@ static int safexcel_probe_generic(void * ring_irq);if (irq <0 ) {dev_err (dev,"Failed to get IRQ ID for ring %d\n" , i); -return irq; + ret = irq; + goto err_cleanup_rings; } priv->ring[i].irq = irq;
@@ -1672,8 +1677,10 @@ static int safexcel_probe_generic(void *snprintf (wq_name,9 ,"wq_ring%d" , i); priv->ring[i].workqueue =create_singlethread_workqueue (wq_name); -if (!priv->ring[i].workqueue) -return -ENOMEM ; +if (!priv->ring[i].workqueue) { + ret = -ENOMEM ; + goto err_cleanup_rings; + } priv->ring[i].requests =0 ; priv->ring[i].busy = false;
@@ -1690,16 +1697,26 @@ static int safexcel_probe_generic(void * ret =safexcel_hw_init (priv);if (ret) {dev_err (dev,"HW init failed (%d)\n" , ret); -return ret; + goto err_cleanup_rings; } ret =safexcel_register_algorithms (priv);if (ret) {dev_err (dev,"Failed to register algorithms (%d)\n" , ret); -return ret; + goto err_cleanup_rings; }return 0 ; + +err_cleanup_rings: +for (i =0 ; i < priv->config.rings; i++) { +if (priv->ring[i].irq) +irq_set_affinity_hint (priv->ring[i].irq,NULL ); +if (priv->ring[i].workqueue) +destroy_workqueue (priv->ring[i].workqueue); + } + +return ret; }static void safexcel_hw_reset_rings (struct safexcel_crypto_priv *priv)
Greg Kroah-Hartman
maintainerPATCH 40/381 rcu: Avoid stack overflow due to __rcu_irq_enter_check_tick() being kprobe-ed
In reply to Greg Kroah-HartmanFrom: Zheng Yejian <[email protected]>
commit 7a29fb4a4771124bc61de397dbfc1554dbbcc19c upstream.
Registering a kprobe on __rcu_irq_enter_check_tick() can cause kernel stack overflow as shown below. This issue can be reproduced by enabling CONFIG_NO_HZ_FULL and booting the kernel with argument "nohz_full=", and then giving the following commands at the shell prompt:
# cd /sys/kernel/tracing/ # echo 'p:mp1 __rcu_irq_enter_check_tick' >> kprobe_events # echo 1 > events/kprobes/enable
This commit therefore adds __rcu_irq_enter_check_tick() to the kprobes blacklist using NOKPROBE_SYMBOL().
Insufficient stack space to handle exception!
ESR: 0x00000000f2000004 -- BRK (AArch64) FAR: 0x0000ffffccf3e510 Task stack: [0xffff80000ad30000..0xffff80000ad38000] IRQ stack: [0xffff800008050000..0xffff800008058000] Overflow stack: [0xffff089c36f9f310..0xffff089c36fa0310] CPU: 5 PID: 190 Comm: bash Not tainted 6.2.0-rc2-00320-g1f5abbd77e2c #19 Hardware name: linux,dummy-virt (DT) pstate: 400003c5 (nZcv DAIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __rcu_irq_enter_check_tick+0x0/0x1b8 lr : ct_nmi_enter+0x11c/0x138
sp : ffff80000ad30080
x29: ffff80000ad30080 x28: ffff089c82e20000 x27: 0000000000000000
x26: 0000000000000000 x25: ffff089c02a8d100 x24: 0000000000000000
x23: 00000000400003c5 x22: 0000ffffccf3e510 x21: ffff089c36fae148
x20: ffff80000ad30120 x19: ffffa8da8fcce148 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: ffffa8da8e44ea6c
x14: ffffa8da8e44e968 x13: ffffa8da8e03136c x12: 1fffe113804d6809
x11: ffff6113804d6809 x10: 0000000000000a60 x9 : dfff800000000000 x8 : ffff089c026b404f x7 : 00009eec7fb297f7 x6 : 0000000000000001 x5 : ffff80000ad30120 x4 : dfff800000000000 x3 : ffffa8da8e3016f4 x2 : 0000000000000003 x1 : 0000000000000000 x0 : 0000000000000000
Kernel panic - not syncing: kernel stack overflow CPU: 5 PID: 190 Comm: bash Not tainted 6.2.0-rc2-00320-g1f5abbd77e2c #19 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0xf8/0x108 show_stack+0x20/0x30 dump_stack_lvl+0x68/0x84 dump_stack+0x1c/0x38 panic+0x214/0x404 add_taint+0x0/0xf8 panic_bad_stack+0x144/0x160 handle_bad_stack+0x38/0x58 __bad_stack+0x78/0x7c __rcu_irq_enter_check_tick+0x0/0x1b8 arm64_enter_el1_dbg.isra.0+0x14/0x20 el1_dbg+0x2c/0x90 el1h_64_sync_handler+0xcc/0xe8 el1h_64_sync+0x64/0x68 __rcu_irq_enter_check_tick+0x0/0x1b8 arm64_enter_el1_dbg.isra.0+0x14/0x20 el1_dbg+0x2c/0x90 el1h_64_sync_handler+0xcc/0xe8 el1h_64_sync+0x64/0x68 __rcu_irq_enter_check_tick+0x0/0x1b8 arm64_enter_el1_dbg.isra.0+0x14/0x20 el1_dbg+0x2c/0x90 el1h_64_sync_handler+0xcc/0xe8 el1h_64_sync+0x64/0x68 __rcu_irq_enter_check_tick+0x0/0x1b8 [...] el1_dbg+0x2c/0x90 el1h_64_sync_handler+0xcc/0xe8 el1h_64_sync+0x64/0x68 __rcu_irq_enter_check_tick+0x0/0x1b8 arm64_enter_el1_dbg.isra.0+0x14/0x20 el1_dbg+0x2c/0x90 el1h_64_sync_handler+0xcc/0xe8 el1h_64_sync+0x64/0x68 __rcu_irq_enter_check_tick+0x0/0x1b8 arm64_enter_el1_dbg.isra.0+0x14/0x20 el1_dbg+0x2c/0x90 el1h_64_sync_handler+0xcc/0xe8 el1h_64_sync+0x64/0x68 __rcu_irq_enter_check_tick+0x0/0x1b8 el1_interrupt+0x28/0x60 el1h_64_irq_handler+0x18/0x28 el1h_64_irq+0x64/0x68 __ftrace_set_clr_event_nolock+0x98/0x198 __ftrace_set_clr_event+0x58/0x80 system_enable_write+0x144/0x178 vfs_write+0x174/0x738 ksys_write+0xd0/0x188 __arm64_sys_write+0x4c/0x60 invoke_syscall+0x64/0x180 el0_svc_common.constprop.0+0x84/0x160 do_el0_svc+0x48/0xe8 el0_svc+0x34/0xd0 el0t_64_sync_handler+0xb8/0xc0 el0t_64_sync+0x190/0x194
SMP: stopping secondary CPUs
Kernel Offset: 0x28da86000000 from 0xffff800008000000PHYS_OFFSET: 0xfffff76600000000
CPU features: 0x00000,01a00100,0000421b Memory Limit: none
--- kernel/rcu/tree.c | 1 + 1 file changed, 1 insertion(+)
kernel/rcu/tree.c +1 -0
@@ -964,6 +964,7 @@ void __rcu_irq_enter_check_tick(void) }raw_spin_unlock_rcu_node (rdp->mynode); } +NOKPROBE_SYMBOL (__rcu_irq_enter_check_tick);#endif /* CONFIG_NO_HZ_FULL */ /**
Greg Kroah-Hartman
maintainerPATCH 41/381 reiserfs: Add security prefix to xattr name in reiserfs_security_write()
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit d82dcd9e21b77d338dc4875f3d4111f0db314a7c upstream.
Reiserfs sets a security xattr at inode creation time in two stages: first, it calls reiserfs_security_init() to obtain the xattr from active LSMs; then, it calls reiserfs_security_write() to actually write that xattr.
Unfortunately, it seems there is a wrong expectation that LSMs provide the full xattr name in the form 'security.<suffix>'. However, LSMs always provided just the suffix, causing reiserfs to not write the xattr at all (if the suffix is shorter than the prefix), or to write an xattr with the wrong name.
Add a temporary buffer in reiserfs_security_write(), and write to it the full xattr name, before passing it to reiserfs_xattr_set_handle().
Also replace the name length check with a check that the full xattr name is not larger than XATTR_NAME_MAX.
--- fs/reiserfs/xattr_security.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/reiserfs/xattr_security.c +6 -2
@@ -81,11 +81,15 @@ int reiserfs_security_write(struct reisestruct inode *inode, struct reiserfs_security_handle *sec) { + char xattr_name[XATTR_NAME_MAX + 1] = XATTR_SECURITY_PREFIX;int error; -if (strlen (sec->name) <sizeof (XATTR_SECURITY_PREFIX )) + +if (XATTR_SECURITY_PREFIX_LEN +strlen (sec->name) >XATTR_NAME_MAX )return -EINVAL ; - error =reiserfs_xattr_set_handle (th, inode, sec->name, sec->value, +strlcat (xattr_name, sec->name,sizeof (xattr_name)); + + error =reiserfs_xattr_set_handle (th, inode, xattr_name, sec->value, sec->length,XATTR_CREATE );if (error == -ENODATA || error == -EOPNOTSUPP ) error =0 ;
Greg Kroah-Hartman
maintainerPATCH 42/381 KVM: nVMX: Emulate NOPs in L2, and PAUSE if its not intercepted
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit 4984563823f0034d3533854c1b50e729f5191089 upstream.
Extend VMX's nested intercept logic for emulated instructions to handle "pause" interception, in quotes because KVM's emulator doesn't filter out NOPs when checking for nested intercepts. Failure to allow emulation of NOPs results in KVM injecting a #UD into L2 on any NOP that collides with the emulator's definition of PAUSE, i.e. on all single-byte NOPs.
For PAUSE itself, honor L1's PAUSE-exiting control, but ignore PLE to avoid unnecessarily injecting a #UD into L2. Per the SDM, the first execution of PAUSE after VM-Entry is treated as the beginning of a new loop, i.e. will never trigger a PLE VM-Exit, and so L1 can't expect any given execution of PAUSE to deterministically exit.
... the processor considers this execution to be the first execution of PAUSE in a loop. (It also does so for the first execution of PAUSE at CPL 0 after VM entry.)
All that said, the PLE side of things is currently a moot point, as KVM doesn't expose PLE to L1.
Note, vmx_check_intercept() is still wildly broken when L1 wants to intercept an instruction, as KVM injects a #UD instead of synthesizing a nested VM-Exit. That issue extends far beyond NOP/PAUSE and needs far more effort to fix, i.e. is a problem for the future.
--- arch/x86/kvm/vmx/vmx.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/x86/kvm/vmx/vmx.c +15 -0
@@ -7536,6 +7536,21 @@ static int vmx_check_intercept(struct kv/* FIXME: produce nested vmexit and return X86EMUL_INTERCEPTED. */ break ; +case x86_intercept_pause: +/* +* PAUSE is a single-byte NOP with a REPE prefix, i.e. collides +* with vanilla NOPs in the emulator. Apply the interception +* check only to actual PAUSE instructions. Don't check +* PAUSE-loop-exiting, software can't expect a given PAUSE to +* exit, i.e. KVM is within its rights to allow L2 to execute +* the PAUSE. +*/ +if ((info->rep_prefix !=REPE_PREFIX ) || + !nested_cpu_has2 (vmcs12,CPU_BASED_PAUSE_EXITING )) +return X86EMUL_CONTINUE ; + +break ; +/* TODO: check more intercepts... */ default :break ;
Greg Kroah-Hartman
maintainerPATCH 43/381 relayfs: fix out-of-bounds access in relay_file_read
In reply to Greg Kroah-HartmanFrom: Zhang Zhengming <[email protected]>
commit 43ec16f1450f4936025a9bdf1a273affdb9732c1 upstream.
There is a crash in relay_file_read, as the var from point to the end of last subbuf.
The oops looks something like:
pc : __arch_copy_to_user+0x180/0x310 lr : relay_file_read+0x20c/0x2c8 Call trace: __arch_copy_to_user+0x180/0x310 full_proxy_read+0x68/0x98 vfs_read+0xb0/0x1d0 ksys_read+0x6c/0xf0 __arm64_sys_read+0x20/0x28 el0_svc_common.constprop.3+0x84/0x108 do_el0_svc+0x74/0x90 el0_svc+0x1c/0x28 el0_sync_handler+0x88/0xb0 el0_sync+0x148/0x180
We get the condition by analyzing the vmcore:
1). The last produced byte and last consumed byte
both at the end of the last subbuf
2). A softirq calls function(e.g __blk_add_trace)
to write relay buffer occurs when an program is calling
relay_file_read_avail().
relay_file_read
relay_file_read_avail
relay_file_read_consume(buf, 0, 0);
//interrupted by softirq who will write subbuf
....
return 1;
//read_start point to the end of the last subbuf
read_start = relay_file_read_start_pos
//avail is equal to subsize
avail = relay_file_read_subbuf_avail
//from points to an invalid memory address
from = buf->start + read_start
//system is crashed
copy_to_user(buffer, from, avail)--- kernel/relay.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/relay.c +2 -1
@@ -1077,7 +1077,8 @@ static size_t relay_file_read_start_pos(size_t subbuf_size = buf->chan->subbuf_size;size_t n_subbufs = buf->chan->n_subbufs;size_t consumed = buf->subbufs_consumed % n_subbufs; -size_t read_pos = consumed * subbuf_size + buf->bytes_consumed; +size_t read_pos = (consumed * subbuf_size + buf->bytes_consumed) + % (n_subbufs * subbuf_size); read_subbuf = read_pos / subbuf_size; padding = buf->padding[read_subbuf];
Greg Kroah-Hartman
maintainerPATCH 44/381 writeback, cgroup: fix null-ptr-deref write in bdi_split_work_to_wbs
In reply to Greg Kroah-HartmanFrom: Baokun Li <[email protected]>
[ Upstream commit 1ba1199ec5747f475538c0d25a32804e5ba1dfde ]
KASAN report null-ptr-deref:
==================================================================
BUG: KASAN: null-ptr-deref in bdi_split_work_to_wbs+0x5c5/0x7b0 Write of size 8 at addr 0000000000000000 by task sync/943 CPU: 5 PID: 943 Comm: sync Tainted: 6.3.0-rc5-next-20230406-dirty #461 Call Trace: <TASK> dump_stack_lvl+0x7f/0xc0 print_report+0x2ba/0x340 kasan_report+0xc4/0x120 kasan_check_range+0x1b7/0x2e0 __kasan_check_write+0x24/0x40 bdi_split_work_to_wbs+0x5c5/0x7b0 sync_inodes_sb+0x195/0x630 sync_inodes_one_sb+0x3a/0x50 iterate_supers+0x106/0x1b0 ksys_sync+0x98/0x160
[...]
==================================================================
The race that causes the above issue is as follows:
cpu1 cpu2
-------------------------|------------------------- inode_switch_wbs
INIT_WORK(&isw->work, inode_switch_wbs_work_fn) queue_rcu_work(isw_wq, &isw->work)
// queue_work async
inode_switch_wbs_work_fn
wb_put_many(old_wb, nr_switched)
percpu_ref_put_many
ref->data->release(ref)
cgwb_release
queue_work(cgwb_release_wq, &wb->release_work)
// queue_work async
&wb->release_work
cgwb_release_workfn
ksys_sync
iterate_supers
sync_inodes_one_sb
sync_inodes_sb
bdi_split_work_to_wbs
kmalloc(sizeof(*work), GFP_ATOMIC)
// alloc memory failed
percpu_ref_exit
ref->data = NULL
kfree(data)
wb_get(wb)
percpu_ref_get(&wb->refcnt)
percpu_ref_get_many(ref, 1)
atomic_long_add(nr, &ref->data->count)
atomic64_add(i, v)
// trigger null-ptr-derefbdi_split_work_to_wbs() traverses &bdi->wb_list to split work into all wbs. If the allocation of new work fails, the on-stack fallback will be used and the reference count of the current wb is increased afterwards. If cgroup writeback membership switches occur before getting the reference count and the current wb is released as old_wd, then calling wb_get() or wb_put() will trigger the null pointer dereference above.
This issue was introduced in v4.3-rc7 (see fix tag1). Both sync_inodes_sb() and __writeback_inodes_sb_nr() calls to bdi_split_work_to_wbs() can trigger this issue. For scenarios called via sync_inodes_sb(), originally commit 7fc5854f8c6e ("writeback: synchronize sync(2) against cgroup writeback membership switches") reduced the possibility of the issue by adding wb_switch_rwsem, but in v5.14-rc1 (see fix tag2) removed the "inode_io_list_del_locked(inode, old_wb)" from inode_switch_wbs_work_fn() so that wb->state contains WB_has_dirty_io, thus old_wb is not skipped when traversing wbs in bdi_split_work_to_wbs(), and the issue becomes easily reproducible again.
To solve this problem, percpu_ref_exit() is called under RCU protection to avoid race between cgwb_release_workfn() and bdi_split_work_to_wbs(). Moreover, replace wb_get() with wb_tryget() in bdi_split_work_to_wbs(), and skip the current wb if wb_tryget() fails because the wb has already been shutdown.
--- fs/fs-writeback.c | 17 ++++++++++------- mm/backing-dev.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 8 deletions(-)
fs/fs-writeback.c +10 -7
@@ -884,6 +884,16 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,continue ; } +/* +* If wb_tryget fails, the wb has been shutdown, skip it. +* +* Pin @wb so that it stays on @bdi->wb_list. This allows +* continuing iteration from @wb after dropping and +* regrabbing rcu read lock. +*/ +if (!wb_tryget (wb)) +continue ; +/* alloc failed, execute synchronously using on-stack fallback */ work = &fallback_work; *work = *base_work;
@@ -892,13 +902,6 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi, work->done = &fallback_work_done;wb_queue_work (wb, work); - -/* -* Pin @wb so that it stays on @bdi->wb_list. This allows -* continuing iteration from @wb after dropping and -* regrabbing rcu read lock. -*/ -wb_get (wb); last_wb = wb;rcu_read_unlock ();
mm/backing-dev.c +10 -1
@@ -378,6 +378,15 @@ static void wb_exit(struct bdi_writeback *wb)static DEFINE_SPINLOCK (cgwb_lock);static struct workqueue_struct *cgwb_release_wq; +static void cgwb_free_rcu (struct rcu_head *rcu_head) +{ +struct bdi_writeback *wb =container_of (rcu_head, + struct bdi_writeback, rcu); + +percpu_ref_exit (&wb->refcnt); +kfree (wb); +} +static void cgwb_release_workfn (struct work_struct *work) { struct bdi_writeback *wb = container_of(work, struct bdi_writeback,
@@ -397,7 +406,7 @@ static void cgwb_release_workfn(struct work_struct *work)fprop_local_destroy_percpu (&wb->memcg_completions);percpu_ref_exit (&wb->refcnt);wb_exit (wb); -kfree_rcu (wb, rcu); +call_rcu (&wb->rcu, cgwb_free_rcu); }static void cgwb_release (struct percpu_ref *refcnt)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 45/381 i2c: omap: Fix standard mode false ACK readings
In reply to Greg Kroah-HartmanFrom: Reid Tonking <[email protected]>
commit c770657bd2611b077ec1e7b1fe6aa92f249399bd upstream.
Using standard mode, rare false ACK responses were appearing with i2cdetect tool. This was happening due to NACK interrupt triggering ISR thread before register access interrupt was ready. Removing the NACK interrupt's ability to trigger ISR thread lets register access ready interrupt do this instead.
--- drivers/i2c/busses/i2c-omap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-omap.c +1 -1
@@ -1058,7 +1058,7 @@ omap_i2c_isr(int irq, void *dev_id)u16 stat; stat =omap_i2c_read_reg (omap,OMAP_I2C_STAT_REG ); - mask =omap_i2c_read_reg (omap,OMAP_I2C_IE_REG ); + mask =omap_i2c_read_reg (omap,OMAP_I2C_IE_REG ) & ~OMAP_I2C_STAT_NACK ;if (stat & mask) ret =IRQ_WAKE_THREAD ;
Greg Kroah-Hartman
maintainerPATCH 46/381 iommu/amd: Fix "Guest Virtual APIC Table Root Pointer" configuration in IRTE
In reply to Greg Kroah-HartmanFrom: Kishon Vijay Abraham I <[email protected]>
commit ccc62b827775915a9b82db42a29813d04f92df7a upstream.
commit b9c6ff94e43a ("iommu/amd: Re-factor guest virtual APIC (de-)activation code") while refactoring guest virtual APIC activation/de-activation code, stored information for activate/de-activate in "struct amd_ir_data". It used 32-bit integer data type for storing the "Guest Virtual APIC Table Root Pointer" (ga_root_ptr), though the "ga_root_ptr" is actually a 40-bit field in IRTE (Interrupt Remapping Table Entry).
This causes interrupts from PCIe devices to not reach the guest in the case of PCIe passthrough with SME (Secure Memory Encryption) enabled as _SME_ bit in the "ga_root_ptr" is lost before writing it to the IRTE.
Fix it by using 64-bit data type for storing the "ga_root_ptr". While at that also change the data type of "ga_tag" to u32 in order to match the IOMMU spec.
--- drivers/iommu/amd/amd_iommu_types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/amd/amd_iommu_types.h +2 -2
@@ -897,8 +897,8 @@ struct amd_ir_data {*/ struct irq_cfg *cfg;int ga_vector; -int ga_root_ptr; -int ga_tag; +u64 ga_root_ptr; +u32 ga_tag; };struct amd_irte_ops {
Greg Kroah-Hartman
maintainerPATCH 47/381 Revert "ubifs: dirty_cow_znode: Fix memleak in error handling path"
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit 7d01cb27f6aebc54efbe28d8961a973b8f795b13 upstream.
This reverts commit 122deabfe1428 (ubifs: dirty_cow_znode: Fix memleak in error handling path).
After commit 122deabfe1428 applied, if insert_old_idx() failed, old index neither exists in TNC nor in old-index tree. Which means that old index node could be overwritten in layout_leb_in_gaps(), then ubifs image will be corrupted in power-cut.
--- fs/ubifs/tnc.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
fs/ubifs/tnc.c +1 -8
@@ -267,18 +267,11 @@ static struct ubifs_znode *dirty_cow_znoif (zbr->len) { err =insert_old_idx (c, zbr->lnum, zbr->offs);if (unlikely (err)) -/* -* Obsolete znodes will be freed by tnc_destroy_cnext() -* or free_obsolete_znodes(), copied up znodes should -* be added back to tnc and freed by -* ubifs_destroy_tnc_subtree(). -*/ - goto out; +return ERR_PTR (err); err =add_idx_dirt (c, zbr->lnum, zbr->len); }else err =0 ; -out: zbr->znode = zn; zbr->lnum =0 ; zbr->offs =0 ;
Greg Kroah-Hartman
maintainerPATCH 48/381 ubifs: Fix memleak when insert_old_idx() failed
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit b5fda08ef213352ac2df7447611eb4d383cce929 upstream.
Following process will cause a memleak for copied up znode:
dirty_cow_znode
zn = copy_znode(c, znode);
err = insert_old_idx(c, zbr->lnum, zbr->offs);
if (unlikely(err))
return ERR_PTR(err); // No one refers to zn.
Fetch a reproducer in [Link].
Function copy_znode() is split into 2 parts: resource allocation and znode replacement, insert_old_idx() is split in similar way, so resource cleanup could be done in error handling path without corrupting metadata(mem & disk).
It's okay that old index inserting is put behind of add_idx_dirt(), old index is used in layout_leb_in_gaps(), so the two processes do not depend on each other.
--- fs/ubifs/tnc.c | 137 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 87 insertions(+), 50 deletions(-)
fs/ubifs/tnc.c +87 -50
@@ -44,6 +44,33 @@ enum { NOT_ON_MEDIA = 3, }; +static void do_insert_old_idx (struct ubifs_info *c, +struct ubifs_old_idx *old_idx) +{ +struct ubifs_old_idx *o; +struct rb_node **p, *parent =NULL ; + + p = &c->old_idx.rb_node; +while (*p) { + parent = *p; + o = rb_entry(parent, struct ubifs_old_idx, rb); +if (old_idx->lnum < o->lnum) + p = &(*p)->rb_left; +else if (old_idx->lnum > o->lnum) + p = &(*p)->rb_right; +else if (old_idx->offs < o->offs) + p = &(*p)->rb_left; +else if (old_idx->offs > o->offs) + p = &(*p)->rb_right; +else { +ubifs_err (c,"old idx added twice!" ); +kfree (old_idx); + } + } +rb_link_node (&old_idx->rb, parent, p); +rb_insert_color (&old_idx->rb, &c->old_idx); +} +/** * insert_old_idx - record an index node obsoleted since the last commit start. * @c: UBIFS file-system description object
@@ -69,35 +96,15 @@ enum {*/ static int insert_old_idx (struct ubifs_info *c,int lnum,int offs) { -struct ubifs_old_idx *old_idx, *o; -struct rb_node **p, *parent =NULL ; +struct ubifs_old_idx *old_idx; old_idx =kmalloc (sizeof (struct ubifs_old_idx ),GFP_NOFS );if (unlikely (!old_idx))return -ENOMEM ; old_idx->lnum = lnum; old_idx->offs = offs; +do_insert_old_idx (c, old_idx); - p = &c->old_idx.rb_node; -while (*p) { - parent = *p; - o = rb_entry(parent, struct ubifs_old_idx, rb); -if (lnum < o->lnum) - p = &(*p)->rb_left; -else if (lnum > o->lnum) - p = &(*p)->rb_right; -else if (offs < o->offs) - p = &(*p)->rb_left; -else if (offs > o->offs) - p = &(*p)->rb_right; -else { -ubifs_err (c,"old idx added twice!" ); -kfree (old_idx); -return 0 ; - } - } -rb_link_node (&old_idx->rb, parent, p); -rb_insert_color (&old_idx->rb, &c->old_idx);return 0 ; }
@@ -199,23 +206,6 @@ static struct ubifs_znode *copy_znode(st__set_bit (DIRTY_ZNODE , &zn->flags);__clear_bit (COW_ZNODE , &zn->flags); -ubifs_assert (c, !ubifs_zn_obsolete (znode)); -__set_bit (OBSOLETE_ZNODE , &znode->flags); - -if (znode->level !=0 ) { -int i; -const int n = zn->child_cnt; - -/* The children now have new parent */ -for (i =0 ; i < n; i++) { -struct ubifs_zbranch *zbr = &zn->zbranch[i]; - -if (zbr->znode) - zbr->znode->parent = zn; - } - } - -atomic_long_inc (&c->dirty_zn_cnt);return zn; }
@@ -234,6 +224,42 @@ static int add_idx_dirt(struct ubifs_inf }/** +* replace_znode - replace old znode with new znode. +* @c: UBIFS file-system description object +* @new_zn: new znode +* @old_zn: old znode +* @zbr: the branch of parent znode +* +* Replace old znode with new znode in TNC. +*/ +static void replace_znode (struct ubifs_info *c,struct ubifs_znode *new_zn, +struct ubifs_znode *old_zn,struct ubifs_zbranch *zbr) +{ +ubifs_assert (c, !ubifs_zn_obsolete (old_zn)); +__set_bit (OBSOLETE_ZNODE , &old_zn->flags); + +if (old_zn->level !=0 ) { +int i; +const int n = new_zn->child_cnt; + +/* The children now have new parent */ +for (i =0 ; i < n; i++) { +struct ubifs_zbranch *child = &new_zn->zbranch[i]; + +if (child->znode) + child->znode->parent = new_zn; + } + } + + zbr->znode = new_zn; + zbr->lnum =0 ; + zbr->offs =0 ; + zbr->len =0 ; + +atomic_long_inc (&c->dirty_zn_cnt); +} + +/** * dirty_cow_znode - ensure a znode is not being committed. * @c: UBIFS file-system description object * @zbr: branch of znode to check
@@ -265,21 +291,32 @@ static struct ubifs_znode *dirty_cow_znoreturn zn;if (zbr->len) { - err =insert_old_idx (c, zbr->lnum, zbr->offs); -if (unlikely (err)) -return ERR_PTR (err); +struct ubifs_old_idx *old_idx; + + old_idx =kmalloc (sizeof (struct ubifs_old_idx ),GFP_NOFS ); +if (unlikely (!old_idx)) { + err = -ENOMEM ; + goto out; + } + old_idx->lnum = zbr->lnum; + old_idx->offs = zbr->offs; + err =add_idx_dirt (c, zbr->lnum, zbr->len); - }else - err =0 ; +if (err) { +kfree (old_idx); + goto out; + } - zbr->znode = zn; - zbr->lnum =0 ; - zbr->offs =0 ; - zbr->len =0 ; +do_insert_old_idx (c, old_idx); + } + +replace_znode (c, zn, znode, zbr); -if (unlikely (err)) -return ERR_PTR (err);return zn; + +out: +kfree (zn); +return ERR_PTR (err); }/**
Greg Kroah-Hartman
maintainerPATCH 49/381 ubi: Fix return value overwrite issue in try_write_vid_and_data()
In reply to Greg Kroah-HartmanFrom: Wang YanQing <[email protected]>
commit 31a149d5c13c4cbcf97de3435817263a2d8c9d6e upstream.
The commit 2d78aee426d8 ("UBI: simplify LEB write and atomic LEB change code") adds helper function, try_write_vid_and_data(), to simplify the code, but this helper function has bug, it will return 0 (success) when ubi_io_write_vid_hdr() or the ubi_io_write_data() return error number (-EIO, etc), because the return value of ubi_wl_put_peb() will overwrite the original return value.
This issue will cause unexpected data loss issue, because the caller of this function and UBIFS willn't know the data is lost.
--- drivers/mtd/ubi/eba.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/mtd/ubi/eba.c +14 -5
@@ -947,7 +947,7 @@ static int try_write_vid_and_data(struct int offset, int len) {struct ubi_device *ubi = vol->ubi; -int pnum, opnum, err, vol_id = vol->vol_id; +int pnum, opnum, err, err2, vol_id = vol->vol_id; pnum =ubi_wl_get_peb (ubi);if (pnum <0 ) {
@@ -982,10 +982,19 @@ static int try_write_vid_and_data(struct out_put:up_read (&ubi->fm_eba_sem); -if (err && pnum >=0 ) - err =ubi_wl_put_peb (ubi, vol_id, lnum, pnum,1 ); -else if (!err && opnum >=0 ) - err =ubi_wl_put_peb (ubi, vol_id, lnum, opnum,0 ); +if (err && pnum >=0 ) { + err2 =ubi_wl_put_peb (ubi, vol_id, lnum, pnum,1 ); +if (err2) { +ubi_warn (ubi,"failed to return physical eraseblock %d, error %d" , + pnum, err2); + } + }else if (!err && opnum >=0 ) { + err2 =ubi_wl_put_peb (ubi, vol_id, lnum, opnum,0 ); +if (err2) { +ubi_warn (ubi,"failed to return physical eraseblock %d, error %d" , + opnum, err2); + } + }return err; }
Greg Kroah-Hartman
maintainerPATCH 50/381 ubifs: Free memory for tmpfile name
In reply to Greg Kroah-HartmanFrom: Mårten Lindahl <[email protected]>
commit 1fb815b38bb31d6af9bd0540b8652a0d6fe6cfd3 upstream.
When opening a ubifs tmpfile on an encrypted directory, function fscrypt_setup_filename allocates memory for the name that is to be stored in the directory entry, but after the name has been copied to the directory entry inode, the memory is not freed.
When running kmemleak on it we see that it is registered as a leak. The report below is triggered by a simple program 'tmpfile' just opening a tmpfile:
unreferenced object 0xffff88810178f380 (size 32):
comm "tmpfile", pid 509, jiffies 4294934744 (age 1524.742s)
backtrace:
__kmem_cache_alloc_node
__kmalloc
fscrypt_setup_filename
ubifs_tmpfile
vfs_tmpfile
path_openatFree this memory after it has been copied to the inode.
--- fs/ubifs/dir.c | 1 + 1 file changed, 1 insertion(+)
fs/ubifs/dir.c +1 -0
@@ -425,6 +425,7 @@ static int do_tmpfile(struct inode *dir,mutex_unlock (&dir_ui->ui_mutex);ubifs_release_budget (c, &req); +fscrypt_free_filename (&nm);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 51/381 sound/oss/dmasound: fix build when drivers are mixed =y/=m
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 9dd7c46346ca4390f84a7ea9933005eb1b175c15 upstream.
When CONFIG_DMASOUND_ATARI=m and CONFIG_DMASOUND_Q40=y (or vice versa), dmasound_core.o can be built without dmasound_deinit() being defined, causing a build error:
ERROR: modpost: "dmasound_deinit" [sound/oss/dmasound/dmasound_atari.ko] undefined!
Modify dmasound_core.c and dmasound.h so that dmasound_deinit() is always available.
The mixed modes (=y/=m) also mean that several variables and structs have to be declared in all cases.
--- sound/oss/dmasound/dmasound.h | 6 ------ sound/oss/dmasound/dmasound_core.c | 24 +----------------------- 2 files changed, 1 insertion(+), 29 deletions(-)
sound/oss/dmasound/dmasound.h +0 -6
@@ -88,11 +88,7 @@ static inline int ioctl_return(int __use*/ extern int dmasound_init (void ); -#ifdef MODULE extern void dmasound_deinit (void ); -#else -#define dmasound_deinit () do { } while (0) -#endif /* description of the set-up applies to either hard or soft settings */
@@ -114,9 +110,7 @@ typedef struct {void *(*dma_alloc)(unsigned int ,gfp_t );void (*dma_free)(void *,unsigned int );int (*irqinit)(void ); -#ifdef MODULE void (*irqcleanup)(void ); -#endif void (*init)(void );void (*silence)(void );int (*setFormat)(int );
sound/oss/dmasound/dmasound_core.c +1 -23
@@ -206,12 +206,10 @@ module_param(writeBufSize, int, 0);MODULE_LICENSE ("GPL" ); -#ifdef MODULE static int sq_unit =-1 ;static int mixer_unit =-1 ;static int state_unit =-1 ;static int irq_installed; -#endif /* MODULE */ /* control over who can modify resources shared between play/record */ static fmode_t shared_resource_owner;
@@ -391,9 +389,6 @@ static const struct file_operations mixestatic void mixer_init (void ) { -#ifndef MODULE -int mixer_unit; -#endif mixer_unit =register_sound_mixer (&mixer_fops,-1 );if (mixer_unit <0 )return ;
@@ -1176,9 +1171,6 @@ static const struct file_operations sq_fstatic int sq_init (void ) {const struct file_operations *fops = &sq_fops; -#ifndef MODULE -int sq_unit; -#endif sq_unit =register_sound_dsp (fops,-1 );if (sq_unit <0 ) {
@@ -1380,9 +1372,6 @@ static const struct file_operations statstatic int state_init (void ) { -#ifndef MODULE -int state_unit; -#endif state_unit =register_sound_special (&state_fops,SND_DEV_STATUS );if (state_unit <0 )return state_unit ;
@@ -1400,10 +1389,9 @@ static int state_init(void)int dmasound_init (void ) {int res ; -#ifdef MODULE +if (irq_installed)return -EBUSY ; -#endif /* Set up sound queue, /dev/audio and /dev/dsp. */
@@ -1422,9 +1410,7 @@ int dmasound_init(void)printk (KERN_ERR "DMA sound driver: Interrupt initialization failed\n" );return -ENODEV ; } -#ifdef MODULE irq_installed =1 ; -#endif printk(KERN_INFO "%s DMA sound driver rev %03d installed\n", dmasound.mach.name, (DMASOUND_CORE_REVISION<<4) +
@@ -1438,8 +1424,6 @@ int dmasound_init(void)return 0 ; } -#ifdef MODULE -void dmasound_deinit (void ) {if (irq_installed) {
@@ -1458,8 +1442,6 @@ void dmasound_deinit(void)unregister_sound_dsp (sq_unit); } -#else /* !MODULE */ -static int dmasound_setup (char *str) {int ints[6 ], size;
@@ -1503,8 +1485,6 @@ static int dmasound_setup(char *str)__setup ("dmasound=" , dmasound_setup); -#endif /* !MODULE */ -/* * Conversion tables */
@@ -1591,9 +1571,7 @@ char dmasound_alaw2dma8[] = {EXPORT_SYMBOL (dmasound);EXPORT_SYMBOL (dmasound_init); -#ifdef MODULE EXPORT_SYMBOL (dmasound_deinit); -#endif EXPORT_SYMBOL (dmasound_write_sq);EXPORT_SYMBOL (dmasound_catchRadius);#ifdef HAS_8BIT_TABLES
Greg Kroah-Hartman
maintainerPATCH 52/381 parisc: Fix argument pointer in real64_call_asm()
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 6e3220ba3323a2c24be834aebf5d6e9f89d0993f upstream.
Fix the argument pointer (ap) to point to real-mode memory instead of virtual memory.
It's interesting that this issue hasn't shown up earlier, as this could have happened with any 64-bit PDC ROM code.
I just noticed it because I suddenly faced a HPMC while trying to execute the 64-bit STI ROM code of an Visualize-FXe graphics card for the STI text console.
--- arch/parisc/kernel/real2.S | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/parisc/kernel/real2.S +2 -3
@@ -248,9 +248,6 @@ ENTRY_CFI(real64_call_asm) /* save fn */ copy %arg2, %r31 - /* set up the new ap */ - ldo 64(%arg1), %r29 - /* load up the arg registers from the saved arg area */ /* 32-bit calling convention passes first 4 args in registers */ ldd 0*REG_SZ(%arg1), %arg0 /* note overwriting arg0 */
@@ -262,7 +259,9 @@ ENTRY_CFI(real64_call_asm) ldd 7*REG_SZ(%arg1), %r19 ldd 1*REG_SZ(%arg1), %arg1 /* do this one last! */ + /* set up real-mode stack and real-mode ap */ tophys_r1 %sp + ldo -16(%sp), %r29 /* Reference param save area */ b,l rfi_virt2real,%r2 nop
Greg Kroah-Hartman
maintainerPATCH 53/381 nilfs2: do not write dirty data after degenerating to read-only
In reply to Greg Kroah-HartmanFrom: Ryusuke Konishi <[email protected]>
commit 28a65b49eb53e172d23567005465019658bfdb4d upstream.
According to syzbot's report, mark_buffer_dirty() called from nilfs_segctor_do_construct() outputs a warning with some patterns after nilfs2 detects metadata corruption and degrades to read-only mode.
After such read-only degeneration, page cache data may be cleared through nilfs_clear_dirty_page() which may also clear the uptodate flag for their buffer heads. However, even after the degeneration, log writes are still performed by unmount processing etc., which causes mark_buffer_dirty() to be called for buffer heads without the "uptodate" flag and causes the warning.
Since any writes should not be done to a read-only file system in the first place, this fixes the warning in mark_buffer_dirty() by letting nilfs_segctor_do_construct() abort early if in read-only mode.
This also changes the retry check of nilfs_segctor_write_out() to avoid unnecessary log write retries if it detects -EROFS that nilfs_segctor_do_construct() returned.
--- fs/nilfs2/segment.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nilfs2/segment.c +4 -1
@@ -2044,6 +2044,9 @@ static int nilfs_segctor_do_construct(ststruct the_nilfs *nilfs = sci->sc_super->s_fs_info;int err; +if (sb_rdonly (sci->sc_super)) +return -EROFS ; +nilfs_sc_cstage_set (sci,NILFS_ST_INIT ); sci->sc_cno = nilfs->ns_cno;
@@ -2729,7 +2732,7 @@ static void nilfs_segctor_write_out(struflush_work (&sci->sc_iput_work); - }while (ret && retrycount-- >0 ); + }while (ret && ret != -EROFS && retrycount-- >0 ); }/**
Greg Kroah-Hartman
maintainerPATCH 54/381 nilfs2: fix infinite loop in nilfs_mdt_get_block()
In reply to Greg Kroah-HartmanFrom: Ryusuke Konishi <[email protected]>
commit a6a491c048882e7e424d407d32cba0b52d9ef2bf upstream.
If the disk image that nilfs2 mounts is corrupted and a virtual block address obtained by block lookup for a metadata file is invalid, nilfs_bmap_lookup_at_level() may return the same internal return code as -ENOENT, meaning the block does not exist in the metadata file.
This duplication of return codes confuses nilfs_mdt_get_block(), causing it to read and create a metadata block indefinitely.
In particular, if this happens to the inode metadata file, ifile, semaphore i_rwsem can be left held, causing task hangs in lock_mount.
Fix this issue by making nilfs_bmap_lookup_at_level() treat virtual block address translation failures with -ENOENT as metadata corruption instead of returning the error code.
--- fs/nilfs2/bmap.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
fs/nilfs2/bmap.c +12 -4
@@ -67,20 +67,28 @@ int nilfs_bmap_lookup_at_level(struct nidown_read (&bmap->b_sem); ret = bmap->b_ops->bop_lookup (bmap, key, level, ptrp); -if (ret <0 ) { - ret =nilfs_bmap_convert_error (bmap, __func__, ret); +if (ret <0 ) goto out; - } +if (NILFS_BMAP_USE_VBN (bmap)) { ret =nilfs_dat_translate (nilfs_bmap_get_dat (bmap), *ptrp, &blocknr);if (!ret) *ptrp = blocknr; +else if (ret == -ENOENT ) { +/* +* If there was no valid entry in DAT for the block +* address obtained by b_ops->bop_lookup, then pass +* internal code -EINVAL to nilfs_bmap_convert_error +* to treat it as metadata corruption. +*/ + ret = -EINVAL ; + } } out:up_read (&bmap->b_sem); -return ret; +return nilfs_bmap_convert_error (bmap, __func__, ret); } int nilfs_bmap_lookup_contig(struct nilfs_bmap *bmap, __u64 key, __u64 *ptrp,
Greg Kroah-Hartman
maintainerPATCH 55/381 md/raid10: fix null-ptr-deref in raid10_sync_request
In reply to Greg Kroah-HartmanFrom: Li Nan <[email protected]>
commit a405c6f0229526160aa3f177f65e20c86fce84c5 upstream.
init_resync() inits mempool and sets conf->have_replacemnt at the beginning of sync, close_sync() frees the mempool when sync is completed.
After [1] recovery might be skipped and init_resync() is called but close_sync() is not. null-ptr-deref occurs with r10bio->dev[i].repl_bio.
The following is one way to reproduce the issue.
1) create a array, wait for resync to complete, mddev->recovery_cp is set to MaxSector.
2) recovery is woken and it is skipped. conf->have_replacement is set to 0 in init_resync(). close_sync() not called.
3) some io errors and rdev A is set to WantReplacement.
4) a new device is added and set to A's replacement.
5) recovery is woken, A have replacement, but conf->have_replacemnt is
0. r10bio->dev[i].repl_bio will not be alloced and null-ptr-deref occurs.
Fix it by not calling init_resync() if recovery skipped.
[1] commit 7e83ccbecd60 ("md/raid10: Allow skipping recovery when clean arrays are assembled")
--- drivers/md/raid10.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/md/raid10.c +4 -4
@@ -2900,10 +2900,6 @@ static sector_t raid10_sync_request(strusector_t chunk_mask = conf->geo.chunk_mask;int page_idx =0 ; -if (!mempool_initialized (&conf->r10buf_pool)) -if (init_resync (conf)) -return 0 ; -/* * Allow skipping a full rebuild for incremental assembly * of a clean array, like RAID1 does.
@@ -2919,6 +2915,10 @@ static sector_t raid10_sync_request(strureturn mddev->dev_sectors - sector_nr; } +if (!mempool_initialized (&conf->r10buf_pool)) +if (init_resync (conf)) +return 0 ; + skipped: max_sector = mddev->dev_sectors; if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery) ||
Greg Kroah-Hartman
maintainerPATCH 56/381 mailbox: zynqmp: Fix IPI isr handling
In reply to Greg Kroah-HartmanFrom: Tanmay Shah <[email protected]>
commit 74ad37a30ffee3643bc34f9ca7225b20a66abaaf upstream.
Multiple IPI channels are mapped to same interrupt handler. Current isr implementation handles only one channel per isr. Fix this behavior by checking isr status bit of all child mailbox nodes.
--- drivers/mailbox/zynqmp-ipi-mailbox.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mailbox/zynqmp-ipi-mailbox.c +3 -3
@@ -152,7 +152,7 @@ static irqreturn_t zynqmp_ipi_interrupt(struct zynqmp_ipi_message *msg;u64 arg0, arg3;struct arm_smccc_res res; -int ret, i; +int ret, i, status =IRQ_NONE ; (void )irq; arg0 =SMC_IPI_MAILBOX_STATUS_ENQUIRY ;
@@ -170,11 +170,11 @@ static irqreturn_t zynqmp_ipi_interrupt(memcpy_fromio (msg->data, mchan->req_buf, msg->len);mbox_chan_received_data (chan, (void *)msg); -return IRQ_HANDLED ; + status =IRQ_HANDLED ; } } } -return IRQ_NONE ; +return status; }/**
Greg Kroah-Hartman
maintainerPATCH 57/381 mailbox: zynqmp: Fix typo in IPI documentation
In reply to Greg Kroah-HartmanFrom: Tanmay Shah <[email protected]>
commit 79963fbfc233759bd8a43462f120d15a1bd4f4fa upstream.
Xilinx IPI message buffers allows 32-byte data transfer. Fix documentation that says 12 bytes
--- include/linux/mailbox/zynqmp-ipi-message.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mailbox/zynqmp-ipi-message.h +1 -1
@@ -9,7 +9,7 @@* @data: message payload * * This is the structure for data used in mbox_send_message -* the maximum length of data buffer is fixed to 12 bytes. +* the maximum length of data buffer is fixed to 32 bytes. * Client is supposed to be aware of this. */ struct zynqmp_ipi_message {
Greg Kroah-Hartman
maintainerPATCH 58/381 wifi: rtl8xxxu: RTL8192EU always needs full init
In reply to Greg Kroah-HartmanFrom: Bitterblue Smith <[email protected]>
commit d46e04ccd40457a0119b76e11ab64a2ad403e138 upstream.
Always run the entire init sequence (rtl8xxxu_init_device()) for RTL8192EU. It's what the vendor driver does too.
This fixes a bug where the device is unable to connect after rebooting:
wlp3s0f3u2: send auth to ... (try 1/3)
wlp3s0f3u2: send auth to ... (try 2/3)
wlp3s0f3u2: send auth to ... (try 3/3)
wlp3s0f3u2: authentication with ... timed out
Rebooting leaves the device powered on (partially? at least the firmware is still running), but not really in a working state.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c +1 -0
@@ -1702,6 +1702,7 @@ struct rtl8xxxu_fileops rtl8192eu_fops = .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc24), .has_s0s1 = 0, .gen2_thermal_meter = 1, + .needs_full_init = 1, .adda_1t_init = 0x0fc01616, .adda_1t_path_on = 0x0fc01616, .adda_2t_path_on_a = 0x0fc01616,
Greg Kroah-Hartman
maintainerPATCH 59/381 clk: rockchip: rk3399: allow clk_cifout to force clk_cifout_src to reparent
In reply to Greg Kroah-HartmanFrom: Quentin Schulz <[email protected]>
commit 933bf364e152cd60902cf9585c2ba310d593e69f upstream.
clk_cifout is derived from clk_cifout_src through an integer divider limited to 32. clk_cifout_src is a child of either cpll, gpll or npll without any possibility of a divider of any sort. The default clock parent is cpll.
Let's allow clk_cifout to ask its parent clk_cifout_src to reparent in order to find the real closest possible rate for clk_cifout and not one derived from cpll only.
--- drivers/clk/rockchip/clk-rk3399.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3399.c +1 -1
@@ -1261,7 +1261,7 @@ static struct rockchip_clk_branch rk3399 RK3399_CLKSEL_CON(56), 6, 2, MFLAGS, RK3399_CLKGATE_CON(10), 7, GFLAGS), -COMPOSITE_NOGATE (SCLK_CIF_OUT ,"clk_cifout" , mux_clk_cif_p,0 , +COMPOSITE_NOGATE (SCLK_CIF_OUT ,"clk_cifout" , mux_clk_cif_p,CLK_SET_RATE_PARENT , RK3399_CLKSEL_CON(56), 5, 1, MFLAGS, 0, 5, DFLAGS),/* gic */
Greg Kroah-Hartman
maintainerPATCH 60/381 rcu: Fix missing TICK_DEP_MASK_RCU_EXP dependency check
In reply to Greg Kroah-HartmanFrom: Zqiang <[email protected]>
[ Upstream commit db7b464df9d820186e98a65aa6a10f0d51fbf8ce ]
This commit adds checks for the TICK_DEP_MASK_RCU_EXP bit, thus enabling RCU expedited grace periods to actually force-enable scheduling-clock interrupts on holdout CPUs.
--- include/trace/events/timer.h | 3 ++- kernel/time/tick-sched.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-)
include/trace/events/timer.h +2 -1
@@ -368,7 +368,8 @@ TRACE_EVENT(itimer_expire, tick_dep_name(PERF_EVENTS) \ tick_dep_name(SCHED) \ tick_dep_name(CLOCK_UNSTABLE) \ - tick_dep_name_end(RCU) + tick_dep_name(RCU) \ + tick_dep_name_end(RCU_EXP) #undef tick_dep_name#undef tick_dep_mask_name
kernel/time/tick-sched.c +5 -0
@@ -213,6 +213,11 @@ static bool check_tick_dependency(atomic_t *dep)return true; } +if (val &TICK_DEP_MASK_RCU_EXP ) { +trace_tick_stop (0 ,TICK_DEP_MASK_RCU_EXP ); +return true; + } +return false; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 61/381 selftests/resctrl: Return NULL if malloc_and_init_memory() did not alloc mem
In reply to Greg Kroah-HartmanFrom: Ilpo Järvinen <[email protected]>
[ Upstream commit 22a8be280383812235131dda18a8212a59fadd2d ]
malloc_and_init_memory() in fill_buf isn't checking if memalign() successfully allocated memory or not before accessing the memory.
Check the return value of memalign() and return NULL if allocating aligned memory fails.
--- tools/testing/selftests/resctrl/fill_buf.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/resctrl/fill_buf.c +2 -0
@@ -68,6 +68,8 @@ static void *malloc_and_init_memory(size_t s)size_t s64;void *p =memalign (PAGE_SIZE , s); +if (!p) +return NULL ; p64 = (uint64_t *)p; s64 = s /sizeof (uint64_t );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 62/381 selftests/resctrl: Check for return value after write_schemata()
In reply to Greg Kroah-HartmanFrom: Ilpo Järvinen <[email protected]>
[ Upstream commit 0d45c83b95da414e98ad333e723141a94f6e2c64 ]
MBA test case writes schemata but it does not check if the write is successful or not.
Add the error check and return error properly.
--- tools/testing/selftests/resctrl/mba_test.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/testing/selftests/resctrl/mba_test.c +6 -1
@@ -28,6 +28,7 @@ static int mba_setup(int num, ...)struct resctrl_val_param *p;char allocation_str[64 ];va_list param; +int ret;va_start (param, num); p = va_arg(param, struct resctrl_val_param *);
@@ -45,7 +46,11 @@ static int mba_setup(int num, ...)sprintf (allocation_str,"%d" , allocation); -write_schemata (p->ctrlgrp, allocation_str, p->cpu_no, p->resctrl_val); + ret =write_schemata (p->ctrlgrp, allocation_str, p->cpu_no, + p->resctrl_val); +if (ret <0 ) +return ret; + allocation -=ALLOCATION_STEP ;return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 63/381 selinux: fix Makefile dependencies of flask.h
In reply to Greg Kroah-HartmanFrom: Ondrej Mosnacek <[email protected]>
[ Upstream commit bcab1adeaad4b39a1e04cb98979a367d08253f03 ]
Make the flask.h target depend on the genheaders binary instead of classmap.h to ensure that it is rebuilt if any of the dependencies of genheaders are changed.
Notably this fixes flask.h not being rebuilt wheninitial_sid_to_string.h is modified.
--- security/selinux/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/selinux/Makefile +2 -2
@@ -21,8 +21,8 @@ ccflags-y := -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include $(addprefix $(obj)/,$(selinux-y)): $(obj)/flask.h quiet_cmd_flask = GEN $(obj)/flask.h $(obj)/av_permissions.h - cmd_flask = scripts/selinux/genheaders/genheaders $(obj)/flask.h $(obj)/av_permissions.h + cmd_flask = $< $(obj)/flask.h $(obj)/av_permissions.h targets += flask.h av_permissions.h -$(obj)/flask.h: $(src)/include/classmap.h FORCE +$(obj)/flask.h: scripts/selinux/genheaders/genheaders FORCE $(call if_changed,flask)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 64/381 selinux: ensure av_permissions.h is built when needed
In reply to Greg Kroah-HartmanFrom: Paul Moore <[email protected]>
[ Upstream commit 4ce1f694eb5d8ca607fed8542d32a33b4f1217a5 ]
The Makefile rule responsible for building flask.h and av_permissions.h only lists flask.h as a target which means that av_permissions.h is only generated when flask.h needs to be generated. This patch fixes this by adding av_permissions.h as a target to the rule.
--- security/selinux/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/Makefile +1 -1
@@ -24,5 +24,5 @@ quiet_cmd_flask = GEN $(obj)/flask.h $(obj)/av_permissions.h cmd_flask = $< $(obj)/flask.h $(obj)/av_permissions.h targets += flask.h av_permissions.h -$(obj)/flask.h: scripts/selinux/genheaders/genheaders FORCE +$(obj)/flask.h $(obj)/av_permissions.h &: scripts/selinux/genheaders/genheaders FORCE $(call if_changed,flask)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 65/381 tpm, tpm_tis: Do not skip reset of original interrupt vector
In reply to Greg Kroah-HartmanFrom: Lino Sanfilippo <[email protected]>
[ Upstream commit ed9be0e6c892a783800d77a41ca4c7255c6af8c5 ]
If in tpm_tis_probe_irq_single() an error occurs after the original interrupt vector has been read, restore the interrupts before the error is returned.
Since the caller does not check the error value, return -1 in any case that the TPM_CHIP_FLAG_IRQ flag is not set. Since the return value of function tpm_tis_gen_interrupt() is not longer used, make it a void function.
--- drivers/char/tpm/tpm_tis_core.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
drivers/char/tpm/tpm_tis_core.c +11 -18
@@ -714,7 +714,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)return IRQ_HANDLED ; } -static int tpm_tis_gen_interrupt (struct tpm_chip *chip) +static void tpm_tis_gen_interrupt (struct tpm_chip *chip) {const char *desc ="attempting to generate an interrupt" ;u32 cap2;
@@ -723,7 +723,7 @@ static int tpm_tis_gen_interrupt(struct tpm_chip *chip) ret =request_locality (chip,0 );if (ret <0 ) -return ret; +return ;if (chip->flags &TPM_CHIP_FLAG_TPM2 ) ret =tpm2_get_tpm_pt (chip,0x100 , &cap2, desc);
@@ -731,8 +731,6 @@ static int tpm_tis_gen_interrupt(struct tpm_chip *chip) ret =tpm1_getcap (chip,TPM_CAP_PROP_TIS_TIMEOUT , &cap, desc,0 );release_locality (chip,0 ); - -return ret; }/* Register the IRQ and issue a command that will cause an interrupt. If an
@@ -762,42 +760,37 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask, rc =tpm_tis_write8 (priv,TPM_INT_VECTOR (priv->locality), irq);if (rc <0 ) -return rc; + goto restore_irqs; rc =tpm_tis_read32 (priv,TPM_INT_STATUS (priv->locality), &int_status);if (rc <0 ) -return rc; + goto restore_irqs;/* Clear all existing */ rc =tpm_tis_write32 (priv,TPM_INT_STATUS (priv->locality), int_status);if (rc <0 ) -return rc; - + goto restore_irqs;/* Turn on */ rc =tpm_tis_write32 (priv,TPM_INT_ENABLE (priv->locality), intmask |TPM_GLOBAL_INT_ENABLE );if (rc <0 ) -return rc; + goto restore_irqs; priv->irq_tested = false;/* Generate an interrupt by having the core call through to * tpm_tis_send */ - rc =tpm_tis_gen_interrupt (chip); -if (rc <0 ) -return rc; +tpm_tis_gen_interrupt (chip); +restore_irqs:/* tpm_tis_send will either confirm the interrupt is working or it * will call disable_irq which undoes all of the above. */ if (!(chip->flags &TPM_CHIP_FLAG_IRQ )) { - rc =tpm_tis_write8 (priv, original_int_vec, -TPM_INT_VECTOR (priv->locality)); -if (rc <0 ) -return rc; - -return 1 ; +tpm_tis_write8 (priv, original_int_vec, +TPM_INT_VECTOR (priv->locality)); +return -1 ; }return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 66/381 tpm, tpm_tis: Claim locality before writing TPM_INT_ENABLE register
In reply to Greg Kroah-HartmanFrom: Lino Sanfilippo <[email protected]>
[ Upstream commit 282657a8bd7fddcf511b834f43705001668b33a7 ]
In disable_interrupts() the TPM_GLOBAL_INT_ENABLE bit is unset in the TPM_INT_ENABLE register to shut the interrupts off. However modifying the register is only possible with a held locality. So claim the locality before disable_interrupts() is called.
Stable-dep-of: 955df4f87760 ("tpm, tpm_tis: Claim locality when interrupts are reenabled on resume")
--- drivers/char/tpm/tpm_tis_core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/char/tpm/tpm_tis_core.c +4 -0
@@ -1076,7 +1076,11 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,dev_err (&chip->dev,FW_BUG "TPM interrupt not working, polling instead\n" ); + rc =request_locality (chip,0 ); +if (rc <0 ) + goto out_err;disable_interrupts (chip); +release_locality (chip,0 ); } }else {tpm_tis_probe_irq (chip, intmask);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 67/381 tpm, tpm_tis: Disable interrupts if tpm_tis_probe_irq() failed
In reply to Greg Kroah-HartmanFrom: Lino Sanfilippo <[email protected]>
[ Upstream commit 6d789ad726950e612a7f31044260337237c5b490 ]
Both functions tpm_tis_probe_irq_single() and tpm_tis_probe_irq() may setup the interrupts and then return with an error. This case is indicated by a missing TPM_CHIP_FLAG_IRQ flag in chip->flags.
Currently the interrupt setup is only undone if tpm_tis_probe_irq_single() fails. Undo the setup also if tpm_tis_probe_irq() fails.
Stable-dep-of: 955df4f87760 ("tpm, tpm_tis: Claim locality when interrupts are reenabled on resume")
--- drivers/char/tpm/tpm_tis_core.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/char/tpm/tpm_tis_core.c +11 -11
@@ -1069,21 +1069,21 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, goto out_err; } -if (irq) { +if (irq)tpm_tis_probe_irq_single (chip, intmask,IRQF_SHARED , irq); -if (!(chip->flags &TPM_CHIP_FLAG_IRQ )) { -dev_err (&chip->dev,FW_BUG +else +tpm_tis_probe_irq (chip, intmask); + +if (!(chip->flags &TPM_CHIP_FLAG_IRQ )) { +dev_err (&chip->dev,FW_BUG "TPM interrupt not working, polling instead\n" ); - rc =request_locality (chip,0 ); -if (rc <0 ) - goto out_err; -disable_interrupts (chip); -release_locality (chip,0 ); - } - }else { -tpm_tis_probe_irq (chip, intmask); + rc =request_locality (chip,0 ); +if (rc <0 ) + goto out_err; +disable_interrupts (chip); +release_locality (chip,0 ); } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 68/381 tpm, tpm_tis: Claim locality before writing interrupt registers
In reply to Greg Kroah-HartmanFrom: Lino Sanfilippo <[email protected]>
[ Upstream commit 15d7aa4e46eba87242a320f39773aa16faddadee ]
In tpm_tis_probe_single_irq() interrupt registers TPM_INT_VECTOR, TPM_INT_STATUS and TPM_INT_ENABLE are modified to setup the interrupts. Currently these modifications are done without holding a locality thus they have no effect. Fix this by claiming the (default) locality before the registers are written.
Since now tpm_tis_gen_interrupt() is called with the locality already claimed remove locality request and release from this function.
Stable-dep-of: 955df4f87760 ("tpm, tpm_tis: Claim locality when interrupts are reenabled on resume")
--- drivers/char/tpm/tpm_tis_core.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/char/tpm/tpm_tis_core.c +11 -9
@@ -721,16 +721,10 @@ static void tpm_tis_gen_interrupt(struct tpm_chip *chip)cap_t cap;int ret; - ret =request_locality (chip,0 ); -if (ret <0 ) -return ; -if (chip->flags &TPM_CHIP_FLAG_TPM2 ) ret =tpm2_get_tpm_pt (chip,0x100 , &cap2, desc);else ret =tpm1_getcap (chip,TPM_CAP_PROP_TIS_TIMEOUT , &cap, desc,0 ); - -release_locality (chip,0 ); }/* Register the IRQ and issue a command that will cause an interrupt. If an
@@ -753,10 +747,16 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask, } priv->irq = irq; + rc =request_locality (chip,0 ); +if (rc <0 ) +return rc; + rc =tpm_tis_read8 (priv,TPM_INT_VECTOR (priv->locality), &original_int_vec); -if (rc <0 ) +if (rc <0 ) { +release_locality (chip, priv->locality);return rc; + } rc =tpm_tis_write8 (priv,TPM_INT_VECTOR (priv->locality), irq);if (rc <0 )
@@ -790,10 +790,12 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,if (!(chip->flags &TPM_CHIP_FLAG_IRQ )) {tpm_tis_write8 (priv, original_int_vec,TPM_INT_VECTOR (priv->locality)); -return -1 ; + rc =-1 ; } -return 0 ; +release_locality (chip, priv->locality); + +return rc; }/* Try to find the IRQ the TPM is using. This is for legacy x86 systems that
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 69/381 tpm, tpm: Implement usage counter for locality
In reply to Greg Kroah-HartmanFrom: Lino Sanfilippo <[email protected]>
[ Upstream commit 7a2f55d0be296c4e81fd782f3d6c43ed4ec7e265 ]
Implement a usage counter for the (default) locality used by the TPM TIS driver:
Request the locality from the TPM if it has not been claimed yet, otherwise only increment the counter. Also release the locality if the counter is 0 otherwise only decrement the counter. Since in case of SPI the register accesses are locked by means of the SPI bus mutex use a sleepable lock (i.e. also a mutex) to ensure thread-safety of the counter which may be accessed by both a userspace thread and the interrupt handler.
By doing this refactor the names of the amended functions to use a more appropriate prefix.
Stable-dep-of: 955df4f87760 ("tpm, tpm_tis: Claim locality when interrupts are reenabled on resume")
--- drivers/char/tpm/tpm_tis_core.c | 63 +++++++++++++++++++++++---------- drivers/char/tpm/tpm_tis_core.h | 2 ++ 2 files changed, 47 insertions(+), 18 deletions(-)
drivers/char/tpm/tpm_tis_core.c +45 -18
@@ -136,16 +136,27 @@ static bool check_locality(struct tpm_chip *chip, int l)return false; } -static int release_locality (struct tpm_chip *chip,int l) +static int __tpm_tis_relinquish_locality (struct tpm_tis_data *priv,int l) +{ +tpm_tis_write8 (priv,TPM_ACCESS (l),TPM_ACCESS_ACTIVE_LOCALITY ); + +return 0 ; +} + +static int tpm_tis_relinquish_locality (struct tpm_chip *chip,int l) {struct tpm_tis_data *priv =dev_get_drvdata (&chip->dev); -tpm_tis_write8 (priv,TPM_ACCESS (l),TPM_ACCESS_ACTIVE_LOCALITY ); +mutex_lock (&priv->locality_count_mutex); + priv->locality_count--; +if (priv->locality_count ==0 ) +__tpm_tis_relinquish_locality (priv, l); +mutex_unlock (&priv->locality_count_mutex);return 0 ; } -static int request_locality (struct tpm_chip *chip,int l) +static int __tpm_tis_request_locality (struct tpm_chip *chip,int l) {struct tpm_tis_data *priv =dev_get_drvdata (&chip->dev);unsigned long stop, timeout;
@@ -186,6 +197,20 @@ static int request_locality(struct tpm_chip *chip, int l)return -1 ; } +static int tpm_tis_request_locality (struct tpm_chip *chip,int l) +{ +struct tpm_tis_data *priv =dev_get_drvdata (&chip->dev); +int ret =0 ; + +mutex_lock (&priv->locality_count_mutex); +if (priv->locality_count ==0 ) + ret =__tpm_tis_request_locality (chip, l); +if (!ret) + priv->locality_count++; +mutex_unlock (&priv->locality_count_mutex); +return ret; +} +static u8 tpm_tis_status (struct tpm_chip *chip) {struct tpm_tis_data *priv =dev_get_drvdata (&chip->dev);
@@ -638,7 +663,7 @@ static int probe_itpm(struct tpm_chip *chip)if (vendor !=TPM_VID_INTEL )return 0 ; -if (request_locality (chip,0 ) !=0 ) +if (tpm_tis_request_locality (chip,0 ) !=0 )return -EBUSY ; rc =tpm_tis_send_data (chip, cmd_getticks, len);
@@ -659,7 +684,7 @@ static int probe_itpm(struct tpm_chip *chip) out:tpm_tis_ready (chip); -release_locality (chip, priv->locality); +tpm_tis_relinquish_locality (chip, priv->locality);return rc; }
@@ -747,14 +772,14 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask, } priv->irq = irq; - rc =request_locality (chip,0 ); + rc =tpm_tis_request_locality (chip,0 );if (rc <0 )return rc; rc =tpm_tis_read8 (priv,TPM_INT_VECTOR (priv->locality), &original_int_vec);if (rc <0 ) { -release_locality (chip, priv->locality); +tpm_tis_relinquish_locality (chip, priv->locality);return rc; }
@@ -793,7 +818,7 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask, rc =-1 ; } -release_locality (chip, priv->locality); +tpm_tis_relinquish_locality (chip, priv->locality);return rc; }
@@ -909,8 +934,8 @@ static const struct tpm_class_ops tpm_tis = { .req_complete_mask = TPM_STS_DATA_AVAIL | TPM_STS_VALID, .req_complete_val = TPM_STS_DATA_AVAIL | TPM_STS_VALID, .req_canceled = tpm_tis_req_canceled, - .request_locality = request_locality, - .relinquish_locality = release_locality, + .request_locality = tpm_tis_request_locality, + .relinquish_locality = tpm_tis_relinquish_locality, .clk_enable = tpm_tis_clkrun_enable, };
@@ -944,6 +969,8 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, priv->timeout_min =TPM_TIMEOUT_USECS_MIN ; priv->timeout_max =TPM_TIMEOUT_USECS_MAX ; priv->phy_ops = phy_ops; + priv->locality_count =0 ; +mutex_init (&priv->locality_count_mutex);dev_set_drvdata (&chip->dev, priv);
@@ -990,14 +1017,14 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,TPM_INTF_DATA_AVAIL_INT |TPM_INTF_STS_VALID_INT ; intmask &= ~TPM_GLOBAL_INT_ENABLE ; - rc =request_locality (chip,0 ); + rc =tpm_tis_request_locality (chip,0 );if (rc <0 ) { rc = -ENODEV ; goto out_err; }tpm_tis_write32 (priv,TPM_INT_ENABLE (priv->locality), intmask); -release_locality (chip,0 ); +tpm_tis_relinquish_locality (chip,0 ); rc =tpm_chip_start (chip);if (rc)
@@ -1057,13 +1084,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,* proper timeouts for the driver. */ - rc =request_locality (chip,0 ); + rc =tpm_tis_request_locality (chip,0 );if (rc <0 ) goto out_err; rc =tpm_get_timeouts (chip); -release_locality (chip,0 ); +tpm_tis_relinquish_locality (chip,0 );if (rc) {dev_err (dev,"Could not get TPM timeouts and durations\n" );
@@ -1081,11 +1108,11 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,dev_err (&chip->dev,FW_BUG "TPM interrupt not working, polling instead\n" ); - rc =request_locality (chip,0 ); + rc =tpm_tis_request_locality (chip,0 );if (rc <0 ) goto out_err;disable_interrupts (chip); -release_locality (chip,0 ); +tpm_tis_relinquish_locality (chip,0 ); } }
@@ -1158,13 +1185,13 @@ int tpm_tis_resume(struct device *dev)* an error code but for unknown reason it isn't handled. */ if (!(chip->flags &TPM_CHIP_FLAG_TPM2 )) { - ret =request_locality (chip,0 ); + ret =tpm_tis_request_locality (chip,0 );if (ret <0 )return ret;tpm1_do_selftest (chip); -release_locality (chip,0 ); +tpm_tis_relinquish_locality (chip,0 ); }return 0 ;
drivers/char/tpm/tpm_tis_core.h +2 -0
@@ -90,6 +90,8 @@ enum tpm_tis_flags {struct tpm_tis_data {u16 manufacturer_id; +struct mutex locality_count_mutex; +unsigned int locality_count;int locality;int irq;bool irq_tested;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 70/381 tpm, tpm_tis: Claim locality when interrupts are reenabled on resume
In reply to Greg Kroah-HartmanFrom: Lino Sanfilippo <[email protected]>
[ Upstream commit 955df4f87760b3bb2af253d3fbb12fb712b3ffa6 ]
In tpm_tis_resume() make sure that the locality has been claimed when tpm_tis_reenable_interrupts() is called. Otherwise the writings to the register might not have any effect.
--- drivers/char/tpm/tpm_tis_core.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/char/tpm/tpm_tis_core.c +9 -10
@@ -1173,28 +1173,27 @@ int tpm_tis_resume(struct device *dev)struct tpm_chip *chip =dev_get_drvdata (dev);int ret; + ret =tpm_tis_request_locality (chip,0 ); +if (ret <0 ) +return ret; +if (chip->flags &TPM_CHIP_FLAG_IRQ )tpm_tis_reenable_interrupts (chip); ret =tpm_pm_resume (dev);if (ret) -return ret; + goto out;/* * TPM 1.2 requires self-test on resume. This function actually returns * an error code but for unknown reason it isn't handled. */ -if (!(chip->flags &TPM_CHIP_FLAG_TPM2 )) { - ret =tpm_tis_request_locality (chip,0 ); -if (ret <0 ) -return ret; - +if (!(chip->flags &TPM_CHIP_FLAG_TPM2 ))tpm1_do_selftest (chip); +out: +tpm_tis_relinquish_locality (chip,0 ); -tpm_tis_relinquish_locality (chip,0 ); - } - - return 0; + return ret; }EXPORT_SYMBOL_GPL (tpm_tis_resume);#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 71/381 erofs: stop parsing non-compact HEAD index if clusterofs is invalid
In reply to Greg Kroah-HartmanFrom: Gao Xiang <[email protected]>
[ Upstream commit cc4efd3dd2ac9f89143e5d881609747ecff04164 ]
Syzbot generated a crafted image [1] with a non-compact HEAD index of clusterofs 33024 while valid numbers should be 0 ~ lclustersize-1, which causes the following unexpected behavior as below:
BUG: unable to handle page fault for address: fffff52101a3fff9 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 23ffed067 P4D 23ffed067 PUD 0 Oops: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 4398 Comm: kworker/u5:1 Not tainted 6.3.0-rc6-syzkaller-g09a9639e56c0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023 Workqueue: erofs_worker z_erofs_decompressqueue_work RIP: 0010:z_erofs_decompress_queue+0xb7e/0x2b40 ... Call Trace: <TASK> z_erofs_decompressqueue_work+0x99/0xe0 process_one_work+0x8f6/0x1170 worker_thread+0xa63/0x1210 kthread+0x270/0x300 ret_from_fork+0x1f/0x30
Note that normal images or images using compact indexes are not impacted. Let's fix this now.
[1] https://lore.kernel.org/r/[email protected]
--- fs/erofs/zmap.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/erofs/zmap.c +4 -0
@@ -179,6 +179,10 @@ static int legacy_load_cluster_from_disk(struct z_erofs_maprecorder *m,case Z_EROFS_VLE_CLUSTER_TYPE_PLAIN :case Z_EROFS_VLE_CLUSTER_TYPE_HEAD : m->clusterofs =le16_to_cpu (di->di_clusterofs); +if (m->clusterofs >=1 << vi->z_logical_clusterbits) { +DBG_BUGON (1 ); +return -EFSCORRUPTED ; + } m->pblk =le32_to_cpu (di->di_u.blkaddr);break ;default :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 72/381 erofs: fix potential overflow calculating xattr_isize
In reply to Greg Kroah-HartmanFrom: Jingbo Xu <[email protected]>
[ Upstream commit 1b3567a1969b26f709d82a874498c0754ea841c3 ]
Given on-disk i_xattr_icount is 16 bits and xattr_isize is calculated from i_xattr_icount multiplying 4, xattr_isize has a theoretical maximum of 256K (64K * 4).
Thus declare xattr_isize as unsigned int to avoid the potential overflow.
--- fs/erofs/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/erofs/internal.h +1 -1
@@ -232,7 +232,7 @@ struct erofs_inode {unsigned char datalayout;unsigned char inode_isize; -unsigned short xattr_isize; +unsigned int xattr_isize;unsigned int xattr_shared_count;unsigned int *xattr_shared_xattrs;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 73/381 drm/rockchip: Drop unbalanced obj unref
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit 8ee3b0e85f6ccd9e6c527bc50eaba774c3bb18d0 ]
In the error path, rockchip_drm_gem_object_mmap() is dropping an obj reference that it doesn't own.
--- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_gem.c +0 -3
@@ -250,9 +250,6 @@ static int rockchip_drm_gem_object_mmap(struct drm_gem_object *obj,else ret =rockchip_drm_gem_object_mmap_dma (obj, vma); -if (ret) -drm_gem_vm_close (vma); -return ret; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 74/381 drm/vgem: add missing mutex_destroy
In reply to Greg Kroah-HartmanFrom: Maíra Canal <[email protected]>
[ Upstream commit 7c18189b14b33c1fbf76480b1bd217877c086e67 ]
vgem_fence_open() instantiates a mutex for a particular fence instance, but never destroys it by calling mutex_destroy() in vgem_fence_close().
So, add the missing mutex_destroy() to guarantee proper resource destruction.
--- drivers/gpu/drm/vgem/vgem_fence.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/vgem/vgem_fence.c +1 -0
@@ -249,4 +249,5 @@ void vgem_fence_close(struct vgem_file *vfile) {idr_for_each (&vfile->fence_idr, __vgem_fence_idr_fini, vfile);idr_destroy (&vfile->fence_idr); +mutex_destroy (&vfile->fence_mutex); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 75/381 drm/probe-helper: Cancel previous job before starting new one
In reply to Greg Kroah-HartmanFrom: Dom Cobley <[email protected]>
[ Upstream commit a8e47884f1906cd7440fafa056adc8817568e73e ]
Currently we schedule a call to output_poll_execute from drm_kms_helper_poll_enable for 10s in future. Later we try to replace that in drm_helper_probe_single_connector_modes with a 0s schedule with delayed_event set.
But as there is already a job in the queue this fails, and the immediate job we wanted with delayed_event set doesn't occur until 10s later.
And that call acts as if connector state has changed, reprobing modes. This has a side effect of waking up a display that has been blanked.
Make sure we cancel the old job before submitting the immediate one.
--- drivers/gpu/drm/drm_probe_helper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_probe_helper.c +3 -2
@@ -488,8 +488,9 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,*/ dev->mode_config.delayed_event = true;if (dev->mode_config.poll_enabled) -schedule_delayed_work (&dev->mode_config.output_poll_work, -0 ); +mod_delayed_work (system_wq, + &dev->mode_config.output_poll_work, +0 ); }/* Re-enable polling in case the global poll config changed. */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 76/381 soc: ti: pm33xx: Enable basic PM runtime support for genpd
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 74033131d2467fda6b76ba10bc80a75fb47e03d1 ]
To prepare for moving to use genpd, let's enable basic PM runtime support.
Stable-dep-of: 8f3c307b580a ("soc: ti: pm33xx: Fix refcount leak in am33xx_pm_probe")
--- drivers/soc/ti/pm33xx.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/soc/ti/pm33xx.c +15 -2
@@ -19,6 +19,7 @@#include <linux/of_address.h> #include <linux/platform_data/pm33xx.h> #include <linux/platform_device.h> +#include <linux/pm_runtime.h> #include <linux/rtc.h> #include <linux/rtc/rtc-omap.h> #include <linux/sizes.h>
@@ -555,16 +556,26 @@ static int am33xx_pm_probe(struct platform_device *pdev) suspend_wfi_flags |=WFI_FLAG_WAKE_M3 ;#endif /* CONFIG_SUSPEND */ +pm_runtime_enable (dev); + ret =pm_runtime_get_sync (dev); +if (ret <0 ) { +pm_runtime_put_noidle (dev); + goto err_pm_runtime_disable; + } + ret = pm_ops->init (am33xx_do_sram_idle);if (ret) {dev_err (dev,"Unable to call core pm init!\n" ); ret = -ENODEV ; - goto err_put_wkup_m3_ipc; + goto err_pm_runtime_put; }return 0 ; -err_put_wkup_m3_ipc: +err_pm_runtime_put: +pm_runtime_put_sync (dev); +err_pm_runtime_disable: +pm_runtime_disable (dev);wkup_m3_ipc_put (m3_ipc); err_unsetup_rtc:iounmap (rtc_base_virt);
@@ -577,6 +588,8 @@ static int am33xx_pm_probe(struct platform_device *pdev)static int am33xx_pm_remove (struct platform_device *pdev) { +pm_runtime_put_sync (&pdev->dev); +pm_runtime_disable (&pdev->dev);if (pm_ops->deinit) pm_ops->deinit ();suspend_set_ops (NULL );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 77/381 soc: ti: pm33xx: Fix refcount leak in am33xx_pm_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 8f3c307b580a4a6425896007325bddefc36e8d91 ]
wkup_m3_ipc_get() takes refcount, which should be freed by wkup_m3_ipc_put(). Add missing refcount release in the error paths.
--- drivers/soc/ti/pm33xx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/soc/ti/pm33xx.c +3 -2
@@ -529,7 +529,7 @@ static int am33xx_pm_probe(struct platform_device *pdev) ret =am33xx_pm_alloc_sram ();if (ret) -return ret; + goto err_wkup_m3_ipc_put; ret =am33xx_pm_rtc_setup ();if (ret)
@@ -576,13 +576,14 @@ static int am33xx_pm_probe(struct platform_device *pdev)pm_runtime_put_sync (dev); err_pm_runtime_disable:pm_runtime_disable (dev); -wkup_m3_ipc_put (m3_ipc); err_unsetup_rtc:iounmap (rtc_base_virt);clk_put (rtc_fck); err_free_sram:am33xx_pm_free_sram (); pm33xx_dev =NULL ; +err_wkup_m3_ipc_put: +wkup_m3_ipc_put (m3_ipc);return ret; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 78/381 arm64: dts: renesas: r8a77990: Remove bogus voltages from OPP table
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit fb76b0fae3ca880363214e1dcd6513ab8bd529e7 ]
According to the R-Car Series, 3rd Generation Hardware User’s Manual Rev. 2.30, the System CPU cores on R-Car E3 do not have their own power supply, but use the common internal power supply (typical 1.03V).
Hence remove the "opp-microvolt" properties from the Operating Performance Points table. They are optional, and unused, when none of the CPU nodes is tied to a regulator using the "cpu-supply" property.
--- arch/arm64/boot/dts/renesas/r8a77990.dtsi | 3 --- 1 file changed, 3 deletions(-)
arch/arm64/boot/dts/renesas/r8a77990.dtsi +0 -3
@@ -60,17 +60,14 @@ opp-shared; opp-800000000 { opp-hz = /bits/ 64 <800000000>; - opp-microvolt = <820000>; clock-latency-ns = <300000>; }; opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; - opp-microvolt = <820000>; clock-latency-ns = <300000>; }; opp-1200000000 { opp-hz = /bits/ 64 <1200000000>; - opp-microvolt = <820000>; clock-latency-ns = <300000>; opp-suspend; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 79/381 arm64: dts: renesas: r8a774c0: Remove bogus voltages from OPP table
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 554edc3e9239bb81e61be9f0f5dbbeb528a69e72 ]
According to the RZ/G Series, 2nd Generation Hardware User’s Manual Rev. 1.11, the System CPU cores on RZ/G2E do not have their own power supply, but use the common internal power supply (typical 1.03V).
Hence remove the "opp-microvolt" properties from the Operating Performance Points table. They are optional, and unused, when none of the CPU nodes is tied to a regulator using the "cpu-supply" property.
--- arch/arm64/boot/dts/renesas/r8a774c0.dtsi | 3 --- 1 file changed, 3 deletions(-)
arch/arm64/boot/dts/renesas/r8a774c0.dtsi +0 -3
@@ -49,17 +49,14 @@ opp-shared; opp-800000000 { opp-hz = /bits/ 64 <800000000>; - opp-microvolt = <820000>; clock-latency-ns = <300000>; }; opp-1000000000 { opp-hz = /bits/ 64 <1000000000>; - opp-microvolt = <820000>; clock-latency-ns = <300000>; }; opp-1200000000 { opp-hz = /bits/ 64 <1200000000>; - opp-microvolt = <820000>; clock-latency-ns = <300000>; opp-suspend; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 80/381 drm/msm/disp/dpu: check for crtc enable rather than crtc active to release shared resources
In reply to Greg Kroah-HartmanFrom: Vinod Polimera <[email protected]>
[ Upstream commit b6975693846b562c4d3e0e60cc884affc5bdac00 ]
According to KMS documentation, The driver must not release any shared resources if active is set to false but enable still true.
Patchwork: https://patchwork.freedesktop.org/patch/524726/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +1 -1
@@ -634,7 +634,7 @@ static int dpu_encoder_virt_atomic_check(if (drm_atomic_crtc_needs_modeset (crtc_state)) {dpu_rm_release (global_state, drm_enc); -if (!crtc_state->active_changed || crtc_state->active) +if (!crtc_state->active_changed || crtc_state->enable) ret =dpu_rm_reserve (&dpu_kms->rm, global_state, drm_enc, crtc_state, topology); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 81/381 EDAC/skx: Fix overflows on the DRAM row address mapping arrays
In reply to Greg Kroah-HartmanFrom: Qiuxu Zhuo <[email protected]>
[ Upstream commit 71b1e3ba3fed5a34c5fac6d3a15c2634b04c1eb7 ]
The current DRAM row address mapping arrays skx_{open,close}_row[] only support ranks with sizes up to 16G. Decoding a rank address to a DRAM row address for a 32G rank by using either one of the above arrays by the skx_edac driver, will result in an overflow on the array.
For a 32G rank, the most significant DRAM row address bit (the bit17) is mapped from the bit34 of the rank address. Add this new mapping item to both arrays to fix the overflow issue.
--- drivers/edac/skx_base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/edac/skx_base.c +2 -2
@@ -509,7 +509,7 @@ static bool skx_rir_decode(struct decoded_addr *res) }static u8 skx_close_row[] = { -15 ,16 ,17 ,18 ,20 ,21 ,22 ,28 ,10 ,11 ,12 ,13 ,29 ,30 ,31 ,32 ,33 +15 ,16 ,17 ,18 ,20 ,21 ,22 ,28 ,10 ,11 ,12 ,13 ,29 ,30 ,31 ,32 ,33 ,34 };static u8 skx_close_column[] = {
@@ -517,7 +517,7 @@ static u8 skx_close_column[] = { };static u8 skx_open_row[] = { -14 ,15 ,16 ,20 ,28 ,21 ,22 ,23 ,24 ,25 ,26 ,27 ,29 ,30 ,31 ,32 ,33 +14 ,15 ,16 ,20 ,28 ,21 ,22 ,23 ,24 ,25 ,26 ,27 ,29 ,30 ,31 ,32 ,33 ,34 };static u8 skx_open_column[] = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 82/381 arm64: dts: qcom: msm8998: Fix stm-stimulus-base reg name
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit b5d08f08377218b1d2ab4026e427a7788b271c8e ]
The name stm-data-base comes from ancient (msm-3.10 or older) downstream kernels. Upstream uses stm-stimulus-base instead. Fix it.
--- arch/arm64/boot/dts/qcom/msm8998.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/msm8998.dtsi +1 -1
@@ -1187,7 +1187,7 @@ compatible = "arm,coresight-stm", "arm,primecell"; reg = <0x06002000 0x1000>, <0x16280000 0x180000>; - reg-names = "stm-base", "stm-data-base"; + reg-names = "stm-base", "stm-stimulus-base"; status = "disabled"; clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 83/381 arm64: dts: qcom: sdm845: correct dynamic power coefficients
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 0e0a8e35d72533b3eef3365e900baacd7cede8e2 ]
Following sm8150/sm8250 update sdm845 capacity-dmips-mhz and dynamic-power-coefficient based on the measurements [1], [2].
The energy model dynamic-power-coefficient values were calculated with
DPC = µW / MHz / V^2
for each OPP, and averaged across all OPPs within each cluster for the final coefficient. Voltages were obtained from the qcom-cpufreq-hw driver that reads voltages from the OSM LUT programmed into the SoC.
Normalized DMIPS/MHz capacity scale values for each CPU were calculated from CoreMarks/MHz (CoreMark iterations per second per MHz), which serves the same purpose. For each CPU, the final capacity-dmips-mhz value is the C/MHz value of its maximum frequency normalized to SCHED_CAPACITY_SCALE (1024) for the fastest CPU in the system.
For more details on measurement process see the commit message for the commit 6aabed5526ee ("arm64: dts: qcom: sm8250: Add CPU capacities and energy model").
[1] https://github.com/kdrag0n/freqbench
[2] https://github.com/kdrag0n/freqbench/tree/master/results/sdm845/main
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +12 -12
@@ -196,8 +196,8 @@ cpu-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1 &CLUSTER_SLEEP_0>; - capacity-dmips-mhz = <607>; - dynamic-power-coefficient = <100>; + capacity-dmips-mhz = <611>; + dynamic-power-coefficient = <290>; qcom,freq-domain = <&cpufreq_hw 0>; operating-points-v2 = <&cpu0_opp_table>; interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -221,8 +221,8 @@ cpu-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1 &CLUSTER_SLEEP_0>; - capacity-dmips-mhz = <607>; - dynamic-power-coefficient = <100>; + capacity-dmips-mhz = <611>; + dynamic-power-coefficient = <290>; qcom,freq-domain = <&cpufreq_hw 0>; operating-points-v2 = <&cpu0_opp_table>; interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -243,8 +243,8 @@ cpu-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1 &CLUSTER_SLEEP_0>; - capacity-dmips-mhz = <607>; - dynamic-power-coefficient = <100>; + capacity-dmips-mhz = <611>; + dynamic-power-coefficient = <290>; qcom,freq-domain = <&cpufreq_hw 0>; operating-points-v2 = <&cpu0_opp_table>; interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -265,8 +265,8 @@ cpu-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1 &CLUSTER_SLEEP_0>; - capacity-dmips-mhz = <607>; - dynamic-power-coefficient = <100>; + capacity-dmips-mhz = <611>; + dynamic-power-coefficient = <290>; qcom,freq-domain = <&cpufreq_hw 0>; operating-points-v2 = <&cpu0_opp_table>; interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -288,7 +288,7 @@ cpu-idle-states = <&BIG_CPU_SLEEP_0 &BIG_CPU_SLEEP_1 &CLUSTER_SLEEP_0>; - dynamic-power-coefficient = <396>; + dynamic-power-coefficient = <442>; qcom,freq-domain = <&cpufreq_hw 1>; operating-points-v2 = <&cpu4_opp_table>; interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -310,7 +310,7 @@ cpu-idle-states = <&BIG_CPU_SLEEP_0 &BIG_CPU_SLEEP_1 &CLUSTER_SLEEP_0>; - dynamic-power-coefficient = <396>; + dynamic-power-coefficient = <442>; qcom,freq-domain = <&cpufreq_hw 1>; operating-points-v2 = <&cpu4_opp_table>; interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -332,7 +332,7 @@ cpu-idle-states = <&BIG_CPU_SLEEP_0 &BIG_CPU_SLEEP_1 &CLUSTER_SLEEP_0>; - dynamic-power-coefficient = <396>; + dynamic-power-coefficient = <442>; qcom,freq-domain = <&cpufreq_hw 1>; operating-points-v2 = <&cpu4_opp_table>; interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
@@ -354,7 +354,7 @@ cpu-idle-states = <&BIG_CPU_SLEEP_0 &BIG_CPU_SLEEP_1 &CLUSTER_SLEEP_0>; - dynamic-power-coefficient = <396>; + dynamic-power-coefficient = <442>; qcom,freq-domain = <&cpufreq_hw 1>; operating-points-v2 = <&cpu4_opp_table>; interconnects = <&gladiator_noc MASTER_APPSS_PROC 3 &mem_noc SLAVE_EBI1 3>,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 84/381 arm64: dts: qcom: sdm845: Fix the PCI I/O port range
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 67aa109eee654c76dcc100554e637fa64d5aa099 ]
For 1MiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x100000. Hence, fix the bogus PCI addresses (0x60200000, 0x40200000) specified in the ranges property for I/O region.
While at it, let's use the missing 0x prefix for the addresses.
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +3 -3
@@ -1816,8 +1816,8 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x01000000 0x0 0x60200000 0 0x60200000 0x0 0x100000>, - <0x02000000 0x0 0x60300000 0 0x60300000 0x0 0xd00000>; + ranges = <0x01000000 0x0 0x00000000 0x0 0x60200000 0x0 0x100000>, + <0x02000000 0x0 0x60300000 0x0 0x60300000 0x0 0xd00000>; interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi";
@@ -1920,7 +1920,7 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x01000000 0x0 0x40200000 0x0 0x40200000 0x0 0x100000>, + ranges = <0x01000000 0x0 0x00000000 0x0 0x40200000 0x0 0x100000>, <0x02000000 0x0 0x40300000 0x0 0x40300000 0x0 0x1fd00000>; interrupts = <GIC_SPI 307 IRQ_TYPE_EDGE_RISING>;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 85/381 arm64: dts: qcom: msm8998: Fix the PCI I/O port range
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit c30a27dcfe4545edbda1578b3a63ed6147519cdd ]
For 1MiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x100000. Hence, fix the bogus PCI address (0x1b200000) specified in the ranges property for I/O region.
--- arch/arm64/boot/dts/qcom/msm8998.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/msm8998.dtsi +1 -1
@@ -942,7 +942,7 @@ phys = <&pciephy>; phy-names = "pciephy"; - ranges = <0x01000000 0x0 0x1b200000 0x1b200000 0x0 0x100000>, + ranges = <0x01000000 0x0 0x00000000 0x1b200000 0x0 0x100000>, <0x02000000 0x0 0x1b300000 0x1b300000 0x0 0xd00000>; #interrupt-cells = <1>;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 86/381 arm64: dts: qcom: ipq8074: Fix the PCI I/O port range
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit e49eafefe5ab325e38dd074f2005076ffc271e54 ]
For 64KiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x10000. Hence, fix the bogus PCI addresses (0x10200000, 0x20200000) specified in the ranges property for I/O region.
While at it, let's use the missing 0x prefix for the addresses and align them in a single line.
--- arch/arm64/boot/dts/qcom/ipq8074.dtsi | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/qcom/ipq8074.dtsi +4 -8
@@ -609,10 +609,8 @@ phys = <&pcie_phy1>; phy-names = "pciephy"; - ranges = <0x81000000 0 0x10200000 0x10200000 - 0 0x10000>, /* downstream I/O */ - <0x82000000 0 0x10220000 0x10220000 - 0 0xfde0000>; /* non-prefetchable memory */ + ranges = <0x81000000 0x0 0x00000000 0x10200000 0x0 0x10000>, /* I/O */ + <0x82000000 0x0 0x10220000 0x10220000 0x0 0xfde0000>; /* MEM */ interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi";
@@ -673,10 +671,8 @@ phys = <&pcie_phy0>; phy-names = "pciephy"; - ranges = <0x81000000 0 0x20200000 0x20200000 - 0 0x10000>, /* downstream I/O */ - <0x82000000 0 0x20220000 0x20220000 - 0 0xfde0000>; /* non-prefetchable memory */ + ranges = <0x81000000 0x0 0x00000000 0x20200000 0x0 0x10000>, /* I/O */ + <0x82000000 0x0 0x20220000 0x20220000 0x0 0xfde0000>; /* MEM */ interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi";
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 87/381 arm64: dts: qcom: msm8996: Fix the PCI I/O port range
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit cf0ac10feb17661987d0018eb9475dc03e2a2253 ]
For 1MiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x100000. Hence, fix the bogus PCI addresses (0x0c200000, 0x0d200000, 0x0e200000) specified in the ranges property for I/O region.
While at it, let's also align the entries.
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/msm8996.dtsi +6 -6
@@ -744,8 +744,8 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x01000000 0x0 0x0c200000 0x0c200000 0x0 0x100000>, - <0x02000000 0x0 0x0c300000 0x0c300000 0x0 0xd00000>; + ranges = <0x01000000 0x0 0x00000000 0x0c200000 0x0 0x100000>, + <0x02000000 0x0 0x0c300000 0x0c300000 0x0 0xd00000>; interrupts = <GIC_SPI 405 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi";
@@ -796,8 +796,8 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x01000000 0x0 0x0d200000 0x0d200000 0x0 0x100000>, - <0x02000000 0x0 0x0d300000 0x0d300000 0x0 0xd00000>; + ranges = <0x01000000 0x0 0x00000000 0x0d200000 0x0 0x100000>, + <0x02000000 0x0 0x0d300000 0x0d300000 0x0 0xd00000>; interrupts = <GIC_SPI 413 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi";
@@ -845,8 +845,8 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x01000000 0x0 0x0e200000 0x0e200000 0x0 0x100000>, - <0x02000000 0x0 0x0e300000 0x0e300000 0x0 0x1d00000>; + ranges = <0x01000000 0x0 0x00000000 0x0e200000 0x0 0x100000>, + <0x02000000 0x0 0x0e300000 0x0e300000 0x0 0x1d00000>; device_type = "pci";
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 88/381 ARM: dts: qcom: ipq4019: Fix the PCI I/O port range
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 2540279e9a9e74fc880d1e4c83754ecfcbe290a0 ]
For 1MiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x100000. Hence, fix the bogus PCI address (0x40200000) specified in the ranges property for I/O region.
While at it, let's use the missing 0x prefix for the addresses.
--- arch/arm/boot/dts/qcom-ipq4019.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/qcom-ipq4019.dtsi +2 -2
@@ -414,8 +414,8 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x40200000 0x40200000 0 0x00100000>, - <0x82000000 0 0x40300000 0x40300000 0 0x00d00000>; + ranges = <0x81000000 0x0 0x00000000 0x40200000 0x0 0x00100000>, + <0x82000000 0x0 0x40300000 0x40300000 0x0 0x00d00000>; interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi";
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 89/381 ARM: dts: qcom: ipq8064: reduce pci IO size to 64K
In reply to Greg Kroah-HartmanFrom: Christian Marangi <[email protected]>
[ Upstream commit 8fafb7e5c041814876266259e5e439f93571dcef ]
The current value for pci IO is problematic for ath10k wifi card commonly connected to ipq8064 SoC.
The current value is probably a typo and is actually uncommon to find 1MB IO space even on a x86 arch. Also with recent changes to the pci driver, pci1 and pci2 now fails to function as any connected device fails any reg read/write. Reduce this to 64K as it should be more than enough and 3 * 64K of total IO space doesn't exceed the IO_SPACE_LIMIT hardcoded for the ARM arch.
Stable-dep-of: 0b16b34e4916 ("ARM: dts: qcom: ipq8064: Fix the PCI I/O port range")
--- arch/arm/boot/dts/qcom-ipq8064.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/qcom-ipq8064.dtsi +3 -3
@@ -465,7 +465,7 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x0fe00000 0x0fe00000 0 0x00100000 /* downstream I/O */ + ranges = <0x81000000 0 0x0fe00000 0x0fe00000 0 0x00010000 /* downstream I/O */ 0x82000000 0 0x08000000 0x08000000 0 0x07e00000>; /* non-prefetchable memory */ interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
@@ -516,7 +516,7 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x31e00000 0x31e00000 0 0x00100000 /* downstream I/O */ + ranges = <0x81000000 0 0x31e00000 0x31e00000 0 0x00010000 /* downstream I/O */ 0x82000000 0 0x2e000000 0x2e000000 0 0x03e00000>; /* non-prefetchable memory */ interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
@@ -567,7 +567,7 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x35e00000 0x35e00000 0 0x00100000 /* downstream I/O */ + ranges = <0x81000000 0 0x35e00000 0x35e00000 0 0x00010000 /* downstream I/O */ 0x82000000 0 0x32000000 0x32000000 0 0x03e00000>; /* non-prefetchable memory */ interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 90/381 ARM: dts: qcom: ipq8064: Fix the PCI I/O port range
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 0b16b34e491629016109e56747ad64588074194b ]
For 64KiB of the I/O region, the I/O ports of the legacy PCI devices are located in the range of 0x0 to 0x10000. Hence, fix the bogus PCI addresses (0x0fe00000, 0x31e00000, 0x35e00000) specified in the ranges property for I/O region.
While at it, let's use the missing 0x prefix for the addresses.
--- arch/arm/boot/dts/qcom-ipq8064.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm/boot/dts/qcom-ipq8064.dtsi +6 -6
@@ -465,8 +465,8 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x0fe00000 0x0fe00000 0 0x00010000 /* downstream I/O */ - 0x82000000 0 0x08000000 0x08000000 0 0x07e00000>; /* non-prefetchable memory */ + ranges = <0x81000000 0x0 0x00000000 0x0fe00000 0x0 0x00010000 /* I/O */ + 0x82000000 0x0 0x08000000 0x08000000 0x0 0x07e00000>; /* MEM */ interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi";
@@ -516,8 +516,8 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x31e00000 0x31e00000 0 0x00010000 /* downstream I/O */ - 0x82000000 0 0x2e000000 0x2e000000 0 0x03e00000>; /* non-prefetchable memory */ + ranges = <0x81000000 0x0 0x00000000 0x31e00000 0x0 0x00010000 /* I/O */ + 0x82000000 0x0 0x2e000000 0x2e000000 0x0 0x03e00000>; /* MEM */ interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi";
@@ -567,8 +567,8 @@ #address-cells = <3>; #size-cells = <2>; - ranges = <0x81000000 0 0x35e00000 0x35e00000 0 0x00010000 /* downstream I/O */ - 0x82000000 0 0x32000000 0x32000000 0 0x03e00000>; /* non-prefetchable memory */ + ranges = <0x81000000 0x0 0x00000000 0x35e00000 0x0 0x00010000 /* I/O */ + 0x82000000 0x0 0x32000000 0x32000000 0x0 0x03e00000>; /* MEM */ interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "msi";
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 91/381 x86/MCE/AMD: Use an u64 for bank_map
In reply to Greg Kroah-HartmanFrom: Muralidhara M K <[email protected]>
[ Upstream commit 4c1cdec319b9aadb65737c3eb1f5cb74bd6aa156 ]
Thee maximum number of MCA banks is 64 (MAX_NR_BANKS), see
a0bc32b3cacf ("x86/mce: Increase maximum number of banks to 64").
However, the bank_map which contains a bitfield of which banks to initialize is of type unsigned int and that overflows when those bit numbers are >= 32, leading to UBSAN complaining correctly:
UBSAN: shift-out-of-bounds in arch/x86/kernel/cpu/mce/amd.c:1365:38 shift exponent 32 is too large for 32-bit type 'int'
Change the bank_map to a u64 and use the proper BIT_ULL() macro when modifying bits in there.
[ bp: Rewrite commit message. ]
--- arch/x86/kernel/cpu/mce/amd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
arch/x86/kernel/cpu/mce/amd.c +7 -7
@@ -197,10 +197,10 @@ static DEFINE_PER_CPU(struct threshold_bank **, threshold_banks);* A list of the banks enabled on each logical CPU. Controls which respective * descriptors to initialize later in mce_threshold_create_device(). */ -static DEFINE_PER_CPU(unsigned int, bank_map); +static DEFINE_PER_CPU(u64, bank_map);/* Map of banks that have more than MCA_MISC0 available. */ -static DEFINE_PER_CPU(u32, smca_misc_banks_map); +static DEFINE_PER_CPU(u64, smca_misc_banks_map);static void amd_threshold_interrupt (void );static void amd_deferred_error_interrupt (void );
@@ -229,7 +229,7 @@ static void smca_set_misc_banks_map(unsigned int bank, unsigned int cpu)return ;if (low &MASK_BLKPTR_LO ) -per_cpu (smca_misc_banks_map, cpu) |=BIT (bank); +per_cpu (smca_misc_banks_map, cpu) |=BIT_ULL (bank); }
@@ -492,7 +492,7 @@ static u32 smca_get_block_address(unsigned int bank, unsigned int block,if (!block)return MSR_AMD64_SMCA_MCx_MISC (bank); -if (!(per_cpu (smca_misc_banks_map, cpu) &BIT (bank))) +if (!(per_cpu (smca_misc_banks_map, cpu) &BIT_ULL (bank)))return 0 ;return MSR_AMD64_SMCA_MCx_MISCy (bank, block -1 );
@@ -536,7 +536,7 @@ prepare_threshold_block(unsigned int bank, unsigned int block, u32 addr,int new;if (!block) -per_cpu (bank_map, cpu) |= (1 << bank); +per_cpu (bank_map, cpu) |=BIT_ULL (bank);memset (&b,0 ,sizeof (b)); b.cpu = cpu;
@@ -1048,7 +1048,7 @@ static void amd_threshold_interrupt(void)return ;for (bank =0 ; bank <this_cpu_read (mce_num_banks); ++bank) { -if (!(per_cpu (bank_map, cpu) & (1 << bank))) +if (!(per_cpu (bank_map, cpu) &BIT_ULL (bank)))continue ; first_block = bp[bank]->blocks;
@@ -1525,7 +1525,7 @@ int mce_threshold_create_device(unsigned int cpu)return -ENOMEM ;for (bank =0 ; bank < numbanks; ++bank) { -if (!(this_cpu_read (bank_map) & (1 << bank))) +if (!(this_cpu_read (bank_map) &BIT_ULL (bank)))continue ; err =threshold_create_bank (bp, cpu, bank);if (err) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 92/381 media: bdisp: Add missing check for create_workqueue
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 2371adeab717d8fe32144a84f3491a03c5838cfb ]
Add the check for the return value of the create_workqueue in order to avoid NULL pointer dereference.
--- drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/sti/bdisp/bdisp-v4l2.c +2 -0
@@ -1310,6 +1310,8 @@ static int bdisp_probe(struct platform_device *pdev)init_waitqueue_head (&bdisp->irq_queue);INIT_DELAYED_WORK (&bdisp->timeout_work, bdisp_irq_timeout); bdisp->work_queue =create_workqueue (BDISP_NAME ); +if (!bdisp->work_queue) +return -ENOMEM ;spin_lock_init (&bdisp->slock);mutex_init (&bdisp->lock);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 93/381 firmware: qcom_scm: Clear download bit during reboot
In reply to Greg Kroah-HartmanFrom: Mukesh Ojha <[email protected]>
[ Upstream commit 781d32d1c9709fd25655c4e3e3e15370ae4ae4db ]
During normal restart of a system download bit should be cleared irrespective of whether download mode is set or not.
--- drivers/firmware/qcom_scm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/firmware/qcom_scm.c +1 -2
@@ -1256,8 +1256,7 @@ static int qcom_scm_probe(struct platform_device *pdev)static void qcom_scm_shutdown (struct platform_device *pdev) {/* Clean shutdown, disable download mode to allow normal restart */ -if (download_mode) -qcom_scm_set_download_mode (false); +qcom_scm_set_download_mode (false); }static const struct of_device_id qcom_scm_dt_match[] = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 94/381 drm/bridge: adv7533: Fix adv7533_mode_valid for adv7533 and adv7535
In reply to Greg Kroah-HartmanFrom: Adam Ford <[email protected]>
[ Upstream commit ee0285e13455fdbce5de315bdbe91b5f198a2a06 ]
When dynamically switching lanes was removed, the intent of the code was to check to make sure that higher speed items used 4 lanes, but it had the unintended consequence of removing the slower speeds for 4-lane users.
This attempts to remedy this by doing a check to see that the max frequency doesn't exceed the chip limit, and a second check to make sure that the max bit-rate doesn't exceed the number of lanes * max bit rate / lane.
--- drivers/gpu/drm/bridge/adv7511/adv7533.c | 25 +++++++++++------------- 1 file changed, 11 insertions(+), 14 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7533.c +11 -14
@@ -103,22 +103,19 @@ void adv7533_dsi_power_off(struct adv7511 *adv)enum drm_mode_status adv7533_mode_valid (struct adv7511 *adv,const struct drm_display_mode *mode) { -int lanes; +unsigned long max_lane_freq;struct mipi_dsi_device *dsi = adv->dsi; +u8 bpp =mipi_dsi_pixel_format_to_bpp (dsi->format); -if (mode->clock >80000 ) - lanes =4 ; -else - lanes =3 ; - -/* -* TODO: add support for dynamic switching of lanes -* by using the bridge pre_enable() op . Till then filter -* out the modes which shall need different number of lanes -* than what was configured in the device tree. -*/ -if (lanes != dsi->lanes) -return MODE_BAD ; +/* Check max clock for either 7533 or 7535 */ +if (mode->clock > (adv->type ==ADV7533 ?80000 :148500 )) +return MODE_CLOCK_HIGH ; + +/* Check max clock for each lane */ + max_lane_freq = (adv->type ==ADV7533 ?800000 :891000 ); + +if (mode->clock * bpp > max_lane_freq * adv->num_dsi_lanes) +return MODE_CLOCK_HIGH ;return MODE_OK ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 95/381 media: max9286: Free control handler
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit bfce6a12e5ba1edde95126aa06778027f16115d4 ]
The control handler is leaked in some probe-time error paths, as well as in the remove path. Fix it.
--- drivers/media/i2c/max9286.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/i2c/max9286.c +1 -0
@@ -899,6 +899,7 @@ static int max9286_v4l2_register(struct max9286_priv *priv)static void max9286_v4l2_unregister (struct max9286_priv *priv) {fwnode_handle_put (priv->sd.fwnode); +v4l2_ctrl_handler_free (&priv->ctrls);v4l2_async_unregister_subdev (&priv->sd);max9286_v4l2_notifier_unregister (priv); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 96/381 drm/msm/adreno: Defer enabling runpm until hw_init()
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit 4b18299b33655fa9672b774b6df774dc03d6aee8 ]
To avoid preventing the display from coming up before the rootfs is mounted, without resorting to packing fw in the initrd, the GPU has this limbo state where the device is probed, but we aren't ready to start sending commands to it. This is particularly problematic for a6xx, since the GMU (which requires fw to be loaded) is the one that is controlling the power/clk/icc votes.
So defer enabling runpm until we are ready to call gpu->hw_init(), as that is a point where we know we have all the needed fw and are ready to start sending commands to the coproc's.
Patchwork: https://patchwork.freedesktop.org/patch/489337/
Stable-dep-of: db7662d076c9 ("drm/msm/adreno: drop bogus pm_runtime_set_active()")
--- drivers/gpu/drm/msm/adreno/adreno_device.c | 6 ++++++ drivers/gpu/drm/msm/adreno/adreno_gpu.c | 1 - 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/adreno_device.c +6 -0
@@ -301,6 +301,12 @@ struct msm_gpu *adreno_load_gpu(struct drm_device *dev)if (ret)return NULL ; +/* +* Now that we have firmware loaded, and are ready to begin +* booting the gpu, go ahead and enable runpm: +*/ +pm_runtime_enable (&pdev->dev); +/* Make sure pm runtime is active and reset any previous errors */ pm_runtime_set_active (&pdev->dev);
drivers/gpu/drm/msm/adreno/adreno_gpu.c +0 -1
@@ -916,7 +916,6 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,pm_runtime_set_autosuspend_delay (dev, adreno_gpu->info->inactive_period);pm_runtime_use_autosuspend (dev); -pm_runtime_enable (dev); ret =msm_gpu_init (drm, pdev, &adreno_gpu->base, &funcs->base, adreno_gpu->info->name, &adreno_gpu_config);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 97/381 drm/msm/adreno: drop bogus pm_runtime_set_active()
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit db7662d076c973072d788bd0e8130e04430307a1 ]
The runtime PM status can only be updated while runtime PM is disabled.
Drop the bogus pm_runtime_set_active() call that was made after enabling runtime PM and which (incidentally but correctly) left the runtime PM status set to 'suspended'.
Patchwork: https://patchwork.freedesktop.org/patch/524972/
--- drivers/gpu/drm/msm/adreno/adreno_device.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_device.c +0 -3
@@ -307,9 +307,6 @@ struct msm_gpu *adreno_load_gpu(struct drm_device *dev)*/ pm_runtime_enable (&pdev->dev); -/* Make sure pm runtime is active and reset any previous errors */ -pm_runtime_set_active (&pdev->dev); - ret =pm_runtime_get_sync (&pdev->dev);if (ret <0 ) {pm_runtime_put_sync (&pdev->dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 98/381 drm: msm: adreno: Disable preemption on Adreno 510
In reply to Greg Kroah-HartmanFrom: Adam Skladowski <[email protected]>
[ Upstream commit 010c8bbad2cb8c33c47963e29f051f1e917e45a5 ]
Downstream driver appears to not support preemption on A510 target, trying to use one make device slow and fill log with rings related errors. Set num_rings to 1 to disable preemption.
Patchwork: https://patchwork.freedesktop.org/patch/526898/
--- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +7 -1
@@ -1569,6 +1569,7 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)struct a5xx_gpu *a5xx_gpu =NULL ;struct adreno_gpu *adreno_gpu;struct msm_gpu *gpu; +unsigned int nr_rings;int ret;if (!pdev) {
@@ -1589,7 +1590,12 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)check_speed_bin (&pdev->dev); - ret =adreno_gpu_init (dev, pdev, adreno_gpu, &funcs,4 ); + nr_rings =4 ; + +if (adreno_is_a510 (adreno_gpu)) + nr_rings =1 ; + + ret =adreno_gpu_init (dev, pdev, adreno_gpu, &funcs, nr_rings);if (ret) {a5xx_destroy (&(a5xx_gpu->base.base));return ERR_PTR (ret);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 99/381 ACPI: processor: Fix evaluating _PDC method when running as Xen dom0
In reply to Greg Kroah-HartmanFrom: Roger Pau Monne <[email protected]>
[ Upstream commit 073828e954459b883f23e53999d31e4c55ab9654 ]
In ACPI systems, the OS can direct power management, as opposed to the firmware. This OS-directed Power Management is called OSPM. Part of telling the firmware that the OS going to direct power management is making ACPI "_PDC" (Processor Driver Capabilities) calls. These _PDC methods must be evaluated for every processor object. If these _PDC calls are not completed for every processor it can lead to inconsistency and later failures in things like the CPU frequency driver.
In a Xen system, the dom0 kernel is responsible for system-wide power management. The dom0 kernel is in charge of OSPM. However, the number of CPUs available to dom0 can be different than the number of CPUs physically present on the system.
This leads to a problem: the dom0 kernel needs to evaluate _PDC for all the processors, but it can't always see them.
In dom0 kernels, ignore the existing ACPI method for determining if a processor is physically present because it might not be accurate. Instead, ask the hypervisor for this information.
Fix this by introducing a custom function to use when running as Xen dom0 in order to check whether a processor object matches a CPU that's online. Such checking is done using the existing information fetched by the Xen pCPU subsystem, extending it to also store the ACPI ID.
This ensures that _PDC method gets evaluated for all physically online CPUs, regardless of the number of CPUs made available to dom0.
--- drivers/acpi/processor_pdc.c | 11 +++++++++++ drivers/xen/pcpu.c | 20 ++++++++++++++++++++ include/xen/xen.h | 11 +++++++++++ 3 files changed, 42 insertions(+)
drivers/acpi/processor_pdc.c +11 -0
@@ -14,6 +14,8 @@#include <linux/acpi.h> #include <acpi/processor.h> +#include <xen/xen.h> +#include "internal.h" #define _COMPONENT ACPI_PROCESSOR_COMPONENT
@@ -50,6 +52,15 @@ static bool __init processor_physically_present(acpi_handle handle)return false; } +if (xen_initial_domain ()) +/* +* When running as a Xen dom0 the number of processors Linux +* sees can be different from the real number of processors on +* the system, and we still need to execute _PDC for all of +* them. +*/ +return xen_processor_present (acpi_id); + type = (acpi_type ==ACPI_TYPE_DEVICE ) ?1 :0 ; cpuid =acpi_get_cpuid (handle, type, acpi_id);
drivers/xen/pcpu.c +20 -0
@@ -58,6 +58,7 @@ struct pcpu {struct list_head list;struct device dev;uint32_t cpu_id; +uint32_t acpi_id;uint32_t flags; };
@@ -249,6 +250,7 @@ static struct pcpu *create_and_register_pcpu(struct xenpf_pcpuinfo *info)INIT_LIST_HEAD (&pcpu->list); pcpu->cpu_id = info->xen_cpuid; + pcpu->acpi_id = info->acpi_id; pcpu->flags = info->flags;/* Need hold on xen_pcpu_lock before pcpu list manipulations */
@@ -416,3 +418,21 @@ static int __init xen_pcpu_init(void)return ret; }arch_initcall (xen_pcpu_init); + +#ifdef CONFIG_ACPI +bool __init xen_processor_present (uint32_t acpi_id) +{ +const struct pcpu *pcpu; +bool online = false; + +mutex_lock (&xen_pcpu_lock); +list_for_each_entry (pcpu, &xen_pcpus, list) +if (pcpu->acpi_id == acpi_id) { + online = pcpu->flags &XEN_PCPU_FLAGS_ONLINE ; +break ; + } +mutex_unlock (&xen_pcpu_lock); + +return online; +} +#endif
include/xen/xen.h +11 -0
@@ -61,4 +61,15 @@ void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages);#include <xen/balloon.h> #endif +#if defined(CONFIG_XEN_DOM0 ) && defined(CONFIG_ACPI ) && defined(CONFIG_X86 ) +bool __init xen_processor_present (uint32_t acpi_id); +#else +#include <linux/bug.h> +static inline bool xen_processor_present (uint32_t acpi_id) +{ +BUG (); +return false; +} +#endif +#endif /* _XEN_XEN_H */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 100/381 mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data
In reply to Greg Kroah-HartmanFrom: Georgii Kruglov <[email protected]>
[ Upstream commit 0dd8316037a2a6d85b2be208bef9991de7b42170 ]
If spec_reg is equal to 'SDHCI_PRESENT_STATE', esdhc_readl_fixup() fixes up register value and returns it immediately. As a result, the further block
(spec_reg == SDHCI_PRESENT_STATE)
&&(esdhc->quirk_ignore_data_inhibit == true),
is never executed.
The patch merges the second block into the first one.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/mmc/host/sdhci-of-esdhc.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/mmc/host/sdhci-of-esdhc.c +11 -13
@@ -126,6 +126,7 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,return ret; } } +/* * The DAT[3:0] line signal levels and the CMD line signal level are * not compatible with standard SDHC register. The line signal levels
@@ -137,6 +138,16 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host, ret = value &0x000fffff ; ret |= (value >>4 ) &SDHCI_DATA_LVL_MASK ; ret |= (value <<1 ) &SDHCI_CMD_LVL ; + +/* +* Some controllers have unreliable Data Line Active +* bit for commands with busy signal. This affects +* Command Inhibit (data) bit. Just ignore it since +* MMC core driver has already polled card status +* with CMD13 after any command with busy siganl. +*/ +if (esdhc->quirk_ignore_data_inhibit) + ret &= ~SDHCI_DATA_INHIBIT ;return ret; }
@@ -151,19 +162,6 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,return ret; } -/* -* Some controllers have unreliable Data Line Active -* bit for commands with busy signal. This affects -* Command Inhibit (data) bit. Just ignore it since -* MMC core driver has already polled card status -* with CMD13 after any command with busy siganl. -*/ -if ((spec_reg ==SDHCI_PRESENT_STATE ) && - (esdhc->quirk_ignore_data_inhibit == true)) { - ret = value & ~SDHCI_DATA_INHIBIT ; -return ret; - } - ret = value;return ret; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 101/381 ARM: dts: gta04: fix excess dma channel usage
In reply to Greg Kroah-HartmanFrom: H. Nikolaus Schaller <[email protected]>
[ Upstream commit a622310f7f0185da02e42cdb06475f533efaae60 ]
OMAP processors support 32 channels but there is no check or inspect this except booting a device and looking at dmesg reports of not available channels.
Recently some more subsystems with DMA (aes1+2) were added filling the list of dma channels beyond the limit of 32 (even if other parameters indicate 96 or 128 channels). This leads to random subsystem failures i(e.g. mcbsp for audio) after boot or boot messages that DMA can not be initialized.
Another symptom is that
/sys/kernel/debug/dmaengine/summary
has 32 entries and does not show all required channels.
Fix by disabling unused (on the GTA04 hardware) mcspi1...4. Each SPI channel allocates 4 DMA channels rapidly filling the available ones.
Disabling unused SPI modules on the OMAP3 SoC may also save some energy (has not been checked).
Message-Id: <[email protected]>
--- arch/arm/boot/dts/omap3-gta04.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm/boot/dts/omap3-gta04.dtsi +16 -0
@@ -609,6 +609,22 @@ clock-frequency = <100000>; }; +&mcspi1 { + status = "disabled"; +}; + +&mcspi2 { + status = "disabled"; +}; + +&mcspi3 { + status = "disabled"; +}; + +&mcspi4 { + status = "disabled"; +}; + &usb_otg_hs { interface-type = <0>; usb-phy = <&usb2_phy>;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 102/381 drm/lima/lima_drv: Add missing unwind goto in lima_pdev_probe()
In reply to Greg Kroah-HartmanFrom: Harshit Mogalapalli <[email protected]>
[ Upstream commit c5647cae2704e58d1c4e5fedbf63f11bca6376c9 ]
Smatch reports:drivers/gpu/drm/lima/lima_drv.c:396 lima_pdev_probe() warn:
missing unwind goto?
Store return value in err and goto 'err_out0' which has lima_sched_slab_fini() before returning.
--- drivers/gpu/drm/lima/lima_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/lima/lima_drv.c +4 -2
@@ -392,8 +392,10 @@ static int lima_pdev_probe(struct platform_device *pdev)/* Allocate and initialize the DRM device. */ ddev =drm_dev_alloc (&lima_drm_driver, &pdev->dev); -if (IS_ERR (ddev)) -return PTR_ERR (ddev); +if (IS_ERR (ddev)) { + err =PTR_ERR (ddev); + goto err_out0; + } ddev->dev_private = ldev; ldev->ddev = ddev;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 103/381 regulator: core: Consistently set mutex_owner when using ww_mutex_lock_slow()
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit b83a1772be854f87602de14726737d3e5b06e1f4 ]
When a codepath locks a rdev using ww_mutex_lock_slow() directly then that codepath is responsible for incrementing the "ref_cnt" and also setting the "mutex_owner" to "current".
The regulator core consistently got that right for "ref_cnt" but didn't always get it right for "mutex_owner". Let's fix this.
It's unlikely that this truly matters because the "mutex_owner" is only needed if we're going to do subsequent locking of the same rdev. However, even though it's not truly needed it seems less surprising if we consistently set "mutex_owner" properly.
--- drivers/regulator/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/core.c +2 -0
@@ -343,6 +343,7 @@ static void regulator_lock_dependent(struct regulator_dev *rdev,ww_mutex_lock_slow (&new_contended_rdev->mutex, ww_ctx); old_contended_rdev = new_contended_rdev; old_contended_rdev->ref_cnt++; + old_contended_rdev->mutex_owner = current; } err = regulator_lock_recursive(rdev,
@@ -5800,6 +5801,7 @@ static void regulator_summary_lock(struct ww_acquire_ctx *ww_ctx)ww_mutex_lock_slow (&new_contended_rdev->mutex, ww_ctx); old_contended_rdev = new_contended_rdev; old_contended_rdev->ref_cnt++; + old_contended_rdev->mutex_owner = current; } err = regulator_summary_lock_all(ww_ctx,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 104/381 regulator: core: Avoid lockdep reports when resolving supplies
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit cba6cfdc7c3f1516f0d08ddfb24e689af0932573 ]
An automated bot told me that there was a potential lockdep problem
with regulators. This was on the chromeos-5.15 kernel, but I see
nothing that would be different downstream compared to upstream. The
bot said:
============================================
WARNING: possible recursive locking detected 5.15.104-lockdep-17461-gc1e499ed6604 #1 Not tainted
--------------------------------------------
kworker/u16:4/115 is trying to acquire lock:
ffffff8083110170 (regulator_ww_class_mutex){+.+.}-{3:3}, at: create_regulator+0x398/0x7ec
but task is already holding lock:
ffffff808378e170 (regulator_ww_class_mutex){+.+.}-{3:3}, at: ww_mutex_trylock+0x3c/0x7b8
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(regulator_ww_class_mutex);
lock(regulator_ww_class_mutex);*** DEADLOCK ***
May be due to missing lock nesting notation
4 locks held by kworker/u16:4/115:
#0: ffffff808006a948 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work+0x520/0x1348 #1: ffffffc00e0a7cc0 ((work_completion)(&entry->work)){+.+.}-{0:0}, at: process_one_work+0x55c/0x1348 #2: ffffff80828a2260 (&dev->mutex){....}-{3:3}, at: __device_attach_async_helper+0xd0/0x2a4 #3: ffffff808378e170 (regulator_ww_class_mutex){+.+.}-{3:3}, at: ww_mutex_trylock+0x3c/0x7b8
stack backtrace: CPU: 2 PID: 115 Comm: kworker/u16:4 Not tainted 5.15.104-lockdep-17461-gc1e499ed6604 #1 9292e52fa83c0e23762b2b3aa1bacf5787a4d5da Hardware name: Google Quackingstick (rev0+) (DT) Workqueue: events_unbound async_run_entry_fn Call trace: dump_backtrace+0x0/0x4ec show_stack+0x34/0x50 dump_stack_lvl+0xdc/0x11c dump_stack+0x1c/0x48 __lock_acquire+0x16d4/0x6c74 lock_acquire+0x208/0x750 __mutex_lock_common+0x11c/0x11f8 ww_mutex_lock+0xc0/0x440 create_regulator+0x398/0x7ec regulator_resolve_supply+0x654/0x7c4 regulator_register_resolve_supply+0x30/0x120 class_for_each_device+0x1b8/0x230 regulator_register+0x17a4/0x1f40 devm_regulator_register+0x60/0xd0 reg_fixed_voltage_probe+0x728/0xaec platform_probe+0x150/0x1c8 really_probe+0x274/0xa20 __driver_probe_device+0x1dc/0x3f4 driver_probe_device+0x78/0x1c0 __device_attach_driver+0x1ac/0x2c8 bus_for_each_drv+0x11c/0x190 __device_attach_async_helper+0x1e4/0x2a4 async_run_entry_fn+0xa0/0x3ac process_one_work+0x638/0x1348 worker_thread+0x4a8/0x9c4 kthread+0x2e4/0x3a0 ret_from_fork+0x10/0x20
The problem was first reported soon after we made many of the regulators probe asynchronously, though nothing I've seen implies that the problems couldn't have also happened even without that.
I haven't personally been able to reproduce the lockdep issue, but the issue does look somewhat legitimate. Specifically, it looks like in regulator_resolve_supply() we are holding a "rdev" lock while calling set_supply() -> create_regulator() which grabs the lock of a _different_ "rdev" (the one for our supply). This is not necessarily safe from a lockdep perspective since there is no documented ordering between these two locks.
In reality, we should always be locking a regulator before the supplying regulator, so I don't expect there to be any real deadlocks in practice. However, the regulator framework in general doesn't express this to lockdep.
Let's fix the issue by simply grabbing the two locks involved in the same way we grab multiple locks elsewhere in the regulator framework:
using the "wound/wait" mechanisms.
--- drivers/regulator/core.c | 91 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 83 insertions(+), 8 deletions(-)
drivers/regulator/core.c +83 -8
@@ -216,6 +216,78 @@ static void regulator_unlock(struct regulator_dev *rdev)mutex_unlock (®ulator_nesting_mutex); } +/** +* regulator_lock_two - lock two regulators +* @rdev1: first regulator +* @rdev2: second regulator +* @ww_ctx: w/w mutex acquire context +* +* Locks both rdevs using the regulator_ww_class. +*/ +static void regulator_lock_two (struct regulator_dev *rdev1, +struct regulator_dev *rdev2, +struct ww_acquire_ctx *ww_ctx) +{ +struct regulator_dev *tmp; +int ret; + +ww_acquire_init (ww_ctx, ®ulator_ww_class); + +/* Try to just grab both of them */ + ret =regulator_lock_nested (rdev1, ww_ctx); +WARN_ON (ret); + ret =regulator_lock_nested (rdev2, ww_ctx); +if (ret != -EDEADLOCK ) { +WARN_ON (ret); + goto exit; + } + +while (true) { +/* +* Start of loop: rdev1 was locked and rdev2 was contended. +* Need to unlock rdev1, slowly lock rdev2, then try rdev1 +* again. +*/ +regulator_unlock (rdev1); + +ww_mutex_lock_slow (&rdev2->mutex, ww_ctx); + rdev2->ref_cnt++; + rdev2->mutex_owner = current; + ret =regulator_lock_nested (rdev1, ww_ctx); + +if (ret == -EDEADLOCK ) { +/* More contention; swap which needs to be slow */ + tmp = rdev1; + rdev1 = rdev2; + rdev2 = tmp; + }else { +WARN_ON (ret); +break ; + } + } + +exit: +ww_acquire_done (ww_ctx); +} + +/** +* regulator_unlock_two - unlock two regulators +* @rdev1: first regulator +* @rdev2: second regulator +* @ww_ctx: w/w mutex acquire context +* +* The inverse of regulator_lock_two(). +*/ + +static void regulator_unlock_two (struct regulator_dev *rdev1, +struct regulator_dev *rdev2, +struct ww_acquire_ctx *ww_ctx) +{ +regulator_unlock (rdev2); +regulator_unlock (rdev1); +ww_acquire_fini (ww_ctx); +} +static bool regulator_supply_is_couple (struct regulator_dev *rdev) {struct regulator_dev *c_rdev;
@@ -1460,8 +1532,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)/** * set_supply - set regulator supply regulator -* @rdev: regulator name -* @supply_rdev: supply regulator name +* @rdev: regulator (locked) +* @supply_rdev: supply regulator (locked)) * * Called by platform initialisation code to set the supply regulator for this * regulator. This ensures that a regulators supply will also be enabled by the
@@ -1633,6 +1705,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,struct regulator *regulator;int err =0 ; +lockdep_assert_held_once (&rdev->mutex.base); +if (dev) {char buf[REG_STR_SIZE ];int size;
@@ -1660,9 +1734,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, regulator->rdev = rdev; regulator->supply_name = supply_name; -regulator_lock (rdev);list_add (®ulator->list, &rdev->consumer_list); -regulator_unlock (rdev);if (dev) { regulator->dev = dev;
@@ -1828,6 +1900,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) {struct regulator_dev *r;struct device *dev = rdev->dev.parent; +struct ww_acquire_ctx ww_ctx;int ret =0 ;/* No supply to resolve? */
@@ -1894,23 +1967,23 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)* between rdev->supply null check and setting rdev->supply in * set_supply() from concurrent tasks. */ -regulator_lock (rdev); +regulator_lock_two (rdev, r, &ww_ctx);/* Supply just resolved by a concurrent task? */ if (rdev->supply) { -regulator_unlock (rdev); +regulator_unlock_two (rdev, r, &ww_ctx);put_device (&r->dev); goto out; } ret =set_supply (rdev, r);if (ret <0 ) { -regulator_unlock (rdev); +regulator_unlock_two (rdev, r, &ww_ctx);put_device (&r->dev); goto out; } -regulator_unlock (rdev); +regulator_unlock_two (rdev, r, &ww_ctx);/* * In set_machine_constraints() we may have turned this regulator on
@@ -2023,7 +2096,9 @@ struct regulator *_regulator_get(struct device *dev, const char *id,return regulator; } +regulator_lock (rdev); regulator =create_regulator (rdev, dev, id); +regulator_unlock (rdev);if (regulator ==NULL ) { regulator =ERR_PTR (-ENOMEM );module_put (rdev->owner);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 105/381 x86/apic: Fix atomic update of offset in reserve_eilvt_offset()
In reply to Greg Kroah-HartmanFrom: Uros Bizjak <[email protected]>
[ Upstream commit f96fb2df3eb31ede1b34b0521560967310267750 ]
The detection of atomic update failure in reserve_eilvt_offset() is not correct. The value returned by atomic_cmpxchg() should be compared to the old value from the location to be updated.
If these two are the same, then atomic update succeeded and "eilvt_offsets[offset]" location is updated to "new" in an atomic way.
Otherwise, the atomic update failed and it should be retried with the value from "eilvt_offsets[offset]" - exactly what atomic_try_cmpxchg() does in a correct and more optimal way.
--- arch/x86/kernel/apic/apic.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kernel/apic/apic.c +2 -3
@@ -410,10 +410,9 @@ static unsigned int reserve_eilvt_offset(int offset, unsigned int new)if (vector && !eilvt_entry_is_changeable (vector, new))/* may not change if vectors are different */ return rsvd; - rsvd =atomic_cmpxchg (&eilvt_offsets[offset], rsvd, new); - }while (rsvd != new); + }while (!atomic_try_cmpxchg (&eilvt_offsets[offset], &rsvd, new)); - rsvd &= ~APIC_EILVT_MASKED ; + rsvd = new & ~APIC_EILVT_MASKED ;if (rsvd && rsvd != vector)pr_info ("LVT offset %d assigned for vector 0x%02x\n" , offset, rsvd);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 106/381 media: rkvdec: fix use after free bug in rkvdec_remove
In reply to Greg Kroah-HartmanFrom: Zheng Wang <[email protected]>
[ Upstream commit 3228cec23b8b29215e18090c6ba635840190993d ]
In rkvdec_probe, rkvdec->watchdog_work is bound with rkvdec_watchdog_func. Then rkvdec_vp9_run may be called to start the work.
If we remove the module which will call rkvdec_remove
to make cleanup, there may be a unfinished work. The possible sequence is as follows, which will cause a typical UAF bug.
Fix it by canceling the work before cleanup in rkvdec_remove.
CPU0 CPU1
|rkvdec_watchdog_func
rkvdec_remove |
rkvdec_v4l2_cleanup|
v4l2_m2m_release |
kfree(m2m_dev); |
|
| v4l2_m2m_get_curr_priv
| m2m_dev->curr_ctx //use--- drivers/staging/media/rkvdec/rkvdec.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/media/rkvdec/rkvdec.c +2 -0
@@ -1077,6 +1077,8 @@ static int rkvdec_remove(struct platform_device *pdev) {struct rkvdec_dev *rkvdec =platform_get_drvdata (pdev); +cancel_delayed_work_sync (&rkvdec->watchdog_work); +rkvdec_v4l2_cleanup (rkvdec);pm_runtime_disable (&pdev->dev);pm_runtime_dont_use_autosuspend (&pdev->dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 107/381 media: dm1105: Fix use after free bug in dm1105_remove due to race condition
In reply to Greg Kroah-HartmanFrom: Zheng Wang <[email protected]>
[ Upstream commit 5abda7a16698d4d1f47af1168d8fa2c640116b4a ]
In dm1105_probe, it called dm1105_ir_init and bound &dm1105->ir.work with dm1105_emit_key.
When it handles IRQ request with dm1105_irq, it may call schedule_work to start the work.
When we call dm1105_remove to remove the driver, there may be a sequence as follows:
Fix it by finishing the work before cleanup in dm1105_remove
CPU0 CPU1
|dm1105_emit_key
dm1105_remove |
dm1105_ir_exit |
rc_unregister_device |
rc_free_device |
rc_dev_release |
kfree(dev); |
|
| rc_keydown
| //use--- drivers/media/pci/dm1105/dm1105.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/dm1105/dm1105.c +1 -0
@@ -1178,6 +1178,7 @@ static void dm1105_remove(struct pci_dev *pdev)struct dvb_demux *dvbdemux = &dev->demux;struct dmx_demux *dmx = &dvbdemux->dmx; +cancel_work_sync (&dev->ir.work);dm1105_ir_exit (dev); dmx->close (dmx);dvb_net_release (&dev->dvbnet);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 108/381 media: saa7134: fix use after free bug in saa7134_finidev due to race condition
In reply to Greg Kroah-HartmanFrom: Zheng Wang <[email protected]>
[ Upstream commit 30cf57da176cca80f11df0d9b7f71581fe601389 ]
In saa7134_initdev, it will call saa7134_hwinit1. There are three function invoking here: saa7134_video_init1, saa7134_ts_init1 and saa7134_vbi_init1.
All of them will init a timer with same function. Take saa7134_video_init1 as an example. It'll bound &dev->video_q.timeout with saa7134_buffer_timeout.
In buffer_activate, the timer funtcion is started.
If we remove the module or device which will call saa7134_finidev to make cleanup, there may be a unfinished work. The possible sequence is as follows, which will cause a typical UAF bug.
Fix it by canceling the timer works accordingly before cleanup in saa7134_finidev.
CPU0 CPU1
|saa7134_buffer_timeout
saa7134_finidev |
kfree(dev); |
|
| saa7134_buffer_next
| //use dev--- drivers/media/pci/saa7134/saa7134-ts.c | 1 + drivers/media/pci/saa7134/saa7134-vbi.c | 1 + drivers/media/pci/saa7134/saa7134-video.c | 1 + 3 files changed, 3 insertions(+)
drivers/media/pci/saa7134/saa7134-ts.c +1 -0
@@ -300,6 +300,7 @@ int saa7134_ts_start(struct saa7134_dev *dev)int saa7134_ts_fini (struct saa7134_dev *dev) { +del_timer_sync (&dev->ts_q.timeout);saa7134_pgtable_free (dev->pci, &dev->ts_q.pt);return 0 ; }
drivers/media/pci/saa7134/saa7134-vbi.c +1 -0
@@ -185,6 +185,7 @@ int saa7134_vbi_init1(struct saa7134_dev *dev)int saa7134_vbi_fini (struct saa7134_dev *dev) {/* nothing */ +del_timer_sync (&dev->vbi_q.timeout);return 0 ; }
drivers/media/pci/saa7134/saa7134-video.c +1 -0
@@ -2153,6 +2153,7 @@ int saa7134_video_init1(struct saa7134_dev *dev)void saa7134_video_fini (struct saa7134_dev *dev) { +del_timer_sync (&dev->video_q.timeout);/* free stuff */ saa7134_pgtable_free (dev->pci, &dev->video_q.pt);saa7134_pgtable_free (dev->pci, &dev->vbi_q.pt);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 109/381 media: rcar_fdp1: simplify error check logic at fdp_open()
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit fa9f443f7c962d072d150472e2bb77de39817a9a ]
Avoid some code duplication by moving the common error path logic at fdp_open().
Stable-dep-of: c766c90faf93 ("media: rcar_fdp1: Fix refcount leak in probe and remove function")
--- drivers/media/platform/rcar_fdp1.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/media/platform/rcar_fdp1.c +8 -7
@@ -2121,9 +2121,7 @@ static int fdp1_open(struct file *file)if (ctx->hdl.error) { ret = ctx->hdl.error; -v4l2_ctrl_handler_free (&ctx->hdl); -kfree (ctx); - goto done; + goto error_ctx; } ctx->fh.ctrl_handler = &ctx->hdl;
@@ -2137,10 +2135,7 @@ static int fdp1_open(struct file *file)if (IS_ERR (ctx->fh.m2m_ctx)) { ret =PTR_ERR (ctx->fh.m2m_ctx); - -v4l2_ctrl_handler_free (&ctx->hdl); -kfree (ctx); - goto done; + goto error_ctx; }/* Perform any power management required */
@@ -2151,6 +2146,12 @@ static int fdp1_open(struct file *file)dprintk (fdp1,"Created instance: %p, m2m_ctx: %p\n" , ctx, ctx->fh.m2m_ctx); +mutex_unlock (&fdp1->dev_mutex); +return 0 ; + +error_ctx: +v4l2_ctrl_handler_free (&ctx->hdl); +kfree (ctx); done:mutex_unlock (&fdp1->dev_mutex);return ret;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 110/381 media: rcar_fdp1: fix pm_runtime_get_sync() usage count
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 45e75a8c6fa455a5909ac04db76a4b15d6bb8368 ]
The pm_runtime_get_sync() internally increments thedev->power.usage_count without decrementing it, even on errors.
Replace it by the new pm_runtime_resume_and_get(), introduced by:
commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") in order to properly decrement the usage counter, avoiding
a potential PM usage counter leak.
Also, right now, the driver is ignoring any troubles when trying to do PM resume. So, add the proper error handling for the code.
Stable-dep-of: c766c90faf93 ("media: rcar_fdp1: Fix refcount leak in probe and remove function")
--- drivers/media/platform/rcar_fdp1.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/media/platform/rcar_fdp1.c +11 -2
@@ -2139,7 +2139,9 @@ static int fdp1_open(struct file *file) }/* Perform any power management required */ -pm_runtime_get_sync (fdp1->dev); + ret =pm_runtime_resume_and_get (fdp1->dev); +if (ret <0 ) + goto error_pm;v4l2_fh_add (&ctx->fh);
@@ -2149,6 +2151,8 @@ static int fdp1_open(struct file *file)mutex_unlock (&fdp1->dev_mutex);return 0 ; +error_pm: +v4l2_m2m_ctx_release (ctx->fh.m2m_ctx); error_ctx:v4l2_ctrl_handler_free (&ctx->hdl);kfree (ctx);
@@ -2356,7 +2360,9 @@ static int fdp1_probe(struct platform_device *pdev)/* Power up the cells to read HW */ pm_runtime_enable (&pdev->dev); -pm_runtime_get_sync (fdp1->dev); + ret =pm_runtime_resume_and_get (fdp1->dev); +if (ret <0 ) + goto disable_pm; hw_version =fdp1_read (fdp1,FD1_IP_INTDATA );switch (hw_version) {
@@ -2385,6 +2391,9 @@ static int fdp1_probe(struct platform_device *pdev)return 0 ; +disable_pm: +pm_runtime_disable (fdp1->dev); + release_m2m:v4l2_m2m_release (fdp1->m2m_dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 111/381 media: rcar_fdp1: Make use of the helper function devm_platform_ioremap_resource()
In reply to Greg Kroah-HartmanFrom: Cai Huoqing <[email protected]>
[ Upstream commit 736cce12fa630e28705de06570d74f0513d948d5 ]
Use the devm_platform_ioremap_resource() helper instead of calling platform_get_resource() and devm_ioremap_resource() separately
Stable-dep-of: c766c90faf93 ("media: rcar_fdp1: Fix refcount leak in probe and remove function")
--- drivers/media/platform/rcar_fdp1.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/platform/rcar_fdp1.c +1 -3
@@ -2260,7 +2260,6 @@ static int fdp1_probe(struct platform_device *pdev)struct fdp1_dev *fdp1;struct video_device *vfd;struct device_node *fcp_node; -struct resource *res;struct clk *clk;unsigned int i;
@@ -2287,8 +2286,7 @@ static int fdp1_probe(struct platform_device *pdev)platform_set_drvdata (pdev, fdp1);/* Memory-mapped registers */ - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - fdp1->regs =devm_ioremap_resource (&pdev->dev, res); + fdp1->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (fdp1->regs))return PTR_ERR (fdp1->regs);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 112/381 media: rcar_fdp1: Fix the correct variable assignments
In reply to Greg Kroah-HartmanFrom: Tang Bin <[email protected]>
[ Upstream commit af88c2adbb72a09ab1bb5c37ba388c98fecca69b ]
In the function fdp1_probe(), when get irq failed, the function platform_get_irq() log an error message, so remove redundant message here. And the variable type of "ret" is int, the "fdp1->irq" is unsigned int, when irq failed, this place maybe wrong, thus fix it.
Stable-dep-of: c766c90faf93 ("media: rcar_fdp1: Fix refcount leak in probe and remove function")
--- drivers/media/platform/rcar_fdp1.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/media/platform/rcar_fdp1.c +3 -4
@@ -2291,11 +2291,10 @@ static int fdp1_probe(struct platform_device *pdev)return PTR_ERR (fdp1->regs);/* Interrupt service routine registration */ - fdp1->irq = ret =platform_get_irq (pdev,0 ); -if (ret <0 ) { -dev_err (&pdev->dev,"cannot find IRQ\n" ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 )return ret; - } + fdp1->irq = ret; ret =devm_request_irq (&pdev->dev, fdp1->irq, fdp1_irq_handler,0 ,dev_name (&pdev->dev), fdp1);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 113/381 media: rcar_fdp1: Fix refcount leak in probe and remove function
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit c766c90faf93897b77c9c5daa603cffab85ba907 ]
rcar_fcp_get() take reference, which should be balanced with rcar_fcp_put(). Add missing rcar_fcp_put() in fdp1_remove and the error paths of fdp1_probe() to fix this.
--- drivers/media/platform/rcar_fdp1.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/media/platform/rcar_fdp1.c +8 -3
@@ -2317,8 +2317,10 @@ static int fdp1_probe(struct platform_device *pdev)/* Determine our clock rate */ clk =clk_get (&pdev->dev,NULL ); -if (IS_ERR (clk)) -return PTR_ERR (clk); +if (IS_ERR (clk)) { + ret =PTR_ERR (clk); + goto put_dev; + } fdp1->clk_rate =clk_get_rate (clk);clk_put (clk);
@@ -2327,7 +2329,7 @@ static int fdp1_probe(struct platform_device *pdev) ret =v4l2_device_register (&pdev->dev, &fdp1->v4l2_dev);if (ret) {v4l2_err (&fdp1->v4l2_dev,"Failed to register video device\n" ); -return ret; + goto put_dev; }/* M2M registration */
@@ -2397,6 +2399,8 @@ static int fdp1_probe(struct platform_device *pdev) unreg_dev:v4l2_device_unregister (&fdp1->v4l2_dev); +put_dev: +rcar_fcp_put (fdp1->fcp);return ret; }
@@ -2408,6 +2412,7 @@ static int fdp1_remove(struct platform_device *pdev)video_unregister_device (&fdp1->vfd);v4l2_device_unregister (&fdp1->v4l2_dev);pm_runtime_disable (&pdev->dev); +rcar_fcp_put (fdp1->fcp);return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 114/381 media: rc: gpio-ir-recv: Fix support for wake-up
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 9c592f8ab114875fdb3b2040f01818e53de44991 ]
The driver was intended from the start to be a wake-up source for the system, however due to the absence of a suitable call to device_set_wakeup_capable(), the device_may_wakeup() call used to decide whether to enable the GPIO interrupt as a wake-up source would never happen. Lookup the DT standard "wakeup-source" property and call device_init_wakeup() to ensure the device is flagged as being wakeup capable.
--- drivers/media/rc/gpio-ir-recv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/rc/gpio-ir-recv.c +2 -0
@@ -107,6 +107,8 @@ static int gpio_ir_recv_probe(struct platform_device *pdev) rcdev->map_name =RC_MAP_EMPTY ; gpio_dev->rcdev = rcdev; +if (of_property_read_bool (np,"wakeup-source" )) +device_init_wakeup (dev, true); rc =devm_rc_register_device (dev, rcdev);if (rc <0 ) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 115/381 media: venus: vdec: Fix non reliable setting of LAST flag
In reply to Greg Kroah-HartmanFrom: Stanimir Varbanov <[email protected]>
[ Upstream commit acf8a57d8caf5ceabbe50774953fe04745ad1a50 ]
In real use of dynamic-resolution-change it is observed that the LAST buffer flag (which marks the last decoded buffer with the resolution before the resolution-change event) is not reliably set.
Fix this by set the LAST buffer flag on next queued capture buffer after the resolution-change event.
Stable-dep-of: 50248ad9f190 ("media: venus: dec: Fix handling of the start cmd")
--- drivers/media/platform/qcom/venus/core.h | 5 +-- drivers/media/platform/qcom/venus/helpers.c | 6 +++ drivers/media/platform/qcom/venus/vdec.c | 45 ++++++++++++--------- 3 files changed, 33 insertions(+), 23 deletions(-)
drivers/media/platform/qcom/venus/core.h +2 -3
@@ -283,7 +283,6 @@ enum venus_dec_state {VENUS_DEC_STATE_DRAIN =5 ,VENUS_DEC_STATE_DECODING =6 , VENUS_DEC_STATE_DRC = 7, - VENUS_DEC_STATE_DRC_FLUSH_DONE = 8, }; struct venus_ts_metadata {
@@ -348,7 +347,7 @@ struct venus_ts_metadata {* @priv: a private for HFI operations callbacks * @session_type: the type of the session (decoder or encoder) * @hprop: a union used as a holder by get property -* @last_buf: last capture buffer for dynamic-resoluton-change +* @next_buf_last: a flag to mark next queued capture buffer as last */ struct venus_inst {struct list_head list;
@@ -410,7 +409,7 @@ struct venus_inst {union hfi_get_property hprop; unsigned int core_acquired: 1;unsigned int bit_depth; -struct vb2_buffer *last_buf; +bool next_buf_last; };#define IS_V1 (core) ((core)->res->hfi_version == HFI_VERSION_1XX)
drivers/media/platform/qcom/venus/helpers.c +6 -0
@@ -1347,6 +1347,12 @@ void venus_helper_vb2_buf_queue(struct vb2_buffer *vb)v4l2_m2m_buf_queue (m2m_ctx, vbuf); +/* Skip processing queued capture buffers after LAST flag */ +if (inst->session_type ==VIDC_SESSION_TYPE_DEC && +V4L2_TYPE_IS_CAPTURE (vb->vb2_queue->type) && + inst->codec_state ==VENUS_DEC_STATE_DRC ) + goto unlock; +cache_payload (inst, vb); if (inst->session_type == VIDC_SESSION_TYPE_ENC &&
drivers/media/platform/qcom/venus/vdec.c +25 -20
98 lines not on this page · raw message
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 116/381 media: venus: vdec: Make decoder return LAST flag for sufficient event
In reply to Greg Kroah-HartmanFrom: Stanimir Varbanov <[email protected]>
[ Upstream commit a4ca67af8b831a781ac53060c5d5c3dccaf7676e ]
This makes the decoder to behaives equally for sufficient and insufficient events. After this change the LAST buffer flag will be set when the new resolution (in dynamic-resolution-change state) is smaller then the old bitstream resolution.
Stable-dep-of: 50248ad9f190 ("media: venus: dec: Fix handling of the start cmd")
--- drivers/media/platform/qcom/venus/vdec.c | 42 ++++++++++++++++-------- 1 file changed, 28 insertions(+), 14 deletions(-)
drivers/media/platform/qcom/venus/vdec.c +28 -14
@@ -636,6 +636,7 @@ static int vdec_output_conf(struct venus_inst *inst) {struct venus_core *core = inst->core;struct hfi_enable en = { .enable =1 }; +struct hfi_buffer_requirements bufreq;u32 width = inst->out_width;u32 height = inst->out_height;u32 out_fmt, out2_fmt;
@@ -711,6 +712,23 @@ static int vdec_output_conf(struct venus_inst *inst) }if (IS_V3 (core) ||IS_V4 (core)) { + ret =venus_helper_get_bufreq (inst,HFI_BUFFER_OUTPUT , &bufreq); +if (ret) +return ret; + +if (bufreq.size > inst->output_buf_size) +return -EINVAL ; + +if (inst->dpb_fmt) { + ret =venus_helper_get_bufreq (inst,HFI_BUFFER_OUTPUT2 , + &bufreq); +if (ret) +return ret; + +if (bufreq.size > inst->output2_buf_size) +return -EINVAL ; + } +if (inst->output2_buf_size) { ret = venus_helper_set_bufsize(inst, inst->output2_buf_size,
@@ -1330,19 +1348,15 @@ static void vdec_event_change(struct venus_inst *inst,dev_dbg (dev,VDBGM "event %s sufficient resources (%ux%u)\n" , sufficient ?"" :"not" , ev_data->width, ev_data->height); -if (sufficient) { -hfi_session_continue (inst); - }else { -switch (inst->codec_state) { -case VENUS_DEC_STATE_INIT : - inst->codec_state =VENUS_DEC_STATE_CAPTURE_SETUP ; -break ; -case VENUS_DEC_STATE_DECODING : - inst->codec_state =VENUS_DEC_STATE_DRC ; -break ; -default : -break ; - } +switch (inst->codec_state) { +case VENUS_DEC_STATE_INIT : + inst->codec_state =VENUS_DEC_STATE_CAPTURE_SETUP ; +break ; +case VENUS_DEC_STATE_DECODING : + inst->codec_state =VENUS_DEC_STATE_DRC ; +break ; +default : +break ; }/*
@@ -1351,7 +1365,7 @@ static void vdec_event_change(struct venus_inst *inst,* itself doesn't mark the last decoder output buffer with HFI EOS flag. */ -if (!sufficient && inst->codec_state ==VENUS_DEC_STATE_DRC ) { +if (inst->codec_state ==VENUS_DEC_STATE_DRC ) {int ret; inst->next_buf_last = true;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 117/381 media: venus: preserve DRC state across seeks
In reply to Greg Kroah-HartmanFrom: Alexandre Courbot <[email protected]>
[ Upstream commit d5ee32d7e5929592ad9b6e7a919dcdf89d05221b ]
DRC events can happen virtually at anytime, including when we are starting a seek. Should this happen, we must make sure to return to the DRC state, otherwise the firmware will expect buffers of the new resolution whereas userspace will still work with the old one.
Returning to the DRC state upon resume for seeking makes sure that the client will get the DRC event and will reallocate the buffers to fit the firmware's expectations.
Stable-dep-of: 50248ad9f190 ("media: venus: dec: Fix handling of the start cmd")
--- drivers/media/platform/qcom/venus/vdec.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/venus/vdec.c +9 -2
@@ -987,7 +987,10 @@ static int vdec_start_output(struct venus_inst *inst)if (inst->codec_state ==VENUS_DEC_STATE_SEEK ) { ret =venus_helper_process_initial_out_bufs (inst); - inst->codec_state =VENUS_DEC_STATE_DECODING ; +if (inst->next_buf_last) + inst->codec_state =VENUS_DEC_STATE_DRC ; +else + inst->codec_state =VENUS_DEC_STATE_DECODING ; goto done; }
@@ -1093,8 +1096,10 @@ static int vdec_stop_capture(struct venus_inst *inst) ret =hfi_session_flush (inst,HFI_FLUSH_ALL , true); fallthrough;case VENUS_DEC_STATE_DRAIN : -vdec_cancel_dst_buffers (inst); inst->codec_state =VENUS_DEC_STATE_STOPPED ; + fallthrough; +case VENUS_DEC_STATE_SEEK : +vdec_cancel_dst_buffers (inst);break ;case VENUS_DEC_STATE_DRC : ret =hfi_session_flush (inst,HFI_FLUSH_OUTPUT , true);
@@ -1116,6 +1121,7 @@ static int vdec_stop_output(struct venus_inst *inst)case VENUS_DEC_STATE_DECODING :case VENUS_DEC_STATE_DRAIN :case VENUS_DEC_STATE_STOPPED : +case VENUS_DEC_STATE_DRC : ret =hfi_session_flush (inst,HFI_FLUSH_ALL , true); inst->codec_state =VENUS_DEC_STATE_SEEK ;break ;
@@ -1375,6 +1381,7 @@ static void vdec_event_change(struct venus_inst *inst,dev_dbg (dev,VDBGH "flush output error %d\n" , ret); } + inst->next_buf_last = true; inst->reconfig = true;v4l2_event_queue_fh (&inst->fh, &ev);wake_up (&inst->reconf_wait);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 118/381 media: venus: vdec: Handle DRC after drain
In reply to Greg Kroah-HartmanFrom: Fritz Koenig <[email protected]>
[ Upstream commit c8e8dabcd1a8c7aaedc514052d383a8152119084 ]
If the DRC is near the end of the stream the client may send a V4L2_DEC_CMD_STOP before the DRC occurs. V4L2_DEC_CMD_STOP puts the driver into the VENUS_DEC_STATE_DRAIN state. DRC must be aware so that after the DRC event the state can be restored correctly.
Stable-dep-of: 50248ad9f190 ("media: venus: dec: Fix handling of the start cmd")
--- drivers/media/platform/qcom/venus/core.h | 1 + drivers/media/platform/qcom/venus/vdec.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/venus/core.h +1 -0
@@ -410,6 +410,7 @@ struct venus_inst { unsigned int core_acquired: 1;unsigned int bit_depth;bool next_buf_last; +bool drain_active; };#define IS_V1 (core) ((core)->res->hfi_version == HFI_VERSION_1XX)
drivers/media/platform/qcom/venus/vdec.c +12 -2
@@ -518,8 +518,10 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) ret =hfi_session_process_buf (inst, &fdata); -if (!ret && inst->codec_state ==VENUS_DEC_STATE_DECODING ) +if (!ret && inst->codec_state ==VENUS_DEC_STATE_DECODING ) { inst->codec_state =VENUS_DEC_STATE_DRAIN ; + inst->drain_active = true; + } } unlock:
@@ -969,9 +971,13 @@ static int vdec_start_capture(struct venus_inst *inst) inst->codec_state =VENUS_DEC_STATE_DECODING ; +if (inst->drain_active) + inst->codec_state =VENUS_DEC_STATE_DRAIN ; + inst->streamon_cap =1 ; inst->sequence_cap =0 ; inst->reconfig = false; + inst->drain_active = false;return 0 ;
@@ -1097,6 +1103,7 @@ static int vdec_stop_capture(struct venus_inst *inst) fallthrough;case VENUS_DEC_STATE_DRAIN : inst->codec_state =VENUS_DEC_STATE_STOPPED ; + inst->drain_active = false; fallthrough;case VENUS_DEC_STATE_SEEK :vdec_cancel_dst_buffers (inst);
@@ -1297,8 +1304,10 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,v4l2_event_queue_fh (&inst->fh, &ev); -if (inst->codec_state ==VENUS_DEC_STATE_DRAIN ) +if (inst->codec_state ==VENUS_DEC_STATE_DRAIN ) { + inst->drain_active = false; inst->codec_state =VENUS_DEC_STATE_STOPPED ; + } }if (!bytesused)
@@ -1359,6 +1368,7 @@ static void vdec_event_change(struct venus_inst *inst, inst->codec_state =VENUS_DEC_STATE_CAPTURE_SETUP ;break ;case VENUS_DEC_STATE_DECODING : +case VENUS_DEC_STATE_DRAIN : inst->codec_state =VENUS_DEC_STATE_DRC ;break ;default :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 119/381 media: venus: dec: Fix handling of the start cmd
In reply to Greg Kroah-HartmanFrom: Michał Krawczyk <[email protected]>
[ Upstream commit 50248ad9f190d527cbd578190ca769729518b703 ]
The decoder driver should clear the last_buffer_dequeued flag of the capture queue upon receiving V4L2_DEC_CMD_START.
The last_buffer_dequeued flag is set upon receiving EOS (which always happens upon receiving V4L2_DEC_CMD_STOP).
Without this patch, after issuing the V4L2_DEC_CMD_STOP and V4L2_DEC_CMD_START, the vb2_dqbuf() function will always fail, even if the buffers are completed by the hardware.
--- drivers/media/platform/qcom/venus/vdec.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/media/platform/qcom/venus/vdec.c +8 -0
@@ -495,6 +495,7 @@ static int vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) { struct venus_inst *inst = to_inst(file); +struct vb2_queue *dst_vq;struct hfi_frame_data fdata = {0 };int ret;
@@ -522,6 +523,13 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) inst->codec_state =VENUS_DEC_STATE_DRAIN ; inst->drain_active = true; } + }else if (cmd->cmd ==V4L2_DEC_CMD_START && + inst->codec_state ==VENUS_DEC_STATE_STOPPED ) { + dst_vq =v4l2_m2m_get_vq (inst->fh.m2m_ctx, +V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ); +vb2_clear_last_buffer_dequeued (dst_vq); + + inst->codec_state =VENUS_DEC_STATE_DECODING ; } unlock:
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 120/381 regulator: stm32-pwr: fix of_iomap leak
In reply to Greg Kroah-HartmanFrom: YAN SHI <[email protected]>
[ Upstream commit c4a413e56d16a2ae84e6d8992f215c4dcc7fac20 ]
Smatch reports:drivers/regulator/stm32-pwr.c:166 stm32_pwr_regulator_probe() warn:
'base' from of_iomap() not released on lines: 151,166.
In stm32_pwr_regulator_probe(), base is not released when devm_kzalloc() fails to allocate memory or devm_regulator_register() fails to register a new regulator device, which may cause a leak.
To fix this issue, replace of_iomap() with devm_platform_ioremap_resource(). devm_platform_ioremap_resource() is a specialized function for platform devices.
It allows 'base' to be automatically released whether the probe function succeeds or fails.
Besides, use IS_ERR(base) instead of !base
as the return value of devm_platform_ioremap_resource() can either be a pointer to the remapped memory or an ERR_PTR() encoded error code if the operation fails.
--- drivers/regulator/stm32-pwr.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/regulator/stm32-pwr.c +3 -4
@@ -129,17 +129,16 @@ static const struct regulator_desc stm32_pwr_desc[] = {static int stm32_pwr_regulator_probe (struct platform_device *pdev) { -struct device_node *np = pdev->dev.of_node;struct stm32_pwr_reg *priv;void __iomem *base;struct regulator_dev *rdev;struct regulator_config config = { };int i, ret =0 ; - base =of_iomap (np,0 ); -if (!base) { + base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (base)) {dev_err (&pdev->dev,"Unable to map IO memory\n" ); -return -ENOMEM ; +return PTR_ERR (base); } config.dev = &pdev->dev;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 121/381 x86/ioapic: Dont return 0 from arch_dynirq_lower_bound()
In reply to Greg Kroah-HartmanFrom: Saurabh Sengar <[email protected]>
[ Upstream commit 5af507bef93c09a94fb8f058213b489178f4cbe5 ]
arch_dynirq_lower_bound() is invoked by the core interrupt code to retrieve the lowest possible Linux interrupt number for dynamically allocated interrupts like MSI.
The x86 implementation uses this to exclude the IO/APIC GSI space. This works correctly as long as there is an IO/APIC registered, but returns 0 if not. This has been observed in VMs where the BIOS does not advertise an IO/APIC.
0 is an invalid interrupt number except for the legacy timer interrupt on x86. The return value is unchecked in the core code, so it ends up to allocate interrupt number 0 which is subsequently considered to be invalid by the caller, e.g. the MSI allocation code.
The function has already a check for 0 in the case that an IO/APIC is registered, as ioapic_dynirq_base is 0 in case of device tree setups.
Consolidate this and zero check for both ioapic_dynirq_base and gsi_top, which is used in the case that no IO/APIC is registered.
--- arch/x86/kernel/apic/io_apic.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
arch/x86/kernel/apic/io_apic.c +9 -5
@@ -2442,17 +2442,21 @@ static int io_apic_get_redir_entries(int ioapic)unsigned int arch_dynirq_lower_bound (unsigned int from) { +unsigned int ret; +/* * dmar_alloc_hwirq() may be called before setup_IO_APIC(), so use * gsi_top if ioapic_dynirq_base hasn't been initialized yet. */ -if (!ioapic_initialized) -return gsi_top; + ret = ioapic_dynirq_base ? : gsi_top; +/* -* For DT enabled machines ioapic_dynirq_base is irrelevant and not -* updated. So simply return @from if ioapic_dynirq_base == 0. +* For DT enabled machines ioapic_dynirq_base is irrelevant and +* always 0. gsi_top can be 0 if there is no IO/APIC registered. +* 0 is an invalid interrupt number for dynamic allocations. Return +* @from instead. */ -return ioapic_dynirq_base ? : from; +return ret ? : from; }#ifdef CONFIG_X86_32
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 122/381 arm64: kgdb: Set PSTATE.SS to 1 to re-enable single-step
In reply to Greg Kroah-HartmanFrom: Sumit Garg <[email protected]>
[ Upstream commit af6c0bd59f4f3ad5daad2f7b777954b1954551d5 ]
Currently only the first attempt to single-step has any effect. After that all further stepping remains "stuck" at the same program counter value.
Refer to the ARM Architecture Reference Manual (ARM DDI 0487E.a) D2.12, PSTATE.SS=1 should be set at each step before transferring the PE to the 'Active-not-pending' state. The problem here is PSTATE.SS=1 is not set since the second single-step.
After the first single-step, the PE transferes to the 'Inactive' state, with PSTATE.SS=0 and MDSCR.SS=1, thus PSTATE.SS won't be set to 1 due to kernel_active_single_step()=true. Then the PE transferes to the 'Active-pending' state when ERET and returns to the debugger by step exception.
Before this patch:
==================
Entering kdb (current=0xffff3376039f0000, pid 1) on processor 0 due to Keyboard Entry [0]kdb>
[0]kdb>
[0]kdb> bp write_sysrq_trigger
Instruction(i) BP #0 at 0xffffa45c13d09290 (write_sysrq_trigger)
is enabled addr at ffffa45c13d09290, hardtype=0 installed=0
[0]kdb> go
$ echo h > /proc/sysrq-trigger
Entering kdb (current=0xffff4f7e453f8000, pid 175) on processor 1 due to Breakpoint @ 0xffffad651a309290 [1]kdb> ss
Entering kdb (current=0xffff4f7e453f8000, pid 175) on processor 1 due to SS trap @ 0xffffad651a309294 [1]kdb> ss
Entering kdb (current=0xffff4f7e453f8000, pid 175) on processor 1 due to SS trap @ 0xffffad651a309294 [1]kdb>
After this patch:
=================
Entering kdb (current=0xffff6851c39f0000, pid 1) on processor 0 due to Keyboard Entry [0]kdb> bp write_sysrq_trigger
Instruction(i) BP #0 at 0xffffc02d2dd09290 (write_sysrq_trigger)
is enabled addr at ffffc02d2dd09290, hardtype=0 installed=0
[0]kdb> go
$ echo h > /proc/sysrq-trigger
Entering kdb (current=0xffff6851c53c1840, pid 174) on processor 1 due to Breakpoint @ 0xffffc02d2dd09290 [1]kdb> ss
Entering kdb (current=0xffff6851c53c1840, pid 174) on processor 1 due to SS trap @ 0xffffc02d2dd09294 [1]kdb> ss
Entering kdb (current=0xffff6851c53c1840, pid 174) on processor 1 due to SS trap @ 0xffffc02d2dd09298 [1]kdb> ss
Entering kdb (current=0xffff6851c53c1840, pid 174) on processor 1 due to SS trap @ 0xffffc02d2dd0929c [1]kdb>
--- arch/arm64/include/asm/debug-monitors.h | 1 + arch/arm64/kernel/debug-monitors.c | 5 +++++ arch/arm64/kernel/kgdb.c | 2 ++ 3 files changed, 8 insertions(+)
arch/arm64/include/asm/debug-monitors.h +1 -0
@@ -116,6 +116,7 @@ void user_regs_reset_single_step(struct user_pt_regs *regs,void kernel_enable_single_step (struct pt_regs *regs);void kernel_disable_single_step (void );int kernel_active_single_step (void ); +void kernel_rewind_single_step (struct pt_regs *regs);#ifdef CONFIG_HAVE_HW_BREAKPOINT int reinstall_suspended_bps (struct pt_regs *regs);
arch/arm64/kernel/debug-monitors.c +5 -0
@@ -439,6 +439,11 @@ int kernel_active_single_step(void) }NOKPROBE_SYMBOL (kernel_active_single_step); +void kernel_rewind_single_step (struct pt_regs *regs) +{ +set_regs_spsr_ss (regs); +} +/* ptrace API */ void user_enable_single_step (struct task_struct *task) {
arch/arm64/kernel/kgdb.c +2 -0
@@ -223,6 +223,8 @@ int kgdb_arch_handle_exception(int exception_vector, int signo,*/ if (!kernel_active_single_step ())kernel_enable_single_step (linux_regs); +else +kernel_rewind_single_step (linux_regs); err =0 ;break ;default :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 123/381 debugobject: Prevent init race with static objects
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 63a759694eed61025713b3e14dd827c8548daadc ]
Statically initialized objects are usually not initialized via the init() function of the subsystem. They are special cased and the subsystem provides a function to validate whether an object which is not yet tracked by debugobjects is statically initialized. This means the object is started to be tracked on first use, e.g. activation.
This works perfectly fine, unless there are two concurrent operations on that object. Schspa decoded the problem:
T0 T1
debug_object_assert_init(addr)
lock_hash_bucket()
obj = lookup_object(addr);
if (!obj) {
unlock_hash_bucket();
- > preemption
lock_subsytem_object(addr);
activate_object(addr)
lock_hash_bucket();
obj = lookup_object(addr);
if (!obj) {
unlock_hash_bucket();
if (is_static_object(addr))
init_and_track(addr);
lock_hash_bucket();
obj = lookup_object(addr);
obj->state = ACTIVATED;
unlock_hash_bucket();
subsys function modifies content of addr,
so static object detection does
not longer work.
unlock_subsytem_object(addr);
if (is_static_object(addr)) <- Fails
debugobject emits a warning and invokes the fixup function which
reinitializes the already active object in the worst case.This race exists forever, but was never observed until mod_timer() got a debug_object_assert_init() added which is outside of the timer base lock held section right at the beginning of the function to cover the lockless early exit points too.
Rework the code so that the lookup, the static object check and the tracking object association happens atomically under the hash bucket lock. This prevents the issue completely as all callers are serialized on the hash bucket lock and therefore cannot observe inconsistent state.
--- lib/debugobjects.c | 125 ++++++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 59 deletions(-)
lib/debugobjects.c +66 -59
@@ -219,10 +219,6 @@ static struct debug_obj *__alloc_object(struct hlist_head *list)return obj; } -/* -* Allocate a new object. If the pool is empty, switch off the debugger. -* Must be called with interrupts disabled. -*/ static struct debug_obj *alloc_object (void *addr,struct debug_bucket *b,const struct debug_obj_descr *descr) {
@@ -555,11 +551,49 @@ static void debug_object_is_on_stack(void *addr, int onstack)WARN_ON (1 ); } +static struct debug_obj *lookup_object_or_alloc (void *addr,struct debug_bucket *b, +const struct debug_obj_descr *descr, +bool onstack,bool alloc_ifstatic) +{ +struct debug_obj *obj =lookup_object (addr, b); +enum debug_obj_state state =ODEBUG_STATE_NONE ; + +if (likely (obj)) +return obj; + +/* +* debug_object_init() unconditionally allocates untracked +* objects. It does not matter whether it is a static object or +* not. +* +* debug_object_assert_init() and debug_object_activate() allow +* allocation only if the descriptor callback confirms that the +* object is static and considered initialized. For non-static +* objects the allocation needs to be done from the fixup callback. +*/ +if (unlikely (alloc_ifstatic)) { +if (!descr->is_static_object || !descr->is_static_object (addr)) +return ERR_PTR (-ENOENT ); +/* Statically allocated objects are considered initialized */ + state =ODEBUG_STATE_INIT ; + } + + obj =alloc_object (addr, b, descr); +if (likely (obj)) { + obj->state = state; +debug_object_is_on_stack (addr, onstack); +return obj; + } + +/* Out of memory. Do the cleanup outside of the locked region */ + debug_objects_enabled =0 ; +return NULL ; +} +static void __debug_object_init (void *addr,const struct debug_obj_descr *descr,int onstack) {enum debug_obj_state state; -bool check_stack = false;struct debug_bucket *db;struct debug_obj *obj;unsigned long flags;
@@ -570,16 +604,11 @@ __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstackraw_spin_lock_irqsave (&db->lock, flags); - obj =lookup_object (addr, db); -if (!obj) { - obj =alloc_object (addr, db, descr); -if (!obj) { - debug_objects_enabled =0 ; -raw_spin_unlock_irqrestore (&db->lock, flags); -debug_objects_oom (); -return ; - } - check_stack = true; + obj =lookup_object_or_alloc (addr, db, descr, onstack, false); +if (unlikely (!obj)) { +raw_spin_unlock_irqrestore (&db->lock, flags); +debug_objects_oom (); +return ; }switch (obj->state) {
@@ -605,8 +634,6 @@ __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack }raw_spin_unlock_irqrestore (&db->lock, flags); -if (check_stack) -debug_object_is_on_stack (addr, onstack); }/**
@@ -646,14 +673,12 @@ EXPORT_SYMBOL_GPL(debug_object_init_on_stack);*/ int debug_object_activate (void *addr,const struct debug_obj_descr *descr) { +struct debug_obj o = { .object = addr, .state =ODEBUG_STATE_NOTAVAILABLE , .descr = descr };enum debug_obj_state state;struct debug_bucket *db;struct debug_obj *obj;unsigned long flags;int ret; -struct debug_obj o = { .object = addr, - .state =ODEBUG_STATE_NOTAVAILABLE , - .descr = descr };if (!debug_objects_enabled)return 0 ;
@@ -662,8 +687,8 @@ int debug_object_activate(void *addr, const struct debug_obj_descr *descr)raw_spin_lock_irqsave (&db->lock, flags); - obj =lookup_object (addr, db); -if (obj) { + obj =lookup_object_or_alloc (addr, db, descr, false, true); +if (likely (!IS_ERR_OR_NULL (obj))) {bool print_object = false;switch (obj->state) {
@@ -696,24 +721,16 @@ int debug_object_activate(void *addr, const struct debug_obj_descr *descr)raw_spin_unlock_irqrestore (&db->lock, flags); -/* -* We are here when a static object is activated. We -* let the type specific code confirm whether this is -* true or not. if true, we just make sure that the -* static object is tracked in the object tracker. If -* not, this must be a bug, so we try to fix it up. -*/ -if (descr->is_static_object && descr->is_static_object (addr)) { -/* track this static object */ -debug_object_init (addr, descr); -debug_object_activate (addr, descr); - }else { -debug_print_object (&o,"activate" ); - ret =debug_object_fixup (descr->fixup_activate, addr, -ODEBUG_STATE_NOTAVAILABLE ); -return ret ?0 : -EINVAL ; +/* If NULL the allocation has hit OOM */ +if (!obj) { +debug_objects_oom (); +return 0 ; } -return 0 ; + +/* Object is neither static nor tracked. It's not initialized */ +debug_print_object (&o,"activate" ); + ret =debug_object_fixup (descr->fixup_activate, addr,ODEBUG_STATE_NOTAVAILABLE ); +return ret ?0 : -EINVAL ; }EXPORT_SYMBOL_GPL (debug_object_activate);
@@ -867,6 +884,7 @@ EXPORT_SYMBOL_GPL(debug_object_free);*/ void debug_object_assert_init (void *addr,const struct debug_obj_descr *descr) { +struct debug_obj o = { .object = addr, .state =ODEBUG_STATE_NOTAVAILABLE , .descr = descr };struct debug_bucket *db;struct debug_obj *obj;unsigned long flags;
@@ -877,31 +895,20 @@ void debug_object_assert_init(void *addr, const struct debug_obj_descr *descr) db =get_bucket ((unsigned long ) addr);raw_spin_lock_irqsave (&db->lock, flags); + obj =lookup_object_or_alloc (addr, db, descr, false, true); +raw_spin_unlock_irqrestore (&db->lock, flags); +if (likely (!IS_ERR_OR_NULL (obj))) +return ; - obj =lookup_object (addr, db); +/* If NULL the allocation has hit OOM */ if (!obj) { -struct debug_obj o = { .object = addr, - .state =ODEBUG_STATE_NOTAVAILABLE , - .descr = descr }; - -raw_spin_unlock_irqrestore (&db->lock, flags); -/* -* Maybe the object is static, and we let the type specific -* code confirm. Track this static object if true, else invoke -* fixup. -*/ -if (descr->is_static_object && descr->is_static_object (addr)) { -/* Track this static object */ -debug_object_init (addr, descr); - }else { -debug_print_object (&o,"assert_init" ); -debug_object_fixup (descr->fixup_assert_init, addr, -ODEBUG_STATE_NOTAVAILABLE ); - } +debug_objects_oom ();return ; } -raw_spin_unlock_irqrestore (&db->lock, flags); +/* Object is neither tracked nor static. It's not initialized. */ +debug_print_object (&o,"assert_init" ); +debug_object_fixup (descr->fixup_assert_init, addr,ODEBUG_STATE_NOTAVAILABLE ); }EXPORT_SYMBOL_GPL (debug_object_assert_init);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 124/381 drm/i915: Make intel_get_crtc_new_encoder() less oopsy
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
[ Upstream commit 631420b06597a33c72b6dcef78d1c2dea17f452d ]
The point of the WARN was to print something, not oops straight up. Currently that is precisely what happens if we can't find the connector for the crtc in the atomic state. Get the dev pointer from the atomic state instead of the potentially NULL encoder to avoid that.
--- drivers/gpu/drm/i915/display/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -1
@@ -5844,7 +5844,7 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state *state, num_encoders++; } -drm_WARN (encoder->base.dev, num_encoders !=1 , +drm_WARN (state->base.dev, num_encoders !=1 ,"%d encoders for pipe %c\n" , num_encoders,pipe_name (crtc->pipe));
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 125/381 tick/sched: Use tick_next_period for lockless quick check
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 372acbbaa80940189593f9d69c7c069955f24f7a ]
No point in doing calculations.
tick_next_period = last_jiffies_update + tick_period
Just check whether now is before tick_next_period to figure out whether jiffies need an update.
Add a comment why the intentional data race in the quick check is safe or not so safe in a 32bit corner case and why we don't worry about it.
Stable-dep-of: e9523a0d8189 ("tick/common: Align tick period with the HZ tick.")
--- kernel/time/tick-sched.c | 46 ++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 13 deletions(-)
kernel/time/tick-sched.c +33 -13
@@ -57,11 +57,29 @@ static void tick_do_update_jiffies64(ktime_t now)ktime_t delta;/* -* Do a quick check without holding jiffies_lock: -* The READ_ONCE() pairs with two updates done later in this function. +* Do a quick check without holding jiffies_lock. The READ_ONCE() +* pairs with the update done later in this function. +* +* This is also an intentional data race which is even safe on +* 32bit in theory. If there is a concurrent update then the check +* might give a random answer. It does not matter because if it +* returns then the concurrent update is already taking care, if it +* falls through then it will pointlessly contend on jiffies_lock. +* +* Though there is one nasty case on 32bit due to store tearing of +* the 64bit value. If the first 32bit store makes the quick check +* return on all other CPUs and the writing CPU context gets +* delayed to complete the second store (scheduled out on virt) +* then jiffies can become stale for up to ~2^32 nanoseconds +* without noticing. After that point all CPUs will wait for +* jiffies lock. +* +* OTOH, this is not any different than the situation with NOHZ=off +* where one CPU is responsible for updating jiffies and +* timekeeping. If that CPU goes out for lunch then all other CPUs +* will operate on stale jiffies until it decides to come back. */ - delta =ktime_sub (now,READ_ONCE (last_jiffies_update)); -if (delta < tick_period) +if (ktime_before (now,READ_ONCE (tick_next_period)))return ;/* Reevaluate with jiffies_lock held */
@@ -72,9 +90,8 @@ static void tick_do_update_jiffies64(ktime_t now)if (delta >= tick_period) { delta =ktime_sub (delta, tick_period); -/* Pairs with the lockless read in this function. */ -WRITE_ONCE (last_jiffies_update, -ktime_add (last_jiffies_update, tick_period)); + last_jiffies_update =ktime_add (last_jiffies_update, + tick_period);/* Slow path for long timeouts */ if (unlikely (delta >= tick_period)) {
@@ -82,15 +99,18 @@ static void tick_do_update_jiffies64(ktime_t now) ticks =ktime_divns (delta, incr); -/* Pairs with the lockless read in this function. */ -WRITE_ONCE (last_jiffies_update, -ktime_add_ns (last_jiffies_update, - incr * ticks)); + last_jiffies_update =ktime_add_ns (last_jiffies_update, + incr * ticks); }do_timer (++ticks); -/* Keep the tick_next_period variable up to date */ - tick_next_period =ktime_add (last_jiffies_update, tick_period); +/* +* Keep the tick_next_period variable up to date. +* WRITE_ONCE() pairs with the READ_ONCE() in the lockless +* quick check above. +*/ +WRITE_ONCE (tick_next_period, +ktime_add (last_jiffies_update, tick_period)); }else {write_seqcount_end (&jiffies_seq);raw_spin_unlock (&jiffies_lock);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 126/381 tick/sched: Reduce seqcount held scope in tick_do_update_jiffies64()
In reply to Greg Kroah-HartmanFrom: Yunfeng Ye <[email protected]>
[ Upstream commit 94ad2e3cedb82af034f6d97c58022f162b669f9b ]
If jiffies are up to date already (caller lost the race against another CPU) there is no point to change the sequence count. Doing that just forces other CPUs into the seqcount retry loop in tick_nohz_next_event() for nothing.
Just bail out early.
[ tglx: Rewrote most of it ]
Stable-dep-of: e9523a0d8189 ("tick/common: Align tick period with the HZ tick.")
--- kernel/time/tick-sched.c | 47 +++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 25 deletions(-)
kernel/time/tick-sched.c +22 -25
@@ -84,38 +84,35 @@ static void tick_do_update_jiffies64(ktime_t now)/* Reevaluate with jiffies_lock held */ raw_spin_lock (&jiffies_lock); +if (ktime_before (now, tick_next_period)) { +raw_spin_unlock (&jiffies_lock); +return ; + } +write_seqcount_begin (&jiffies_seq); - delta =ktime_sub (now, last_jiffies_update); -if (delta >= tick_period) { + last_jiffies_update =ktime_add (last_jiffies_update, tick_period); - delta =ktime_sub (delta, tick_period); - last_jiffies_update =ktime_add (last_jiffies_update, - tick_period); + delta =ktime_sub (now, tick_next_period); +if (unlikely (delta >= tick_period)) { +/* Slow path for long idle sleep times */ +s64 incr =ktime_to_ns (tick_period); -/* Slow path for long timeouts */ -if (unlikely (delta >= tick_period)) { -s64 incr =ktime_to_ns (tick_period); + ticks =ktime_divns (delta, incr); - ticks =ktime_divns (delta, incr); + last_jiffies_update =ktime_add_ns (last_jiffies_update, + incr * ticks); + } - last_jiffies_update =ktime_add_ns (last_jiffies_update, - incr * ticks); - } -do_timer (++ticks); +do_timer (++ticks); + +/* +* Keep the tick_next_period variable up to date. WRITE_ONCE() +* pairs with the READ_ONCE() in the lockless quick check above. +*/ +WRITE_ONCE (tick_next_period, +ktime_add (last_jiffies_update, tick_period)); -/* -* Keep the tick_next_period variable up to date. -* WRITE_ONCE() pairs with the READ_ONCE() in the lockless -* quick check above. -*/ -WRITE_ONCE (tick_next_period, -ktime_add (last_jiffies_update, tick_period)); - }else { -write_seqcount_end (&jiffies_seq); -raw_spin_unlock (&jiffies_lock); -return ; - }write_seqcount_end (&jiffies_seq);raw_spin_unlock (&jiffies_lock);update_wall_time ();
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 127/381 tick/sched: Optimize tick_do_update_jiffies64() further
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 7a35bf2a6a871cd0252cd371d741e7d070b53af9 ]
Now that it's clear that there is always one tick to account, simplify the calculations some more.
Stable-dep-of: e9523a0d8189 ("tick/common: Align tick period with the HZ tick.")
--- kernel/time/tick-sched.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
kernel/time/tick-sched.c +6 -5
@@ -53,7 +53,7 @@ static ktime_t last_jiffies_update;*/ static void tick_do_update_jiffies64 (ktime_t now) { -unsigned long ticks =0 ; +unsigned long ticks =1 ;ktime_t delta;/*
@@ -91,20 +91,21 @@ static void tick_do_update_jiffies64(ktime_t now)write_seqcount_begin (&jiffies_seq); - last_jiffies_update =ktime_add (last_jiffies_update, tick_period); - delta =ktime_sub (now, tick_next_period);if (unlikely (delta >= tick_period)) {/* Slow path for long idle sleep times */ s64 incr =ktime_to_ns (tick_period); - ticks =ktime_divns (delta, incr); + ticks +=ktime_divns (delta, incr); last_jiffies_update =ktime_add_ns (last_jiffies_update, incr * ticks); + }else { + last_jiffies_update =ktime_add (last_jiffies_update, + tick_period); } -do_timer (++ticks); +do_timer (ticks);/* * Keep the tick_next_period variable up to date. WRITE_ONCE()
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 128/381 tick: Get rid of tick_period
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit b996544916429946bf4934c1c01a306d1690972c ]
The variable tick_period is initialized to NSEC_PER_TICK / HZ during boot and never updated again.
If NSEC_PER_TICK is not an integer multiple of HZ this computation is less accurate than TICK_NSEC which has proper rounding in place.
Aside of the inaccuracy there is no reason for having this variable at all. It's just a pointless indirection and all usage sites can just use the TICK_NSEC constant.
Stable-dep-of: e9523a0d8189 ("tick/common: Align tick period with the HZ tick.")
--- kernel/time/tick-broadcast.c | 2 +- kernel/time/tick-common.c | 8 +++----- kernel/time/tick-internal.h | 1 - kernel/time/tick-sched.c | 22 +++++++++++----------- 4 files changed, 15 insertions(+), 18 deletions(-)
kernel/time/tick-broadcast.c +1 -1
@@ -331,7 +331,7 @@ static void tick_handle_periodic_broadcast(struct clock_event_device *dev) bc_local =tick_do_periodic_broadcast ();if (clockevent_state_oneshot (dev)) { -ktime_t next =ktime_add (dev->next_event, tick_period); +ktime_t next =ktime_add_ns (dev->next_event,TICK_NSEC );clockevents_program_event (dev, next, true); }
kernel/time/tick-common.c +3 -5
@@ -30,7 +30,6 @@ DEFINE_PER_CPU(struct tick_device, tick_cpu_device);* Tick next event: keeps track of the tick time */ ktime_t tick_next_period; -ktime_t tick_period;/* * tick_do_timer_cpu is a timer core internal variable which holds the CPU NR
@@ -88,7 +87,7 @@ static void tick_periodic(int cpu)write_seqcount_begin (&jiffies_seq);/* Keep track of the next tick event */ - tick_next_period =ktime_add (tick_next_period, tick_period); + tick_next_period =ktime_add_ns (tick_next_period,TICK_NSEC );do_timer (1 );write_seqcount_end (&jiffies_seq);
@@ -127,7 +126,7 @@ void tick_handle_periodic(struct clock_event_device *dev)* Setup the next period for devices, which do not have * periodic mode: */ - next =ktime_add (next, tick_period); + next =ktime_add_ns (next,TICK_NSEC );if (!clockevents_program_event (dev, next, false))return ;
@@ -173,7 +172,7 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast)for (;;) {if (!clockevents_program_event (dev, next, false))return ; - next =ktime_add (next, tick_period); + next =ktime_add_ns (next,TICK_NSEC ); } } }
@@ -220,7 +219,6 @@ static void tick_setup_device(struct tick_device *td, tick_do_timer_cpu = cpu; tick_next_period =ktime_get (); - tick_period =NSEC_PER_SEC /HZ ;#ifdef CONFIG_NO_HZ_FULL /* * The boot CPU may be nohz_full, in which case set
kernel/time/tick-internal.h +0 -1
@@ -15,7 +15,6 @@ DECLARE_PER_CPU(struct tick_device, tick_cpu_device);extern ktime_t tick_next_period; -extern ktime_t tick_period;extern int tick_do_timer_cpu__read_mostly ;extern void tick_setup_periodic (struct clock_event_device *dev,int broadcast);
kernel/time/tick-sched.c +11 -11
@@ -92,17 +92,17 @@ static void tick_do_update_jiffies64(ktime_t now)write_seqcount_begin (&jiffies_seq); delta =ktime_sub (now, tick_next_period); -if (unlikely (delta >= tick_period)) { +if (unlikely (delta >=TICK_NSEC )) {/* Slow path for long idle sleep times */ -s64 incr =ktime_to_ns (tick_period); +s64 incr =TICK_NSEC ; ticks +=ktime_divns (delta, incr); last_jiffies_update =ktime_add_ns (last_jiffies_update, incr * ticks); }else { - last_jiffies_update =ktime_add (last_jiffies_update, - tick_period); + last_jiffies_update =ktime_add_ns (last_jiffies_update, +TICK_NSEC ); }do_timer (ticks);
@@ -112,7 +112,7 @@ static void tick_do_update_jiffies64(ktime_t now)* pairs with the READ_ONCE() in the lockless quick check above. */ WRITE_ONCE (tick_next_period, -ktime_add (last_jiffies_update, tick_period)); +ktime_add_ns (last_jiffies_update,TICK_NSEC ));write_seqcount_end (&jiffies_seq);raw_spin_unlock (&jiffies_lock);
@@ -688,7 +688,7 @@ static void tick_nohz_restart(struct tick_sched *ts, ktime_t now)hrtimer_set_expires (&ts->sched_timer, ts->last_tick);/* Forward the time to expire in the future */ -hrtimer_forward (&ts->sched_timer, now, tick_period); +hrtimer_forward (&ts->sched_timer, now,TICK_NSEC );if (ts->nohz_mode ==NOHZ_MODE_HIGHRES ) { hrtimer_start_expires(&ts->sched_timer,
@@ -1250,7 +1250,7 @@ static void tick_nohz_handler(struct clock_event_device *dev)if (unlikely (ts->tick_stopped))return ; -hrtimer_forward (&ts->sched_timer, now, tick_period); +hrtimer_forward (&ts->sched_timer, now,TICK_NSEC );tick_program_event (hrtimer_get_expires (&ts->sched_timer),1 ); }
@@ -1287,7 +1287,7 @@ static void tick_nohz_switch_to_nohz(void) next =tick_init_jiffy_update ();hrtimer_set_expires (&ts->sched_timer, next); -hrtimer_forward_now (&ts->sched_timer, tick_period); +hrtimer_forward_now (&ts->sched_timer,TICK_NSEC );tick_program_event (hrtimer_get_expires (&ts->sched_timer),1 );tick_nohz_activate (ts,NOHZ_MODE_LOWRES ); }
@@ -1353,7 +1353,7 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)if (unlikely (ts->tick_stopped))return HRTIMER_NORESTART ; -hrtimer_forward (timer, now, tick_period); +hrtimer_forward (timer, now,TICK_NSEC );return HRTIMER_RESTART ; }
@@ -1387,13 +1387,13 @@ void tick_setup_sched_timer(void)/* Offset the tick to avert jiffies_lock contention. */ if (sched_skew_tick) { -u64 offset =ktime_to_ns (tick_period) >>1 ; +u64 offset =TICK_NSEC >>1 ;do_div (offset,num_possible_cpus ()); offset *=smp_processor_id ();hrtimer_add_expires_ns (&ts->sched_timer, offset); } -hrtimer_forward (&ts->sched_timer, now, tick_period); +hrtimer_forward (&ts->sched_timer, now,TICK_NSEC );hrtimer_start_expires (&ts->sched_timer,HRTIMER_MODE_ABS_PINNED_HARD );tick_nohz_activate (ts,NOHZ_MODE_HIGHRES ); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 129/381 tick/common: Align tick period with the HZ tick.
In reply to Greg Kroah-HartmanFrom: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit e9523a0d81899361214d118ad60ef76f0e92f71d ]
With HIGHRES enabled tick_sched_timer() is programmed every jiffy to expire the timer_list timers. This timer is programmed accurate in respect to CLOCK_MONOTONIC so that 0 seconds and nanoseconds is the first tick and the next one is 1000/CONFIG_HZ ms later. For HZ=250 it is every 4 ms and so based on the current time the next tick can be computed.
This accuracy broke since the commit mentioned below because the jiffy based clocksource is initialized with higher accuracy in read_persistent_wall_and_boot_offset(). This higher accuracy is inherited during the setup in tick_setup_device(). The timer still fires every 4ms with HZ=250 but timer is no longer aligned with CLOCK_MONOTONIC with 0 as it origin but has an offset in the us/ns part of the timestamp. The offset differs with every boot and makes it impossible for user land to align with the tick.
Align the tick period with CLOCK_MONOTONIC ensuring that it is always a multiple of 1000/CONFIG_HZ ms.
--- kernel/time/tick-common.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
kernel/time/tick-common.c +11 -1
@@ -216,9 +216,19 @@ static void tick_setup_device(struct tick_device *td,* this cpu: */ if (tick_do_timer_cpu ==TICK_DO_TIMER_BOOT ) { +ktime_t next_p; +u32 rem; + tick_do_timer_cpu = cpu; - tick_next_period =ktime_get (); + next_p =ktime_get (); +div_u64_rem (next_p,TICK_NSEC , &rem); +if (rem) { + next_p -= rem; + next_p +=TICK_NSEC ; + } + + tick_next_period = next_p;#ifdef CONFIG_NO_HZ_FULL /* * The boot CPU may be nohz_full, in which case set
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 130/381 wifi: ath6kl: minor fix for allocation size
In reply to Greg Kroah-HartmanFrom: Alexey V. Vissarionov <[email protected]>
[ Upstream commit 778f83f889e7fca37780d9640fcbd0229ae38eaa ]
Although the "param" pointer occupies more or equal space compared to "*param", the allocation size should use the size of variable itself.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/wireless/ath/ath6kl/bmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/bmi.c +1 -1
@@ -246,7 +246,7 @@ int ath6kl_bmi_execute(struct ath6kl *ar, u32 addr, u32 *param)return -EACCES ; } - size =sizeof (cid) +sizeof (addr) +sizeof (param); + size =sizeof (cid) +sizeof (addr) +sizeof (*param);if (size > ar->bmi.max_cmd_size) {WARN_ON (1 );return -EINVAL ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 131/381 wifi: ath9k: hif_usb: fix memory leak of remain_skbs
In reply to Greg Kroah-HartmanFrom: Fedor Pchelkin <[email protected]>
[ Upstream commit 7654cc03eb699297130b693ec34e25f77b17c947 ]
hif_dev->remain_skb is allocated and used exclusively in ath9k_hif_usb_rx_stream(). It is implied that an allocated remain_skb is processed and subsequently freed (in error paths) only during the next call of ath9k_hif_usb_rx_stream().
So, if the urbs are deallocated between those two calls due to the device deinitialization or suspend, it is possible that ath9k_hif_usb_rx_stream() is not called next time and the allocated remain_skb is leaked. Our local Syzkaller instance was able to trigger that.
remain_skb makes sense when receiving two consecutive urbs which are logically linked together, i.e. a specific data field from the first skb indicates a cached skb to be allocated, memcpy'd with some data and subsequently processed in the next call to ath9k_hif_usb_rx_stream(). Urbs deallocation supposedly makes that link irrelevant so we need to free the cached skb in those cases.
Fix the leak by introducing a function to explicitly free remain_skb (if it is not NULL) when the rx urbs have been deallocated. remain_skb is NULL when it has not been allocated at all (hif_dev struct is kzalloced) or when it has been processed in next call to ath9k_hif_usb_rx_stream().
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/wireless/ath/ath9k/hif_usb.c +19 -0
@@ -534,6 +534,24 @@ static struct ath9k_htc_hif hif_usb = { .send = hif_usb_send, }; +/* Need to free remain_skb allocated in ath9k_hif_usb_rx_stream +* in case ath9k_hif_usb_rx_stream wasn't called next time to +* process the buffer and subsequently free it. +*/ +static void ath9k_hif_usb_free_rx_remain_skb (struct hif_device_usb *hif_dev) +{ +unsigned long flags; + +spin_lock_irqsave (&hif_dev->rx_lock, flags); +if (hif_dev->remain_skb) { +dev_kfree_skb_any (hif_dev->remain_skb); + hif_dev->remain_skb =NULL ; + hif_dev->rx_remain_len =0 ; +RX_STAT_INC (hif_dev, skb_dropped); + } +spin_unlock_irqrestore (&hif_dev->rx_lock, flags); +} +static void ath9k_hif_usb_rx_stream (struct hif_device_usb *hif_dev,struct sk_buff *skb) {
@@ -868,6 +886,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev)static void ath9k_hif_usb_dealloc_rx_urbs (struct hif_device_usb *hif_dev) {usb_kill_anchored_urbs (&hif_dev->rx_submitted); +ath9k_hif_usb_free_rx_remain_skb (hif_dev); }static int ath9k_hif_usb_alloc_rx_urbs (struct hif_device_usb *hif_dev)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 132/381 wifi: ath5k: fix an off by one check in ath5k_eeprom_read_freq_list()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 4c856ee12df85aabd437c3836ed9f68d94268358 ]
This loop checks that i < max at the start of loop but then it does i++ which could put it past the end of the array. It's harmless to check again and prevent a potential out of bounds.
--- drivers/net/wireless/ath/ath5k/eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath5k/eeprom.c +1 -1
@@ -529,7 +529,7 @@ ath5k_eeprom_read_freq_list(struct ath5k_hw *ah, int *offset, int max, ee->ee_n_piers[mode]++; freq2 = (val >>8 ) &0xff ; -if (!freq2) +if (!freq2 || i >= max)break ; pc[i++].freq = ath5k_eeprom_bin2freq(ee,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 133/381 wifi: ath6kl: reduce WARN to dev_dbg() in callback
In reply to Greg Kroah-HartmanFrom: Fedor Pchelkin <[email protected]>
[ Upstream commit 75c4a8154cb6c7239fb55d5550f481f6765fb83c ]
The warn is triggered on a known race condition, documented in the code above the test, that is correctly handled. Using WARN() hinders automated testing. Reducing severity.
--- drivers/net/wireless/ath/ath6kl/htc_pipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath6kl/htc_pipe.c +2 -2
@@ -960,8 +960,8 @@ static int ath6kl_htc_pipe_rx_complete(struct ath6kl *ar, struct sk_buff *skb,* Thus the possibility of ar->htc_target being NULL * via ath6kl_recv_complete -> ath6kl_usb_io_comp_work. */ -if (WARN_ON_ONCE (!target)) { -ath6kl_err ("Target not yet initialized\n" ); +if (!target) { +ath6kl_dbg (ATH6KL_DBG_HTC ,"Target not yet initialized\n" ); status = -EINVAL ; goto free_skb; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 134/381 tools: bpftool: Remove invalid \ json escape
In reply to Greg Kroah-HartmanFrom: Luis Gerhorst <[email protected]>
[ Upstream commit c679bbd611c08b0559ffae079330bc4e5574696a ]
RFC8259 ("The JavaScript Object Notation (JSON) Data Interchange Format") only specifies \", \\, \/, \b, \f, \n, \r, and \r as valid two-character escape sequences. This does not include \', which is not required in JSON because it exclusively uses double quotes as string separators.
Solidus (/) may be escaped, but does not have to. Only reverse solidus (\), double quotes ("), and the control characters have to be escaped. Therefore, with this fix, bpftool correctly supports all valid two-character escape sequences (but still does not support characters that require multi-character escape sequences).
Witout this fix, attempting to load a JSON file generated by bpftool using Python 3.10.6's default json.load() may fail with the error "Invalid \escape" if the file contains the invalid escaped single quote (\').
--- tools/bpf/bpftool/json_writer.c | 3 --- 1 file changed, 3 deletions(-)
tools/bpf/bpftool/json_writer.c +0 -3
@@ -80,9 +80,6 @@ static void jsonw_puts(json_writer_t *self, const char *str)case '"' :fputs ("\\\"" , self->out);break ; -case '\'' : -fputs ("\\\'" , self->out); -break ;default :putc (*str, self->out); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 135/381 wifi: rtw88: mac: Return the original error from rtw_pwr_seq_parser()
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit b7ed9fa2cb76ca7a3c3cd4a6d35748fe1fbda9f6 ]
rtw_pwr_seq_parser() calls rtw_sub_pwr_seq_parser() which can either return -EBUSY, -EINVAL or 0. Propagate the original error code instead of unconditionally returning -EBUSY in case of an error.
--- drivers/net/wireless/realtek/rtw88/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/mac.c +1 -1
@@ -233,7 +233,7 @@ static int rtw_pwr_seq_parser(struct rtw_dev *rtwdev, ret =rtw_sub_pwr_seq_parser (rtwdev, intf_mask, cut_mask, cmd);if (ret) -return -EBUSY ; +return ret; idx++; }while (1 );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 136/381 wifi: rtw88: mac: Return the original error from rtw_mac_power_switch()
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 15c8e267dfa62f207ee1db666c822324e3362b84 ]
rtw_mac_power_switch() calls rtw_pwr_seq_parser() which can return -EINVAL, -EBUSY or 0. Propagate the original error code instead of unconditionally returning -EINVAL in case of an error.
--- drivers/net/wireless/realtek/rtw88/mac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/mac.c +4 -2
@@ -247,6 +247,7 @@ static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on)const struct rtw_pwr_seq_cmd **pwr_seq;u8 rpwm;bool cur_pwr; +int ret;if (rtw_chip_wcpu_11ac (rtwdev)) { rpwm =rtw_read8 (rtwdev, rtwdev->hci.rpwm_addr);
@@ -270,8 +271,9 @@ static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on)return -EALREADY ; pwr_seq = pwr_on ? chip->pwr_on_seq : chip->pwr_off_seq; -if (rtw_pwr_seq_parser (rtwdev, pwr_seq)) -return -EINVAL ; + ret =rtw_pwr_seq_parser (rtwdev, pwr_seq); +if (ret) +return ret;return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 137/381 bpf: take into account liveness when propagating precision
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 52c2b005a3c18c565fc70cfd0ca49375f301e952 ]
When doing state comparison, if old state has register that is not marked as REG_LIVE_READ, then we just skip comparison, regardless what's the state of corresponing register in current state. This is because not REG_LIVE_READ register is irrelevant for further program execution and correctness. All good here.
But when we get to precision propagation, after two states were declared equivalent, we don't take into account old register's liveness, and thus attempt to propagate precision for register in current state even if that register in old state was not REG_LIVE_READ anymore. This is bad, because register in current state could be anything at all and this could cause -EFAULT due to internal logic bugs.
Fix by taking into account REG_LIVE_READ liveness mark to keep the logic in state comparison in sync with precision propagation.
--- kernel/bpf/verifier.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/bpf/verifier.c +4 -2
@@ -9550,7 +9550,8 @@ static int propagate_precision(struct bpf_verifier_env *env, state_reg = state->regs;for (i =0 ; i <BPF_REG_FP ; i++, state_reg++) {if (state_reg->type !=SCALAR_VALUE || - !state_reg->precise) + !state_reg->precise || + !(state_reg->live ®_LIVE_READ ))continue ;if (env->log.level &BPF_LOG_LEVEL2 )verbose (env,"frame %d: propagating r%d\n" , i, fr);
@@ -9564,7 +9565,8 @@ static int propagate_precision(struct bpf_verifier_env *env,continue ; state_reg = &state->stack[i].spilled_ptr;if (state_reg->type !=SCALAR_VALUE || - !state_reg->precise) + !state_reg->precise || + !(state_reg->live ®_LIVE_READ ))continue ;if (env->log.level &BPF_LOG_LEVEL2 ) verbose(env, "frame %d: propagating fp%d\n",
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 138/381 bpf: fix precision propagation verbose logging
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 34f0677e7afd3a292bc1aadda7ce8e35faedb204 ]
Fix wrong order of frame index vs register/slot index in precision propagation verbose (level 2) output. It's wrong and very confusing as is.
--- kernel/bpf/verifier.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/verifier.c +2 -2
@@ -9554,7 +9554,7 @@ static int propagate_precision(struct bpf_verifier_env *env, !(state_reg->live & REG_LIVE_READ))continue ;if (env->log.level &BPF_LOG_LEVEL2 ) -verbose (env,"frame %d: propagating r%d\n" , i, fr); +verbose (env,"frame %d: propagating r%d\n" , fr, i); err =mark_chain_precision_frame (env, fr, i);if (err <0 )return err;
@@ -9570,7 +9570,7 @@ static int propagate_precision(struct bpf_verifier_env *env,continue ;if (env->log.level &BPF_LOG_LEVEL2 )verbose (env,"frame %d: propagating fp%d\n" , - (-i -1 ) *BPF_REG_SIZE , fr); + fr, (-i -1 ) *BPF_REG_SIZE ); err =mark_chain_precision_stack_frame (env, fr, i);if (err <0 )return err;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 139/381 scm: fix MSG_CTRUNC setting condition for SO_PASSSEC
In reply to Greg Kroah-HartmanFrom: Alexander Mikhalitsyn <[email protected]>
[ Upstream commit a02d83f9947d8f71904eda4de046630c3eb6802c ]
Currently, kernel would set MSG_CTRUNC flag if msg_control buffer wasn't provided and SO_PASSCRED was set or if there was pending SCM_RIGHTS.
For some reason we have no corresponding check for SO_PASSSEC.
In the recvmsg(2) doc we have:
MSG_CTRUNC
indicates that some control data was discarded due to lack of space in the buffer for ancillary data.
So, we need to set MSG_CTRUNC flag for all types of SCM.
This change can break applications those don't check MSG_CTRUNC flag.
v2:
- commit message was rewritten according to Eric's suggestion
--- include/net/scm.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
include/net/scm.h +12 -1
@@ -105,16 +105,27 @@ static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct sc } } } + +static inline bool scm_has_secdata (struct socket *sock) +{ +return test_bit (SOCK_PASSSEC , &sock->flags); +}#else static inline void scm_passec (struct socket *sock,struct msghdr *msg,struct scm_cookie *scm) { } + +static inline bool scm_has_secdata (struct socket *sock) +{ +return false; +}#endif /* CONFIG_SECURITY_NETWORK */ static __inline__void scm_recv (struct socket *sock,struct msghdr *msg,struct scm_cookie *scm,int flags) {if (!msg->msg_control) { -if (test_bit (SOCK_PASSCRED , &sock->flags) || scm->fp) +if (test_bit (SOCK_PASSCRED , &sock->flags) || scm->fp || +scm_has_secdata (sock)) msg->msg_flags |=MSG_CTRUNC ;scm_destroy (scm);return ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 140/381 bpf: Remove misleading spec_v1 check on var-offset stack read
In reply to Greg Kroah-HartmanFrom: Luis Gerhorst <[email protected]>
[ Upstream commit 082cdc69a4651dd2a77539d69416a359ed1214f5 ]
For every BPF_ADD/SUB involving a pointer, adjust_ptr_min_max_vals() ensures that the resulting pointer has a constant offset if bypass_spec_v1 is false. This is ensured by calling sanitize_check_bounds() which in turn calls check_stack_access_for_ptr_arithmetic(). There, -EACCESS is returned if the register's offset is not constant, thereby rejecting the program.
In summary, an unprivileged user must never be able to create stack pointers with a variable offset. That is also the case, because a respective check in check_stack_write() is missing. If they were able to create a variable-offset pointer, users could still use it in a stack-write operation to trigger unsafe speculative behavior [1].
Because unprivileged users must already be prevented from creating variable-offset stack pointers, viable options are to either remove this check (replacing it with a clarifying comment), or to turn it into a "verifier BUG"-message, also adding a similar check in check_stack_write() (for consistency, as a second-level defense). This patch implements the first option to reduce verifier bloat.
This check was introduced by commit 01f810ace9ed ("bpf: Allow variable-offset stack access") which correctly notes that "variable-offset reads and writes are disallowed (they were already disallowed for the indirect access case) because the speculative execution checking code doesn't support them". However, it does not further discuss why the check in check_stack_read() is necessary. The code which made this check obsolete was also introduced in this commit.
I have compiled ~650 programs from the Linux selftests, Linux samples, Cilium, and libbpf/examples projects and confirmed that none of these trigger the check in check_stack_read() [2]. Instead, all of these programs are, as expected, already rejected when constructing the variable-offset pointers. Note that the check in check_stack_access_for_ptr_arithmetic() also prints "off=%d" while the code removed by this patch does not (the error removed does not appear in the "verification_error" values). For reproducibility, the repository linked includes the raw data and scripts used to create the plot.
[1] https://arxiv.org/pdf/1807.03757.pdf
[2] https://gitlab.cs.fau.de/un65esoq/bpf-spectre/-/raw/53dc19fcf459c186613b1156a81504b39c8d49db/data/plots/23-02-26_23-56_bpftool/bpftool/0004-errors.pdf?inline=false
--- kernel/bpf/verifier.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
kernel/bpf/verifier.c +6 -10
@@ -2775,17 +2775,13 @@ static int check_stack_read(struct bpf_verifier_env *env, }/* Variable offset is prohibited for unprivileged mode for simplicity * since it requires corresponding support in Spectre masking for stack -* ALU. See also retrieve_ptr_limit(). +* ALU. See also retrieve_ptr_limit(). The check in +* check_stack_access_for_ptr_arithmetic() called by +* adjust_ptr_min_max_vals() prevents users from creating stack pointers +* with variable offsets, therefore no check is required here. Further, +* just checking it here would be insufficient as speculative stack +* writes could still lead to unsafe speculative behaviour. */ -if (!env->bypass_spec_v1 && var_off) { -char tn_buf[48 ]; - -tnum_strn (tn_buf,sizeof (tn_buf), reg->var_off); -verbose (env,"R%d variable offset stack access prohibited for !root, var_off=%s\n" , - ptr_regno, tn_buf); -return -EACCES ; - } -if (!var_off) { off += reg->var_off.value; err = check_stack_read_fixed_off(env, state, off, size,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 141/381 vlan: partially enable SIOCSHWTSTAMP in container
In reply to Greg Kroah-HartmanFrom: Vadim Fedorenko <[email protected]>
[ Upstream commit 731b73dba359e3ff00517c13aa0daa82b34ff466 ]
Setting timestamp filter was explicitly disabled on vlan devices in containers because it might affect other processes on the host. But it's absolutely legit in case when real device is in the same namespace.
--- net/8021q/vlan_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/8021q/vlan_dev.c +1 -1
@@ -365,7 +365,7 @@ static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)switch (cmd) {case SIOCSHWTSTAMP : -if (!net_eq (dev_net (dev), &init_net)) +if (!net_eq (dev_net (dev),dev_net (real_dev)))break ; fallthrough;case SIOCGMIIPHY :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 142/381 net/packet: annotate accesses to po->xmit
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit b9d83ab8a708f23a4001d60e9d8d0b3be3d9f607 ]
po->xmit can be set from setsockopt(PACKET_QDISC_BYPASS), while read locklessly.
Use READ_ONCE()/WRITE_ONCE() to avoid potential load/store tearing issues.
--- net/packet/af_packet.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/packet/af_packet.c +8 -4
@@ -269,7 +269,8 @@ static void packet_cached_dev_reset(struct packet_sock *po)static bool packet_use_direct_xmit (const struct packet_sock *po) { -return po->xmit == packet_direct_xmit; +/* Paired with WRITE_ONCE() in packet_setsockopt() */ +return READ_ONCE (po->xmit) == packet_direct_xmit; }static u16 packet_pick_tx_queue (struct sk_buff *skb)
@@ -2825,7 +2826,8 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)packet_inc_pending (&po->tx_ring); status =TP_STATUS_SEND_REQUEST ; - err = po->xmit (skb); +/* Paired with WRITE_ONCE() in packet_setsockopt() */ + err =READ_ONCE (po->xmit)(skb);if (unlikely (err !=0 )) {if (err >0 ) err =net_xmit_errno (err);
@@ -3028,7 +3030,8 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)virtio_net_hdr_set_proto (skb, &vnet_hdr); } - err = po->xmit (skb); +/* Paired with WRITE_ONCE() in packet_setsockopt() */ + err =READ_ONCE (po->xmit)(skb);if (unlikely (err !=0 )) {if (err >0 ) err =net_xmit_errno (err);
@@ -3979,7 +3982,8 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval,if (copy_from_sockptr (&val, optval,sizeof (val)))return -EFAULT ; - po->xmit = val ? packet_direct_xmit : dev_queue_xmit; +/* Paired with all lockless reads of po->xmit */ +WRITE_ONCE (po->xmit, val ? packet_direct_xmit : dev_queue_xmit);return 0 ; }default :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 143/381 net/packet: convert po->origdev to an atomic flag
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit ee5675ecdf7a4e713ed21d98a70c2871d6ebed01 ]
syzbot/KCAN reported that po->origdev can be read
while another thread is changing its value.
We can avoid this splat by converting this field
to an actual bit.
Following patches will convert remaining 1bit fields.
--- net/packet/af_packet.c | 10 ++++------ net/packet/diag.c | 2 +- net/packet/internal.h | 22 +++++++++++++++++++++- 3 files changed, 26 insertions(+), 8 deletions(-)
net/packet/af_packet.c +4 -6
@@ -2146,7 +2146,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, sll = &PACKET_SKB_CB (skb)->sa.ll; sll->sll_hatype = dev->type; sll->sll_pkttype = skb->pkt_type; -if (unlikely (po->origdev)) +if (unlikely (packet_sock_flag (po,PACKET_SOCK_ORIGDEV ))) sll->sll_ifindex = orig_dev->ifindex;else sll->sll_ifindex = dev->ifindex;
@@ -2419,7 +2419,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, sll->sll_hatype = dev->type; sll->sll_protocol = skb->protocol; sll->sll_pkttype = skb->pkt_type; -if (unlikely (po->origdev)) +if (unlikely (packet_sock_flag (po,PACKET_SOCK_ORIGDEV ))) sll->sll_ifindex = orig_dev->ifindex;else sll->sll_ifindex = dev->ifindex;
@@ -3883,9 +3883,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval,if (copy_from_sockptr (&val, optval,sizeof (val)))return -EFAULT ; -lock_sock (sk); - po->origdev = !!val; -release_sock (sk); +packet_sock_flag_set (po,PACKET_SOCK_ORIGDEV , val);return 0 ; }case PACKET_VNET_HDR :
@@ -4037,7 +4035,7 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, val = po->auxdata;break ;case PACKET_ORIGDEV : - val = po->origdev; + val =packet_sock_flag (po,PACKET_SOCK_ORIGDEV );break ;case PACKET_VNET_HDR : val = po->has_vnet_hdr;
net/packet/diag.c +1 -1
@@ -25,7 +25,7 @@ static int pdiag_put_info(const struct packet_sock *po, struct sk_buff *nlskb) pinfo.pdi_flags |=PDI_RUNNING ;if (po->auxdata) pinfo.pdi_flags |=PDI_AUXDATA ; -if (po->origdev) +if (packet_sock_flag (po,PACKET_SOCK_ORIGDEV )) pinfo.pdi_flags |=PDI_ORIGDEV ;if (po->has_vnet_hdr) pinfo.pdi_flags |=PDI_VNETHDR ;
net/packet/internal.h +21 -1
@@ -116,9 +116,9 @@ struct packet_sock {int copy_thresh;spinlock_t bind_lock;struct mutex pg_vec_lock; +unsigned long flags;unsigned int running;/* bind_lock must be held */ unsigned int auxdata:1, /* writer must hold sock lock */ - origdev:1, has_vnet_hdr:1, tp_loss:1, tp_tx_has_off:1;
@@ -144,4 +144,24 @@ static struct packet_sock *pkt_sk(struct sock *sk) return (struct packet_sock *)sk; } +enum packet_sock_flags { +PACKET_SOCK_ORIGDEV , +}; + +static inline void packet_sock_flag_set (struct packet_sock *po, +enum packet_sock_flags flag, +bool val) +{ +if (val) +set_bit (flag, &po->flags); +else +clear_bit (flag, &po->flags); +} + +static inline bool packet_sock_flag (const struct packet_sock *po, +enum packet_sock_flags flag) +{ +return test_bit (flag, &po->flags); +} +#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 144/381 net/packet: convert po->auxdata to an atomic flag
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit fd53c297aa7b077ae98a3d3d2d3aa278a1686ba6 ]
po->auxdata can be read while another thread is changing its value, potentially raising KCSAN splat.
Convert it to PACKET_SOCK_AUXDATA flag.
--- net/packet/af_packet.c | 8 +++----- net/packet/diag.c | 2 +- net/packet/internal.h | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-)
net/packet/af_packet.c +3 -5
@@ -3485,7 +3485,7 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,memcpy (msg->msg_name, &PACKET_SKB_CB (skb)->sa, copy_len); } -if (pkt_sk (sk)->auxdata) { +if (packet_sock_flag (pkt_sk (sk),PACKET_SOCK_AUXDATA )) {struct tpacket_auxdata aux; aux.tp_status =TP_STATUS_USER ;
@@ -3869,9 +3869,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval,if (copy_from_sockptr (&val, optval,sizeof (val)))return -EFAULT ; -lock_sock (sk); - po->auxdata = !!val; -release_sock (sk); +packet_sock_flag_set (po,PACKET_SOCK_AUXDATA , val);return 0 ; }case PACKET_ORIGDEV :
@@ -4032,7 +4030,7 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,break ;case PACKET_AUXDATA : - val = po->auxdata; + val =packet_sock_flag (po,PACKET_SOCK_AUXDATA );break ;case PACKET_ORIGDEV : val =packet_sock_flag (po,PACKET_SOCK_ORIGDEV );
net/packet/diag.c +1 -1
@@ -23,7 +23,7 @@ static int pdiag_put_info(const struct packet_sock *po, struct sk_buff *nlskb) pinfo.pdi_flags =0 ;if (po->running) pinfo.pdi_flags |=PDI_RUNNING ; -if (po->auxdata) +if (packet_sock_flag (po,PACKET_SOCK_AUXDATA )) pinfo.pdi_flags |=PDI_AUXDATA ;if (packet_sock_flag (po,PACKET_SOCK_ORIGDEV )) pinfo.pdi_flags |=PDI_ORIGDEV ;
net/packet/internal.h +2 -2
@@ -118,8 +118,7 @@ struct packet_sock {struct mutex pg_vec_lock;unsigned long flags;unsigned int running;/* bind_lock must be held */ - unsigned int auxdata:1, /* writer must hold sock lock */ - has_vnet_hdr:1, + unsigned int has_vnet_hdr:1, /* writer must hold sock lock */ tp_loss:1, tp_tx_has_off:1;int pressure;
@@ -146,6 +145,7 @@ static struct packet_sock *pkt_sk(struct sock *sk)enum packet_sock_flags {PACKET_SOCK_ORIGDEV , +PACKET_SOCK_AUXDATA , }; static inline void packet_sock_flag_set(struct packet_sock *po,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 145/381 scsi: target: Rename struct sense_info to sense_detail
In reply to Greg Kroah-HartmanFrom: David Disseldorp <[email protected]>
[ Upstream commit b455233dcc403e3eb955a642dd69b6676e12b245 ]
This helps distinguish it from the SCSI sense INFORMATION field.
Stable-dep-of: 673db054d7a2 ("scsi: target: Fix multiple LUN_RESET handling")
--- drivers/target/target_core_transport.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/target/target_core_transport.c +11 -11
@@ -3131,14 +3131,14 @@ bool transport_wait_for_tasks(struct se_cmd *cmd) }EXPORT_SYMBOL (transport_wait_for_tasks); -struct sense_info { +struct sense_detail {u8 key;u8 asc;u8 ascq;bool add_sector_info; }; -static const struct sense_info sense_info_table[] = { +static const struct sense_detail sense_detail_table[] = { [TCM_NO_SENSE ] = { .key =NOT_READY },
@@ -3298,39 +3298,39 @@ static const struct sense_info sense_info_table[] = {*/ static void translate_sense_reason (struct se_cmd *cmd,sense_reason_t reason) { -const struct sense_info *si; +const struct sense_detail *sd;u8 *buffer = cmd->sense_buffer;int r = (__force int )reason;u8 key, asc, ascq;bool desc_format =target_sense_desc_format (cmd->se_dev); -if (r <ARRAY_SIZE (sense_info_table) && sense_info_table[r].key) - si = &sense_info_table[r]; +if (r <ARRAY_SIZE (sense_detail_table) && sense_detail_table[r].key) + sd = &sense_detail_table[r];else - si = &sense_info_table[(__force int ) + sd = &sense_detail_table[(__force int )TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ]; - key = si->key; + key = sd->key;if (reason ==TCM_CHECK_CONDITION_UNIT_ATTENTION ) {if (!core_scsi3_ua_for_check_condition (cmd, &key, &asc, &ascq)) { cmd->scsi_status =SAM_STAT_BUSY ;return ; } - }else if (si->asc ==0 ) { + }else if (sd->asc ==0 ) {WARN_ON_ONCE (cmd->scsi_asc ==0 ); asc = cmd->scsi_asc; ascq = cmd->scsi_ascq; }else { - asc = si->asc; - ascq = si->ascq; + asc = sd->asc; + ascq = sd->ascq; } cmd->se_cmd_flags |=SCF_EMULATED_TASK_SENSE ; cmd->scsi_status =SAM_STAT_CHECK_CONDITION ; cmd->scsi_sense_length =TRANSPORT_SENSE_BUFFER ;scsi_build_sense_buffer (desc_format, buffer, key, asc, ascq); -if (si->add_sector_info) +if (sd->add_sector_info)WARN_ON_ONCE (scsi_set_sense_information (buffer, cmd->scsi_sense_length, cmd->bad_sector) <0 );
Signature · 1 line
2.39.2