5.4.118-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 5.4.118-rc1 review
This is the start of the stable review cycle for the 5.4.118 release. There are 184 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, 12 May 2021 10:19:23 +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.4.118-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.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.4.118-rc1
Benjamin Block <[email protected]>
dm rq: fix double free of blk_mq_tag_set in dev remove after table load fails
Tian Tao <[email protected]>
dm integrity: fix missing goto in bitmap_flush_interval error handling
Joe Thornber <[email protected]>
dm space map common: fix division bug in sm_ll_find_free_block()
Joe Thornber <[email protected]>
dm persistent data: packed struct should have an aligned() attribute too
Steven Rostedt (VMware) <[email protected]>
tracing: Restructure trace_clock_global() to never block
Steven Rostedt (VMware) <[email protected]>
tracing: Map all PIDs to command lines
Marek Vasut <[email protected]>
rsi: Use resume_noirq for SDIO
Pavel Skripkin <[email protected]>
tty: fix memory leak in vc_deallocate
Artur Petrosyan <[email protected]>
usb: dwc2: Fix session request interrupt handler
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Fix START_TRANSFER link state check
Dean Anderson <[email protected]>
usb: gadget/function/f_fs string table fix for multiple languages
Hemant Kumar <[email protected]>
usb: gadget: Fix double free of device descriptor pointers
Anirudh Rayabharam <[email protected]>
usb: gadget: dummy_hcd: fix gpf in gadget_setup
Ricardo Ribalda <[email protected]>
media: staging/intel-ipu3: Fix race condition during set_fmt
Ricardo Ribalda <[email protected]>
media: staging/intel-ipu3: Fix set_fmt error handling
Ricardo Ribalda <[email protected]>
media: staging/intel-ipu3: Fix memory leak in imu_fmt
Takashi Iwai <[email protected]>
media: dvb-usb: Fix memory leak at error in dvb_usb_device_init()
Takashi Iwai <[email protected]>
media: dvb-usb: Fix use-after-free access
Peilin Ye <[email protected]>
media: dvbdev: Fix memory leak in dvb_media_device_free()
Fengnan Chang <[email protected]>
ext4: fix error code in ext4_commit_super
Zhang Yi <[email protected]>
ext4: do not set SB_ACTIVE in ext4_orphan_cleanup()
Zhang Yi <[email protected]>
ext4: fix check to prevent false positive report of incorrect used inodes
Masahiro Yamada <[email protected]>
kbuild: update config_data.gz only when the content of .config is changed
Sean Christopherson <[email protected]>
x86/cpu: Initialize MSR_TSC_AUX if RDTSCP *or* RDPID is supported
Thomas Gleixner <[email protected]>
Revert 337f13046ff0 ("futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op")
Yang Yang <[email protected]>
jffs2: check the validity of dstlen in jffs2_zlib_compress()
Linus Torvalds <[email protected]>
Fix misc new gcc warnings
Arnd Bergmann <[email protected]>
security: commoncap: fix -Wstringop-overread warning
Vivek Goyal <[email protected]>
fuse: fix write deadlock
Heinz Mauelshagen <[email protected]>
dm raid: fix inconclusive reshape layout on fast raid4/5/6 table reload sequences
Paul Clements <[email protected]>
md/raid1: properly indicate failure when ending a failed write request
Eric Biggers <[email protected]>
crypto: rng - fix crypto_rng_reset() refcounting when !CRYPTO_STATS
Stefan Berger <[email protected]>
tpm: vtpm_proxy: Avoid reading host log when using a virtual device
Stefan Berger <[email protected]>
tpm: efi: Use local variable for calculating final log size
Alexander Shishkin <[email protected]>
intel_th: pci: Add Alder Lake-M support
Tony Ambardar <[email protected]>
powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h
Mahesh Salgaonkar <[email protected]>
powerpc/eeh: Fix EEH handling for hugepages in ioremap space.
lizhe <[email protected]>
jffs2: Fix kasan slab-out-of-bounds problem
Hansem Ro <[email protected]>
Input: ili210x - add missing negation for touch indication on ili210x
Trond Myklebust <[email protected]>
NFSv4: Don't discard segments marked for return in _pnfs_return_layout()
Trond Myklebust <[email protected]>
NFS: Don't discard pNFS layout segments that are marked for return
Marc Zyngier <[email protected]>
ACPI: GTDT: Don't corrupt interrupt mappings on watchdow probe failure
Davide Caratti <[email protected]>
openvswitch: fix stack OOB read while fragmenting IPv4 packets
Ido Schimmel <[email protected]>
mlxsw: spectrum_mr: Update egress RIF list before route's action
Chao Yu <[email protected]>
f2fs: fix to avoid out-of-bounds memory access
Guochun Mao <[email protected]>
ubifs: Only check replay with inode type to judge if inode linked
Luis Henriques <[email protected]>
virtiofs: fix memory leak in virtio_fs_probe()
Nathan Chancellor <[email protected]>
Makefile: Move -Wno-unused-but-set-variable out of GCC only block
Bill Wendling <[email protected]>
arm64/vdso: Discard .note.gnu.property sections in vDSO
Filipe Manana <[email protected]>
btrfs: fix race when picking most recent mod log operation for an old root
Eckhart Mohr <[email protected]>
ALSA: hda/realtek: Add quirk for Intel Clevo PCx0Dx
Sami Loone <[email protected]>
ALSA: hda/realtek: fix static noise on ALC285 Lenovo laptops
Phil Calvin <[email protected]>
ALSA: hda/realtek: fix mic boost on Intel NUC 8
Luke D Jones <[email protected]>
ALSA: hda/realtek: GA503 use same quirks as GA401
Timo Gurr <[email protected]>
ALSA: usb-audio: Add dB range mapping for Sennheiser Communications Headset PC 8
Takashi Iwai <[email protected]>
ALSA: usb-audio: More constifications
Takashi Iwai <[email protected]>
ALSA: usb-audio: Explicitly set up the clock selector
Lv Yunlong <[email protected]>
ALSA: sb: Fix two use after free in snd_sb_qsound_build
Takashi Iwai <[email protected]>
ALSA: hda/conexant: Re-order CX5066 quirk table entries
Lv Yunlong <[email protected]>
ALSA: emu8000: Fix a use after free in snd_emu8000_create_mixer
Harald Freudenberger <[email protected]>
s390/archrandom: add parameter check for s390_arch_random_generate
Bart Van Assche <[email protected]>
scsi: libfc: Fix a format specifier
Dinghao Liu <[email protected]>
mfd: arizona: Fix rumtime PM imbalance on error
James Smart <[email protected]>
scsi: lpfc: Remove unsupported mbox PORT_CAPABILITIES logic
James Smart <[email protected]>
scsi: lpfc: Fix error handling for mailboxes completed in MBX_POLL mode
James Smart <[email protected]>
scsi: lpfc: Fix crash when a REG_RPI mailbox fails triggering a LOGO response
Guchun Chen <[email protected]>
drm/amdgpu: fix NULL pointer dereference
Arnd Bergmann <[email protected]>
amdgpu: avoid incorrect %hu format string
Qu Huang <[email protected]>
drm/amdkfd: Fix cat debugfs hang_hws file causes system crash bug
Marijn Suijten <[email protected]>
drm/msm/mdp5: Do not multiply vclk line count by 100
Marijn Suijten <[email protected]>
drm/msm/mdp5: Configure PP_SYNC_HEIGHT to double the vtotal
Lingutla Chandrasekhar <[email protected]>
sched/fair: Ignore percpu threads for imbalance pulls
Hans Verkuil <[email protected]>
media: gscpa/stv06xx: fix memory leak
Pavel Skripkin <[email protected]>
media: dvb-usb: fix memory leak in dvb_usb_adapter_init
Dinghao Liu <[email protected]>
media: platform: sti: Fix runtime PM imbalance in regs_show
Yang Yingliang <[email protected]>
media: i2c: adv7842: fix possible use-after-free in adv7842_remove()
Yang Yingliang <[email protected]>
media: i2c: tda1997: Fix possible use-after-free in tda1997x_remove()
Yang Yingliang <[email protected]>
media: i2c: adv7511-v4l2: fix possible use-after-free in adv7511_remove()
Yang Yingliang <[email protected]>
media: adv7604: fix possible use-after-free in adv76xx_remove()
Yang Yingliang <[email protected]>
media: tc358743: fix possible use-after-free in tc358743_remove()
Yang Yingliang <[email protected]>
power: supply: s3c_adc_battery: fix possible use-after-free in s3c_adc_bat_remove()
Yang Yingliang <[email protected]>
power: supply: generic-adc-battery: fix possible use-after-free in gab_remove()
Colin Ian King <[email protected]>
clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return
Hans Verkuil <[email protected]>
media: vivid: update EDID
Muhammad Usama Anjum <[email protected]>
media: em28xx: fix memory leak
Ewan D. Milne <[email protected]>
scsi: scsi_dh_alua: Remove check for ASC 24h in alua_rtpg()
Kevin Barnett <[email protected]>
scsi: smartpqi: Add new PCI IDs
Murthy Bhat <[email protected]>
scsi: smartpqi: Correct request leakage during reset operations
Xingui Yang <[email protected]>
ata: ahci: Disable SXS for Hisilicon Kunpeng920
Adrian Hunter <[email protected]>
mmc: sdhci-pci: Add PCI IDs for Intel LKF
Quinn Tran <[email protected]>
scsi: qla2xxx: Fix use after free in bsg
Dmitry Vyukov <[email protected]>
drm/vkms: fix misuse of WARN_ON
Bart Van Assche <[email protected]>
scsi: qla2xxx: Always check the return value of qla24xx_get_isp_stats()
Dmytro Laktyushkin <[email protected]>
drm/amd/display: fix dml prefetch validation
Anson Jacob <[email protected]>
drm/amd/display: Fix UBSAN warning for not a valid value for type '_Bool'
shaoyunl <[email protected]>
drm/amdgpu : Fix asic reset regression issue introduce by 8f211fe8ac7c4f
Anson Jacob <[email protected]>
drm/amdkfd: Fix UBSAN shift-out-of-bounds warning
Jonathan Kim <[email protected]>
drm/amdgpu: mask the xgmi number of hops reported from psp to kfd
dongjian <[email protected]>
power: supply: Use IRQF_ONESHOT
Hans Verkuil <[email protected]>
media: gspca/sq905.c: fix uninitialized variable
Daniel Niv <[email protected]>
media: media/saa7164: fix saa7164_encoder_register() memory leak bugs
Hans de Goede <[email protected]>
extcon: arizona: Fix various races on driver unbind
Hans de Goede <[email protected]>
extcon: arizona: Fix some issues when HPDET IRQ fires after the jack has been unplugged
Matthias Schiffer <[email protected]>
power: supply: bq27xxx: fix power_avg for newer ICs
Laurent Pinchart <[email protected]>
media: imx: capture: Return -EPIPE from __capture_legacy_try_fmt()
Julian Braha <[email protected]>
media: drivers: media: pci: sta2x11: fix Kconfig dependency on GPIOLIB
Sean Young <[email protected]>
media: ite-cir: check for receive overflow
Chaitanya Kulkarni <[email protected]>
scsi: target: pscsi: Fix warning in pscsi_complete_cmd()
James Smart <[email protected]>
scsi: lpfc: Fix pt2pt connection does not recover after LOGO
James Smart <[email protected]>
scsi: lpfc: Fix incorrect dbde assignment when building target abts wqe
Aric Cyr <[email protected]>
drm/amd/display: Don't optimize bandwidth before disabling planes
Eryk Brol <[email protected]>
drm/amd/display: Check for DSC support instead of ASIC revision
Gerd Hoffmann <[email protected]>
drm/qxl: release shadow on shutdown
Jared Baldridge <[email protected]>
drm: Added orientation quirk for OneGX1 Pro
Josef Bacik <[email protected]>
btrfs: convert logic BUG_ON()'s in replace_path to ASSERT()'s
David E. Box <[email protected]>
platform/x86: intel_pmc_core: Don't use global pmcdev in quirks
Shixin Liu <[email protected]>
crypto: omap-aes - Fix PM reference leak on omap-aes.c
Shixin Liu <[email protected]>
crypto: stm32/cryp - Fix PM reference leak on stm32-cryp.c
Shixin Liu <[email protected]>
crypto: stm32/hash - Fix PM reference leak on stm32-hash.c
Yang Yingliang <[email protected]>
phy: phy-twl4030-usb: Fix possible use-after-free in twl4030_usb_remove()
Pavel Machek <[email protected]>
intel_th: Consistency and off-by-one fix
Hillf Danton <[email protected]>
tty: n_gsm: check error while registering tty devices
Bixuan Cui <[email protected]>
usb: core: hub: Fix PM reference leak in usb_port_resume()
Bixuan Cui <[email protected]>
usb: musb: fix PM reference leak in musb_irq_work()
Wang Li <[email protected]>
spi: qup: fix PM reference leak in spi_qup_remove()
Wei Yongjun <[email protected]>
spi: omap-100k: Fix reference leak to master
Wei Yongjun <[email protected]>
spi: dln2: Fix reference leak to master
Mathias Nyman <[email protected]>
xhci: fix potential array out of bounds with several interrupters
Mathias Nyman <[email protected]>
xhci: check control context is valid before dereferencing it.
Chunfeng Yun <[email protected]>
usb: xhci-mtk: support quirk to disable usb2 lpm
Robin Murphy <[email protected]>
perf/arm_pmu_platform: Fix error handling
Jerome Forissier <[email protected]>
tee: optee: do not check memref size on return from Secure World
John Millikin <[email protected]>
x86/build: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS)
Rafael J. Wysocki <[email protected]>
PCI: PM: Do not read power state in pci_enable_device_flags()
Thinh Nguyen <[email protected]>
usb: xhci: Fix port minor revision
Wesley Cheng <[email protected]>
usb: dwc3: gadget: Ignore EP queue requests during bus reset
Ruslan Bilovol <[email protected]>
usb: gadget: f_uac1: validate input parameters
Ruslan Bilovol <[email protected]>
usb: gadget: f_uac2: validate input parameters
Vitaly Kuznetsov <[email protected]>
genirq/matrix: Prevent allocation counter corruption
Pawel Laszczak <[email protected]>
usb: webcam: Invalid size of Processing Unit Descriptor
Pawel Laszczak <[email protected]>
usb: gadget: uvc: add bInterval checking for HS mode
Hui Tang <[email protected]>
crypto: qat - fix unmap invalid dma address
Ard Biesheuvel <[email protected]>
crypto: api - check for ERR pointers in crypto_destroy_tfm()
David Bauer <[email protected]>
spi: ath79: remove spi-master setup and cleanup assignment
David Bauer <[email protected]>
spi: ath79: always call chipselect function
karthik alapati <[email protected]>
staging: wimax/i2400m: fix byte-order issue
Tony Lindgren <[email protected]>
bus: ti-sysc: Probe for l4_wkup and l4_cfg interconnect devices first
Phillip Potter <[email protected]>
fbdev: zero-fill colormap in fbcmap.c
Chen Jun <[email protected]>
posix-timers: Preserve return value in clock_adjtime32()
Alexander Shishkin <[email protected]>
intel_th: pci: Add Rocket Lake CPU support
Filipe Manana <[email protected]>
btrfs: fix metadata extent leak after failure to create subvolume
Paul Aurich <[email protected]>
cifs: Return correct error code from smb2_get_enc_key
He Ying <[email protected]>
irqchip/gic-v3: Do not enable irqs when handling spurious interrups
Christoph Hellwig <[email protected]>
modules: inherit TAINT_PROPRIETARY_MODULE
Christoph Hellwig <[email protected]>
modules: return licensing information from find_symbol
Christoph Hellwig <[email protected]>
modules: rename the licence field in struct symsearch to license
Christoph Hellwig <[email protected]>
modules: unexport __module_address
Christoph Hellwig <[email protected]>
modules: unexport __module_text_address
Christoph Hellwig <[email protected]>
modules: mark each_symbol_section static
Christoph Hellwig <[email protected]>
modules: mark find_symbol static
Christoph Hellwig <[email protected]>
modules: mark ref_module static
Ulf Hansson <[email protected]>
mmc: core: Fix hanging on I/O during system suspend for removable cards
Seunghui Lee <[email protected]>
mmc: core: Set read only for SD cards with permanent write protect bit
DooHyun Hwang <[email protected]>
mmc: core: Do a power cycle when the CMD11 fails
Avri Altman <[email protected]>
mmc: block: Issue a cache flush only when it's enabled
Avri Altman <[email protected]>
mmc: block: Update ext_csd.cache_ctrl if it was written
Adrian Hunter <[email protected]>
mmc: sdhci-pci: Fix initialization of some SD cards for Intel BYT-based controllers
Pradeep P V K <[email protected]>
mmc: sdhci: Check for reset prior to DMA address unmap
Christophe JAILLET <[email protected]>
mmc: uniphier-sd: Fix a resource leak in the remove function
Christophe JAILLET <[email protected]>
mmc: uniphier-sd: Fix an error handling path in uniphier_sd_probe()
Sreekanth Reddy <[email protected]>
scsi: mpt3sas: Block PCI config access from userspace during reset
Arun Easi <[email protected]>
scsi: qla2xxx: Fix crash in qla2xxx_mqueuecommand()
Tudor Ambarus <[email protected]>
spi: spi-ti-qspi: Free DMA resources
Gao Xiang <[email protected]>
erofs: add unsupported inode i_format check
Kai Stuhlemmer (ebee Engineering) <[email protected]>
mtd: rawnand: atmel: Update ecc_stats.corrected counter
Alexander Lobakin <[email protected]>
mtd: spinand: core: add missing MODULE_DEVICE_TABLE()
Jeffrey Mitchell <[email protected]>
ecryptfs: fix kernel panic with null dev_name
Chunfeng Yun <[email protected]>
arm64: dts: mt8173: fix property typo of 'phys' in dsi node
Marek Behún <[email protected]>
arm64: dts: marvell: armada-37xx: add syscon compatible to NB clk node
Ard Biesheuvel <[email protected]>
ARM: 9056/1: decompressor: fix BSS size calculation for LLVM ld.lld
Steven Rostedt (VMware) <[email protected]>
ftrace: Handle commands when closing set_ftrace_filter file
Mark Langsdorf <[email protected]>
ACPI: custom_method: fix a possible memory leak
Mark Langsdorf <[email protected]>
ACPI: custom_method: fix potential use-after-free issue
Vasily Gorbik <[email protected]>
s390/disassembler: increase ebpf disasm buffer size
-------------
Diffstat:
Makefile | 12 +- arch/arm/boot/compressed/Makefile | 4 +- arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 3 +- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 2 +- arch/arm64/kernel/vdso/vdso.lds.S | 8 +- arch/powerpc/include/uapi/asm/errno.h | 1 + arch/powerpc/kernel/eeh.c | 11 +- arch/s390/crypto/arch_random.c | 4 + arch/s390/kernel/dis.c | 2 +- arch/x86/Makefile | 1 + arch/x86/kernel/cpu/common.c | 2 +- crypto/api.c | 2 +- crypto/rng.c | 10 +- drivers/acpi/arm64/gtdt.c | 10 +- drivers/acpi/custom_method.c | 4 +- drivers/ata/ahci.c | 5 + drivers/ata/ahci.h | 1 + drivers/ata/libahci.c | 5 + drivers/bus/ti-sysc.c | 49 ++++++ drivers/char/tpm/eventlog/common.c | 3 + drivers/char/tpm/eventlog/efi.c | 29 +++- drivers/clk/socfpga/clk-gate-a10.c | 1 + drivers/crypto/omap-aes.c | 6 +- drivers/crypto/qat/qat_common/qat_algs.c | 11 +- drivers/crypto/stm32/stm32-cryp.c | 4 +- drivers/crypto/stm32/stm32-hash.c | 8 +- drivers/extcon/extcon-arizona.c | 57 +++---- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 9 +- drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c | 7 +- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 17 +- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 +- .../amd/display/dc/dml/dcn20/display_mode_vba_20.c | 1 + .../display/dc/dml/dcn20/display_mode_vba_20v2.c | 1 + drivers/gpu/drm/drm_panel_orientation_quirks.c | 14 ++ drivers/gpu/drm/i915/intel_pm.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c | 18 ++- drivers/gpu/drm/qxl/qxl_display.c | 4 + drivers/gpu/drm/vkms/vkms_crtc.c | 3 +- drivers/hwtracing/intel_th/gth.c | 4 +- drivers/hwtracing/intel_th/pci.c | 10 ++ drivers/input/touchscreen/ili210x.c | 2 +- drivers/irqchip/irq-gic-v3.c | 8 +- drivers/md/dm-integrity.c | 1 + drivers/md/dm-raid.c | 34 +++- drivers/md/dm-rq.c | 2 + drivers/md/persistent-data/dm-btree-internal.h | 4 +- drivers/md/persistent-data/dm-space-map-common.c | 2 + drivers/md/persistent-data/dm-space-map-common.h | 8 +- drivers/md/raid1.c | 2 + drivers/media/dvb-core/dvbdev.c | 1 + drivers/media/i2c/adv7511-v4l2.c | 2 +- drivers/media/i2c/adv7604.c | 2 +- drivers/media/i2c/adv7842.c | 2 +- drivers/media/i2c/tc358743.c | 2 +- drivers/media/i2c/tda1997x.c | 2 +- drivers/media/pci/saa7164/saa7164-encoder.c | 20 +-- drivers/media/pci/sta2x11/Kconfig | 1 + drivers/media/platform/sti/bdisp/bdisp-debug.c | 2 +- drivers/media/platform/vivid/vivid-core.c | 6 +- drivers/media/rc/ite-cir.c | 8 +- drivers/media/usb/dvb-usb/dvb-usb-init.c | 90 +++++++---- drivers/media/usb/dvb-usb/dvb-usb.h | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 1 + drivers/media/usb/gspca/gspca.c | 2 + drivers/media/usb/gspca/gspca.h | 1 + drivers/media/usb/gspca/sq905.c | 2 +- drivers/media/usb/gspca/stv06xx/stv06xx.c | 9 ++ drivers/mfd/arizona-irq.c | 2 +- drivers/mmc/core/block.c | 16 ++ drivers/mmc/core/core.c | 76 +-------- drivers/mmc/core/core.h | 17 +- drivers/mmc/core/host.c | 40 ++++- drivers/mmc/core/mmc.c | 7 + drivers/mmc/core/mmc_ops.c | 4 +- drivers/mmc/core/sd.c | 6 + drivers/mmc/core/sdio.c | 28 +++- drivers/mmc/host/sdhci-pci-core.c | 29 ++++ drivers/mmc/host/sdhci-pci.h | 2 + drivers/mmc/host/sdhci.c | 60 +++---- drivers/mmc/host/uniphier-sd.c | 5 +- drivers/mtd/nand/raw/atmel/nand-controller.c | 6 +- drivers/mtd/nand/spi/core.c | 2 + drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c | 30 ++-- drivers/net/wimax/i2400m/op-rfkill.c | 2 +- drivers/net/wireless/rsi/rsi_91x_sdio.c | 2 +- drivers/pci/pci.c | 16 +- drivers/perf/arm_pmu_platform.c | 2 +- drivers/phy/ti/phy-twl4030-usb.c | 2 +- drivers/platform/x86/intel_pmc_core.c | 19 ++- drivers/power/supply/bq27xxx_battery.c | 51 +++--- drivers/power/supply/generic-adc-battery.c | 2 +- drivers/power/supply/lp8788-charger.c | 2 +- drivers/power/supply/pm2301_charger.c | 2 +- drivers/power/supply/s3c_adc_battery.c | 2 +- drivers/power/supply/tps65090-charger.c | 2 +- drivers/power/supply/tps65217_charger.c | 2 +- drivers/scsi/device_handler/scsi_dh_alua.c | 5 +- drivers/scsi/libfc/fc_lport.c | 2 +- drivers/scsi/lpfc/lpfc_attr.c | 75 +++++---- drivers/scsi/lpfc/lpfc_crtn.h | 3 - drivers/scsi/lpfc/lpfc_hw4.h | 174 +-------------------- drivers/scsi/lpfc/lpfc_init.c | 112 +------------ drivers/scsi/lpfc/lpfc_mbox.c | 36 ----- drivers/scsi/lpfc/lpfc_nportdisc.c | 11 +- drivers/scsi/lpfc/lpfc_nvmet.c | 1 - drivers/scsi/lpfc/lpfc_sli.c | 43 ++--- drivers/scsi/mpt3sas/mpt3sas_base.c | 4 + drivers/scsi/qla2xxx/qla_attr.c | 8 +- drivers/scsi/qla2xxx/qla_bsg.c | 3 +- drivers/scsi/qla2xxx/qla_os.c | 7 - drivers/scsi/smartpqi/smartpqi_init.c | 160 +++++++++++++++++++ drivers/spi/spi-ath79.c | 3 +- drivers/spi/spi-dln2.c | 2 +- drivers/spi/spi-omap-100k.c | 6 +- drivers/spi/spi-qup.c | 2 +- drivers/spi/spi-ti-qspi.c | 20 ++- drivers/staging/media/imx/imx-media-capture.c | 2 +- drivers/staging/media/ipu3/ipu3-v4l2.c | 36 +++-- drivers/target/target_core_pscsi.c | 3 +- drivers/tee/optee/core.c | 10 -- drivers/tty/n_gsm.c | 14 +- drivers/tty/vt/vt.c | 1 + drivers/usb/core/hub.c | 2 +- drivers/usb/dwc2/core_intr.c | 8 + drivers/usb/dwc3/gadget.c | 22 ++- drivers/usb/gadget/config.c | 4 + drivers/usb/gadget/function/f_fs.c | 3 +- drivers/usb/gadget/function/f_uac1.c | 43 +++++ drivers/usb/gadget/function/f_uac2.c | 39 ++++- drivers/usb/gadget/function/f_uvc.c | 8 +- drivers/usb/gadget/legacy/webcam.c | 1 + drivers/usb/gadget/udc/dummy_hcd.c | 23 ++- drivers/usb/host/xhci-mem.c | 9 ++ drivers/usb/host/xhci-mtk.c | 3 + drivers/usb/host/xhci-mtk.h | 1 + drivers/usb/host/xhci.c | 14 +- drivers/usb/musb/musb_core.c | 2 +- drivers/video/fbdev/core/fbcmap.c | 8 +- fs/btrfs/ctree.c | 20 +++ fs/btrfs/ioctl.c | 18 ++- fs/btrfs/relocation.c | 6 +- fs/cifs/smb2ops.c | 2 +- fs/ecryptfs/main.c | 6 + fs/erofs/erofs_fs.h | 3 + fs/erofs/inode.c | 7 + fs/ext4/ialloc.c | 48 ++++-- fs/ext4/super.c | 9 +- fs/f2fs/node.c | 3 + fs/fuse/file.c | 41 +++-- fs/fuse/fuse_i.h | 1 + fs/fuse/virtio_fs.c | 1 + fs/jffs2/compr_rtime.c | 3 + fs/jffs2/scan.c | 2 +- fs/nfs/pnfs.c | 7 +- fs/ubifs/replay.c | 3 +- include/crypto/acompress.h | 2 + include/crypto/aead.h | 2 + include/crypto/akcipher.h | 2 + include/crypto/hash.h | 4 + include/crypto/kpp.h | 2 + include/crypto/rng.h | 2 + include/crypto/skcipher.h | 2 + include/linux/mmc/host.h | 3 - include/linux/module.h | 26 +-- include/linux/power/bq27xxx_battery.h | 1 - include/scsi/libfcoe.h | 2 +- include/uapi/linux/usb/video.h | 3 +- kernel/.gitignore | 1 + kernel/Makefile | 9 +- kernel/futex.c | 3 +- kernel/irq/matrix.c | 4 +- kernel/module.c | 60 +++++-- kernel/sched/fair.c | 4 + kernel/time/posix-timers.c | 4 +- kernel/trace/ftrace.c | 5 +- kernel/trace/trace.c | 41 ++--- kernel/trace/trace_clock.c | 44 ++++-- net/bluetooth/ecdh_helper.h | 2 +- net/openvswitch/actions.c | 8 +- security/commoncap.c | 2 +- sound/isa/sb/emu8000.c | 4 +- sound/isa/sb/sb16_csp.c | 8 +- sound/pci/hda/patch_conexant.c | 14 +- sound/pci/hda/patch_realtek.c | 25 ++- sound/usb/clock.c | 18 ++- sound/usb/mixer.c | 60 +++---- sound/usb/mixer_maps.c | 68 ++++---- sound/usb/mixer_quirks.c | 6 +- sound/usb/mixer_scarlett.c | 14 +- sound/usb/proc.c | 2 +- sound/usb/stream.c | 4 +- sound/usb/validate.c | 4 +- 196 files changed, 1542 insertions(+), 1052 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/184 s390/disassembler: increase ebpf disasm buffer size
From: Vasily Gorbik <[email protected]>
commit 6f3353c2d2b3eb4de52e9704cb962712033db181 upstream.
Current ebpf disassembly buffer size of 64 is too small. E.g. this line takes 65 bytes:01fffff8005822e: ec8100ed8065\tclgrj\t%r8,%r1,8,001fffff80058408\n\0
Double the buffer size like it is done for the kernel disassembly buffer.
Fixes the following KASAN finding:
UG: KASAN: stack-out-of-bounds in print_fn_code+0x34c/0x380
Write of size 1 at addr 001fff800ad5f970 by task test_progs/853
CPU: 53 PID: 853 Comm: test_progs Not tainted
5.12.0-rc7-23786-g23457d86b1f0-dirty #19
Hardware name: IBM 3906 M04 704 (LPAR)
Call Trace:
[<0000000cd8e0538a>] show_stack+0x17a/0x1668
[<0000000cd8e2a5d8>] dump_stack+0x140/0x1b8
[<0000000cd8e16e74>] print_address_description.constprop.0+0x54/0x260
[<0000000cd75a8698>] kasan_report+0xc8/0x130
[<0000000cd6e26da4>] print_fn_code+0x34c/0x380
[<0000000cd6ea0f4e>] bpf_int_jit_compile+0xe3e/0xe58
[<0000000cd72c4c88>] bpf_prog_select_runtime+0x5b8/0x9c0
[<0000000cd72d1bf8>] bpf_prog_load+0xa78/0x19c0
[<0000000cd72d7ad6>] __do_sys_bpf.part.0+0x18e/0x768
[<0000000cd6e0f392>] do_syscall+0x12a/0x220
[<0000000cd8e333f8>] __do_syscall+0x98/0xc8
[<0000000cd8e54834>] system_call+0x6c/0x94
1 lock held by test_progs/853:
#0: 0000000cd9bf7460 (report_lock){....}-{2:2}, at:
kasan_report+0x96/0x130addr 001fff800ad5f970 is located in stack of task test_progs/853 at offset 96 in frame:
print_fn_code+0x0/0x380
this frame has 1 object:
[32, 96) 'buffer'
Memory state around the buggy address:
001fff800ad5f800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
001fff800ad5f880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>001fff800ad5f900: 00 00 f1 f1 f1 f1 00 00 00 00 00 00 00 00 f3 f3
^
001fff800ad5f980: f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00
001fff800ad5fa00: 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00 00 00--- arch/s390/kernel/dis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/dis.c +1 -1
@@ -557,7 +557,7 @@ void show_code(struct pt_regs *regs)void print_fn_code (unsigned char *code,unsigned long len) { -char buffer[64 ], *ptr; +char buffer[128 ], *ptr;int opsize, i;while (len) {
Greg Kroah-Hartman
maintainerPATCH 2/184 ACPI: custom_method: fix potential use-after-free issue
In reply to Greg Kroah-HartmanFrom: Mark Langsdorf <[email protected]>
commit e483bb9a991bdae29a0caa4b3a6d002c968f94aa upstream.
In cm_write(), buf is always freed when reaching the end of the function. If the requested count is less than table.length, the allocated buffer will be freed but subsequent calls to cm_write() will still try to access it.
Remove the unconditional kfree(buf) at the end of the function and set the buf to NULL in the -EINVAL error path to match the rest of function.
--- drivers/acpi/custom_method.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/custom_method.c +1 -1
@@ -57,6 +57,7 @@ static ssize_t cm_write(struct file *fil (*ppos + count < count) || (count > uncopied_bytes)) {kfree (buf); + buf =NULL ;return -EINVAL ; }
@@ -78,7 +79,6 @@ static ssize_t cm_write(struct file *filadd_taint (TAINT_OVERRIDDEN_ACPI_TABLE ,LOCKDEP_NOW_UNRELIABLE ); } -kfree (buf);return count; }
Greg Kroah-Hartman
maintainerPATCH 3/184 ACPI: custom_method: fix a possible memory leak
In reply to Greg Kroah-HartmanFrom: Mark Langsdorf <[email protected]>
commit 1cfd8956437f842836e8a066b40d1ec2fc01f13e upstream.
In cm_write(), if the 'buf' is allocated memory but not fully consumed, it is possible to reallocate the buffer without freeing it by passing '*ppos' as 0 on a subsequent call.
Add an explicit kfree() before kzalloc() to prevent the possible memory leak.
--- drivers/acpi/custom_method.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/acpi/custom_method.c +2 -0
@@ -44,6 +44,8 @@ static ssize_t cm_write(struct file *fil sizeof(struct acpi_table_header)))return -EFAULT ; uncopied_bytes = max_size = table.length; +/* make sure the buf is not allocated */ +kfree (buf); buf =kzalloc (max_size,GFP_KERNEL );if (!buf)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 4/184 ftrace: Handle commands when closing set_ftrace_filter file
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
commit 8c9af478c06bb1ab1422f90d8ecbc53defd44bc3 upstream.
# echo switch_mm:traceoff > /sys/kernel/tracing/set_ftrace_filter
will cause switch_mm to stop tracing by the traceoff command.
# echo -n switch_mm:traceoff > /sys/kernel/tracing/set_ftrace_filter
does nothing.
The reason is that the parsing in the write function only processes commands if it finished parsing (there is white space written after the command). That's to handle:
write(fd, "switch_mm:", 10);
write(fd, "traceoff", 8);
cases, where the command is broken over multiple writes.
The problem is if the file descriptor is closed, then the write call is not processed, and the command needs to be processed in the release code. The release code can handle matching of functions, but does not handle commands.
--- kernel/trace/ftrace.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/trace/ftrace.c +4 -1
@@ -5053,7 +5053,10 @@ int ftrace_regex_release(struct inode *i parser = &iter->parser;if (trace_parser_loaded (parser)) { -ftrace_match_records (iter->hash, parser->buffer, parser->idx); +int enable = !(iter->flags &FTRACE_ITER_NOTRACE ); + +ftrace_process_regex (iter, parser->buffer, + parser->idx, enable); }trace_parser_put (parser);
Greg Kroah-Hartman
maintainerPATCH 5/184 ARM: 9056/1: decompressor: fix BSS size calculation for LLVM ld.lld
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
commit c4e792d1acce31c2eb7b9193ab06ab94de05bf42 upstream.
The LLVM ld.lld linker uses a different symbol type for __bss_start, resulting in the calculation of KBSS_SZ to be thrown off. Up until now, this has gone unnoticed as it only affects the appended DTB case, but pending changes for ARM in the way the decompressed kernel is cleaned from the caches has uncovered this problem.
On a ld.lld build:
$ nm vmlinux |grep bss_ c1c22034 D __bss_start c1c86e98 B __bss_stop
resulting in
$ readelf -s arch/arm/boot/compressed/vmlinux | grep bss_size 433: c1c86e98 0 NOTYPE GLOBAL DEFAULT ABS _kernel_bss_size
which is obviously incorrect, and may cause the cache clean to access unmapped memory, or cause the size calculation to wrap, resulting in no cache clean to be performed at all.
Fix this by updating the sed regex to take D type symbols into account.
--- arch/arm/boot/compressed/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/compressed/Makefile +2 -2
@@ -122,8 +122,8 @@ asflags-y := -DZIMAGE # Supply kernel BSS size to the decompressor via a linker symbol. KBSS_SZ = $(shell echo $$(($$($(NM) $(obj)/../../../../vmlinux | \ - sed -n -e 's/^\([^ ]*\) [AB] __bss_start$$/-0x\1/p' \ - -e 's/^\([^ ]*\) [AB] __bss_stop$$/+0x\1/p') )) ) + sed -n -e 's/^\([^ ]*\) [ABD] __bss_start$$/-0x\1/p' \ + -e 's/^\([^ ]*\) [ABD] __bss_stop$$/+0x\1/p') )) ) LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ) # Supply ZRELADDR to the decompressor via a linker symbol. ifneq ($(CONFIG_AUTO_ZRELADDR),y)
Greg Kroah-Hartman
maintainerPATCH 6/184 arm64: dts: marvell: armada-37xx: add syscon compatible to NB clk node
In reply to Greg Kroah-HartmanFrom: Marek Behún <[email protected]>
commit 1d88358a89dbac9c7d4559548b9a44840456e6fb upstream.
Add "syscon" compatible to the North Bridge clocks node to allow the cpufreq driver to access these registers via syscon API.
This is needed for a fix of cpufreq driver.
--- arch/arm64/boot/dts/marvell/armada-37xx.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/marvell/armada-37xx.dtsi +2 -1
@@ -156,7 +156,8 @@ }; nb_periph_clk: nb-periph-clk@13000 { - compatible = "marvell,armada-3700-periph-clock-nb"; + compatible = "marvell,armada-3700-periph-clock-nb", + "syscon"; reg = <0x13000 0x100>; clocks = <&tbg 0>, <&tbg 1>, <&tbg 2>, <&tbg 3>, <&xtalclk>;
Greg Kroah-Hartman
maintainerPATCH 7/184 arm64: dts: mt8173: fix property typo of phys in dsi node
In reply to Greg Kroah-HartmanFrom: Chunfeng Yun <[email protected]>
commit e4e5d030bd779fb8321d3b8bd65406fbe0827037 upstream.
Use 'phys' instead of 'phy'.
--- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt8173.dtsi +1 -1
@@ -1137,7 +1137,7 @@ <&mmsys CLK_MM_DSI1_DIGITAL>, <&mipi_tx1>; clock-names = "engine", "digital", "hs"; - phy = <&mipi_tx1>; + phys = <&mipi_tx1>; phy-names = "dphy"; status = "disabled"; };
Greg Kroah-Hartman
maintainerPATCH 8/184 ecryptfs: fix kernel panic with null dev_name
In reply to Greg Kroah-HartmanFrom: Jeffrey Mitchell <[email protected]>
commit 9046625511ad8dfbc8c6c2de16b3532c43d68d48 upstream.
When mounting eCryptfs, a null "dev_name" argument to ecryptfs_mount() causes a kernel panic if the parsed options are valid. The easiest way to reproduce this is to call mount() from userspace with an existing eCryptfs mount's options and a "source" argument of 0.
Error out if "dev_name" is null in ecryptfs_mount()
--- fs/ecryptfs/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ecryptfs/main.c +6 -0
@@ -492,6 +492,12 @@ static struct dentry *ecryptfs_mount(str goto out; } +if (!dev_name) { + rc = -EINVAL ; + err ="Device name cannot be null" ; + goto out; + } + rc =ecryptfs_parse_options (sbi, raw_data, &check_ruid);if (rc) { err ="Error parsing options" ;
Greg Kroah-Hartman
maintainerPATCH 9/184 mtd: spinand: core: add missing MODULE_DEVICE_TABLE()
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
commit 25fefc88c71f47db0466570335e3f75f10952e7a upstream.
The module misses MODULE_DEVICE_TABLE() for both SPI and OF ID tables and thus never autoloads on ID matches.
Add the missing declarations.
Present since day-0 of spinand framework introduction.
--- drivers/mtd/nand/spi/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/nand/spi/core.c +2 -0
@@ -1133,12 +1133,14 @@ static const struct spi_device_id spinan { .name = "spi-nand" }, { /* sentinel */ }, }; +MODULE_DEVICE_TABLE (spi, spinand_ids);#ifdef CONFIG_OF static const struct of_device_id spinand_of_ids[] = { { .compatible ="spi-nand" }, {/* sentinel */ }, }; +MODULE_DEVICE_TABLE (of, spinand_of_ids);#endif static struct spi_mem_driver spinand_drv = {
Greg Kroah-Hartman
maintainerPATCH 10/184 mtd: rawnand: atmel: Update ecc_stats.corrected counter
In reply to Greg Kroah-HartmanFrom: Kai Stuhlemmer (ebee Engineering) <[email protected]>
commit 33cebf701e98dd12b01d39d1c644387b27c1a627 upstream.
Update MTD ECC statistics with the number of corrected bits.
--- drivers/mtd/nand/raw/atmel/nand-controller.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/atmel/nand-controller.c +4 -2
@@ -813,10 +813,12 @@ static int atmel_nand_pmecc_correct_dataNULL ,0 , chip->ecc.strength); -if (ret >=0 ) +if (ret >=0 ) { + mtd->ecc_stats.corrected += ret; max_bitflips =max (ret, max_bitflips); -else + }else { mtd->ecc_stats.failed++; + } databuf += chip->ecc.size; eccbuf += chip->ecc.bytes;
Greg Kroah-Hartman
maintainerPATCH 11/184 erofs: add unsupported inode i_format check
In reply to Greg Kroah-HartmanFrom: Gao Xiang <[email protected]>
commit 24a806d849c0b0c1d0cd6a6b93ba4ae4c0ec9f08 upstream.
If any unknown i_format fields are set (may be of some new incompat inode features), mark such inode as unsupported.
Just in case of any new incompat i_format fields added in the future.
--- fs/erofs/erofs_fs.h | 3 +++ fs/erofs/inode.c | 7 +++++++ 2 files changed, 10 insertions(+)
fs/erofs/erofs_fs.h +3 -0
@@ -74,6 +74,9 @@ static inline bool erofs_inode_is_data_c#define EROFS_I_VERSION_BIT 0#define EROFS_I_DATALAYOUT_BIT 1 +#define EROFS_I_ALL \ + ((1 << (EROFS_I_DATALAYOUT_BIT + EROFS_I_DATALAYOUT_BITS)) - 1) +/* 32-byte reduced form of an ondisk inode */ struct erofs_inode_compact {__le16 i_format;/* inode format hints */
fs/erofs/inode.c +7 -0
@@ -44,6 +44,13 @@ static struct page *erofs_read_inode(str dic =page_address (page) + *ofs; ifmt =le16_to_cpu (dic->i_format); +if (ifmt & ~EROFS_I_ALL ) { +erofs_err (inode->i_sb,"unsupported i_format %u of nid %llu" , + ifmt, vi->nid); + err = -EOPNOTSUPP ; + goto err_out; + } + vi->datalayout =erofs_inode_datalayout (ifmt);if (vi->datalayout >=EROFS_INODE_DATALAYOUT_MAX ) { erofs_err(inode->i_sb, "unsupported datalayout %u of nid %llu",
Greg Kroah-Hartman
maintainerPATCH 12/184 spi: spi-ti-qspi: Free DMA resources
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit 1d309cd688a76fb733f0089d36dc630327b32d59 upstream.
Release the RX channel and free the dma coherent memory when devm_spi_register_master() fails.
--- drivers/spi/spi-ti-qspi.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/spi/spi-ti-qspi.c +14 -6
@@ -656,6 +656,17 @@ static int ti_qspi_runtime_resume(structreturn 0 ; } +static void ti_qspi_dma_cleanup (struct ti_qspi *qspi) +{ +if (qspi->rx_bb_addr) +dma_free_coherent (qspi->dev,QSPI_DMA_BUFFER_SIZE , + qspi->rx_bb_addr, + qspi->rx_bb_dma_addr); + +if (qspi->rx_chan) +dma_release_channel (qspi->rx_chan); +} +static const struct of_device_id ti_qspi_match[] = { {.compatible ="ti,dra7xxx-qspi" }, {.compatible ="ti,am4372-qspi" },
@@ -809,6 +820,8 @@ no_dma:if (!ret)return 0 ; +ti_qspi_dma_cleanup (qspi); +pm_runtime_disable (&pdev->dev); free_master:spi_master_put (master);
@@ -827,12 +840,7 @@ static int ti_qspi_remove(struct platforpm_runtime_put_sync (&pdev->dev);pm_runtime_disable (&pdev->dev); -if (qspi->rx_bb_addr) -dma_free_coherent (qspi->dev,QSPI_DMA_BUFFER_SIZE , - qspi->rx_bb_addr, - qspi->rx_bb_dma_addr); -if (qspi->rx_chan) -dma_release_channel (qspi->rx_chan); +ti_qspi_dma_cleanup (qspi);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 13/184 scsi: qla2xxx: Fix crash in qla2xxx_mqueuecommand()
In reply to Greg Kroah-HartmanFrom: Arun Easi <[email protected]>
commit 6641df81ab799f28a5d564f860233dd26cca0d93 upstream.
RIP: 0010:kmem_cache_free+0xfa/0x1b0
Call Trace:
qla2xxx_mqueuecommand+0x2b5/0x2c0 [qla2xxx]
scsi_queue_rq+0x5e2/0xa40
__blk_mq_try_issue_directly+0x128/0x1d0
blk_mq_request_issue_directly+0x4e/0xb0Fix incorrect call to free srb in qla2xxx_mqueuecommand(), as srb is now allocated by upper layers. This fixes smatch warning of srb unintended free.
--- drivers/scsi/qla2xxx/qla_os.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +0 -7
@@ -983,8 +983,6 @@ qla2xxx_mqueuecommand(struct Scsi_Host *if (rval !=QLA_SUCCESS ) {ql_dbg (ql_dbg_io + ql_dbg_verbose, vha,0x3078 ,"Start scsi failed rval=%d for cmd=%p.\n" , rval, cmd); -if (rval ==QLA_INTERFACE_ERROR ) - goto qc24_free_sp_fail_command; goto qc24_host_busy_free_sp; }
@@ -996,11 +994,6 @@ qc24_host_busy_free_sp: qc24_target_busy:return SCSI_MLQUEUE_TARGET_BUSY ; -qc24_free_sp_fail_command: - sp->free (sp); -CMD_SP (cmd) =NULL ; -qla2xxx_rel_qpair_sp (sp->qpair, sp); - qc24_fail_command: cmd->scsi_done (cmd);
Greg Kroah-Hartman
maintainerPATCH 14/184 scsi: mpt3sas: Block PCI config access from userspace during reset
In reply to Greg Kroah-HartmanFrom: Sreekanth Reddy <[email protected]>
commit 3c8604691d2acc7b7d4795d9695070de9eaa5828 upstream.
While diag reset is in progress there is short duration where all access to controller's PCI config space from the host needs to be blocked. This is due to a hardware limitation of the IOC controllers.
Block all access to controller's config space from userland applications by calling pci_cfg_access_lock() while diag reset is in progress and unlocking it again after the controller comes back to ready state.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/mpt3sas/mpt3sas_base.c +4 -0
@@ -6572,6 +6572,8 @@ _base_diag_reset(struct MPT3SAS_ADAPTERioc_info (ioc,"sending diag reset !!\n" ); +pci_cfg_access_lock (ioc->pdev); +drsprintk (ioc,ioc_info (ioc,"clear interrupts\n" )); count =0 ;
@@ -6653,10 +6655,12 @@ _base_diag_reset(struct MPT3SAS_ADAPTER goto out; } +pci_cfg_access_unlock (ioc->pdev);ioc_info (ioc,"diag reset: SUCCESS\n" );return 0 ; out: +pci_cfg_access_unlock (ioc->pdev);ioc_err (ioc,"diag reset: FAILED\n" );return -EFAULT ; }
Greg Kroah-Hartman
maintainerPATCH 15/184 mmc: uniphier-sd: Fix an error handling path in uniphier_sd_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit b03aec1c1f337dfdae44cdb0645ecac34208ae0a upstream.
A 'uniphier_sd_clk_enable()' call should be balanced by a corresponding 'uniphier_sd_clk_disable()' call.
This is done in the remove function, but not in the error handling path of the probe.
Add the missing call.
--- drivers/mmc/host/uniphier-sd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/uniphier-sd.c +3 -1
@@ -639,7 +639,7 @@ static int uniphier_sd_probe(struct plat ret =tmio_mmc_host_probe (host);if (ret) - goto free_host; + goto disable_clk; ret =devm_request_irq (dev, irq, tmio_mmc_irq,IRQF_SHARED ,dev_name (dev), host);
@@ -650,6 +650,8 @@ static int uniphier_sd_probe(struct plat remove_host:tmio_mmc_host_remove (host); +disable_clk: +uniphier_sd_clk_disable (host); free_host:tmio_mmc_host_free (host);
Greg Kroah-Hartman
maintainerPATCH 16/184 mmc: uniphier-sd: Fix a resource leak in the remove function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit e29c84857e2d51aa017ce04284b962742fb97d9e upstream.
A 'tmio_mmc_host_free()' call is missing in the remove function, in order to balance a 'tmio_mmc_host_alloc()' call in the probe.
This is done in the error handling path of the probe, but not in the remove function.
Add the missing call.
--- drivers/mmc/host/uniphier-sd.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/uniphier-sd.c +1 -0
@@ -664,6 +664,7 @@ static int uniphier_sd_remove(struct platmio_mmc_host_remove (host);uniphier_sd_clk_disable (host); +tmio_mmc_host_free (host);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 17/184 mmc: sdhci: Check for reset prior to DMA address unmap
In reply to Greg Kroah-HartmanFrom: Pradeep P V K <[email protected]>
commit 21e35e898aa9ef7781632959db8613a5380f2eae upstream.
For data read commands, SDHC may initiate data transfers even before it completely process the command response. In case command itself fails, driver un-maps the memory associated with data transfer but this memory can still be accessed by SDHC for the already initiated data transfer. This scenario can lead to un-mapped memory access error.
To avoid this scenario, reset SDHC (when command fails) prior to un-mapping memory. Resetting SDHC ensures that all in-flight data transfers are either aborted or completed. So we don't run into this scenario.
Swap the reset, un-map steps sequence in sdhci_request_done().
--- drivers/mmc/host/sdhci.c | 60 ++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 29 deletions(-)
drivers/mmc/host/sdhci.c +31 -29
@@ -2648,6 +2648,37 @@ static bool sdhci_request_done(struct sd }/* +* The controller needs a reset of internal state machines +* upon error conditions. +*/ +if (sdhci_needs_reset (host, mrq)) { +/* +* Do not finish until command and data lines are available for +* reset. Note there can only be one other mrq, so it cannot +* also be in mrqs_done, otherwise host->cmd and host->data_cmd +* would both be null. +*/ +if (host->cmd || host->data_cmd) { +spin_unlock_irqrestore (&host->lock, flags); +return true; + } + +/* Some controllers need this kick or reset won't work here */ +if (host->quirks &SDHCI_QUIRK_CLOCK_BEFORE_RESET ) +/* This is to force an update */ + host->ops->set_clock (host, host->clock); + +/* +* Spec says we should do both at the same time, but Ricoh +* controllers do not like that. +*/ +sdhci_do_reset (host,SDHCI_RESET_CMD ); +sdhci_do_reset (host,SDHCI_RESET_DATA ); + + host->pending_reset = false; + } + +/* * Always unmap the data buffers if they were mapped by * sdhci_prepare_data() whenever we finish with a request. * This avoids leaking DMA mappings on error.
@@ -2699,35 +2730,6 @@ static bool sdhci_request_done(struct sd } } -/* -* The controller needs a reset of internal state machines -* upon error conditions. -*/ -if (sdhci_needs_reset (host, mrq)) { -/* -* Do not finish until command and data lines are available for -* reset. Note there can only be one other mrq, so it cannot -* also be in mrqs_done, otherwise host->cmd and host->data_cmd -* would both be null. -*/ -if (host->cmd || host->data_cmd) { -spin_unlock_irqrestore (&host->lock, flags); -return true; - } - -/* Some controllers need this kick or reset won't work here */ -if (host->quirks &SDHCI_QUIRK_CLOCK_BEFORE_RESET ) -/* This is to force an update */ - host->ops->set_clock (host, host->clock); - -/* Spec says we should do both at the same time, but Ricoh -controllers do not like that. */ -sdhci_do_reset (host,SDHCI_RESET_CMD ); -sdhci_do_reset (host,SDHCI_RESET_DATA ); - - host->pending_reset = false; - } - host->mrqs_done[i] =NULL ;spin_unlock_irqrestore (&host->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 18/184 mmc: sdhci-pci: Fix initialization of some SD cards for Intel BYT-based controllers
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 2970134b927834e9249659a70aac48e62dff804a upstream.
Bus power may control card power, but the full reset done by SDHCI at initialization still may not reset the power, whereas a direct write to SDHCI_POWER_CONTROL can. That might be needed to initialize correctly, if the card was left powered on previously.
--- drivers/mmc/host/sdhci-pci-core.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +27 -0
@@ -520,6 +520,7 @@ struct intel_host {int drv_strength;bool d3_retune;bool rpm_retune_ok; +bool needs_pwr_off;u32 glk_rx_ctrl1;u32 glk_tun_val;u32 active_ltr;
@@ -647,9 +648,25 @@ out:static void sdhci_intel_set_power (struct sdhci_host *host,unsigned char mode,unsigned short vdd) { +struct sdhci_pci_slot *slot =sdhci_priv (host); +struct intel_host *intel_host =sdhci_pci_priv (slot);int cntr;u8 reg; +/* +* Bus power may control card power, but a full reset still may not +* reset the power, whereas a direct write to SDHCI_POWER_CONTROL can. +* That might be needed to initialize correctly, if the card was left +* powered on previously. +*/ +if (intel_host->needs_pwr_off) { + intel_host->needs_pwr_off = false; +if (mode !=MMC_POWER_OFF ) { +sdhci_writeb (host,0 ,SDHCI_POWER_CONTROL ); +usleep_range (10000 ,12500 ); + } + } +sdhci_set_power (host, mode, vdd);if (mode ==MMC_POWER_OFF )
@@ -1139,6 +1156,14 @@ static int byt_sdio_probe_slot(struct sdreturn 0 ; } +static void byt_needs_pwr_off (struct sdhci_pci_slot *slot) +{ +struct intel_host *intel_host =sdhci_pci_priv (slot); +u8 reg =sdhci_readb (slot->host,SDHCI_POWER_CONTROL ); + + intel_host->needs_pwr_off = reg &SDHCI_POWER_ON ; +} +static int byt_sd_probe_slot (struct sdhci_pci_slot *slot) {byt_probe_slot (slot);
@@ -1156,6 +1181,8 @@ static int byt_sd_probe_slot(struct sdhc slot->chip->pdev->subsystem_device == PCI_SUBDEVICE_ID_NI_78E3) slot->host->mmc->caps2 |= MMC_CAP2_AVOID_3_3V; +byt_needs_pwr_off (slot); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 19/184 mmc: block: Update ext_csd.cache_ctrl if it was written
In reply to Greg Kroah-HartmanFrom: Avri Altman <[email protected]>
commit aea0440ad023ab0662299326f941214b0d7480bd upstream.
The cache function can be turned ON and OFF by writing to the CACHE_CTRL byte (EXT_CSD byte [33]). However, card->ext_csd.cache_ctrl is only set on init if cache size > 0.
Fix that by explicitly setting ext_csd.cache_ctrl on ext-csd write.
--- drivers/mmc/core/block.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/mmc/core/block.c +12 -0
@@ -622,6 +622,18 @@ static int __mmc_blk_ioctl_cmd(struct mm }/* +* Make sure to update CACHE_CTRL in case it was changed. The cache +* will get turned back on if the card is re-initialized, e.g. +* suspend/resume or hw reset in recovery. +*/ +if ((MMC_EXTRACT_INDEX_FROM_ARG (cmd.arg) ==EXT_CSD_CACHE_CTRL ) && + (cmd.opcode ==MMC_SWITCH )) { +u8 value =MMC_EXTRACT_VALUE_FROM_ARG (cmd.arg) &1 ; + + card->ext_csd.cache_ctrl = value; + } + +/* * According to the SD specs, some commands require a delay after * issuing the command. */
Greg Kroah-Hartman
maintainerPATCH 20/184 mmc: block: Issue a cache flush only when its enabled
In reply to Greg Kroah-HartmanFrom: Avri Altman <[email protected]>
commit 97fce126e279690105ee15be652b465fd96f9997 upstream.
In command queueing mode, the cache isn't flushed via the mmc_flush_cache() function, but instead by issuing a CMDQ_TASK_MGMT (CMD48) with a FLUSH_CACHE opcode. In this path, we need to check if cache has been enabled, before deciding to flush the cache, along the lines of what's being done in mmc_flush_cache().
To fix this problem, let's add a new bus ops callback ->cache_enabled() and implement it for the mmc bus type. In this way, the mmc block device driver can call it to know whether cache flushing should be done.
--- drivers/mmc/core/block.c | 4 ++++ drivers/mmc/core/core.h | 9 +++++++++ drivers/mmc/core/mmc.c | 7 +++++++ drivers/mmc/core/mmc_ops.c | 4 +--- 4 files changed, 21 insertions(+), 3 deletions(-)
drivers/mmc/core/block.c +4 -0
@@ -2227,6 +2227,10 @@ enum mmc_issued mmc_blk_mq_issue_rq(strucase MMC_ISSUE_ASYNC :switch (req_op (req)) {case REQ_OP_FLUSH : +if (!mmc_cache_enabled (host)) { +blk_mq_end_request (req,BLK_STS_OK ); +return MMC_REQ_FINISHED ; + } ret =mmc_blk_cqe_issue_flush (mq, req);break ;case REQ_OP_READ :
drivers/mmc/core/core.h +9 -0
@@ -29,6 +29,7 @@ struct mmc_bus_ops {int (*shutdown)(struct mmc_host *);int (*hw_reset)(struct mmc_host *);int (*sw_reset)(struct mmc_host *); +bool (*cache_enabled)(struct mmc_host *); };void mmc_attach_bus (struct mmc_host *host,const struct mmc_bus_ops *ops);
@@ -171,4 +172,12 @@ static inline void mmc_post_req(struct m host->ops->post_req(host, mrq, err); } +static inline bool mmc_cache_enabled (struct mmc_host *host) +{ +if (host->bus_ops->cache_enabled) +return host->bus_ops->cache_enabled (host); + +return false; +} +#endif
drivers/mmc/core/mmc.c +7 -0
@@ -2019,6 +2019,12 @@ static void mmc_detect(struct mmc_host * } } +static bool _mmc_cache_enabled (struct mmc_host *host) +{ +return host->card->ext_csd.cache_size >0 && + host->card->ext_csd.cache_ctrl &1 ; +} +static int _mmc_suspend (struct mmc_host *host,bool is_suspend) {int err =0 ;
@@ -2197,6 +2203,7 @@ static const struct mmc_bus_ops mmc_ops .alive = mmc_alive, .shutdown = mmc_shutdown, .hw_reset = _mmc_hw_reset, + .cache_enabled = _mmc_cache_enabled, };/*
drivers/mmc/core/mmc_ops.c +1 -3
@@ -959,9 +959,7 @@ int mmc_flush_cache(struct mmc_card *car {int err =0 ; -if (mmc_card_mmc (card) && - (card->ext_csd.cache_size >0 ) && - (card->ext_csd.cache_ctrl &1 )) { +if (mmc_cache_enabled (card->host)) { err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL ,EXT_CSD_FLUSH_CACHE ,1 ,0 );if (err)
Greg Kroah-Hartman
maintainerPATCH 21/184 mmc: core: Do a power cycle when the CMD11 fails
In reply to Greg Kroah-HartmanFrom: DooHyun Hwang <[email protected]>
commit 147186f531ae49c18b7a9091a2c40e83b3d95649 upstream.
A CMD11 is sent to the SD/SDIO card to start the voltage switch procedure into 1.8V I/O. According to the SD spec a power cycle is needed of the card, if it turns out that the CMD11 fails. Let's fix this, to allow a retry of the initialization without the voltage switch, to succeed.
Note that, whether it makes sense to also retry with the voltage switch after the power cycle is a bit more difficult to know. At this point, we treat it like the CMD11 isn't supported and therefore we skip it when retrying.
--- drivers/mmc/core/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/core.c +1 -1
@@ -1221,7 +1221,7 @@ int mmc_set_uhs_voltage(struct mmc_host err =mmc_wait_for_cmd (host, &cmd,0 );if (err) -return err; + goto power_cycle;if (!mmc_host_is_spi (host) && (cmd.resp[0 ] &R1_ERROR ))return -EIO ;
Greg Kroah-Hartman
maintainerPATCH 22/184 mmc: core: Set read only for SD cards with permanent write protect bit
In reply to Greg Kroah-HartmanFrom: Seunghui Lee <[email protected]>
commit 917a5336f2c27928be270226ab374ed0cbf3805d upstream.
Some of SD cards sets permanent write protection bit in their CSD register, due to lifespan or internal problem. To avoid unnecessary I/O write operations, let's parse the bits in the CSD during initialization and mark the card as read only for this case.
--- drivers/mmc/core/sd.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/mmc/core/sd.c +6 -0
@@ -135,6 +135,9 @@ static int mmc_decode_csd(struct mmc_car csd->erase_size =UNSTUFF_BITS (resp,39 ,7 ) +1 ; csd->erase_size <<= csd->write_blkbits -9 ; } + +if (UNSTUFF_BITS (resp,13 ,1 )) +mmc_card_set_readonly (card);break ;case 1 :/*
@@ -169,6 +172,9 @@ static int mmc_decode_csd(struct mmc_car csd->write_blkbits =9 ; csd->write_partial =0 ; csd->erase_size =1 ; + +if (UNSTUFF_BITS (resp,13 ,1 )) +mmc_card_set_readonly (card);break ;default : pr_err("%s: unrecognised CSD structure version %d\n",
Greg Kroah-Hartman
maintainerPATCH 23/184 mmc: core: Fix hanging on I/O during system suspend for removable cards
In reply to Greg Kroah-HartmanFrom: Ulf Hansson <[email protected]>
commit 17a17bf50612e6048a9975450cf1bd30f93815b5 upstream.
The mmc core uses a PM notifier to temporarily during system suspend, turn off the card detection mechanism for removal/insertion of (e)MMC/SD/SDIO cards. Additionally, the notifier may be used to remove an SDIO card entirely, if a corresponding SDIO functional driver don't have the system suspend/resume callbacks assigned. This behaviour has been around for a very long time.
However, a recent bug report tells us there are problems with this approach. More precisely, when receiving the PM_SUSPEND_PREPARE notification, we may end up hanging on I/O to be completed, thus also preventing the system from getting suspended.
In the end what happens, is that the cancel_delayed_work_sync() in mmc_pm_notify() ends up waiting for mmc_rescan() to complete - and since mmc_rescan() wants to claim the host, it needs to wait for the I/O to be completed first.
Typically, this problem is triggered in Android, if there is ongoing I/O while the user decides to suspend, resume and then suspend the system again. This due to that after the resume, an mmc_rescan() work gets punted to the workqueue, which job is to verify that the card remains inserted after the system has resumed.
To fix this problem, userspace needs to become frozen to suspend the I/O, prior to turning off the card detection mechanism. Therefore, let's drop the PM notifiers for mmc subsystem altogether and rely on the card detection to be turned off/on as a part of the system_freezable_wq, that we are already using.
Moreover, to allow and SDIO card to be removed during system suspend, let's manage this from a ->prepare() callback, assigned at the mmc_host_class level. In this way, we can use the parent device (the mmc_host_class device), to remove the card device that is the child, in the device_prepare() phase.
--- drivers/mmc/core/core.c | 74 ----------------------------------------------- drivers/mmc/core/core.h | 8 ----- drivers/mmc/core/host.c | 40 +++++++++++++++++++++++-- drivers/mmc/core/sdio.c | 28 +++++++++++++---- include/linux/mmc/host.h | 3 - 5 files changed, 59 insertions(+), 94 deletions(-)
drivers/mmc/core/core.c +0 -74
@@ -2392,80 +2392,6 @@ void mmc_stop_host(struct mmc_host *hostmmc_release_host (host); } -#ifdef CONFIG_PM_SLEEP -/* Do the card removal on suspend if card is assumed removeable -* Do that in pm notifier while userspace isn't yet frozen, so we will be able -to sync the card. -*/ -static int mmc_pm_notify (struct notifier_block *notify_block, -unsigned long mode,void *unused) -{ -struct mmc_host *host =container_of ( - notify_block, struct mmc_host, pm_notify); -unsigned long flags; -int err =0 ; - -switch (mode) { -case PM_HIBERNATION_PREPARE : -case PM_SUSPEND_PREPARE : -case PM_RESTORE_PREPARE : -spin_lock_irqsave (&host->lock, flags); - host->rescan_disable =1 ; -spin_unlock_irqrestore (&host->lock, flags); -cancel_delayed_work_sync (&host->detect); - -if (!host->bus_ops) -break ; - -/* Validate prerequisites for suspend */ -if (host->bus_ops->pre_suspend) - err = host->bus_ops->pre_suspend (host); -if (!err) -break ; - -if (!mmc_card_is_removable (host)) { -dev_warn (mmc_dev (host), -"pre_suspend failed for non-removable host: " -"%d\n" , err); -/* Avoid removing non-removable hosts */ -break ; - } - -/* Calling bus_ops->remove() with a claimed host can deadlock */ - host->bus_ops->remove (host); -mmc_claim_host (host); -mmc_detach_bus (host); -mmc_power_off (host); -mmc_release_host (host); - host->pm_flags =0 ; -break ; - -case PM_POST_SUSPEND : -case PM_POST_HIBERNATION : -case PM_POST_RESTORE : - -spin_lock_irqsave (&host->lock, flags); - host->rescan_disable =0 ; -spin_unlock_irqrestore (&host->lock, flags); -_mmc_detect_change (host,0 , false); - - } - -return 0 ; -} - -void mmc_register_pm_notifier (struct mmc_host *host) -{ - host->pm_notify.notifier_call = mmc_pm_notify; -register_pm_notifier (&host->pm_notify); -} - -void mmc_unregister_pm_notifier (struct mmc_host *host) -{ -unregister_pm_notifier (&host->pm_notify); -} -#endif -static int __init mmc_init (void ) {int ret;
drivers/mmc/core/core.h +0 -8
@@ -94,14 +94,6 @@ int mmc_execute_tuning(struct mmc_card *int mmc_hs200_to_hs400 (struct mmc_card *card);int mmc_hs400_to_hs200 (struct mmc_card *card); -#ifdef CONFIG_PM_SLEEP -void mmc_register_pm_notifier (struct mmc_host *host); -void mmc_unregister_pm_notifier (struct mmc_host *host); -#else -static inline void mmc_register_pm_notifier (struct mmc_host *host) { } -static inline void mmc_unregister_pm_notifier (struct mmc_host *host) { } -#endif -void mmc_wait_for_req_done (struct mmc_host *host,struct mmc_request *mrq);bool mmc_is_req_done (struct mmc_host *host,struct mmc_request *mrq);
drivers/mmc/core/host.c +37 -3
@@ -33,6 +33,42 @@static DEFINE_IDA (mmc_host_ida); +#ifdef CONFIG_PM_SLEEP +static int mmc_host_class_prepare (struct device *dev) +{ +struct mmc_host *host =cls_dev_to_mmc_host (dev); + +/* +* It's safe to access the bus_ops pointer, as both userspace and the +* workqueue for detecting cards are frozen at this point. +*/ +if (!host->bus_ops) +return 0 ; + +/* Validate conditions for system suspend. */ +if (host->bus_ops->pre_suspend) +return host->bus_ops->pre_suspend (host); + +return 0 ; +} + +static void mmc_host_class_complete (struct device *dev) +{ +struct mmc_host *host =cls_dev_to_mmc_host (dev); + +_mmc_detect_change (host,0 , false); +} + +static const struct dev_pm_ops mmc_host_class_dev_pm_ops = { + .prepare = mmc_host_class_prepare, + .complete = mmc_host_class_complete, +}; + +#define MMC_HOST_CLASS_DEV_PM_OPS (&mmc_host_class_dev_pm_ops) +#else +#define MMC_HOST_CLASS_DEV_PM_OPS NULL +#endif +static void mmc_host_classdev_release (struct device *dev) {struct mmc_host *host =cls_dev_to_mmc_host (dev);
@@ -43,6 +79,7 @@ static void mmc_host_classdev_release(ststatic struct class mmc_host_class = { .name ="mmc_host" , .dev_release = mmc_host_classdev_release, + .pm =MMC_HOST_CLASS_DEV_PM_OPS , };int mmc_register_host_class (void )
@@ -477,8 +514,6 @@ int mmc_add_host(struct mmc_host *host)#endif mmc_start_host (host); -mmc_register_pm_notifier (host); -return 0 ; }
@@ -494,7 +529,6 @@ EXPORT_SYMBOL(mmc_add_host);*/ void mmc_remove_host (struct mmc_host *host) { -mmc_unregister_pm_notifier (host);mmc_stop_host (host);#ifdef CONFIG_DEBUG_FS
drivers/mmc/core/sdio.c +22 -6
@@ -924,21 +924,37 @@ out:*/ static int mmc_sdio_pre_suspend (struct mmc_host *host) { -int i, err =0 ; +int i;for (i =0 ; i < host->card->sdio_funcs; i++) {struct sdio_func *func = host->card->sdio_func[i];if (func &&sdio_func_present (func) && func->dev.driver) {const struct dev_pm_ops *pmops = func->dev.driver->pm; -if (!pmops || !pmops->suspend || !pmops->resume) { +if (!pmops || !pmops->suspend || !pmops->resume)/* force removal of entire card in that case */ - err = -ENOSYS ; -break ; - } + goto remove; } } -return err; +return 0 ; + +remove: +if (!mmc_card_is_removable (host)) { +dev_warn (mmc_dev (host), +"missing suspend/resume ops for non-removable SDIO card\n" ); +/* Don't remove a non-removable card - we can't re-detect it. */ +return 0 ; + } + +/* Remove the SDIO card and let it be re-detected later on. */ +mmc_sdio_remove (host); +mmc_claim_host (host); +mmc_detach_bus (host); +mmc_power_off (host); +mmc_release_host (host); + host->pm_flags =0 ; + +return 0 ; }/*
include/linux/mmc/host.h +0 -3
@@ -281,9 +281,6 @@ struct mmc_host {u32 ocr_avail_sdio;/* SDIO-specific OCR */ u32 ocr_avail_sd;/* SD-specific OCR */ u32 ocr_avail_mmc;/* MMC-specific OCR */ -#ifdef CONFIG_PM_SLEEP -struct notifier_block pm_notify; -#endif u32 max_current_330;u32 max_current_300;u32 max_current_180;
Greg Kroah-Hartman
maintainerPATCH 24/184 modules: mark ref_module static
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
commit 7ef5264de773279b9f23b6cc8afb5addb30e970b upstream.
ref_module isn't used anywhere outside of module.c.
--- include/linux/module.h | 1 - kernel/module.c | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-)
include/linux/module.h +0 -1
@@ -636,7 +636,6 @@ static inline void __module_get(struct m#define symbol_put_addr (p) do { } while (0)#endif /* CONFIG_MODULE_UNLOAD */ -int ref_module (struct module *a,struct module *b);/* This is a #define so the string doesn't get put in every .o file */ #define module_name (mod) \
kernel/module.c +2 -4
@@ -867,7 +867,7 @@ static int add_module_usage(struct modul }/* Module a uses b: caller needs module_mutex() */ -int ref_module (struct module *a,struct module *b) +static int ref_module (struct module *a,struct module *b) {int err;
@@ -886,7 +886,6 @@ int ref_module(struct module *a, struct }return 0 ; } -EXPORT_SYMBOL_GPL (ref_module);/* Clear the unload stuff of the module. */ static void module_unload_free (struct module *mod)
@@ -1167,11 +1166,10 @@ static inline void module_unload_free(st { } -int ref_module (struct module *a,struct module *b) +static int ref_module (struct module *a,struct module *b) {return strong_try_module_get (b); } -EXPORT_SYMBOL_GPL (ref_module);static inline int module_unload_init (struct module *mod) {
Greg Kroah-Hartman
maintainerPATCH 25/184 modules: mark find_symbol static
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
commit 773110470e2fa3839523384ae014f8a723c4d178 upstream.
find_symbol is only used in module.c.
--- include/linux/module.h | 11 ----------- kernel/module.c | 3 +-- 2 files changed, 1 insertion(+), 13 deletions(-)
include/linux/module.h +0 -11
@@ -570,17 +570,6 @@ struct symsearch { };/* -* Search for an exported symbol by name. -* -* Must be called with module_mutex held or preemption disabled. -*/ -const struct kernel_symbol *find_symbol (const char *name, -struct module **owner, -const s32 **crc, -bool gplok, -bool warn); - -/* * Walk the exported symbol table * * Must be called with module_mutex held or preemption disabled.
kernel/module.c +1 -2
@@ -583,7 +583,7 @@ static bool find_exported_symbol_in_sect/* Find an exported symbol and return it, along with, (optional) crc and * (optional) module which owns it. Needs preempt disabled or module_mutex. */ -const struct kernel_symbol *find_symbol(const char *name, +static const struct kernel_symbol *find_symbol(const char *name, struct module **owner, const s32 **crc, bool gplok,
@@ -606,7 +606,6 @@ const struct kernel_symbol *find_symbol(pr_debug ("Failed to find symbol %s\n" , name);return NULL ; } -EXPORT_SYMBOL_GPL (find_symbol);/* * Search for module by name: must hold module_mutex (or preempt disabled
Greg Kroah-Hartman
maintainerPATCH 26/184 modules: mark each_symbol_section static
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
commit a54e04914c211b5678602a46b3ede5d82ec1327d upstream.
each_symbol_section is only used inside of module.c.
--- include/linux/module.h | 9 --------- kernel/module.c | 3 +-- 2 files changed, 1 insertion(+), 11 deletions(-)
include/linux/module.h +0 -9
@@ -569,15 +569,6 @@ struct symsearch {bool unused; }; -/* -* Walk the exported symbol table -* -* Must be called with module_mutex held or preemption disabled. -*/ -bool each_symbol_section (bool (*fn)(const struct symsearch *arr, -struct module *owner, -void *data),void *data); -/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if symnum out of range. */ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
kernel/module.c +1 -2
@@ -420,7 +420,7 @@ static bool each_symbol_in_section(const }/* Returns true as soon as fn returns true, otherwise false. */ -bool each_symbol_section (bool (*fn)(const struct symsearch *arr, +static bool each_symbol_section (bool (*fn)(const struct symsearch *arr,struct module *owner,void *data),void *data)
@@ -482,7 +482,6 @@ bool each_symbol_section(bool (*fn)(cons }return false; } -EXPORT_SYMBOL_GPL (each_symbol_section);struct find_symbol_arg {/* Input */
Greg Kroah-Hartman
maintainerPATCH 27/184 modules: unexport __module_text_address
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
commit 3fe1e56d0e68b623dd62d8d38265d2a052e7e185 upstream.
__module_text_address is only used by built-in code.
--- kernel/module.c | 1 - 1 file changed, 1 deletion(-)
kernel/module.c +0 -1
@@ -4655,7 +4655,6 @@ struct module *__module_text_address(uns }return mod; } -EXPORT_SYMBOL_GPL (__module_text_address);/* Don't grab lock, we're oopsing. */ void print_modules (void )
Greg Kroah-Hartman
maintainerPATCH 28/184 modules: unexport __module_address
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
commit 34e64705ad415ed7a816e60ef62b42fe6d1729d9 upstream.
__module_address is only used by built-in code.
--- kernel/module.c | 1 - 1 file changed, 1 deletion(-)
kernel/module.c +0 -1
@@ -4616,7 +4616,6 @@ struct module *__module_address(unsigned }return mod; } -EXPORT_SYMBOL_GPL (__module_address);/* * is_module_text_address - is this address inside module code?
Greg Kroah-Hartman
maintainerPATCH 29/184 modules: rename the licence field in struct symsearch to license
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
commit cd8732cdcc37d7077c4fa2c966b748c0662b607e upstream.
Use the same spelling variant as the rest of the file.
--- include/linux/module.h | 2 +- kernel/module.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
include/linux/module.h +1 -1
@@ -565,7 +565,7 @@ struct symsearch {NOT_GPL_ONLY ,GPL_ONLY ,WILL_BE_GPL_ONLY , - } licence; + } license;bool unused; };
kernel/module.c +2 -2
@@ -502,9 +502,9 @@ static bool check_exported_symbol(conststruct find_symbol_arg *fsa = data;if (!fsa->gplok) { -if (syms->licence ==GPL_ONLY ) +if (syms->license ==GPL_ONLY )return false; -if (syms->licence ==WILL_BE_GPL_ONLY && fsa->warn) { +if (syms->license ==WILL_BE_GPL_ONLY && fsa->warn) {pr_warn ("Symbol %s is being used by a non-GPL module, " "which will not be allowed in the future\n" , fsa->name);
Greg Kroah-Hartman
maintainerPATCH 30/184 modules: return licensing information from find_symbol
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
commit ef1dac6021cc8ec5de02ce31722bf26ac4ed5523 upstream.
Report the GPLONLY status through a new argument.
--- include/linux/module.h | 2 +- kernel/module.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-)
include/linux/module.h +1 -1
@@ -561,7 +561,7 @@ struct module *find_module(const char *nstruct symsearch {const struct kernel_symbol *start, *stop;const s32 *crcs; -enum { +enum mod_license {NOT_GPL_ONLY ,GPL_ONLY ,WILL_BE_GPL_ONLY ,
kernel/module.c +11 -5
@@ -493,6 +493,7 @@ struct find_symbol_arg {struct module *owner;const s32 *crc;const struct kernel_symbol *sym; +enum mod_license license; }; static bool check_exported_symbol(const struct symsearch *syms,
@@ -526,6 +527,7 @@ static bool check_exported_symbol(const fsa->owner = owner; fsa->crc =symversion (syms->crcs, symnum); fsa->sym = &syms->start[symnum]; + fsa->license = syms->license;return true; }
@@ -585,6 +587,7 @@ static bool find_exported_symbol_in_sectstatic const struct kernel_symbol *find_symbol (const char *name,struct module **owner,const s32 **crc, +enum mod_license *license,bool gplok,bool warn) {
@@ -599,6 +602,8 @@ static const struct kernel_symbol *find_ *owner = fsa.owner;if (crc) *crc = fsa.crc; +if (license) + *license = fsa.license;return fsa.sym; }
@@ -1072,7 +1077,7 @@ void __symbol_put(const char *symbol)struct module *owner;preempt_disable (); -if (!find_symbol (symbol, &owner,NULL , true, false)) +if (!find_symbol (symbol, &owner,NULL ,NULL , true, false))BUG ();module_put (owner);preempt_enable ();
@@ -1350,7 +1355,7 @@ static inline int check_modstruct_versio* locking is necessary -- use preempt_disable() to placate lockdep. */ preempt_disable (); -if (!find_symbol ("module_layout" ,NULL , &crc, true, false)) { +if (!find_symbol ("module_layout" ,NULL , &crc,NULL , true, false)) {preempt_enable ();BUG (); }
@@ -1434,6 +1439,7 @@ static const struct kernel_symbol *resolstruct module *owner;const struct kernel_symbol *sym;const s32 *crc; +enum mod_license license;int err;/*
@@ -1443,7 +1449,7 @@ static const struct kernel_symbol *resol*/ sched_annotate_sleep ();mutex_lock (&module_mutex); - sym =find_symbol (name, &owner, &crc, + sym =find_symbol (name, &owner, &crc, &license, !(mod->taints & (1 <<TAINT_PROPRIETARY_MODULE )), true);if (!sym) goto unlock;
@@ -2258,7 +2264,7 @@ void *__symbol_get(const char *symbol)const struct kernel_symbol *sym;preempt_disable (); - sym =find_symbol (symbol, &owner,NULL , true, true); + sym =find_symbol (symbol, &owner,NULL ,NULL , true, true);if (sym &&strong_try_module_get (owner)) sym =NULL ;preempt_enable ();
@@ -2294,7 +2300,7 @@ static int verify_exported_symbols(strucfor (i =0 ; i <ARRAY_SIZE (arr); i++) {for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) {if (find_symbol (kernel_symbol_name (s), &owner,NULL , - true, false)) { +NULL , true, false)) { pr_err("%s: exports duplicate symbol %s" " (owned by %s)\n", mod->name, kernel_symbol_name(s),
Greg Kroah-Hartman
maintainerPATCH 31/184 modules: inherit TAINT_PROPRIETARY_MODULE
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
commit 262e6ae7081df304fc625cf368d5c2cbba2bb991 upstream.
If a TAINT_PROPRIETARY_MODULE exports symbol, inherit the taint flag for all modules importing these symbols, and don't allow loading symbols from TAINT_PROPRIETARY_MODULE modules if the module previously imported gplonly symbols. Add a anti-circumvention devices so people don't accidentally get themselves into trouble this way.
Comment from Greg:
"Ah, the proven-to-be-illegal "GPL Condom" defense :)"
--- include/linux/module.h | 1 + kernel/module.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+)
include/linux/module.h +1 -0
@@ -376,6 +376,7 @@ struct module {unsigned int num_gpl_syms;const struct kernel_symbol *gpl_syms;const s32 *gpl_crcs; +bool using_gplonly_symbols;#ifdef CONFIG_UNUSED_SYMBOLS /* unused exported symbols. */
kernel/module.c +26 -0
@@ -1429,6 +1429,24 @@ static int verify_namespace_is_imported(return 0 ; } +static bool inherit_taint (struct module *mod,struct module *owner) +{ +if (!owner || !test_bit (TAINT_PROPRIETARY_MODULE , &owner->taints)) +return true; + +if (mod->using_gplonly_symbols) { +pr_err ("%s: module using GPL-only symbols uses symbols from proprietary module %s.\n" , + mod->name, owner->name); +return false; + } + +if (!test_bit (TAINT_PROPRIETARY_MODULE , &mod->taints)) { +pr_warn ("%s: module uses symbols from proprietary module %s, inheriting taint.\n" , + mod->name, owner->name); +set_bit (TAINT_PROPRIETARY_MODULE , &mod->taints); + } +return true; +}/* Resolve a symbol for this module. I.e. if we find one, record usage. */ static const struct kernel_symbol *resolve_symbol(struct module *mod,
@@ -1454,6 +1472,14 @@ static const struct kernel_symbol *resolif (!sym) goto unlock; +if (license ==GPL_ONLY ) + mod->using_gplonly_symbols = true; + +if (!inherit_taint (mod, owner)) { + sym =NULL ; + goto getname; + } +if (!check_version (info, name, mod, crc)) { sym =ERR_PTR (-EINVAL ); goto getname;
Re: [PATCH 5.4 031/184] modules: inherit TAINT_PROPRIETARY_MODULE
Quoted 4 lines · Greg Kroah-Hartman
From: Christoph Hellwig <[email protected]>
commit
262e6ae7081df304fc625cf368d5c2cbba2bb991upstream.
Quoted 8 lines
If a
TAINT_PROPRIETARY_MODULEexports symbol, inherit the taint flag for all modules importing these symbols, and don't allow loading symbols fromTAINT_PROPRIETARY_MODULEmodules if the module previously imported gplonly symbols. Add a anti-circumvention devices so people don't accidentally get themselves into trouble this way.Comment from Greg:
"Ah, the proven-to-be-illegal "GPL Condom" defense :)"
Patch got in to stable, so my comments are quite late, but can someone explain me - how this is a stable material? What specific, real bug that bothers people, is being fixed here? Or maybe it fixes serious issue reported by a user of distribution kernel? IOW, how does this match stable kernel rules at all?
For sure it breaks some out-of-tree modules already present and used by customers of downstream stable kernels. Therefore I wonder what is the bug fixed here, so the breakage and annoyance of stable users is justified.
Quoted 8 lines
[jeyu: pr_info -> pr_err and pr_warn as per discussion]Acked-by Daniel Vetter <[email protected]>Reviewed-by Greg Kroah-Hartman <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>Signed-off-by Jessica Yu <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Best regards,
Krzysztof
Re: [PATCH 5.4 031/184] modules: inherit TAINT_PROPRIETARY_MODULE
Quoted 20 lines · Krzysztof Kozlowski
Quoted 4 lines · Greg Kroah-Hartman
From: Christoph Hellwig <[email protected]>
commit
262e6ae7081df304fc625cf368d5c2cbba2bb991upstream.Quoted 8 lines
If a
TAINT_PROPRIETARY_MODULEexports symbol, inherit the taint flag for all modules importing these symbols, and don't allow loading symbols fromTAINT_PROPRIETARY_MODULEmodules if the module previously imported gplonly symbols. Add a anti-circumvention devices so people don't accidentally get themselves into trouble this way.Comment from Greg:
"Ah, the proven-to-be-illegal "GPL Condom" defense :)"Patch got in to stable, so my comments are quite late, but can someone explain me - how this is a stable material? What specific, real bug that bothers people, is being fixed here? Or maybe it fixes serious issue reported by a user of distribution kernel? IOW, how does this match stable kernel rules at all?
Quoted 3 lines
For sure it breaks some out-of-tree modules already present and used by customers of downstream stable kernels. Therefore I wonder what is the bug fixed here, so the breakage and annoyance of stable users is justified.
And for the record I am not talking about this patch only. I am asking also what serious or real bug is being fixed by:
"modules: mark find_symbol staticfind_symbol is only used in module.c."
I would be really happy to extend my knowledge about real bugs faced by people, where the fix is to un-export unused symbol. It must have been very interesting, real bug bothering people. :)
Best regards,
Krzysztof
Greg Kroah-Hartman
maintainerRe: [PATCH 5.4 031/184] modules: inherit TAINT_PROPRIETARY_MODULE
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Krzysztof Kozlowski
Quoted 4 lines · Greg Kroah-Hartman
From: Christoph Hellwig <[email protected]>
commit
262e6ae7081df304fc625cf368d5c2cbba2bb991upstream.Quoted 8 lines
If a
TAINT_PROPRIETARY_MODULEexports symbol, inherit the taint flag for all modules importing these symbols, and don't allow loading symbols fromTAINT_PROPRIETARY_MODULEmodules if the module previously imported gplonly symbols. Add a anti-circumvention devices so people don't accidentally get themselves into trouble this way.Comment from Greg:
"Ah, the proven-to-be-illegal "GPL Condom" defense :)"Patch got in to stable, so my comments are quite late, but can someone explain me - how this is a stable material? What specific, real bug that bothers people, is being fixed here? Or maybe it fixes serious issue reported by a user of distribution kernel? IOW, how does this match stable kernel rules at all?
Quoted 8 lines
Quoted 3 lines
For sure it breaks some out-of-tree modules already present and used by customers of downstream stable kernels. Therefore I wonder what is the bug fixed here, so the breakage and annoyance of stable users is justified.
And for the record I am not talking about this patch only. I am asking also what serious or real bug is being fixed by:
"modules: markfind_symbolstaticfind_symbolis only used inmodule.c."
That was part of the patch series, I needed pretty much the whole thing to be able to apply them cleanly. We always try to match what is in Linus's tree exactly so we can correctly track things, one-off backports are almost always broken and wrong.
And no one should be ever using find_symbol(), that's just a given.
thanks,
greg k-h
RE: [PATCH 5.4 031/184] modules: inherit TAINT_PROPRIETARY_MODULE
In reply to Krzysztof KozlowskiFrom: Krzysztof Kozlowski
Quoted 22 lines
Sent: 18 June 2021 09:57
Quoted 4 lines · Greg Kroah-Hartman
From: Christoph Hellwig <[email protected]>
commit
262e6ae7081df304fc625cf368d5c2cbba2bb991upstream.Quoted 8 lines
If a
TAINT_PROPRIETARY_MODULEexports symbol, inherit the taint flag for all modules importing these symbols, and don't allow loading symbols fromTAINT_PROPRIETARY_MODULEmodules if the module previously imported gplonly symbols. Add a anti-circumvention devices so people don't accidentally get themselves into trouble this way.Comment from Greg:
"Ah, the proven-to-be-illegal "GPL Condom" defense :)"Patch got in to stable, so my comments are quite late, but can someone explain me - how this is a stable material? What specific, real bug that bothers people, is being fixed here? Or maybe it fixes serious issue reported by a user of distribution kernel? IOW, how does this match stable kernel rules at all?
Quoted 3 lines
For sure it breaks some out-of-tree modules already present and used by customers of downstream stable kernels. Therefore I wonder what is the bug fixed here, so the breakage and annoyance of stable users is justified.
It also doesn't stop non-gpl out-of-tree modules doing anything. They just have to be reorganized with a 'base' GPL module that includes wrappers for all the gplonly symbols and then all the rest of the modules can be non-gpl.
This means that drivers that were marked gpl no longer need to be because they now use the wrappers.
So it is just an annoyance.
Fortunately our main out-of-tree drivers don't use any GPL bits at all - so this change doesn't affect our customer releases.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Greg Kroah-Hartman
maintainerRe: [PATCH 5.4 031/184] modules: inherit TAINT_PROPRIETARY_MODULE
Quoted 23 lines · David Laight
From: Krzysztof Kozlowski
Quoted 22 lines
Sent: 18 June 2021 09:57
Quoted 4 lines · Greg Kroah-Hartman
From: Christoph Hellwig <[email protected]>
commit
262e6ae7081df304fc625cf368d5c2cbba2bb991upstream.Quoted 8 lines
If a
TAINT_PROPRIETARY_MODULEexports symbol, inherit the taint flag for all modules importing these symbols, and don't allow loading symbols fromTAINT_PROPRIETARY_MODULEmodules if the module previously imported gplonly symbols. Add a anti-circumvention devices so people don't accidentally get themselves into trouble this way.Comment from Greg:
"Ah, the proven-to-be-illegal "GPL Condom" defense :)"Patch got in to stable, so my comments are quite late, but can someone explain me - how this is a stable material? What specific, real bug that bothers people, is being fixed here? Or maybe it fixes serious issue reported by a user of distribution kernel? IOW, how does this match stable kernel rules at all?
Quoted 8 lines
Quoted 3 lines
For sure it breaks some out-of-tree modules already present and used by customers of downstream stable kernels. Therefore I wonder what is the bug fixed here, so the breakage and annoyance of stable users is justified.
It also doesn't stop non-gpl out-of-tree modules doing anything. They just have to be reorganized with a 'base' GPL module that includes wrappers for all the gplonly symbols and then all the rest of the modules can be non-gpl.
Ah, the "gpl condom defense". Love it that you somehow think that is acceptable (hint, it is not.)
That's what this patch series is supposed to be addressing and fixing,
but someone has shown me a way around this. I'll work on fixing that
up in a future patch series next week.
thanks,
greg k-h
Re: [PATCH 5.4 031/184] modules: inherit TAINT_PROPRIETARY_MODULE
Quoted 33 lines · Greg Kroah-Hartman
Quoted 23 lines · David Laight
From: Krzysztof Kozlowski
Quoted 22 lines
Sent: 18 June 2021 09:57
Quoted 4 lines · Greg Kroah-Hartman
From: Christoph Hellwig <[email protected]>
commit
262e6ae7081df304fc625cf368d5c2cbba2bb991upstream.Quoted 8 lines
If a
TAINT_PROPRIETARY_MODULEexports symbol, inherit the taint flag for all modules importing these symbols, and don't allow loading symbols fromTAINT_PROPRIETARY_MODULEmodules if the module previously imported gplonly symbols. Add a anti-circumvention devices so people don't accidentally get themselves into trouble this way.Comment from Greg:
"Ah, the proven-to-be-illegal "GPL Condom" defense :)"Patch got in to stable, so my comments are quite late, but can someone explain me - how this is a stable material? What specific, real bug that bothers people, is being fixed here? Or maybe it fixes serious issue reported by a user of distribution kernel? IOW, how does this match stable kernel rules at all?
Quoted 8 lines
Quoted 3 lines
For sure it breaks some out-of-tree modules already present and used by customers of downstream stable kernels. Therefore I wonder what is the bug fixed here, so the breakage and annoyance of stable users is justified.
It also doesn't stop non-gpl out-of-tree modules doing anything. They just have to be reorganized with a 'base' GPL module that includes wrappers for all the gplonly symbols and then all the rest of the modules can be non-gpl.
Quoted 6 lines
Ah, the "gpl condom defense". Love it that you somehow think that is acceptable (hint, it is not.)
That's what this patch series is supposed to be addressing and fixing,
but someone has shown me a way around this. I'll work on fixing that
up in a future patch series next week.
Greg, for real, no one argues with the patch in the mainline. But what is the justification for stable kernel backport? How does it match the rules of stable kernels?
Best regards,
Krzysztof
Greg Kroah-Hartman
maintainerRe: [PATCH 5.4 031/184] modules: inherit TAINT_PROPRIETARY_MODULE
In reply to Krzysztof KozlowskiQuoted 20 lines · Krzysztof Kozlowski
Quoted 4 lines · Greg Kroah-Hartman
From: Christoph Hellwig <[email protected]>
commit
262e6ae7081df304fc625cf368d5c2cbba2bb991upstream.Quoted 8 lines
If a
TAINT_PROPRIETARY_MODULEexports symbol, inherit the taint flag for all modules importing these symbols, and don't allow loading symbols fromTAINT_PROPRIETARY_MODULEmodules if the module previously imported gplonly symbols. Add a anti-circumvention devices so people don't accidentally get themselves into trouble this way.Comment from Greg:
"Ah, the proven-to-be-illegal "GPL Condom" defense :)"Patch got in to stable, so my comments are quite late, but can someone explain me - how this is a stable material? What specific, real bug that bothers people, is being fixed here? Or maybe it fixes serious issue reported by a user of distribution kernel? IOW, how does this match stable kernel rules at all?
Quoted 3 lines
For sure it breaks some out-of-tree modules already present and used by customers of downstream stable kernels. Therefore I wonder what is the bug fixed here, so the breakage and annoyance of stable users is justified.
It fixes a reported bug in that somehow symbols are being exported to modules that should not have been. This has been in mainline and newer stable releases for quite some time, it should not be a suprise that this was backported further as well.
thanks,
greg k-h
Re: [PATCH 5.4 031/184] modules: inherit TAINT_PROPRIETARY_MODULE
Quoted 21 lines · Greg Kroah-Hartman
Quoted 20 lines · Krzysztof Kozlowski
Quoted 4 lines · Greg Kroah-Hartman
From: Christoph Hellwig <[email protected]>
commit
262e6ae7081df304fc625cf368d5c2cbba2bb991upstream.Quoted 8 lines
If a
TAINT_PROPRIETARY_MODULEexports symbol, inherit the taint flag for all modules importing these symbols, and don't allow loading symbols fromTAINT_PROPRIETARY_MODULEmodules if the module previously imported gplonly symbols. Add a anti-circumvention devices so people don't accidentally get themselves into trouble this way.Comment from Greg:
"Ah, the proven-to-be-illegal "GPL Condom" defense :)"Patch got in to stable, so my comments are quite late, but can someone explain me - how this is a stable material? What specific, real bug that bothers people, is being fixed here? Or maybe it fixes serious issue reported by a user of distribution kernel? IOW, how does this match stable kernel rules at all?
Quoted 8 lines
Quoted 3 lines
For sure it breaks some out-of-tree modules already present and used by customers of downstream stable kernels. Therefore I wonder what is the bug fixed here, so the breakage and annoyance of stable users is justified.
It fixes a reported bug in that somehow symbols are being exported to modules that should not have been. This has been in mainline and newer stable releases for quite some time, it should not be a suprise that this was backported further as well.
This is vague. What exactly is the bug? How exporting symbols which should not be exported, causes it? Is there OOPs? Some feature does not work?
Best regards,
Krzysztof
Greg Kroah-Hartman
maintainerRe: [PATCH 5.4 031/184] modules: inherit TAINT_PROPRIETARY_MODULE
Quoted 26 lines · Krzysztof Kozlowski
Quoted 25 lines · Greg Kroah-Hartman
Quoted 23 lines · Krzysztof Kozlowski
Quoted 4 lines · Greg Kroah-Hartman
From: Christoph Hellwig <[email protected]>
commit
262e6ae7081df304fc625cf368d5c2cbba2bb991upstream.Quoted 8 lines
If a
TAINT_PROPRIETARY_MODULEexports symbol, inherit the taint flag for all modules importing these symbols, and don't allow loading symbols fromTAINT_PROPRIETARY_MODULEmodules if the module previously imported gplonly symbols. Add a anti-circumvention devices so people don't accidentally get themselves into trouble this way.Comment from Greg:
"Ah, the proven-to-be-illegal "GPL Condom" defense :)"Patch got in to stable, so my comments are quite late, but can someone explain me - how this is a stable material? What specific, real bug that bothers people, is being fixed here? Or maybe it fixes serious issue reported by a user of distribution kernel? IOW, how does this match stable kernel rules at all?
For sure it breaks some out-of-tree modules already present and used by customers of downstream stable kernels. Therefore I wonder what is the bug fixed here, so the breakage and annoyance of stable users is justified.
Quoted 8 lines
Quoted 4 lines
It fixes a reported bug in that somehow symbols are being exported to modules that should not have been. This has been in mainline and newer stable releases for quite some time, it should not be a suprise that this was backported further as well.
This is vague. What exactly is the bug? How exporting symbols which should not be exported, causes it? Is there OOPs? Some feature does not work?
The bug/issue is that symbols were being incorrectly exported in ways that they should not have been and were available to users that should not have been able to use them. That is what this patch series resolves. I can go into details but they are boring and deal with closed source monstrosities that feel they are allowed to muck around in kernel internals at will, which causes a support burden on the kernel community.
If you object to this, that's fine, you are free to revert them in your local distro kernel after discussing it with your lawyers to get their approval to do so.
thanks,
greg k-h
Re: [PATCH 5.4 031/184] modules: inherit TAINT_PROPRIETARY_MODULE
Quoted 36 lines · Greg Kroah-Hartman
Quoted 26 lines · Krzysztof Kozlowski
Quoted 25 lines · Greg Kroah-Hartman
Quoted 23 lines · Krzysztof Kozlowski
Quoted 4 lines · Greg Kroah-Hartman
From: Christoph Hellwig <[email protected]>
commit
262e6ae7081df304fc625cf368d5c2cbba2bb991upstream.Quoted 8 lines
If a
TAINT_PROPRIETARY_MODULEexports symbol, inherit the taint flag for all modules importing these symbols, and don't allow loading symbols fromTAINT_PROPRIETARY_MODULEmodules if the module previously imported gplonly symbols. Add a anti-circumvention devices so people don't accidentally get themselves into trouble this way.Comment from Greg:
"Ah, the proven-to-be-illegal "GPL Condom" defense :)"Patch got in to stable, so my comments are quite late, but can someone explain me - how this is a stable material? What specific, real bug that bothers people, is being fixed here? Or maybe it fixes serious issue reported by a user of distribution kernel? IOW, how does this match stable kernel rules at all?
For sure it breaks some out-of-tree modules already present and used by customers of downstream stable kernels. Therefore I wonder what is the bug fixed here, so the breakage and annoyance of stable users is justified.
Quoted 8 lines
Quoted 4 lines
It fixes a reported bug in that somehow symbols are being exported to modules that should not have been. This has been in mainline and newer stable releases for quite some time, it should not be a suprise that this was backported further as well.
This is vague. What exactly is the bug? How exporting symbols which should not be exported, causes it? Is there OOPs? Some feature does not work?
Quoted 7 lines
The bug/issue is that symbols were being incorrectly exported in ways that they should not have been and were available to users that should not have been able to use them. That is what this patch series resolves. I can go into details but they are boring and deal with closed source monstrosities that feel they are allowed to muck around in kernel internals at will, which causes a support burden on the kernel community.
Thanks Greg, I would prefer honest "we don't want others to do something we don't like or approve and we can change it" :)
Quoted 3 lines
If you object to this, that's fine, you are free to revert them in your local distro kernel after discussing it with your lawyers to get their approval to do so.
Best regards,
Krzysztof
Greg Kroah-Hartman
maintainerPATCH 32/184 irqchip/gic-v3: Do not enable irqs when handling spurious interrups
In reply to Greg Kroah-HartmanFrom: He Ying <[email protected]>
commit a97709f563a078e259bf0861cd259aa60332890a upstream.
We triggered the following error while running our 4.19 kernel with the pseudo-NMI patches backported to it:
[ 14.816231] ------------[ cut here ]------------ [ 14.816231] kernel BUG at irq.c:99! [ 14.816232] Internal error: Oops - BUG: 0 [#1] SMP [ 14.816232] Process swapper/0 (pid: 0, stack limit = 0x(____ptrval____)) [ 14.816233] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G O 4.19.95.aarch64 #14 [ 14.816233] Hardware name: evb (DT) [ 14.816234] pstate: 80400085 (Nzcv daIf +PAN -UAO) [ 14.816234] pc : asm_nmi_enter+0x94/0x98 [ 14.816235] lr : asm_nmi_enter+0x18/0x98 [ 14.816235] sp : ffff000008003c50 [ 14.816235] pmr_save: 00000070 [ 14.816237] x29: ffff000008003c50 x28: ffff0000095f56c0 [ 14.816238] x27: 0000000000000000 x26: ffff000008004000 [ 14.816239] x25: 00000000015e0000 x24: ffff8008fb916000 [ 14.816240] x23: 0000000020400005 x22: ffff0000080817cc [ 14.816241] x21: ffff000008003da0 x20: 0000000000000060 [ 14.816242] x19: 00000000000003ff x18: ffffffffffffffff [ 14.816243] x17: 0000000000000008 x16: 003d090000000000 [ 14.816244] x15: ffff0000095ea6c8 x14: ffff8008fff5ab40 [ 14.816244] x13: ffff8008fff58b9d x12: 0000000000000000 [ 14.816245] x11: ffff000008c8a200 x10: 000000008e31fca5 [ 14.816246] x9 : ffff000008c8a208 x8 : 000000000000000f [ 14.816247] x7 : 0000000000000004 x6 : ffff8008fff58b9e [ 14.816248] x5 : 0000000000000000 x4 : 0000000080000000 [ 14.816249] x3 : 0000000000000000 x2 : 0000000080000000 [ 14.816250] x1 : 0000000000120000 x0 : ffff0000095f56c0 [ 14.816251] Call trace: [ 14.816251] asm_nmi_enter+0x94/0x98 [ 14.816251] el1_irq+0x8c/0x180 (IRQ C) [ 14.816252] gic_handle_irq+0xbc/0x2e4 [ 14.816252] el1_irq+0xcc/0x180 (IRQ B) [ 14.816253] arch_timer_handler_virt+0x38/0x58 [ 14.816253] handle_percpu_devid_irq+0x90/0x240 [ 14.816253] generic_handle_irq+0x34/0x50 [ 14.816254] __handle_domain_irq+0x68/0xc0 [ 14.816254] gic_handle_irq+0xf8/0x2e4 [ 14.816255] el1_irq+0xcc/0x180 (IRQ A) [ 14.816255] arch_cpu_idle+0x34/0x1c8 [ 14.816255] default_idle_call+0x24/0x44 [ 14.816256] do_idle+0x1d0/0x2c8 [ 14.816256] cpu_startup_entry+0x28/0x30 [ 14.816256] rest_init+0xb8/0xc8 [ 14.816257] start_kernel+0x4c8/0x4f4 [ 14.816257] Code: 940587f1 d5384100 b9401001 36a7fd01 (d4210000) [ 14.816258] Modules linked in: start_dp(O) smeth(O) [ 15.103092] ---[ end trace 701753956cb14aa8 ]--- [ 15.103093] Kernel panic - not syncing: Fatal exception in interrupt [ 15.103099] SMP: stopping secondary CPUs [ 15.103100] Kernel Offset: disabled [ 15.103100] CPU features: 0x36,a2400218 [ 15.103100] Memory Limit: none
which is cause by a 'BUG_ON(in_nmi())' in nmi_enter().
Quoted 1 line
From the call trace, we can find three interrupts (noted A, B, C above):
interrupt (A) is preempted by (B), which is further interrupted by (C).
Subsequent investigations show that (B) results in nmi_enter() being called, but that it actually is a spurious interrupt. Furthermore, interrupts are reenabled in the context of (B), and (C) fires with NMI priority. We end-up with a nested NMI situation, something we definitely do not want to (and cannot) handle.
The bug here is that spurious interrupts should never result in any state change, and we should just return to the interrupted context. Moving the handling of spurious interrupts as early as possible in the GICv3 handler fixes this issue.
--- drivers/irqchip/irq-gic-v3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/irqchip/irq-gic-v3.c +4 -4
@@ -621,6 +621,10 @@ static asmlinkage void __exception_irq_e irqnr =gic_read_iar (); +/* Check for special IDs first */ +if ((irqnr >=1020 && irqnr <=1023 )) +return ; +if (gic_supports_nmi () &&unlikely (gic_read_rpr () ==GICD_INT_NMI_PRI )) {gic_handle_nmi (irqnr, regs);
@@ -632,10 +636,6 @@ static asmlinkage void __exception_irq_egic_arch_enable_irqs (); } -/* Check for special IDs first */ -if ((irqnr >=1020 && irqnr <=1023 )) -return ; -/* Treat anything but SGIs in a uniform way */ if (likely (irqnr >15 )) {int err;
Greg Kroah-Hartman
maintainerPATCH 33/184 cifs: Return correct error code from smb2_get_enc_key
In reply to Greg Kroah-HartmanFrom: Paul Aurich <[email protected]>
commit 83728cbf366e334301091d5b808add468ab46b27 upstream.
Avoid a warning if the error percolates back up:
[440700.376476] CIFS VFS: \\otters.example.com crypt_message: Could not get encryption key [440700.386947] ------------[ cut here ]------------ [440700.386948] err = 1 [440700.386977] WARNING: CPU: 11 PID: 2733 at /build/linux-hwe-5.4-p6lk6L/linux-hwe-5.4-5.4.0/lib/errseq.c:74 errseq_set+0x5c/0x70 ... [440700.397304] CPU: 11 PID: 2733 Comm: tar Tainted: G OE 5.4.0-70-generic #78~18.04.1-Ubuntu ... [440700.397334] Call Trace: [440700.397346] __filemap_set_wb_err+0x1a/0x70 [440700.397419] cifs_writepages+0x9c7/0xb30 [cifs] [440700.397426] do_writepages+0x4b/0xe0 [440700.397444] __filemap_fdatawrite_range+0xcb/0x100 [440700.397455] filemap_write_and_wait+0x42/0xa0 [440700.397486] cifs_setattr+0x68b/0xf30 [cifs] [440700.397493] notify_change+0x358/0x4a0 [440700.397500] utimes_common+0xe9/0x1c0 [440700.397510] do_utimes+0xc5/0x150 [440700.397520] __x64_sys_utimensat+0x88/0xd0
--- fs/cifs/smb2ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2ops.c +1 -1
@@ -3693,7 +3693,7 @@ smb2_get_enc_key(struct TCP_Server_Info }spin_unlock (&cifs_tcp_ses_lock); -return 1 ; +return -EAGAIN ; }/* * Encrypt or decrypt @rqst message. @rqst[0] has the following format:
Greg Kroah-Hartman
maintainerPATCH 34/184 btrfs: fix metadata extent leak after failure to create subvolume
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 67addf29004c5be9fa0383c82a364bb59afc7f84 upstream.
When creating a subvolume we allocate an extent buffer for its root node after starting a transaction. We setup a root item for the subvolume that points to that extent buffer and then attempt to insert the root item into the root tree - however if that fails, due to ENOMEM for example, we do not free the extent buffer previously allocated and we do not abort the transaction (as at that point we did nothing that can not be undone).
This means that we effectively do not return the metadata extent back to the free space cache/tree and we leave a delayed reference for it which causes a metadata extent item to be added to the extent tree, in the next transaction commit, without having backreferences. When this happens 'btrfs check' reports the following:
$ btrfs check /dev/sdi Opening filesystem to check... Checking filesystem on /dev/sdi UUID: dce2cb9d-025f-4b05-a4bf-cee0ad3785eb [1/7] checking root items [2/7] checking extents ref mismatch on [30425088 16384] extent item 1, found 0 backref 30425088 root 256 not referenced back 0x564a91c23d70 incorrect global backref count on 30425088 found 1 wanted 0 backpointer mismatch on [30425088 16384] owner ref check failed [30425088 16384] ERROR: errors found in extent allocation tree or chunk allocation [3/7] checking free space cache [4/7] checking fs roots [5/7] checking only csums items (without verifying data) [6/7] checking root refs [7/7] checking quota groups skipped (not enabled on this FS) found 212992 bytes used, error(s) found total csum bytes: 0 total tree bytes: 131072 total fs tree bytes: 32768 total extent tree bytes: 16384 btree space waste bytes: 124669 file data blocks allocated: 65536 referenced 65536
So fix this by freeing the metadata extent if btrfs_insert_root() returns an error.
--- fs/btrfs/ioctl.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
fs/btrfs/ioctl.c +15 -3
@@ -667,8 +667,6 @@ static noinline int create_subvol(structbtrfs_set_root_otransid (root_item, trans->transid);btrfs_tree_unlock (leaf); -free_extent_buffer (leaf); - leaf =NULL ;btrfs_set_root_dirid (root_item, new_dirid);
@@ -677,8 +675,22 @@ static noinline int create_subvol(struct key.type =BTRFS_ROOT_ITEM_KEY ; ret =btrfs_insert_root (trans, fs_info->tree_root, &key, root_item); -if (ret) +if (ret) { +/* +* Since we don't abort the transaction in this case, free the +* tree block so that we don't leak space and leave the +* filesystem in an inconsistent state (an extent item in the +* extent tree without backreferences). Also no need to have +* the tree block locked since it is not in any tree at this +* point, so no other task can find it and use it. +*/ +btrfs_free_tree_block (trans, root, leaf,0 ,1 ); +free_extent_buffer (leaf); goto fail; + } + +free_extent_buffer (leaf); + leaf =NULL ; key.offset = (u64)-1 ; new_root =btrfs_read_fs_root_no_name (fs_info, &key);
Greg Kroah-Hartman
maintainerPATCH 35/184 intel_th: pci: Add Rocket Lake CPU support
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
commit 9f7f2a5e01ab4ee56b6d9c0572536fe5fd56e376 upstream.
This adds support for the Trace Hub in Rocket Lake CPUs.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -268,6 +268,11 @@ static const struct pci_device_id intel_ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x1bcc), .driver_data = (kernel_ulong_t)&intel_th_2x, }, + { +/* Rocket Lake CPU */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4c19), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, { 0 }, };
Greg Kroah-Hartman
maintainerPATCH 36/184 posix-timers: Preserve return value in clock_adjtime32()
In reply to Greg Kroah-HartmanFrom: Chen Jun <[email protected]>
commit 2d036dfa5f10df9782f5278fc591d79d283c1fad upstream.
The return value on success (>= 0) is overwritten by the return value of put_old_timex32(). That works correct in the fault case, but is wrong for the success case where put_old_timex32() returns 0.
Just check the return value of put_old_timex32() and return -EFAULT in case it is not zero.
[ tglx: Massage changelog ]
--- kernel/time/posix-timers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/time/posix-timers.c +2 -2
@@ -1169,8 +1169,8 @@ SYSCALL_DEFINE2(clock_adjtime32, clockid err =do_clock_adjtime (which_clock, &ktx); -if (err >=0 ) - err =put_old_timex32 (utp, &ktx); +if (err >=0 &&put_old_timex32 (utp, &ktx)) +return -EFAULT ;return err; }
Greg Kroah-Hartman
maintainerPATCH 37/184 fbdev: zero-fill colormap in fbcmap.c
In reply to Greg Kroah-HartmanFrom: Phillip Potter <[email protected]>
commit 19ab233989d0f7ab1de19a036e247afa4a0a1e9c upstream.
Use kzalloc() rather than kmalloc() for the dynamically allocated parts of the colormap in fb_alloc_cmap_gfp, to prevent a leak of random kernel data to userspace under certain circumstances.
Fixes a KMSAN-found infoleak bug reported by syzbot at:
https://syzkaller.appspot.com/bug?id=741578659feabd108ad9e06696f0c1f2e69c4b6e
--- drivers/video/fbdev/core/fbcmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/video/fbdev/core/fbcmap.c +4 -4
@@ -101,17 +101,17 @@ int fb_alloc_cmap_gfp(struct fb_cmap *cmif (!len)return 0 ; - cmap->red =kmalloc (size, flags); + cmap->red =kzalloc (size, flags);if (!cmap->red) goto fail; - cmap->green =kmalloc (size, flags); + cmap->green =kzalloc (size, flags);if (!cmap->green) goto fail; - cmap->blue =kmalloc (size, flags); + cmap->blue =kzalloc (size, flags);if (!cmap->blue) goto fail;if (transp) { - cmap->transp =kmalloc (size, flags); + cmap->transp =kzalloc (size, flags);if (!cmap->transp) goto fail; }else {
Greg Kroah-Hartman
maintainerPATCH 38/184 bus: ti-sysc: Probe for l4_wkup and l4_cfg interconnect devices first
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 4700a00755fb5a4bb5109128297d6fd2d1272ee6 ]
We want to probe l4_wkup and l4_cfg interconnect devices first to avoid issues with missing resources. Otherwise we attempt to probe l4_per devices first causing pointless deferred probe and also annoyingh renumbering of the MMC devices for example.
--- drivers/bus/ti-sysc.c | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
drivers/bus/ti-sysc.c +49 -0
@@ -602,6 +602,51 @@ static int sysc_parse_and_check_child_range(struct sysc *ddata)return 0 ; } +/* Interconnect instances to probe before l4_per instances */ +static struct resource early_bus_ranges[] = { +/* am3/4 l4_wkup */ + { .start =0x44c00000 , .end =0x44c00000 +0x300000 , }, +/* omap4/5 and dra7 l4_cfg */ + { .start =0x4a000000 , .end =0x4a000000 +0x300000 , }, +/* omap4 l4_wkup */ + { .start =0x4a300000 , .end =0x4a300000 +0x30000 , }, +/* omap5 and dra7 l4_wkup without dra7 dcan segment */ + { .start =0x4ae00000 , .end =0x4ae00000 +0x30000 , }, +}; + +static atomic_t sysc_defer =ATOMIC_INIT (10 ); + +/** +* sysc_defer_non_critical - defer non_critical interconnect probing +* @ddata: device driver data +* +* We want to probe l4_cfg and l4_wkup interconnect instances before any +* l4_per instances as l4_per instances depend on resources on l4_cfg and +* l4_wkup interconnects. +*/ +static int sysc_defer_non_critical (struct sysc *ddata) +{ +struct resource *res; +int i; + +if (!atomic_read (&sysc_defer)) +return 0 ; + +for (i =0 ; i <ARRAY_SIZE (early_bus_ranges); i++) { + res = &early_bus_ranges[i]; +if (ddata->module_pa >= res->start && + ddata->module_pa <= res->end) { +atomic_set (&sysc_defer,0 ); + +return 0 ; + } + } + +atomic_dec_if_positive (&sysc_defer); + +return -EPROBE_DEFER ; +} +static struct device_node *stdout_path;static void sysc_init_stdout_path (struct sysc *ddata)
@@ -826,6 +871,10 @@ static int sysc_map_and_check_registers(struct sysc *ddata)if (error)return error; + error =sysc_defer_non_critical (ddata); +if (error) +return error; +sysc_check_children (ddata); error =sysc_parse_registers (ddata);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 39/184 staging: wimax/i2400m: fix byte-order issue
In reply to Greg Kroah-HartmanFrom: karthik alapati <[email protected]>
[ Upstream commit 0c37baae130df39b19979bba88bde2ee70a33355 ]
fix sparse byte-order warnings by converting host byte-order type to __le16 byte-order types before assigning to hdr.length
--- drivers/net/wimax/i2400m/op-rfkill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wimax/i2400m/op-rfkill.c +1 -1
@@ -86,7 +86,7 @@ int i2400m_op_rfkill_sw_toggle(struct wimax_dev *wimax_dev,if (cmd ==NULL ) goto error_alloc; cmd->hdr.type =cpu_to_le16 (I2400M_MT_CMD_RF_CONTROL ); - cmd->hdr.length =sizeof (cmd->sw_rf); + cmd->hdr.length =cpu_to_le16 (sizeof (cmd->sw_rf)); cmd->hdr.version =cpu_to_le16 (I2400M_L3L4_VERSION ); cmd->sw_rf.hdr.type =cpu_to_le16 (I2400M_TLV_RF_OPERATION ); cmd->sw_rf.hdr.length =cpu_to_le16 (sizeof (cmd->sw_rf.status));
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 40/184 spi: ath79: always call chipselect function
In reply to Greg Kroah-HartmanFrom: David Bauer <[email protected]>
[ Upstream commit 19e2132174583beb90c1bd3e9c842bc6d5c944d1 ]
spi-bitbang has to call the chipselect function on the ath79 SPI driver in order to communicate with the SPI slave device, as the ath79 SPI driver has three dedicated chipselect lines but can also be used with GPIOs for the CS lines.
Fixes commit 4a07b8bcd503 ("spi: bitbang: Make chipselect callback optional")
--- drivers/spi/spi-ath79.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-ath79.c +1 -0
@@ -158,6 +158,7 @@ static int ath79_spi_probe(struct platform_device *pdev) master->bits_per_word_mask =SPI_BPW_RANGE_MASK (1 ,32 ); master->setup = spi_bitbang_setup; master->cleanup = spi_bitbang_cleanup; + master->flags =SPI_MASTER_GPIO_SS ;if (pdata) { master->bus_num = pdata->bus_num; master->num_chipselect = pdata->num_chipselect;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 41/184 spi: ath79: remove spi-master setup and cleanup assignment
In reply to Greg Kroah-HartmanFrom: David Bauer <[email protected]>
[ Upstream commit ffb597b2bd3cd78b9bfb68f536743cd46dbb2cc4 ]
This removes the assignment of setup and cleanup functions for the ath79 target. Assigning the setup-method will lead to 'setup_transfer' not being assigned in spi_bitbang_init. Because of this, performing any TX/RX operation will lead to a kernel oops.
Also drop the redundant cleanup assignment, as it's also assigned in spi_bitbang_init.
--- drivers/spi/spi-ath79.c | 2 -- 1 file changed, 2 deletions(-)
drivers/spi/spi-ath79.c +0 -2
@@ -156,8 +156,6 @@ static int ath79_spi_probe(struct platform_device *pdev) master->use_gpio_descriptors = true; master->bits_per_word_mask =SPI_BPW_RANGE_MASK (1 ,32 ); - master->setup = spi_bitbang_setup; - master->cleanup = spi_bitbang_cleanup; master->flags =SPI_MASTER_GPIO_SS ;if (pdata) { master->bus_num = pdata->bus_num;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 42/184 crypto: api - check for ERR pointers in crypto_destroy_tfm()
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 83681f2bebb34dbb3f03fecd8f570308ab8b7c2c ]
Given that crypto_alloc_tfm() may return ERR pointers, and to avoid crashes on obscure error paths where such pointers are presented to crypto_destroy_tfm() (such as [0]), add an ERR_PTR check there before dereferencing the second argument as a struct crypto_tfm pointer.
[0] https://lore.kernel.org/linux-crypto/[email protected]/
--- crypto/api.c | 2 +- include/crypto/acompress.h | 2 ++ include/crypto/aead.h | 2 ++ include/crypto/akcipher.h | 2 ++ include/crypto/hash.h | 4 ++++ include/crypto/kpp.h | 2 ++ include/crypto/rng.h | 2 ++ include/crypto/skcipher.h | 2 ++ 8 files changed, 17 insertions(+), 1 deletion(-)
crypto/api.c +1 -1
@@ -568,7 +568,7 @@ void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) {struct crypto_alg *alg; -if (unlikely (!mem)) +if (IS_ERR_OR_NULL (mem))return ; alg = tfm->__crt_alg;
include/crypto/acompress.h +2 -0
@@ -147,6 +147,8 @@ static inline struct crypto_acomp *crypto_acomp_reqtfm(struct acomp_req *req)* crypto_free_acomp() -- free ACOMPRESS tfm handle * * @tfm: ACOMPRESS tfm handle allocated with crypto_alloc_acomp() +* +* If @tfm is a NULL or error pointer, this function does nothing. */ static inline void crypto_free_acomp (struct crypto_acomp *tfm) {
include/crypto/aead.h +2 -0
@@ -179,6 +179,8 @@ static inline struct crypto_tfm *crypto_aead_tfm(struct crypto_aead *tfm)/** * crypto_free_aead() - zeroize and free aead handle * @tfm: cipher handle to be freed +* +* If @tfm is a NULL or error pointer, this function does nothing. */ static inline void crypto_free_aead (struct crypto_aead *tfm) {
include/crypto/akcipher.h +2 -0
@@ -174,6 +174,8 @@ static inline struct crypto_akcipher *crypto_akcipher_reqtfm(* crypto_free_akcipher() - free AKCIPHER tfm handle * * @tfm: AKCIPHER tfm handle allocated with crypto_alloc_akcipher() +* +* If @tfm is a NULL or error pointer, this function does nothing. */ static inline void crypto_free_akcipher (struct crypto_akcipher *tfm) {
include/crypto/hash.h +4 -0
@@ -260,6 +260,8 @@ static inline struct crypto_tfm *crypto_ahash_tfm(struct crypto_ahash *tfm)/** * crypto_free_ahash() - zeroize and free the ahash handle * @tfm: cipher handle to be freed +* +* If @tfm is a NULL or error pointer, this function does nothing. */ static inline void crypto_free_ahash (struct crypto_ahash *tfm) {
@@ -703,6 +705,8 @@ static inline struct crypto_tfm *crypto_shash_tfm(struct crypto_shash *tfm)/** * crypto_free_shash() - zeroize and free the message digest handle * @tfm: cipher handle to be freed +* +* If @tfm is a NULL or error pointer, this function does nothing. */ static inline void crypto_free_shash (struct crypto_shash *tfm) {
include/crypto/kpp.h +2 -0
@@ -154,6 +154,8 @@ static inline void crypto_kpp_set_flags(struct crypto_kpp *tfm, u32 flags)* crypto_free_kpp() - free KPP tfm handle * * @tfm: KPP tfm handle allocated with crypto_alloc_kpp() +* +* If @tfm is a NULL or error pointer, this function does nothing. */ static inline void crypto_free_kpp (struct crypto_kpp *tfm) {
include/crypto/rng.h +2 -0
@@ -111,6 +111,8 @@ static inline struct rng_alg *crypto_rng_alg(struct crypto_rng *tfm)/** * crypto_free_rng() - zeroize and free RNG handle * @tfm: cipher handle to be freed +* +* If @tfm is a NULL or error pointer, this function does nothing. */ static inline void crypto_free_rng (struct crypto_rng *tfm) {
include/crypto/skcipher.h +2 -0
@@ -203,6 +203,8 @@ static inline struct crypto_tfm *crypto_skcipher_tfm(/** * crypto_free_skcipher() - zeroize and free cipher handle * @tfm: cipher handle to be freed +* +* If @tfm is a NULL or error pointer, this function does nothing. */ static inline void crypto_free_skcipher (struct crypto_skcipher *tfm) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 43/184 crypto: qat - fix unmap invalid dma address
In reply to Greg Kroah-HartmanFrom: Hui Tang <[email protected]>
[ Upstream commit 792b32fad548281e1b7fe14df9063a96c54b32a2 ]
'dma_mapping_error' return a negative value if 'dma_addr' is equal to 'DMA_MAPPING_ERROR' not zero, so fix initialization of 'dma_addr'.
--- drivers/crypto/qat/qat_common/qat_algs.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/crypto/qat/qat_common/qat_algs.c +9 -2
@@ -715,7 +715,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,struct qat_alg_buf_list *bufl;struct qat_alg_buf_list *buflout =NULL ;dma_addr_t blp; -dma_addr_t bloutp =0 ; +dma_addr_t bloutp;struct scatterlist *sg;size_t sz_out, sz =struct_size (bufl, bufers, n +1 );
@@ -727,6 +727,9 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,if (unlikely (!bufl))return -ENOMEM ; +for_each_sg (sgl, sg, n, i) + bufl->bufers[i].addr =DMA_MAPPING_ERROR ; + blp =dma_map_single (dev, bufl, sz,DMA_TO_DEVICE );if (unlikely (dma_mapping_error (dev, blp))) goto err_in;
@@ -760,10 +763,14 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, dev_to_node(&GET_DEV(inst->accel_dev)));if (unlikely (!buflout)) goto err_in; + + bufers = buflout->bufers; +for_each_sg (sglout, sg, n, i) + bufers[i].addr =DMA_MAPPING_ERROR ; + bloutp =dma_map_single (dev, buflout, sz_out,DMA_TO_DEVICE );if (unlikely (dma_mapping_error (dev, bloutp))) goto err_out; - bufers = buflout->bufers;for_each_sg (sglout, sg, n, i) {int y = sg_nctr;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 44/184 usb: gadget: uvc: add bInterval checking for HS mode
In reply to Greg Kroah-HartmanFrom: Pawel Laszczak <[email protected]>
[ Upstream commit 26adde04acdff14a1f28d4a5dce46a8513a3038b ]
Patch adds extra checking for bInterval passed by configfs. The 5.6.4 chapter of USB Specification (rev. 2.0) say:
"A high-bandwidth endpoint must specify a period of 1x125 µs (i.e., a bInterval value of 1)."
The issue was observed during testing UVC class on CV. I treat this change as improvement because we can control bInterval by configfs.
--- drivers/usb/gadget/function/f_uvc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_uvc.c +6 -1
@@ -633,7 +633,12 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) uvc_hs_streaming_ep.wMaxPacketSize =cpu_to_le16 (max_packet_size | ((max_packet_mult -1 ) <<11 )); - uvc_hs_streaming_ep.bInterval = opts->streaming_interval; + +/* A high-bandwidth endpoint must specify a bInterval value of 1 */ +if (max_packet_mult >1 ) + uvc_hs_streaming_ep.bInterval =1 ; +else + uvc_hs_streaming_ep.bInterval = opts->streaming_interval; uvc_ss_streaming_ep.wMaxPacketSize =cpu_to_le16 (max_packet_size); uvc_ss_streaming_ep.bInterval = opts->streaming_interval;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 45/184 usb: webcam: Invalid size of Processing Unit Descriptor
In reply to Greg Kroah-HartmanFrom: Pawel Laszczak <[email protected]>
[ Upstream commit 6a154ec9ef6762c774cd2b50215c7a8f0f08a862 ]
According with USB Device Class Definition for Video Device the Processing Unit Descriptor bLength should be 12 (10 + bmControlSize), but it has 11.
Invalid length caused that Processing Unit Descriptor Test Video form CV tool failed. To fix this issue patch adds bmVideoStandards into uvc_processing_unit_descriptor structure.
The bmVideoStandards field was added in UVC 1.1 and it wasn't part of UVC 1.0a.
--- drivers/usb/gadget/function/f_uvc.c | 1 + drivers/usb/gadget/legacy/webcam.c | 1 + include/uapi/linux/usb/video.h | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_uvc.c +1 -0
@@ -822,6 +822,7 @@ static struct usb_function_instance *uvc_alloc_inst(void) pd->bmControls[0 ] =1 ; pd->bmControls[1 ] =0 ; pd->iProcessing =0 ; + pd->bmVideoStandards =0 ; od = &opts->uvc_output_terminal; od->bLength =UVC_DT_OUTPUT_TERMINAL_SIZE ;
drivers/usb/gadget/legacy/webcam.c +1 -0
@@ -125,6 +125,7 @@ static const struct uvc_processing_unit_descriptor uvc_processing = { .bmControls[0] = 1, .bmControls[1] = 0, .iProcessing = 0, + .bmVideoStandards = 0, };static const struct uvc_output_terminal_descriptor uvc_output_terminal = {
include/uapi/linux/usb/video.h +2 -1
@@ -302,9 +302,10 @@ struct uvc_processing_unit_descriptor {__u8 bControlSize;__u8 bmControls[2 ];__u8 iProcessing; +__u8 bmVideoStandards; } __attribute__((__packed__)); -#define UVC_DT_PROCESSING_UNIT_SIZE (n) (9+(n)) +#define UVC_DT_PROCESSING_UNIT_SIZE (n) (10+(n))/* 3.7.2.6. Extension Unit Descriptor */ struct uvc_extension_unit_descriptor {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 46/184 genirq/matrix: Prevent allocation counter corruption
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit c93a5e20c3c2dabef8ea360a3d3f18c6f68233ab ]
When irq_matrix_free() is called for an unallocated vector the managed_allocated and total_allocated counters get out of sync with the real state of the matrix. Later, when the last interrupt is freed, these counters will underflow resulting in UINTMAX because the counters are unsigned.
While this is certainly a problem of the calling code, this can be catched in the allocator by checking the allocation bit for the to be freed vector which simplifies debugging.
An example of the problem described above:
https://lore.kernel.org/lkml/[email protected]/
Add the missing sanity check and emit a warning when it triggers.
--- kernel/irq/matrix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/irq/matrix.c +3 -1
@@ -423,7 +423,9 @@ void irq_matrix_free(struct irq_matrix *m, unsigned int cpu,if (WARN_ON_ONCE (bit < m->alloc_start || bit >= m->alloc_end))return ; -clear_bit (bit, cm->alloc_map); +if (WARN_ON_ONCE (!test_and_clear_bit (bit, cm->alloc_map))) +return ; + cm->allocated--;if (managed) cm->managed_allocated--;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 47/184 usb: gadget: f_uac2: validate input parameters
In reply to Greg Kroah-HartmanFrom: Ruslan Bilovol <[email protected]>
[ Upstream commit 3713d5ceb04d5ab6a5e2b86dfca49170053f3a5e ]
Currently user can configure UAC2 function with parameters that violate UAC2 spec or are not supported by UAC2 gadget implementation.
This can lead to incorrect behavior if such gadget is connected to the host - like enumeration failure or other issues depending on host's UAC2 driver implementation, bringing user to a long hours of debugging the issue.
Instead of silently accept these parameters, throw an error if they are not valid.
--- drivers/usb/gadget/function/f_uac2.c | 39 ++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_uac2.c +37 -2
@@ -14,6 +14,9 @@#include "u_audio.h" #include "u_uac2.h" +/* UAC2 spec: 4.1 Audio Channel Cluster Descriptor */ +#define UAC2_CHANNEL_MASK 0x07FFFFFF +/* * The driver implements a simple UAC_2 topology. * USB-OUT -> IT_1 -> OT_3 -> ALSA_Capture
@@ -604,6 +607,36 @@ static void setup_descriptor(struct f_uac2_opts *opts) hs_audio_desc[i] =NULL ; } +static int afunc_validate_opts (struct g_audio *agdev,struct device *dev) +{ +struct f_uac2_opts *opts =g_audio_to_uac2_opts (agdev); + +if (!opts->p_chmask && !opts->c_chmask) { +dev_err (dev,"Error: no playback and capture channels\n" ); +return -EINVAL ; + }else if (opts->p_chmask & ~UAC2_CHANNEL_MASK ) { +dev_err (dev,"Error: unsupported playback channels mask\n" ); +return -EINVAL ; + }else if (opts->c_chmask & ~UAC2_CHANNEL_MASK ) { +dev_err (dev,"Error: unsupported capture channels mask\n" ); +return -EINVAL ; + }else if ((opts->p_ssize <1 ) || (opts->p_ssize >4 )) { +dev_err (dev,"Error: incorrect playback sample size\n" ); +return -EINVAL ; + }else if ((opts->c_ssize <1 ) || (opts->c_ssize >4 )) { +dev_err (dev,"Error: incorrect capture sample size\n" ); +return -EINVAL ; + }else if (!opts->p_srate) { +dev_err (dev,"Error: incorrect playback sampling rate\n" ); +return -EINVAL ; + }else if (!opts->c_srate) { +dev_err (dev,"Error: incorrect capture sampling rate\n" ); +return -EINVAL ; + } + +return 0 ; +} +static int afunc_bind (struct usb_configuration *cfg,struct usb_function *fn) {
@@ -612,11 +645,13 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)struct usb_composite_dev *cdev = cfg->cdev;struct usb_gadget *gadget = cdev->gadget;struct device *dev = &gadget->dev; -struct f_uac2_opts *uac2_opts; +struct f_uac2_opts *uac2_opts =g_audio_to_uac2_opts (agdev);struct usb_string *us;int ret; - uac2_opts = container_of(fn->fi, struct f_uac2_opts, func_inst); + ret =afunc_validate_opts (agdev, dev); +if (ret) +return ret; us =usb_gstrings_attach (cdev, fn_strings,ARRAY_SIZE (strings_fn));if (IS_ERR (us))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 48/184 usb: gadget: f_uac1: validate input parameters
In reply to Greg Kroah-HartmanFrom: Ruslan Bilovol <[email protected]>
[ Upstream commit a59c68a6a3d1b18e2494f526eb19893a34fa6ec6 ]
Currently user can configure UAC1 function with parameters that violate UAC1 spec or are not supported by UAC1 gadget implementation.
This can lead to incorrect behavior if such gadget is connected to the host - like enumeration failure or other issues depending on host's UAC1 driver implementation, bringing user to a long hours of debugging the issue.
Instead of silently accept these parameters, throw an error if they are not valid.
--- drivers/usb/gadget/function/f_uac1.c | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
drivers/usb/gadget/function/f_uac1.c +43 -0
@@ -19,6 +19,9 @@#include "u_audio.h" #include "u_uac1.h" +/* UAC1 spec: 3.7.2.3 Audio Channel Cluster Format */ +#define UAC1_CHANNEL_MASK 0x0FFF +struct f_uac1 {struct g_audio g_audio;u8 ac_intf, as_in_intf, as_out_intf;
@@ -30,6 +33,11 @@ static inline struct f_uac1 *func_to_uac1(struct usb_function *f) return container_of(f, struct f_uac1, g_audio.func); } +static inline struct f_uac1_opts *g_audio_to_uac1_opts (struct g_audio *audio) +{ + return container_of(audio->func.fi, struct f_uac1_opts, func_inst); +} +/* * DESCRIPTORS ... most are static, but strings and full * configuration descriptors are built on demand.
@@ -505,11 +513,42 @@ static void f_audio_disable(struct usb_function *f)/*-------------------------------------------------------------------------*/ +static int f_audio_validate_opts (struct g_audio *audio,struct device *dev) +{ +struct f_uac1_opts *opts =g_audio_to_uac1_opts (audio); + +if (!opts->p_chmask && !opts->c_chmask) { +dev_err (dev,"Error: no playback and capture channels\n" ); +return -EINVAL ; + }else if (opts->p_chmask & ~UAC1_CHANNEL_MASK ) { +dev_err (dev,"Error: unsupported playback channels mask\n" ); +return -EINVAL ; + }else if (opts->c_chmask & ~UAC1_CHANNEL_MASK ) { +dev_err (dev,"Error: unsupported capture channels mask\n" ); +return -EINVAL ; + }else if ((opts->p_ssize <1 ) || (opts->p_ssize >4 )) { +dev_err (dev,"Error: incorrect playback sample size\n" ); +return -EINVAL ; + }else if ((opts->c_ssize <1 ) || (opts->c_ssize >4 )) { +dev_err (dev,"Error: incorrect capture sample size\n" ); +return -EINVAL ; + }else if (!opts->p_srate) { +dev_err (dev,"Error: incorrect playback sampling rate\n" ); +return -EINVAL ; + }else if (!opts->c_srate) { +dev_err (dev,"Error: incorrect capture sampling rate\n" ); +return -EINVAL ; + } + +return 0 ; +} +/* audio function driver setup/binding */ static int f_audio_bind (struct usb_configuration *c,struct usb_function *f) {struct usb_composite_dev *cdev = c->cdev;struct usb_gadget *gadget = cdev->gadget; +struct device *dev = &gadget->dev;struct f_uac1 *uac1 =func_to_uac1 (f);struct g_audio *audio =func_to_g_audio (f);struct f_uac1_opts *audio_opts;
@@ -519,6 +558,10 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f)int rate;int status; + status =f_audio_validate_opts (audio, dev); +if (status) +return status; + audio_opts = container_of(f->fi, struct f_uac1_opts, func_inst); us =usb_gstrings_attach (cdev, uac1_strings,ARRAY_SIZE (strings_uac1));
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 49/184 usb: dwc3: gadget: Ignore EP queue requests during bus reset
In reply to Greg Kroah-HartmanFrom: Wesley Cheng <[email protected]>
[ Upstream commit 71ca43f30df9c642970f9dc9b2d6f463f4967e7b ]
The current dwc3_gadget_reset_interrupt() will stop any active transfers, but only addresses blocking of EP queuing for while we are coming from a disconnected scenario, i.e. after receiving the disconnect event. If the host decides to issue a bus reset on the device, the connected parameter will still be set to true, allowing for EP queuing to continue while we are disabling the functions. To avoid this, set the connected flag to false until the stop active transfers is complete.
--- drivers/usb/dwc3/gadget.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/usb/dwc3/gadget.c +9 -0
@@ -2986,6 +2986,15 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) dwc->connected = true; +/* +* Ideally, dwc3_reset_gadget() would trigger the function +* drivers to stop any active transfers through ep disable. +* However, for functions which defer ep disable, such as mass +* storage, we will need to rely on the call to stop active +* transfers here, and avoid allowing of request queuing. +*/ + dwc->connected = false; +/* * WORKAROUND: DWC3 revisions <1.88a have an issue which * would cause a missing Disconnect Event if there's a
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 50/184 usb: xhci: Fix port minor revision
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
[ Upstream commit 64364bc912c01b33bba6c22e3ccb849bfca96398 ]
Some hosts incorrectly use sub-minor version for minor version (i.e. 0x02 instead of 0x20 for bcdUSB 0x320 and 0x01 for bcdUSB 0x310). Currently the xHCI driver works around this by just checking for minor revision > 0x01 for USB 3.1 everywhere. With the addition of USB 3.2, checking this gets a bit cumbersome. Since there is no USB release with bcdUSB 0x301 to 0x309, we can assume that sub-minor version 01 to 09 is incorrect. Let's try to fix this and use the minor revision that matches with the USB/xHCI spec to help with the version checking within the driver.
--- drivers/usb/host/xhci-mem.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/usb/host/xhci-mem.c +9 -0
@@ -2134,6 +2134,15 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,if (major_revision ==0x03 ) { rhub = &xhci->usb3_rhub; +/* +* Some hosts incorrectly use sub-minor version for minor +* version (i.e. 0x02 instead of 0x20 for bcdUSB 0x320 and 0x01 +* for bcdUSB 0x310). Since there is no USB release with sub +* minor version 0x301 to 0x309, we can assume that they are +* incorrect and fix it here. +*/ +if (minor_revision >0x00 && minor_revision <0x10 ) + minor_revision <<=4 ; }else if (major_revision <=0x02 ) { rhub = &xhci->usb2_rhub; }else {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 51/184 PCI: PM: Do not read power state in pci_enable_device_flags()
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit 4514d991d99211f225d83b7e640285f29f0755d0 ]
It should not be necessary to update the current_state field of struct pci_dev in pci_enable_device_flags() before calling do_pci_enable_device() for the device, because none of the code between that point and the pci_set_power_state() call in do_pci_enable_device() invoked later depends on it.
Moreover, doing that is actively harmful in some cases. For example, if the given PCI device depends on an ACPI power resource whose _STA method initially returns 0 ("off"), but the config space of the PCI device is accessible and the power state retrieved from the PCI_PM_CTRL register is D0, the current_state field in the struct pci_dev representing that device will get out of sync with the power.state of its ACPI companion object and that will lead to power management issues going forward.
To avoid such issues it is better to leave the current_state value as is until it is changed to PCI_D0 by do_pci_enable_device() as appropriate. However, the power state of the device is not changed to PCI_D0 if it is already enabled when pci_enable_device_flags() gets called for it, so update its current_state in that case, but use pci_update_current_state() covering platform PM too for that.
--- drivers/pci/pci.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/pci/pci.c +3 -13
@@ -1666,20 +1666,10 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)int err;int i, bars =0 ; -/* -* Power state could be unknown at this point, either due to a fresh -* boot or a device removal call. So get the current power state -* so that things like MSI message writing will behave as expected -* (e.g. if the device really is in D0 at enable time). -*/ -if (dev->pm_cap) { -u16 pmcsr; -pci_read_config_word (dev, dev->pm_cap +PCI_PM_CTRL , &pmcsr); - dev->current_state = (pmcsr &PCI_PM_CTRL_STATE_MASK ); - } - -if (atomic_inc_return (&dev->enable_cnt) >1 ) +if (atomic_inc_return (&dev->enable_cnt) >1 ) { +pci_update_current_state (dev, dev->current_state);return 0 ;/* already enabled */ + } bridge =pci_upstream_bridge (dev);if (bridge)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 52/184 x86/build: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS)
In reply to Greg Kroah-HartmanFrom: John Millikin <[email protected]>
[ Upstream commit 8abe7fc26ad8f28bfdf78adbed56acd1fa93f82d ]
When cross-compiling with Clang, the $(CLANG_FLAGS)' variable contains additional flags needed to build C and assembly sources for the target platform. Normally this variable is automatically included in $(KBUILD_CFLAGS)' via the top-level Makefile.
The x86 real-mode makefile builds `$(REALMODE_CFLAGS)' from a plain assignment and therefore drops the Clang flags. This causes Clang to not recognize x86-specific assembler directives:
arch/x86/realmode/rm/header.S:36:1: error: unknown directive .type real_mode_header STT_OBJECT ; .size real_mode_header, .-real_mode_header ^
Explicit propagation of $(CLANG_FLAGS)' to $(REALMODE_CFLAGS)', which is inherited by real-mode make rules, fixes cross-compilation with Clang for x86 targets.
Relevant flags:
* --target' sets the target architecture when cross-compiling. This flag must be set for both compilation and assembly (KBUILD_AFLAGS') to support architecture-specific assembler directives.
* -no-integrated-as' tells clang to assemble with GNU Assembler instead of its built-in LLVM assembler. This flag is set by default unless LLVM_IAS=1' is set, because the LLVM assembler can't yet parse certain GNU extensions.
--- arch/x86/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/x86/Makefile +1 -0
@@ -40,6 +40,7 @@ REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -ffreestanding REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -fno-stack-protector) REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -Wno-address-of-packed-member) REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), $(cc_stack_align4)) +REALMODE_CFLAGS += $(CLANG_FLAGS) export REALMODE_CFLAGS # BITS is used as extension for files which are available in a 32 bit
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 53/184 tee: optee: do not check memref size on return from Secure World
In reply to Greg Kroah-HartmanFrom: Jerome Forissier <[email protected]>
[ Upstream commit c650b8dc7a7910eb25af0aac1720f778b29e679d ]
When Secure World returns, it may have changed the size attribute of the memory references passed as [in/out] parameters. The GlobalPlatform TEE Internal Core API specification does not restrict the values that this size can take. In particular, Secure World may increase the value to be larger than the size of the input buffer to indicate that it needs more.
Therefore, the size check in optee_from_msg_param() is incorrect and needs to be removed. This fixes a number of failed test cases in the GlobalPlatform TEE Initial Configuratiom Test Suite v2_0_0_0-2017_06_09 when OP-TEE is compiled without dynamic shared memory support (CFG_CORE_DYN_SHM=n).
--- drivers/tee/optee/core.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/tee/optee/core.c +0 -10
@@ -78,16 +78,6 @@ int optee_from_msg_param(struct tee_param *params, size_t num_params,return rc; p->u.memref.shm_offs = mp->u.tmem.buf_ptr - pa; p->u.memref.shm = shm; - -/* Check that the memref is covered by the shm object */ -if (p->u.memref.size) { -size_t o = p->u.memref.shm_offs + - p->u.memref.size -1 ; - - rc =tee_shm_get_pa (shm, o,NULL ); -if (rc) -return rc; - }break ;case OPTEE_MSG_ATTR_TYPE_RMEM_INPUT :case OPTEE_MSG_ATTR_TYPE_RMEM_OUTPUT :
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 54/184 perf/arm_pmu_platform: Fix error handling
In reply to Greg Kroah-HartmanFrom: Robin Murphy <[email protected]>
[ Upstream commit e338cb6bef254821a8c095018fd27254d74bfd6a ]
If we're aborting after failing to register the PMU device, we probably don't want to leak the IRQs that we've claimed.
--- drivers/perf/arm_pmu_platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/arm_pmu_platform.c +1 -1
@@ -236,7 +236,7 @@ int arm_pmu_device_probe(struct platform_device *pdev, ret =armpmu_register (pmu);if (ret) - goto out_free; + goto out_free_irqs;return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 55/184 usb: xhci-mtk: support quirk to disable usb2 lpm
In reply to Greg Kroah-HartmanFrom: Chunfeng Yun <[email protected]>
[ Upstream commit bee1f89aad2a51cd3339571bc8eadbb0dc88a683 ]
The xHCI driver support usb2 HW LPM by default, here add support XHCI_HW_LPM_DISABLE quirk, then we can disable usb2 lpm when need it.
--- drivers/usb/host/xhci-mtk.c | 3 +++ drivers/usb/host/xhci-mtk.h | 1 + 2 files changed, 4 insertions(+)
drivers/usb/host/xhci-mtk.c +3 -0
@@ -397,6 +397,8 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |=XHCI_SPURIOUS_SUCCESS ;if (mtk->lpm_support) xhci->quirks |=XHCI_LPM_SUPPORT ; +if (mtk->u2_lpm_disable) + xhci->quirks |=XHCI_HW_LPM_DISABLE ;/* * MTK xHCI 0.96: PSA is 1 by default even if doesn't support stream,
@@ -469,6 +471,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)return ret; mtk->lpm_support =of_property_read_bool (node,"usb3-lpm-capable" ); + mtk->u2_lpm_disable =of_property_read_bool (node,"usb2-lpm-disable" );/* optional property, ignore the error if it does not exist */ of_property_read_u32 (node,"mediatek,u3p-dis-msk" , &mtk->u3p_dis_msk);
drivers/usb/host/xhci-mtk.h +1 -0
@@ -150,6 +150,7 @@ struct xhci_hcd_mtk {struct phy **phys;int num_phys;bool lpm_support; +bool u2_lpm_disable;/* usb remote wakeup */ bool uwk_en;struct regmap *uwk;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 56/184 xhci: check control context is valid before dereferencing it.
In reply to Greg Kroah-HartmanFrom: Mathias Nyman <[email protected]>
[ Upstream commit 597899d2f7c5619c87185ee7953d004bd37fd0eb ]
Don't dereference ctrl_ctx before checking it's valid. Issue reported by Klockwork
--- drivers/usb/host/xhci.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/usb/host/xhci.c +8 -0
@@ -3227,6 +3227,14 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd,/* config ep command clears toggle if add and drop ep flags are set */ ctrl_ctx =xhci_get_input_control_ctx (cfg_cmd->in_ctx); +if (!ctrl_ctx) { +spin_unlock_irqrestore (&xhci->lock, flags); +xhci_free_command (xhci, cfg_cmd); +xhci_warn (xhci,"%s: Could not get input context, bad type.\n" , + __func__); + goto cleanup; + } +xhci_setup_input_ctx_for_config_ep (xhci, cfg_cmd->in_ctx, vdev->out_ctx, ctrl_ctx, ep_flag, ep_flag);xhci_endpoint_copy (xhci, cfg_cmd->in_ctx, vdev->out_ctx, ep_index);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 57/184 xhci: fix potential array out of bounds with several interrupters
In reply to Greg Kroah-HartmanFrom: Mathias Nyman <[email protected]>
[ Upstream commit 286fd02fd54b6acab65809549cf5fb3f2a886696 ]
The Max Interrupters supported by the controller is given in a 10bit wide bitfield, but the driver uses a fixed 128 size array to index these interrupters.
Klockwork reports a possible array out of bounds case which in theory is possible. In practice this hasn't been hit as a common number of Max Interrupters for new controllers is 8, not even close to 128.
This needs to be fixed anyway
--- drivers/usb/host/xhci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +5 -1
@@ -228,6 +228,7 @@ static void xhci_zero_64b_regs(struct xhci_hcd *xhci)struct device *dev =xhci_to_hcd (xhci)->self.sysdev;int err, i;u64 val; +u32 intrs;/* * Some Renesas controllers get into a weird state if they are
@@ -266,7 +267,10 @@ static void xhci_zero_64b_regs(struct xhci_hcd *xhci)if (upper_32_bits (val))xhci_write_64 (xhci,0 , &xhci->op_regs->cmd_ring); -for (i =0 ; i <HCS_MAX_INTRS (xhci->hcs_params1); i++) { + intrs =min_t (u32,HCS_MAX_INTRS (xhci->hcs_params1), +ARRAY_SIZE (xhci->run_regs->ir_set)); + +for (i =0 ; i < intrs; i++) {struct xhci_intr_reg __iomem *ir; ir = &xhci->run_regs->ir_set[i];
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 58/184 spi: dln2: Fix reference leak to master
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 9b844b087124c1538d05f40fda8a4fec75af55be ]
Call spi_master_get() holds the reference count to master device, thus we need an additional spi_master_put() call to reduce the reference count, otherwise we will leak a reference to master.
This commit fix it by removing the unnecessary spi_master_get().
--- drivers/spi/spi-dln2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-dln2.c +1 -1
@@ -780,7 +780,7 @@ exit_free_master:static int dln2_spi_remove (struct platform_device *pdev) { -struct spi_master *master =spi_master_get (platform_get_drvdata (pdev)); +struct spi_master *master =platform_get_drvdata (pdev);struct dln2_spi *dln2 =spi_master_get_devdata (master);pm_runtime_disable (&pdev->dev);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 59/184 spi: omap-100k: Fix reference leak to master
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit a23faea76d4cf5f75decb574491e66f9ecd707e7 ]
Call spi_master_get() holds the reference count to master device, thus we need an additional spi_master_put() call to reduce the reference count, otherwise we will leak a reference to master.
This commit fix it by removing the unnecessary spi_master_get().
--- drivers/spi/spi-omap-100k.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/spi/spi-omap-100k.c +3 -3
@@ -426,7 +426,7 @@ err:static int omap1_spi100k_remove (struct platform_device *pdev) { -struct spi_master *master =spi_master_get (platform_get_drvdata (pdev)); +struct spi_master *master =platform_get_drvdata (pdev);struct omap1_spi100k *spi100k =spi_master_get_devdata (master);pm_runtime_disable (&pdev->dev);
@@ -440,7 +440,7 @@ static int omap1_spi100k_remove(struct platform_device *pdev)#ifdef CONFIG_PM static int omap1_spi100k_runtime_suspend (struct device *dev) { -struct spi_master *master =spi_master_get (dev_get_drvdata (dev)); +struct spi_master *master =dev_get_drvdata (dev);struct omap1_spi100k *spi100k =spi_master_get_devdata (master);clk_disable_unprepare (spi100k->ick);
@@ -451,7 +451,7 @@ static int omap1_spi100k_runtime_suspend(struct device *dev)static int omap1_spi100k_runtime_resume (struct device *dev) { -struct spi_master *master =spi_master_get (dev_get_drvdata (dev)); +struct spi_master *master =dev_get_drvdata (dev);struct omap1_spi100k *spi100k =spi_master_get_devdata (master);int ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 60/184 spi: qup: fix PM reference leak in spi_qup_remove()
In reply to Greg Kroah-HartmanFrom: Wang Li <[email protected]>
[ Upstream commit cec77e0a249892ceb10061bf17b63f9fb111d870 ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/spi/spi-qup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-qup.c +1 -1
@@ -1263,7 +1263,7 @@ static int spi_qup_remove(struct platform_device *pdev)struct spi_qup *controller =spi_master_get_devdata (master);int ret; - ret =pm_runtime_get_sync (&pdev->dev); + ret =pm_runtime_resume_and_get (&pdev->dev);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 61/184 usb: musb: fix PM reference leak in musb_irq_work()
In reply to Greg Kroah-HartmanFrom: Bixuan Cui <[email protected]>
[ Upstream commit 9535b99533904e9bc1607575aa8e9539a55435d7 ]
pm_runtime_get_sync will increment pm usage counter even it failed. thus a pairing decrement is needed.
Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/usb/musb/musb_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/musb/musb_core.c +1 -1
@@ -1932,7 +1932,7 @@ static void musb_irq_work(struct work_struct *data) struct musb *musb = container_of(data, struct musb, irq_work.work);int error; - error =pm_runtime_get_sync (musb->controller); + error =pm_runtime_resume_and_get (musb->controller);if (error <0 ) {dev_err (musb->controller,"Could not enable: %i\n" , error);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 62/184 usb: core: hub: Fix PM reference leak in usb_port_resume()
In reply to Greg Kroah-HartmanFrom: Bixuan Cui <[email protected]>
[ Upstream commit 025f97d188006eeee4417bb475a6878d1e0eed3f ]
pm_runtime_get_sync will increment pm usage counter even it failed. thus a pairing decrement is needed.
Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/usb/core/hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/core/hub.c +1 -1
@@ -3537,7 +3537,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)u16 portchange, portstatus;if (!test_and_set_bit (port1, hub->child_usage_bits)) { - status =pm_runtime_get_sync (&port_dev->dev); + status =pm_runtime_resume_and_get (&port_dev->dev);if (status <0 ) {dev_dbg (&udev->dev,"can't resume usb port, status %d\n" , status);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 63/184 tty: n_gsm: check error while registering tty devices
In reply to Greg Kroah-HartmanFrom: Hillf Danton <[email protected]>
[ Upstream commit 0a360e8b65d62fe1a994f0a8da4f8d20877b2100 ]
Add the error path for registering tty devices and roll back in case of error in bid to avoid the UAF like the below one reported.
Plus syzbot reported general protection fault in cdev_del() on Sep 24, 2020 and both cases are down to the kobject_put() in tty_cdev_add().
------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 1 PID: 8923 at lib/refcount.c:28 refcount_warn_saturate+0x1cf/0x210 -origin/lib/refcount.c:28 Modules linked in: CPU: 1 PID: 8923 Comm: executor Not tainted 5.12.0-rc5+ #8 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 RIP: 0010:refcount_warn_saturate+0x1cf/0x210 -origin/lib/refcount.c:28 Code: 4f ff ff ff e8 32 fa b5 fe 48 c7 c7 3d f8 f6 86 e8 d6 ab c6 fe c6 05 7c 34 67 04 01 48 c7 c7 68 f8 6d 86 31 c0 e8 81 2e 9d fe <0f> 0b e9 22 ff ff ff e8 05 fa b5 fe 48 c7 c7 3e f8 f6 86 e8 a9 ab RSP: 0018:ffffc90001633c60 EFLAGS: 00010246 RAX: 15d08b2e34b77800 RBX: 0000000000000003 RCX: ffff88804c056c80 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000003 R08: ffffffff813767aa R09: 0001ffffffffffff R10: 0001ffffffffffff R11: ffff88804c056c80 R12: ffff888040b7d000 R13: ffff88804c206938 R14: ffff88804c206900 R15: ffff888041b18488 FS: 00000000022c9940(0000) GS:ffff88807ec00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f9f9b122008 CR3: 0000000044b4b000 CR4: 0000000000750ee0 PKRU: 55555554 Call Trace: __refcount_sub_and_test -origin/./include/linux/refcount.h:283 [inline] __refcount_dec_and_test -origin/./include/linux/refcount.h:315 [inline] refcount_dec_and_test -origin/./include/linux/refcount.h:333 [inline] kref_put -origin/./include/linux/kref.h:64 [inline] kobject_put+0x17b/0x180 -origin/lib/kobject.c:753 cdev_del+0x4b/0x50 -origin/fs/char_dev.c:597 tty_unregister_device+0x99/0xd0 -origin/drivers/tty/tty_io.c:3343 gsmld_detach_gsm -origin/drivers/tty/n_gsm.c:2409 [inline] gsmld_close+0x6c/0x140 -origin/drivers/tty/n_gsm.c:2478 tty_ldisc_close -origin/drivers/tty/tty_ldisc.c:488 [inline] tty_ldisc_kill -origin/drivers/tty/tty_ldisc.c:636 [inline] tty_ldisc_release+0x1b6/0x400 -origin/drivers/tty/tty_ldisc.c:809 tty_release_struct+0x19/0xb0 -origin/drivers/tty/tty_io.c:1714 tty_release+0x9ad/0xa00 -origin/drivers/tty/tty_io.c:1885 __fput+0x260/0x4e0 -origin/fs/file_table.c:280 ____fput+0x11/0x20 -origin/fs/file_table.c:313 task_work_run+0x8e/0x110 -origin/kernel/task_work.c:140 tracehook_notify_resume -origin/./include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop -origin/kernel/entry/common.c:174 [inline] exit_to_user_mode_prepare+0x16b/0x1a0 -origin/kernel/entry/common.c:208 __syscall_exit_to_user_mode_work -origin/kernel/entry/common.c:290 [inline] syscall_exit_to_user_mode+0x20/0x40 -origin/kernel/entry/common.c:301 do_syscall_64+0x45/0x80 -origin/arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xae
--- drivers/tty/n_gsm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/tty/n_gsm.c +12 -2
@@ -2377,8 +2377,18 @@ static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)/* Don't register device 0 - this is the control channel and not a usable tty interface */ base =mux_num_to_base (gsm);/* Base for this MUX */ -for (i =1 ; i <NUM_DLCI ; i++) -tty_register_device (gsm_tty_driver, base + i,NULL ); +for (i =1 ; i <NUM_DLCI ; i++) { +struct device *dev; + + dev =tty_register_device (gsm_tty_driver, + base + i,NULL ); +if (IS_ERR (dev)) { +for (i--; i >=1 ; i--) +tty_unregister_device (gsm_tty_driver, + base + i); +return PTR_ERR (dev); + } + } }return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 64/184 intel_th: Consistency and off-by-one fix
In reply to Greg Kroah-HartmanFrom: Pavel Machek <[email protected]>
[ Upstream commit 18ffbc47d45a1489b664dd68fb3a7610a6e1dea3 ]
Consistently use "< ... +1" in for loops.
Fix of-by-one in for_each_set_bit().
--- drivers/hwtracing/intel_th/gth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwtracing/intel_th/gth.c +2 -2
@@ -543,7 +543,7 @@ static void intel_th_gth_disable(struct intel_th_device *thdev, output->active = false;for_each_set_bit (master, gth->output[output->port].master, -TH_CONFIGURABLE_MASTERS ) { +TH_CONFIGURABLE_MASTERS +1 ) {gth_master_set (gth, master,-1 ); }spin_unlock (>h->gth_lock);
@@ -697,7 +697,7 @@ static void intel_th_gth_unassign(struct intel_th_device *thdev, othdev->output.port =-1 ; othdev->output.active = false; gth->output[port].output =NULL ; -for (master =0 ; master <=TH_CONFIGURABLE_MASTERS ; master++) +for (master =0 ; master <TH_CONFIGURABLE_MASTERS +1 ; master++)if (gth->master[master] == port) gth->master[master] =-1 ;spin_unlock (>h->gth_lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 65/184 phy: phy-twl4030-usb: Fix possible use-after-free in twl4030_usb_remove()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit e1723d8b87b73ab363256e7ca3af3ddb75855680 ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/phy/ti/phy-twl4030-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/ti/phy-twl4030-usb.c +1 -1
@@ -779,7 +779,7 @@ static int twl4030_usb_remove(struct platform_device *pdev)usb_remove_phy (&twl->phy);pm_runtime_get_sync (twl->dev); -cancel_delayed_work (&twl->id_workaround_work); +cancel_delayed_work_sync (&twl->id_workaround_work);device_remove_file (twl->dev, &dev_attr_vbus);/* set transceiver mode to power on defaults */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 66/184 crypto: stm32/hash - Fix PM reference leak on stm32-hash.c
In reply to Greg Kroah-HartmanFrom: Shixin Liu <[email protected]>
[ Upstream commit 1cb3ad701970e68f18a9e5d090baf2b1b703d729 ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/crypto/stm32/stm32-hash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/stm32/stm32-hash.c +4 -4
@@ -810,7 +810,7 @@ static void stm32_hash_finish_req(struct ahash_request *req, int err)static int stm32_hash_hw_init (struct stm32_hash_dev *hdev,struct stm32_hash_request_ctx *rctx) { -pm_runtime_get_sync (hdev->dev); +pm_runtime_resume_and_get (hdev->dev);if (!(HASH_FLAGS_INIT & hdev->flags)) {stm32_hash_write (hdev,HASH_CR ,HASH_CR_INIT );
@@ -959,7 +959,7 @@ static int stm32_hash_export(struct ahash_request *req, void *out)u32 *preg;unsigned int i; -pm_runtime_get_sync (hdev->dev); +pm_runtime_resume_and_get (hdev->dev);while ((stm32_hash_read (hdev,HASH_SR ) &HASH_SR_BUSY ))cpu_relax ();
@@ -997,7 +997,7 @@ static int stm32_hash_import(struct ahash_request *req, const void *in) preg = rctx->hw_context; -pm_runtime_get_sync (hdev->dev); +pm_runtime_resume_and_get (hdev->dev);stm32_hash_write (hdev,HASH_IMR , *preg++);stm32_hash_write (hdev,HASH_STR , *preg++);
@@ -1553,7 +1553,7 @@ static int stm32_hash_remove(struct platform_device *pdev)if (!hdev)return -ENODEV ; - ret =pm_runtime_get_sync (hdev->dev); + ret =pm_runtime_resume_and_get (hdev->dev);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 67/184 crypto: stm32/cryp - Fix PM reference leak on stm32-cryp.c
In reply to Greg Kroah-HartmanFrom: Shixin Liu <[email protected]>
[ Upstream commit 747bf30fd944f02f341b5f3bc7d97a13f2ae2fbe ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/crypto/stm32/stm32-cryp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/stm32/stm32-cryp.c +2 -2
@@ -537,7 +537,7 @@ static int stm32_cryp_hw_init(struct stm32_cryp *cryp)int ret;u32 cfg, hw_mode; -pm_runtime_get_sync (cryp->dev); +pm_runtime_resume_and_get (cryp->dev);/* Disable interrupt */ stm32_cryp_write (cryp,CRYP_IMSCR ,0 );
@@ -2054,7 +2054,7 @@ static int stm32_cryp_remove(struct platform_device *pdev)if (!cryp)return -ENODEV ; - ret =pm_runtime_get_sync (cryp->dev); + ret =pm_runtime_resume_and_get (cryp->dev);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 68/184 crypto: omap-aes - Fix PM reference leak on omap-aes.c
In reply to Greg Kroah-HartmanFrom: Shixin Liu <[email protected]>
[ Upstream commit 1f34cc4a8da34fbb250efb928f9b8c6fe7ee0642 ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/crypto/omap-aes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/omap-aes.c +3 -3
@@ -103,7 +103,7 @@ static int omap_aes_hw_init(struct omap_aes_dev *dd) dd->err =0 ; } - err =pm_runtime_get_sync (dd->dev); + err =pm_runtime_resume_and_get (dd->dev);if (err <0 ) {dev_err (dd->dev,"failed to get sync: %d\n" , err);return err;
@@ -1153,7 +1153,7 @@ static int omap_aes_probe(struct platform_device *pdev)pm_runtime_set_autosuspend_delay (dev,DEFAULT_AUTOSUSPEND_DELAY );pm_runtime_enable (dev); - err =pm_runtime_get_sync (dev); + err =pm_runtime_resume_and_get (dev);if (err <0 ) {dev_err (dev,"%s: failed to get_sync(%d)\n" , __func__, err);
@@ -1318,7 +1318,7 @@ static int omap_aes_suspend(struct device *dev)static int omap_aes_resume (struct device *dev) { -pm_runtime_get_sync (dev); +pm_runtime_resume_and_get (dev);return 0 ; }#endif
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 69/184 platform/x86: intel_pmc_core: Dont use global pmcdev in quirks
In reply to Greg Kroah-HartmanFrom: David E. Box <[email protected]>
[ Upstream commit c9f86d6ca6b5e23d30d16ade4b9fff5b922a610a ]
The DMI callbacks, used for quirks, currently access the PMC by getting the address a global pmc_dev struct. Instead, have the callbacks set a global quirk specific variable. In probe, after calling dmi_check_system(), pass pmc_dev to a function that will handle each quirk if its variable condition is met. This allows removing the global pmc_dev later.
--- drivers/platform/x86/intel_pmc_core.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/platform/x86/intel_pmc_core.c +16 -3
@@ -831,9 +831,15 @@ static const struct pci_device_id pmc_pci_ids[] = {* the platform BIOS enforces 24Mhx Crystal to shutdown * before PMC can assert SLP_S0#. */ +static bool xtal_ignore;static int quirk_xtal_ignore (const struct dmi_system_id *id) { -struct pmc_dev *pmcdev = &pmc; + xtal_ignore = true; +return 0 ; +} + +static void pmc_core_xtal_ignore (struct pmc_dev *pmcdev) +{u32 value; value =pmc_core_reg_read (pmcdev, pmcdev->map->pm_vric1_offset);
@@ -842,7 +848,6 @@ static int quirk_xtal_ignore(const struct dmi_system_id *id)/* Low Voltage Mode Enable */ value &= ~SPT_PMC_VRIC1_SLPS0LVEN ;pmc_core_reg_write (pmcdev, pmcdev->map->pm_vric1_offset, value); -return 0 ; }static const struct dmi_system_id pmc_core_dmi_table[] = {
@@ -857,6 +862,14 @@ static const struct dmi_system_id pmc_core_dmi_table[] = { {} }; +static void pmc_core_do_dmi_quirks (struct pmc_dev *pmcdev) +{ +dmi_check_system (pmc_core_dmi_table); + +if (xtal_ignore) +pmc_core_xtal_ignore (pmcdev); +} +static int pmc_core_probe (struct platform_device *pdev) {static bool device_initialized;
@@ -898,7 +911,7 @@ static int pmc_core_probe(struct platform_device *pdev)mutex_init (&pmcdev->lock);platform_set_drvdata (pdev, pmcdev); pmcdev->pmc_xram_read_bit =pmc_core_check_read_lock_bit (); -dmi_check_system (pmc_core_dmi_table); +pmc_core_do_dmi_quirks (pmcdev);pmc_core_dbgfs_register (pmcdev);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 70/184 btrfs: convert logic BUG_ON()s in replace_path to ASSERT()s
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit 7a9213a93546e7eaef90e6e153af6b8fc7553f10 ]
A few BUG_ON()'s in replace_path are purely to keep us from making logical mistakes, so replace them with ASSERT()'s.
--- fs/btrfs/relocation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/btrfs/relocation.c +3 -3
@@ -1836,8 +1836,8 @@ int replace_path(struct btrfs_trans_handle *trans, struct reloc_control *rc,int ret;int slot; -BUG_ON (src->root_key.objectid !=BTRFS_TREE_RELOC_OBJECTID ); -BUG_ON (dest->root_key.objectid ==BTRFS_TREE_RELOC_OBJECTID ); +ASSERT (src->root_key.objectid ==BTRFS_TREE_RELOC_OBJECTID ); +ASSERT (dest->root_key.objectid !=BTRFS_TREE_RELOC_OBJECTID ); last_snapshot =btrfs_root_last_snapshot (&src->root_item); again:
@@ -1871,7 +1871,7 @@ again:struct btrfs_key first_key; level =btrfs_header_level (parent); -BUG_ON (level < lowest_level); +ASSERT (level >= lowest_level); ret =btrfs_bin_search (parent, &key, level, &slot);if (ret <0 )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 71/184 drm: Added orientation quirk for OneGX1 Pro
In reply to Greg Kroah-HartmanFrom: Jared Baldridge <[email protected]>
[ Upstream commit 81ad7f9f78e4ff80e95be8282423f511b84f1166 ]
The OneGX1 Pro has a fairly unique combination of generic strings, but we additionally match on the BIOS date just to be safe.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +14 -0
@@ -84,6 +84,13 @@ static const struct drm_dmi_panel_orientation_data itworks_tw891 = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data onegx1_pro = { + .width =1200 , + .height =1920 , + .bios_dates = (const char *const []){"12/17/2020" ,NULL }, + .orientation =DRM_MODE_PANEL_ORIENTATION_RIGHT_UP , +}; +static const struct drm_dmi_panel_orientation_data lcd720x1280_rightside_up = { .width =720 , .height =1280 ,
@@ -211,6 +218,13 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), }, .driver_data = (void *)&lcd1200x1920_rightside_up, + }, { /* OneGX1 Pro */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"SYSTEM_MANUFACTURER" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"SYSTEM_PRODUCT_NAME" ), + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Default string"), + }, + .driver_data = (void *)&onegx1_pro, }, { /* VIOS LTH17 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 72/184 drm/qxl: release shadow on shutdown
In reply to Greg Kroah-HartmanFrom: Gerd Hoffmann <[email protected]>
[ Upstream commit 4ca77c513537700d3fae69030879f781dde1904c ]
In case we have a shadow surface on shutdown release it so it doesn't leak.
--- drivers/gpu/drm/qxl/qxl_display.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/qxl/qxl_display.c +4 -0
@@ -1237,6 +1237,10 @@ int qxl_modeset_init(struct qxl_device *qdev)void qxl_modeset_fini (struct qxl_device *qdev) { +if (qdev->dumb_shadow_bo) { +drm_gem_object_put (&qdev->dumb_shadow_bo->tbo.base); + qdev->dumb_shadow_bo =NULL ; + }qxl_destroy_monitors_object (qdev);drm_mode_config_cleanup (&qdev->ddev); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 73/184 drm/amd/display: Check for DSC support instead of ASIC revision
In reply to Greg Kroah-HartmanFrom: Eryk Brol <[email protected]>
[ Upstream commit 349a19b2f1b01e713268c7de9944ad669ccdf369 ]
[why]
This check for ASIC revision is no longer useful and causes lightup issues after a topology change in MST DSC scenario. In this case, DSC configs should be recalculated for the new topology. This check prevented that from happening on certain ASICs that do, in fact, support DSC.
[how]
Change the ASIC revision to instead check if DSC is supported.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -7330,7 +7330,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, }#if defined(CONFIG_DRM_AMD_DC_DCN ) -if (adev->asic_type >=CHIP_NAVI10 ) { +if (dc_resource_is_dsc_encoding_supported (dc)) {for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {if (drm_atomic_crtc_needs_modeset (new_crtc_state)) { ret =add_affected_mst_dsc_crtcs (state, crtc);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 74/184 drm/amd/display: Dont optimize bandwidth before disabling planes
In reply to Greg Kroah-HartmanFrom: Aric Cyr <[email protected]>
[ Upstream commit 6ad98e8aeb0106f453bb154933e8355849244990 ]
[Why]
There is a window of time where we optimize bandwidth due to no streams enabled will enable PSTATE changing but HUBPs are not disabled yet. This results in underflow counter increasing in some hotplug scenarios.
[How]
Set the optimize-bandwidth flag for later processing once all the HUBPs are properly disabled.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -1
@@ -1961,7 +1961,8 @@ static void commit_planes_do_stream_update(struct dc *dc,if (pipe_ctx->stream_res.audio && !dc->debug.az_endpoint_mute_only) pipe_ctx->stream_res.audio->funcs->az_disable (pipe_ctx->stream_res.audio); - dc->hwss.optimize_bandwidth (dc, dc->current_state); + dc->optimized_required = true; + }else {if (!dc->optimize_seamless_boot) dc->hwss.prepare_bandwidth (dc, dc->current_state);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 75/184 scsi: lpfc: Fix incorrect dbde assignment when building target abts wqe
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit 9302154c07bff4e7f7f43c506a1ac84540303d06 ]
The wqe_dbde field indicates whether a Data BDE is present in Words 0:2 and should therefore should be clear in the abts request wqe. By setting the bit we can be misleading fw into error cases.
Clear the wqe_dbde field.
--- drivers/scsi/lpfc/lpfc_nvmet.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/lpfc/lpfc_nvmet.c +0 -1
@@ -3204,7 +3204,6 @@ lpfc_nvmet_unsol_issue_abort(struct lpfc_hba *phba,bf_set (wqe_rcvoxid, &wqe_abts->xmit_sequence.wqe_com, xri);/* Word 10 */ -bf_set (wqe_dbde, &wqe_abts->xmit_sequence.wqe_com,1 );bf_set (wqe_iod, &wqe_abts->xmit_sequence.wqe_com,LPFC_WQE_IOD_WRITE );bf_set (wqe_lenloc, &wqe_abts->xmit_sequence.wqe_com,LPFC_WQE_LENLOC_WORD12 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 76/184 scsi: lpfc: Fix pt2pt connection does not recover after LOGO
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit bd4f5100424d17d4e560d6653902ef8e49b2fc1f ]
On a pt2pt setup, between 2 initiators, if one side issues a a LOGO, there is no relogin attempt. The FC specs are grey in this area on which port (higher wwn or not) is to re-login.
As there is no spec guidance, unconditionally re-PLOGI after the logout to ensure a login is re-established.
--- drivers/scsi/lpfc/lpfc_nportdisc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_nportdisc.c +7 -2
@@ -888,9 +888,14 @@ lpfc_rcv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, } }else if ((!(ndlp->nlp_type &NLP_FABRIC ) && ((ndlp->nlp_type &NLP_FCP_TARGET ) || - !(ndlp->nlp_type &NLP_FCP_INITIATOR ))) || + (ndlp->nlp_type &NLP_NVME_TARGET ) || + (vport->fc_flag &FC_PT2PT ))) || (ndlp->nlp_state ==NLP_STE_ADISC_ISSUE )) { -/* Only try to re-login if this is NOT a Fabric Node */ +/* Only try to re-login if this is NOT a Fabric Node +* AND the remote NPORT is a FCP/NVME Target or we +* are in pt2pt mode. NLP_STE_ADISC_ISSUE is a special +* case for LOGO as a response to ADISC behavior. +*/ mod_timer (&ndlp->nlp_delayfunc, jiffies +msecs_to_jiffies (1000 *1 ));spin_lock_irq (shost->host_lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 77/184 scsi: target: pscsi: Fix warning in pscsi_complete_cmd()
In reply to Greg Kroah-HartmanFrom: Chaitanya Kulkarni <[email protected]>
[ Upstream commit fd48c056a32ed6e7754c7c475490f3bed54ed378 ]
This fixes a compilation warning in pscsi_complete_cmd():
drivers/target/target_core_pscsi.c: In function ‘pscsi_complete_cmd’:
drivers/target/target_core_pscsi.c:624:5: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] ; /* XXX: TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE */
--- drivers/target/target_core_pscsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/target/target_core_pscsi.c +2 -1
@@ -620,8 +620,9 @@ static void pscsi_complete_cmd(struct se_cmd *cmd, u8 scsi_status,unsigned char *buf; buf =transport_kmap_data_sg (cmd); -if (!buf) +if (!buf) { ;/* XXX: TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE */ + }if (cdb[0 ] ==MODE_SENSE_10 ) {if (!(buf[3 ] &0x80 ))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 78/184 media: ite-cir: check for receive overflow
In reply to Greg Kroah-HartmanFrom: Sean Young <[email protected]>
[ Upstream commit 28c7afb07ccfc0a939bb06ac1e7afe669901c65a ]
It's best if this condition is reported.
--- drivers/media/rc/ite-cir.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/rc/ite-cir.c +7 -1
@@ -276,8 +276,14 @@ static irqreturn_t ite_cir_isr(int irq, void *data)/* read the interrupt flags */ iflags = dev->params.get_irq_causes (dev); +/* Check for RX overflow */ +if (iflags &ITE_IRQ_RX_FIFO_OVERRUN ) { +dev_warn (&dev->rdev->dev,"receive overflow\n" ); +ir_raw_event_reset (dev->rdev); + } +/* check for the receive interrupt */ -if (iflags & (ITE_IRQ_RX_FIFO |ITE_IRQ_RX_FIFO_OVERRUN )) { +if (iflags &ITE_IRQ_RX_FIFO ) {/* read the FIFO bytes */ rx_bytes = dev->params.get_rx_bytes(dev, rx_buf,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 79/184 media: drivers: media: pci: sta2x11: fix Kconfig dependency on GPIOLIB
In reply to Greg Kroah-HartmanFrom: Julian Braha <[email protected]>
[ Upstream commit 24df8b74c8b2fb42c49ffe8585562da0c96446ff ]
When STA2X11_VIP is enabled, and GPIOLIB is disabled, Kbuild gives the following warning:
WARNING: unmet direct dependencies detected for VIDEO_ADV7180
Depends on [n]: MEDIA_SUPPORT [=y] && GPIOLIB [=n] && VIDEO_V4L2 [=y] && I2C [=y]
Selected by [y]:
- STA2X11_VIP [=y] && MEDIA_SUPPORT [=y] && MEDIA_PCI_SUPPORT [=y] && MEDIA_CAMERA_SUPPORT [=y] && PCI [=y] && VIDEO_V4L2 [=y] && VIRT_TO_BUS [=y] && I2C [=y] && (STA2X11 [=n] || COMPILE_TEST [=y]) && MEDIA_SUBDRV_AUTOSELECT [=y]
This is because STA2X11_VIP selects VIDEO_ADV7180
without selecting or depending on GPIOLIB,
despite VIDEO_ADV7180 depending on GPIOLIB.
--- drivers/media/pci/sta2x11/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/sta2x11/Kconfig +1 -0
@@ -2,6 +2,7 @@ config STA2X11_VIP tristate "STA2X11 VIP Video For Linux" depends on STA2X11 || COMPILE_TEST + select GPIOLIB if MEDIA_SUBDRV_AUTOSELECT select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT select VIDEOBUF2_DMA_CONTIG depends on PCI && VIDEO_V4L2 && VIRT_TO_BUS
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 80/184 media: imx: capture: Return -EPIPE from __capture_legacy_try_fmt()
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit cc271b6754691af74d710b761eaf027e3743e243 ]
The correct return code to report an invalid pipeline configuration is -EPIPE. Return it instead of -EINVAL from __capture_legacy_try_fmt() when the capture format doesn't match the media bus format of the connected subdev.
--- drivers/staging/media/imx/imx-media-capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/imx/imx-media-capture.c +1 -1
@@ -553,7 +553,7 @@ static int capture_validate_fmt(struct capture_priv *priv) priv->vdev.fmt.fmt.pix.height != f.fmt.pix.height || priv->vdev.cc->cs != cc->cs || priv->vdev.compose.width != compose.width || - priv->vdev.compose.height != compose.height) ? -EINVAL : 0; + priv->vdev.compose.height != compose.height) ? -EPIPE : 0; }static int capture_start_streaming (struct vb2_queue *vq,unsigned int count)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 81/184 power: supply: bq27xxx: fix power_avg for newer ICs
In reply to Greg Kroah-HartmanFrom: Matthias Schiffer <[email protected]>
[ Upstream commit c4d57c22ac65bd503716062a06fad55a01569cac ]
On all newer bq27xxx ICs, the AveragePower register contains a signed value; in addition to handling the raw value as unsigned, the driver code also didn't convert it to µW as expected.
At least for the BQ28Z610, the reference manual incorrectly states that the value is in units of 1mW and not 10mW. I have no way of knowing whether the manuals of other supported ICs contain the same error, or if there are models that actually use 1mW. At least, the new code shouldn't be *less* correct than the old version for any device.
power_avg is removed from the cache structure, se we don't have to extend it to store both a signed value and an error code. Always getting an up-to-date value may be desirable anyways, as it avoids inconsistent current and power readings when switching between charging and discharging.
--- drivers/power/supply/bq27xxx_battery.c | 51 ++++++++++++++------------ include/linux/power/bq27xxx_battery.h | 1 - 2 files changed, 27 insertions(+), 25 deletions(-)
drivers/power/supply/bq27xxx_battery.c +27 -24
@@ -1499,27 +1499,6 @@ static int bq27xxx_battery_read_time(struct bq27xxx_device_info *di, u8 reg)return tval *60 ; } -/* -* Read an average power register. -* Return < 0 if something fails. -*/ -static int bq27xxx_battery_read_pwr_avg (struct bq27xxx_device_info *di) -{ -int tval; - - tval =bq27xxx_read (di,BQ27XXX_REG_AP , false); -if (tval <0 ) { -dev_err (di->dev,"error reading average power register %02x: %d\n" , -BQ27XXX_REG_AP , tval); -return tval; - } - -if (di->opts &BQ27XXX_O_ZERO ) -return (tval *BQ27XXX_POWER_CONSTANT ) /BQ27XXX_RS ; -else -return tval; -} -/* * Returns true if a battery over temperature condition is detected */
@@ -1604,8 +1583,6 @@ void bq27xxx_battery_update(struct bq27xxx_device_info *di) }if (di->regs[BQ27XXX_REG_CYCT ] !=INVALID_REG_ADDR ) cache.cycle_count =bq27xxx_battery_read_cyct (di); -if (di->regs[BQ27XXX_REG_AP ] !=INVALID_REG_ADDR ) - cache.power_avg =bq27xxx_battery_read_pwr_avg (di);/* We only have to read charge design full once */ if (di->charge_design_full <=0 )
@@ -1668,6 +1645,32 @@ static int bq27xxx_battery_current(struct bq27xxx_device_info *di,return 0 ; } +/* +* Get the average power in µW +* Return < 0 if something fails. +*/ +static int bq27xxx_battery_pwr_avg (struct bq27xxx_device_info *di, +union power_supply_propval *val) +{ +int power; + + power =bq27xxx_read (di,BQ27XXX_REG_AP , false); +if (power <0 ) { +dev_err (di->dev, +"error reading average power register %02x: %d\n" , +BQ27XXX_REG_AP , power); +return power; + } + +if (di->opts &BQ27XXX_O_ZERO ) + val->intval = (power *BQ27XXX_POWER_CONSTANT ) /BQ27XXX_RS ; +else +/* Other gauges return a signed value in units of 10mW */ + val->intval = (int )((s16 )power) *10000 ; + +return 0 ; +} +static int bq27xxx_battery_status (struct bq27xxx_device_info *di,union power_supply_propval *val) {
@@ -1835,7 +1838,7 @@ static int bq27xxx_battery_get_property(struct power_supply *psy, ret =bq27xxx_simple_value (di->cache.energy, val);break ;case POWER_SUPPLY_PROP_POWER_AVG : - ret =bq27xxx_simple_value (di->cache.power_avg, val); + ret =bq27xxx_battery_pwr_avg (di, val);break ;case POWER_SUPPLY_PROP_HEALTH : ret =bq27xxx_simple_value (di->cache.health, val);
include/linux/power/bq27xxx_battery.h +0 -1
@@ -50,7 +50,6 @@ struct bq27xxx_reg_cache {int capacity;int energy;int flags; -int power_avg;int health; };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 82/184 extcon: arizona: Fix some issues when HPDET IRQ fires after the jack has been unplugged
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit c309a3e8793f7e01c4a4ec7960658380572cb576 ]
When the jack is partially inserted and then removed again it may be removed while the hpdet code is running. In this case the following may happen:
1. The "JACKDET rise" or ""JACKDET fall" IRQ triggers
2. arizona_jackdet runs and takes info->lock
3. The "HPDET" IRQ triggers
4. arizona_hpdet_irq runs, blocks on info->lock
5. arizona_jackdet calls arizona_stop_mic() and clears info->hpdet_done
6. arizona_jackdet releases info->lock
7. arizona_hpdet_irq now can continue running and:
7.1 Calls arizona_start_mic() (if a mic was detected)
7.2 sets info->hpdet_done
Step 7 is undesirable / a bug:
7.1 causes the device to stay in a high power-state (with MICVDD enabled) 7.2 causes hpdet to not run on the next jack insertion, which in turn
causes the EXTCON_JACK_HEADPHONE state to never get set
This fixes both issues by skipping these 2 steps when arizona_hpdet_irq runs after the jack has been unplugged.
--- drivers/extcon/extcon-arizona.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/extcon/extcon-arizona.c +9 -8
@@ -597,7 +597,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)struct arizona *arizona = info->arizona;int id_gpio = arizona->pdata.hpdet_id_gpio;unsigned int report =EXTCON_JACK_HEADPHONE ; -int ret, reading; +int ret, reading, state;bool mic = false;mutex_lock (&info->lock);
@@ -610,12 +610,11 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) }/* If the cable was removed while measuring ignore the result */ - ret =extcon_get_state (info->edev,EXTCON_MECHANICAL ); -if (ret <0 ) { -dev_err (arizona->dev,"Failed to check cable state: %d\n" , - ret); + state =extcon_get_state (info->edev,EXTCON_MECHANICAL ); +if (state <0 ) { +dev_err (arizona->dev,"Failed to check cable state: %d\n" , state); goto out; - }else if (!ret) { + }else if (!state) {dev_dbg (arizona->dev,"Ignoring HPDET for removed cable\n" ); goto done; }
@@ -668,7 +667,7 @@ done: ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);/* If we have a mic then reenable MICDET */ -if (mic || info->mic) +if (state && (mic || info->mic))arizona_start_mic (info);if (info->hpdet_active) {
@@ -676,7 +675,9 @@ done: info->hpdet_active = false; } - info->hpdet_done = true; +/* Do not set hp_det done when the cable has been unplugged */ +if (state) + info->hpdet_done = true; out:mutex_unlock (&info->lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 83/184 extcon: arizona: Fix various races on driver unbind
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit e5b499f6fb17bc95a813e85d0796522280203806 ]
We must free/disable all interrupts and cancel all pending works before doing further cleanup.
Before this commit arizona_extcon_remove() was doing several register writes to shut things down before disabling the IRQs and it was cancelling only 1 of the 3 different works used.
Move all the register-writes shutting things down to after the disabling of the IRQs and add the 2 missing cancel_delayed_work_sync() calls.
This fixes various possible races on driver unbind. One of which would always trigger on devices using the mic-clamp feature for jack detection. The ARIZONA_MICD_CLAMP_MODE_MASK update was done before disabling the IRQs, causing:
1. arizona_jackdet() to run
2. detect a jack being inserted (clamp disabled means jack inserted)
3. call arizona_start_mic() which:
3.1 Enables the MICVDD regulator
3.2 takes a pm_runtime_reference
And this was all happening after the ARIZONA_MICD_ENA bit clearing, which would undo 3.1 and 3.2 because the ARIZONA_MICD_CLAMP_MODE_MASK update was being done after the ARIZONA_MICD_ENA bit clearing.
So this means that arizona_extcon_remove() would exit with
1. MICVDD enabled and 2. The pm_runtime_reference being unbalanced.
MICVDD still being enabled caused the following oops when the regulator is released by the devm framework:
[ 2850.745757] ------------[ cut here ]------------ [ 2850.745827] WARNING: CPU: 2 PID: 2098 at drivers/regulator/core.c:2123 _regulator_put.part.0+0x19f/0x1b0 [ 2850.745835] Modules linked in: extcon_arizona ... ... [ 2850.746909] Call Trace: [ 2850.746932] regulator_put+0x2d/0x40 [ 2850.746946] release_nodes+0x22a/0x260 [ 2850.746984] __device_release_driver+0x190/0x240 [ 2850.747002] driver_detach+0xd4/0x120 ... [ 2850.747337] ---[ end trace f455dfd7abd9781f ]---
Note this oops is just one of various theoretically possible races caused by the wrong ordering inside arizona_extcon_remove(), this fixes the ordering fixing all possible races, including the reported oops.
--- drivers/extcon/extcon-arizona.c | 40 +++++++++++++++++---------------- 1 file changed, 21 insertions(+), 19 deletions(-)
drivers/extcon/extcon-arizona.c +21 -19
@@ -1725,25 +1725,6 @@ static int arizona_extcon_remove(struct platform_device *pdev)bool change;int ret; - ret =regmap_update_bits_check (arizona->regmap,ARIZONA_MIC_DETECT_1 , -ARIZONA_MICD_ENA ,0 , - &change); -if (ret <0 ) { -dev_err (&pdev->dev,"Failed to disable micd on remove: %d\n" , - ret); - }else if (change) { -regulator_disable (info->micvdd); -pm_runtime_put (info->dev); - } - -gpiod_put (info->micd_pol_gpio); - -pm_runtime_disable (&pdev->dev); - -regmap_update_bits (arizona->regmap, -ARIZONA_MICD_CLAMP_CONTROL , -ARIZONA_MICD_CLAMP_MODE_MASK ,0 ); -if (info->micd_clamp) { jack_irq_rise =ARIZONA_IRQ_MICD_CLAMP_RISE ; jack_irq_fall =ARIZONA_IRQ_MICD_CLAMP_FALL ;
@@ -1759,10 +1740,31 @@ static int arizona_extcon_remove(struct platform_device *pdev)arizona_free_irq (arizona, jack_irq_rise, info);arizona_free_irq (arizona, jack_irq_fall, info);cancel_delayed_work_sync (&info->hpdet_work); +cancel_delayed_work_sync (&info->micd_detect_work); +cancel_delayed_work_sync (&info->micd_timeout_work); + + ret =regmap_update_bits_check (arizona->regmap,ARIZONA_MIC_DETECT_1 , +ARIZONA_MICD_ENA ,0 , + &change); +if (ret <0 ) { +dev_err (&pdev->dev,"Failed to disable micd on remove: %d\n" , + ret); + }else if (change) { +regulator_disable (info->micvdd); +pm_runtime_put (info->dev); + } + +regmap_update_bits (arizona->regmap, +ARIZONA_MICD_CLAMP_CONTROL , +ARIZONA_MICD_CLAMP_MODE_MASK ,0 );regmap_update_bits (arizona->regmap,ARIZONA_JACK_DETECT_ANALOGUE ,ARIZONA_JD1_ENA ,0 );arizona_clk32k_disable (arizona); +gpiod_put (info->micd_pol_gpio); + +pm_runtime_disable (&pdev->dev); +return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 84/184 media: media/saa7164: fix saa7164_encoder_register() memory leak bugs
In reply to Greg Kroah-HartmanFrom: Daniel Niv <[email protected]>
[ Upstream commit c759b2970c561e3b56aa030deb13db104262adfe ]
Add a fix for the memory leak bugs that can occur when the saa7164_encoder_register() function fails.
The function allocates memory without explicitly freeing
it when errors occur.
Add a better error handling that deallocate the unused buffers before the function exits during a fail.
--- drivers/media/pci/saa7164/saa7164-encoder.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/media/pci/saa7164/saa7164-encoder.c +11 -9
@@ -1008,7 +1008,7 @@ int saa7164_encoder_register(struct saa7164_port *port)printk (KERN_ERR "%s() failed (errno = %d), NO PCI configuration\n" , __func__, result); result = -ENOMEM ; - goto failed; + goto fail_pci; }/* Establish encoder defaults here */
@@ -1062,7 +1062,7 @@ int saa7164_encoder_register(struct saa7164_port *port) 100000, ENCODER_DEF_BITRATE);if (hdl->error) { result = hdl->error; - goto failed; + goto fail_hdl; } port->std =V4L2_STD_NTSC_M ;
@@ -1080,7 +1080,7 @@ int saa7164_encoder_register(struct saa7164_port *port)printk (KERN_INFO "%s: can't allocate mpeg device\n" , dev->name); result = -ENOMEM ; - goto failed; + goto fail_hdl; } port->v4l_device->ctrl_handler = hdl;
@@ -1091,10 +1091,7 @@ int saa7164_encoder_register(struct saa7164_port *port)if (result <0 ) {printk (KERN_INFO "%s: can't register mpeg device\n" , dev->name); -/* TODO: We're going to leak here if we don't dealloc -The buffers above. The unreg function can't deal wit it. -*/ - goto failed; + goto fail_reg; } printk(KERN_INFO "%s: registered device video%d [mpeg]\n",
@@ -1116,9 +1113,14 @@ int saa7164_encoder_register(struct saa7164_port *port)saa7164_api_set_encoder (port);saa7164_api_get_encoder (port); +return 0 ; - result =0 ; -failed: +fail_reg: +video_device_release (port->v4l_device); + port->v4l_device =NULL ; +fail_hdl: +v4l2_ctrl_handler_free (hdl); +fail_pci:return result; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 85/184 media: gspca/sq905.c: fix uninitialized variable
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit eaaea4681984c79d2b2b160387b297477f0c1aab ]
act_len can be uninitialized if usb_bulk_msg() returns an error. Set it to 0 to avoid a KMSAN error.
--- drivers/media/usb/gspca/sq905.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/gspca/sq905.c +1 -1
@@ -158,7 +158,7 @@ static int sq905_read_data(struct gspca_dev *gspca_dev, u8 *data, int size, int need_lock) { int ret; -int act_len; +int act_len =0 ; gspca_dev->usb_buf[0 ] ='\0' ;if (need_lock)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 86/184 power: supply: Use IRQF_ONESHOT
In reply to Greg Kroah-HartmanFrom: dongjian <[email protected]>
[ Upstream commit 2469b836fa835c67648acad17d62bc805236a6ea ]
Fixes coccicheck error:
drivers/power/supply/pm2301_charger.c:1089:7-27: ERROR:
drivers/power/supply/lp8788-charger.c:502:8-28: ERROR:
drivers/power/supply/tps65217_charger.c:239:8-33: ERROR:
drivers/power/supply/tps65090-charger.c:303:8-33: ERROR:
Threaded IRQ with no primary handler requested without IRQF_ONESHOT
--- drivers/power/supply/lp8788-charger.c | 2 +- drivers/power/supply/pm2301_charger.c | 2 +- drivers/power/supply/tps65090-charger.c | 2 +- drivers/power/supply/tps65217_charger.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/power/supply/lp8788-charger.c +1 -1
@@ -501,7 +501,7 @@ static int lp8788_set_irqs(struct platform_device *pdev, ret =request_threaded_irq (virq,NULL , lp8788_charger_irq_thread, -0 , name, pchg); +IRQF_ONESHOT , name, pchg);if (ret)break ; }
drivers/power/supply/pm2301_charger.c +1 -1
@@ -1095,7 +1095,7 @@ static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client, ret =request_threaded_irq (gpio_to_irq (pm2->pdata->gpio_irq_number),NULL , pm2xxx_charger_irq[0 ].isr, - pm2->pdata->irq_type, + pm2->pdata->irq_type |IRQF_ONESHOT , pm2xxx_charger_irq[0 ].name, pm2);if (ret !=0 ) {
drivers/power/supply/tps65090-charger.c +1 -1
@@ -301,7 +301,7 @@ static int tps65090_charger_probe(struct platform_device *pdev)if (irq != -ENXIO ) { ret =devm_request_threaded_irq (&pdev->dev, irq,NULL , - tps65090_charger_isr,0 ,"tps65090-charger" , cdata); + tps65090_charger_isr,IRQF_ONESHOT ,"tps65090-charger" , cdata);if (ret) { dev_err(cdata->dev, "Unable to register irq %d err %d\n", irq,
drivers/power/supply/tps65217_charger.c +1 -1
@@ -238,7 +238,7 @@ static int tps65217_charger_probe(struct platform_device *pdev)for (i =0 ; i <NUM_CHARGER_IRQS ; i++) { ret =devm_request_threaded_irq (&pdev->dev, irq[i],NULL , tps65217_charger_irq, -0 ,"tps65217-charger" , +IRQF_ONESHOT ,"tps65217-charger" , charger);if (ret) { dev_err(charger->dev,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 87/184 drm/amdgpu: mask the xgmi number of hops reported from psp to kfd
In reply to Greg Kroah-HartmanFrom: Jonathan Kim <[email protected]>
[ Upstream commit 4ac5617c4b7d0f0a8f879997f8ceaa14636d7554 ]
The psp supplies the link type in the upper 2 bits of the psp xgmi node information num_hops field. With a new link type, Aldebaran has these bits set to a non-zero value (1 = xGMI3) so the KFD topology will report the incorrect IO link weights without proper masking.
The actual number of hops is located in the 3 least significant bits of this field so mask if off accordingly before passing it to the KFD.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +8 -1
@@ -311,15 +311,22 @@ int amdgpu_xgmi_update_topology(struct amdgpu_hive_info *hive, struct amdgpu_dev } +/* +* NOTE psp_xgmi_node_info.num_hops layout is as follows: +* num_hops[7:6] = link type (0 = xGMI2, 1 = xGMI3, 2/3 = reserved) +* num_hops[5:3] = reserved +* num_hops[2:0] = number of hops +*/ int amdgpu_xgmi_get_hops_count (struct amdgpu_device *adev,struct amdgpu_device *peer_adev) {struct psp_xgmi_topology_info *top = &adev->psp.xgmi_context.top_info; +uint8_t num_hops_mask =0x7 ;int i;for (i =0 ; i < top->num_nodes; ++i)if (top->nodes[i].node_id == peer_adev->gmc.xgmi.node_id) -return top->nodes[i].num_hops; +return top->nodes[i].num_hops & num_hops_mask;return -EINVAL ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 88/184 drm/amdkfd: Fix UBSAN shift-out-of-bounds warning
In reply to Greg Kroah-HartmanFrom: Anson Jacob <[email protected]>
[ Upstream commit 50e2fc36e72d4ad672032ebf646cecb48656efe0 ]
If get_num_sdma_queues or get_num_xgmi_sdma_queues is 0, we end up doing a shift operation where the number of bits shifted equals number of bits in the operand. This behaviour is undefined.
Set num_sdma_queues or num_xgmi_sdma_queues to ULLONG_MAX, if the count is >= number of bits in the operand.
--- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +15 -2
@@ -1011,6 +1011,9 @@ static int set_sched_resources(struct device_queue_manager *dqm)static int initialize_cpsch (struct device_queue_manager *dqm) { +uint64_t num_sdma_queues; +uint64_t num_xgmi_sdma_queues; +pr_debug ("num of pipes: %d\n" ,get_pipes_per_mec (dqm));mutex_init (&dqm->lock_hidden);
@@ -1019,8 +1022,18 @@ static int initialize_cpsch(struct device_queue_manager *dqm) dqm->sdma_queue_count =0 ; dqm->xgmi_sdma_queue_count =0 ; dqm->active_runlist = false; - dqm->sdma_bitmap = ~0ULL >> (64 -get_num_sdma_queues (dqm)); - dqm->xgmi_sdma_bitmap = ~0ULL >> (64 -get_num_xgmi_sdma_queues (dqm)); + + num_sdma_queues =get_num_sdma_queues (dqm); +if (num_sdma_queues >=BITS_PER_TYPE (dqm->sdma_bitmap)) + dqm->sdma_bitmap =ULLONG_MAX ; +else + dqm->sdma_bitmap = (BIT_ULL (num_sdma_queues) -1 ); + + num_xgmi_sdma_queues =get_num_xgmi_sdma_queues (dqm); +if (num_xgmi_sdma_queues >=BITS_PER_TYPE (dqm->xgmi_sdma_bitmap)) + dqm->xgmi_sdma_bitmap =ULLONG_MAX ; +else + dqm->xgmi_sdma_bitmap = (BIT_ULL (num_xgmi_sdma_queues) -1 );INIT_WORK (&dqm->hw_exception_work, kfd_process_hw_exception);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 89/184 drm/amdgpu : Fix asic reset regression issue introduce by 8f211fe8ac7c4f
In reply to Greg Kroah-HartmanFrom: shaoyunl <[email protected]>
[ Upstream commit c8941550aa66b2a90f4b32c45d59e8571e33336e ]
This recent change introduce SDMA interrupt info printing with irq->process function. These functions do not require a set function to enable/disable the irq
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +1 -1
@@ -469,7 +469,7 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev)for (j =0 ; j <AMDGPU_MAX_IRQ_SRC_ID ; ++j) {struct amdgpu_irq_src *src = adev->irq.client[i].sources[j]; -if (!src) +if (!src || !src->funcs || !src->funcs->set)continue ;for (k =0 ; k < src->num_types; k++)amdgpu_irq_update (adev, src, k);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 90/184 drm/amd/display: Fix UBSAN warning for not a valid value for type _Bool
In reply to Greg Kroah-HartmanFrom: Anson Jacob <[email protected]>
[ Upstream commit 6a30a92997eee49554f72b462dce90abe54a496f ]
[Why]dc_cursor_position do not initialise position.translate_by_source when crtc or plane->state->fb is NULL. UBSAN caught this error in dce110_set_cursor_position, as the value was garbage.
[How]
Initialise dc_cursor_position structure elements to 0 in handle_cursor_update before calling get_cursor_position.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -5
@@ -5372,10 +5372,6 @@ static int get_cursor_position(struct drm_plane *plane, struct drm_crtc *crtc,int x, y;int xorigin =0 , yorigin =0 ; - position->enable = false; - position->x =0 ; - position->y =0 ; -if (!crtc || !plane->state->fb)return 0 ;
@@ -5427,7 +5423,7 @@ static void handle_cursor_update(struct drm_plane *plane,struct dm_crtc_state *crtc_state = crtc ?to_dm_crtc_state (crtc->state) :NULL ;struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc);uint64_t address = afb ? afb->address :0 ; -struct dc_cursor_position position; +struct dc_cursor_position position = {0 };struct dc_cursor_attributes attributes;int ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 91/184 drm/amd/display: fix dml prefetch validation
In reply to Greg Kroah-HartmanFrom: Dmytro Laktyushkin <[email protected]>
[ Upstream commit 8ee0fea4baf90e43efe2275de208a7809f9985bc ]
Incorrect variable used, missing initialization during validation.
--- drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c | 1 + drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c +1 -0
@@ -3435,6 +3435,7 @@ void dml20_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l mode_lib->vba.DCCEnabledInAnyPlane = true; } } + mode_lib->vba.UrgentLatency = mode_lib->vba.UrgentLatencyPixelDataOnly;for (i =0 ; i <= mode_lib->vba.soc.num_states; i++) { locals->FabricAndDRAMBandwidthPerState[i] =dml_min ( mode_lib->vba.DRAMSpeedPerState[i] * mode_lib->vba.NumberOfChannels
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c +1 -0
@@ -3467,6 +3467,7 @@ void dml20v2_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode mode_lib->vba.DCCEnabledInAnyPlane = true; } } + mode_lib->vba.UrgentLatency = mode_lib->vba.UrgentLatencyPixelDataOnly;for (i =0 ; i <= mode_lib->vba.soc.num_states; i++) { locals->FabricAndDRAMBandwidthPerState[i] =dml_min ( mode_lib->vba.DRAMSpeedPerState[i] * mode_lib->vba.NumberOfChannels
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 92/184 scsi: qla2xxx: Always check the return value of qla24xx_get_isp_stats()
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit a2b2cc660822cae08c351c7f6b452bfd1330a4f7 ]
This patch fixes the following Coverity warning:
CID 361199 (#1 of 1): Unchecked return value (CHECKED_RETURN)
3. check_return: Calling qla24xx_get_isp_stats without checking return value (as is done elsewhere 4 out of 5 times).
--- drivers/scsi/qla2xxx/qla_attr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_attr.c +7 -1
@@ -2691,6 +2691,8 @@ qla2x00_reset_host_stats(struct Scsi_Host *shost) vha->qla_stats.jiffies_at_last_reset =get_jiffies_64 ();if (IS_FWI2_CAPABLE (ha)) { +int rval; + stats =dma_alloc_coherent (&ha->pdev->dev,sizeof (*stats), &stats_dma,GFP_KERNEL );if (!stats) {
@@ -2700,7 +2702,11 @@ qla2x00_reset_host_stats(struct Scsi_Host *shost) }/* reset firmware statistics */ -qla24xx_get_isp_stats (base_vha, stats, stats_dma,BIT_0 ); + rval =qla24xx_get_isp_stats (base_vha, stats, stats_dma,BIT_0 ); +if (rval !=QLA_SUCCESS ) +ql_log (ql_log_warn, vha,0x70de , +"Resetting ISP statistics failed: rval = %d\n" , + rval);dma_free_coherent (&ha->pdev->dev,sizeof (*stats), stats, stats_dma);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 93/184 drm/vkms: fix misuse of WARN_ON
In reply to Greg Kroah-HartmanFrom: Dmitry Vyukov <[email protected]>
[ Upstream commit b4142fc4d52d051d4d8df1fb6c569e5b445d369e ]
vkms_vblank_simulate() uses WARN_ON for timing-dependent condition (timer overrun). This is a mis-use of WARN_ON, WARN_ON must be used to denote kernel bugs. Use pr_warn() instead.
--- drivers/gpu/drm/vkms/vkms_crtc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/vkms/vkms_crtc.c +2 -1
@@ -20,7 +20,8 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer) ret_overrun =hrtimer_forward_now (&output->vblank_hrtimer, output->period_ns); -WARN_ON (ret_overrun !=1 ); +if (ret_overrun !=1 ) +pr_warn ("%s: vblank timer overrun\n" , __func__); ret =drm_crtc_handle_vblank (crtc);if (!ret)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 94/184 scsi: qla2xxx: Fix use after free in bsg
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit 2ce35c0821afc2acd5ee1c3f60d149f8b2520ce8 ]
On bsg command completion, bsg_job_done() was called while qla driver continued to access the bsg_job buffer. bsg_job_done() would free up resources that ended up being reused by other task while the driver continued to access the buffers. As a result, driver was reading garbage data.
localhost kernel: BUG: KASAN: use-after-free in sg_next+0x64/0x80 localhost kernel: Read of size 8 at addr ffff8883228a3330 by task swapper/26/0 localhost kernel:
localhost kernel: CPU: 26 PID: 0 Comm: swapper/26 Kdump:
loaded Tainted: G OE --------- - - 4.18.0-193.el8.x86_64+debug #1
localhost kernel: Hardware name: HP ProLiant DL360
Gen9/ProLiant DL360 Gen9, BIOS P89 08/12/2016
localhost kernel: Call Trace:
localhost kernel: <IRQ>
localhost kernel: dump_stack+0x9a/0xf0
localhost kernel: print_address_description.cold.3+0x9/0x23b localhost kernel: kasan_report.cold.4+0x65/0x95
localhost kernel: debug_dma_unmap_sg.part.12+0x10d/0x2d0 localhost kernel: qla2x00_bsg_sp_free+0xaf6/0x1010 [qla2xxx]
--- drivers/scsi/qla2xxx/qla_bsg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_bsg.c +2 -1
@@ -17,10 +17,11 @@ void qla2x00_bsg_job_done(srb_t *sp, int res)struct bsg_job *bsg_job = sp->u.bsg_job;struct fc_bsg_reply *bsg_reply = bsg_job->reply; + sp->free (sp); + bsg_reply->result = res;bsg_job_done (bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len); - sp->free (sp); }void qla2x00_bsg_sp_free (srb_t *sp)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 95/184 mmc: sdhci-pci: Add PCI IDs for Intel LKF
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
[ Upstream commit ee629112be8b4eff71d4d3d108a28bc7dc877e13 ]
Add PCI IDs for Intel LKF eMMC and SD card host controllers.
--- drivers/mmc/host/sdhci-pci-core.c | 2 ++ drivers/mmc/host/sdhci-pci.h | 2 ++ 2 files changed, 4 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +2 -0
@@ -1934,6 +1934,8 @@ static const struct pci_device_id pci_ids[] = {SDHCI_PCI_DEVICE (INTEL ,CMLH_SD , intel_byt_sd),SDHCI_PCI_DEVICE (INTEL ,JSL_EMMC , intel_glk_emmc),SDHCI_PCI_DEVICE (INTEL ,JSL_SD , intel_byt_sd), +SDHCI_PCI_DEVICE (INTEL ,LKF_EMMC , intel_glk_emmc), +SDHCI_PCI_DEVICE (INTEL ,LKF_SD , intel_byt_sd),SDHCI_PCI_DEVICE (O2 ,8120 , o2),SDHCI_PCI_DEVICE (O2 ,8220 , o2), SDHCI_PCI_DEVICE(O2, 8221, o2),
drivers/mmc/host/sdhci-pci.h +2 -0
@@ -57,6 +57,8 @@#define PCI_DEVICE_ID_INTEL_CMLH_SD 0x06f5#define PCI_DEVICE_ID_INTEL_JSL_EMMC 0x4dc4#define PCI_DEVICE_ID_INTEL_JSL_SD 0x4df8 +#define PCI_DEVICE_ID_INTEL_LKF_EMMC 0x98c4 +#define PCI_DEVICE_ID_INTEL_LKF_SD 0x98f8#define PCI_DEVICE_ID_SYSKONNECT_8000 0x8000#define PCI_DEVICE_ID_VIA_95D0 0x95d0
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 96/184 ata: ahci: Disable SXS for Hisilicon Kunpeng920
In reply to Greg Kroah-HartmanFrom: Xingui Yang <[email protected]>
[ Upstream commit 234e6d2c18f5b080cde874483c4c361f3ae7cffe ]
On Hisilicon Kunpeng920, ESP is set to 1 by default for all ports of SATA controller. In some scenarios, some ports are not external SATA ports, and it cause disks connected to these ports to be identified as removable disks. So disable the SXS capability on the software side to prevent users from mistakenly considering non-removable disks as removable disks and performing related operations.
--- drivers/ata/ahci.c | 5 +++++ drivers/ata/ahci.h | 1 + drivers/ata/libahci.c | 5 +++++ 3 files changed, 11 insertions(+)
drivers/ata/ahci.c +5 -0
@@ -1728,6 +1728,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) hpriv->flags |=AHCI_HFLAG_NO_DEVSLP ;#ifdef CONFIG_ARM64 +if (pdev->vendor ==PCI_VENDOR_ID_HUAWEI && + pdev->device ==0xa235 && + pdev->revision <0x30 ) + hpriv->flags |=AHCI_HFLAG_NO_SXS ; +if (pdev->vendor ==0x177d && pdev->device ==0xa01c ) hpriv->irq_handler = ahci_thunderx_irq_handler;#endif
drivers/ata/ahci.h +1 -0
@@ -242,6 +242,7 @@ enum {suspend/resume */ AHCI_HFLAG_IGN_NOTSUPP_POWER_ON = (1 <<27 ),/* ignore -EOPNOTSUPP from phy_power_on() */ + AHCI_HFLAG_NO_SXS = (1 << 28), /* SXS not supported *//* ap->flags bits */
drivers/ata/libahci.c +5 -0
@@ -493,6 +493,11 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv) cap |=HOST_CAP_ALPM ; } +if ((cap &HOST_CAP_SXS ) && (hpriv->flags &AHCI_HFLAG_NO_SXS )) { +dev_info (dev,"controller does not support SXS, disabling CAP_SXS\n" ); + cap &= ~HOST_CAP_SXS ; + } +if (hpriv->force_port_map && port_map != hpriv->force_port_map) {dev_info (dev,"forcing port_map 0x%x -> 0x%x\n" , port_map, hpriv->force_port_map);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 97/184 scsi: smartpqi: Correct request leakage during reset operations
In reply to Greg Kroah-HartmanFrom: Murthy Bhat <[email protected]>
[ Upstream commit b622a601a13ae5974c5b0aeecb990c224b8db0d9 ]
While failing queued I/Os in TMF path, there was a request leak and hence stale entries in request pool with ref count being non-zero. In shutdown path we have a BUG_ON to catch stuck I/O either in firmware or in the driver. The stale requests caused a system crash. The I/O request pool leakage also lead to a significant performance drop.
--- drivers/scsi/smartpqi/smartpqi_init.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/smartpqi/smartpqi_init.c +4 -0
@@ -5513,6 +5513,8 @@ static void pqi_fail_io_queued_for_device(struct pqi_ctrl_info *ctrl_info,list_del (&io_request->request_list_entry);set_host_byte (scmd,DID_RESET ); +pqi_free_io_request (io_request); +scsi_dma_unmap (scmd);pqi_scsi_done (scmd); }
@@ -5549,6 +5551,8 @@ static void pqi_fail_io_queued_for_all_devices(struct pqi_ctrl_info *ctrl_info)list_del (&io_request->request_list_entry);set_host_byte (scmd,DID_RESET ); +pqi_free_io_request (io_request); +scsi_dma_unmap (scmd);pqi_scsi_done (scmd); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 98/184 scsi: smartpqi: Add new PCI IDs
In reply to Greg Kroah-HartmanFrom: Kevin Barnett <[email protected]>
[ Upstream commit 75fbeacca3ad30835e903002dba98dd909b4dfff ]
Add support for newer hardware.
--- drivers/scsi/smartpqi/smartpqi_init.c | 156 ++++++++++++++++++++++++++ 1 file changed, 156 insertions(+)
drivers/scsi/smartpqi/smartpqi_init.c +156 -0
@@ -8146,6 +8146,10 @@ static const struct pci_device_id pqi_pci_id_table[] = {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x152d ,0x8a37 ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x193d ,0x8460 ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x193d ,0x1104 )
@@ -8218,6 +8222,22 @@ static const struct pci_device_id pqi_pci_id_table[] = {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x1bd4 ,0x004f ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1bd4 ,0x0051 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1bd4 ,0x0052 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1bd4 ,0x0053 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1bd4 ,0x0054 ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x19e5 ,0xd227 )
@@ -8374,6 +8394,122 @@ static const struct pci_device_id pqi_pci_id_table[] = {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,PCI_VENDOR_ID_ADAPTEC2 ,0x1380 ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1400 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1402 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1410 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1411 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1412 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1420 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1430 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1440 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1441 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1450 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1452 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1460 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1461 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1462 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1470 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1471 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1472 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1480 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1490 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x1491 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14a0 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14a1 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14b0 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14b1 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14c0 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14c1 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14d0 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14e0 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_ADAPTEC2 ,0x14f0 ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,PCI_VENDOR_ID_ADVANTECH ,0x8312 )
@@ -8438,6 +8574,10 @@ static const struct pci_device_id pqi_pci_id_table[] = {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,PCI_VENDOR_ID_HP ,0x1001 ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +PCI_VENDOR_ID_HP ,0x1002 ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,PCI_VENDOR_ID_HP ,0x1100 )
@@ -8446,6 +8586,22 @@ static const struct pci_device_id pqi_pci_id_table[] = {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,PCI_VENDOR_ID_HP ,0x1101 ) }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1590 ,0x0294 ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1590 ,0x02db ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1590 ,0x02dc ) + }, + { +PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f , +0x1590 ,0x032e ) + }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_ADAPTEC2 ,0x028f ,0x1d8d ,0x0800 )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 99/184 scsi: scsi_dh_alua: Remove check for ASC 24h in alua_rtpg()
In reply to Greg Kroah-HartmanFrom: Ewan D. Milne <[email protected]>
[ Upstream commit bc3f2b42b70eb1b8576e753e7d0e117bbb674496 ]
Some arrays return ILLEGAL_REQUEST with ASC 00h if they don't support the RTPG extended header so remove the check for INVALID FIELD IN CDB.
--- drivers/scsi/device_handler/scsi_dh_alua.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/device_handler/scsi_dh_alua.c +3 -2
@@ -565,10 +565,11 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)* even though it shouldn't according to T10. * The retry without rtpg_ext_hdr_req set * handles this. +* Note: some arrays return a sense key of ILLEGAL_REQUEST +* with ASC 00h if they don't support the extended header. */ if (!(pg->flags &ALUA_RTPG_EXT_HDR_UNSUPP ) && - sense_hdr.sense_key ==ILLEGAL_REQUEST && - sense_hdr.asc ==0x24 && sense_hdr.ascq ==0 ) { + sense_hdr.sense_key ==ILLEGAL_REQUEST ) { pg->flags |=ALUA_RTPG_EXT_HDR_UNSUPP ; goto retry; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 100/184 media: em28xx: fix memory leak
In reply to Greg Kroah-HartmanFrom: Muhammad Usama Anjum <[email protected]>
[ Upstream commit 0ae10a7dc8992ee682ff0b1752ff7c83d472eef1 ]
If some error occurs, URB buffers should also be freed. If they aren't freed with the dvb here, the em28xx_dvb_fini call doesn't frees the URB buffers as dvb is set to NULL. The function in which error occurs should do all the cleanup for the allocations it had done.
Tested the patch with the reproducer provided by syzbot. This patch fixes the memleak.
--- drivers/media/usb/em28xx/em28xx-dvb.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/usb/em28xx/em28xx-dvb.c +1 -0
@@ -1924,6 +1924,7 @@ ret:return result; out_free: +em28xx_uninit_usb_xfer (dev,EM28XX_DIGITAL_MODE );kfree (dvb); dev->dvb =NULL ; goto ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 101/184 media: vivid: update EDID
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit 443ec4bbc6116f6f492a7a1282bfd8422c862158 ]
The EDID had a few mistakes as reported by edid-decode:
Block 1, CTA-861 Extension Block:
Video Data Block: For improved preferred timing interoperability, set 'Native detailed modes' to 1. Video Capability Data Block: S_PT is equal to S_IT and S_CE, so should be set to 0 instead.
Fixed those.
--- drivers/media/platform/vivid/vivid-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/vivid/vivid-core.c +3 -3
@@ -174,13 +174,13 @@ static const u8 vivid_hdmi_edid[256] = {0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x01 ,0x7b , -0x02 ,0x03 ,0x3f ,0xf0 ,0x51 ,0x61 ,0x60 ,0x5f , +0x02 ,0x03 ,0x3f ,0xf1 ,0x51 ,0x61 ,0x60 ,0x5f ,0x5e ,0x5d ,0x10 ,0x1f ,0x04 ,0x13 ,0x22 ,0x21 ,0x20 ,0x05 ,0x14 ,0x02 ,0x11 ,0x01 ,0x23 ,0x09 ,0x07 ,0x07 ,0x83 ,0x01 ,0x00 ,0x00 ,0x6d ,0x03 ,0x0c ,0x00 ,0x10 ,0x00 ,0x00 ,0x3c ,0x21 ,0x00 ,0x60 ,0x01 ,0x02 ,0x03 ,0x67 ,0xd8 ,0x5d ,0xc4 , -0x01 ,0x78 ,0x00 ,0x00 ,0xe2 ,0x00 ,0xea ,0xe3 , +0x01 ,0x78 ,0x00 ,0x00 ,0xe2 ,0x00 ,0xca ,0xe3 ,0x05 ,0x00 ,0x00 ,0xe3 ,0x06 ,0x01 ,0x00 ,0x4d ,0xd0 ,0x00 ,0xa0 ,0xf0 ,0x70 ,0x3e ,0x80 ,0x30 , 0x20, 0x35, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00,
@@ -189,7 +189,7 @@ static const u8 vivid_hdmi_edid[256] = {0x00 ,0x00 ,0x1a ,0x1a ,0x1d ,0x00 ,0x80 ,0x51 ,0xd0 ,0x1c ,0x20 ,0x40 ,0x80 ,0x35 ,0x00 ,0xc0 ,0x1c ,0x32 ,0x00 ,0x00 ,0x1c ,0x00 ,0x00 ,0x00 , - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, }; static int vidioc_querycap(struct file *file, void *priv,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 102/184 clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 657d4d1934f75a2d978c3cf2086495eaa542e7a9 ]
There is an error return path that is not kfree'ing socfpga_clk leading to a memory leak. Fix this by adding in the missing kfree call.
Addresses-Coverity: ("Resource leak")
--- drivers/clk/socfpga/clk-gate-a10.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/socfpga/clk-gate-a10.c +1 -0
@@ -146,6 +146,7 @@ static void __init __socfpga_gate_init(struct device_node *node,if (IS_ERR (socfpga_clk->sys_mgr_base_addr)) {pr_err ("%s: failed to find altr,sys-mgr regmap!\n" , __func__); +kfree (socfpga_clk);return ; } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 103/184 power: supply: generic-adc-battery: fix possible use-after-free in gab_remove()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit b6cfa007b3b229771d9588970adb4ab3e0487f49 ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/power/supply/generic-adc-battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/generic-adc-battery.c +1 -1
@@ -382,7 +382,7 @@ static int gab_remove(struct platform_device *pdev) }kfree (adc_bat->psy_desc.properties); -cancel_delayed_work (&adc_bat->bat_work); +cancel_delayed_work_sync (&adc_bat->bat_work);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 104/184 power: supply: s3c_adc_battery: fix possible use-after-free in s3c_adc_bat_remove()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 68ae256945d2abe9036a7b68af4cc65aff79d5b7 ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/power/supply/s3c_adc_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/s3c_adc_battery.c +1 -1
@@ -394,7 +394,7 @@ static int s3c_adc_bat_remove(struct platform_device *pdev)gpio_free (pdata->gpio_charge_finished); } -cancel_delayed_work (&bat_work); +cancel_delayed_work_sync (&bat_work);if (pdata->exit) pdata->exit ();
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 105/184 media: tc358743: fix possible use-after-free in tc358743_remove()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 6107a4fdf8554a7aa9488bdc835bb010062fa8a9 ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/media/i2c/tc358743.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/tc358743.c +1 -1
@@ -2192,7 +2192,7 @@ static int tc358743_remove(struct i2c_client *client)del_timer_sync (&state->timer);flush_work (&state->work_i2c_poll); } -cancel_delayed_work (&state->delayed_work_enable_hotplug); +cancel_delayed_work_sync (&state->delayed_work_enable_hotplug);cec_unregister_adapter (state->cec_adap);v4l2_async_unregister_subdev (sd);v4l2_device_unregister_subdev (sd);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 106/184 media: adv7604: fix possible use-after-free in adv76xx_remove()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit fa56f5f1fe31c2050675fa63b84963ebd504a5b3 ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/media/i2c/adv7604.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/adv7604.c +1 -1
@@ -3606,7 +3606,7 @@ static int adv76xx_remove(struct i2c_client *client)io_write (sd,0x6e ,0 );io_write (sd,0x73 ,0 ); -cancel_delayed_work (&state->delayed_work_enable_hotplug); +cancel_delayed_work_sync (&state->delayed_work_enable_hotplug);v4l2_async_unregister_subdev (sd);media_entity_cleanup (&sd->entity);adv76xx_unregister_clients (to_state (sd));
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 107/184 media: i2c: adv7511-v4l2: fix possible use-after-free in adv7511_remove()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 2c9541720c66899adf6f3600984cf3ef151295ad ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/media/i2c/adv7511-v4l2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/adv7511-v4l2.c +1 -1
@@ -1964,7 +1964,7 @@ static int adv7511_remove(struct i2c_client *client)adv7511_set_isr (sd, false);adv7511_init_setup (sd); -cancel_delayed_work (&state->edid_handler); +cancel_delayed_work_sync (&state->edid_handler);i2c_unregister_device (state->i2c_edid);i2c_unregister_device (state->i2c_cec);i2c_unregister_device (state->i2c_pktmem);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 108/184 media: i2c: tda1997: Fix possible use-after-free in tda1997x_remove()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 7f820ab5d4eebfe2d970d32a76ae496a6c286f0f ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/media/i2c/tda1997x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/tda1997x.c +1 -1
@@ -2804,7 +2804,7 @@ static int tda1997x_remove(struct i2c_client *client)media_entity_cleanup (&sd->entity);v4l2_ctrl_handler_free (&state->hdl);regulator_bulk_disable (TDA1997X_NUM_SUPPLIES , state->supplies); -cancel_delayed_work (&state->delayed_work_enable_hpd); +cancel_delayed_work_sync (&state->delayed_work_enable_hpd);mutex_destroy (&state->page_lock);mutex_destroy (&state->lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 109/184 media: i2c: adv7842: fix possible use-after-free in adv7842_remove()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 4a15275b6a18597079f18241c87511406575179a ]
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself.
--- drivers/media/i2c/adv7842.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/adv7842.c +1 -1
@@ -3586,7 +3586,7 @@ static int adv7842_remove(struct i2c_client *client)struct adv7842_state *state =to_state (sd);adv7842_irq_enable (sd, false); -cancel_delayed_work (&state->delayed_work_enable_hotplug); +cancel_delayed_work_sync (&state->delayed_work_enable_hotplug);v4l2_device_unregister_subdev (sd);media_entity_cleanup (&sd->entity);adv7842_unregister_clients (sd);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 110/184 media: platform: sti: Fix runtime PM imbalance in regs_show
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 69306a947b3ae21e0d1cbfc9508f00fec86c7297 ]
pm_runtime_get_sync() will increase the runtime PM counter even it returns an error. Thus a pairing decrement is needed to prevent refcount leak. Fix this by replacing this API with pm_runtime_resume_and_get(), which will not change the runtime PM counter on error.
--- drivers/media/platform/sti/bdisp/bdisp-debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/sti/bdisp/bdisp-debug.c +1 -1
@@ -480,7 +480,7 @@ static int regs_show(struct seq_file *s, void *data)int ret;unsigned int i; - ret =pm_runtime_get_sync (bdisp->dev); + ret =pm_runtime_resume_and_get (bdisp->dev);if (ret <0 ) {seq_puts (s,"Cannot wake up IP\n" );return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 111/184 media: dvb-usb: fix memory leak in dvb_usb_adapter_init
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit b7cd0da982e3043f2eec7235ac5530cb18d6af1d ]
syzbot reported memory leak in dvb-usb. The problem was in invalid error handling in dvb_usb_adapter_init().
for (n = 0; n < d->props.num_adapters; n++) {
....
if ((ret = dvb_usb_adapter_stream_init(adap)) ||
(ret = dvb_usb_adapter_dvb_init(adap, adapter_nrs)) ||
(ret = dvb_usb_adapter_frontend_init(adap))) {
return ret;
}
...
d->num_adapters_initialized++;...
}
In case of error in dvb_usb_adapter_dvb_init() or dvb_usb_adapter_dvb_init() d->num_adapters_initialized won't be incremented, but dvb_usb_adapter_exit() relies on it:
for (n = 0; n < d->num_adapters_initialized; n++)
So, allocated objects won't be freed.
--- drivers/media/usb/dvb-usb/dvb-usb-init.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/media/usb/dvb-usb/dvb-usb-init.c +16 -4
@@ -79,11 +79,17 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) } } -if ((ret =dvb_usb_adapter_stream_init (adap)) || - (ret =dvb_usb_adapter_dvb_init (adap, adapter_nrs)) || - (ret =dvb_usb_adapter_frontend_init (adap))) { + ret =dvb_usb_adapter_stream_init (adap); +if (ret)return ret; - } + + ret =dvb_usb_adapter_dvb_init (adap, adapter_nrs); +if (ret) + goto dvb_init_err; + + ret =dvb_usb_adapter_frontend_init (adap); +if (ret) + goto frontend_init_err;/* use exclusive FE lock if there is multiple shared FEs */ if (adap->fe_adap[1 ].fe)
@@ -103,6 +109,12 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) }return 0 ; + +frontend_init_err: +dvb_usb_adapter_dvb_exit (adap); +dvb_init_err: +dvb_usb_adapter_stream_exit (adap); +return ret; }static int dvb_usb_adapter_exit (struct dvb_usb_device *d)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 112/184 media: gscpa/stv06xx: fix memory leak
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit 4f4e6644cd876c844cdb3bea2dd7051787d5ae25 ]
For two of the supported sensors the stv06xx driver allocates memory which is stored in sd->sensor_priv. This memory is freed on a disconnect, but if the probe() fails, then it isn't freed and so this leaks memory.
Add a new probe_error() op that drivers can use to free any allocated memory in case there was a probe failure.
Thanks to Pavel Skripkin <[email protected]> for discovering the cause of the memory leak.
--- drivers/media/usb/gspca/gspca.c | 2 ++ drivers/media/usb/gspca/gspca.h | 1 + drivers/media/usb/gspca/stv06xx/stv06xx.c | 9 +++++++++ 3 files changed, 12 insertions(+)
drivers/media/usb/gspca/gspca.c +2 -0
@@ -1576,6 +1576,8 @@ out:#endif v4l2_ctrl_handler_free (gspca_dev->vdev.ctrl_handler);v4l2_device_unregister (&gspca_dev->v4l2_dev); +if (sd_desc->probe_error) + sd_desc->probe_error (gspca_dev);kfree (gspca_dev->usb_buf);kfree (gspca_dev);return ret;
drivers/media/usb/gspca/gspca.h +1 -0
@@ -105,6 +105,7 @@ struct sd_desc {cam_cf_op config;/* called on probe */ cam_op init;/* called on probe and resume */ cam_op init_controls;/* called on probe */ +cam_v_op probe_error;/* called if probe failed, do cleanup here */ cam_op start;/* called on stream on after URBs creation */ cam_pkt_op pkt_scan;/* optional operations */
drivers/media/usb/gspca/stv06xx/stv06xx.c +9 -0
@@ -529,12 +529,21 @@ static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,static int stv06xx_config (struct gspca_dev *gspca_dev,const struct usb_device_id *id); +static void stv06xx_probe_error (struct gspca_dev *gspca_dev) +{ +struct sd *sd = (struct sd *)gspca_dev; + +kfree (sd->sensor_priv); + sd->sensor_priv =NULL ; +} +/* sub-driver description */ static const struct sd_desc sd_desc = { .name =MODULE_NAME , .config = stv06xx_config, .init = stv06xx_init, .init_controls = stv06xx_init_controls, + .probe_error = stv06xx_probe_error, .start = stv06xx_start, .stopN = stv06xx_stopN, .pkt_scan = stv06xx_pkt_scan,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 113/184 sched/fair: Ignore percpu threads for imbalance pulls
In reply to Greg Kroah-HartmanFrom: Lingutla Chandrasekhar <[email protected]>
[ Upstream commit 9bcb959d05eeb564dfc9cac13a59843a4fb2edf2 ]
During load balance, LBF_SOME_PINNED will be set if any candidate task cannot be detached due to CPU affinity constraints. This can result in setting env->sd->parent->sgc->group_imbalance, which can lead to a group being classified as group_imbalanced (rather than any of the other, lower group_type) when balancing at a higher level.
In workloads involving a single task per CPU, LBF_SOME_PINNED can often be set due to per-CPU kthreads being the only other runnable tasks on any given rq. This results in changing the group classification during load-balance at higher levels when in reality there is nothing that can be done for this affinity constraint: per-CPU kthreads, as the name implies, don't get to move around (modulo hotplug shenanigans).
It's not as clear for userspace tasks - a task could be in an N-CPU cpuset with N-1 offline CPUs, making it an "accidental" per-CPU task rather than an intended one. KTHREAD_IS_PER_CPU gives us an indisputable signal which we can leverage here to not set LBF_SOME_PINNED.
Note that the aforementioned classification to group_imbalance (when nothing can be done) is especially problematic on big.LITTLE systems, which have a topology the likes of:
DIE [ ]
MC [ ][ ]
0 1 2 3
L L B B arch_scale_cpu_capacity(L) < arch_scale_cpu_capacity(B)
Here, setting LBF_SOME_PINNED due to a per-CPU kthread when balancing at MC level on CPUs [0-1] will subsequently prevent CPUs [2-3] from classifying the [0-1] group as group_misfit_task when balancing at DIE level. Thus, if CPUs [0-1] are running CPU-bound (misfit) tasks, ill-timed per-CPU kthreads can significantly delay the upgmigration of said misfit tasks. Systems relying on ASYM_PACKING are likely to face similar issues.
--- kernel/sched/fair.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/sched/fair.c +4 -0
@@ -7300,6 +7300,10 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)if (throttled_lb_pair (task_group (p), env->src_cpu, env->dst_cpu))return 0 ; +/* Disregard pcpu kthreads; they are where they need to be. */ +if ((p->flags &PF_KTHREAD ) &&kthread_is_per_cpu (p)) +return 0 ; +if (!cpumask_test_cpu (env->dst_cpu, p->cpus_ptr)) {int cpu;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 114/184 drm/msm/mdp5: Configure PP_SYNC_HEIGHT to double the vtotal
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 2ad52bdb220de5ab348098e3482b01235d15a842 ]
Leaving this at a close-to-maximum register value 0xFFF0 means it takes very long for the MDSS to generate a software vsync interrupt when the hardware TE interrupt doesn't arrive. Configuring this to double the vtotal (like some downstream kernels) leads to a frame to take at most twice before the vsync signal, until hardware TE comes up.
In this case the hardware interrupt responsible for providing this signal - "disp-te" gpio - is not hooked up to the mdp5 vsync/pp logic at all. This solves severe panel update issues observed on at least the Xperia Loire and Tone series, until said gpio is properly hooked up to an irq.
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c +9 -1
@@ -70,9 +70,17 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder, | MDP5_PP_SYNC_CONFIG_VSYNC_IN_EN; cfg |=MDP5_PP_SYNC_CONFIG_VSYNC_COUNT (vclks_line); +/* +* Tearcheck emits a blanking signal every vclks_line * vtotal * 2 ticks on +* the vsync_clk equating to roughly half the desired panel refresh rate. +* This is only necessary as stability fallback if interrupts from the +* panel arrive too late or not at all, but is currently used by default +* because these panel interrupts are not wired up yet. +*/ mdp5_write (mdp5_kms,REG_MDP5_PP_SYNC_CONFIG_VSYNC (pp_id), cfg);mdp5_write (mdp5_kms, -REG_MDP5_PP_SYNC_CONFIG_HEIGHT (pp_id),0xfff0 ); +REG_MDP5_PP_SYNC_CONFIG_HEIGHT (pp_id), (2 * mode->vtotal)); +mdp5_write (mdp5_kms,REG_MDP5_PP_VSYNC_INIT_VAL (pp_id), mode->vdisplay);mdp5_write (mdp5_kms,REG_MDP5_PP_RD_PTR_IRQ (pp_id), mode->vdisplay +1 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 115/184 drm/msm/mdp5: Do not multiply vclk line count by 100
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 377569f82ea8228c421cef4da33e056a900b58ca ]
Neither vtotal nor drm_mode_vrefresh contain a value that is premultiplied by 100 making the x100 variable name incorrect and resulting in vclks_line to become 100 times larger than it is supposed to be. The hardware counts 100 clockticks too many before tearcheck, leading to severe panel issues on at least the Sony Xperia lineup.
This is likely an artifact from the original MDSS DSI panel driver where the calculation [1] corrected for a premultiplied reference framerate by 100 [2]. It does not appear that the above values were ever premultiplied in the history of the DRM MDP5 driver.
With this change applied the value written to the SYNC_CONFIG_VSYNC register is now identical to downstream kernels.
[1]: https://source.codeaurora.org/quic/la/kernel/msm-3.18/tree/drivers/video/msm/mdss/mdss_mdp_intf_cmd.c?h=LA.UM.8.6.c26-02400-89xx.0#n288
[2]: https://source.codeaurora.org/quic/la/kernel/msm-3.18/tree/drivers/video/msm/mdss/mdss_dsi_panel.c?h=LA.UM.8.6.c26-02400-89xx.0#n1648
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_cmd_encoder.c +4 -4
@@ -41,7 +41,7 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder, {struct mdp5_kms *mdp5_kms =get_kms (encoder);struct device *dev = encoder->dev->dev; -u32 total_lines_x100, vclks_line, cfg; +u32 total_lines, vclks_line, cfg;long vsync_clk_speed;struct mdp5_hw_mixer *mixer =mdp5_crtc_get_mixer (encoder->crtc);int pp_id = mixer->pp;
@@ -51,8 +51,8 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder,return -EINVAL ; } - total_lines_x100 = mode->vtotal *drm_mode_vrefresh (mode); -if (!total_lines_x100) { + total_lines = mode->vtotal *drm_mode_vrefresh (mode); +if (!total_lines) {DRM_DEV_ERROR (dev,"%s: vtotal(%d) or vrefresh(%d) is 0\n" , __func__, mode->vtotal,drm_mode_vrefresh (mode));return -EINVAL ;
@@ -64,7 +64,7 @@ static int pingpong_tearcheck_setup(struct drm_encoder *encoder, vsync_clk_speed);return -EINVAL ; } - vclks_line = vsync_clk_speed *100 / total_lines_x100; + vclks_line = vsync_clk_speed / total_lines; cfg =MDP5_PP_SYNC_CONFIG_VSYNC_COUNTER_EN |MDP5_PP_SYNC_CONFIG_VSYNC_IN_EN ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 116/184 drm/amdkfd: Fix cat debugfs hang_hws file causes system crash bug
In reply to Greg Kroah-HartmanFrom: Qu Huang <[email protected]>
[ Upstream commit d73610211eec8aa027850982b1a48980aa1bc96e ]
Here is the system crash log:
[ 1272.884438] BUG: unable to handle kernel NULL pointer dereference at (null) [ 1272.884444] IP: [< (null)>] (null) [ 1272.884447] PGD 825b09067 PUD 8267c8067 PMD 0 [ 1272.884452] Oops: 0010 [#1] SMP [ 1272.884509] CPU: 13 PID: 3485 Comm: cat Kdump: loaded Tainted: G [ 1272.884515] task: ffff9a38dbd4d140 ti: ffff9a37cd3b8000 task.ti: ffff9a37cd3b8000 [ 1272.884517] RIP: 0010:[<0000000000000000>] [< (null)>] (null) [ 1272.884520] RSP: 0018:ffff9a37cd3bbe68 EFLAGS: 00010203 [ 1272.884522] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000014d5f [ 1272.884524] RDX: fffffffffffffff4 RSI: 0000000000000001 RDI: ffff9a38aca4d200 [ 1272.884526] RBP: ffff9a37cd3bbed0 R08: ffff9a38dcd5f1a0 R09: ffff9a31ffc07300 [ 1272.884527] R10: ffff9a31ffc07300 R11: ffffffffaddd5e9d R12: ffff9a38b4e0fb00 [ 1272.884529] R13: 0000000000000001 R14: ffff9a37cd3bbf18 R15: ffff9a38aca4d200 [ 1272.884532] FS: 00007feccaa67740(0000) GS:ffff9a38dcd40000(0000) knlGS:0000000000000000 [ 1272.884534] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1272.884536] CR2: 0000000000000000 CR3: 00000008267c0000 CR4: 00000000003407e0 [ 1272.884537] Call Trace: [ 1272.884544] [<ffffffffade68940>] ? seq_read+0x130/0x440 [ 1272.884548] [<ffffffffade40f8f>] vfs_read+0x9f/0x170 [ 1272.884552] [<ffffffffade41e4f>] SyS_read+0x7f/0xf0 [ 1272.884557] [<ffffffffae374ddb>] system_call_fastpath+0x22/0x27 [ 1272.884558] Code: Bad RIP value. [ 1272.884562] RIP [< (null)>] (null) [ 1272.884564] RSP <ffff9a37cd3bbe68> [ 1272.884566] CR2: 0000000000000000
--- drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_debugfs.c +6 -1
@@ -33,6 +33,11 @@ static int kfd_debugfs_open(struct inode *inode, struct file *file)return single_open (file, show,NULL ); } +static int kfd_debugfs_hang_hws_read (struct seq_file *m,void *data) +{ +seq_printf (m,"echo gpu_id > hang_hws\n" ); +return 0 ; +}static ssize_t kfd_debugfs_hang_hws_write (struct file *file,const char __user *user_buf,size_t size,loff_t *ppos)
@@ -94,7 +99,7 @@ void kfd_debugfs_init(void)debugfs_create_file ("rls" ,S_IFREG |0444 , debugfs_root, kfd_debugfs_rls_by_device, &kfd_debugfs_fops);debugfs_create_file ("hang_hws" ,S_IFREG |0200 , debugfs_root, -NULL , &kfd_debugfs_hang_hws_fops); + kfd_debugfs_hang_hws_read, &kfd_debugfs_hang_hws_fops); }void kfd_debugfs_fini (void )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 117/184 amdgpu: avoid incorrect %hu format string
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 7d98d416c2cc1c1f7d9508e887de4630e521d797 ]
clang points out that the %hu format string does not match the type of the variables here:
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c:263:7: warning: format specifies type 'unsigned short' but the argument has type 'unsigned int' [-Wformat]
version_major, version_minor);
^~~~~~~~~~~~~
include/drm/drm_print.h:498:19: note: expanded from macro 'DRM_ERROR'
__drm_err(fmt, ##__VA_ARGS__)
~~~ ^~~~~~~~~~~Change it to a regular %u, the same way a previous patch did for another instance of the same warning.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
@@ -231,7 +231,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)if ((adev->asic_type ==CHIP_POLARIS10 || adev->asic_type ==CHIP_POLARIS11 ) && (adev->uvd.fw_version <FW_1_66_16 )) -DRM_ERROR ("POLARIS10/11 UVD firmware version %hu.%hu is too old.\n" , +DRM_ERROR ("POLARIS10/11 UVD firmware version %u.%u is too old.\n" , version_major, version_minor); }else {unsigned int enc_major, enc_minor, dec_minor;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 118/184 drm/amdgpu: fix NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: Guchun Chen <[email protected]>
[ Upstream commit 3c3dc654333f6389803cdcaf03912e94173ae510 ]
ttm->sg needs to be checked before accessing its child member.
Call Trace: amdgpu_ttm_backend_destroy+0x12/0x70 [amdgpu] ttm_bo_cleanup_memtype_use+0x3a/0x60 [ttm] ttm_bo_release+0x17d/0x300 [ttm] amdgpu_bo_unref+0x1a/0x30 [amdgpu] amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu+0x78b/0x8b0 [amdgpu] kfd_ioctl_alloc_memory_of_gpu+0x118/0x220 [amdgpu] kfd_ioctl+0x222/0x400 [amdgpu] ? kfd_dev_is_large_bar+0x90/0x90 [amdgpu] __x64_sys_ioctl+0x8e/0xd0 ? __context_tracking_exit+0x52/0x90 do_syscall_64+0x33/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f97f264d317 Code: b3 66 90 48 8b 05 71 4b 2d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 41 4b 2d 00 f7 d8 64 89 01 48 RSP: 002b:00007ffdb402c338 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f97f3cc63a0 RCX: 00007f97f264d317 RDX: 00007ffdb402c380 RSI: 00000000c0284b16 RDI: 0000000000000003 RBP: 00007ffdb402c380 R08: 00007ffdb402c428 R09: 00000000c4000004 R10: 00000000c4000004 R11: 0000000000000246 R12: 00000000c0284b16 R13: 0000000000000003 R14: 00007f97f3cc63a0 R15: 00007f8836200000
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -984,7 +984,7 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_tt *ttm) DMA_BIDIRECTIONAL :DMA_TO_DEVICE ;/* double check that we don't free the table twice */ -if (!ttm->sg->sgl) +if (!ttm->sg || !ttm->sg->sgl)return ;/* unmap the pages mapped to the device */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 119/184 scsi: lpfc: Fix crash when a REG_RPI mailbox fails triggering a LOGO response
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit fffd18ec6579c2d9c72b212169259062fe747888 ]
Fix a crash caused by a double put on the node when the driver completed an ACC for an unsolicted abort on the same node. The second put was executed by lpfc_nlp_not_used() and is wrong because the completion routine executes the nlp_put when the iocbq was released. Additionally, the driver is issuing a LOGO then immediately calls lpfc_nlp_set_state to put the node into NPR. This call does nothing.
Remove the lpfc_nlp_not_used call and additional set_state in the completion routine. Remove the lpfc_nlp_set_state post issue_logo. Isn't necessary.
--- drivers/scsi/lpfc/lpfc_nportdisc.c | 2 -- drivers/scsi/lpfc/lpfc_sli.c | 1 - 2 files changed, 3 deletions(-)
drivers/scsi/lpfc/lpfc_nportdisc.c +0 -2
@@ -1961,8 +1961,6 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport, ndlp->nlp_last_elscmd =ELS_CMD_PLOGI ;lpfc_issue_els_logo (vport, ndlp,0 ); - ndlp->nlp_prev_state =NLP_STE_REG_LOGIN_ISSUE ; -lpfc_nlp_set_state (vport, ndlp,NLP_STE_NPR_NODE );return ndlp->nlp_state; }
drivers/scsi/lpfc/lpfc_sli.c +0 -1
@@ -17472,7 +17472,6 @@ lpfc_sli4_seq_abort_rsp_cmpl(struct lpfc_hba *phba,if (cmd_iocbq) { ndlp = (struct lpfc_nodelist *)cmd_iocbq->context1;lpfc_nlp_put (ndlp); -lpfc_nlp_not_used (ndlp);lpfc_sli_release_iocbq (phba, cmd_iocbq); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 120/184 scsi: lpfc: Fix error handling for mailboxes completed in MBX_POLL mode
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit 304ee43238fed517faa123e034b593905b8679f8 ]
In SLI-4, when performing a mailbox command with MBX_POLL, the driver uses the BMBX register to send the command rather than the MQ. A flag is set indicating the BMBX register is active and saves the mailbox job struct (mboxq) in the mbox_active element of the adapter. The routine then waits for completion or timeout. The mailbox job struct is not freed by the routine. In cases of timeout, the adapter will be reset. The lpfc_sli_mbox_sys_flush() routine will clean up the mbox in preparation for the reset. It clears the BMBX active flag and marks the job structure as MBX_NOT_FINISHED. But, it never frees the mboxq job structure. Expectation in both normal completion and timeout cases is that the issuer of the mbx command will free the structure. Unfortunately, not all calling paths are freeing the memory in cases of error.
All calling paths were looked at and updated, if missing, to free the mboxq memory regardless of completion status.
--- drivers/scsi/lpfc/lpfc_attr.c | 75 +++++++++++++++++++++-------------- drivers/scsi/lpfc/lpfc_init.c | 9 ++--- drivers/scsi/lpfc/lpfc_sli.c | 42 ++++++++++---------- 3 files changed, 70 insertions(+), 56 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +45 -30
@@ -1691,8 +1691,7 @@ lpfc_set_trunking(struct lpfc_hba *phba, char *buff_out)lpfc_printf_log (phba,KERN_ERR ,LOG_MBOX ,"0071 Set trunk mode failed with status: %d" , rc); -if (rc !=MBX_TIMEOUT ) -mempool_free (mbox, phba->mbox_mem_pool); +mempool_free (mbox, phba->mbox_mem_pool);return 0 ; }
@@ -6608,15 +6607,19 @@ lpfc_get_stats(struct Scsi_Host *shost) pmboxq->ctx_buf =NULL ; pmboxq->vport = vport; -if (vport->fc_flag &FC_OFFLINE_MODE ) +if (vport->fc_flag &FC_OFFLINE_MODE ) { rc =lpfc_sli_issue_mbox (phba, pmboxq,MBX_POLL ); -else - rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); - -if (rc !=MBX_SUCCESS ) { -if (rc !=MBX_TIMEOUT ) +if (rc !=MBX_SUCCESS ) {mempool_free (pmboxq, phba->mbox_mem_pool); -return NULL ; +return NULL ; + } + }else { + rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); +if (rc !=MBX_SUCCESS ) { +if (rc !=MBX_TIMEOUT ) +mempool_free (pmboxq, phba->mbox_mem_pool); +return NULL ; + } }memset (hs,0 ,sizeof (struct fc_host_statistics ));
@@ -6640,15 +6643,19 @@ lpfc_get_stats(struct Scsi_Host *shost) pmboxq->ctx_buf =NULL ; pmboxq->vport = vport; -if (vport->fc_flag &FC_OFFLINE_MODE ) +if (vport->fc_flag &FC_OFFLINE_MODE ) { rc =lpfc_sli_issue_mbox (phba, pmboxq,MBX_POLL ); -else - rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); - -if (rc !=MBX_SUCCESS ) { -if (rc !=MBX_TIMEOUT ) +if (rc !=MBX_SUCCESS ) {mempool_free (pmboxq, phba->mbox_mem_pool); -return NULL ; +return NULL ; + } + }else { + rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); +if (rc !=MBX_SUCCESS ) { +if (rc !=MBX_TIMEOUT ) +mempool_free (pmboxq, phba->mbox_mem_pool); +return NULL ; + } } hs->link_failure_count = pmb->un.varRdLnk.linkFailureCnt;
@@ -6721,15 +6728,19 @@ lpfc_reset_stats(struct Scsi_Host *shost) pmboxq->vport = vport;if ((vport->fc_flag &FC_OFFLINE_MODE ) || - (!(psli->sli_flag &LPFC_SLI_ACTIVE ))) + (!(psli->sli_flag &LPFC_SLI_ACTIVE ))) { rc =lpfc_sli_issue_mbox (phba, pmboxq,MBX_POLL ); -else - rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); - -if (rc !=MBX_SUCCESS ) { -if (rc !=MBX_TIMEOUT ) +if (rc !=MBX_SUCCESS ) {mempool_free (pmboxq, phba->mbox_mem_pool); -return ; +return ; + } + }else { + rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); +if (rc !=MBX_SUCCESS ) { +if (rc !=MBX_TIMEOUT ) +mempool_free (pmboxq, phba->mbox_mem_pool); +return ; + } }memset (pmboxq,0 ,sizeof (LPFC_MBOXQ_t));
@@ -6739,15 +6750,19 @@ lpfc_reset_stats(struct Scsi_Host *shost) pmboxq->vport = vport;if ((vport->fc_flag &FC_OFFLINE_MODE ) || - (!(psli->sli_flag &LPFC_SLI_ACTIVE ))) + (!(psli->sli_flag &LPFC_SLI_ACTIVE ))) { rc =lpfc_sli_issue_mbox (phba, pmboxq,MBX_POLL ); -else +if (rc !=MBX_SUCCESS ) { +mempool_free (pmboxq, phba->mbox_mem_pool); +return ; + } + }else { rc =lpfc_sli_issue_mbox_wait (phba, pmboxq, phba->fc_ratov *2 ); - -if (rc !=MBX_SUCCESS ) { -if (rc !=MBX_TIMEOUT ) -mempool_free ( pmboxq, phba->mbox_mem_pool); -return ; +if (rc !=MBX_SUCCESS ) { +if (rc !=MBX_TIMEOUT ) +mempool_free (pmboxq, phba->mbox_mem_pool); +return ; + } } lso->link_failure_count = pmb->un.varRdLnk.linkFailureCnt;
drivers/scsi/lpfc/lpfc_init.c +3 -6
@@ -9387,8 +9387,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba)"3250 QUERY_FW_CFG mailbox failed with status " "x%x add_status x%x, mbx status x%x\n" , shdr_status, shdr_add_status, rc); -if (rc !=MBX_TIMEOUT ) -mempool_free (mboxq, phba->mbox_mem_pool); +mempool_free (mboxq, phba->mbox_mem_pool); rc = -ENXIO ; goto out_error; }
@@ -9404,8 +9403,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba)"ulp1_mode:x%x\n" , phba->sli4_hba.fw_func_mode, phba->sli4_hba.ulp0_mode, phba->sli4_hba.ulp1_mode); -if (rc !=MBX_TIMEOUT ) -mempool_free (mboxq, phba->mbox_mem_pool); +mempool_free (mboxq, phba->mbox_mem_pool);/* * Set up HBA Event Queues (EQs)
@@ -10001,8 +9999,7 @@ lpfc_pci_function_reset(struct lpfc_hba *phba) shdr_status =bf_get (lpfc_mbox_hdr_status, &shdr->response); shdr_add_status =bf_get (lpfc_mbox_hdr_add_status, &shdr->response); -if (rc !=MBX_TIMEOUT ) -mempool_free (mboxq, phba->mbox_mem_pool); +mempool_free (mboxq, phba->mbox_mem_pool);if (shdr_status || shdr_add_status || rc) {lpfc_printf_log (phba,KERN_ERR ,LOG_INIT , "0495 SLI_FUNCTION_RESET mailbox "
drivers/scsi/lpfc/lpfc_sli.c +22 -20
90 lines not on this page · raw message
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 121/184 scsi: lpfc: Remove unsupported mbox PORT_CAPABILITIES logic
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit b62232ba8caccaf1954e197058104a6478fac1af ]
SLI-4 does not contain a PORT_CAPABILITIES mailbox command (only SLI-3 does, and SLI-3 doesn't use it), yet there are SLI-4 code paths that have code to issue the command. The command will always fail.
Remove the code for the mailbox command and leave only the resulting "failure path" logic.
--- drivers/scsi/lpfc/lpfc_crtn.h | 3 - drivers/scsi/lpfc/lpfc_hw4.h | 174 +--------------------------------- drivers/scsi/lpfc/lpfc_init.c | 103 +------------------- drivers/scsi/lpfc/lpfc_mbox.c | 36 ------- 4 files changed, 3 insertions(+), 313 deletions(-)
drivers/scsi/lpfc/lpfc_crtn.h +0 -3
@@ -56,9 +56,6 @@ void lpfc_register_new_vport(struct lpfc_hba *, struct lpfc_vport *,void lpfc_unreg_vpi (struct lpfc_hba *,uint16_t ,LPFC_MBOXQ_t *);void lpfc_init_link (struct lpfc_hba *,LPFC_MBOXQ_t *,uint32_t ,uint32_t );void lpfc_request_features (struct lpfc_hba *,struct lpfcMboxq *); -void lpfc_supported_pages (struct lpfcMboxq *); -void lpfc_pc_sli4_params (struct lpfcMboxq *); -int lpfc_pc_sli4_params_get (struct lpfc_hba *,LPFC_MBOXQ_t *);int lpfc_sli4_mbox_rsrc_extent (struct lpfc_hba *,struct lpfcMboxq *,uint16_t ,uint16_t ,bool );int lpfc_get_sli4_parameters (struct lpfc_hba *,LPFC_MBOXQ_t *);
drivers/scsi/lpfc/lpfc_hw4.h +1 -173
198 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_init.c +2 -101
127 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_mbox.c +0 -36
@@ -2622,39 +2622,3 @@ lpfc_resume_rpi(struct lpfcMboxq *mbox, struct lpfc_nodelist *ndlp) resume_rpi->event_tag = ndlp->phba->fc_eventTag; } -/** -* lpfc_supported_pages - Initialize the PORT_CAPABILITIES supported pages -* mailbox command. -* @mbox: pointer to lpfc mbox command to initialize. -* -* The PORT_CAPABILITIES supported pages mailbox command is issued to -* retrieve the particular feature pages supported by the port. -**/ -void -lpfc_supported_pages (struct lpfcMboxq *mbox) -{ -struct lpfc_mbx_supp_pages *supp_pages; - -memset (mbox,0 ,sizeof (*mbox)); - supp_pages = &mbox->u.mqe.un.supp_pages; -bf_set (lpfc_mqe_command, &mbox->u.mqe,MBX_PORT_CAPABILITIES ); -bf_set (cpn, supp_pages,LPFC_SUPP_PAGES ); -} - -/** -* lpfc_pc_sli4_params - Initialize the PORT_CAPABILITIES SLI4 Params mbox cmd. -* @mbox: pointer to lpfc mbox command to initialize. -* -* The PORT_CAPABILITIES SLI4 parameters mailbox command is issued to -* retrieve the particular SLI4 features supported by the port. -**/ -void -lpfc_pc_sli4_params (struct lpfcMboxq *mbox) -{ -struct lpfc_mbx_pc_sli4_params *sli4_params; - -memset (mbox,0 ,sizeof (*mbox)); - sli4_params = &mbox->u.mqe.un.sli4_params; -bf_set (lpfc_mqe_command, &mbox->u.mqe,MBX_PORT_CAPABILITIES ); -bf_set (cpn, sli4_params,LPFC_SLI4_PARAMETERS ); -}
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 122/184 mfd: arizona: Fix rumtime PM imbalance on error
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit fe6df2b48043bbe1e852b2320501d3b169363c35 ]
pm_runtime_get_sync() will increase the rumtime PM counter even it returns an error. Thus a pairing decrement is needed to prevent refcount leak. Fix this by replacing this API with pm_runtime_resume_and_get(), which will not change the runtime PM counter on error.
--- drivers/mfd/arizona-irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/arizona-irq.c +1 -1
@@ -100,7 +100,7 @@ static irqreturn_t arizona_irq_thread(int irq, void *data)unsigned int val;int ret; - ret =pm_runtime_get_sync (arizona->dev); + ret =pm_runtime_resume_and_get (arizona->dev);if (ret <0 ) {dev_err (arizona->dev,"Failed to resume device: %d\n" , ret);return IRQ_NONE ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 123/184 scsi: libfc: Fix a format specifier
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 90d6697810f06aceea9de71ad836a8c7669789cd ]
Since the 'mfs' member has been declared as 'u32' in include/scsi/libfc.h, use the %u format specifier instead of %hu. This patch fixes the following clang compiler warning:
warning: format specifies type
'unsigned short' but the argument has type 'u32' (aka 'unsigned int')
[-Wformat]
"lport->mfs:%hu\n", mfs, lport->mfs);
~~~ ^~~~~~~~~~
%u--- drivers/scsi/libfc/fc_lport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/libfc/fc_lport.c +1 -1
@@ -1729,7 +1729,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,if (mfs <FC_SP_MIN_MAX_PAYLOAD || mfs >FC_SP_MAX_MAX_PAYLOAD ) {FC_LPORT_DBG (lport,"FLOGI bad mfs:%hu response, " -"lport->mfs:%hu\n" , mfs, lport->mfs); +"lport->mfs:%u\n" , mfs, lport->mfs);fc_lport_error (lport, fp); goto out; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 124/184 s390/archrandom: add parameter check for s390_arch_random_generate
In reply to Greg Kroah-HartmanFrom: Harald Freudenberger <[email protected]>
[ Upstream commit 28096067686c5a5cbd4c35b079749bd805df5010 ]
A review of the code showed, that this function which is exposed within the whole kernel should do a parameter check for the amount of bytes requested. If this requested bytes is too high an unsigned int overflow could happen causing this function to try to memcpy a really big memory chunk.
This is not a security issue as there are only two invocations of this function from arch/s390/include/asm/archrandom.h and both are not exposed to userland.
--- arch/s390/crypto/arch_random.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/s390/crypto/arch_random.c +4 -0
@@ -53,6 +53,10 @@ static DECLARE_DELAYED_WORK(arch_rng_work, arch_rng_refill_buffer);bool s390_arch_random_generate (u8 *buf,unsigned int nbytes) { +/* max hunk is ARCH_RNG_BUF_SIZE */ +if (nbytes >ARCH_RNG_BUF_SIZE ) +return false; +/* lock rng buffer */ if (!spin_trylock (&arch_rng_lock))return false;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 125/184 ALSA: emu8000: Fix a use after free in snd_emu8000_create_mixer
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
commit 1c98f574403dbcf2eb832d5535a10d967333ef2d upstream.
Our code analyzer reported a uaf.
In snd_emu8000_create_mixer, the callee snd_ctl_add(..,emu->controls[i]) calls snd_ctl_add_replace(.., kcontrol,..). Inside snd_ctl_add_replace(), if error happens, kcontrol will be freed by snd_ctl_free_one(kcontrol). Then emu->controls[i] points to a freed memory, and the execution comes to __error branch of snd_emu8000_create_mixer. The freed emu->controls[i] is used in snd_ctl_remove(card, emu->controls[i]).
My patch set emu->controls[i] to NULL if snd_ctl_add() failed to avoid the uaf.
--- sound/isa/sb/emu8000.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/isa/sb/emu8000.c +3 -1
@@ -1029,8 +1029,10 @@ snd_emu8000_create_mixer(struct snd_cardmemset (emu->controls,0 ,sizeof (emu->controls));for (i =0 ; i <EMU8000_NUM_CONTROLS ; i++) { -if ((err =snd_ctl_add (card, emu->controls[i] =snd_ctl_new1 (mixer_defs[i], emu))) <0 ) +if ((err =snd_ctl_add (card, emu->controls[i] =snd_ctl_new1 (mixer_defs[i], emu))) <0 ) { + emu->controls[i] =NULL ; goto __error; + } }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 126/184 ALSA: hda/conexant: Re-order CX5066 quirk table entries
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 2e6a731296be9d356fdccee9fb6ae345dad96438 upstream.
Just re-order the cx5066_fixups[] entries for HP devices for avoiding the oversight of the duplicated or unapplied item in future. No functional changes.
Also Cc-to-stable for the further patch applications.
--- sound/pci/hda/patch_conexant.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
sound/pci/hda/patch_conexant.c +7 -7
@@ -898,18 +898,18 @@ static const struct snd_pci_quirk cxt506SND_PCI_QUIRK (0x103c ,0x8079 ,"HP EliteBook 840 G3" ,CXT_FIXUP_HP_DOCK ),SND_PCI_QUIRK (0x103c ,0x807C ,"HP EliteBook 820 G3" ,CXT_FIXUP_HP_DOCK ),SND_PCI_QUIRK (0x103c ,0x80FD ,"HP ProBook 640 G2" ,CXT_FIXUP_HP_DOCK ), -SND_PCI_QUIRK (0x103c ,0x828c ,"HP EliteBook 840 G4" ,CXT_FIXUP_HP_DOCK ), -SND_PCI_QUIRK (0x103c ,0x83b2 ,"HP EliteBook 840 G5" ,CXT_FIXUP_HP_DOCK ), -SND_PCI_QUIRK (0x103c ,0x83b3 ,"HP EliteBook 830 G5" ,CXT_FIXUP_HP_DOCK ), -SND_PCI_QUIRK (0x103c ,0x83d3 ,"HP ProBook 640 G4" ,CXT_FIXUP_HP_DOCK ), -SND_PCI_QUIRK (0x103c ,0x8174 ,"HP Spectre x360" ,CXT_FIXUP_HP_SPECTRE ),SND_PCI_QUIRK (0x103c ,0x8115 ,"HP Z1 Gen3" ,CXT_FIXUP_HP_GATE_MIC ),SND_PCI_QUIRK (0x103c ,0x814f ,"HP ZBook 15u G3" ,CXT_FIXUP_MUTE_LED_GPIO ), +SND_PCI_QUIRK (0x103c ,0x8174 ,"HP Spectre x360" ,CXT_FIXUP_HP_SPECTRE ),SND_PCI_QUIRK (0x103c ,0x822e ,"HP ProBook 440 G4" ,CXT_FIXUP_MUTE_LED_GPIO ), -SND_PCI_QUIRK (0x103c ,0x836e ,"HP ProBook 455 G5" ,CXT_FIXUP_MUTE_LED_GPIO ), -SND_PCI_QUIRK (0x103c ,0x837f ,"HP ProBook 470 G5" ,CXT_FIXUP_MUTE_LED_GPIO ), +SND_PCI_QUIRK (0x103c ,0x828c ,"HP EliteBook 840 G4" ,CXT_FIXUP_HP_DOCK ),SND_PCI_QUIRK (0x103c ,0x8299 ,"HP 800 G3 SFF" ,CXT_FIXUP_HP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x103c ,0x829a ,"HP 800 G3 DM" ,CXT_FIXUP_HP_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x103c ,0x836e ,"HP ProBook 455 G5" ,CXT_FIXUP_MUTE_LED_GPIO ), +SND_PCI_QUIRK (0x103c ,0x837f ,"HP ProBook 470 G5" ,CXT_FIXUP_MUTE_LED_GPIO ), +SND_PCI_QUIRK (0x103c ,0x83b2 ,"HP EliteBook 840 G5" ,CXT_FIXUP_HP_DOCK ), +SND_PCI_QUIRK (0x103c ,0x83b3 ,"HP EliteBook 830 G5" ,CXT_FIXUP_HP_DOCK ), +SND_PCI_QUIRK (0x103c ,0x83d3 ,"HP ProBook 640 G4" ,CXT_FIXUP_HP_DOCK ),SND_PCI_QUIRK (0x103c ,0x8402 ,"HP ProBook 645 G4" ,CXT_FIXUP_MUTE_LED_GPIO ),SND_PCI_QUIRK (0x103c ,0x8455 ,"HP Z2 G4" ,CXT_FIXUP_HP_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x103c, 0x8456, "HP Z2 G4 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE),
Greg Kroah-Hartman
maintainerPATCH 127/184 ALSA: sb: Fix two use after free in snd_sb_qsound_build
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
commit 4fb44dd2c1dda18606348acdfdb97e8759dde9df upstream.
In snd_sb_qsound_build, snd_ctl_add(..,p->qsound_switch...) and snd_ctl_add(..,p->qsound_space..) are called. But the second arguments of snd_ctl_add() could be freed via snd_ctl_add_replace() ->snd_ctl_free_one(). After the error code is returned, snd_sb_qsound_destroy(p) is called in __error branch.
But in snd_sb_qsound_destroy(), the freed p->qsound_switch and p->qsound_space are still used by snd_ctl_remove().
My patch set p->qsound_switch and p->qsound_space to NULL if snd_ctl_add() failed to avoid the uaf bugs. But these codes need to further be improved with the code style.
--- sound/isa/sb/sb16_csp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/isa/sb/sb16_csp.c +6 -2
@@ -1045,10 +1045,14 @@ static int snd_sb_qsound_build(struct snspin_lock_init (&p->q_lock); -if ((err =snd_ctl_add (card, p->qsound_switch =snd_ctl_new1 (&snd_sb_qsound_switch, p))) <0 ) +if ((err =snd_ctl_add (card, p->qsound_switch =snd_ctl_new1 (&snd_sb_qsound_switch, p))) <0 ) { + p->qsound_switch =NULL ; goto __error; -if ((err =snd_ctl_add (card, p->qsound_space =snd_ctl_new1 (&snd_sb_qsound_space, p))) <0 ) + } +if ((err =snd_ctl_add (card, p->qsound_space =snd_ctl_new1 (&snd_sb_qsound_space, p))) <0 ) { + p->qsound_space =NULL ; goto __error; + }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 128/184 ALSA: usb-audio: Explicitly set up the clock selector
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit d2e8f641257d0d3af6e45d6ac2d6f9d56b8ea964 upstream.
In the current code, we have some assumption that the audio clock selector has been set up implicitly and don't want to touch it unless it's really needed for the fallback autoclock setup. This works for most devices but some seem having a problem. Partially this was covered for the devices with a single connector at the initialization phase (commit 086b957cc17f "ALSA: usb-audio: Skip the clock selector inquiry for single connections"), but also there are cases where the wrong clock set up is kept silently. The latter seems to be the cause of the noises on Behringer devices.
In this patch, we explicitly set up the audio clock selector whenever the appropriate node is found.
--- sound/usb/clock.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
sound/usb/clock.c +14 -4
@@ -296,7 +296,7 @@ static int __uac_clock_find_source(struc selector =snd_usb_find_clock_selector (chip->ctrl_intf, entity_id);if (selector) { -int ret, i, cur; +int ret, i, cur, err;/* the entity ID we are looking for is a selector. * find out what it currently selects */
@@ -318,13 +318,17 @@ static int __uac_clock_find_source(struc ret =__uac_clock_find_source (chip, fmt, selector->baCSourceID[ret -1 ], visited, validate); +if (ret >0 ) { + err =uac_clock_selector_set_val (chip, entity_id, cur); +if (err <0 ) +return err; + } +if (!validate || ret >0 || !chip->autoclock)return ret;/* The current clock source is invalid, try others. */ for (i =1 ; i <= selector->bNrInPins; i++) { -int err; -if (i == cur)continue ;
@@ -390,7 +394,7 @@ static int __uac3_clock_find_source(stru selector =snd_usb_find_clock_selector_v3 (chip->ctrl_intf, entity_id);if (selector) { -int ret, i, cur; +int ret, i, cur, err;/* the entity ID we are looking for is a selector. * find out what it currently selects */
@@ -412,6 +416,12 @@ static int __uac3_clock_find_source(stru ret =__uac3_clock_find_source (chip, fmt, selector->baCSourceID[ret -1 ], visited, validate); +if (ret >0 ) { + err =uac_clock_selector_set_val (chip, entity_id, cur); +if (err <0 ) +return err; + } +if (!validate || ret >0 || !chip->autoclock)return ret;
Greg Kroah-Hartman
maintainerPATCH 129/184 ALSA: usb-audio: More constifications
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit a01df925d1bbc97d6f7fe07b157aadb565315337 upstream.
Apply const prefix to the remaining places: the static table for the unit information, the mixer maps, the validator tables, etc.
Just for minor optimization and no functional changes.
--- sound/usb/mixer.c | 60 ++++++++++++++++++++++----------------------- sound/usb/mixer_maps.c | 56 +++++++++++++++++++++--------------------- sound/usb/mixer_quirks.c | 6 ++-- sound/usb/mixer_scarlett.c | 14 +++++----- sound/usb/proc.c | 2 - sound/usb/stream.c | 4 +-- sound/usb/validate.c | 4 +-- 7 files changed, 73 insertions(+), 73 deletions(-)
sound/usb/mixer.c +30 -30
@@ -1030,7 +1030,7 @@ struct usb_feature_control_info {int type_uac2;/* data type for uac2 if different from uac1, else -1 */ }; -static struct usb_feature_control_info audio_feature_info[] = { +static const struct usb_feature_control_info audio_feature_info[] = { {UAC_FU_MUTE ,"Mute" ,USB_MIXER_INV_BOOLEAN ,-1 }, {UAC_FU_VOLUME ,"Volume" ,USB_MIXER_S16 ,-1 }, {UAC_FU_BASS ,"Tone Control - Bass" ,USB_MIXER_S8 ,-1 },
@@ -1544,7 +1544,7 @@ static void check_no_speaker_on_headset(strlcpy (kctl->id.name,"Headphone" ,sizeof (kctl->id.name)); } -static struct usb_feature_control_info *get_feature_control_info (int control) +static const struct usb_feature_control_info *get_feature_control_info (int control) {int i;
@@ -1562,7 +1562,7 @@ static void __build_feature_ctl(struct ustruct usb_audio_term *oterm, int unitid, int nameid, int readonly_mask) { - struct usb_feature_control_info *ctl_info; + const struct usb_feature_control_info *ctl_info;unsigned int len =0 ;int mapped_name =0 ;struct snd_kcontrol *kctl;
@@ -2237,7 +2237,7 @@ static const struct snd_kcontrol_new mix*/ struct procunit_value_info {int control; -char *suffix; +const char *suffix;int val_type;int min_value; };
@@ -2245,44 +2245,44 @@ struct procunit_value_info {struct procunit_info {int type;char *name; -struct procunit_value_info *values; +const struct procunit_value_info *values; }; -static struct procunit_value_info undefined_proc_info[] = { +static const struct procunit_value_info undefined_proc_info[] = { {0x00 ,"Control Undefined" ,0 }, {0 } }; -static struct procunit_value_info updown_proc_info[] = { +static const struct procunit_value_info updown_proc_info[] = { {UAC_UD_ENABLE ,"Switch" ,USB_MIXER_BOOLEAN }, {UAC_UD_MODE_SELECT ,"Mode Select" ,USB_MIXER_U8 ,1 }, {0 } }; -static struct procunit_value_info prologic_proc_info[] = { +static const struct procunit_value_info prologic_proc_info[] = { {UAC_DP_ENABLE ,"Switch" ,USB_MIXER_BOOLEAN }, {UAC_DP_MODE_SELECT ,"Mode Select" ,USB_MIXER_U8 ,1 }, {0 } }; -static struct procunit_value_info threed_enh_proc_info[] = { +static const struct procunit_value_info threed_enh_proc_info[] = { {UAC_3D_ENABLE ,"Switch" ,USB_MIXER_BOOLEAN }, {UAC_3D_SPACE ,"Spaciousness" ,USB_MIXER_U8 }, {0 } }; -static struct procunit_value_info reverb_proc_info[] = { +static const struct procunit_value_info reverb_proc_info[] = { {UAC_REVERB_ENABLE ,"Switch" ,USB_MIXER_BOOLEAN }, {UAC_REVERB_LEVEL ,"Level" ,USB_MIXER_U8 }, {UAC_REVERB_TIME ,"Time" ,USB_MIXER_U16 }, {UAC_REVERB_FEEDBACK ,"Feedback" ,USB_MIXER_U8 }, {0 } }; -static struct procunit_value_info chorus_proc_info[] = { +static const struct procunit_value_info chorus_proc_info[] = { {UAC_CHORUS_ENABLE ,"Switch" ,USB_MIXER_BOOLEAN }, {UAC_CHORUS_LEVEL ,"Level" ,USB_MIXER_U8 }, {UAC_CHORUS_RATE ,"Rate" ,USB_MIXER_U16 }, {UAC_CHORUS_DEPTH ,"Depth" ,USB_MIXER_U16 }, {0 } }; -static struct procunit_value_info dcr_proc_info[] = { +static const struct procunit_value_info dcr_proc_info[] = { {UAC_DCR_ENABLE ,"Switch" ,USB_MIXER_BOOLEAN }, {UAC_DCR_RATE ,"Ratio" ,USB_MIXER_U16 }, {UAC_DCR_MAXAMPL ,"Max Amp" ,USB_MIXER_S16 },
@@ -2292,7 +2292,7 @@ static struct procunit_value_info dcr_pr { 0 } }; -static struct procunit_info procunits[] = { +static const struct procunit_info procunits[] = { {UAC_PROCESS_UP_DOWNMIX ,"Up Down" , updown_proc_info }, {UAC_PROCESS_DOLBY_PROLOGIC ,"Dolby Prologic" , prologic_proc_info }, {UAC_PROCESS_STEREO_EXTENDER ,"3D Stereo Extender" , threed_enh_proc_info },
@@ -2302,16 +2302,16 @@ static struct procunit_info procunits[] { 0 }, }; -static struct procunit_value_info uac3_updown_proc_info[] = { +static const struct procunit_value_info uac3_updown_proc_info[] = { {UAC3_UD_MODE_SELECT ,"Mode Select" ,USB_MIXER_U8 ,1 }, {0 } }; -static struct procunit_value_info uac3_stereo_ext_proc_info[] = { +static const struct procunit_value_info uac3_stereo_ext_proc_info[] = { {UAC3_EXT_WIDTH_CONTROL ,"Width Control" ,USB_MIXER_U8 }, {0 } }; -static struct procunit_info uac3_procunits[] = { +static const struct procunit_info uac3_procunits[] = { {UAC3_PROCESS_UP_DOWNMIX ,"Up Down" , uac3_updown_proc_info }, {UAC3_PROCESS_STEREO_EXTENDER ,"3D Stereo Extender" , uac3_stereo_ext_proc_info }, { UAC3_PROCESS_MULTI_FUNCTION, "Multi-Function", undefined_proc_info },
@@ -2321,23 +2321,23 @@ static struct procunit_info uac3_procuni/* * predefined data for extension units */ -static struct procunit_value_info clock_rate_xu_info[] = { +static const struct procunit_value_info clock_rate_xu_info[] = { {USB_XU_CLOCK_RATE_SELECTOR ,"Selector" ,USB_MIXER_U8 ,0 }, {0 } }; -static struct procunit_value_info clock_source_xu_info[] = { +static const struct procunit_value_info clock_source_xu_info[] = { {USB_XU_CLOCK_SOURCE_SELECTOR ,"External" ,USB_MIXER_BOOLEAN }, {0 } }; -static struct procunit_value_info spdif_format_xu_info[] = { +static const struct procunit_value_info spdif_format_xu_info[] = { {USB_XU_DIGITAL_FORMAT_SELECTOR ,"SPDIF/AC3" ,USB_MIXER_BOOLEAN }, {0 } }; -static struct procunit_value_info soft_limit_xu_info[] = { +static const struct procunit_value_info soft_limit_xu_info[] = { {USB_XU_SOFT_LIMIT_SELECTOR ," " ,USB_MIXER_BOOLEAN }, {0 } }; -static struct procunit_info extunits[] = { +static const struct procunit_info extunits[] = { {USB_XU_CLOCK_RATE ,"Clock rate" , clock_rate_xu_info }, {USB_XU_CLOCK_SOURCE ,"DigitalIn CLK source" , clock_source_xu_info }, {USB_XU_DIGITAL_IO_STATUS ,"DigitalOut format:" , spdif_format_xu_info },
@@ -2349,7 +2349,7 @@ static struct procunit_info extunits[] =* build a processing/extension unit */ static int build_audio_procunit (struct mixer_build *state,int unitid, -void *raw_desc,struct procunit_info *list, +void *raw_desc,const struct procunit_info *list,bool extension_unit) {struct uac_processing_unit_descriptor *desc = raw_desc;
@@ -2357,14 +2357,14 @@ static int build_audio_procunit(struct mstruct usb_mixer_elem_info *cval;struct snd_kcontrol *kctl;int i, err, nameid, type, len; -struct procunit_info *info; -struct procunit_value_info *valinfo; +const struct procunit_info *info; +const struct procunit_value_info *valinfo;const struct usbmix_name_map *map; -static struct procunit_value_info default_value_info[] = { +static const struct procunit_value_info default_value_info[] = { {0x01 ,"Switch" ,USB_MIXER_BOOLEAN }, {0 } }; -static struct procunit_info default_info = { +static const struct procunit_info default_info = {0 ,NULL , default_value_info }; const char *name = extension_unit ?
@@ -2842,7 +2842,7 @@ struct uac3_badd_profile {int st_chmask;/* side tone mixing channel mask */ }; -static struct uac3_badd_profile uac3_badd_profiles[] = { +static const struct uac3_badd_profile uac3_badd_profiles[] = { {/* * BAIF, BAOF or combination of both
@@ -2903,7 +2903,7 @@ static struct uac3_badd_profile uac3_bad };static bool uac3_badd_func_has_valid_channels (struct usb_mixer_interface *mixer, -struct uac3_badd_profile *f, +const struct uac3_badd_profile *f,int c_chmask,int p_chmask) {/*
@@ -2947,7 +2947,7 @@ static int snd_usb_mixer_controls_badd(sstruct usb_device *dev = mixer->chip->dev;struct usb_interface_assoc_descriptor *assoc;int badd_profile = mixer->chip->badd_profile; -struct uac3_badd_profile *f; +const struct uac3_badd_profile *f;const struct usbmix_ctl_map *map;int p_chmask =0 , c_chmask =0 , st_chmask =0 ;int i;
@@ -3241,7 +3241,7 @@ static void snd_usb_mixer_dump_cval(stru struct usb_mixer_elem_list *list) {struct usb_mixer_elem_info *cval =mixer_elem_list_to_info (list); -static char *val_types[] = {"BOOLEAN" ,"INV_BOOLEAN" , +static const char *const val_types[] = {"BOOLEAN" ,"INV_BOOLEAN" ,"S8" ,"U8" ,"S16" ,"U16" }; snd_iprintf(buffer, " Info: id=%i, control=%i, cmask=0x%x, " "channels=%i, type=\"%s\"\n", cval->head.id,
sound/usb/mixer_maps.c +28 -28
195 lines not on this page · raw message
sound/usb/mixer_quirks.c +3 -3
@@ -119,7 +119,7 @@ static int snd_create_std_mono_ctl(struc* Create a set of standard UAC controls from a table */ static int snd_create_std_mono_table (struct usb_mixer_interface *mixer, -struct std_mono_table *t) +const struct std_mono_table *t) {int err;
@@ -1388,7 +1388,7 @@ static int snd_c400_create_mixer(struct* are valid they presents mono controls as L and R channels of * stereo. So we provide a good mixer here. */ -static struct std_mono_table ebox44_table[] = { +static const struct std_mono_table ebox44_table[] = { { .unitid =4 , .control =1 ,
@@ -1697,7 +1697,7 @@ static struct snd_kcontrol_new snd_microstatic int snd_microii_controls_create (struct usb_mixer_interface *mixer) {int err, i; -static usb_mixer_elem_resume_func_t resume_funcs[] = { +const static usb_mixer_elem_resume_func_t resume_funcs[] = { snd_microii_spdif_default_update,NULL , snd_microii_spdif_switch_update
sound/usb/mixer_scarlett.c +7 -7
@@ -623,7 +623,7 @@ static int add_output_ctls(struct usb_mi/********************** device-specific config *************************/ /* untested... */ -static struct scarlett_device_info s6i6_info = { +static const struct scarlett_device_info s6i6_info = { .matrix_in =18 , .matrix_out =8 , .input_len =6 ,
@@ -665,7 +665,7 @@ static struct scarlett_device_info s6i6_ };/* untested... */ -static struct scarlett_device_info s8i6_info = { +static const struct scarlett_device_info s8i6_info = { .matrix_in =18 , .matrix_out =6 , .input_len =8 ,
@@ -704,7 +704,7 @@ static struct scarlett_device_info s8i6_ } }; -static struct scarlett_device_info s18i6_info = { +static const struct scarlett_device_info s18i6_info = { .matrix_in =18 , .matrix_out =6 , .input_len =18 ,
@@ -741,7 +741,7 @@ static struct scarlett_device_info s18i6 } }; -static struct scarlett_device_info s18i8_info = { +static const struct scarlett_device_info s18i8_info = { .matrix_in =18 , .matrix_out =8 , .input_len =18 ,
@@ -783,7 +783,7 @@ static struct scarlett_device_info s18i8 } }; -static struct scarlett_device_info s18i20_info = { +static const struct scarlett_device_info s18i20_info = { .matrix_in =18 , .matrix_out =8 , .input_len =18 ,
@@ -833,7 +833,7 @@ static struct scarlett_device_info s18i2static int scarlett_controls_create_generic (struct usb_mixer_interface *mixer, -struct scarlett_device_info *info) +const struct scarlett_device_info *info) {int i, err;char mx[SNDRV_CTL_ELEM_ID_NAME_MAXLEN ];
@@ -896,7 +896,7 @@ int snd_scarlett_controls_create(struct {int err, i, o;char mx[SNDRV_CTL_ELEM_ID_NAME_MAXLEN ]; -struct scarlett_device_info *info; +const struct scarlett_device_info *info;struct usb_mixer_elem_info *elem;static char sample_rate_buffer[4 ] = {'\x80' ,'\xbb' ,'\x00' ,'\x00' };
sound/usb/proc.c +1 -1
@@ -60,7 +60,7 @@ void snd_usb_audio_create_proc(struct snstatic void proc_dump_substream_formats (struct snd_usb_substream *subs,struct snd_info_buffer *buffer) {struct audioformat *fp; -static char *sync_types[4 ] = { +static const char *const sync_types[4 ] = {"NONE" ,"ASYNC" ,"ADAPTIVE" ,"SYNC" };
sound/usb/stream.c +2 -2
@@ -240,7 +240,7 @@ static int add_chmap(struct snd_pcm *pcmstatic struct snd_pcm_chmap_elem *convert_chmap (int channels,unsigned int bits,int protocol) { -static unsigned int uac1_maps[] = { +static const unsigned int uac1_maps[] = {SNDRV_CHMAP_FL ,/* left front */ SNDRV_CHMAP_FR ,/* right front */ SNDRV_CHMAP_FC ,/* center front */
@@ -255,7 +255,7 @@ static struct snd_pcm_chmap_elem *converSNDRV_CHMAP_TC ,/* top */ 0 /* terminator */ }; -static unsigned int uac2_maps[] = { +static const unsigned int uac2_maps[] = {SNDRV_CHMAP_FL ,/* front left */ SNDRV_CHMAP_FR ,/* front right */ SNDRV_CHMAP_FC, /* front center */
sound/usb/validate.c +2 -2
@@ -233,7 +233,7 @@ static bool validate_midi_out_jack(const#define FIXED (p, t, s) { .protocol = (p), .type = (t), .size = sizeof(s) }#define FUNC (p, t, f) { .protocol = (p), .type = (t), .func = (f) } -static struct usb_desc_validator audio_validators[] = { +static const struct usb_desc_validator audio_validators[] = {/* UAC1 */ FUNC (UAC_VERSION_1 ,UAC_HEADER , validate_uac1_header), FIXED(UAC_VERSION_1, UAC_INPUT_TERMINAL,
@@ -288,7 +288,7 @@ static struct usb_desc_validator audio_v { }/* terminator */ }; -static struct usb_desc_validator midi_validators[] = { +static const struct usb_desc_validator midi_validators[] = {FIXED (UAC_VERSION_ALL ,USB_MS_HEADER , struct usb_ms_header_descriptor), FIXED(UAC_VERSION_ALL, USB_MS_MIDI_IN_JACK,
Greg Kroah-Hartman
maintainerPATCH 130/184 ALSA: usb-audio: Add dB range mapping for Sennheiser Communications Headset PC 8
In reply to Greg Kroah-HartmanFrom: Timo Gurr <[email protected]>
commit ab2165e2e6ed17345ffa8ee88ca764e8788ebcd7 upstream.
The decibel volume range contains a negative maximum value resulting in pipewire complaining about the device and effectivly having no sound output. The wrong values also resulted in the headset sounding muted already at a mixer level of about ~25%.
PipeWire BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1049
--- sound/usb/mixer_maps.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/usb/mixer_maps.c +12 -0
@@ -337,6 +337,13 @@ static struct usbmix_name_map bose_compa { 0 } /* terminator */ }; +/* Sennheiser Communications Headset [PC 8], the dB value is reported as -6 negative maximum */ +static const struct usbmix_dB_map sennheiser_pc8_dB = {-9500 ,0 }; +static const struct usbmix_name_map sennheiser_pc8_map[] = { + {9 ,NULL , .dB = &sennheiser_pc8_dB }, + {0 }/* terminator */ +}; +/* * Dell usb dock with ALC4020 codec had a firmware problem where it got * screwed up when zero volume is passed; just skip it as a workaround
@@ -619,5 +626,10 @@ static struct usbmix_ctl_map uac3_badd_u .id = UAC3_FUNCTION_SUBCLASS_SPEAKERPHONE, .map = uac3_badd_speakerphone_map, }, + { +/* Sennheiser Communications Headset [PC 8] */ + .id = USB_ID(0x1395, 0x0025), + .map = sennheiser_pc8_map, + }, { 0 } /* terminator */ };
Greg Kroah-Hartman
maintainerPATCH 131/184 ALSA: hda/realtek: GA503 use same quirks as GA401
In reply to Greg Kroah-HartmanFrom: Luke D Jones <[email protected]>
commit 76fae6185f5456865ff1bcb647709d44fd987eb6 upstream.
The GA503 has almost exactly the same default setup as the GA401 model with the same issues. The GA401 quirks solve all the issues so we will use the full quirk chain.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -7958,6 +7958,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1043 ,0x1ccd ,"ASUS X555UB" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x1d4e ,"ASUS TM420" ,ALC256_FIXUP_ASUS_HPE ),SND_PCI_QUIRK (0x1043 ,0x1e11 ,"ASUS Zephyrus G15" ,ALC289_FIXUP_ASUS_GA502 ), +SND_PCI_QUIRK (0x1043 ,0x1e8e ,"ASUS Zephyrus G15" ,ALC289_FIXUP_ASUS_GA401 ),SND_PCI_QUIRK (0x1043 ,0x1f11 ,"ASUS Zephyrus G14" ,ALC289_FIXUP_ASUS_GA401 ),SND_PCI_QUIRK (0x1043 ,0x1881 ,"ASUS Zephyrus S/M" ,ALC294_FIXUP_ASUS_GX502_PINS ), SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Greg Kroah-Hartman
maintainerPATCH 132/184 ALSA: hda/realtek: fix mic boost on Intel NUC 8
In reply to Greg Kroah-HartmanFrom: Phil Calvin <[email protected]>
commit d1ee66c5d3c5a0498dd5e3f2af5b8c219a98bba5 upstream.
Fix two bugs with the Intel HDA Realtek ALC233 sound codec present in Intel NUC NUC8i7BEH and probably a few other similar NUC models.
These codecs advertise a 4-level microphone input boost amplifier on pin 0x19, but the highest two boost settings do not work correctly, and produce only low analog noise that does not seem to contain any discernible signal. There is an existing fixup for this exact problem but for a different PCI subsystem ID, so we re-use that logic.
Changing the boost level also triggers a DC spike in the input signal that bleeds off over about a second and overwhelms any input during that time. Thankfully, the existing fixup has the side effect of making the boost control show up in userspace as a mute/unmute switch, and this keeps (e.g.) PulseAudio from fiddling with it during normal input volume adjustments.
Finally, the NUC hardware has built-in inverted stereo mics. This patch also enables the usual fixup for this so the two channels cancel noise instead of the actual signal.
[ Re-ordered the quirk entry point by tiwai ]
--- sound/pci/hda/patch_realtek.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/pci/hda/patch_realtek.c +13 -0
@@ -6332,6 +6332,8 @@ enum {ALC269_FIXUP_LEMOTE_A1802 ,ALC269_FIXUP_LEMOTE_A190X ,ALC256_FIXUP_INTEL_NUC8_RUGGED , +ALC233_FIXUP_INTEL_NUC8_DMIC , +ALC233_FIXUP_INTEL_NUC8_BOOST ,ALC256_FIXUP_INTEL_NUC10 ,ALC255_FIXUP_XIAOMI_HEADSET_MIC , ALC274_FIXUP_HP_MIC,
@@ -7043,6 +7045,16 @@ static const struct hda_fixup alc269_fix .type = HDA_FIXUP_FUNC, .v.func = alc233_fixup_lenovo_line2_mic_hotkey, }, + [ALC233_FIXUP_INTEL_NUC8_DMIC] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_inv_dmic, + .chained = true, + .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST, + }, + [ALC233_FIXUP_INTEL_NUC8_BOOST] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc269_fixup_limit_int_mic_boost + }, [ALC255_FIXUP_DELL_SPK_NOISE] = { .type = HDA_FIXUP_FUNC, .v.func = alc_fixup_disable_aamix,
@@ -8125,6 +8137,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x10ec ,0x118c ,"Medion EE4254 MD62100" ,ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE ),SND_PCI_QUIRK (0x1c06 ,0x2013 ,"Lemote A1802" ,ALC269_FIXUP_LEMOTE_A1802 ),SND_PCI_QUIRK (0x1c06 ,0x2015 ,"Lemote A190X" ,ALC269_FIXUP_LEMOTE_A190X ), +SND_PCI_QUIRK (0x8086 ,0x2074 ,"Intel NUC 8" ,ALC233_FIXUP_INTEL_NUC8_DMIC ),SND_PCI_QUIRK (0x8086 ,0x2080 ,"Intel NUC 8 Rugged" ,ALC256_FIXUP_INTEL_NUC8_RUGGED ), SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
Greg Kroah-Hartman
maintainerPATCH 133/184 ALSA: hda/realtek: fix static noise on ALC285 Lenovo laptops
In reply to Greg Kroah-HartmanFrom: Sami Loone <[email protected]>
commit 9bbb94e57df135ef61bef075d9c99b8d9e89e246 upstream.
Remove a duplicate vendor+subvendor pin fixup entry as one is masking the other and making it unreachable. Consider the more specific newcomer as a second chance instead.
The generic entry is made less strict to also match for laptops with slightly different 0x12 pin configuration. Tested on Lenovo Yoga 6 (AMD) where 0x12 is 0x40000000.
--- sound/pci/hda/patch_realtek.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
sound/pci/hda/patch_realtek.c +4 -5
@@ -8597,12 +8597,7 @@ static const struct snd_hda_pin_quirk al {0x12, 0x90a60130}, {0x19, 0x03a11020}, {0x21, 0x0321101f}), -SND_HDA_PIN_QUIRK (0x10ec0285 ,0x17aa ,"Lenovo" ,ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK , - {0x14, 0x90170110}, - {0x19, 0x04a11040}, - {0x21, 0x04211020}),SND_HDA_PIN_QUIRK (0x10ec0285 ,0x17aa ,"Lenovo" ,ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE , - {0x12, 0x90a60130}, {0x14, 0x90170110}, {0x19, 0x04a11040}, {0x21, 0x04211020}),
@@ -8770,6 +8765,10 @@ static const struct snd_hda_pin_quirk alSND_HDA_PIN_QUIRK (0x10ec0236 ,0x1028 ,"Dell" ,ALC255_FIXUP_DELL1_MIC_NO_PRESENCE , {0x19, 0x40000000}, {0x1a, 0x40000000}), +SND_HDA_PIN_QUIRK (0x10ec0285 ,0x17aa ,"Lenovo" ,ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK , + {0x14, 0x90170110}, + {0x19, 0x04a11040}, + {0x21, 0x04211020}), {} };
Greg Kroah-Hartman
maintainerPATCH 134/184 ALSA: hda/realtek: Add quirk for Intel Clevo PCx0Dx
In reply to Greg Kroah-HartmanFrom: Eckhart Mohr <[email protected]>
commit 970e3012c04c96351c413f193a9c909e6d871ce2 upstream.
This applies a SND_PCI_QUIRK(...) to the Clevo PCx0Dx barebones. This fix enables audio output over the headset jack and ensures that a microphone connected via the headset combo jack is correctly recognized when pluged in.
[ Rearranged the list entries in a sorted order -- tiwai ]
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -2542,8 +2542,10 @@ static const struct snd_pci_quirk alc882SND_PCI_QUIRK (0x1558 ,0x65d1 ,"Clevo PB51[ER][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK (0x1558 ,0x65d2 ,"Clevo PB51R[CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK (0x1558 ,0x65e1 ,"Clevo PB51[ED][DF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ), +SND_PCI_QUIRK (0x1558 ,0x65e5 ,"Clevo PC50D[PRS](?:-D|-G)?" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK (0x1558 ,0x67d1 ,"Clevo PB71[ER][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK (0x1558 ,0x67e1 ,"Clevo PB71[DE][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ), +SND_PCI_QUIRK (0x1558 ,0x67e5 ,"Clevo PC70D[PRS](?:-D|-G)?" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK (0x1558 ,0x70d1 ,"Clevo PC70[ER][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK (0x1558 ,0x7714 ,"Clevo X170" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ), SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
Greg Kroah-Hartman
maintainerPATCH 135/184 btrfs: fix race when picking most recent mod log operation for an old root
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
[ Upstream commit f9690f426b2134cc3e74bfc5d9dfd6a4b2ca5281 ]
Commit dbcc7d57bffc0c ("btrfs: fix race when cloning extent buffer during rewind of an old root"), fixed a race when we need to rewind the extent buffer of an old root. It was caused by picking a new mod log operation for the extent buffer while getting a cloned extent buffer with an outdated number of items (off by -1), because we cloned the extent buffer without locking it first.
However there is still another similar race, but in the opposite direction. The cloned extent buffer has a number of items that does not match the number of tree mod log operations that are going to be replayed. This is because right after we got the last (most recent) tree mod log operation to replay and before locking and cloning the extent buffer, another task adds a new pointer to the extent buffer, which results in adding a new tree mod log operation and incrementing the number of items in the extent buffer. So after cloning we have mismatch between the number of items in the extent buffer and the number of mod log operations we are going to apply to it. This results in hitting a BUG_ON() that produces the following stack trace:
------------[ cut here ]------------
kernel BUG at fs/btrfs/tree-mod-log.c:675!
invalid opcode: 0000 [#1] SMP KASAN PTI
CPU: 3 PID: 4811 Comm: crawl_1215 Tainted: G W 5.12.0-7d1efdf501f8-misc-next+ #99
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
RIP: 0010:tree_mod_log_rewind+0x3b1/0x3c0
Code: 05 48 8d 74 10 (...)
RSP: 0018:ffffc90001027090 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff8880a8514600 RCX: ffffffffaa9e59b6
RDX: 0000000000000007 RSI: dffffc0000000000 RDI: ffff8880a851462c
RBP: ffffc900010270e0 R08: 00000000000000c0 R09: ffffed1004333417
R10: ffff88802199a0b7 R11: ffffed1004333416 R12: 000000000000000e
R13: ffff888135af8748 R14: ffff88818766ff00 R15: ffff8880a851462c
FS: 00007f29acf62700(0000) GS:ffff8881f2200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f0e6013f718 CR3: 000000010d42e003 CR4: 0000000000170ee0
Call Trace:
btrfs_get_old_root+0x16a/0x5c0
? lock_downgrade+0x400/0x400
btrfs_search_old_slot+0x192/0x520
? btrfs_search_slot+0x1090/0x1090
? free_extent_buffer.part.61+0xd7/0x140
? free_extent_buffer+0x13/0x20
resolve_indirect_refs+0x3e9/0xfc0
? lock_downgrade+0x400/0x400
? __kasan_check_read+0x11/0x20
? add_prelim_ref.part.11+0x150/0x150
? lock_downgrade+0x400/0x400
? __kasan_check_read+0x11/0x20
? lock_acquired+0xbb/0x620
? __kasan_check_write+0x14/0x20
? do_raw_spin_unlock+0xa8/0x140
? rb_insert_color+0x340/0x360
? prelim_ref_insert+0x12d/0x430
find_parent_nodes+0x5c3/0x1830
? stack_trace_save+0x87/0xb0
? resolve_indirect_refs+0xfc0/0xfc0
? fs_reclaim_acquire+0x67/0xf0
? __kasan_check_read+0x11/0x20
? lockdep_hardirqs_on_prepare+0x210/0x210
? fs_reclaim_acquire+0x67/0xf0
? __kasan_check_read+0x11/0x20
? ___might_sleep+0x10f/0x1e0
? __kasan_kmalloc+0x9d/0xd0
? trace_hardirqs_on+0x55/0x120
btrfs_find_all_roots_safe+0x142/0x1e0
? find_parent_nodes+0x1830/0x1830
? trace_hardirqs_on+0x55/0x120
? ulist_free+0x1f/0x30
? btrfs_inode_flags_to_xflags+0x50/0x50
iterate_extent_inodes+0x20e/0x580
? tree_backref_for_extent+0x230/0x230
? release_extent_buffer+0x225/0x280
? read_extent_buffer+0xdd/0x110
? lock_downgrade+0x400/0x400
? __kasan_check_read+0x11/0x20
? lock_acquired+0xbb/0x620
? __kasan_check_write+0x14/0x20
? do_raw_spin_unlock+0xa8/0x140
? _raw_spin_unlock+0x22/0x30
? release_extent_buffer+0x225/0x280
iterate_inodes_from_logical+0x129/0x170
? iterate_inodes_from_logical+0x129/0x170
? btrfs_inode_flags_to_xflags+0x50/0x50
? iterate_extent_inodes+0x580/0x580
? __vmalloc_node+0x92/0xb0
? init_data_container+0x34/0xb0
? init_data_container+0x34/0xb0
? kvmalloc_node+0x60/0x80
btrfs_ioctl_logical_to_ino+0x158/0x230
btrfs_ioctl+0x2038/0x4360
? __kasan_check_write+0x14/0x20
? mmput+0x3b/0x220
? btrfs_ioctl_get_supported_features+0x30/0x30
? __kasan_check_read+0x11/0x20
? __kasan_check_read+0x11/0x20
? lock_release+0xc8/0x650
? __might_fault+0x64/0xd0
? __kasan_check_read+0x11/0x20
? lock_downgrade+0x400/0x400
? lockdep_hardirqs_on_prepare+0x210/0x210
? lockdep_hardirqs_on_prepare+0x13/0x210
? _raw_spin_unlock_irqrestore+0x51/0x63
? __kasan_check_read+0x11/0x20
? do_vfs_ioctl+0xfc/0x9d0
? ioctl_file_clone+0xe0/0xe0
? lock_downgrade+0x400/0x400
? lockdep_hardirqs_on_prepare+0x210/0x210
? __kasan_check_read+0x11/0x20
? lock_release+0xc8/0x650
? __task_pid_nr_ns+0xd3/0x250
? __kasan_check_read+0x11/0x20
? __fget_files+0x160/0x230
? __fget_light+0xf2/0x110
__x64_sys_ioctl+0xc3/0x100
do_syscall_64+0x37/0x80
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f29ae85b427
Code: 00 00 90 48 8b (...)
RSP: 002b:00007f29acf5fcf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f29acf5ff40 RCX: 00007f29ae85b427
RDX: 00007f29acf5ff48 RSI: 00000000c038943b RDI: 0000000000000003
RBP: 0000000001000000 R08: 0000000000000000 R09: 00007f29acf60120
R10: 00005640d5fc7b00 R11: 0000000000000246 R12: 0000000000000003
R13: 00007f29acf5ff48 R14: 00007f29acf5ff40 R15: 00007f29acf5fef8
Modules linked in:
---[ end trace 85e5fce078dfbe04 ]--- (gdb) l *(tree_mod_log_rewind+0x3b1)
0xffffffff819e5b21 is in tree_mod_log_rewind (fs/btrfs/tree-mod-log.c:675).
670 * the modification. As we're going backwards, we do the 671 * opposite of each operation here. 672 */
673 switch (tm->op) {
674 case BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING:
675 BUG_ON(tm->slot < n);
676 fallthrough;
677 case BTRFS_MOD_LOG_KEY_REMOVE_WHILE_MOVING:
678 case BTRFS_MOD_LOG_KEY_REMOVE:
679 btrfs_set_node_key(eb, &tm->key, tm->slot);
(gdb) quit
The following steps explain in more detail how it happens:
1) We have one tree mod log user (through fiemap or the logical ino ioctl), with a sequence number of 1, so we have fs_info->tree_mod_seq == 1. This is task A;
2) Another task is at ctree.c:balance_level() and we have eb X currently as the root of the tree, and we promote its single child, eb Y, as the new root.
Then, at ctree.c:balance_level(), we call:
ret = btrfs_tree_mod_log_insert_root(root->node, child, true);
3) At btrfs_tree_mod_log_insert_root() we create a tree mod log operation of type BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING, with a ->logical field pointing to ebX->start. We only have one item in eb X, so we create only one tree mod log operation, and store in the "tm_list" array;
4) Then, still at btrfs_tree_mod_log_insert_root(), we create a tree mod log element of operation type BTRFS_MOD_LOG_ROOT_REPLACE, ->logical set to ebY->start, ->old_root.logical set to ebX->start, ->old_root.level set to the level of eb X and ->generation set to the generation of eb X;
5) Then btrfs_tree_mod_log_insert_root() calls tree_mod_log_free_eb() with "tm_list" as argument. After that, tree_mod_log_free_eb() calls tree_mod_log_insert(). This inserts the mod log operation of type BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING from step 3 into the rbtree with a sequence number of 2 (and fs_info->tree_mod_seq set to 2);
6) Then, after inserting the "tm_list" single element into the tree mod log rbtree, the BTRFS_MOD_LOG_ROOT_REPLACE element is inserted, which gets the sequence number 3 (and fs_info->tree_mod_seq set to 3);
7) Back to ctree.c:balance_level(), we free eb X by calling btrfs_free_tree_block() on it. Because eb X was created in the current transaction, has no other references and writeback did not happen for it, we add it back to the free space cache/tree;
8) Later some other task B allocates the metadata extent from eb X, since it is marked as free space in the space cache/tree, and uses it as a node for some other btree;
9) The tree mod log user task calls btrfs_search_old_slot(), which calls btrfs_get_old_root(), and finally that calls tree_mod_log_oldest_root() with time_seq == 1 and eb_root == eb Y;
10) The first iteration of the while loop finds the tree mod log element with sequence number 3, for the logical address of eb Y and of type BTRFS_MOD_LOG_ROOT_REPLACE;
11) Because the operation type is BTRFS_MOD_LOG_ROOT_REPLACE, we don't
break out of the loop, and set root_logical to point to
tm->old_root.logical, which corresponds to the logical address of
eb X;12) On the next iteration of the while loop, the call to tree_mod_log_search_oldest() returns the smallest tree mod log element for the logical address of eb X, which has a sequence number of 2, an operation type of BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING and corresponds to the old slot 0 of eb X (eb X had only 1 item in it before being freed at step 7);
13) We then break out of the while loop and return the tree mod log operation of type BTRFS_MOD_LOG_ROOT_REPLACE (eb Y), and not the one for slot 0 of eb X, to btrfs_get_old_root();
14) At btrfs_get_old_root(), we process the BTRFS_MOD_LOG_ROOT_REPLACE operation and set "logical" to the logical address of eb X, which was the old root. We then call tree_mod_log_search() passing it the logical address of eb X and time_seq == 1;
15) But before calling tree_mod_log_search(), task B locks eb X, adds a key to eb X, which results in adding a tree mod log operation of type BTRFS_MOD_LOG_KEY_ADD, with a sequence number of 4, to the tree mod log, and increments the number of items in eb X from 0 to 1. Now fs_info->tree_mod_seq has a value of 4;
16) Task A then calls tree_mod_log_search(), which returns the most recent tree mod log operation for eb X, which is the one just added by task B at the previous step, with a sequence number of 4, a type of BTRFS_MOD_LOG_KEY_ADD and for slot 0;
17) Before task A locks and clones eb X, task A adds another key to eb X, which results in adding a new BTRFS_MOD_LOG_KEY_ADD mod log operation, with a sequence number of 5, for slot 1 of eb X, increments the number of items in eb X from 1 to 2, and unlocks eb X.
Now fs_info->tree_mod_seq has a value of 5;
18) Task A then locks eb X and clones it. The clone has a value of 2 for the number of items and the pointer "tm" points to the tree mod log operation with sequence number 4, not the most recent one with a sequence number of 5, so there is mismatch between the number of mod log operations that are going to be applied to the cloned version of eb X and the number of items in the clone;
19) Task A then calls tree_mod_log_rewind() with the clone of eb X, the tree mod log operation with sequence number 4 and a type of BTRFS_MOD_LOG_KEY_ADD, and time_seq == 1;
20) At tree_mod_log_rewind(), we set the local variable "n" with a value of 2, which is the number of items in the clone of eb X.
Then in the first iteration of the while loop, we process the mod log operation with sequence number 4, which is targeted at slot 0 and has a type of BTRFS_MOD_LOG_KEY_ADD. This results in decrementing "n" from 2 to 1.
Then we pick the next tree mod log operation for eb X, which is the tree mod log operation with a sequence number of 2, a type of BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING and for slot 0, it is the one added in step 5 to the tree mod log tree.
We go back to the top of the loop to process this mod log operation, and because its slot is 0 and "n" has a value of 1, we hit the BUG_ON:
(...)
switch (tm->op) {
case BTRFS_MOD_LOG_KEY_REMOVE_WHILE_FREEING:
BUG_ON(tm->slot < n); fallthrough;
(...)
Fix this by checking for a more recent tree mod log operation after locking and cloning the extent buffer of the old root node, and use it as the first operation to apply to the cloned extent buffer when rewinding it.
Stable backport notes: due to moved code and renames, in =< 5.11 the change should be applied to ctree.c:get_old_root.
--- fs/btrfs/ctree.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
fs/btrfs/ctree.c +20 -0
@@ -1406,10 +1406,30 @@ get_old_root(struct btrfs_root *root, u64 time_seq)"failed to read tree block %llu from get_old_root" , logical); }else { +struct tree_mod_elem *tm2; +btrfs_tree_read_lock (old); eb =btrfs_clone_extent_buffer (old); +/* +* After the lookup for the most recent tree mod operation +* above and before we locked and cloned the extent buffer +* 'old', a new tree mod log operation may have been added. +* So lookup for a more recent one to make sure the number +* of mod log operations we replay is consistent with the +* number of items we have in the cloned extent buffer, +* otherwise we can hit a BUG_ON when rewinding the extent +* buffer. +*/ + tm2 =tree_mod_log_search (fs_info, logical, time_seq);btrfs_tree_read_unlock (old);free_extent_buffer (old); +ASSERT (tm2); +ASSERT (tm2 == tm || tm2->seq > tm->seq); +if (!tm2 || tm2->seq < tm->seq) { +free_extent_buffer (eb); +return NULL ; + } + tm = tm2; } }else if (old_root) { eb_root_owner =btrfs_header_owner (eb_root);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 136/184 arm64/vdso: Discard .note.gnu.property sections in vDSO
In reply to Greg Kroah-HartmanFrom: Bill Wendling <[email protected]>
[ Upstream commit 388708028e6937f3fc5fc19aeeb847f8970f489c ]
The arm64 assembler in binutils 2.32 and above generates a program property note in a note section, .note.gnu.property, to encode used x86 ISAs and features. But the kernel linker script only contains a single NOTE segment:
PHDRS
{
text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
note PT_NOTE FLAGS(4); /* PF_R */
}The NOTE segment generated by the vDSO linker script is aligned to 4 bytes. But the .note.gnu.property section must be aligned to 8 bytes on arm64.
$ readelf -n vdso64.so
Displaying notes found in: .note
Owner Data size Description
Linux 0x00000004 Unknown note type: (0x00000000)
description data: 06 00 00 00 readelf: Warning: note with invalid namesz and/or descsz found at offset 0x20
readelf: Warning: type: 0x78, namesize: 0x00000100, descsize: 0x756e694c, alignment: 8
Since the note.gnu.property section in the vDSO is not checked by the dynamic linker, discard the .note.gnu.property sections in the vDSO.
Similar to commit 4caffe6a28d31 ("x86/vdso: Discard .note.gnu.property sections in vDSO"), but for arm64.
--- arch/arm64/kernel/vdso/vdso.lds.S | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm64/kernel/vdso/vdso.lds.S +7 -1
@@ -28,6 +28,13 @@ SECTIONS .gnu.version_d : { *(.gnu.version_d) } .gnu.version_r : { *(.gnu.version_r) } + /* + * Discard .note.gnu.property sections which are unused and have + * different alignment requirement from vDSO note sections. + */ + /DISCARD/ : { + *(.note.GNU-stack .note.gnu.property) + } .note : { *(.note.*) } :text :note . = ALIGN(16);
@@ -48,7 +55,6 @@ SECTIONS PROVIDE(end = .); /DISCARD/ : { - *(.note.GNU-stack) *(.data .data.* .gnu.linkonce.d.* .sdata*) *(.bss .sbss .dynbss .dynsbss) }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 137/184 Makefile: Move -Wno-unused-but-set-variable out of GCC only block
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit 885480b084696331bea61a4f7eba10652999a9c1 upstream.
Currently, -Wunused-but-set-variable is only supported by GCC so it is disabled unconditionally in a GCC only block (it is enabled with W=1). clang currently has its implementation for this warning in review so preemptively move this statement out of the GCC only block and wrap it with cc-disable-warning so that both compilers function the same.
--- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Makefile +4 -4
@@ -765,16 +765,16 @@ KBUILD_CFLAGS += -Wno-tautological-compa KBUILD_CFLAGS += -mno-global-merge else -# These warnings generated too much noise in a regular build. -# Use make W=1 to enable them (see scripts/Makefile.extrawarn) -KBUILD_CFLAGS += -Wno-unused-but-set-variable - # Warn about unmarked fall-throughs in switch statement. # Disabled for clang while comment to attribute conversion happens and # https://github.com/ClangBuiltLinux/linux/issues/636 is discussed. KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,) endif +# These warnings generated too much noise in a regular build. +# Use make W=1 to enable them (see scripts/Makefile.extrawarn) +KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) + KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
Greg Kroah-Hartman
maintainerPATCH 138/184 virtiofs: fix memory leak in virtio_fs_probe()
In reply to Greg Kroah-HartmanFrom: Luis Henriques <[email protected]>
commit c79c5e0178922a9e092ec8fed026750f39dcaef4 upstream.
When accidentally passing twice the same tag to qemu, kmemleak ended up reporting a memory leak in virtiofs. Also, looking at the log I saw the following error (that's when I realised the duplicated tag):
virtiofs: probe of virtio5 failed with error -17
Here's the kmemleak log for reference:
unreferenced object 0xffff888103d47800 (size 1024):
comm "systemd-udevd", pid 118, jiffies 4294893780 (age 18.340s) hex dump (first 32 bytes):
00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00 .....N..........
ff ff ff ff ff ff ff ff 80 90 02 a0 ff ff ff ff ................
backtrace:
[<000000000ebb87c1>] virtio_fs_probe+0x171/0x7ae [virtiofs]
[<00000000f8aca419>] virtio_dev_probe+0x15f/0x210
[<000000004d6baf3c>] really_probe+0xea/0x430
[<00000000a6ceeac8>] device_driver_attach+0xa8/0xb0
[<00000000196f47a7>] __driver_attach+0x98/0x140
[<000000000b20601d>] bus_for_each_dev+0x7b/0xc0
[<00000000399c7b7f>] bus_add_driver+0x11b/0x1f0
[<0000000032b09ba7>] driver_register+0x8f/0xe0
[<00000000cdd55998>] 0xffffffffa002c013
[<000000000ea196a2>] do_one_initcall+0x64/0x2e0
[<0000000008f727ce>] do_init_module+0x5c/0x260
[<000000003cdedab6>] __do_sys_finit_module+0xb5/0x120
[<00000000ad2f48c6>] do_syscall_64+0x33/0x40
[<00000000809526b5>] entry_SYSCALL_64_after_hwframe+0x44/0xae--- fs/fuse/virtio_fs.c | 1 + 1 file changed, 1 insertion(+)
fs/fuse/virtio_fs.c +1 -0
@@ -667,6 +667,7 @@ static int virtio_fs_probe(struct virtio out_vqs: vdev->config->reset (vdev);virtio_fs_cleanup_vqs (vdev, fs); +kfree (fs->vqs); out: vdev->priv =NULL ;
Greg Kroah-Hartman
maintainerPATCH 139/184 ubifs: Only check replay with inode type to judge if inode linked
In reply to Greg Kroah-HartmanFrom: Guochun Mao <[email protected]>
commit 3e903315790baf4a966436e7f32e9c97864570ac upstream.
Conside the following case, it just write a big file into flash, when complete writing, delete the file, and then power off promptly. Next time power on, we'll get a replay list like:
...
LEB 1105:211344 len 4144 deletion 0 sqnum 428783 key type 1 inode 80 LEB 15:233544 len 160 deletion 1 sqnum 428785 key type 0 inode 80 LEB 1105:215488 len 4144 deletion 0 sqnum 428787 key type 1 inode 80
...
In the replay list, data nodes' deletion are 0, and the inode node's deletion is 1. In current logic, the file's dentry will be removed, but inode and the flash space it occupied will be reserved. User will see that much free space been disappeared.
We only need to check the deletion value of the following inode type node of the replay entry.
--- fs/ubifs/replay.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ubifs/replay.c +2 -1
@@ -223,7 +223,8 @@ static bool inode_still_linked(struct ub*/ list_for_each_entry_reverse (r, &c->replay_list, list) {ubifs_assert (c, r->sqnum >= rino->sqnum); -if (key_inum (c, &r->key) ==key_inum (c, &rino->key)) +if (key_inum (c, &r->key) ==key_inum (c, &rino->key) && +key_type (c, &r->key) ==UBIFS_INO_KEY )return r->deletion ==0 ; }
Greg Kroah-Hartman
maintainerPATCH 140/184 f2fs: fix to avoid out-of-bounds memory access
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit b862676e371715456c9dade7990c8004996d0d9e upstream.
butt3rflyh4ck <[email protected]> reported a bug found by syzkaller fuzzer with custom modifications in 5.12.0-rc3+ [1]:
dump_stack+0xfa/0x151 lib/dump_stack.c:120 print_address_description.constprop.0.cold+0x82/0x32c mm/kasan/report.c:232 __kasan_report mm/kasan/report.c:399 [inline] kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:416 f2fs_test_bit fs/f2fs/f2fs.h:2572 [inline] current_nat_addr fs/f2fs/node.h:213 [inline] get_next_nat_page fs/f2fs/node.c:123 [inline] __flush_nat_entry_set fs/f2fs/node.c:2888 [inline] f2fs_flush_nat_entries+0x258e/0x2960 fs/f2fs/node.c:2991 f2fs_write_checkpoint+0x1372/0x6a70 fs/f2fs/checkpoint.c:1640 f2fs_issue_checkpoint+0x149/0x410 fs/f2fs/checkpoint.c:1807 f2fs_sync_fs+0x20f/0x420 fs/f2fs/super.c:1454 __sync_filesystem fs/sync.c:39 [inline] sync_filesystem fs/sync.c:67 [inline] sync_filesystem+0x1b5/0x260 fs/sync.c:48 generic_shutdown_super+0x70/0x370 fs/super.c:448 kill_block_super+0x97/0xf0 fs/super.c:1394
The root cause is, if nat entry in checkpoint journal area is corrupted, e.g. nid of journalled nat entry exceeds max nid value, during checkpoint, once it tries to flush nat journal to NAT area, get_next_nat_page() may access out-of-bounds memory on nat_bitmap due to it uses wrong nid value as bitmap offset.
[1] https://lore.kernel.org/lkml/CAFcO6XOMWdr8pObek6eN6-fs58KG9doRFadgJj-FnF-1x43s2g@mail.gmail.com/T/#u
--- fs/f2fs/node.c | 3 +++ 1 file changed, 3 insertions(+)
fs/f2fs/node.c +3 -0
@@ -2718,6 +2718,9 @@ static void remove_nats_in_journal(strucstruct f2fs_nat_entry raw_ne;nid_t nid =le32_to_cpu (nid_in_journal (journal, i)); +if (f2fs_check_nid_range (sbi, nid)) +continue ; + raw_ne =nat_in_journal (journal, i); ne =__lookup_nat_cache (nm_i, nid);
Greg Kroah-Hartman
maintainerPATCH 141/184 mlxsw: spectrum_mr: Update egress RIF list before routes action
In reply to Greg Kroah-HartmanFrom: Ido Schimmel <[email protected]>
commit cbaf3f6af9c268caf558c8e7ec52bcb35c5455dd upstream.
Each multicast route that is forwarding packets (as opposed to trapping them) points to a list of egress router interfaces (RIFs) through which packets are replicated.
A route's action can transition from trap to forward when a RIF is created for one of the route's egress virtual interfaces (eVIF). When this happens, the route's action is first updated and only later the list of egress RIFs is committed to the device.
This results in the route pointing to an invalid list. In case the list pointer is out of range (due to uninitialized memory), the device will complain:
mlxsw_spectrum2 0000:06:00.0: EMAD reg access failed (tid=5733bf490000905c,reg_id=300f(pefa),type=write,status=7(bad parameter))
Fix this by first committing the list of egress RIFs to the device and only later update the route's action.
Note that a fix is not needed in the reverse function (i.e., mlxsw_sp_mr_route_evif_unresolve()), as there the route's action is first updated and only later the RIF is removed from the list.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c +15 -15
@@ -524,6 +524,16 @@ mlxsw_sp_mr_route_evif_resolve(struct mlu16 erif_index =0 ;int err; +/* Add the eRIF */ +if (mlxsw_sp_mr_vif_valid (rve->mr_vif)) { + erif_index =mlxsw_sp_rif_index (rve->mr_vif->rif); + err = mr->mr_ops->route_erif_add (mlxsw_sp, + rve->mr_route->route_priv, + erif_index); +if (err) +return err; + } +/* Update the route action, as the new eVIF can be a tunnel or a pimreg * device which will require updating the action. */
@@ -533,17 +543,7 @@ mlxsw_sp_mr_route_evif_resolve(struct ml rve->mr_route->route_priv, route_action);if (err) -return err; - } - -/* Add the eRIF */ -if (mlxsw_sp_mr_vif_valid (rve->mr_vif)) { - erif_index =mlxsw_sp_rif_index (rve->mr_vif->rif); - err = mr->mr_ops->route_erif_add (mlxsw_sp, - rve->mr_route->route_priv, - erif_index); -if (err) - goto err_route_erif_add; + goto err_route_action_update; }/* Update the minimum MTU */
@@ -561,14 +561,14 @@ mlxsw_sp_mr_route_evif_resolve(struct mlreturn 0 ; err_route_min_mtu_update: -if (mlxsw_sp_mr_vif_valid (rve->mr_vif)) - mr->mr_ops->route_erif_del (mlxsw_sp, rve->mr_route->route_priv, - erif_index); -err_route_erif_add:if (route_action != rve->mr_route->route_action) mr->mr_ops->route_action_update (mlxsw_sp, rve->mr_route->route_priv, rve->mr_route->route_action); +err_route_action_update: +if (mlxsw_sp_mr_vif_valid (rve->mr_vif)) + mr->mr_ops->route_erif_del (mlxsw_sp, rve->mr_route->route_priv, + erif_index);return err; }
Greg Kroah-Hartman
maintainerPATCH 142/184 openvswitch: fix stack OOB read while fragmenting IPv4 packets
In reply to Greg Kroah-HartmanFrom: Davide Caratti <[email protected]>
commit 7c0ea5930c1c211931819d83cfb157bff1539a4c upstream.
running openvswitch on kernels built with KASAN, it's possible to see the following splat while testing fragmentation of IPv4 packets:
BUG: KASAN: stack-out-of-bounds in ip_do_fragment+0x1b03/0x1f60 Read of size 1 at addr ffff888112fc713c by task handler2/1367 CPU: 0 PID: 1367 Comm: handler2 Not tainted 5.12.0-rc6+ #418 Hardware name: Red Hat KVM, BIOS 1.11.1-4.module+el8.1.0+4066+0f1aadab 04/01/2014 Call Trace: dump_stack+0x92/0xc1 print_address_description.constprop.7+0x1a/0x150 kasan_report.cold.13+0x7f/0x111 ip_do_fragment+0x1b03/0x1f60 ovs_fragment+0x5bf/0x840 [openvswitch] do_execute_actions+0x1bd5/0x2400 [openvswitch] ovs_execute_actions+0xc8/0x3d0 [openvswitch] ovs_packet_cmd_execute+0xa39/0x1150 [openvswitch] genl_family_rcv_msg_doit.isra.15+0x227/0x2d0 genl_rcv_msg+0x287/0x490 netlink_rcv_skb+0x120/0x380 genl_rcv+0x24/0x40 netlink_unicast+0x439/0x630 netlink_sendmsg+0x719/0xbf0 sock_sendmsg+0xe2/0x110 ____sys_sendmsg+0x5ba/0x890 ___sys_sendmsg+0xe9/0x160 __sys_sendmsg+0xd3/0x170 do_syscall_64+0x33/0x40 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f957079db07 Code: c3 66 90 41 54 41 89 d4 55 48 89 f5 53 89 fb 48 83 ec 10 e8 eb ec ff ff 44 89 e2 48 89 ee 89 df 41 89 c0 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 48 89 44 24 08 e8 24 ed ff ff 48 RSP: 002b:00007f956ce35a50 EFLAGS: 00000293 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000000000019 RCX: 00007f957079db07 RDX: 0000000000000000 RSI: 00007f956ce35ae0 RDI: 0000000000000019 RBP: 00007f956ce35ae0 R08: 0000000000000000 R09: 00007f9558006730 R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000 R13: 00007f956ce37308 R14: 00007f956ce35f80 R15: 00007f956ce35ae0 The buggy address belongs to the page: page:00000000af2a1d93 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x112fc7 flags: 0x17ffffc0000000() raw: 0017ffffc0000000 0000000000000000 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected
addr ffff888112fc713c is located in stack of task handler2/1367 at offset 180 in frame:
ovs_fragment+0x0/0x840 [openvswitch]
this frame has 2 objects:
[32, 144) 'ovs_dst'
[192, 424) 'ovs_rt'
Memory state around the buggy address:
ffff888112fc7000: f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888112fc7080: 00 f1 f1 f1 f1 00 00 00 00 00 00 00 00 00 00 00
>ffff888112fc7100: 00 00 00 f2 f2 f2 f2 f2 f2 00 00 00 00 00 00 00
^
ffff888112fc7180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888112fc7200: 00 00 00 00 00 00 f2 f2 f2 00 00 00 00 00 00 00for IPv4 packets, ovs_fragment() uses a temporary struct dst_entry. Then, in the following call graph:
ip_do_fragment()
ip_skb_dst_mtu()
ip_dst_mtu_maybe_forward()
ip_mtu_locked()the pointer to struct dst_entry is used as pointer to struct rtable: this turns the access to struct members like rt_mtu_locked into an OOB read in the stack. Fix this changing the temporary variable used for IPv4 packets in ovs_fragment(), similarly to what is done for IPv6 few lines below.
--- net/openvswitch/actions.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/openvswitch/actions.c +4 -4
@@ -831,17 +831,17 @@ static void ovs_fragment(struct net *net }if (key->eth.type ==htons (ETH_P_IP )) { -struct dst_entry ovs_dst; +struct rtable ovs_rt = {0 };unsigned long orig_dst;prepare_frag (vport, skb, orig_network_offset,ovs_key_mac_proto (key)); -dst_init (&ovs_dst, &ovs_dst_ops,NULL ,1 , +dst_init (&ovs_rt.dst, &ovs_dst_ops,NULL ,1 ,DST_OBSOLETE_NONE ,DST_NOCOUNT ); - ovs_dst.dev = vport->dev; + ovs_rt.dst.dev = vport->dev; orig_dst = skb->_skb_refdst; -skb_dst_set_noref (skb, &ovs_dst); +skb_dst_set_noref (skb, &ovs_rt.dst);IPCB (skb)->frag_max_size = mru;ip_do_fragment (net, skb->sk, skb, ovs_vport_output);
Greg Kroah-Hartman
maintainerPATCH 143/184 ACPI: GTDT: Dont corrupt interrupt mappings on watchdow probe failure
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit 1ecd5b129252249b9bc03d7645a7bda512747277 upstream.
When failing the driver probe because of invalid firmware properties, the GTDT driver unmaps the interrupt that it mapped earlier.
However, it never checks whether the mapping of the interrupt actially succeeded. Even more, should the firmware report an illegal interrupt number that overlaps with the GIC SGI range, this can result in an IPI being unmapped, and subsequent fireworks (as reported by Dann Frazier).
Rework the driver to have a slightly saner behaviour and actually check whether the interrupt has been mapped before unmapping things.
--- drivers/acpi/arm64/gtdt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/acpi/arm64/gtdt.c +6 -4
@@ -329,7 +329,7 @@ static int __init gtdt_import_sbsa_gwdt( int index) {struct platform_device *pdev; -int irq =map_gt_gsi (wd->timer_interrupt, wd->timer_flags); +int irq;/* * According to SBSA specification the size of refresh and control
@@ -338,7 +338,7 @@ static int __init gtdt_import_sbsa_gwdt(struct resource res[] = {DEFINE_RES_MEM (wd->control_frame_address,SZ_4K ),DEFINE_RES_MEM (wd->refresh_frame_address,SZ_4K ), -DEFINE_RES_IRQ (irq), + {}, };int nr_res =ARRAY_SIZE (res);
@@ -348,10 +348,11 @@ static int __init gtdt_import_sbsa_gwdt(if (!(wd->refresh_frame_address && wd->control_frame_address)) {pr_err (FW_BUG "failed to get the Watchdog base address.\n" ); -acpi_unregister_gsi (wd->timer_interrupt);return -EINVAL ; } + irq =map_gt_gsi (wd->timer_interrupt, wd->timer_flags); + res[2 ] = (struct resource )DEFINE_RES_IRQ (irq);if (irq <=0 ) {pr_warn ("failed to map the Watchdog interrupt.\n" ); nr_res--;
@@ -364,7 +365,8 @@ static int __init gtdt_import_sbsa_gwdt(*/ pdev =platform_device_register_simple ("sbsa-gwdt" , index, res, nr_res);if (IS_ERR (pdev)) { -acpi_unregister_gsi (wd->timer_interrupt); +if (irq >0 ) +acpi_unregister_gsi (wd->timer_interrupt);return PTR_ERR (pdev); }
Greg Kroah-Hartman
maintainerPATCH 144/184 NFS: Dont discard pNFS layout segments that are marked for return
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit 39fd01863616964f009599e50ca5c6ea9ebf88d6 upstream.
If the pNFS layout segment is marked with the NFS_LSEG_LAYOUTRETURN flag, then the assumption is that it has some reporting requirement to perform through a layoutreturn (e.g. flexfiles layout stats or error information).
--- fs/nfs/pnfs.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/nfs/pnfs.c +5 -0
@@ -2427,6 +2427,9 @@ pnfs_mark_matching_lsegs_return(struct passert_spin_locked (&lo->plh_inode->i_lock); +if (test_bit (NFS_LAYOUT_RETURN_REQUESTED , &lo->plh_flags)) + tmp_list = &lo->plh_return_segs; +list_for_each_entry_safe (lseg, next, &lo->plh_segs, pls_list)if (pnfs_match_lseg_recall (lseg, return_range, seq)) { dprintk("%s: marking lseg %p iomode %d "
@@ -2434,6 +2437,8 @@ pnfs_mark_matching_lsegs_return(struct p lseg, lseg->pls_range.iomode, lseg->pls_range.offset, lseg->pls_range.length); +if (test_bit (NFS_LSEG_LAYOUTRETURN , &lseg->pls_flags)) + tmp_list = &lo->plh_return_segs;if (mark_lseg_invalid (lseg, tmp_list))continue ; remaining++;
Greg Kroah-Hartman
maintainerPATCH 145/184 NFSv4: Dont discard segments marked for return in _pnfs_return_layout()
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit de144ff4234f935bd2150108019b5d87a90a8a96 upstream.
If the pNFS layout segment is marked with the NFS_LSEG_LAYOUTRETURN flag, then the assumption is that it has some reporting requirement to perform through a layoutreturn (e.g. flexfiles layout stats or error information).
--- fs/nfs/pnfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/pnfs.c +1 -1
@@ -1311,7 +1311,7 @@ _pnfs_return_layout(struct inode *ino) } valid_layout =pnfs_layout_is_valid (lo);pnfs_clear_layoutcommit (ino, &tmp_list); -pnfs_mark_matching_lsegs_invalid (lo, &tmp_list,NULL ,0 ); +pnfs_mark_matching_lsegs_return (lo, &tmp_list,NULL ,0 );if (NFS_SERVER (ino)->pnfs_curr_ld->return_range) {struct pnfs_layout_range range = {
Greg Kroah-Hartman
maintainerPATCH 146/184 Input: ili210x - add missing negation for touch indication on ili210x
In reply to Greg Kroah-HartmanFrom: Hansem Ro <[email protected]>
commit ac05a8a927e5a1027592d8f98510a511dadeed14 upstream.
This adds the negation needed for proper finger detection on Ilitek ili2107/ili210x. This fixes polling issues (on Amazon Kindle Fire) caused by returning false for the cooresponding finger on the touchscreen.
--- drivers/input/touchscreen/ili210x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/ili210x.c +1 -1
@@ -109,7 +109,7 @@ static bool ili210x_touchdata_to_coords(if (finger >=ILI210X_TOUCHES )return false; -if (touchdata[0 ] &BIT (finger)) +if (!(touchdata[0 ] &BIT (finger)))return false; *x =get_unaligned_be16 (touchdata +1 + (finger *4 ) +0 );
Greg Kroah-Hartman
maintainerPATCH 147/184 jffs2: Fix kasan slab-out-of-bounds problem
In reply to Greg Kroah-HartmanFrom: lizhe <[email protected]>
commit 960b9a8a7676b9054d8b46a2c7db52a0c8766b56 upstream.
KASAN report a slab-out-of-bounds problem. The logs are listed below. It is because in function jffs2_scan_dirent_node, we alloc "checkedlen+1" bytes for fd->name and we check crc with length rd->nsize. If checkedlen is less than rd->nsize, it will cause the slab-out-of-bounds problem.
jffs2: Dirent at *** has zeroes in name. Truncating to %d char
==================================================================
BUG: KASAN: slab-out-of-bounds in crc32_le+0x1ce/0x260 at addr ffff8800842cf2d1
Read of size 1 by task test_JFFS2/915
=============================================================================
BUG kmalloc-64 (Tainted: G B O ): kasan: bad access detected
-----------------------------------------------------------------------------
INFO: Allocated in jffs2_alloc_full_dirent+0x2a/0x40 age=0 cpu=1 pid=915
___slab_alloc+0x580/0x5f0
__slab_alloc.isra.24+0x4e/0x64
__kmalloc+0x170/0x300
jffs2_alloc_full_dirent+0x2a/0x40
jffs2_scan_eraseblock+0x1ca4/0x3b64
jffs2_scan_medium+0x285/0xfe0
jffs2_do_mount_fs+0x5fb/0x1bbc
jffs2_do_fill_super+0x245/0x6f0
jffs2_fill_super+0x287/0x2e0
mount_mtd_aux.isra.0+0x9a/0x144
mount_mtd+0x222/0x2f0
jffs2_mount+0x41/0x60
mount_fs+0x63/0x230
vfs_kern_mount.part.6+0x6c/0x1f4
do_mount+0xae8/0x1940
SyS_mount+0x105/0x1d0
INFO: Freed in jffs2_free_full_dirent+0x22/0x40 age=27 cpu=1 pid=915
__slab_free+0x372/0x4e4
kfree+0x1d4/0x20c
jffs2_free_full_dirent+0x22/0x40
jffs2_build_remove_unlinked_inode+0x17a/0x1e4
jffs2_do_mount_fs+0x1646/0x1bbc
jffs2_do_fill_super+0x245/0x6f0
jffs2_fill_super+0x287/0x2e0
mount_mtd_aux.isra.0+0x9a/0x144
mount_mtd+0x222/0x2f0
jffs2_mount+0x41/0x60
mount_fs+0x63/0x230
vfs_kern_mount.part.6+0x6c/0x1f4
do_mount+0xae8/0x1940
SyS_mount+0x105/0x1d0
entry_SYSCALL_64_fastpath+0x1e/0x97
Call Trace:
[<ffffffff815befef>] dump_stack+0x59/0x7e
[<ffffffff812d1d65>] print_trailer+0x125/0x1b0
[<ffffffff812d82c8>] object_err+0x34/0x40
[<ffffffff812dadef>] kasan_report.part.1+0x21f/0x534
[<ffffffff81132401>] ? vprintk+0x2d/0x40
[<ffffffff815f1ee2>] ? crc32_le+0x1ce/0x260
[<ffffffff812db41a>] kasan_report+0x26/0x30
[<ffffffff812d9fc1>] __asan_load1+0x3d/0x50
[<ffffffff815f1ee2>] crc32_le+0x1ce/0x260
[<ffffffff814764ae>] ? jffs2_alloc_full_dirent+0x2a/0x40
[<ffffffff81485cec>] jffs2_scan_eraseblock+0x1d0c/0x3b64
[<ffffffff81488813>] ? jffs2_scan_medium+0xccf/0xfe0
[<ffffffff81483fe0>] ? jffs2_scan_make_ino_cache+0x14c/0x14c
[<ffffffff812da3e9>] ? kasan_unpoison_shadow+0x35/0x50
[<ffffffff812da3e9>] ? kasan_unpoison_shadow+0x35/0x50
[<ffffffff812da462>] ? kasan_kmalloc+0x5e/0x70
[<ffffffff812d5d90>] ? kmem_cache_alloc_trace+0x10c/0x2cc
[<ffffffff818169fb>] ? mtd_point+0xf7/0x130
[<ffffffff81487dc9>] jffs2_scan_medium+0x285/0xfe0
[<ffffffff81487b44>] ? jffs2_scan_eraseblock+0x3b64/0x3b64
[<ffffffff812da3e9>] ? kasan_unpoison_shadow+0x35/0x50
[<ffffffff812da3e9>] ? kasan_unpoison_shadow+0x35/0x50
[<ffffffff812da462>] ? kasan_kmalloc+0x5e/0x70
[<ffffffff812d57df>] ? __kmalloc+0x12b/0x300
[<ffffffff812da462>] ? kasan_kmalloc+0x5e/0x70
[<ffffffff814a2753>] ? jffs2_sum_init+0x9f/0x240
[<ffffffff8148b2ff>] jffs2_do_mount_fs+0x5fb/0x1bbc
[<ffffffff8148ad04>] ? jffs2_del_noinode_dirent+0x640/0x640
[<ffffffff812da462>] ? kasan_kmalloc+0x5e/0x70
[<ffffffff81127c5b>] ? __init_rwsem+0x97/0xac
[<ffffffff81492349>] jffs2_do_fill_super+0x245/0x6f0
[<ffffffff81493c5b>] jffs2_fill_super+0x287/0x2e0
[<ffffffff814939d4>] ? jffs2_parse_options+0x594/0x594
[<ffffffff81819bea>] mount_mtd_aux.isra.0+0x9a/0x144
[<ffffffff81819eb6>] mount_mtd+0x222/0x2f0
[<ffffffff814939d4>] ? jffs2_parse_options+0x594/0x594
[<ffffffff81819c94>] ? mount_mtd_aux.isra.0+0x144/0x144
[<ffffffff81258757>] ? free_pages+0x13/0x1c
[<ffffffff814fa0ac>] ? selinux_sb_copy_data+0x278/0x2e0
[<ffffffff81492b35>] jffs2_mount+0x41/0x60
[<ffffffff81302fb7>] mount_fs+0x63/0x230
[<ffffffff8133755f>] ? alloc_vfsmnt+0x32f/0x3b0
[<ffffffff81337f2c>] vfs_kern_mount.part.6+0x6c/0x1f4
[<ffffffff8133ceec>] do_mount+0xae8/0x1940
[<ffffffff811b94e0>] ? audit_filter_rules.constprop.6+0x1d10/0x1d10
[<ffffffff8133c404>] ? copy_mount_string+0x40/0x40
[<ffffffff812cbf78>] ? alloc_pages_current+0xa4/0x1bc
[<ffffffff81253a89>] ? __get_free_pages+0x25/0x50
[<ffffffff81338993>] ? copy_mount_options.part.17+0x183/0x264
[<ffffffff8133e3a9>] SyS_mount+0x105/0x1d0
[<ffffffff8133e2a4>] ? copy_mnt_ns+0x560/0x560
[<ffffffff810e8391>] ? msa_space_switch_handler+0x13d/0x190
[<ffffffff81be184a>] entry_SYSCALL_64_fastpath+0x1e/0x97
[<ffffffff810e9274>] ? msa_space_switch+0xb0/0xe0
Memory state around the buggy address:
ffff8800842cf180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8800842cf200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8800842cf280: fc fc fc fc fc fc 00 00 00 00 01 fc fc fc fc fc
^
ffff8800842cf300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8800842cf380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================--- fs/jffs2/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jffs2/scan.c +1 -1
@@ -1078,7 +1078,7 @@ static int jffs2_scan_dirent_node(structmemcpy (&fd->name, rd->name, checkedlen); fd->name[checkedlen] =0 ; - crc =crc32 (0 , fd->name, rd->nsize); + crc =crc32 (0 , fd->name, checkedlen);if (crc !=je32_to_cpu (rd->name_crc)) {pr_notice ("%s(): Name CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n" , __func__, ofs,je32_to_cpu (rd->name_crc), crc);
Greg Kroah-Hartman
maintainerPATCH 148/184 powerpc/eeh: Fix EEH handling for hugepages in ioremap space.
In reply to Greg Kroah-HartmanFrom: Mahesh Salgaonkar <[email protected]>
commit 5ae5bc12d0728db60a0aa9b62160ffc038875f1a upstream.
During the EEH MMIO error checking, the current implementation fails to map the (virtual) MMIO address back to the pci device on radix with hugepage mappings for I/O. This results into failure to dispatch EEH event with no recovery even when EEH capability has been enabled on the device.
eeh_check_failure(token) # token = virtual MMIO address
addr = eeh_token_to_phys(token);
edev = eeh_addr_cache_get_dev(addr);
if (!edev)
return 0;
eeh_dev_check_failure(edev); <= Dispatch the EEH event
In case of hugepage mappings, eeh_token_to_phys() has a bug in virt -> phys translation that results in wrong physical address, which is then passed to eeh_addr_cache_get_dev() to match it against cached pci I/O address ranges to get to a PCI device. Hence, it fails to find a match and the EEH event never gets dispatched leaving the device in failed state.
The commit 33439620680be ("powerpc/eeh: Handle hugepages in ioremap space") introduced following logic to translate virt to phys for hugepage mappings:
eeh_token_to_phys():
+ pa = pte_pfn(*ptep);
+
+ /* On radix we can do hugepage mappings for io, so handle that */
+ if (hugepage_shift) {
+ pa <<= hugepage_shift; <= This is wrong
+ pa |= token & ((1ul << hugepage_shift) - 1);
+ }
This patch fixes the virt -> phys translation in eeh_token_to_phys() function.
$ cat /sys/kernel/debug/powerpc/eeh_address_cache mem addr range [0x0000040080000000-0x00000400807fffff]: 0030:01:00.1 mem addr range [0x0000040080800000-0x0000040080ffffff]: 0030:01:00.1 mem addr range [0x0000040081000000-0x00000400817fffff]: 0030:01:00.0 mem addr range [0x0000040081800000-0x0000040081ffffff]: 0030:01:00.0 mem addr range [0x0000040082000000-0x000004008207ffff]: 0030:01:00.1 mem addr range [0x0000040082080000-0x00000400820fffff]: 0030:01:00.0 mem addr range [0x0000040082100000-0x000004008210ffff]: 0030:01:00.1 mem addr range [0x0000040082110000-0x000004008211ffff]: 0030:01:00.0
Above is the list of cached io address ranges of pci 0030:01:00.<fn>.
Before this patch:
Tracing 'arg1' of function eeh_addr_cache_get_dev() during error injection clearly shows that 'addr=' contains wrong physical address:
kworker/u16:0-7 [001] .... 108.883775: eeh_addr_cache_get_dev:
(eeh_addr_cache_get_dev+0xc/0xf0) addr=0x80103000a510
dmesg shows no EEH recovery messages:
[ 108.563768] bnx2x: [bnx2x_timer:5801(eth2)]MFW seems hanged: drv_pulse (0x9ae) != mcp_pulse (0x7fff) [ 108.563788] bnx2x: [bnx2x_hw_stats_update:870(eth2)]NIG timer max (4294967295) [ 108.883788] bnx2x: [bnx2x_acquire_hw_lock:2013(eth1)]lock_status 0xffffffff resource_bit 0x1 [ 108.884407] bnx2x 0030:01:00.0 eth1: MDC/MDIO access timeout [ 108.884976] bnx2x 0030:01:00.0 eth1: MDC/MDIO access timeout <..>
After this patch:
eeh_addr_cache_get_dev() trace shows correct physical address:
<idle>-0 [001] ..s. 1043.123828: eeh_addr_cache_get_dev:
(eeh_addr_cache_get_dev+0xc/0xf0) addr=0x40080bc7cd8
dmesg logs shows EEH recovery getting triggerred:
[ 964.323980] bnx2x: [bnx2x_timer:5801(eth2)]MFW seems hanged: drv_pulse (0x746f) != mcp_pulse (0x7fff) [ 964.323991] EEH: Recovering PHB#30-PE#10000 [ 964.324002] EEH: PE location: N/A, PHB location: N/A [ 964.324006] EEH: Frozen PHB#30-PE#10000 detected <..>
--- arch/powerpc/kernel/eeh.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
arch/powerpc/kernel/eeh.c +4 -7
@@ -368,14 +368,11 @@ static inline unsigned long eeh_token_to pa =pte_pfn (*ptep);/* On radix we can do hugepage mappings for io, so handle that */ -if (hugepage_shift) { - pa <<= hugepage_shift; - pa |= token & ((1ul << hugepage_shift) -1 ); - }else { - pa <<=PAGE_SHIFT ; - pa |= token & (PAGE_SIZE -1 ); - } +if (!hugepage_shift) + hugepage_shift =PAGE_SHIFT ; + pa <<=PAGE_SHIFT ; + pa |= token & ((1ul << hugepage_shift) -1 );return pa; }
Greg Kroah-Hartman
maintainerPATCH 149/184 powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h
In reply to Greg Kroah-HartmanFrom: Tony Ambardar <[email protected]>
commit 7de21e679e6a789f3729e8402bc440b623a28eae upstream.
A few archs like powerpc have different errno.h values for macros EDEADLOCK and EDEADLK. In code including both libc and linux versions of errno.h, this can result in multiple definitions of EDEADLOCK in the include chain. Definitions to the same value (e.g. seen with mips) do not raise warnings, but on powerpc there are redefinitions changing the value, which raise warnings and errors (if using "-Werror").
Guard against these redefinitions to avoid build errors like the following, first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with musl 1.1.24:
In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5,
from ../../include/linux/err.h:8,
from libbpf.c:29: ../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror]
#define EDEADLOCK EDEADLK
In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10,
from libbpf.c:26:
toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition
#define EDEADLOCK 58
cc1: all warnings being treated as errors
--- arch/powerpc/include/uapi/asm/errno.h | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/include/uapi/asm/errno.h +1 -0
@@ -2,6 +2,7 @@#ifndef _ASM_POWERPC_ERRNO_H#define _ASM_POWERPC_ERRNO_H +#undef EDEADLOCK#include <asm-generic/errno.h> #undef EDEADLOCK
Greg Kroah-Hartman
maintainerPATCH 150/184 intel_th: pci: Add Alder Lake-M support
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
commit 48cb17531b15967d9d3f34c770a25cc6c4ca6ad1 upstream.
This adds support for the Trace Hub in Alder Lake-M PCH.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -269,6 +269,11 @@ static const struct pci_device_id intel_ .driver_data = (kernel_ulong_t)&intel_th_2x, }, { +/* Alder Lake-M */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x54a6), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + {/* Rocket Lake CPU */ PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x4c19 ), .driver_data = (kernel_ulong_t)&intel_th_2x,
Greg Kroah-Hartman
maintainerPATCH 151/184 tpm: efi: Use local variable for calculating final log size
In reply to Greg Kroah-HartmanFrom: Stefan Berger <[email protected]>
commit 48cff270b037022e37835d93361646205ca25101 upstream.
When tpm_read_log_efi is called multiple times, which happens when one loads and unloads a TPM2 driver multiple times, then the global variable efi_tpm_final_log_size will at some point become a negative number due to the subtraction of final_events_preboot_size occurring each time. Use a local variable to avoid this integer underflow.
The following issue is now resolved:
Mar 8 15:35:12 hibinst kernel: Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 Mar 8 15:35:12 hibinst kernel: Workqueue: tpm-vtpm vtpm_proxy_work [tpm_vtpm_proxy] Mar 8 15:35:12 hibinst kernel: RIP: 0010:__memcpy+0x12/0x20 Mar 8 15:35:12 hibinst kernel: Code: 00 b8 01 00 00 00 85 d2 74 0a c7 05 44 7b ef 00 0f 00 00 00 c3 cc cc cc 66 66 90 66 90 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 <f3> 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 f3 a4 Mar 8 15:35:12 hibinst kernel: RSP: 0018:ffff9ac4c0fcfde0 EFLAGS: 00010206 Mar 8 15:35:12 hibinst kernel: RAX: ffff88f878cefed5 RBX: ffff88f878ce9000 RCX: 1ffffffffffffe0f Mar 8 15:35:12 hibinst kernel: RDX: 0000000000000003 RSI: ffff9ac4c003bff9 RDI: ffff88f878cf0e4d Mar 8 15:35:12 hibinst kernel: RBP: ffff9ac4c003b000 R08: 0000000000001000 R09: 000000007e9d6073 Mar 8 15:35:12 hibinst kernel: R10: ffff9ac4c003b000 R11: ffff88f879ad3500 R12: 0000000000000ed5 Mar 8 15:35:12 hibinst kernel: R13: ffff88f878ce9760 R14: 0000000000000002 R15: ffff88f77de7f018 Mar 8 15:35:12 hibinst kernel: FS: 0000000000000000(0000) GS:ffff88f87bd00000(0000) knlGS:0000000000000000 Mar 8 15:35:12 hibinst kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Mar 8 15:35:12 hibinst kernel: CR2: ffff9ac4c003c000 CR3: 00000001785a6004 CR4: 0000000000060ee0 Mar 8 15:35:12 hibinst kernel: Call Trace: Mar 8 15:35:12 hibinst kernel: tpm_read_log_efi+0x152/0x1a7 Mar 8 15:35:12 hibinst kernel: tpm_bios_log_setup+0xc8/0x1c0 Mar 8 15:35:12 hibinst kernel: tpm_chip_register+0x8f/0x260 Mar 8 15:35:12 hibinst kernel: vtpm_proxy_work+0x16/0x60 [tpm_vtpm_proxy] Mar 8 15:35:12 hibinst kernel: process_one_work+0x1b4/0x370 Mar 8 15:35:12 hibinst kernel: worker_thread+0x53/0x3e0 Mar 8 15:35:12 hibinst kernel: ? process_one_work+0x370/0x370
--- drivers/char/tpm/eventlog/efi.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
drivers/char/tpm/eventlog/efi.c +21 -8
@@ -17,6 +17,7 @@ int tpm_read_log_efi(struct tpm_chip *ch {struct efi_tcg2_final_events_table *final_tbl =NULL ; +int final_events_log_size = efi_tpm_final_log_size;struct linux_efi_tpm_eventlog *log_tbl;struct tpm_bios_log *log;u32 log_size;
@@ -66,12 +67,12 @@ int tpm_read_log_efi(struct tpm_chip *ch ret = tpm_log_version;if (efi.tpm_final_log ==EFI_INVALID_TABLE_ADDR || - efi_tpm_final_log_size ==0 || + final_events_log_size ==0 || tpm_log_version !=EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 ) goto out; final_tbl =memremap (efi.tpm_final_log, -sizeof (*final_tbl) + efi_tpm_final_log_size, +sizeof (*final_tbl) + final_events_log_size,MEMREMAP_WB );if (!final_tbl) {pr_err ("Could not map UEFI TPM final log\n" );
@@ -80,10 +81,18 @@ int tpm_read_log_efi(struct tpm_chip *ch goto out; } - efi_tpm_final_log_size -= log_tbl->final_events_preboot_size; +/* +* The 'final events log' size excludes the 'final events preboot log' +* at its beginning. +*/ + final_events_log_size -= log_tbl->final_events_preboot_size; +/* +* Allocate memory for the 'combined log' where we will append the +* 'final events log' to. +*/ tmp =krealloc (log->bios_event_log, - log_size + efi_tpm_final_log_size, + log_size + final_events_log_size,GFP_KERNEL );if (!tmp) {kfree (log->bios_event_log);
@@ -94,15 +103,19 @@ int tpm_read_log_efi(struct tpm_chip *ch log->bios_event_log = tmp;/* -* Copy any of the final events log that didn't also end up in the -* main log. Events can be logged in both if events are generated +* Append any of the 'final events log' that didn't also end up in the +* 'main log'. Events can be logged in both if events are generated * between GetEventLog() and ExitBootServices(). */ memcpy ((void *)log->bios_event_log + log_size, final_tbl->events + log_tbl->final_events_preboot_size, - efi_tpm_final_log_size); + final_events_log_size); +/* +* The size of the 'combined log' is the size of the 'main log' plus +* the size of the 'final events log'. +*/ log->bios_event_log_end = log->bios_event_log + - log_size + efi_tpm_final_log_size; + log_size + final_events_log_size; out:memunmap (final_tbl);
Greg Kroah-Hartman
maintainerPATCH 152/184 tpm: vtpm_proxy: Avoid reading host log when using a virtual device
In reply to Greg Kroah-HartmanFrom: Stefan Berger <[email protected]>
commit 9716ac65efc8f780549b03bddf41e60c445d4709 upstream.
Avoid allocating memory and reading the host log when a virtual device is used since this log is of no use to that driver. A virtual device can be identified through the flag TPM_CHIP_FLAG_VIRTUAL, which is only set for the tpm_vtpm_proxy driver.
--- drivers/char/tpm/eventlog/common.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/char/tpm/eventlog/common.c +3 -0
@@ -107,6 +107,9 @@ void tpm_bios_log_setup(struct tpm_chipint log_version;int rc =0 ; +if (chip->flags &TPM_CHIP_FLAG_VIRTUAL ) +return ; + rc =tpm_read_log (chip);if (rc <0 )return ;
Greg Kroah-Hartman
maintainerPATCH 153/184 crypto: rng - fix crypto_rng_reset() refcounting when !CRYPTO_STATS
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 30d0f6a956fc74bb2e948398daf3278c6b08c7e9 upstream.
crypto_stats_get() is a no-op when the kernel is compiled without CONFIG_CRYPTO_STATS, so pairing it with crypto_alg_put() unconditionally (as crypto_rng_reset() does) is wrong.
Fix this by moving the call to crypto_stats_get() to just before the actual algorithm operation which might need it. This makes it always paired with crypto_stats_rng_seed().
--- crypto/rng.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
crypto/rng.c +3 -7
@@ -34,22 +34,18 @@ int crypto_rng_reset(struct crypto_rng *u8 *buf =NULL ;int err; -crypto_stats_get (alg);if (!seed && slen) { buf =kmalloc (slen,GFP_KERNEL ); -if (!buf) { -crypto_alg_put (alg); +if (!buf)return -ENOMEM ; - } err =get_random_bytes_wait (buf, slen); -if (err) { -crypto_alg_put (alg); +if (err) goto out; - } seed = buf; } +crypto_stats_get (alg); err =crypto_rng_alg (tfm)->seed (tfm, seed, slen);crypto_stats_rng_seed (alg, err); out:
Greg Kroah-Hartman
maintainerPATCH 154/184 md/raid1: properly indicate failure when ending a failed write request
In reply to Greg Kroah-HartmanFrom: Paul Clements <[email protected]>
commit 2417b9869b81882ab90fd5ed1081a1cb2d4db1dd upstream.
This patch addresses a data corruption bug in raid1 arrays using bitmaps. Without this fix, the bitmap bits for the failed I/O end up being cleared.
Since we are in the failure leg of raid1_end_write_request, the request either needs to be retried (R1BIO_WriteError) or failed (R1BIO_Degraded).
--- drivers/md/raid1.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/md/raid1.c +2 -0
@@ -458,6 +458,8 @@ static void raid1_end_write_request(struif (!test_bit (Faulty, &rdev->flags))set_bit (R1BIO_WriteError, &r1_bio->state);else { +/* Fail the request */ +set_bit (R1BIO_Degraded, &r1_bio->state);/* Finished with this branch */ r1_bio->bios[mirror] =NULL ; to_put = bio;
Greg Kroah-Hartman
maintainerPATCH 155/184 dm raid: fix inconclusive reshape layout on fast raid4/5/6 table reload sequences
In reply to Greg Kroah-HartmanFrom: Heinz Mauelshagen <[email protected]>
commit f99a8e4373eeacb279bc9696937a55adbff7a28a upstream.
If fast table reloads occur during an ongoing reshape of raid4/5/6 devices the target may race reading a superblock vs the the MD resync thread; causing an inconclusive reshape state to be read in its constructor.
lvm2 test lvconvert-raid-reshape-stripes-load-reload.sh can cause BUG_ON() to trigger in md_run(), e.g.:
"kernel BUG at drivers/md/raid5.c:7567!".
Scenario triggering the bug:
1. the MD sync thread calls end_reshape() from raid5_sync_request() when done reshaping. However end_reshape() _only_ updates the reshape position to MaxSector keeping the changed layout configuration though (i.e. any delta disks, chunk sector or RAID algorithm changes). That inconclusive configuration is stored in the superblock.
2. dm-raid constructs a mapping, loading named inconsistent superblock as of step 1 before step 3 is able to finish resetting the reshape state completely, and calls md_run() which leads to mentioned bug in raid5.c.
3. the MD RAID personality's finish_reshape() is called; which resets the reshape information on chunk sectors, delta disks, etc. This explains why the bug is rarely seen on multi-core machines, as MD's finish_reshape() superblock update races with the dm-raid constructor's superblock load in step 2.
Fix identifies inconclusive superblock content in the dm-raid constructor and resets it before calling md_run(), factoring out identifying checks into rs_is_layout_change() to share in existing rs_reshape_requested() and new rs_reset_inclonclusive_reshape(). Also enhance a comment and remove an empty line.
--- drivers/md/dm-raid.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-)
drivers/md/dm-raid.c +28 -6
@@ -1892,6 +1892,14 @@ static bool rs_takeover_requested(structreturn rs->md.new_level != rs->md.level; } +/* True if layout is set to reshape. */ +static bool rs_is_layout_change (struct raid_set *rs,bool use_mddev) +{ +return (use_mddev ? rs->md.delta_disks : rs->delta_disks) || + rs->md.new_layout != rs->md.layout || + rs->md.new_chunk_sectors != rs->md.chunk_sectors; +} +/* True if @rs is requested to reshape by ctr */ static bool rs_reshape_requested (struct raid_set *rs) {
@@ -1904,9 +1912,7 @@ static bool rs_reshape_requested(structif (rs_is_raid0 (rs))return false; - change = mddev->new_layout != mddev->layout || - mddev->new_chunk_sectors != mddev->chunk_sectors || - rs->delta_disks; + change =rs_is_layout_change (rs, false);/* Historical case to support raid1 reshape without delta disks */ if (rs_is_raid1 (rs)) {
@@ -2843,7 +2849,7 @@ static sector_t _get_reshape_sectors(str }/* -* +* Reshape: * - change raid layout * - change chunk size * - add disks
@@ -2953,6 +2959,20 @@ static int rs_setup_reshape(struct raid_ }/* +* If the md resync thread has updated superblock with max reshape position +* at the end of a reshape but not (yet) reset the layout configuration +* changes -> reset the latter. +*/ +static void rs_reset_inconclusive_reshape (struct raid_set *rs) +{ +if (!rs_is_reshaping (rs) &&rs_is_layout_change (rs, true)) { +rs_set_cur (rs); + rs->md.delta_disks =0 ; + rs->md.reshape_backwards =0 ; + } +} + +/* * Enable/disable discard support on RAID set depending on * RAID level and discard properties of underlying RAID members. */
@@ -3216,11 +3236,14 @@ static int raid_ctr(struct dm_target *tiif (r) goto bad; +/* Catch any inconclusive reshape superblock content. */ +rs_reset_inconclusive_reshape (rs); +/* Start raid set read-only and assumed clean to change in raid_resume() */ rs->md.ro =1 ; rs->md.in_sync =1 ; -/* Keep array frozen */ +/* Keep array frozen until resume. */ set_bit (MD_RECOVERY_FROZEN , &rs->md.recovery);/* Has to be held on running the array */
@@ -3234,7 +3257,6 @@ static int raid_ctr(struct dm_target *ti } r =md_start (&rs->md); -if (r) { ti->error ="Failed to start raid array" ;mddev_unlock (&rs->md);
Greg Kroah-Hartman
maintainerPATCH 156/184 fuse: fix write deadlock
In reply to Greg Kroah-HartmanFrom: Vivek Goyal <[email protected]>
commit 4f06dd92b5d0a6f8eec6a34b8d6ef3e1f4ac1e10 upstream.
There are two modes for write(2) and friends in fuse:
a) write through (update page cache, send sync WRITE request to userspace)
b) buffered write (update page cache, async writeout later)
The write through method kept all the page cache pages locked that were used for the request. Keeping more than one page locked is deadlock prone and Qian Cai demonstrated this with trinity fuzzing.
The reason for keeping the pages locked is that concurrent mapped reads shouldn't try to pull possibly stale data into the page cache.
For full page writes, the easy way to fix this is to make the cached page be the authoritative source by marking the page PG_uptodate immediately. After this the page can be safely unlocked, since mapped/cached reads will take the written data from the cache.
Concurrent mapped writes will now cause data in the original WRITE request to be updated; this however doesn't cause any data inconsistency and this scenario should be exceedingly rare anyway.
If the WRITE request returns with an error in the above case, currently the page is not marked uptodate; this means that a concurrent read will always read consistent data. After this patch the page is uptodate between writing to the cache and receiving the error: there's window where a cached read will read the wrong data. While theoretically this could be a regression, it is unlikely to be one in practice, since this is normal for buffered writes.
In case of a partial page write to an already uptodate page the locking is also unnecessary, with the above caveats.
Partial write of a not uptodate page still needs to be handled. One way would be to read the complete page before doing the write. This is not possible, since it might break filesystems that don't expect any READ requests when the file was opened O_WRONLY.
The other solution is to serialize the synchronous write with reads from the partial pages. The easiest way to do this is to keep the partial pages locked. The problem is that a write() may involve two such pages (one head and one tail). This patch fixes it by only locking the partial tail page. If there's a partial head page as well, then split that off as a separate WRITE request.
--- fs/fuse/file.c | 41 +++++++++++++++++++++++++++++------------ fs/fuse/fuse_i.h | 1 + 2 files changed, 30 insertions(+), 12 deletions(-)
fs/fuse/file.c +29 -12
@@ -1108,6 +1108,7 @@ static ssize_t fuse_send_write_pages(strstruct fuse_file *ff = file->private_data;struct fuse_conn *fc = ff->fc;unsigned int offset, i; +bool short_write;int err;for (i =0 ; i < ap->num_pages; i++)
@@ -1120,32 +1121,38 @@ static ssize_t fuse_send_write_pages(strif (!err && ia->write.out.size > count) err = -EIO ; + short_write = ia->write.out.size < count; offset = ap->descs[0 ].offset; count = ia->write.out.size;for (i =0 ; i < ap->num_pages; i++) {struct page *page = ap->pages[i]; -if (!err && !offset && count >=PAGE_SIZE ) -SetPageUptodate (page); - -if (count >PAGE_SIZE - offset) - count -=PAGE_SIZE - offset; -else - count =0 ; - offset =0 ; - -unlock_page (page); +if (err) { +ClearPageUptodate (page); + }else { +if (count >=PAGE_SIZE - offset) + count -=PAGE_SIZE - offset; +else { +if (short_write) +ClearPageUptodate (page); + count =0 ; + } + offset =0 ; + } +if (ia->write.page_locked && (i == ap->num_pages -1 )) +unlock_page (page);put_page (page); }return err; } -static ssize_t fuse_fill_write_pages (struct fuse_args_pages *ap, +static ssize_t fuse_fill_write_pages (struct fuse_io_args *ia,struct address_space *mapping,struct iov_iter *ii,loff_t pos,unsigned int max_pages) { +struct fuse_args_pages *ap = &ia->ap;struct fuse_conn *fc =get_fuse_conn (mapping->host);unsigned offset = pos & (PAGE_SIZE -1 );size_t count =0 ;
@@ -1198,6 +1205,16 @@ static ssize_t fuse_fill_write_pages(strif (offset ==PAGE_SIZE ) offset =0 ; +/* If we copied full page, mark it uptodate */ +if (tmp ==PAGE_SIZE ) +SetPageUptodate (page); + +if (PageUptodate (page)) { +unlock_page (page); + }else { + ia->write.page_locked = true; +break ; + }if (!fc->big_writes)break ; } while (iov_iter_count(ii) && count < fc->max_write &&
@@ -1241,7 +1258,7 @@ static ssize_t fuse_perform_write(structbreak ; } - count =fuse_fill_write_pages (ap, mapping, ii, pos, nr_pages); + count =fuse_fill_write_pages (&ia, mapping, ii, pos, nr_pages);if (count <=0 ) { err = count; }else {
fs/fuse/fuse_i.h +1 -0
@@ -845,6 +845,7 @@ struct fuse_io_args {struct {struct fuse_write_in in;struct fuse_write_out out; +bool page_locked; } write; };struct fuse_args_pages ap;
Greg Kroah-Hartman
maintainerPATCH 157/184 security: commoncap: fix -Wstringop-overread warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 82e5d8cc768b0c7b03c551a9ab1f8f3f68d5f83f upstream.
gcc-11 introdces a harmless warning for cap_inode_getsecurity:
security/commoncap.c: In function ‘cap_inode_getsecurity’:security/commoncap.c:440:33: error: ‘memcpy’ reading 16 bytes from a region of size 0 [-Werror=stringop-overread]
440 | memcpy(&nscap->data, &cap->data, sizeof(__le32) * 2 * VFS_CAP_U32);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The problem here is that tmpbuf is initialized to NULL, so gcc assumes it is not accessible unless it gets set by vfs_getxattr_alloc(). This is a legitimate warning as far as I can tell, but the code is correct since it correctly handles the error when that function fails.
Add a separate NULL check to tell gcc about it as well.
--- security/commoncap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/commoncap.c +1 -1
@@ -391,7 +391,7 @@ int cap_inode_getsecurity(struct inode * &tmpbuf, size, GFP_NOFS);dput (dentry); -if (ret <0 ) +if (ret <0 || !tmpbuf)return ret; fs_ns = inode->i_sb->s_user_ns;
Greg Kroah-Hartman
maintainerPATCH 158/184 Fix misc new gcc warnings
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
commit e7c6e405e171fb33990a12ecfd14e6500d9e5cf2 upstream.
It seems like Fedora 34 ends up enabling a few new gcc warnings, notably "-Wstringop-overread" and "-Warray-parameter".
Both of them cause what seem to be valid warnings in the kernel, where we have array size mismatches in function arguments (that are no longer just silently converted to a pointer to element, but actually checked).
This fixes most of the trivial ones, by making the function declaration match the function definition, and in the case of intel_pm.c, removing the over-specified array size from the argument declaration.
At least one 'stringop-overread' warning remains in the i915 driver, but that one doesn't have the same obvious trivial fix, and may or may not actually be indicative of a bug.
[ It was a mistake to upgrade one of my machines to Fedora 34 while
being busy with the merge window, but if this is the extent of the
compiler upgrade problems, things are better than usual - Linus ]
--- drivers/gpu/drm/i915/intel_pm.c | 2 +- drivers/media/usb/dvb-usb/dvb-usb.h | 2 +- include/scsi/libfcoe.h | 2 +- net/bluetooth/ecdh_helper.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -2966,7 +2966,7 @@ int ilk_wm_max_level(const struct drm_i9static void intel_print_wm_latency (struct drm_i915_private *dev_priv,const char *name, -const u16 wm[8 ]) +const u16 wm[]) {int level, max_level =ilk_wm_max_level (dev_priv);
drivers/media/usb/dvb-usb/dvb-usb.h +1 -1
@@ -485,7 +485,7 @@ extern int __must_check dvb_usb_generic_write(struct dvb_usb_device *, u8 *, u16);/* commonly used remote control parsing */ -extern int dvb_usb_nec_rc_key_to_event (struct dvb_usb_device *,u8 [],u32 *,int *); +extern int dvb_usb_nec_rc_key_to_event (struct dvb_usb_device *,u8 [5 ],u32 *,int *);/* commonly used firmware download types and function */ struct hexline {
include/scsi/libfcoe.h +1 -1
@@ -249,7 +249,7 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctl struct fc_frame *);/* libfcoe funcs */ -u64 fcoe_wwn_from_mac (unsigned char mac[],unsigned int ,unsigned int ); +u64 fcoe_wwn_from_mac (unsigned char mac[MAX_ADDR_LEN ],unsigned int ,unsigned int );int fcoe_libfc_config (struct fc_lport *,struct fcoe_ctlr *,const struct libfc_function_template *,int init_fcp);u32 fcoe_fc_crc (struct fc_frame *fp);
net/bluetooth/ecdh_helper.h +1 -1
@@ -25,6 +25,6 @@int compute_ecdh_secret (struct crypto_kpp *tfm,const u8 pair_public_key[64 ],u8 secret[32 ]); -int set_ecdh_privkey (struct crypto_kpp *tfm,const u8 *private_key); +int set_ecdh_privkey (struct crypto_kpp *tfm,const u8 private_key[32 ]);int generate_ecdh_public_key (struct crypto_kpp *tfm,u8 public_key[64 ]);int generate_ecdh_keys (struct crypto_kpp *tfm,u8 public_key[64 ]);
Greg Kroah-Hartman
maintainerPATCH 159/184 jffs2: check the validity of dstlen in jffs2_zlib_compress()
In reply to Greg Kroah-HartmanFrom: Yang Yang <[email protected]>
commit 90ada91f4610c5ef11bc52576516d96c496fc3f1 upstream.
KASAN reports a BUG when download file in jffs2 filesystem.It is because when dstlen == 1, cpage_out will write array out of bounds. Actually, data will not be compressed in jffs2_zlib_compress() if data's length less than 4.
[ 393.799778] BUG: KASAN: slab-out-of-bounds in jffs2_rtime_compress+0x214/0x2f0 at addr ffff800062e3b281 [ 393.809166] Write of size 1 by task tftp/2918 [ 393.813526] CPU: 3 PID: 2918 Comm: tftp Tainted: G B 4.9.115-rt93-EMBSYS-CGEL-6.1.R6-dirty #1 [ 393.823173] Hardware name: LS1043A RDB Board (DT) [ 393.827870] Call trace: [ 393.830322] [<ffff20000808c700>] dump_backtrace+0x0/0x2f0 [ 393.835721] [<ffff20000808ca04>] show_stack+0x14/0x20 [ 393.840774] [<ffff2000086ef700>] dump_stack+0x90/0xb0 [ 393.845829] [<ffff20000827b19c>] kasan_object_err+0x24/0x80 [ 393.851402] [<ffff20000827b404>] kasan_report_error+0x1b4/0x4d8 [ 393.857323] [<ffff20000827bae8>] kasan_report+0x38/0x40 [ 393.862548] [<ffff200008279d44>] __asan_store1+0x4c/0x58 [ 393.867859] [<ffff2000084ce2ec>] jffs2_rtime_compress+0x214/0x2f0 [ 393.873955] [<ffff2000084bb3b0>] jffs2_selected_compress+0x178/0x2a0 [ 393.880308] [<ffff2000084bb530>] jffs2_compress+0x58/0x478 [ 393.885796] [<ffff2000084c5b34>] jffs2_write_inode_range+0x13c/0x450 [ 393.892150] [<ffff2000084be0b8>] jffs2_write_end+0x2a8/0x4a0 [ 393.897811] [<ffff2000081f3008>] generic_perform_write+0x1c0/0x280 [ 393.903990] [<ffff2000081f5074>] __generic_file_write_iter+0x1c4/0x228 [ 393.910517] [<ffff2000081f5210>] generic_file_write_iter+0x138/0x288 [ 393.916870] [<ffff20000829ec1c>] __vfs_write+0x1b4/0x238 [ 393.922181] [<ffff20000829ff00>] vfs_write+0xd0/0x238 [ 393.927232] [<ffff2000082a1ba8>] SyS_write+0xa0/0x110 [ 393.932283] [<ffff20000808429c>] __sys_trace_return+0x0/0x4 [ 393.937851] Object at ffff800062e3b280, in cache kmalloc-64 size: 64 [ 393.944197] Allocated: [ 393.946552] PID = 2918 [ 393.948913] save_stack_trace_tsk+0x0/0x220 [ 393.953096] save_stack_trace+0x18/0x20 [ 393.956932] kasan_kmalloc+0xd8/0x188 [ 393.960594] __kmalloc+0x144/0x238 [ 393.963994] jffs2_selected_compress+0x48/0x2a0 [ 393.968524] jffs2_compress+0x58/0x478 [ 393.972273] jffs2_write_inode_range+0x13c/0x450 [ 393.976889] jffs2_write_end+0x2a8/0x4a0 [ 393.980810] generic_perform_write+0x1c0/0x280 [ 393.985251] __generic_file_write_iter+0x1c4/0x228 [ 393.990040] generic_file_write_iter+0x138/0x288 [ 393.994655] __vfs_write+0x1b4/0x238 [ 393.998228] vfs_write+0xd0/0x238 [ 394.001543] SyS_write+0xa0/0x110 [ 394.004856] __sys_trace_return+0x0/0x4 [ 394.008684] Freed: [ 394.010691] PID = 2918 [ 394.013051] save_stack_trace_tsk+0x0/0x220 [ 394.017233] save_stack_trace+0x18/0x20 [ 394.021069] kasan_slab_free+0x88/0x188 [ 394.024902] kfree+0x6c/0x1d8 [ 394.027868] jffs2_sum_write_sumnode+0x2c4/0x880 [ 394.032486] jffs2_do_reserve_space+0x198/0x598 [ 394.037016] jffs2_reserve_space+0x3f8/0x4d8 [ 394.041286] jffs2_write_inode_range+0xf0/0x450 [ 394.045816] jffs2_write_end+0x2a8/0x4a0 [ 394.049737] generic_perform_write+0x1c0/0x280 [ 394.054179] __generic_file_write_iter+0x1c4/0x228 [ 394.058968] generic_file_write_iter+0x138/0x288 [ 394.063583] __vfs_write+0x1b4/0x238 [ 394.067157] vfs_write+0xd0/0x238 [ 394.070470] SyS_write+0xa0/0x110 [ 394.073783] __sys_trace_return+0x0/0x4 [ 394.077612] Memory state around the buggy address: [ 394.082404] ffff800062e3b180: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc [ 394.089623] ffff800062e3b200: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc [ 394.096842] >ffff800062e3b280: 01 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 394.104056] ^ [ 394.107283] ffff800062e3b300: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ 394.114502] ffff800062e3b380: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ 394.121718] ==================================================================
--- fs/jffs2/compr_rtime.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jffs2/compr_rtime.c +3 -0
@@ -37,6 +37,9 @@ static int jffs2_rtime_compress(unsignedint outpos =0 ;int pos=0 ; +if (*dstlen <=3 ) +return -1 ; +memset (positions,0 ,sizeof (positions));while (pos < (*sourcelen) && outpos <= (*dstlen)-2 ) {
Greg Kroah-Hartman
maintainerPATCH 160/184 Revert 337f13046ff0 ("futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op")
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 4fbf5d6837bf81fd7a27d771358f4ee6c4f243f8 upstream.
The FUTEX_WAIT operand has historically a relative timeout which means that the clock id is irrelevant as relative timeouts on CLOCK_REALTIME are not subject to wall clock changes and therefore are mapped by the kernel to CLOCK_MONOTONIC for simplicity.
If a caller would set FUTEX_CLOCK_REALTIME for FUTEX_WAIT the timeout is still treated relative vs. CLOCK_MONOTONIC and then the wait arms that timeout based on CLOCK_REALTIME which is broken and obviously has never been used or even tested.
Reject any attempt to use FUTEX_CLOCK_REALTIME with FUTEX_WAIT again.
The desired functionality can be achieved with FUTEX_WAIT_BITSET and a FUTEX_BITSET_MATCH_ANY argument.
--- kernel/futex.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/futex.c +1 -2
@@ -3862,8 +3862,7 @@ long do_futex(u32 __user *uaddr, int op,if (op &FUTEX_CLOCK_REALTIME ) { flags |=FLAGS_CLOCKRT ; -if (cmd !=FUTEX_WAIT && cmd !=FUTEX_WAIT_BITSET && \ - cmd !=FUTEX_WAIT_REQUEUE_PI ) +if (cmd !=FUTEX_WAIT_BITSET && cmd !=FUTEX_WAIT_REQUEUE_PI )return -ENOSYS ; }
Greg Kroah-Hartman
maintainerPATCH 161/184 x86/cpu: Initialize MSR_TSC_AUX if RDTSCP *or* RDPID is supported
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit b6b4fbd90b155a0025223df2c137af8a701d53b3 upstream.
Initialize MSR_TSC_AUX with CPU node information if RDTSCP or RDPID is supported. This fixes a bug where vdso_read_cpunode() will read garbage via RDPID if RDPID is supported but RDTSCP is not. While no known CPU supports RDPID but not RDTSCP, both Intel's SDM and AMD's APM allow for RDPID to exist without RDTSCP, e.g. it's technically a legal CPU model for a virtual machine.
Note, technically MSR_TSC_AUX could be initialized if and only if RDPID is supported since RDTSCP is currently not used to retrieve the CPU node. But, the cost of the superfluous WRMSR is negigible, whereas leaving MSR_TSC_AUX uninitialized is just asking for future breakage if someone decides to utilize RDTSCP.
--- arch/x86/kernel/cpu/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/common.c +1 -1
@@ -1826,7 +1826,7 @@ static void setup_getcpu(int cpu)unsigned long cpudata =vdso_encode_cpunode (cpu,early_cpu_to_node (cpu));struct desc_struct d = { }; -if (boot_cpu_has (X86_FEATURE_RDTSCP )) +if (boot_cpu_has (X86_FEATURE_RDTSCP ) ||boot_cpu_has (X86_FEATURE_RDPID ))write_rdtscp_aux (cpudata);/* Store CPU and node number in limit. */
Greg Kroah-Hartman
maintainerPATCH 162/184 kbuild: update config_data.gz only when the content of .config is changed
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 46b41d5dd8019b264717978c39c43313a524d033 upstream.
If the timestamp of the .config file is updated, config_data.gz is regenerated, then vmlinux is re-linked. This occurs even if the content of the .config has not changed at all.
This issue was mitigated by commit 67424f61f813 ("kconfig: do not write .config if the content is the same"); Kconfig does not update the .config when it ends up with the identical configuration.
The issue is remaining when the .config is created by *_defconfig with some config fragment(s) applied on top.
This is typical for powerpc and mips, where several *_defconfig targets are constructed by using merge_config.sh.
One workaround is to have the copy of the .config. The filechk rule updates the copy, kernel/config_data, by checking the content instead of the timestamp.
With this commit, the second run with the same configuration avoids the needless rebuilds.
$ make ARCH=mips defconfig all
[ snip ]
$ make ARCH=mips defconfig all
*** Default configuration is based on target '32r2el_defconfig'
Using ./arch/mips/configs/generic_defconfig as base
Merging arch/mips/configs/generic/32r2.config
Merging arch/mips/configs/generic/el.config
Merging ./arch/mips/configs/generic/board-boston.config
Merging ./arch/mips/configs/generic/board-ni169445.config
Merging ./arch/mips/configs/generic/board-ocelot.config
Merging ./arch/mips/configs/generic/board-ranchu.config
Merging ./arch/mips/configs/generic/board-sead-3.config
Merging ./arch/mips/configs/generic/board-xilfpga.config
#
# configuration written to .config
#
SYNC include/config/auto.conf
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
CHK include/generated/compile.h
CHK include/generated/autoksyms.h--- kernel/.gitignore | 1 + kernel/Makefile | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
kernel/.gitignore +1 -0
@@ -1,4 +1,5 @@ # +/config_data # Generated files # kheaders.md5
kernel/Makefile +7 -2
@@ -122,10 +122,15 @@ KCOV_INSTRUMENT_stackleak.o := n $(obj)/configs.o: $(obj)/config_data.gz -targets += config_data.gz -$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE +targets += config_data config_data.gz +$(obj)/config_data.gz: $(obj)/config_data FORCE $(call if_changed,gzip) +filechk_cat = cat $< + +$(obj)/config_data: $(KCONFIG_CONFIG) FORCE + $(call filechk,cat) + $(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz quiet_cmd_genikh = CHK $(obj)/kheaders_data.tar.xz