5.16.10-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainercover 5.16.10-rc1 review
This is the start of the stable review cycle for the 5.16.10 release. There are 203 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, 16 Feb 2022 09:24:36 +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.16.10-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.16.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.16.10-rc1
Vijayanand Jitta <[email protected]>
iommu: Fix potential use-after-free during probe
Chia-Wei Wang <[email protected]>
docs/ABI: testing: aspeed-uart-routing: Escape asterisk
Masahiro Yamada <[email protected]>
kconfig: fix missing fclose() on error paths
Song Liu <[email protected]>
perf: Fix list corruption in perf_cgroup_switch()
Alexander Stein <[email protected]>
arm64: dts: imx8mq: fix lcdif port node
Thomas Bogendoerfer <[email protected]>
MIPS: octeon: Fix missed PTR->PTR_WD conversion
James Smart <[email protected]>
scsi: lpfc: Reduce log messages seen after firmware download
James Smart <[email protected]>
scsi: lpfc: Remove NVMe support if kernel has NVME_FC disabled
Nathan Chancellor <[email protected]>
Makefile.extrawarn: Move -Wunaligned-access to W=1
Tadeusz Struk <[email protected]>
sched/fair: Fix fault in reweight_entity
Reinette Chatre <[email protected]>
x86/sgx: Silence softlockup detection when releasing large enclaves
Slark Xiao <[email protected]>
bus: mhi: pci_generic: Add mru_default for Cinterion MV31-W
Slark Xiao <[email protected]>
bus: mhi: pci_generic: Add mru_default for Foxconn SDX55
Vineeth Vijayan <[email protected]>
s390/cio: verify the driver availability for path_event call
Kees Cook <[email protected]>
signal: HANDLER_EXIT should clear SIGNAL_UNKILLABLE
Kees Cook <[email protected]>
seccomp: Invalidate seccomp mode to catch death failures
Roman Gushchin <[email protected]>
mm: memcg: synchronize objcg lists with a dedicated spinlock
Mel Gorman <[email protected]>
mm: vmscan: remove deadlock due to throttling failing to make progress
Yang Shi <[email protected]>
fs/proc: task_mmu.c: don't read mapcount for migration entry
Mathias Krause <[email protected]>
iio: buffer: Fix file related error handling in IIO_BUFFER_GET_FD_IOCTL
Kishon Vijay Abraham I <[email protected]>
phy: ti: Fix missing sentinel for clk_div_table
Samuel Thibault <[email protected]>
speakup-dectlk: Restore pitch setting
Johan Hovold <[email protected]>
USB: serial: cp210x: add CPI Bulk Coin Recycler id
Johan Hovold <[email protected]>
USB: serial: cp210x: add NCR Retail IO box id
Stephan Brunner <[email protected]>
USB: serial: ch341: add support for GW Instek USB2.0-Serial devices
Pawel Dembicki <[email protected]>
USB: serial: option: add ZTE MF286D modem
Cameron Williams <[email protected]>
USB: serial: ftdi_sio: add support for Brainboxes US-159/235/320
Jann Horn <[email protected]>
usb: raw-gadget: fix handling of dual-direction-capable endpoints
Pavel Hofman <[email protected]>
usb: gadget: f_uac2: Define specific wTerminalType
Greg Kroah-Hartman <[email protected]>
usb: gadget: rndis: check size of RNDIS_MSG_SET command
Szymon Heidrich <[email protected]>
USB: gadget: validate interface OS descriptor requests
Adam Ford <[email protected]>
usb: gadget: udc: renesas_usb3: Fix host to USB_ROLE_NONE transition
Udipto Goswami <[email protected]>
usb: dwc3: gadget: Prevent core from processing stale TRBs
Sean Anderson <[email protected]>
usb: ulpi: Call of_node_put correctly
Sean Anderson <[email protected]>
usb: ulpi: Move of_node_put to ulpi_dev_release
Jann Horn <[email protected]>
net: usb: ax88179_178a: Fix out-of-bounds accesses in RX fixup
Greg Kroah-Hartman <[email protected]>
Revert "usb: dwc2: drd: fix soft connect when gadget is unconfigured"
Fabrice Gasnier <[email protected]>
usb: dwc2: drd: fix soft connect when gadget is unconfigured
Jonas Malaco <[email protected]>
eeprom: ee1004: limit i2c reads to I2C_SMBUS_BLOCK_MAX
TATSUKAWA KOSUKE (立川 江介) <[email protected]>
n_tty: wake up poll(POLLRDNORM) on receiving data
Jakob Koschel <[email protected]>
vt_ioctl: add array_index_nospec to VT_ACTIVATE
Jakob Koschel <[email protected]>
vt_ioctl: fix array_index_nospec in vt_setactivate
Vladimir Oltean <[email protected]>
net: dsa: mv88e6xxx: fix use-after-free in mv88e6xxx_mdios_unregister
Colin Foster <[email protected]>
net: mscc: ocelot: fix mutex lock error during ethtool stats read
Dave Ertman <[email protected]>
ice: Avoid RTNL lock when re-creating auxiliary device
Dave Ertman <[email protected]>
ice: Fix KASAN error in LAG NETDEV_UNREGISTER handler
Jesse Brandeburg <[email protected]>
ice: fix IPIP and SIT TSO offload
Dan Carpenter <[email protected]>
ice: fix an error code in ice_cfg_phy_fec()
Robert-Ionut Alexa <[email protected]>
dpaa2-eth: unregister the netdev before disconnecting from the PHY
Kishen Maloor <[email protected]>
mptcp: netlink: process IPv6 addrs in creating listening sockets
Yang Wang <[email protected]>
drm/amd/pm: fix hwmon node of power1_label create issue
Vladimir Oltean <[email protected]>
net: dsa: fix panic when DSA master device unbinds on shutdown
Raju Rangoju <[email protected]>
net: amd-xgbe: disable interrupts during pci removal
Jon Maloy <[email protected]>
tipc: rate limit warning for received illegal binding update
Joel Stanley <[email protected]>
net: mdio: aspeed: Add missing MODULE_DEVICE_TABLE
Eric Dumazet <[email protected]>
veth: fix races around rq->rx_notify_masked
Antoine Tenart <[email protected]>
net: fix a memleak when uncloning an skb dst and its metadata
Antoine Tenart <[email protected]>
net: do not keep the dst cache when uncloning an skb dst and its metadata
Louis Peens <[email protected]>
nfp: flower: fix ida_idx not being released
Eric Dumazet <[email protected]>
ipmr,ip6mr: acquire RTNL before calling ip[6]mr_free_table() on failure path
Cai Huoqing <[email protected]>
net: ethernet: litex: Add the dependency on HAS_IOMEM
Sukadev Bhattiprolu <[email protected]>
ibmvnic: don't release napi in __ibmvnic_open()
Vladimir Oltean <[email protected]>
net: dsa: lantiq_gswip: don't use devres for mdiobus
Vladimir Oltean <[email protected]>
net: dsa: mt7530: fix kernel bug in mdiobus_free() when unbinding
Vladimir Oltean <[email protected]>
net: dsa: seville: register the mdiobus under devres
Colin Foster <[email protected]>
net: dsa: ocelot: seville: utilize of_mdiobus_register
Vladimir Oltean <[email protected]>
net: dsa: felix: don't use devres for mdiobus
Vladimir Oltean <[email protected]>
net: dsa: bcm_sf2: don't use devres for mdiobus
Vladimir Oltean <[email protected]>
net: dsa: ar9331: register the mdiobus under devres
Vladimir Oltean <[email protected]>
net: dsa: mv88e6xxx: don't use devres for mdiobus
Mahesh Bandewar <[email protected]>
bonding: pair enable_port with slave_arr_updates
Tao Liu <[email protected]>
gve: Recording rx queue before sending to napi
NeilBrown <[email protected]>
SUNRPC: lock against ->sock changing during sysfs read
Helge Deller <[email protected]>
fbcon: Avoid 'cap' set but not used warning
Niklas Cassel <[email protected]>
gpio: sifive: use the correct register to read output values
Andy Shevchenko <[email protected]>
gpiolib: Never return internal error codes to user space
Rafael J. Wysocki <[email protected]>
ACPI: PM: s2idle: Cancel wakeup before dispatching EC GPE
Ilya Leoshkevich <[email protected]>
s390/module: fix building test_modules_helpers.o with clang
Christoph Niedermaier <[email protected]>
drm/panel: simple: Assign data from panel_dpi_probe() correctly
Vladimir Oltean <[email protected]>
net: mscc: ocelot: fix all IP traffic getting trapped to CPU with PTP over IP
Eric Dumazet <[email protected]>
tcp: take care of mixed splice()/sendmsg(MSG_ZEROCOPY) case
Samuel Mendoza-Jonas <[email protected]>
ixgbevf: Require large buffers for build_skb on 82599VF
Lutz Koschorreck <[email protected]>
arm64: dts: meson-sm1-odroid: fix boot loop after reboot
Dongjin Kim <[email protected]>
arm64: dts: meson-sm1-bananapi-m5: fix wrong GPIO domain for GPIOE_2
Lutz Koschorreck <[email protected]>
arm64: dts: meson-sm1-odroid: use correct enable-gpio pin for tf-io regulator
Dongjin Kim <[email protected]>
arm64: dts: meson-g12b-odroid-n2: fix typo 'dio2133'
Florian Westphal <[email protected]>
netfilter: ctnetlink: disable helper autoassign
Florian Westphal <[email protected]>
netfilter: nft_payload: don't allow th access for fragments
Steen Hegelund <[email protected]>
net: sparx5: Fix get_stat64 crash in tcpdump
Mathias Krause <[email protected]>
misc: fastrpc: avoid double fput() on failed usercopy
Dave Stevenson <[email protected]>
drm/vc4: hdmi: Allow DBLCLK modes even if horz timing is odd.
Trond Myklebust <[email protected]>
NFS: Avoid duplicate uncached readdir calls on eof
[email protected] <[email protected]>
NFS: Don't skip directory entries when doing uncached readdir
[email protected] <[email protected]>
NFS: Don't overfill uncached readdir pages
Geert Uytterhoeven <[email protected]>
gpio: aggregator: Fix calling into sleeping GPIO controllers
Liu Ying <[email protected]>
phy: dphy: Correct clk_pre parameter
Mark Brown <[email protected]>
arm64: Enable Cortex-A510 erratum 2051678 by default
Udipto Goswami <[email protected]>
usb: f_fs: Fix use-after-free for epfile
Martin Kepplinger <[email protected]>
arm64: dts: imx8mq: fix mipi_csi bidirectional port numbers
Rob Herring <[email protected]>
ARM: dts: imx7ulp: Fix 'assigned-clocks-parents' typo
Dan Carpenter <[email protected]>
phy: stm32: fix a refcount leak in stm32_usbphyc_pll_enable()
Robert Hancock <[email protected]>
phy: xilinx: zynqmp: Fix bus width setting for SGMII
Fabio Estevam <[email protected]>
ARM: dts: imx6qdl-udoo: Properly describe the SD card detect
Uwe Kleine-König <[email protected]>
staging: fbtft: Fix error path in fbtft_driver_module_init()
Jens Wiklander <[email protected]>
optee: add error checks in optee_ffa_do_call_with_arg()
Jerome Forissier <[email protected]>
tee: optee: do not check memref size on return from Secure World
Al Cooper <[email protected]>
phy: broadcom: Kconfig: Fix PHY_BRCM_USB config option
Martin Blumenstingl <[email protected]>
ARM: dts: meson8b: Fix the UART device-tree schema validation
Martin Blumenstingl <[email protected]>
ARM: dts: meson8: Fix the UART device-tree schema validation
Martin Blumenstingl <[email protected]>
ARM: dts: meson: Fix the UART compatible strings
Tony Lindgren <[email protected]>
ARM: dts: Fix timer regression for beagleboard revision c
Ville Syrjälä <[email protected]>
drm/i915: Workaround broken BIOS DBUF configuration on TGL/RKL
Ville Syrjälä <[email protected]>
drm/i915: Populate pipe dbuf slices more accurately during readout
Ville Syrjälä <[email protected]>
drm/i915: Allow !join_mbus cases for adlp+ dbuf configuration
Ville Syrjälä <[email protected]>
drm/i915: Disable DRRS on IVB/HSW port != A
Brian Norris <[email protected]>
drm/rockchip: vop: Correct RK3399 VOP register fields
Alex Deucher <[email protected]>
drm/amdgpu/display: change pipe policy for DCN 2.0
Rafael J. Wysocki <[email protected]>
PM: s2idle: ACPI: Fix wakeup interrupts handling
Robin Murphy <[email protected]>
ACPI/IORT: Check node revision for PMCG resources
Sagi Grimberg <[email protected]>
nvme-tcp: fix bogus request completion when failing to send AER
Krzysztof Kozlowski <[email protected]>
ARM: socfpga: fix missing RESET_CONTROLLER
Linus Walleij <[email protected]>
ARM: dts: Fix boot regression on Skomer
Fabio Estevam <[email protected]>
ARM: dts: imx23-evk: Remove MX23_PAD_SSP1_DETECT from hog group
Bjorn Helgaas <[email protected]>
Revert "PCI/portdrv: Do not setup up IRQs if there are no users"
Andreas Gruenbacher <[email protected]>
Revert "gfs2: check context in gfs2_glock_put"
Bob Peterson <[email protected]>
gfs2: Fix gfs2_release for non-writers regression
Changbin Du <[email protected]>
riscv: eliminate unreliable __builtin_frame_address(1)
Palmer Dabbelt <[email protected]>
riscv/mm: Add XIP_FIXUP for phys_ram_base
Pingfan Liu <[email protected]>
riscv: cpu-hotplug: clear cpu from numa map when teardown
Myrtle Shah <[email protected]>
riscv: Fix XIP_FIXUP_FLASH_OFFSET
Aurelien Jarno <[email protected]>
riscv: fix build with binutils 2.38
Jim Mattson <[email protected]>
KVM: x86: Report deprecated x87 features in supported CPUID
Sean Christopherson <[email protected]>
KVM: VMX: Set vmcs.PENDING_DBG.BS on #DB in STI/MOVSS blocking shadow
Sean Christopherson <[email protected]>
KVM: SVM: Don't kill SEV guest if SMAP erratum triggers in usermode
Vitaly Kuznetsov <[email protected]>
KVM: nVMX: Also filter MSR_IA32_VMX_TRUE_PINBASED_CTLS when eVMCS
Vitaly Kuznetsov <[email protected]>
KVM: nVMX: eVMCS: Filter out VM_EXIT_SAVE_VMX_PREEMPTION_TIMER
Hou Wenlong <[email protected]>
KVM: eventfd: Fix false positive RCU usage warning
Marco Elver <[email protected]>
kasan: test: fix compatibility with FORTIFY_SOURCE
James Morse <[email protected]>
arm64: cpufeature: List early Cortex-A510 parts as having broken dbm
Anshuman Khandual <[email protected]>
arm64: errata: Add detection for TRBE trace data corruption
Anshuman Khandual <[email protected]>
arm64: errata: Add detection for TRBE invalid prohibited states
Anshuman Khandual <[email protected]>
arm64: errata: Add detection for TRBE ignored system register writes
Jisheng Zhang <[email protected]>
net: stmmac: dwmac-sun8i: use return val of readl_poll_timeout()
Thomas Bogendoerfer <[email protected]>
MIPS: Fix build error due to PTR used in more places
Wu Zheng <[email protected]>
nvme-pci: add the IGNORE_DEV_SUBNQN quirk for Intel P4500/P4600 SSDs
James Clark <[email protected]>
perf: Always wake the parent event
Amelie Delaunay <[email protected]>
usb: dwc2: gadget: don't try to disable ep0 in dwc2_hsotg_suspend
Alex Deucher <[email protected]>
drm/amdgpu/display: use msleep rather than udelay for long delays
Alex Deucher <[email protected]>
drm/amdgpu/display: adjust msleep limit in dp_wait_for_training_aux_rd_interval
Zhan Liu <[email protected]>
drm/amd/display: Correct MPC split policy for DCN301
Amadeusz Sławiński <[email protected]>
PM: hibernate: Remove register_nosave_region_late()
Jisheng Zhang <[email protected]>
net: stmmac: reduce unnecessary wakeups from eee sw timer
Tong Zhang <[email protected]>
scsi: myrs: Fix crash in error case
Kiwoong Kim <[email protected]>
scsi: ufs: Treat link loss as fatal error
Kiwoong Kim <[email protected]>
scsi: ufs: Use generic error code in ufshcd_set_dev_pwr_mode()
John Garry <[email protected]>
scsi: pm8001: Fix bogus FW crash for maxcpus=1
Saurav Kashyap <[email protected]>
scsi: qedf: Change context reset messages to ratelimited
Saurav Kashyap <[email protected]>
scsi: qedf: Fix refcount issue when LOGO is received during TMF
Saurav Kashyap <[email protected]>
scsi: qedf: Add stag_work to all the vports
Xiaoke Wang <[email protected]>
scsi: ufs: ufshcd-pltfrm: Check the return value of devm_kstrdup()
ZouMingzhe <[email protected]>
scsi: target: iscsi: Make sure the np under each tpg is unique
Anshuman Khandual <[email protected]>
arm64: errata: Update ARM64_ERRATUM_[2119858|2224489] with Cortex-X2 ranges
Anshuman Khandual <[email protected]>
arm64: Add Cortex-X2 CPU part definition
Ilya Leoshkevich <[email protected]>
s390/module: test loading modules with a lot of relocations
Christophe Leroy <[email protected]>
powerpc/fixmap: Fix VM debug warning on unmap
Victor Nogueira <[email protected]>
net: sched: Clarify error message when qdisc kind is unknown
Raymond Jay Golo <[email protected]>
drm: panel-orientation-quirks: Add quirk for the 1Netbook OneXPlayer
Padmanabha Srinivasaiah <[email protected]>
drm/vc4: Fix deadlock on DSI device attach error
Peter Zijlstra <[email protected]>
sched: Avoid double preemption in __cond_resched_*lock*()
Andi Kleen <[email protected]>
x86/perf: Avoid warning for Arch LBR without XSAVE
Stephane Eranian <[email protected]>
perf/x86/rapl: fix AMD event handling
Sander Vanheule <[email protected]>
irqchip/realtek-rtl: Service all pending interrupts
Anna Schumaker <[email protected]>
sunrpc: Fix potential race conditions in rpc_sysfs_xprt_state_change()
Xiyu Yang <[email protected]>
net/sunrpc: fix reference count leaks in rpc_sysfs_xprt_state_change
Olga Kornievskaia <[email protected]>
SUNRPC allow for unspecified transport time in rpc_clnt_add_xprt
Olga Kornievskaia <[email protected]>
NFSv4 handle port presence in fs_location server string
Olga Kornievskaia <[email protected]>
NFSv4 expose nfs_parse_server_name function
Olga Kornievskaia <[email protected]>
NFSv4.1 query for fs_location attr on a new file system
Olga Kornievskaia <[email protected]>
NFSv4 store server support for fs_location attribute
Olga Kornievskaia <[email protected]>
NFSv4 remove zero number of fs_locations entries error check
Trond Myklebust <[email protected]>
NFSv4.1: Fix uninitialised variable in devicenotify
Xiaoke Wang <[email protected]>
nfs: nfs4clinet: check the return value of kstrdup()
Olga Kornievskaia <[email protected]>
NFSv4 only print the label when its queried
NeilBrown <[email protected]>
NFS: change nfs_access_get_cached to only report the mask
Chuck Lever <[email protected]>
NFSD: Fix the behavior of READ near OFFSET_MAX
Chuck Lever <[email protected]>
NFSD: Fix offset type in I/O trace points
Chuck Lever <[email protected]>
NFSD: Clamp WRITE offsets
Chuck Lever <[email protected]>
NFSD: Fix ia_size underflow
Chuck Lever <[email protected]>
NFSD: Fix NFSv3 SETATTR/CREATE's handling of large file sizes
Trond Myklebust <[email protected]>
NFS: Fix initialisation of nfs_client cl_flags field
Pavel Parkhomenko <[email protected]>
net: phy: marvell: Fix MDI-x polarity setting in 88e1118-compatible PHYs
Pavel Parkhomenko <[email protected]>
net: phy: marvell: Fix RGMII Tx/Rx delays setting in 88e1121-compatible PHYs
Oliver Hartkopp <[email protected]>
can: isotp: fix error path in isotp_sendmsg() to unlock wait queue
Oliver Hartkopp <[email protected]>
can: isotp: fix potential CAN frame reception race in isotp_rcv()
Jiasheng Jiang <[email protected]>
mmc: sh_mmcif: Check for null res pointer
Andrey Skvortsov <[email protected]>
mmc: core: Wait for command setting 'Power Off Notification' bit to complete
Jiasheng Jiang <[email protected]>
mmc: sdhci-of-esdhc: Check for error num after setting mask
Stefan Berger <[email protected]>
ima: Do not print policy rule with inactive LSM labels
Roberto Sassu <[email protected]>
ima: Allow template selection with ima_template[_fmt]= after ima_hash=
Stefan Berger <[email protected]>
ima: Remove ima_policy file before directory
Eric Biggers <[email protected]>
ima: fix reference leak in asymmetric_verify()
Paul Moore <[email protected]>
audit: don't deref the syscall args when checking the openat2 open_how::flags
Xiaoke Wang <[email protected]>
integrity: check the return value of audit_log_start()
-------------
Diffstat:
.../ABI/testing/sysfs-driver-aspeed-uart-routing | 6 +- Documentation/arm64/silicon-errata.rst | 12 ++ .../devicetree/bindings/arm/omap/omap.txt | 3 + Makefile | 4 +- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/imx23-evk.dts | 1 - arch/arm/boot/dts/imx6qdl-udoo.dtsi | 5 +- arch/arm/boot/dts/imx7ulp.dtsi | 2 +- arch/arm/boot/dts/meson.dtsi | 8 +- arch/arm/boot/dts/meson8.dtsi | 24 +-- arch/arm/boot/dts/meson8b.dtsi | 24 +-- arch/arm/boot/dts/omap3-beagle-ab4.dts | 47 ++++++ arch/arm/boot/dts/omap3-beagle.dts | 33 ---- arch/arm/boot/dts/ste-ux500-samsung-skomer.dts | 4 - arch/arm/mach-socfpga/Kconfig | 2 + arch/arm64/Kconfig | 82 +++++++++- .../boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 4 +- .../boot/dts/amlogic/meson-sm1-bananapi-m5.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi | 2 +- arch/arm64/boot/dts/freescale/imx8mq.dtsi | 10 +- arch/arm64/include/asm/cputype.h | 2 + arch/arm64/kernel/cpu_errata.c | 29 ++++ arch/arm64/kernel/cpufeature.c | 3 + arch/arm64/tools/cpucaps | 3 + arch/mips/cavium-octeon/octeon-memcpy.S | 2 +- arch/mips/include/asm/asm.h | 4 +- arch/mips/include/asm/ftrace.h | 4 +- arch/mips/include/asm/r4kcache.h | 4 +- arch/mips/include/asm/unaligned-emul.h | 176 ++++++++++----------- arch/mips/kernel/mips-r2-to-r6-emul.c | 104 ++++++------ arch/mips/kernel/r2300_fpu.S | 6 +- arch/mips/kernel/r4k_fpu.S | 2 +- arch/mips/kernel/relocate_kernel.S | 22 +-- arch/mips/kernel/scall32-o32.S | 10 +- arch/mips/kernel/scall64-n32.S | 2 +- arch/mips/kernel/scall64-n64.S | 2 +- arch/mips/kernel/scall64-o32.S | 10 +- arch/mips/kernel/syscall.c | 8 +- arch/mips/lib/csum_partial.S | 4 +- arch/mips/lib/memcpy.S | 4 +- arch/mips/lib/memset.S | 2 +- arch/mips/lib/strncpy_user.S | 4 +- arch/mips/lib/strnlen_user.S | 2 +- arch/powerpc/include/asm/book3s/32/pgtable.h | 1 + arch/powerpc/include/asm/book3s/64/pgtable.h | 2 + arch/powerpc/include/asm/fixmap.h | 6 +- arch/powerpc/include/asm/nohash/32/pgtable.h | 1 + arch/powerpc/include/asm/nohash/64/pgtable.h | 1 + arch/powerpc/mm/pgtable.c | 9 ++ arch/riscv/Makefile | 6 + arch/riscv/kernel/cpu-hotplug.c | 2 + arch/riscv/kernel/head.S | 11 +- arch/riscv/kernel/stacktrace.c | 9 +- arch/riscv/mm/init.c | 1 + arch/s390/Kconfig | 15 ++ arch/s390/lib/Makefile | 3 + arch/s390/lib/test_modules.c | 32 ++++ arch/s390/lib/test_modules.h | 53 +++++++ arch/s390/lib/test_modules_helpers.c | 13 ++ arch/x86/events/intel/lbr.c | 3 + arch/x86/events/rapl.c | 9 +- arch/x86/kernel/cpu/sgx/encl.c | 2 + arch/x86/kvm/cpuid.c | 13 +- arch/x86/kvm/svm/svm.c | 16 +- arch/x86/kvm/vmx/evmcs.c | 1 + arch/x86/kvm/vmx/evmcs.h | 4 +- arch/x86/kvm/vmx/vmx.c | 25 +++ drivers/accessibility/speakup/speakup_dectlk.c | 1 + drivers/acpi/arm64/iort.c | 14 +- drivers/acpi/ec.c | 10 ++ drivers/acpi/sleep.c | 15 +- drivers/base/power/wakeup.c | 41 ++++- drivers/bus/mhi/pci_generic.c | 2 + drivers/clocksource/timer-ti-dm-systimer.c | 2 +- drivers/gpio/gpio-aggregator.c | 18 ++- drivers/gpio/gpio-sifive.c | 2 +- drivers/gpio/gpiolib-cdev.c | 6 +- drivers/gpio/gpiolib-sysfs.c | 7 +- drivers/gpio/gpiolib.h | 12 ++ drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 6 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 2 +- .../drm/amd/display/dc/dcn301/dcn301_resource.c | 2 +- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 3 +- drivers/gpu/drm/bridge/nwl-dsi.c | 12 +- drivers/gpu/drm/drm_panel_orientation_quirks.c | 12 ++ drivers/gpu/drm/i915/display/intel_display.c | 1 + drivers/gpu/drm/i915/display/intel_drrs.c | 8 + drivers/gpu/drm/i915/intel_pm.c | 143 ++++++++++++++--- drivers/gpu/drm/i915/intel_pm.h | 1 + drivers/gpu/drm/panel/panel-simple.c | 1 + drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 8 +- drivers/gpu/drm/vc4/vc4_dsi.c | 14 +- drivers/gpu/drm/vc4/vc4_hdmi.c | 2 + drivers/iio/industrialio-buffer.c | 14 +- drivers/iommu/iommu.c | 9 +- drivers/irqchip/irq-realtek-rtl.c | 8 +- drivers/misc/eeprom/ee1004.c | 3 + drivers/misc/fastrpc.c | 9 +- drivers/mmc/core/sd.c | 8 +- drivers/mmc/host/sdhci-of-esdhc.c | 8 +- drivers/mmc/host/sh_mmcif.c | 3 + drivers/net/bonding/bond_3ad.c | 3 +- drivers/net/dsa/bcm_sf2.c | 7 +- drivers/net/dsa/lantiq_gswip.c | 14 +- drivers/net/dsa/mt7530.c | 2 +- drivers/net/dsa/mv88e6xxx/chip.c | 15 +- drivers/net/dsa/ocelot/felix_vsc9959.c | 4 +- drivers/net/dsa/ocelot/seville_vsc9953.c | 6 +- drivers/net/dsa/qca/ar9331.c | 3 +- drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 3 + drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 +- drivers/net/ethernet/google/gve/gve_rx.c | 1 + drivers/net/ethernet/ibm/ibmvnic.c | 13 +- drivers/net/ethernet/intel/ice/ice.h | 3 +- drivers/net/ethernet/intel/ice/ice_common.c | 3 +- drivers/net/ethernet/intel/ice/ice_lag.c | 34 +++- drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 28 +++- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 13 +- drivers/net/ethernet/litex/Kconfig | 2 +- .../net/ethernet/microchip/sparx5/sparx5_ethtool.c | 2 +- drivers/net/ethernet/mscc/ocelot.c | 19 ++- .../ethernet/netronome/nfp/flower/tunnel_conf.c | 12 +- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +- drivers/net/mdio/mdio-aspeed.c | 1 + drivers/net/phy/marvell.c | 17 +- drivers/net/usb/ax88179_178a.c | 68 ++++---- drivers/net/veth.c | 13 +- drivers/nvme/host/pci.c | 3 +- drivers/nvme/host/tcp.c | 10 +- drivers/pci/pcie/portdrv_core.c | 47 ++---- drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c | 3 +- drivers/phy/broadcom/Kconfig | 3 +- drivers/phy/phy-core-mipi-dphy.c | 4 +- drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c | 3 +- drivers/phy/st/phy-stm32-usbphyc.c | 2 +- drivers/phy/ti/phy-j721e-wiz.c | 1 + drivers/phy/xilinx/phy-zynqmp.c | 11 +- drivers/s390/cio/device.c | 2 +- drivers/scsi/lpfc/lpfc.h | 13 +- drivers/scsi/lpfc/lpfc_attr.c | 4 +- drivers/scsi/lpfc/lpfc_init.c | 2 +- drivers/scsi/lpfc/lpfc_sli.c | 8 +- drivers/scsi/myrs.c | 3 +- drivers/scsi/pm8001/pm80xx_hwi.c | 16 +- drivers/scsi/pm8001/pm80xx_hwi.h | 6 +- drivers/scsi/qedf/qedf_io.c | 1 + drivers/scsi/qedf/qedf_main.c | 7 +- drivers/scsi/ufs/ufshcd-pltfrm.c | 7 + drivers/scsi/ufs/ufshcd.c | 9 +- drivers/scsi/ufs/ufshci.h | 3 +- drivers/staging/fbtft/fbtft.h | 5 +- drivers/target/iscsi/iscsi_target_tpg.c | 3 + drivers/tee/optee/ffa_abi.c | 15 +- drivers/tee/optee/smc_abi.c | 10 -- drivers/tty/n_tty.c | 4 +- drivers/tty/vt/vt_ioctl.c | 3 +- drivers/usb/common/ulpi.c | 10 +- drivers/usb/dwc2/gadget.c | 2 +- drivers/usb/dwc3/gadget.c | 13 ++ drivers/usb/gadget/composite.c | 3 + drivers/usb/gadget/function/f_fs.c | 56 +++++-- drivers/usb/gadget/function/f_uac2.c | 4 +- drivers/usb/gadget/function/rndis.c | 9 +- drivers/usb/gadget/legacy/raw_gadget.c | 2 +- drivers/usb/gadget/udc/renesas_usb3.c | 2 + drivers/usb/serial/ch341.c | 1 + drivers/usb/serial/cp210x.c | 2 + drivers/usb/serial/ftdi_sio.c | 3 + drivers/usb/serial/ftdi_sio_ids.h | 3 + drivers/usb/serial/option.c | 2 + drivers/video/fbdev/core/fbcon.c | 7 +- fs/gfs2/file.c | 7 +- fs/gfs2/glock.c | 3 - fs/nfs/callback.h | 2 +- fs/nfs/callback_proc.c | 2 +- fs/nfs/callback_xdr.c | 18 +-- fs/nfs/client.c | 9 +- fs/nfs/dir.c | 44 ++++-- fs/nfs/nfs4_fs.h | 12 +- fs/nfs/nfs4client.c | 5 +- fs/nfs/nfs4namespace.c | 19 ++- fs/nfs/nfs4proc.c | 96 ++++++++--- fs/nfs/nfs4state.c | 6 +- fs/nfs/nfs4xdr.c | 9 +- fs/nfsd/nfs3proc.c | 13 +- fs/nfsd/nfs3xdr.c | 2 +- fs/nfsd/nfs4proc.c | 13 +- fs/nfsd/nfs4xdr.c | 8 +- fs/nfsd/trace.h | 14 +- fs/nfsd/vfs.c | 4 + fs/proc/task_mmu.c | 40 +++-- include/linux/memcontrol.h | 5 +- include/linux/nfs_fs.h | 5 +- include/linux/nfs_fs_sb.h | 2 +- include/linux/nfs_xdr.h | 1 + include/linux/suspend.h | 15 +- include/net/dst_metadata.h | 14 +- include/uapi/linux/netfilter/nf_conntrack_common.h | 2 +- kernel/auditsc.c | 2 +- kernel/events/core.c | 16 +- kernel/power/main.c | 5 +- kernel/power/process.c | 2 +- kernel/power/snapshot.c | 21 +-- kernel/power/suspend.c | 2 - kernel/sched/core.c | 23 ++- kernel/seccomp.c | 10 ++ kernel/signal.c | 5 +- lib/test_kasan.c | 5 + mm/memcontrol.c | 10 +- mm/vmscan.c | 4 +- net/can/isotp.c | 29 +++- net/dsa/dsa2.c | 25 +-- net/ipv4/ipmr.c | 2 + net/ipv4/tcp.c | 33 ++-- net/ipv6/ip6mr.c | 2 + net/mptcp/pm_netlink.c | 8 +- net/netfilter/nf_conntrack_netlink.c | 3 +- net/netfilter/nft_exthdr.c | 2 +- net/netfilter/nft_payload.c | 9 +- net/sched/sch_api.c | 2 +- net/sunrpc/clnt.c | 5 +- net/sunrpc/sysfs.c | 46 +++--- net/sunrpc/xprtsock.c | 7 +- net/tipc/name_distr.c | 2 +- scripts/Makefile.extrawarn | 1 + scripts/kconfig/confdata.c | 12 +- security/integrity/digsig_asymmetric.c | 15 +- security/integrity/ima/ima_fs.c | 2 +- security/integrity/ima/ima_policy.c | 8 + security/integrity/ima/ima_template.c | 10 +- security/integrity/integrity_audit.c | 2 + virt/kvm/eventfd.c | 8 +- 234 files changed, 1811 insertions(+), 860 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/203 integrity: check the return value of audit_log_start()
From: Xiaoke Wang <[email protected]>
commit 83230351c523b04ff8a029a4bdf97d881ecb96fc upstream.
audit_log_start() returns audit_buffer pointer on success or NULL on error, so it is better to check the return value of it.
--- security/integrity/integrity_audit.c | 2 ++ 1 file changed, 2 insertions(+)
security/integrity/integrity_audit.c +2 -0
@@ -45,6 +45,8 @@ void integrity_audit_message(int audit_mreturn ; ab =audit_log_start (audit_context (),GFP_KERNEL , audit_msgno); +if (!ab) +return ; audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u", task_pid_nr(current), from_kuid(&init_user_ns, current_uid()),
Greg Kroah-Hartman
maintainerPATCH 2/203 audit: dont deref the syscall args when checking the openat2 open_how::flags
In reply to Greg Kroah-HartmanFrom: Paul Moore <[email protected]>
commit 7a82f89de92aac5a244d3735b2bd162c1147620c upstream.
As reported by Jeff, dereferencing the openat2 syscall argument in audit_match_perm() to obtain the open_how::flags can result in an oops/page-fault. This patch fixes this by using the open_how struct that we store in the audit_context with audit_openat2_how().
Independent of this patch, Richard Guy Briggs posted a similar patch to the audit mailing list roughly 40 minutes after this patch was posted.
--- kernel/auditsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/auditsc.c +1 -1
@@ -185,7 +185,7 @@ static int audit_match_perm(struct auditcase AUDITSC_EXECVE :return mask &AUDIT_PERM_EXEC ;case AUDITSC_OPENAT2 : -return mask &ACC_MODE ((u32)((struct open_how *)ctx->argv[2 ])->flags); +return mask &ACC_MODE ((u32 )ctx->openat2.flags);default :return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 3/203 ima: fix reference leak in asymmetric_verify()
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 926fd9f23b27ca6587492c3f58f4c7f4cd01dad5 upstream.
Don't leak a reference to the key if its algorithm is unknown.
--- security/integrity/digsig_asymmetric.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
security/integrity/digsig_asymmetric.c +9 -6
@@ -109,22 +109,25 @@ int asymmetric_verify(struct key *keyrin pk =asymmetric_key_public_key (key); pks.pkey_algo = pk->pkey_algo; -if (!strcmp (pk->pkey_algo,"rsa" )) +if (!strcmp (pk->pkey_algo,"rsa" )) { pks.encoding ="pkcs1" ; -else if (!strncmp (pk->pkey_algo,"ecdsa-" ,6 )) + }else if (!strncmp (pk->pkey_algo,"ecdsa-" ,6 )) {/* edcsa-nist-p192 etc. */ pks.encoding ="x962" ; -else if (!strcmp (pk->pkey_algo,"ecrdsa" ) || - !strcmp (pk->pkey_algo,"sm2" )) + }else if (!strcmp (pk->pkey_algo,"ecrdsa" ) || + !strcmp (pk->pkey_algo,"sm2" )) { pks.encoding ="raw" ; -else -return -ENOPKG ; + }else { + ret = -ENOPKG ; + goto out; + } pks.digest = (u8 *)data; pks.digest_size = datalen; pks.s = hdr->sig; pks.s_size = siglen; ret =verify_signature (key, &pks); +out:key_put (key);pr_debug ("%s() = %d\n" , __func__, ret);return ret;
Greg Kroah-Hartman
maintainerPATCH 4/203 ima: Remove ima_policy file before directory
In reply to Greg Kroah-HartmanFrom: Stefan Berger <[email protected]>
commit f7333b9572d0559e00352a926c92f29f061b4569 upstream.
The removal of ima_dir currently fails since ima_policy still exists, so remove the ima_policy file before removing the directory.
--- security/integrity/ima/ima_fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/ima/ima_fs.c +1 -1
@@ -496,12 +496,12 @@ int __init ima_fs_init(void)return 0 ; out: +securityfs_remove (ima_policy);securityfs_remove (violations);securityfs_remove (runtime_measurements_count);securityfs_remove (ascii_runtime_measurements);securityfs_remove (binary_runtime_measurements);securityfs_remove (ima_symlink);securityfs_remove (ima_dir); -securityfs_remove (ima_policy);return -1 ; }
Greg Kroah-Hartman
maintainerPATCH 5/203 ima: Allow template selection with ima_template[_fmt]= after ima_hash=
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit bb8e52e4906f148c2faf6656b5106cf7233e9301 upstream.
Commit c2426d2ad5027 ("ima: added support for new kernel cmdline parameter ima_template_fmt") introduced an additional check on the ima_template variable to avoid multiple template selection.
Unfortunately, ima_template could be also set by the setup function of the ima_hash= parameter, when it calls ima_template_desc_current(). This causes attempts to choose a new template with ima_template= or with ima_template_fmt=, after ima_hash=, to be ignored.
Achieve the goal of the commit mentioned with the new static variable template_setup_done, so that template selection requests after ima_hash= are not ignored.
Finally, call ima_init_template_list(), if not already done, to initialize the list of templates before lookup_template_desc() is called.
--- security/integrity/ima/ima_template.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
security/integrity/ima/ima_template.c +7 -3
@@ -29,6 +29,7 @@ static struct ima_template_desc builtin_static LIST_HEAD (defined_templates);static DEFINE_SPINLOCK (template_list); +static int template_setup_done;static const struct ima_template_field supported_fields[] = { {.field_id ="d" , .field_init = ima_eventdigest_init,
@@ -101,10 +102,11 @@ static int __init ima_template_setup(chastruct ima_template_desc *template_desc;int template_len =strlen (str); -if (ima_template) +if (template_setup_done)return 1 ; -ima_init_template_list (); +if (!ima_template) +ima_init_template_list ();/* * Verify that a template with the supplied name exists.
@@ -128,6 +130,7 @@ static int __init ima_template_setup(cha } ima_template = template_desc; + template_setup_done =1 ;return 1 ; }__setup ("ima_template=" , ima_template_setup);
@@ -136,7 +139,7 @@ static int __init ima_template_fmt_setup {int num_templates =ARRAY_SIZE (builtin_templates); -if (ima_template) +if (template_setup_done)return 1 ;if (template_desc_init_fields (str,NULL ,NULL ) <0 ) {
@@ -147,6 +150,7 @@ static int __init ima_template_fmt_setup builtin_templates[num_templates -1 ].fmt = str; ima_template = builtin_templates + num_templates -1 ; + template_setup_done =1 ;return 1 ; }
Greg Kroah-Hartman
maintainerPATCH 6/203 ima: Do not print policy rule with inactive LSM labels
In reply to Greg Kroah-HartmanFrom: Stefan Berger <[email protected]>
commit 89677197ae709eb1ab3646952c44f6a171c9e74c upstream.
Before printing a policy rule scan for inactive LSM labels in the policy rule. Inactive LSM labels are identified by args_p != NULL and rule == NULL.
--- security/integrity/ima/ima_policy.c | 8 ++++++++ 1 file changed, 8 insertions(+)
security/integrity/ima/ima_policy.c +8 -0
@@ -1967,6 +1967,14 @@ int ima_policy_show(struct seq_file *m,rcu_read_lock (); +/* Do not print rules with inactive LSM labels */ +for (i =0 ; i <MAX_LSM_RULES ; i++) { +if (entry->lsm[i].args_p && !entry->lsm[i].rule) { +rcu_read_unlock (); +return 0 ; + } + } +if (entry->action &MEASURE )seq_puts (m,pt (Opt_measure));if (entry->action &DONT_MEASURE )
Greg Kroah-Hartman
maintainerPATCH 7/203 mmc: sdhci-of-esdhc: Check for error num after setting mask
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
commit 40c67c291a93f8846c4a972c9ef1b7ba4544c8d0 upstream.
Because of the possible failure of the dma_supported(), the dma_set_mask_and_coherent() may return error num.
Therefore, it should be better to check it and return the error if fails.
And since the sdhci_setup_host() has already checked the return value of the enable_dma, we need not check it in sdhci_resume_host() again.
--- drivers/mmc/host/sdhci-of-esdhc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-esdhc.c +6 -2
@@ -524,12 +524,16 @@ static void esdhc_of_adma_workaround(strstatic int esdhc_of_enable_dma (struct sdhci_host *host) { +int ret;u32 value;struct device *dev =mmc_dev (host->mmc);if (of_device_is_compatible (dev->of_node,"fsl,ls1043a-esdhc" ) || -of_device_is_compatible (dev->of_node,"fsl,ls1046a-esdhc" )) -dma_set_mask_and_coherent (dev,DMA_BIT_MASK (40 )); +of_device_is_compatible (dev->of_node,"fsl,ls1046a-esdhc" )) { + ret =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (40 )); +if (ret) +return ret; + } value =sdhci_readl (host,ESDHC_DMA_SYSCTL );
Greg Kroah-Hartman
maintainerPATCH 8/203 mmc: core: Wait for command setting Power Off Notification bit to complete
In reply to Greg Kroah-HartmanFrom: Andrey Skvortsov <[email protected]>
commit 379f56c24e698f14242f532b1d0a0f1747725e08 upstream.
SD card is allowed to signal busy on DAT0 up to 1s after the CMD49. According to SD spec (version 6.0 section 5.8.1.3) first host waits until busy of CMD49 is released and only then polls Power Management Status register up to 1s until the card indicates ready to power off.
Without waiting for busy before polling status register sometimes card becomes unresponsive and system fails to suspend:
[ 205.907459] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 206.421274] sunxi-mmc 1c0f000.mmc: data error, sending stop command [ 206.421321] sunxi-mmc 1c0f000.mmc: send stop command failed [ 206.421347] mmc0: error -110 reading status reg of PM func [ 206.421366] PM: dpm_run_callback(): mmc_bus_suspend+0x0/0x74 returns -110 [ 206.421402] mmcblk mmc0:aaaa: PM: failed to suspend async: error -110 [ 206.437064] PM: Some devices failed to suspend, or early wake event detected
Tested with Sandisk Extreme PRO A2 64GB on Allwinner A64 system.
--- drivers/mmc/core/sd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/mmc/core/sd.c +7 -1
@@ -67,7 +67,7 @@ static const unsigned int sd_au_size[] = __res & __mask; \ }) -#define SD_POWEROFF_NOTIFY_TIMEOUT_MS 2000 +#define SD_POWEROFF_NOTIFY_TIMEOUT_MS 1000#define SD_WRITE_EXTR_SINGLE_TIMEOUT_MS 1000struct sd_busy_data {
@@ -1664,6 +1664,12 @@ static int sd_poweroff_notify(struct mmc goto out; } +/* Find out when the command is completed. */ + err =mmc_poll_for_busy (card,SD_WRITE_EXTR_SINGLE_TIMEOUT_MS , false, +MMC_BUSY_EXTR_SINGLE ); +if (err) + goto out; + cb_data.card = card; cb_data.reg_buf = reg_buf; err = __mmc_poll_for_busy(card, SD_POWEROFF_NOTIFY_TIMEOUT_MS,
Greg Kroah-Hartman
maintainerPATCH 9/203 mmc: sh_mmcif: Check for null res pointer
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
commit 4d315357b3d6c315a7260420c6c6fc076e58d14b upstream.
If there is no suitable resource, platform_get_resource() will return NULL.
Therefore in order to avoid the dereference of the NULL pointer, it should be better to check the 'res'.
--- drivers/mmc/host/sh_mmcif.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mmc/host/sh_mmcif.c +3 -0
@@ -405,6 +405,9 @@ static int sh_mmcif_dma_slave_config(strstruct dma_slave_config cfg = {0 , }; res =platform_get_resource (host->pd,IORESOURCE_MEM ,0 ); +if (!res) +return -EINVAL ; + cfg.direction = direction;if (direction ==DMA_DEV_TO_MEM ) {
Greg Kroah-Hartman
maintainerPATCH 10/203 can: isotp: fix potential CAN frame reception race in isotp_rcv()
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
commit 7c759040c1dd03954f650f147ae7175476d51314 upstream.
When receiving a CAN frame the current code logic does not consider concurrently receiving processes which do not show up in real world usage.
Ziyang Xuan writes:
The following syz problem is one of the scenarios. so->rx.len is changed by isotp_rcv_ff() during isotp_rcv_cf(), so->rx.len equals 0 before alloc_skb() and equals 4096 after alloc_skb(). That will trigger skb_over_panic() in skb_put().
=======================================================
CPU: 1 PID: 19 Comm: ksoftirqd/1 Not tainted 5.16.0-rc8-syzkaller #0 RIP: 0010:skb_panic+0x16c/0x16e net/core/skbuff.c:113 Call Trace: <TASK> skb_over_panic net/core/skbuff.c:118 [inline] skb_put.cold+0x24/0x24 net/core/skbuff.c:1990 isotp_rcv_cf net/can/isotp.c:570 [inline] isotp_rcv+0xa38/0x1e30 net/can/isotp.c:668 deliver net/can/af_can.c:574 [inline] can_rcv_filter+0x445/0x8d0 net/can/af_can.c:635 can_receive+0x31d/0x580 net/can/af_can.c:665 can_rcv+0x120/0x1c0 net/can/af_can.c:696 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5465 __netif_receive_skb+0x24/0x1b0 net/core/dev.c:5579
Therefore we make sure the state changes and data structures stay consistent at CAN frame reception time by adding a spin_lock in isotp_rcv(). This fixes the issue reported by syzkaller but does not affect real world operation.
--- net/can/isotp.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
net/can/isotp.c +13 -1
@@ -56,6 +56,7 @@#include <linux/module.h> #include <linux/init.h> #include <linux/interrupt.h> +#include <linux/spinlock.h> #include <linux/hrtimer.h> #include <linux/wait.h> #include <linux/uio.h>
@@ -145,6 +146,7 @@ struct isotp_sock {struct tpcon rx, tx;struct list_head notifier;wait_queue_head_t wait; +spinlock_t rx_lock;/* protect single thread state machine */ };static LIST_HEAD (isotp_notifier_list);
@@ -615,11 +617,17 @@ static void isotp_rcv(struct sk_buff *sk n_pci_type = cf->data[ae] &0xF0 ; +/* Make sure the state changes and data structures stay consistent at +* CAN frame reception time. This locking is not needed in real world +* use cases but the inconsistency can be triggered with syzkaller. +*/ +spin_lock (&so->rx_lock); +if (so->opt.flags &CAN_ISOTP_HALF_DUPLEX ) {/* check rx/tx path half duplex expectations */ if ((so->tx.state !=ISOTP_IDLE && n_pci_type !=N_PCI_FC ) || (so->rx.state !=ISOTP_IDLE && n_pci_type ==N_PCI_FC )) -return ; + goto out_unlock; }switch (n_pci_type) {
@@ -668,6 +676,9 @@ static void isotp_rcv(struct sk_buff *skisotp_rcv_cf (sk, cf, ae, skb);break ; } + +out_unlock: +spin_unlock (&so->rx_lock); } static void isotp_fill_dataframe(struct canfd_frame *cf, struct isotp_sock *so,
@@ -1444,6 +1455,7 @@ static int isotp_init(struct sock *sk) so->txtimer.function = isotp_tx_timer_handler;init_waitqueue_head (&so->wait); +spin_lock_init (&so->rx_lock);spin_lock (&isotp_notifier_lock);list_add_tail (&so->notifier, &isotp_notifier_list);
Greg Kroah-Hartman
maintainerPATCH 11/203 can: isotp: fix error path in isotp_sendmsg() to unlock wait queue
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
commit 8375dfac4f683e1b2c5956d919d36aeedad46699 upstream.
Commit 43a08c3bdac4 ("can: isotp: isotp_sendmsg(): fix TX buffer concurrent access in isotp_sendmsg()") introduced a new locking scheme that may render the userspace application in a locking state when an error is detected. This issue shows up under high load on simultaneously running isotp channels with identical configuration which is against the ISO specification and therefore breaks any reasonable PDU communication anyway.
--- net/can/isotp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
net/can/isotp.c +9 -6
@@ -887,7 +887,7 @@ static int isotp_sendmsg(struct socket *if (!size || size >MAX_MSG_LENGTH ) { err = -EINVAL ; - goto err_out; + goto err_out_drop; }/* take care of a potential SF_DL ESC offset for TX_DL > 8 */
@@ -897,24 +897,24 @@ static int isotp_sendmsg(struct socket *if ((so->opt.flags &CAN_ISOTP_SF_BROADCAST ) && (size > so->tx.ll_dl -SF_PCI_SZ4 - ae - off)) { err = -EINVAL ; - goto err_out; + goto err_out_drop; } err =memcpy_from_msg (so->tx.buf, msg, size);if (err <0 ) - goto err_out; + goto err_out_drop; dev =dev_get_by_index (sock_net (sk), so->ifindex);if (!dev) { err = -ENXIO ; - goto err_out; + goto err_out_drop; } skb =sock_alloc_send_skb (sk, so->ll.mtu +sizeof (struct can_skb_priv ), msg->msg_flags &MSG_DONTWAIT , &err);if (!skb) {dev_put (dev); - goto err_out; + goto err_out_drop; }can_skb_reserve (skb);
@@ -976,7 +976,7 @@ static int isotp_sendmsg(struct socket *if (err) {pr_notice_once ("can-isotp: %s: can_send_ret %pe\n" , __func__,ERR_PTR (err)); - goto err_out; + goto err_out_drop; }if (wait_tx_done) {
@@ -989,6 +989,9 @@ static int isotp_sendmsg(struct socket *return size; +err_out_drop: +/* drop this PDU and unlock a potential wait queue */ + old_state =ISOTP_IDLE ; err_out: so->tx.state = old_state;if (so->tx.state ==ISOTP_IDLE )
Greg Kroah-Hartman
maintainerPATCH 12/203 net: phy: marvell: Fix RGMII Tx/Rx delays setting in 88e1121-compatible PHYs
In reply to Greg Kroah-HartmanFrom: Pavel Parkhomenko <[email protected]>
commit fe4f57bf7b585dca58f1496c4e2481ecbae18126 upstream.
It is mandatory for a software to issue a reset upon modifying RGMII Receive Timing Control and RGMII Transmit Timing Control bit fields of MAC Specific Control register 2 (page 2, register 21) otherwise the changes won't be perceived by the PHY (the same is applicable for a lot of other registers). Not setting the RGMII delays on the platforms that imply it' being done on the PHY side will consequently cause the traffic loss. We discovered that the denoted soft-reset is missing in the m88e1121_config_aneg() method for the case if the RGMII delays are modified but the MDIx polarity isn't changed or the auto-negotiation is left enabled, thus causing the traffic loss on our platform with Marvell Alaska 88E1510 installed. Let's fix that by issuing the soft-reset if the delays have been actually set in the m88e1121_config_aneg_rgmii_delays() method.
--- drivers/net/phy/marvell.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/phy/marvell.c +6 -4
@@ -553,9 +553,9 @@ static int m88e1121_config_aneg_rgmii_deelse mscr =0 ; -return phy_modify_paged (phydev,MII_MARVELL_MSCR_PAGE , -MII_88E1121_PHY_MSCR_REG , -MII_88E1121_PHY_MSCR_DELAY_MASK , mscr); +return phy_modify_paged_changed (phydev,MII_MARVELL_MSCR_PAGE , +MII_88E1121_PHY_MSCR_REG , +MII_88E1121_PHY_MSCR_DELAY_MASK , mscr); }static int m88e1121_config_aneg (struct phy_device *phydev)
@@ -569,11 +569,13 @@ static int m88e1121_config_aneg(struct preturn err; } + changed = err; + err =marvell_set_polarity (phydev, phydev->mdix_ctrl);if (err <0 )return err; - changed = err; + changed |= err; err =genphy_config_aneg (phydev);if (err <0 )
Greg Kroah-Hartman
maintainerPATCH 13/203 net: phy: marvell: Fix MDI-x polarity setting in 88e1118-compatible PHYs
In reply to Greg Kroah-HartmanFrom: Pavel Parkhomenko <[email protected]>
commit aec12836e7196e4d360b2cbf20cf7aa5139ad2ec upstream.
When setting up autonegotiation for 88E1118R and compatible PHYs, a software reset of PHY is issued before setting up polarity. This is incorrect as changes of MDI Crossover Mode bits are disruptive to the normal operation and must be followed by a software reset to take effect. Let's patch m88e1118_config_aneg() to fix the issue mentioned before by invoking software reset of the PHY just after setting up MDI-x polarity.
--- drivers/net/phy/marvell.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/phy/marvell.c +3 -4
@@ -1215,16 +1215,15 @@ static int m88e1118_config_aneg(struct p {int err; - err =genphy_soft_reset (phydev); + err =marvell_set_polarity (phydev, phydev->mdix_ctrl);if (err <0 )return err; - err =marvell_set_polarity (phydev, phydev->mdix_ctrl); + err =genphy_config_aneg (phydev);if (err <0 )return err; - err =genphy_config_aneg (phydev); -return 0 ; +return genphy_soft_reset (phydev); }static int m88e1118_config_init (struct phy_device *phydev)
Greg Kroah-Hartman
maintainerPATCH 14/203 NFS: Fix initialisation of nfs_client cl_flags field
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit 468d126dab45718feeb728319be20bd869a5eaa7 upstream.
For some long forgotten reason, the nfs_client cl_flags field is initialised in nfs_get_client() instead of being initialised at allocation time. This quirk was harmless until we moved the call to nfs_create_rpc_client().
--- fs/nfs/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/client.c +1 -1
@@ -177,6 +177,7 @@ struct nfs_client *nfs_alloc_client(consINIT_LIST_HEAD (&clp->cl_superblocks); clp->cl_rpcclient =ERR_PTR (-EINVAL ); + clp->cl_flags = cl_init->init_flags; clp->cl_proto = cl_init->proto; clp->cl_nconnect = cl_init->nconnect; clp->cl_max_connect = cl_init->max_connect ? cl_init->max_connect :1 ;
@@ -427,7 +428,6 @@ struct nfs_client *nfs_get_client(constlist_add_tail (&new->cl_share_link, &nn->nfs_client_list);spin_unlock (&nn->nfs_client_lock); - new->cl_flags = cl_init->init_flags;return rpc_ops->init_client (new, cl_init); }
Greg Kroah-Hartman
maintainerPATCH 15/203 NFSD: Fix NFSv3 SETATTR/CREATEs handling of large file sizes
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
commit a648fdeb7c0e17177a2280344d015dba3fbe3314 upstream.
iattr::ia_size is a loff_t, so these NFSv3 procedures must be careful to deal with incoming client size values that are larger than s64_max without corrupting the value.
Silently capping the value results in storing a different value than the client passed in which is unexpected behavior, so remove the min_t() check in decode_sattr3().
Note that RFC 1813 permits only the WRITE procedure to return NFS3ERR_FBIG. We believe that NFSv3 reference implementations also return NFS3ERR_FBIG when ia_size is too large.
--- fs/nfsd/nfs3xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs3xdr.c +1 -1
@@ -254,7 +254,7 @@ svcxdr_decode_sattr3(struct svc_rqst *rqif (xdr_stream_decode_u64 (xdr, &newsize) <0 )return false; iap->ia_valid |=ATTR_SIZE ; - iap->ia_size =min_t (u64, newsize,NFS_OFFSET_MAX ); + iap->ia_size = newsize; }if (xdr_stream_decode_u32 (xdr, &set_it) <0 )return false;
Greg Kroah-Hartman
maintainerPATCH 16/203 NFSD: Fix ia_size underflow
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
commit e6faac3f58c7c4176b66f63def17a34232a17b0e upstream.
iattr::ia_size is a loff_t, which is a signed 64-bit type. NFSv3 and NFSv4 both define file size as an unsigned 64-bit type. Thus there is a range of valid file size values an NFS client can send that is already larger than Linux can handle.
Currently decode_fattr4() dumps a full u64 value into ia_size. If that value happens to be larger than S64_MAX, then ia_size underflows. I'm about to fix up the NFSv3 behavior as well, so let's catch the underflow in the common code path: nfsd_setattr().
--- fs/nfsd/vfs.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/nfsd/vfs.c +4 -0
@@ -434,6 +434,10 @@ nfsd_setattr(struct svc_rqst *rqstp, str .ia_size = iap->ia_size, }; + host_err = -EFBIG ; +if (iap->ia_size <0 ) + goto out_unlock; + host_err =notify_change (&init_user_ns, dentry, &size_attr,NULL );if (host_err) goto out_unlock;
Greg Kroah-Hartman
maintainerPATCH 17/203 NFSD: Clamp WRITE offsets
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
commit 6260d9a56ab352b54891ec66ab0eced57d55abc6 upstream.
Ensure that a client cannot specify a WRITE range that falls in a byte range outside what the kernel's internal types (such as loff_t, which is signed) can represent. The kiocb iterators, invoked in nfsd_vfs_write(), should properly limit write operations to within the underlying file system's s_maxbytes.
--- fs/nfsd/nfs3proc.c | 5 +++++ fs/nfsd/nfs4proc.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-)
fs/nfsd/nfs3proc.c +5 -0
@@ -199,6 +199,11 @@ nfsd3_proc_write(struct svc_rqst *rqstp) (unsigned long long ) argp->offset, argp->stable? " stable" : ""); + resp->status = nfserr_fbig; +if (argp->offset > (u64 )OFFSET_MAX || + argp->offset + argp->len > (u64 )OFFSET_MAX ) +return rpc_success; +fh_copy (&resp->fh, &argp->fh); resp->committed = argp->stable; nvecs =svc_fill_write_vector (rqstp, &argp->payload);
fs/nfsd/nfs4proc.c +3 -2
@@ -1018,8 +1018,9 @@ nfsd4_write(struct svc_rqst *rqstp, struunsigned long cnt;int nvecs; -if (write->wr_offset >=OFFSET_MAX ) -return nfserr_inval; +if (write->wr_offset > (u64 )OFFSET_MAX || + write->wr_offset + write->wr_buflen > (u64 )OFFSET_MAX ) +return nfserr_fbig; cnt = write->wr_buflen; trace_nfsd_write_start(rqstp, &cstate->current_fh,
Greg Kroah-Hartman
maintainerPATCH 18/203 NFSD: Fix offset type in I/O trace points
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
commit 6a4d333d540041d244b2fca29b8417bfde20af81 upstream.
NFSv3 and NFSv4 use u64 offset values on the wire. Record these values verbatim without the implicit type case to loff_t.
--- fs/nfsd/trace.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/nfsd/trace.h +7 -7
@@ -320,14 +320,14 @@ TRACE_EVENT(nfsd_export_update, DECLARE_EVENT_CLASS(nfsd_io_class, TP_PROTO(struct svc_rqst *rqstp, struct svc_fh *fhp, - loff_t offset, - unsigned long len), + u64 offset, + u32 len), TP_ARGS(rqstp, fhp, offset, len), TP_STRUCT__entry( __field(u32, xid) __field(u32, fh_hash) - __field(loff_t, offset) - __field(unsigned long, len) + __field(u64, offset) + __field(u32, len) ), TP_fast_assign( __entry->xid = be32_to_cpu(rqstp->rq_xid);
@@ -335,7 +335,7 @@ DECLARE_EVENT_CLASS(nfsd_io_class, __entry->offset = offset; __entry->len = len; ), -TP_printk ("xid=0x%08x fh_hash=0x%08x offset=%lld len=%lu" , +TP_printk ("xid=0x%08x fh_hash=0x%08x offset=%llu len=%u" , __entry->xid, __entry->fh_hash, __entry->offset, __entry->len) )
@@ -344,8 +344,8 @@ DECLARE_EVENT_CLASS(nfsd_io_class, DEFINE_EVENT(nfsd_io_class, nfsd_##name, \ TP_PROTO(struct svc_rqst *rqstp, \ struct svc_fh *fhp, \ - loff_t offset, \ - unsigned long len), \ + u64 offset, \ + u32 len), \ TP_ARGS(rqstp, fhp, offset, len))DEFINE_NFSD_IO_EVENT (read_start);
Greg Kroah-Hartman
maintainerPATCH 19/203 NFSD: Fix the behavior of READ near OFFSET_MAX
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
commit 0cb4d23ae08c48f6bf3c29a8e5c4a74b8388b960 upstream.
Dan Aloni reports:
Quoted 9 lines
Due to commit
8cfb9015280d("NFS: Always provide aligned buffers to the RPC read layers") on the client, a read of0xfffis aligned up to server rsize of0x1000.As a result, in a test where the server has a file of size
0x7fffffffffffffff, and the client tries to read from the offset0x7ffffffffffff000, the read causesloff_toverflow in the server and it returns an NFS code of EINVAL to the client. The client as a result indefinitely retries the request.
The Linux NFS client does not handle NFS?ERR_INVAL, even though all NFS specifications permit servers to return that status code for a READ.
Instead of NFS?ERR_INVAL, have out-of-range READ requests succeed and return a short result. Set the EOF flag in the result to prevent the client from retrying the READ request. This behavior appears to be consistent with Solaris NFS servers.
Note that NFSv3 and NFSv4 use u64 offset values on the wire. These must be converted to loff_t internally before use -- an implicit type cast is not adequate for this purpose. Otherwise VFS checks against sb->s_maxbytes do not work properly.
--- fs/nfsd/nfs3proc.c | 8 ++++++-- fs/nfsd/nfs4proc.c | 8 ++++++-- fs/nfsd/nfs4xdr.c | 8 ++------ 3 files changed, 14 insertions(+), 10 deletions(-)
fs/nfsd/nfs3proc.c +6 -2
@@ -150,13 +150,17 @@ nfsd3_proc_read(struct svc_rqst *rqstp)unsigned int len;int v; - argp->count =min_t (u32, argp->count, max_blocksize); -dprintk ("nfsd: READ(3) %s %lu bytes at %Lu\n" ,SVCFH_fmt (&argp->fh), (unsigned long ) argp->count, (unsigned long long ) argp->offset); + argp->count =min_t (u32, argp->count, max_blocksize); +if (argp->offset > (u64 )OFFSET_MAX ) + argp->offset = (u64 )OFFSET_MAX ; +if (argp->offset + argp->count > (u64 )OFFSET_MAX ) + argp->count = (u64 )OFFSET_MAX - argp->offset; + v =0 ; len = argp->count; resp->pages = rqstp->rq_next_page;
fs/nfsd/nfs4proc.c +6 -2
@@ -782,12 +782,16 @@ nfsd4_read(struct svc_rqst *rqstp, struc__be32 status; read->rd_nf =NULL ; -if (read->rd_offset >=OFFSET_MAX ) -return nfserr_inval;trace_nfsd_read_start (rqstp, &cstate->current_fh, read->rd_offset, read->rd_length); + read->rd_length =min_t (u32, read->rd_length,svc_max_payload (rqstp)); +if (read->rd_offset > (u64 )OFFSET_MAX ) + read->rd_offset = (u64 )OFFSET_MAX ; +if (read->rd_offset + read->rd_length > (u64 )OFFSET_MAX ) + read->rd_length = (u64 )OFFSET_MAX - read->rd_offset; +/* * If we do a zero copy read, then a client will see read data * that reflects the state of the file *after* performing the
fs/nfsd/nfs4xdr.c +2 -6
@@ -3997,10 +3997,8 @@ nfsd4_encode_read(struct nfsd4_compoundr }xdr_commit_encode (xdr); - maxcount =svc_max_payload (resp->rqstp); - maxcount = min_t(unsigned long, maxcount, + maxcount = min_t(unsigned long, read->rd_length, (xdr->buf->buflen - xdr->buf->len)); - maxcount = min_t(unsigned long, maxcount, read->rd_length);if (file->f_op->splice_read &&test_bit (RQ_SPLICE_OK , &resp->rqstp->rq_flags))
@@ -4837,10 +4835,8 @@ nfsd4_encode_read_plus(struct nfsd4_compreturn nfserr_resource;xdr_commit_encode (xdr); - maxcount =svc_max_payload (resp->rqstp); - maxcount = min_t(unsigned long, maxcount, + maxcount = min_t(unsigned long, read->rd_length, (xdr->buf->buflen - xdr->buf->len)); - maxcount = min_t(unsigned long, maxcount, read->rd_length); count = maxcount; eof = read->rd_offset >=i_size_read (file_inode (file));
Greg Kroah-Hartman
maintainerPATCH 20/203 NFS: change nfs_access_get_cached to only report the mask
In reply to Greg Kroah-HartmanFrom: NeilBrown <[email protected]>
[ Upstream commit b5e7b59c3480f355910f9d2c6ece5857922a5e54 ]
Currently the nfs_access_get_cached family of functions report a 'struct nfs_access_entry' as the result, with both .mask and .cred set. However the .cred is never used. This is probably good and there is no guarantee that it won't be freed before use.
Change to only report the 'mask' - as this is all that is used or needed.
--- fs/nfs/dir.c | 20 +++++++++----------- fs/nfs/nfs4proc.c | 18 +++++++++--------- include/linux/nfs_fs.h | 4 ++-- 3 files changed, 20 insertions(+), 22 deletions(-)
fs/nfs/dir.c +9 -11
@@ -2695,7 +2695,7 @@ static struct nfs_access_entry *nfs_access_search_rbtree(struct inode *inode, coreturn NULL ; } -static int nfs_access_get_cached_locked (struct inode *inode,const struct cred *cred,struct nfs_access_entry *res,bool may_block) +static int nfs_access_get_cached_locked (struct inode *inode,const struct cred *cred,u32 *mask,bool may_block) {struct nfs_inode *nfsi =NFS_I (inode);struct nfs_access_entry *cache;
@@ -2725,8 +2725,7 @@ static int nfs_access_get_cached_locked(struct inode *inode, const struct cred *spin_lock (&inode->i_lock); retry = false; } - res->cred = cache->cred; - res->mask = cache->mask; + *mask = cache->mask;list_move_tail (&cache->lru, &nfsi->access_cache_entry_lru); err =0 ; out:
@@ -2738,7 +2737,7 @@ static int nfs_access_get_cached_locked(struct inode *inode, const struct cred *return -ENOENT ; } -static int nfs_access_get_cached_rcu (struct inode *inode,const struct cred *cred,struct nfs_access_entry *res) +static int nfs_access_get_cached_rcu (struct inode *inode,const struct cred *cred,u32 *mask) {/* Only check the most recently returned cache entry, * but do it without locking.
@@ -2760,22 +2759,21 @@ static int nfs_access_get_cached_rcu(struct inode *inode, const struct cred *cre goto out;if (nfs_check_cache_invalid (inode,NFS_INO_INVALID_ACCESS )) goto out; - res->cred = cache->cred; - res->mask = cache->mask; + *mask = cache->mask; err =0 ; out:rcu_read_unlock ();return err; } -int nfs_access_get_cached (struct inode *inode,const struct cred *cred,struct -nfs_access_entry *res,bool may_block) +int nfs_access_get_cached (struct inode *inode,const struct cred *cred, +u32 *mask,bool may_block) {int status; - status =nfs_access_get_cached_rcu (inode, cred, res); + status =nfs_access_get_cached_rcu (inode, cred, mask);if (status !=0 ) - status =nfs_access_get_cached_locked (inode, cred, res, + status =nfs_access_get_cached_locked (inode, cred, mask, may_block);return status;
@@ -2896,7 +2894,7 @@ static int nfs_do_access(struct inode *inode, const struct cred *cred, int mask)trace_nfs_access_enter (inode); - status =nfs_access_get_cached (inode, cred, &cache, may_block); + status =nfs_access_get_cached (inode, cred, &cache.mask, may_block);if (status ==0 ) goto out_cached;
fs/nfs/nfs4proc.c +9 -9
@@ -7611,7 +7611,7 @@ static int nfs4_xattr_set_nfs4_user(const struct xattr_handler *handler, const char *key, const void *buf, size_t buflen, int flags) { - struct nfs_access_entry cache; + u32 mask;int ret;if (!nfs_server_capable (inode,NFS_CAP_XATTR ))
@@ -7626,8 +7626,8 @@ static int nfs4_xattr_set_nfs4_user(const struct xattr_handler *handler,* do a cached access check for the XA* flags to possibly avoid * doing an RPC and getting EACCES back. */ -if (!nfs_access_get_cached (inode,current_cred (), &cache, true)) { -if (!(cache.mask &NFS_ACCESS_XAWRITE )) +if (!nfs_access_get_cached (inode,current_cred (), &mask, true)) { +if (!(mask &NFS_ACCESS_XAWRITE ))return -EACCES ; }
@@ -7648,14 +7648,14 @@ static int nfs4_xattr_get_nfs4_user(const struct xattr_handler *handler, struct dentry *unused, struct inode *inode, const char *key, void *buf, size_t buflen) { - struct nfs_access_entry cache; + u32 mask;ssize_t ret;if (!nfs_server_capable (inode,NFS_CAP_XATTR ))return -EOPNOTSUPP ; -if (!nfs_access_get_cached (inode,current_cred (), &cache, true)) { -if (!(cache.mask &NFS_ACCESS_XAREAD )) +if (!nfs_access_get_cached (inode,current_cred (), &mask, true)) { +if (!(mask &NFS_ACCESS_XAREAD ))return -EACCES ; }
@@ -7680,13 +7680,13 @@ nfs4_listxattr_nfs4_user(struct inode *inode, char *list, size_t list_len)ssize_t ret, size;char *buf;size_t buflen; -struct nfs_access_entry cache; +u32 mask;if (!nfs_server_capable (inode,NFS_CAP_XATTR ))return 0 ; -if (!nfs_access_get_cached (inode,current_cred (), &cache, true)) { -if (!(cache.mask &NFS_ACCESS_XALIST )) +if (!nfs_access_get_cached (inode,current_cred (), &mask, true)) { +if (!(mask &NFS_ACCESS_XALIST ))return 0 ; }
include/linux/nfs_fs.h +2 -2
@@ -533,8 +533,8 @@ extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr);extern int nfs_may_open (struct inode *inode,const struct cred *cred,int openflags);extern void nfs_access_zap_cache (struct inode *inode); -extern int nfs_access_get_cached (struct inode *inode,const struct cred *cred,struct nfs_access_entry *res, -bool may_block); +extern int nfs_access_get_cached (struct inode *inode,const struct cred *cred, +u32 *mask,bool may_block);/* * linux/fs/nfs/symlink.c
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 21/203 NFSv4 only print the label when its queried
In reply to Greg Kroah-HartmanFrom: Olga Kornievskaia <[email protected]>
[ Upstream commit 2c52c8376db7160a1dd8a681c61c9258405ef143 ]
When the bitmask of the attributes doesn't include the security label, don't bother printing it. Since the label might not be null terminated, adjust the printing format accordingly.
--- fs/nfs/nfs4xdr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/nfs/nfs4xdr.c +4 -3
@@ -4200,10 +4200,11 @@ static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap, }else printk (KERN_WARNING "%s: label too long (%u)!\n" , __func__, len); +if (label && label->label) +dprintk ("%s: label=%.*s, len=%d, PI=%d, LFS=%d\n" , + __func__, label->len, (char *)label->label, + label->len, label->pi, label->lfs); } -if (label && label->label) -dprintk ("%s: label=%s, len=%d, PI=%d, LFS=%d\n" , __func__, - (char *)label->label, label->len, label->pi, label->lfs);return status; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 22/203 nfs: nfs4clinet: check the return value of kstrdup()
In reply to Greg Kroah-HartmanFrom: Xiaoke Wang <[email protected]>
[ Upstream commit fbd2057e5329d3502a27491190237b6be52a1cb6 ]
kstrdup() returns NULL when some internal memory errors happen, it is better to check the return value of it so to catch the memory error in time.
--- fs/nfs/nfs4client.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nfs/nfs4client.c +4 -1
@@ -1343,8 +1343,11 @@ int nfs4_update_server(struct nfs_server *server, const char *hostname, }nfs_put_client (clp); -if (server->nfs_client->cl_hostname ==NULL ) +if (server->nfs_client->cl_hostname ==NULL ) { server->nfs_client->cl_hostname =kstrdup (hostname,GFP_KERNEL ); +if (server->nfs_client->cl_hostname ==NULL ) +return -ENOMEM ; + }nfs_server_insert_lists (server);return nfs_probe_server (server,NFS_FH (d_inode (server->super->s_root)));
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 23/203 NFSv4.1: Fix uninitialised variable in devicenotify
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit b05bf5c63b326ce1da84ef42498d8e0e292e694c ]
When decode_devicenotify_args() exits with no entries, we need to ensure that the struct cb_devicenotifyargs is initialised to { 0, NULL } in order to avoid problems in nfs4_callback_devicenotify().
--- fs/nfs/callback.h | 2 +- fs/nfs/callback_proc.c | 2 +- fs/nfs/callback_xdr.c | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-)
fs/nfs/callback.h +1 -1
@@ -170,7 +170,7 @@ struct cb_devicenotifyitem { };struct cb_devicenotifyargs { -int ndevs; +uint32_t ndevs;struct cb_devicenotifyitem *devs; };
fs/nfs/callback_proc.c +1 -1
@@ -358,7 +358,7 @@ __be32 nfs4_callback_devicenotify(void *argp, void *resp, struct cb_process_state *cps) {struct cb_devicenotifyargs *args = argp; -int i; +uint32_t i;__be32 res =0 ;struct nfs_client *clp = cps->clp;struct nfs_server *server =NULL ;
fs/nfs/callback_xdr.c +9 -9
@@ -258,11 +258,9 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp, void *argp) {struct cb_devicenotifyargs *args = argp; +uint32_t tmp, n, i;__be32 *p;__be32 status =0 ; -u32 tmp; -int n, i; - args->ndevs =0 ;/* Num of device notifications */ p =xdr_inline_decode (xdr,sizeof (uint32_t ));
@@ -271,7 +269,7 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp, goto out; } n =ntohl (*p++); -if (n <=0 ) +if (n ==0 ) goto out;if (n >ULONG_MAX /sizeof (*args->devs)) { status =htonl (NFS4ERR_BADXDR );
@@ -330,19 +328,21 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp, dev->cbd_immediate =0 ; } - args->ndevs++; -dprintk ("%s: type %d layout 0x%x immediate %d\n" , __func__, dev->cbd_notify_type, dev->cbd_layout_type, dev->cbd_immediate); } + args->ndevs = n; +dprintk ("%s: ndevs %d\n" , __func__, args->ndevs); +return 0 ; +err: +kfree (args->devs); out: + args->devs =NULL ; + args->ndevs =0 ;dprintk ("%s: status %d ndevs %d\n" , __func__,ntohl (status), args->ndevs);return status; -err: -kfree (args->devs); - goto out; } static __be32 decode_sessionid(struct xdr_stream *xdr,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 24/203 NFSv4 remove zero number of fs_locations entries error check
In reply to Greg Kroah-HartmanFrom: Olga Kornievskaia <[email protected]>
[ Upstream commit 90e12a3191040bd3854d3e236c35921e4e92a044 ]
Remove the check for the zero length fs_locations reply in the xdr decoding, and instead check for that in the migration code.
--- fs/nfs/nfs4state.c | 3 +++ fs/nfs/nfs4xdr.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-)
fs/nfs/nfs4state.c +3 -0
@@ -2106,6 +2106,9 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred } result = -NFS4ERR_NXIO ; +if (!locations->nlocations) + goto out; +if (!(locations->fattr.valid &NFS_ATTR_FATTR_V4_LOCATIONS )) {dprintk ("<-- %s: No fs_locations data, migration skipped\n" , __func__);
fs/nfs/nfs4xdr.c +0 -2
@@ -3696,8 +3696,6 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, stif (unlikely (!p)) goto out_eio; n =be32_to_cpup (p); -if (n <=0 ) - goto out_eio;for (res->nlocations =0 ; res->nlocations < n; res->nlocations++) {u32 m;struct nfs4_fs_location *loc;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 25/203 NFSv4 store server support for fs_location attribute
In reply to Greg Kroah-HartmanFrom: Olga Kornievskaia <[email protected]>
[ Upstream commit 8a59bb93b7e3cca389af44781a429ac12ac49be6 ]
Define and store if server returns it supports fs_locations attribute as a capability.
--- fs/nfs/nfs4proc.c | 2 ++ include/linux/nfs_fs_sb.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
fs/nfs/nfs4proc.c +2 -0
@@ -3874,6 +3874,8 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fif (res.attr_bitmask[2 ] &FATTR4_WORD2_SECURITY_LABEL ) server->caps |=NFS_CAP_SECURITY_LABEL ;#endif +if (res.attr_bitmask[0 ] &FATTR4_WORD0_FS_LOCATIONS ) + server->caps |=NFS_CAP_FS_LOCATIONS ;if (!(res.attr_bitmask[0 ] &FATTR4_WORD0_FILEID )) server->fattr_valid &= ~NFS_ATTR_FATTR_FILEID ;if (!(res.attr_bitmask[1 ] &FATTR4_WORD1_MODE ))
include/linux/nfs_fs_sb.h +1 -1
@@ -287,5 +287,5 @@ struct nfs_server {#define NFS_CAP_COPY_NOTIFY (1U << 27)#define NFS_CAP_XATTR (1U << 28)#define NFS_CAP_READ_PLUS (1U << 29) - +#define NFS_CAP_FS_LOCATIONS (1U << 30)#endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 26/203 NFSv4.1 query for fs_location attr on a new file system
In reply to Greg Kroah-HartmanFrom: Olga Kornievskaia <[email protected]>
[ Upstream commit 1976b2b31462151403c9fc110204fcc2a77bdfd1 ]
Query the server for other possible trunkable locations for a given file system on a 4.1+ mount.
v2:
-- added missing static to nfs4_discover_trunking, reported by the kernel test robot
--- fs/nfs/client.c | 7 ++++ fs/nfs/nfs4_fs.h | 9 ++--- fs/nfs/nfs4proc.c | 76 +++++++++++++++++++++++++++++++++++------ fs/nfs/nfs4state.c | 3 +- include/linux/nfs_xdr.h | 1 + 5 files changed, 81 insertions(+), 15 deletions(-)
fs/nfs/client.c +7 -0
@@ -860,6 +860,13 @@ static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, str server->namelen = pathinfo.max_namelen; } +if (clp->rpc_ops->discover_trunking !=NULL && + (server->caps &NFS_CAP_FS_LOCATIONS )) { + error = clp->rpc_ops->discover_trunking (server, mntfh); +if (error <0 ) +return error; + } +return 0 ; }
fs/nfs/nfs4_fs.h +5 -4
@@ -260,8 +260,8 @@ struct nfs4_state_maintenance_ops { };struct nfs4_mig_recovery_ops { -int (*get_locations)(struct inode *,struct nfs4_fs_locations *, -struct page *,const struct cred *); +int (*get_locations)(struct nfs_server *,struct nfs_fh *, +struct nfs4_fs_locations *,struct page *,const struct cred *);int (*fsid_present)(struct inode *,const struct cred *); };
@@ -302,8 +302,9 @@ extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait);extern int nfs4_server_capabilities (struct nfs_server *server,struct nfs_fh *fhandle);extern int nfs4_proc_fs_locations (struct rpc_clnt *,struct inode *,const struct qstr *,struct nfs4_fs_locations *,struct page *); -extern int nfs4_proc_get_locations (struct inode *,struct nfs4_fs_locations *, -struct page *page,const struct cred *); +extern int nfs4_proc_get_locations (struct nfs_server *,struct nfs_fh *, +struct nfs4_fs_locations *, +struct page *page,const struct cred *);extern int nfs4_proc_fsid_present (struct inode *,const struct cred *); extern struct rpc_clnt *nfs4_proc_lookup_mountpoint(struct inode *, struct dentry *,
fs/nfs/nfs4proc.c +66 -10
134 lines not on this page · raw message
fs/nfs/nfs4state.c +2 -1
@@ -2098,7 +2098,8 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred } inode =d_inode (server->super->s_root); - result =nfs4_proc_get_locations (inode, locations, page, cred); + result =nfs4_proc_get_locations (server,NFS_FH (inode), locations, + page, cred);if (result) {dprintk ("<-- %s: failed to retrieve fs_locations: %d\n" , __func__, result);
include/linux/nfs_xdr.h +1 -0
@@ -1795,6 +1795,7 @@ struct nfs_rpc_ops {struct nfs_server *(*create_server)(struct fs_context *);struct nfs_server *(*clone_server)(struct nfs_server *,struct nfs_fh *,struct nfs_fattr *,rpc_authflavor_t ); +int (*discover_trunking)(struct nfs_server *,struct nfs_fh *); };/*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 27/203 NFSv4 expose nfs_parse_server_name function
In reply to Greg Kroah-HartmanFrom: Olga Kornievskaia <[email protected]>
[ Upstream commit f5b27cc6761e27ee6387a24df1a99ca77b360fea ]
Make nfs_parse_server_name available outside of nfs4namespace.c.
--- fs/nfs/nfs4_fs.h | 3 ++- fs/nfs/nfs4namespace.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
fs/nfs/nfs4_fs.h +2 -1
@@ -280,7 +280,8 @@ struct rpc_clnt *nfs4_negotiate_security(struct rpc_clnt *, struct inode *,int nfs4_submount (struct fs_context *,struct nfs_server *);int nfs4_replace_transport (struct nfs_server *server,const struct nfs4_fs_locations *locations); - +size_t nfs_parse_server_name (char *string,size_t len,struct sockaddr *sa, +size_t salen,struct net *net);/* nfs4proc.c */ extern int nfs4_handle_exception (struct nfs_server *,int ,struct nfs4_exception *); extern int nfs4_async_handle_error(struct rpc_task *task,
fs/nfs/nfs4namespace.c +2 -2
@@ -164,8 +164,8 @@ static int nfs4_validate_fspath(struct dentry *dentry,return 0 ; } -static size_t nfs_parse_server_name (char *string,size_t len, -struct sockaddr *sa,size_t salen,struct net *net) +size_t nfs_parse_server_name (char *string,size_t len,struct sockaddr *sa, +size_t salen,struct net *net) {ssize_t ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 28/203 NFSv4 handle port presence in fs_location server string
In reply to Greg Kroah-HartmanFrom: Olga Kornievskaia <[email protected]>
[ Upstream commit a8d54baba7c65db2d3278873def61f8d3753d766 ]
An fs_location attribute returns a string that can be ipv4, ipv6, or DNS name. An ip location can have a port appended to it and if no port is present a default port needs to be set. If rpc_pton() fails to parse, try calling rpc_uaddr2socaddr() that can convert an universal address.
--- fs/nfs/nfs4_fs.h | 2 +- fs/nfs/nfs4namespace.c | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-)
fs/nfs/nfs4_fs.h +1 -1
@@ -281,7 +281,7 @@ int nfs4_submount(struct fs_context *, struct nfs_server *);int nfs4_replace_transport (struct nfs_server *server,const struct nfs4_fs_locations *locations);size_t nfs_parse_server_name (char *string,size_t len,struct sockaddr *sa, -size_t salen,struct net *net); +size_t salen,struct net *net,int port);/* nfs4proc.c */ extern int nfs4_handle_exception (struct nfs_server *,int ,struct nfs4_exception *); extern int nfs4_async_handle_error(struct rpc_task *task,
fs/nfs/nfs4namespace.c +11 -6
@@ -165,15 +165,20 @@ static int nfs4_validate_fspath(struct dentry *dentry, }size_t nfs_parse_server_name (char *string,size_t len,struct sockaddr *sa, -size_t salen,struct net *net) +size_t salen,struct net *net,int port) {ssize_t ret; ret =rpc_pton (net, string, len, sa, salen);if (ret ==0 ) { - ret =nfs_dns_resolve_name (net, string, len, sa, salen); -if (ret <0 ) - ret =0 ; + ret =rpc_uaddr2sockaddr (net, string, len, sa, salen); +if (ret ==0 ) { + ret =nfs_dns_resolve_name (net, string, len, sa, salen); +if (ret <0 ) + ret =0 ; + } + }else if (port) { +rpc_set_port (sa, port); }return ret; }
@@ -328,7 +333,7 @@ static int try_location(struct fs_context *fc,nfs_parse_server_name (buf->data, buf->len, &ctx->nfs_server.address,sizeof (ctx->nfs_server._address), - fc->net_ns); + fc->net_ns,0 );if (ctx->nfs_server.addrlen ==0 )continue ;
@@ -496,7 +501,7 @@ static int nfs4_try_replacing_one_location(struct nfs_server *server,continue ; salen =nfs_parse_server_name (buf->data, buf->len, - sap, addr_bufsize, net); + sap, addr_bufsize, net,0 );if (salen ==0 )continue ;rpc_set_port (sap,NFS_PORT );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 29/203 SUNRPC allow for unspecified transport time in rpc_clnt_add_xprt
In reply to Greg Kroah-HartmanFrom: Olga Kornievskaia <[email protected]>
[ Upstream commit b8a09619a56334414cbd7f935a0796240d0cc07e ]
If the supplied argument doesn't specify the transport type, use the type of the existing rpc clnt and its existing transport.
--- net/sunrpc/clnt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/sunrpc/clnt.c +4 -1
@@ -2900,7 +2900,7 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt,unsigned long connect_timeout;unsigned long reconnect_timeout;unsigned char resvport, reuseport; -int ret =0 ; +int ret =0 , ident;rcu_read_lock (); xps =xprt_switch_get (rcu_dereference (clnt->cl_xpi.xpi_xpswitch));
@@ -2914,8 +2914,11 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt, reuseport = xprt->reuseport; connect_timeout = xprt->connect_timeout; reconnect_timeout = xprt->max_reconnect_timeout; + ident = xprt->xprt_class->ident;rcu_read_unlock (); +if (!xprtargs->ident) + xprtargs->ident = ident; xprt =xprt_create_transport (xprtargs);if (IS_ERR (xprt)) { ret =PTR_ERR (xprt);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 30/203 net/sunrpc: fix reference count leaks in rpc_sysfs_xprt_state_change
In reply to Greg Kroah-HartmanFrom: Xiyu Yang <[email protected]>
[ Upstream commit 776d794f28c95051bc70405a7b1fa40115658a18 ]
The refcount leak issues take place in an error handling path. When the 3rd argument buf doesn't match with "offline", "online" or "remove", the function simply returns -EINVAL and forgets to decrease the reference count of a rpc_xprt object and a rpc_xprt_switch object increased by rpc_sysfs_xprt_kobj_get_xprt() and rpc_sysfs_xprt_kobj_get_xprt_switch(), causing reference count leaks of both unused objects.
Fix this issue by jumping to the error handling path labelled with out_put when buf matches none of "offline", "online" or "remove".
--- net/sunrpc/sysfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/sunrpc/sysfs.c +4 -2
@@ -295,8 +295,10 @@ static ssize_t rpc_sysfs_xprt_state_change(struct kobject *kobj, online =1 ; else if (!strncmp(buf, "remove", 6)) remove =1 ; - else - return -EINVAL; + else { + count = -EINVAL ; + goto out_put; + }if (wait_on_bit_lock (&xprt->state,XPRT_LOCKED ,TASK_KILLABLE )) { count = -EINTR ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 31/203 sunrpc: Fix potential race conditions in rpc_sysfs_xprt_state_change()
In reply to Greg Kroah-HartmanFrom: Anna Schumaker <[email protected]>
[ Upstream commit 1a48db3fef499f615b56093947ec4b0d3d8e3021 ]
We need to use test_and_set_bit() when changing xprt state flags to avoid potentially getting xps->xps_nactive out of sync.
--- net/sunrpc/sysfs.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-)
net/sunrpc/sysfs.c +19 -16
@@ -309,25 +309,28 @@ static ssize_t rpc_sysfs_xprt_state_change(struct kobject *kobj, goto release_tasks; }if (offline) { -set_bit (XPRT_OFFLINE , &xprt->state); -spin_lock (&xps->xps_lock); - xps->xps_nactive--; -spin_unlock (&xps->xps_lock); +if (!test_and_set_bit (XPRT_OFFLINE , &xprt->state)) { +spin_lock (&xps->xps_lock); + xps->xps_nactive--; +spin_unlock (&xps->xps_lock); + } }else if (online) { -clear_bit (XPRT_OFFLINE , &xprt->state); -spin_lock (&xps->xps_lock); - xps->xps_nactive++; -spin_unlock (&xps->xps_lock); +if (test_and_clear_bit (XPRT_OFFLINE , &xprt->state)) { +spin_lock (&xps->xps_lock); + xps->xps_nactive++; +spin_unlock (&xps->xps_lock); + } }else if (remove) {if (test_bit (XPRT_OFFLINE , &xprt->state)) { -set_bit (XPRT_REMOVE , &xprt->state); -xprt_force_disconnect (xprt); -if (test_bit (XPRT_CONNECTED , &xprt->state)) { -if (!xprt->sending.qlen && - !xprt->pending.qlen && - !xprt->backlog.qlen && - !atomic_long_read (&xprt->queuelen)) -rpc_xprt_switch_remove_xprt (xps, xprt); +if (!test_and_set_bit (XPRT_REMOVE , &xprt->state)) { +xprt_force_disconnect (xprt); +if (test_bit (XPRT_CONNECTED , &xprt->state)) { +if (!xprt->sending.qlen && + !xprt->pending.qlen && + !xprt->backlog.qlen && + !atomic_long_read (&xprt->queuelen)) +rpc_xprt_switch_remove_xprt (xps, xprt); + } } }else { count = -EINVAL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 32/203 irqchip/realtek-rtl: Service all pending interrupts
In reply to Greg Kroah-HartmanFrom: Sander Vanheule <[email protected]>
[ Upstream commit 960dd884ddf5621ae6284cd3a42724500a97ae4c ]
Instead of only servicing the lowest pending interrupt line, make sure all pending SoC interrupts are serviced before exiting the chained handler. This adds a small overhead if only one interrupt is pending, but should prevent rapid re-triggering of the handler.
--- drivers/irqchip/irq-realtek-rtl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/irqchip/irq-realtek-rtl.c +6 -2
@@ -76,16 +76,20 @@ static void realtek_irq_dispatch(struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc);struct irq_domain *domain; -unsigned int pending; +unsigned long pending; +unsigned int soc_int;chained_irq_enter (chip, desc); pending =readl (REG (RTL_ICTL_GIMR )) &readl (REG (RTL_ICTL_GISR )); +if (unlikely (!pending)) {spurious_interrupt (); goto out; } + domain =irq_desc_get_handler_data (desc); -generic_handle_domain_irq (domain,__ffs (pending)); +for_each_set_bit (soc_int, &pending,32 ) +generic_handle_domain_irq (domain, soc_int); out:chained_irq_exit (chip, desc);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 33/203 perf/x86/rapl: fix AMD event handling
In reply to Greg Kroah-HartmanFrom: Stephane Eranian <[email protected]>
[ Upstream commit 0036fb00a756a2f6e360d44e2e3d2200a8afbc9b ]
The RAPL events exposed under /sys/devices/power/events should only reflect what the underlying hardware actually support. This is how it works on Intel RAPL and Intel core/uncore PMUs in general.
But on AMD, this was not the case. All possible RAPL events were advertised.
This is what it showed on an AMD Fam17h:
$ ls /sys/devices/power/events/ energy-cores energy-gpu energy-pkg energy-psys energy-ram energy-cores.scale energy-gpu.scale energy-pkg.scale energy-psys.scale energy-ram.scale energy-cores.unit energy-gpu.unit energy-pkg.unit energy-psys.unit energy-ram.unit
Yet, on AMD Fam17h, only energy-pkg is supported.
This patch fixes the problem. Given the way perf_msr_probe() works, the amd_rapl_msrs[] table has to have all entries filled out and in particular the group field, otherwise perf_msr_probe() defaults to making the event visible.
With the patch applied, the kernel now only shows was is actually supported:
$ ls /sys/devices/power/events/ energy-pkg energy-pkg.scale energy-pkg.unit
The patch also uses the RAPL_MSR_MASK because only the 32-bits LSB of the RAPL counters are relevant when reading power consumption.
--- arch/x86/events/rapl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/x86/events/rapl.c +6 -3
@@ -536,11 +536,14 @@ static struct perf_msr intel_rapl_spr_msrs[] = {* - perf_msr_probe(PERF_RAPL_MAX) * - want to use same event codes across both architectures */ -static struct perf_msr amd_rapl_msrs[PERF_RAPL_MAX ] = { - [PERF_RAPL_PKG ] = {MSR_AMD_PKG_ENERGY_STATUS , &rapl_events_pkg_group, test_msr }, +static struct perf_msr amd_rapl_msrs[] = { + [PERF_RAPL_PP0 ] = {0 , &rapl_events_cores_group,0 , false,0 }, + [PERF_RAPL_PKG ] = {MSR_AMD_PKG_ENERGY_STATUS , &rapl_events_pkg_group, test_msr, false,RAPL_MSR_MASK }, + [PERF_RAPL_RAM ] = {0 , &rapl_events_ram_group,0 , false,0 }, + [PERF_RAPL_PP1 ] = {0 , &rapl_events_gpu_group,0 , false,0 }, + [PERF_RAPL_PSYS ] = {0 , &rapl_events_psys_group,0 , false,0 }, }; -static int rapl_cpu_offline (unsigned int cpu) {struct rapl_pmu *pmu =cpu_to_rapl_pmu (cpu);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 34/203 x86/perf: Avoid warning for Arch LBR without XSAVE
In reply to Greg Kroah-HartmanFrom: Andi Kleen <[email protected]>
[ Upstream commit 8c16dc047b5dd8f7b3bf4584fa75733ea0dde7dc ]
Some hypervisors support Arch LBR, but without the LBR XSAVE support. The current Arch LBR init code prints a warning when the xsave size (0) is unexpected. Avoid printing the warning for the "no LBR XSAVE" case.
--- arch/x86/events/intel/lbr.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/events/intel/lbr.c +3 -0
@@ -1726,6 +1726,9 @@ static bool is_arch_lbr_xsave_available(void)* Check the LBR state with the corresponding software structure. * Disable LBR XSAVES support if the size doesn't match. */ +if (xfeature_size (XFEATURE_LBR ) ==0 ) +return false; +if (WARN_ON (xfeature_size (XFEATURE_LBR ) !=get_lbr_state_size ()))return false;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 35/203 sched: Avoid double preemption in __cond_resched_*lock*()
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 7e406d1ff39b8ee574036418a5043c86723170cf ]
For PREEMPT/DYNAMIC_PREEMPT the *_unlock() will already trigger a preemption, no point in then calling preempt_schedule_common() *again*.
Use _cond_resched() instead, since this is a NOP for the preemptible configs while it provide a preemption point for the others.
--- kernel/sched/core.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
kernel/sched/core.c +3 -9
@@ -8176,9 +8176,7 @@ int __cond_resched_lock(spinlock_t *lock)if (spin_needbreak (lock) || resched) {spin_unlock (lock); -if (resched) -preempt_schedule_common (); -else +if (!_cond_resched ())cpu_relax (); ret =1 ;spin_lock (lock);
@@ -8196,9 +8194,7 @@ int __cond_resched_rwlock_read(rwlock_t *lock)if (rwlock_needbreak (lock) || resched) {read_unlock (lock); -if (resched) -preempt_schedule_common (); -else +if (!_cond_resched ())cpu_relax (); ret =1 ;read_lock (lock);
@@ -8216,9 +8212,7 @@ int __cond_resched_rwlock_write(rwlock_t *lock)if (rwlock_needbreak (lock) || resched) {write_unlock (lock); -if (resched) -preempt_schedule_common (); -else +if (!_cond_resched ())cpu_relax (); ret =1 ;write_lock (lock);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 36/203 drm/vc4: Fix deadlock on DSI device attach error
In reply to Greg Kroah-HartmanFrom: Padmanabha Srinivasaiah <[email protected]>
[ Upstream commit 0a3d12ab5097b1d045e693412e6b366b7e82031b ]
DSI device attach to DSI host will be done with host device's lock held.
Un-registering host in "device attach" error path (ex: probe retry) will result in deadlock with below call trace and non operational DSI display.
Startup Call trace:
[ 35.043036] rt_mutex_slowlock.constprop.21+0x184/0x1b8 [ 35.043048] mutex_lock_nested+0x7c/0xc8 [ 35.043060] device_del+0x4c/0x3e8 [ 35.043075] device_unregister+0x20/0x40 [ 35.043082] mipi_dsi_remove_device_fn+0x18/0x28 [ 35.043093] device_for_each_child+0x68/0xb0 [ 35.043105] mipi_dsi_host_unregister+0x40/0x90 [ 35.043115] vc4_dsi_host_attach+0xf0/0x120 [vc4] [ 35.043199] mipi_dsi_attach+0x30/0x48 [ 35.043209] tc358762_probe+0x128/0x164 [tc358762] [ 35.043225] mipi_dsi_drv_probe+0x28/0x38 [ 35.043234] really_probe+0xc0/0x318 [ 35.043244] __driver_probe_device+0x80/0xe8 [ 35.043254] driver_probe_device+0xb8/0x118 [ 35.043263] __device_attach_driver+0x98/0xe8 [ 35.043273] bus_for_each_drv+0x84/0xd8 [ 35.043281] __device_attach+0xf0/0x150 [ 35.043290] device_initial_probe+0x1c/0x28 [ 35.043300] bus_probe_device+0xa4/0xb0 [ 35.043308] deferred_probe_work_func+0xa0/0xe0 [ 35.043318] process_one_work+0x254/0x700 [ 35.043330] worker_thread+0x4c/0x448 [ 35.043339] kthread+0x19c/0x1a8 [ 35.043348] ret_from_fork+0x10/0x20
Shutdown Call trace:
[ 365.565417] Call trace: [ 365.565423] __switch_to+0x148/0x200 [ 365.565452] __schedule+0x340/0x9c8 [ 365.565467] schedule+0x48/0x110 [ 365.565479] schedule_timeout+0x3b0/0x448 [ 365.565496] wait_for_completion+0xac/0x138 [ 365.565509] __flush_work+0x218/0x4e0 [ 365.565523] flush_work+0x1c/0x28 [ 365.565536] wait_for_device_probe+0x68/0x158 [ 365.565550] device_shutdown+0x24/0x348 [ 365.565561] kernel_restart_prepare+0x40/0x50 [ 365.565578] kernel_restart+0x20/0x70 [ 365.565591] __do_sys_reboot+0x10c/0x220 [ 365.565605] __arm64_sys_reboot+0x2c/0x38 [ 365.565619] invoke_syscall+0x4c/0x110 [ 365.565634] el0_svc_common.constprop.3+0xfc/0x120 [ 365.565648] do_el0_svc+0x2c/0x90 [ 365.565661] el0_svc+0x4c/0xf0 [ 365.565671] el0t_64_sync_handler+0x90/0xb8 [ 365.565682] el0t_64_sync+0x180/0x184
--- drivers/gpu/drm/vc4/vc4_dsi.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/gpu/drm/vc4/vc4_dsi.c +4 -10
@@ -1262,7 +1262,6 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) {struct vc4_dsi *dsi =host_to_dsi (host); -int ret; dsi->lanes = device->lanes; dsi->channel = device->channel;
@@ -1297,18 +1296,15 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host,return 0 ; } - ret =component_add (&dsi->pdev->dev, &vc4_dsi_ops); -if (ret) { -mipi_dsi_host_unregister (&dsi->dsi_host); -return ret; - } - -return 0 ; +return component_add (&dsi->pdev->dev, &vc4_dsi_ops); }static int vc4_dsi_host_detach (struct mipi_dsi_host *host,struct mipi_dsi_device *device) { +struct vc4_dsi *dsi =host_to_dsi (host); + +component_del (&dsi->pdev->dev, &vc4_dsi_ops);return 0 ; }
@@ -1686,9 +1682,7 @@ static int vc4_dsi_dev_remove(struct platform_device *pdev)struct device *dev = &pdev->dev;struct vc4_dsi *dsi =dev_get_drvdata (dev); -component_del (&pdev->dev, &vc4_dsi_ops);mipi_dsi_host_unregister (&dsi->dsi_host); -return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 37/203 drm: panel-orientation-quirks: Add quirk for the 1Netbook OneXPlayer
In reply to Greg Kroah-HartmanFrom: Raymond Jay Golo <[email protected]>
[ Upstream commit d3cbc6e323c9299d10c8d2e4127c77c7d05d07b1 ]
The 1Netbook OneXPlayer uses a panel which has been mounted 90 degrees rotated. Add a quirk for this.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +12 -0
@@ -115,6 +115,12 @@ static const struct drm_dmi_panel_orientation_data lcd1280x1920_rightside_up = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd1600x2560_leftside_up = { + .width =1600 , + .height =2560 , + .orientation =DRM_MODE_PANEL_ORIENTATION_LEFT_UP , +}; +static const struct dmi_system_id orientation_data[] = { {/* Acer One 10 (S1003) */ .matches = {
@@ -275,6 +281,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Default string"), }, .driver_data = (void *)&onegx1_pro, + }, { /* OneXPlayer */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"ONE-NETBOOK TECHNOLOGY CO., LTD." ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONE XPLAYER"), + }, + .driver_data = (void *)&lcd1600x2560_leftside_up, }, { /* Samsung GalaxyBook 10.6 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 38/203 net: sched: Clarify error message when qdisc kind is unknown
In reply to Greg Kroah-HartmanFrom: Victor Nogueira <[email protected]>
[ Upstream commit 973bf8fdd12f0e70ea351c018e68edd377a836d1 ]
When adding a tc rule with a qdisc kind that is not supported or not compiled into the kernel, the kernel emits the following error: "Error:
Specified qdisc not found.". Found via tdc testing when ETS qdisc was not compiled in and it was not obvious right away what the message meant without looking at the kernel code.
Change the error message to be more explicit and say the qdisc kind is unknown.
--- net/sched/sch_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_api.c +1 -1
@@ -1204,7 +1204,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev, err = -ENOENT ;if (!ops) { -NL_SET_ERR_MSG (extack,"Specified qdisc not found" ); +NL_SET_ERR_MSG (extack,"Specified qdisc kind is unknown" ); goto err_out; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 39/203 powerpc/fixmap: Fix VM debug warning on unmap
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit aec982603aa8cc0a21143681feb5f60ecc69d718 ]
Unmapping a fixmap entry is done by calling __set_fixmap() with FIXMAP_PAGE_CLEAR as flags.
Today, powerpc __set_fixmap() calls map_kernel_page().
map_kernel_page() is not happy when called a second time for the same page.
WARNING: CPU: 0 PID: 1 at arch/powerpc/mm/pgtable.c:194 set_pte_at+0xc/0x1e8 CPU: 0 PID: 1 Comm: swapper Not tainted 5.16.0-rc3-s3k-dev-01993-g350ff07feb7d-dirty #682 NIP: c0017cd4 LR: c00187f0 CTR: 00000010 REGS: e1011d50 TRAP: 0700 Not tainted (5.16.0-rc3-s3k-dev-01993-g350ff07feb7d-dirty) MSR: 00029032 <EE,ME,IR,DR,RI> CR: 42000208 XER: 00000000
GPR00: c0165fec e1011e10 c14c0000 c0ee2550 ff800000 c0f3d000 00000000 c001686c GPR08: 00001000 b00045a9 00000001 c0f58460 c0f50000 00000000 c0007e10 00000000 GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 GPR24: 00000000 00000000 c0ee2550 00000000 c0f57000 00000ff8 00000000 ff800000 NIP [c0017cd4] set_pte_at+0xc/0x1e8 LR [c00187f0] map_kernel_page+0x9c/0x100 Call Trace: [e1011e10] [c0736c68] vsnprintf+0x358/0x6c8 (unreliable) [e1011e30] [c0165fec] __set_fixmap+0x30/0x44 [e1011e40] [c0c13bdc] early_iounmap+0x11c/0x170 [e1011e70] [c0c06cb0] ioremap_legacy_serial_console+0x88/0xc0 [e1011e90] [c0c03634] do_one_initcall+0x80/0x178 [e1011ef0] [c0c0385c] kernel_init_freeable+0xb4/0x250 [e1011f20] [c0007e34] kernel_init+0x24/0x140 [e1011f30] [c0016268] ret_from_kernel_thread+0x5c/0x64 Instruction dump: 7fe3fb78 48019689 80010014 7c630034 83e1000c 5463d97e 7c0803a6 38210010 4e800020 81250000 712a0001 41820008 <0fe00000> 9421ffe0 93e1001c 48000030
Implement unmap_kernel_page() which clears an existing pte.
--- arch/powerpc/include/asm/book3s/32/pgtable.h | 1 + arch/powerpc/include/asm/book3s/64/pgtable.h | 2 ++ arch/powerpc/include/asm/fixmap.h | 6 ++++-- arch/powerpc/include/asm/nohash/32/pgtable.h | 1 + arch/powerpc/include/asm/nohash/64/pgtable.h | 1 + arch/powerpc/mm/pgtable.c | 9 +++++++++ 6 files changed, 18 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/book3s/32/pgtable.h +1 -0
@@ -178,6 +178,7 @@ static inline bool pte_user(pte_t pte)#ifndef __ASSEMBLY__int map_kernel_page (unsigned long va,phys_addr_t pa,pgprot_t prot); +void unmap_kernel_page (unsigned long va);#endif /* !__ASSEMBLY__ */
arch/powerpc/include/asm/book3s/64/pgtable.h +2 -0
@@ -1082,6 +1082,8 @@ static inline int map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t preturn hash__map_kernel_page (ea, pa, prot); } +void unmap_kernel_page (unsigned long va); +static inline int __meminit vmemmap_create_mapping (unsigned long start,unsigned long page_size,unsigned long phys)
arch/powerpc/include/asm/fixmap.h +4 -2
@@ -111,8 +111,10 @@ static inline void __set_fixmap(enum fixed_addresses idx,BUILD_BUG_ON (idx >= __end_of_fixed_addresses); else if (WARN_ON(idx >= __end_of_fixed_addresses)) return; - -map_kernel_page (__fix_to_virt (idx ),phys ,flags ); +if (pgprot_val (flags)) +map_kernel_page (__fix_to_virt (idx), phys, flags); +else +unmap_kernel_page (__fix_to_virt (idx)); }#define __early_set_fixmap __set_fixmap
arch/powerpc/include/asm/nohash/32/pgtable.h +1 -0
@@ -64,6 +64,7 @@ extern int icache_44x_need_flush;#ifndef __ASSEMBLY__int map_kernel_page (unsigned long va,phys_addr_t pa,pgprot_t prot); +void unmap_kernel_page (unsigned long va);#endif /* !__ASSEMBLY__ */
arch/powerpc/include/asm/nohash/64/pgtable.h +1 -0
@@ -308,6 +308,7 @@ static inline void __ptep_set_access_flags(struct vm_area_struct *vma,#define __swp_entry_to_pte (x) __pte((x).val)int map_kernel_page (unsigned long ea,unsigned long pa,pgprot_t prot); +void unmap_kernel_page (unsigned long va);extern int __meminit vmemmap_create_mapping (unsigned long start,unsigned long page_size,unsigned long phys);
arch/powerpc/mm/pgtable.c +9 -0
@@ -203,6 +203,15 @@ void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,__set_pte_at (mm, addr, ptep, pte,0 ); } +void unmap_kernel_page (unsigned long va) +{ +pmd_t *pmdp =pmd_off_k (va); +pte_t *ptep =pte_offset_kernel (pmdp, va); + +pte_clear (&init_mm, va, ptep); +flush_tlb_kernel_range (va, va +PAGE_SIZE ); +} +/* * This is called when relaxing access to a PTE. It's also called in the page * fault path when we don't hit any of the major fault cases, ie, a minor
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 40/203 s390/module: test loading modules with a lot of relocations
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 90c5318795eefa09a9f9aef8d18a904e24962b5c ]
Add a test in order to prevent regressions.
--- arch/s390/Kconfig | 15 +++++++++ arch/s390/lib/Makefile | 3 ++ arch/s390/lib/test_modules.c | 35 +++++++++++++++++++ arch/s390/lib/test_modules.h | 50 ++++++++++++++++++++++++++++ arch/s390/lib/test_modules_helpers.c | 13 ++++++++ 5 files changed, 116 insertions(+) create mode 100644 arch/s390/lib/test_modules.c create mode 100644 arch/s390/lib/test_modules.h create mode 100644 arch/s390/lib/test_modules_helpers.c
arch/s390/Kconfig +15 -0
@@ -947,6 +947,9 @@ config S390_GUEST endmenu +config S390_MODULES_SANITY_TEST_HELPERS + def_bool n + menu "Selftests" config S390_UNWIND_SELFTEST
@@ -973,4 +976,16 @@ config S390_KPROBES_SANITY_TEST Say N if you are unsure. +config S390_MODULES_SANITY_TEST + def_tristate n + depends on KUNIT + default KUNIT_ALL_TESTS + prompt "Enable s390 specific modules tests" + select S390_MODULES_SANITY_TEST_HELPERS + help + This option enables an s390 specific modules test. This option is + not useful for distributions or general kernels, but only for + kernel developers working on architecture code. + + Say N if you are unsure. endmenu
arch/s390/lib/Makefile +3 -0
@@ -17,4 +17,7 @@ KASAN_SANITIZE_uaccess.o := n obj-$(CONFIG_S390_UNWIND_SELFTEST) += test_unwind.o CFLAGS_test_unwind.o += -fno-optimize-sibling-calls +obj-$(CONFIG_S390_MODULES_SANITY_TEST) += test_modules.o +obj-$(CONFIG_S390_MODULES_SANITY_TEST_HELPERS) += test_modules_helpers.o + lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
arch/s390/lib/test_modules.c new file +35 -0
@@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <kunit/test.h> +#include <linux/module.h> + +#include "test_modules.h" + +#define DECLARE_RETURN (i) int test_modules_return_ ## i(void) +REPEAT_10000 (DECLARE_RETURN ); + +/* +* Test that modules with many relocations are loaded properly. +*/ +static void test_modules_many_vmlinux_relocs (struct kunit *test) +{ +int result =0 ; + +#define CALL_RETURN (i) result += test_modules_return_ ## i() +REPEAT_10000 (CALL_RETURN ); +KUNIT_ASSERT_EQ (test, result,49995000 ); +} + +static struct kunit_case modules_testcases[] = { +KUNIT_CASE (test_modules_many_vmlinux_relocs), + {} +}; + +static struct kunit_suite modules_test_suite = { + .name ="modules_test_s390" , + .test_cases = modules_testcases, +}; + +kunit_test_suites (&modules_test_suite); + +MODULE_LICENSE ("GPL" );
arch/s390/lib/test_modules.h new file +50 -0
50 lines not on this page · raw message
arch/s390/lib/test_modules_helpers.c new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include <linux/export.h> + +#include "test_modules.h" + +#define DEFINE_RETURN (i) \ + int test_modules_return_ ## i(void) \ + { \ + return 1 ## i - 10000; \ + } \ + EXPORT_SYMBOL_GPL(test_modules_return_ ## i) +REPEAT_10000 (DEFINE_RETURN );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 41/203 arm64: Add Cortex-X2 CPU part definition
In reply to Greg Kroah-HartmanFrom: Anshuman Khandual <[email protected]>
[ Upstream commit 72bb9dcb6c33cfac80282713c2b4f2b254cd24d1 ]
Add the CPU Partnumbers for the new Arm designs.
--- arch/arm64/include/asm/cputype.h | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/include/asm/cputype.h +2 -0
@@ -75,6 +75,7 @@#define ARM_CPU_PART_CORTEX_A77 0xD0D#define ARM_CPU_PART_CORTEX_A510 0xD46#define ARM_CPU_PART_CORTEX_A710 0xD47 +#define ARM_CPU_PART_CORTEX_X2 0xD48#define ARM_CPU_PART_NEOVERSE_N2 0xD49#define APM_CPU_PART_POTENZA 0x000
@@ -118,6 +119,7 @@#define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77)#define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510)#define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710) +#define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2)#define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N2)#define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX)#define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 42/203 arm64: errata: Update ARM64_ERRATUM_[2119858|2224489] with Cortex-X2 ranges
In reply to Greg Kroah-HartmanFrom: Anshuman Khandual <[email protected]>
[ Upstream commit eb30d838a44c9e59a2a106884f536119859c7257 ]
Errata ARM64_ERRATUM_[2119858|2224489] also affect some Cortex-X2 ranges as well. Lets update these errata definition and detection to accommodate all new Cortex-X2 based cpu MIDR ranges.
--- Documentation/arm64/silicon-errata.rst | 4 ++++ arch/arm64/Kconfig | 12 ++++++------ arch/arm64/kernel/cpu_errata.c | 2 ++ 3 files changed, 12 insertions(+), 6 deletions(-)
Documentation/arm64/silicon-errata.rst +4 -0
@@ -98,6 +98,10 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A710 | #2224489 | ARM64_ERRATUM_2224489 | +----------------+-----------------+-----------------+-----------------------------+ +| ARM | Cortex-X2 | #2119858 | ARM64_ERRATUM_2119858 | ++----------------+-----------------+-----------------+-----------------------------+ +| ARM | Cortex-X2 | #2224489 | ARM64_ERRATUM_2224489 | ++----------------+-----------------+-----------------+-----------------------------+ | ARM | Neoverse-N1 | #1188873,1418040| ARM64_ERRATUM_1418040 | +----------------+-----------------+-----------------+-----------------------------+ | ARM | Neoverse-N1 | #1349291 | N/A |
arch/arm64/Kconfig +6 -6
@@ -671,14 +671,14 @@ config ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE bool config ARM64_ERRATUM_2119858 - bool "Cortex-A710: 2119858: workaround TRBE overwriting trace data in FILL mode" + bool "Cortex-A710/X2: 2119858: workaround TRBE overwriting trace data in FILL mode" default y depends on CORESIGHT_TRBE select ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE help - This option adds the workaround for ARM Cortex-A710 erratum 2119858. + This option adds the workaround for ARM Cortex-A710/X2 erratum 2119858. - Affected Cortex-A710 cores could overwrite up to 3 cache lines of trace + Affected Cortex-A710/X2 cores could overwrite up to 3 cache lines of trace data at the base of the buffer (pointed to by TRBASER_EL1) in FILL mode in the event of a WRAP event.
@@ -761,14 +761,14 @@ config ARM64_ERRATUM_2253138 If unsure, say Y. config ARM64_ERRATUM_2224489 - bool "Cortex-A710: 2224489: workaround TRBE writing to address out-of-range" + bool "Cortex-A710/X2: 2224489: workaround TRBE writing to address out-of-range" depends on CORESIGHT_TRBE default y select ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE help - This option adds the workaround for ARM Cortex-A710 erratum 2224489. + This option adds the workaround for ARM Cortex-A710/X2 erratum 2224489. - Affected Cortex-A710 cores might write to an out-of-range address, not reserved + Affected Cortex-A710/X2 cores might write to an out-of-range address, not reserved for TRBE. Under some conditions, the TRBE might generate a write to the next virtually addressed page following the last page of the TRBE address space (i.e., the TRBLIMITR_EL1.LIMIT), instead of wrapping around to the base.
arch/arm64/kernel/cpu_errata.c +2 -0
@@ -347,6 +347,7 @@ static const struct midr_range trbe_overwrite_fill_mode_cpus[] = {#endif #ifdef CONFIG_ARM64_ERRATUM_2119858 MIDR_ALL_VERSIONS (MIDR_CORTEX_A710 ), + MIDR_RANGE(MIDR_CORTEX_X2, 0, 0, 2, 0), #endif {}, };
@@ -371,6 +372,7 @@ static struct midr_range trbe_write_out_of_range_cpus[] = {#endif #ifdef CONFIG_ARM64_ERRATUM_2224489 MIDR_ALL_VERSIONS (MIDR_CORTEX_A710 ), + MIDR_RANGE(MIDR_CORTEX_X2, 0, 0, 2, 0), #endif {}, };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 43/203 scsi: target: iscsi: Make sure the np under each tpg is unique
In reply to Greg Kroah-HartmanFrom: ZouMingzhe <[email protected]>
[ Upstream commit a861790afaa8b6369eee8a88c5d5d73f5799c0c6 ]
iscsit_tpg_check_network_portal() has nested for_each loops and is supposed to return true when a match is found. However, the tpg loop will still continue after existing the tpg_np loop. If this tpg_np is not the last the match value will be changed.
Break the outer loop after finding a match and make sure the np under each tpg is unique.
--- drivers/target/iscsi/iscsi_target_tpg.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/target/iscsi/iscsi_target_tpg.c +3 -0
@@ -443,6 +443,9 @@ static bool iscsit_tpg_check_network_portal(break ; }spin_unlock (&tpg->tpg_np_lock); + +if (match) +break ; }spin_unlock (&tiqn->tiqn_tpg_lock);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 44/203 scsi: ufs: ufshcd-pltfrm: Check the return value of devm_kstrdup()
In reply to Greg Kroah-HartmanFrom: Xiaoke Wang <[email protected]>
[ Upstream commit a65b32748f4566f986ba2495a8236c141fa42a26 ]
devm_kstrdup() returns pointer to allocated string on success, NULL on failure. So it is better to check the return value of it.
--- drivers/scsi/ufs/ufshcd-pltfrm.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/scsi/ufs/ufshcd-pltfrm.c +7 -0
@@ -92,6 +92,11 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) clki->min_freq = clkfreq[i]; clki->max_freq = clkfreq[i+1 ]; clki->name =devm_kstrdup (dev, name,GFP_KERNEL ); +if (!clki->name) { + ret = -ENOMEM ; + goto out; + } +if (!strcmp (name,"ref_clk" )) clki->keep_link_active = true; dev_dbg(dev, "%s: min %u max %u name %s\n", "freq-table-hz",
@@ -127,6 +132,8 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name,return -ENOMEM ; vreg->name =devm_kstrdup (dev, name,GFP_KERNEL ); +if (!vreg->name) +return -ENOMEM ;snprintf (prop_name,MAX_PROP_SIZE ,"%s-max-microamp" , name);if (of_property_read_u32 (np, prop_name, &vreg->max_uA)) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 45/203 scsi: qedf: Add stag_work to all the vports
In reply to Greg Kroah-HartmanFrom: Saurav Kashyap <[email protected]>
[ Upstream commit b70a99fd13282d7885f69bf1372e28b7506a1613 ]
Call trace seen when creating NPIV ports, only 32 out of 64 show online. stag work was not initialized for vport, hence initialize the stag work.
WARNING: CPU: 8 PID: 645 at kernel/workqueue.c:1635 __queue_delayed_work+0x68/0x80 CPU: 8 PID: 645 Comm: kworker/8:1 Kdump: loaded Tainted: G IOE --------- -- 4.18.0-348.el8.x86_64 #1 Hardware name: Dell Inc. PowerEdge MX740c/0177V9, BIOS 2.12.2 07/09/2021 Workqueue: events fc_lport_timeout [libfc] RIP: 0010:__queue_delayed_work+0x68/0x80 Code: 89 b2 88 00 00 00 44 89 82 90 00 00 00 48 01 c8 48 89 42 50 41 81 f8 00 20 00 00 75 1d e9 60 24 07 00 44 89 c7 e9 98 f6 ff ff <0f> 0b eb c5 0f 0b eb a1 0f 0b eb a7 0f 0b eb ac 44 89 c6 e9 40 23 RSP: 0018:ffffae514bc3be40 EFLAGS: 00010006 RAX: ffff8d25d6143750 RBX: 0000000000000202 RCX: 0000000000000002 RDX: ffff8d2e31383748 RSI: ffff8d25c000d600 RDI: ffff8d2e31383788 RBP: ffff8d2e31380de0 R08: 0000000000002000 R09: ffff8d2e31383750 R10: ffffffffc0c957e0 R11: ffff8d2624800000 R12: ffff8d2e31380a58 R13: ffff8d2d915eb000 R14: ffff8d25c499b5c0 R15: ffff8d2e31380e18 FS: 0000000000000000(0000) GS:ffff8d2d1fb00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055fd0484b8b8 CR3: 00000008ffc10006 CR4: 00000000007706e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: queue_delayed_work_on+0x36/0x40 qedf_elsct_send+0x57/0x60 [qedf] fc_lport_enter_flogi+0x90/0xc0 [libfc] fc_lport_timeout+0xb7/0x140 [libfc] process_one_work+0x1a7/0x360 ? create_worker+0x1a0/0x1a0 worker_thread+0x30/0x390 ? create_worker+0x1a0/0x1a0 kthread+0x116/0x130 ? kthread_flush_work_fn+0x10/0x10 ret_from_fork+0x35/0x40 ---[ end trace 008f00f722f2c2ff ]--
Initialize stag work for all the vports.
--- drivers/scsi/qedf/qedf_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/qedf/qedf_main.c +1 -0
@@ -1862,6 +1862,7 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled) vport_qedf->cmd_mgr = base_qedf->cmd_mgr;init_completion (&vport_qedf->flogi_compl);INIT_LIST_HEAD (&vport_qedf->fcports); +INIT_DELAYED_WORK (&vport_qedf->stag_work, qedf_stag_change_work); rc =qedf_vport_libfc_config (vport, vn_port);if (rc) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 46/203 scsi: qedf: Fix refcount issue when LOGO is received during TMF
In reply to Greg Kroah-HartmanFrom: Saurav Kashyap <[email protected]>
[ Upstream commit 5239ab63f17cee643bd4bf6addfedebaa7d4f41e ]
Hung task call trace was seen during LOGO processing.
[ 974.309060] [0000:00:00.0]:[qedf_eh_device_reset:868]: 1:0:2:0: LUN RESET Issued... [ 974.309065] [0000:00:00.0]:[qedf_initiate_tmf:2422]: tm_flags 0x10 sc_cmd 00000000c16b930f op = 0x2a target_id = 0x2 lun=0 [ 974.309178] [0000:00:00.0]:[qedf_initiate_tmf:2431]: portid=016900 tm_flags =LUN RESET [ 974.309222] [0000:00:00.0]:[qedf_initiate_tmf:2438]: orig io_req = 00000000ec78df8f xid = 0x180 ref_cnt = 1. [ 974.309625] host1: rport 016900: Received LOGO request while in state Ready [ 974.309627] host1: rport 016900: Delete port [ 974.309642] host1: rport 016900: work event 3 [ 974.309644] host1: rport 016900: lld callback ev 3 [ 974.313243] [0000:61:00.2]:[qedf_execute_tmf:2383]:1: fcport is uploading, not executing flush. [ 974.313295] [0000:61:00.2]:[qedf_execute_tmf:2400]:1: task mgmt command success... [ 984.031088] INFO: task jbd2/dm-15-8:7645 blocked for more than 120 seconds. [ 984.031136] Not tainted 4.18.0-305.el8.x86_64 #1
[ 984.031166] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 984.031209] jbd2/dm-15-8 D 0 7645 2 0x80004080 [ 984.031212] Call Trace: [ 984.031222] __schedule+0x2c4/0x700 [ 984.031230] ? unfreeze_partials.isra.83+0x16e/0x1a0 [ 984.031233] ? bit_wait_timeout+0x90/0x90 [ 984.031235] schedule+0x38/0xa0 [ 984.031238] io_schedule+0x12/0x40 [ 984.031240] bit_wait_io+0xd/0x50 [ 984.031243] __wait_on_bit+0x6c/0x80 [ 984.031248] ? free_buffer_head+0x21/0x50 [ 984.031251] out_of_line_wait_on_bit+0x91/0xb0 [ 984.031257] ? init_wait_var_entry+0x50/0x50 [ 984.031268] jbd2_journal_commit_transaction+0x112e/0x19f0 [jbd2] [ 984.031280] kjournald2+0xbd/0x270 [jbd2] [ 984.031284] ? finish_wait+0x80/0x80 [ 984.031291] ? commit_timeout+0x10/0x10 [jbd2] [ 984.031294] kthread+0x116/0x130 [ 984.031300] ? kthread_flush_work_fn+0x10/0x10 [ 984.031305] ret_from_fork+0x1f/0x40
There was a ref count issue when LOGO is received during TMF. This leads to one of the I/Os hanging with the driver. Fix the ref count.
--- drivers/scsi/qedf/qedf_io.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/qedf/qedf_io.c +1 -0
@@ -2250,6 +2250,7 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, io_req->tm_flags == FCP_TMF_TGT_RESET) {clear_bit (QEDF_CMD_OUTSTANDING , &io_req->flags); io_req->sc_cmd =NULL ; +kref_put (&io_req->refcount, qedf_release_cmd);complete (&io_req->tm_done); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 47/203 scsi: qedf: Change context reset messages to ratelimited
In reply to Greg Kroah-HartmanFrom: Saurav Kashyap <[email protected]>
[ Upstream commit 64fd4af6274eb0f49d29772c228fffcf6bde1635 ]
If FCoE is not configured, libfc/libfcoe keeps on retrying FLOGI and after 3 retries driver does a context reset and tries fipvlan again. This leads to context reset message flooding the logs. Hence ratelimit the message to prevent flooding the logs.
--- drivers/scsi/qedf/qedf_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/qedf/qedf_main.c +4 -2
@@ -911,7 +911,7 @@ void qedf_ctx_soft_reset(struct fc_lport *lport)struct qed_link_output if_link;if (lport->vport) { -QEDF_ERR (NULL ,"Cannot issue host reset on NPIV port.\n" ); +printk_ratelimited ("Cannot issue host reset on NPIV port.\n" );return ; }
@@ -3979,7 +3979,9 @@ void qedf_stag_change_work(struct work_struct *work)struct qedf_ctx *qedf = container_of(work, struct qedf_ctx, stag_work.work); -QEDF_ERR (&qedf->dbg_ctx,"Performing software context reset.\n" ); +printk_ratelimited ("[%s]:[%s:%d]:%d: Performing software context reset." , +dev_name (&qedf->pdev->dev), __func__, __LINE__, + qedf->dbg_ctx.host_no);qedf_ctx_soft_reset (qedf->lport); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 48/203 scsi: pm8001: Fix bogus FW crash for maxcpus=1
In reply to Greg Kroah-HartmanFrom: John Garry <[email protected]>
[ Upstream commit 62afb379a0fee7e9c2f9f68e1abeb85ceddf51b9 ]
According to the comment in check_fw_ready() we should not check the IOP1_READY field in register SCRATCH_PAD_1 for 8008 or 8009 controllers.
However we check this very field in process_oq() for processing the highest index interrupt vector. The highest interrupt vector is checked as the FW is programmed to signal fatal errors through this irq.
Change that function to not check IOP1_READY for those mentioned controllers, but do check ILA_READY in both cases.
The reason I assume that this was not hit earlier was because we always allocated 64 MSI(X), and just did not pass the vector index check in process_oq(), i.e. the handler never ran for vector index 63.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 16 ++++++++++++++-- drivers/scsi/pm8001/pm80xx_hwi.h | 6 +++++- 2 files changed, 19 insertions(+), 3 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +14 -2
@@ -4161,10 +4161,22 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec)u32 ret =MPI_IO_STATUS_FAIL ;u32 regval; +/* +* Fatal errors are programmed to be signalled in irq vector +* pm8001_ha->max_q_num - 1 through pm8001_ha->main_cfg_tbl.pm80xx_tbl. +* fatal_err_interrupt +*/ if (vec == (pm8001_ha->max_q_num -1 )) { +u32 mipsall_ready; + +if (pm8001_ha->chip_id == chip_8008 || + pm8001_ha->chip_id == chip_8009) + mipsall_ready =SCRATCH_PAD_MIPSALL_READY_8PORT ; +else + mipsall_ready =SCRATCH_PAD_MIPSALL_READY_16PORT ; + regval =pm8001_cr32 (pm8001_ha,0 ,MSGU_SCRATCH_PAD_1 ); -if ((regval &SCRATCH_PAD_MIPSALL_READY ) != -SCRATCH_PAD_MIPSALL_READY ) { +if ((regval & mipsall_ready) != mipsall_ready) { pm8001_ha->controller_fatal_error = true; pm8001_dbg(pm8001_ha, FAIL, "Firmware Fatal error! Regval:0x%x\n",
drivers/scsi/pm8001/pm80xx_hwi.h +5 -1
@@ -1405,8 +1405,12 @@ typedef struct SASProtocolTimerConfig SASProtocolTimerConfig_t;#define SCRATCH_PAD_BOOT_LOAD_SUCCESS 0x0#define SCRATCH_PAD_IOP0_READY 0xC00#define SCRATCH_PAD_IOP1_READY 0x3000 -#define SCRATCH_PAD_MIPSALL_READY (SCRATCH_PAD_IOP1_READY | \ +#define SCRATCH_PAD_MIPSALL_READY_16PORT (SCRATCH_PAD_IOP1_READY | \ SCRATCH_PAD_IOP0_READY | \ + SCRATCH_PAD_ILA_READY | \ + SCRATCH_PAD_RAAE_READY) +#define SCRATCH_PAD_MIPSALL_READY_8PORT (SCRATCH_PAD_IOP0_READY | \ + SCRATCH_PAD_ILA_READY | \ SCRATCH_PAD_RAAE_READY)/* boot loader state */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 49/203 scsi: ufs: Use generic error code in ufshcd_set_dev_pwr_mode()
In reply to Greg Kroah-HartmanFrom: Kiwoong Kim <[email protected]>
[ Upstream commit ad6c8a426446873febc98140d81d5353f8c0825b ]
The return value of ufshcd_set_dev_pwr_mode() is passed to device PM core. However, the function currently returns a SCSI result which the PM core doesn't understand. This might lead to unexpected behaviors in userland; a platform reset was observed in Android.
Use a generic error code for SSU failures.
--- drivers/scsi/ufs/ufshcd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/scsi/ufs/ufshcd.c +6 -3
@@ -8587,7 +8587,7 @@ static void ufshcd_hba_exit(struct ufs_hba *hba)* @pwr_mode: device power mode to set * * Returns 0 if requested power mode is set successfully -* Returns non-zero if failed to set the requested power mode +* Returns < 0 if failed to set the requested power mode */ static int ufshcd_set_dev_pwr_mode (struct ufs_hba *hba,enum ufs_dev_pwr_mode pwr_mode)
@@ -8641,8 +8641,11 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,sdev_printk (KERN_WARNING , sdp,"START_STOP failed for power mode: %d, result %x\n" , pwr_mode, ret); -if (ret >0 &&scsi_sense_valid (&sshdr)) -scsi_print_sense_hdr (sdp,NULL , &sshdr); +if (ret >0 ) { +if (scsi_sense_valid (&sshdr)) +scsi_print_sense_hdr (sdp,NULL , &sshdr); + ret = -EIO ; + } }if (!ret)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 50/203 scsi: ufs: Treat link loss as fatal error
In reply to Greg Kroah-HartmanFrom: Kiwoong Kim <[email protected]>
[ Upstream commit c99b9b2301492b665b6e51ba6c06ec362eddcd10 ]
This event is raised when link is lost as specified in UFSHCI spec and that means communication is not possible. Thus initializing UFS interface needs to be done.
Make UFS driver considers Link Lost as fatal in the INT_FATAL_ERRORS mask. This will trigger a host reset whenever a link lost interrupt occurs.
--- drivers/scsi/ufs/ufshci.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufshci.h +2 -1
@@ -142,7 +142,8 @@ static inline u32 ufshci_version(u32 major, u32 minor)#define INT_FATAL_ERRORS (DEVICE_FATAL_ERROR |\ CONTROLLER_FATAL_ERROR |\ SYSTEM_BUS_FATAL_ERROR |\ - CRYPTO_ENGINE_FATAL_ERROR) + CRYPTO_ENGINE_FATAL_ERROR |\ + UIC_LINK_LOST)/* HCS - Host Controller Status 30h */ #define DEVICE_PRESENT 0x1
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 51/203 scsi: myrs: Fix crash in error case
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit 4db09593af0b0b4d7d4805ebb3273df51d7cc30d ]
In myrs_detect(), cs->disable_intr is NULL when privdata->hw_init() fails with non-zero. In this case, myrs_cleanup(cs) will call a NULL ptr and crash the kernel.
[ 1.105606] myrs 0000:00:03.0: Unknown Initialization Error 5A [ 1.105872] myrs 0000:00:03.0: Failed to initialize Controller [ 1.106082] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 1.110774] Call Trace: [ 1.110950] myrs_cleanup+0xe4/0x150 [myrs] [ 1.111135] myrs_probe.cold+0x91/0x56a [myrs] [ 1.111302] ? DAC960_GEM_intr_handler+0x1f0/0x1f0 [myrs] [ 1.111500] local_pci_probe+0x48/0x90
--- drivers/scsi/myrs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/myrs.c +2 -1
@@ -2269,7 +2269,8 @@ static void myrs_cleanup(struct myrs_hba *cs)myrs_unmap (cs);if (cs->mmio_base) { - cs->disable_intr (cs); +if (cs->disable_intr) + cs->disable_intr (cs);iounmap (cs->mmio_base); cs->mmio_base =NULL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 52/203 net: stmmac: reduce unnecessary wakeups from eee sw timer
In reply to Greg Kroah-HartmanFrom: Jisheng Zhang <[email protected]>
[ Upstream commit c74ead223deb88bdf18af8c772d7ca5a9b6c3c2b ]
Currently, on EEE capable platforms, if EEE SW timer is used, the SW timer cause 1 wakeup/s even if the TX has successfully entered EEE. Remove this unnecessary wakeup by only calling mod_timer() if we haven't successfully entered EEE.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +7 -6
@@ -400,7 +400,7 @@ static void stmmac_lpi_entry_timer_config(struct stmmac_priv *priv, bool en)* Description: this function is to verify and enter in LPI mode in case of * EEE. */ -static void stmmac_enable_eee_mode (struct stmmac_priv *priv) +static int stmmac_enable_eee_mode (struct stmmac_priv *priv) {u32 tx_cnt = priv->plat->tx_queues_to_use;u32 queue;
@@ -410,13 +410,14 @@ static void stmmac_enable_eee_mode(struct stmmac_priv *priv)struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];if (tx_q->dirty_tx != tx_q->cur_tx) -return ;/* still unfinished work */ +return -EBUSY ;/* still unfinished work */ }/* Check and enter in LPI mode */ if (!priv->tx_path_in_lpi_mode)stmmac_set_eee_mode (priv, priv->hw, priv->plat->en_tx_lpi_clockgating); +return 0 ; }/**
@@ -448,8 +449,8 @@ static void stmmac_eee_ctrl_timer(struct timer_list *t) {struct stmmac_priv *priv =from_timer (priv, t, eee_ctrl_timer); -stmmac_enable_eee_mode (priv); -mod_timer (&priv->eee_ctrl_timer,STMMAC_LPI_T (priv->tx_lpi_timer)); +if (stmmac_enable_eee_mode (priv)) +mod_timer (&priv->eee_ctrl_timer,STMMAC_LPI_T (priv->tx_lpi_timer)); }/**
@@ -2641,8 +2642,8 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue)if (priv->eee_enabled && !priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en) { -stmmac_enable_eee_mode (priv); -mod_timer (&priv->eee_ctrl_timer,STMMAC_LPI_T (priv->tx_lpi_timer)); +if (stmmac_enable_eee_mode (priv)) +mod_timer (&priv->eee_ctrl_timer,STMMAC_LPI_T (priv->tx_lpi_timer)); }/* We still have pending packets, let's call for a new scheduling */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 53/203 PM: hibernate: Remove register_nosave_region_late()
In reply to Greg Kroah-HartmanFrom: Amadeusz Sławiński <[email protected]>
[ Upstream commit 33569ef3c754a82010f266b7b938a66a3ccf90a4 ]
It is an unused wrapper forcing kmalloc allocation for registering nosave regions. Also, rename __register_nosave_region() to register_nosave_region() now that there is no need for disambiguation.
--- include/linux/suspend.h | 11 +---------- kernel/power/snapshot.c | 21 +++++++-------------- 2 files changed, 8 insertions(+), 24 deletions(-)
include/linux/suspend.h +1 -10
@@ -430,15 +430,7 @@ struct platform_hibernation_ops {#ifdef CONFIG_HIBERNATION /* kernel/power/snapshot.c */ -extern void __register_nosave_region (unsigned long b,unsigned long e,int km); -static inline void __init register_nosave_region (unsigned long b,unsigned long e) -{ -__register_nosave_region (b, e,0 ); -} -static inline void __init register_nosave_region_late (unsigned long b,unsigned long e) -{ -__register_nosave_region (b, e,1 ); -} +extern void register_nosave_region (unsigned long b,unsigned long e);extern int swsusp_page_is_forbidden (struct page *);extern void swsusp_set_page_free (struct page *);extern void swsusp_unset_page_free (struct page *);
@@ -457,7 +449,6 @@ int pfn_is_nosave(unsigned long pfn);int hibernate_quiet_exec (int (*func)(void *data),void *data);#else /* CONFIG_HIBERNATION */ static inline void register_nosave_region (unsigned long b,unsigned long e) {} -static inline void register_nosave_region_late (unsigned long b,unsigned long e) {}static inline int swsusp_page_is_forbidden (struct page *p) {return 0 ; }static inline void swsusp_set_page_free (struct page *p) {}static inline void swsusp_unset_page_free (struct page *p) {}
kernel/power/snapshot.c +7 -14
@@ -978,8 +978,7 @@ static void memory_bm_recycle(struct memory_bitmap *bm)* Register a range of page frames the contents of which should not be saved * during hibernation (to be used in the early initialization code). */ -void __init __register_nosave_region (unsigned long start_pfn, -unsigned long end_pfn,int use_kmalloc) +void __init register_nosave_region (unsigned long start_pfn,unsigned long end_pfn) {struct nosave_region *region;
@@ -995,18 +994,12 @@ void __init __register_nosave_region(unsigned long start_pfn, goto Report; } } -if (use_kmalloc) { -/* During init, this shouldn't fail */ - region =kmalloc (sizeof (struct nosave_region ),GFP_KERNEL ); -BUG_ON (!region); - }else { -/* This allocation cannot fail */ - region =memblock_alloc (sizeof (struct nosave_region ), -SMP_CACHE_BYTES ); -if (!region) -panic ("%s: Failed to allocate %zu bytes\n" , __func__, -sizeof (struct nosave_region )); - } +/* This allocation cannot fail */ + region =memblock_alloc (sizeof (struct nosave_region ), +SMP_CACHE_BYTES ); +if (!region) +panic ("%s: Failed to allocate %zu bytes\n" , __func__, +sizeof (struct nosave_region )); region->start_pfn = start_pfn; region->end_pfn = end_pfn;list_add_tail (®ion->list, &nosave_regions);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 54/203 drm/amd/display: Correct MPC split policy for DCN301
In reply to Greg Kroah-HartmanFrom: Zhan Liu <[email protected]>
[ Upstream commit ac46d93235074a6c5d280d35771c23fd8620e7d9 ]
[Why]
DCN301 has seamless boot enabled. With MPC split enabled at the same time, system will hang.
[How]
Revert MPC split policy back to "MPC_SPLIT_AVOID". Since we have ODM combine enabled on DCN301, pipe split is not necessary here.
--- drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c +1 -1
@@ -686,7 +686,7 @@ static const struct dc_debug_options debug_defaults_drv = { .disable_clock_gate = true, .disable_pplib_clock_request = true, .disable_pplib_wm_range = true, - .pipe_split_policy = MPC_SPLIT_DYNAMIC, + .pipe_split_policy = MPC_SPLIT_AVOID, .force_single_disp_pipe_split = false, .disable_dcc = DCC_ENABLE, .vsr_support = true,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 55/203 drm/amdgpu/display: adjust msleep limit in dp_wait_for_training_aux_rd_interval
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit dc919d670c6fd1ac81ebf31625cd19579f7b3d4c ]
Some architectures (e.g., ARM) have relatively low udelay limits. On most architectures, anything longer than 2000us is not recommended. Change the check to align with other similar checks in DC.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -1
@@ -201,7 +201,7 @@ void dp_wait_for_training_aux_rd_interval( uint32_t wait_in_micro_secs) {#if defined(CONFIG_DRM_AMD_DC_DCN ) -if (wait_in_micro_secs >16000 ) +if (wait_in_micro_secs >1000 )msleep (wait_in_micro_secs/1000 );else udelay (wait_in_micro_secs);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 56/203 drm/amdgpu/display: use msleep rather than udelay for long delays
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 98fdcacb45f7cd2092151d6af2e60152811eb79c ]
Some architectures (e.g., ARM) throw an compilation error if the udelay is too long. In general udelays of longer than 2000us are not recommended on any architecture. Switch to msleep in these cases.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +2 -2
@@ -6058,7 +6058,7 @@ bool dpcd_write_128b_132b_sst_payload_allocation_table( } } retries++; -udelay (5000 ); +msleep (5 ); }if (!result && retries == max_retries) {
@@ -6110,7 +6110,7 @@ bool dpcd_poll_for_allocation_change_trigger(struct dc_link *link)break ; } -udelay (5000 ); +msleep (5 ); }if (result ==ACT_FAILED ) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 57/203 usb: dwc2: gadget: dont try to disable ep0 in dwc2_hsotg_suspend
In reply to Greg Kroah-HartmanFrom: Amelie Delaunay <[email protected]>
[ Upstream commit ac55d163855924aa5af9f1560977da8f346963c8 ]
Calling dwc2_hsotg_ep_disable on ep0 (in/out) will lead to the following logs before returning -EINVAL:
dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0 dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0
To avoid these two logs while suspending, start disabling the endpoint from the index 1, as done in dwc2_hsotg_udc_stop:
/* all endpoints should be shutdown */
for (ep = 1; ep < hsotg->num_of_eps; ep++) {
if (hsotg->eps_in[ep])
dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep);
if (hsotg->eps_out[ep])
dwc2_hsotg_ep_disable_lock(&hsotg->eps_out[ep]->ep);
}--- drivers/usb/dwc2/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc2/gadget.c +1 -1
@@ -5097,7 +5097,7 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg) hsotg->gadget.speed =USB_SPEED_UNKNOWN ;spin_unlock_irqrestore (&hsotg->lock, flags); -for (ep =0 ; ep < hsotg->num_of_eps; ep++) { +for (ep =1 ; ep < hsotg->num_of_eps; ep++) {if (hsotg->eps_in[ep])dwc2_hsotg_ep_disable_lock (&hsotg->eps_in[ep]->ep);if (hsotg->eps_out[ep])
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 58/203 perf: Always wake the parent event
In reply to Greg Kroah-HartmanFrom: James Clark <[email protected]>
[ Upstream commit 961c39121759ad09a89598ec4ccdd34ae0468a19 ]
When using per-process mode and event inheritance is set to true, forked processes will create a new perf events via inherit_event() -> perf_event_alloc(). But these events will not have ring buffers assigned to them. Any call to wakeup will be dropped if it's called on an event with no ring buffer assigned because that's the object that holds the wakeup list.
If the child event is disabled due to a call to perf_aux_output_begin() or perf_aux_output_end(), the wakeup is dropped leaving userspace hanging forever on the poll.
Normally the event is explicitly re-enabled by userspace after it wakes up to read the aux data, but in this case it does not get woken up so the event remains disabled.
This can be reproduced when using Arm SPE and 'stress' which forks once before running the workload. By looking at the list of aux buffers read, it's apparent that they stop after the fork:
perf record -e arm_spe// -vvv -- stress -c 1
With this patch applied they continue to be printed. This behaviour doesn't happen when using systemwide or per-cpu mode.
--- kernel/events/core.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
kernel/events/core.c +10 -2
@@ -6004,6 +6004,8 @@ static void ring_buffer_attach(struct perf_event *event,struct perf_buffer *old_rb =NULL ;unsigned long flags; +WARN_ON_ONCE (event->parent); +if (event->rb) {/* * Should be impossible, we set this when removing
@@ -6061,6 +6063,9 @@ static void ring_buffer_wakeup(struct perf_event *event) {struct perf_buffer *rb; +if (event->parent) + event = event->parent; +rcu_read_lock (); rb =rcu_dereference (event->rb);if (rb) {
@@ -6074,6 +6079,9 @@ struct perf_buffer *ring_buffer_get(struct perf_event *event) {struct perf_buffer *rb; +if (event->parent) + event = event->parent; +rcu_read_lock (); rb =rcu_dereference (event->rb);if (rb) {
@@ -6772,7 +6780,7 @@ static unsigned long perf_prepare_sample_aux(struct perf_event *event,if (WARN_ON_ONCE (READ_ONCE (sampler->oncpu) !=smp_processor_id ())) goto out; - rb =ring_buffer_get (sampler->parent ? sampler->parent : sampler); + rb =ring_buffer_get (sampler);if (!rb) goto out;
@@ -6838,7 +6846,7 @@ static void perf_aux_sample_output(struct perf_event *event,if (WARN_ON_ONCE (!sampler || !data->aux_size))return ; - rb =ring_buffer_get (sampler->parent ? sampler->parent : sampler); + rb =ring_buffer_get (sampler);if (!rb)return ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 59/203 nvme-pci: add the IGNORE_DEV_SUBNQN quirk for Intel P4500/P4600 SSDs
In reply to Greg Kroah-HartmanFrom: Wu Zheng <[email protected]>
[ Upstream commit 25e58af4be412d59e056da65cc1cefbd89185bd2 ]
The Intel P4500/P4600 SSDs do not report a subsystem NQN despite claiming compliance to a standards version where reporting one is required.
Add the IGNORE_DEV_SUBNQN quirk to not fail the initialization of a second such SSDs in a system.
--- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +2 -1
@@ -3326,7 +3326,8 @@ static const struct pci_device_id nvme_id_table[] = { NVME_QUIRK_DEALLOCATE_ZEROES, }, { PCI_VDEVICE(INTEL, 0x0a54), /* Intel P4500/P4600 */ .driver_data =NVME_QUIRK_STRIPE_SIZE | - NVME_QUIRK_DEALLOCATE_ZEROES, }, +NVME_QUIRK_DEALLOCATE_ZEROES | + NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_VDEVICE(INTEL, 0x0a55), /* Dell Express Flash P4600 */ .driver_data = NVME_QUIRK_STRIPE_SIZE | NVME_QUIRK_DEALLOCATE_ZEROES, },
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 60/203 MIPS: Fix build error due to PTR used in more places
In reply to Greg Kroah-HartmanFrom: Thomas Bogendoerfer <[email protected]>
[ Upstream commit fa62f39dc7e25fc16371b958ac59b9a6fd260bea ]
Use PTR_WD instead of PTR to avoid clashes with other parts.
--- arch/mips/include/asm/asm.h | 4 +- arch/mips/include/asm/ftrace.h | 4 +- arch/mips/include/asm/r4kcache.h | 4 +- arch/mips/include/asm/unaligned-emul.h | 176 ++++++++++++------------- arch/mips/kernel/mips-r2-to-r6-emul.c | 104 +++++++-------- arch/mips/kernel/r2300_fpu.S | 6 +- arch/mips/kernel/r4k_fpu.S | 2 +- arch/mips/kernel/relocate_kernel.S | 22 ++-- arch/mips/kernel/scall32-o32.S | 10 +- arch/mips/kernel/scall64-n32.S | 2 +- arch/mips/kernel/scall64-n64.S | 2 +- arch/mips/kernel/scall64-o32.S | 10 +- arch/mips/kernel/syscall.c | 8 +- arch/mips/lib/csum_partial.S | 4 +- arch/mips/lib/memcpy.S | 4 +- arch/mips/lib/memset.S | 2 +- arch/mips/lib/strncpy_user.S | 4 +- arch/mips/lib/strnlen_user.S | 2 +- 18 files changed, 185 insertions(+), 185 deletions(-)
arch/mips/include/asm/asm.h +2 -2
@@ -276,7 +276,7 @@ symbol = value#define PTR_SCALESHIFT 2 -#define PTR .word +#define PTR_WD .word#define PTRSIZE 4#define PTRLOG 2#endif
@@ -301,7 +301,7 @@ symbol = value#define PTR_SCALESHIFT 3 -#define PTR .dword +#define PTR_WD .dword#define PTRSIZE 8#define PTRLOG 3#endif
arch/mips/include/asm/ftrace.h +2 -2
@@ -32,7 +32,7 @@ do { \".previous\n" \ \".section\t__ex_table,\"a\"\n\t" \ - STR(PTR) "\t1b, 3b\n\t" \ + STR(PTR_WD) "\t1b, 3b\n\t" \".previous\n" \ \ : [tmp_dst] "=&r" (dst), [tmp_err] "=r" (error)\
@@ -54,7 +54,7 @@ do { \".previous\n" \ \".section\t__ex_table,\"a\"\n\t" \ - STR(PTR) "\t1b, 3b\n\t" \ + STR(PTR_WD) "\t1b, 3b\n\t" \".previous\n" \ \ : [tmp_err] "=r" (error) \
arch/mips/include/asm/r4kcache.h +2 -2
@@ -119,7 +119,7 @@ static inline void flush_scache_line(unsigned long addr)" j 2b \n" \" .previous \n" \" .section __ex_table,\"a\" \n" \ - " "STR(PTR)" 1b, 3b \n" \ + " "STR(PTR_WD)" 1b, 3b \n" \" .previous" \ : "+r" (__err) \: " i" (op), " r" (addr), " i" (-EFAULT)); \
@@ -142,7 +142,7 @@ static inline void flush_scache_line(unsigned long addr)" j 2b \n" \" .previous \n" \" .section __ex_table,\"a\" \n" \ - " "STR(PTR)" 1b, 3b \n" \ + " "STR(PTR_WD)" 1b, 3b \n" \" .previous" \ : "+r" (__err) \: " i" (op), " r" (addr), " i" (-EFAULT)); \
arch/mips/include/asm/unaligned-emul.h +88 -88
332 lines not on this page · raw message
arch/mips/kernel/mips-r2-to-r6-emul.c +52 -52
176 lines not on this page · raw message
arch/mips/kernel/r2300_fpu.S +3 -3
@@ -23,14 +23,14 @@ #define EX(a,b) \ 9: a,##b; \ .section __ex_table,"a"; \ - PTR 9b,fault; \ + PTR_WD 9b,fault; \ .previous #define EX2(a,b) \ 9: a,##b; \ .section __ex_table,"a"; \ - PTR 9b,fault; \ - PTR 9b+4,fault; \ + PTR_WD 9b,fault; \ + PTR_WD 9b+4,fault; \ .previous .set mips1
arch/mips/kernel/r4k_fpu.S +1 -1
@@ -31,7 +31,7 @@ .ex\@: \insn \reg, \src .set pop .section __ex_table,"a" - PTR .ex\@, fault + PTR_WD .ex\@, fault .previous .endm
arch/mips/kernel/relocate_kernel.S +11 -11
@@ -147,10 +147,10 @@ LEAF(kexec_smp_wait) kexec_args: EXPORT(kexec_args) -arg0: PTR 0x0 -arg1: PTR 0x0 -arg2: PTR 0x0 -arg3: PTR 0x0 +arg0: PTR_WD 0x0 +arg1: PTR_WD 0x0 +arg2: PTR_WD 0x0 +arg3: PTR_WD 0x0 .size kexec_args,PTRSIZE*4 #ifdef CONFIG_SMP
@@ -161,10 +161,10 @@ arg3: PTR 0x0 */ secondary_kexec_args: EXPORT(secondary_kexec_args) -s_arg0: PTR 0x0 -s_arg1: PTR 0x0 -s_arg2: PTR 0x0 -s_arg3: PTR 0x0 +s_arg0: PTR_WD 0x0 +s_arg1: PTR_WD 0x0 +s_arg2: PTR_WD 0x0 +s_arg3: PTR_WD 0x0 .size secondary_kexec_args,PTRSIZE*4 kexec_flag: LONG 0x1
@@ -173,17 +173,17 @@ kexec_flag: kexec_start_address: EXPORT(kexec_start_address) - PTR 0x0 + PTR_WD 0x0 .size kexec_start_address, PTRSIZE kexec_indirection_page: EXPORT(kexec_indirection_page) - PTR 0 + PTR_WD 0 .size kexec_indirection_page, PTRSIZE relocate_new_kernel_end: relocate_new_kernel_size: EXPORT(relocate_new_kernel_size) - PTR relocate_new_kernel_end - relocate_new_kernel + PTR_WD relocate_new_kernel_end - relocate_new_kernel .size relocate_new_kernel_size, PTRSIZE
arch/mips/kernel/scall32-o32.S +5 -5
@@ -72,10 +72,10 @@ loads_done: .set pop .section __ex_table,"a" - PTR load_a4, bad_stack_a4 - PTR load_a5, bad_stack_a5 - PTR load_a6, bad_stack_a6 - PTR load_a7, bad_stack_a7 + PTR_WD load_a4, bad_stack_a4 + PTR_WD load_a5, bad_stack_a5 + PTR_WD load_a6, bad_stack_a6 + PTR_WD load_a7, bad_stack_a7 .previous lw t0, TI_FLAGS($28) # syscall tracing enabled?
@@ -216,7 +216,7 @@ einval: li v0, -ENOSYS #endif /* CONFIG_MIPS_MT_FPAFF */ #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native) -#define __SYSCALL(nr, entry) PTR entry +#define __SYSCALL(nr, entry) PTR_WD entry .align 2 .type sys_call_table, @object EXPORT(sys_call_table)
arch/mips/kernel/scall64-n32.S +1 -1
@@ -101,7 +101,7 @@ not_n32_scall: END(handle_sysn32) -#define __SYSCALL(nr, entry) PTR entry +#define __SYSCALL(nr, entry) PTR_WD entry .type sysn32_call_table, @object EXPORT(sysn32_call_table) #include <asm/syscall_table_n32.h>
arch/mips/kernel/scall64-n64.S +1 -1
@@ -109,7 +109,7 @@ illegal_syscall: j n64_syscall_exit END(handle_sys64) -#define __SYSCALL(nr, entry) PTR entry +#define __SYSCALL(nr, entry) PTR_WD entry .align 3 .type sys_call_table, @object EXPORT(sys_call_table)
arch/mips/kernel/scall64-o32.S +5 -5
@@ -73,10 +73,10 @@ load_a7: lw a7, 28(t0) # argument #8 from usp loads_done: .section __ex_table,"a" - PTR load_a4, bad_stack_a4 - PTR load_a5, bad_stack_a5 - PTR load_a6, bad_stack_a6 - PTR load_a7, bad_stack_a7 + PTR_WD load_a4, bad_stack_a4 + PTR_WD load_a5, bad_stack_a5 + PTR_WD load_a6, bad_stack_a6 + PTR_WD load_a7, bad_stack_a7 .previous li t1, _TIF_WORK_SYSCALL_ENTRY
@@ -214,7 +214,7 @@ einval: li v0, -ENOSYS END(sys32_syscall) #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat) -#define __SYSCALL(nr, entry) PTR entry +#define __SYSCALL(nr, entry) PTR_WD entry .align 3 .type sys32_call_table,@object EXPORT(sys32_call_table)
arch/mips/kernel/syscall.c +4 -4
@@ -122,8 +122,8 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new)" j 3b \n" " .previous \n" " .section __ex_table,\"a\" \n" - " "STR(PTR)" 1b, 4b \n" - " "STR(PTR)" 2b, 4b \n" + " "STR(PTR_WD)" 1b, 4b \n" + " "STR(PTR_WD)" 2b, 4b \n"" .previous \n" " .set pop \n" : [old] "=&r" (old),
@@ -152,8 +152,8 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new)" j 3b \n" " .previous \n" " .section __ex_table,\"a\" \n" - " "STR(PTR)" 1b, 5b \n" - " "STR(PTR)" 2b, 5b \n" + " "STR(PTR_WD)" 1b, 5b \n" + " "STR(PTR_WD)" 2b, 5b \n"" .previous \n" " .set pop \n" : [old] "=&r" (old),
arch/mips/lib/csum_partial.S +2 -2
@@ -347,7 +347,7 @@ EXPORT_SYMBOL(csum_partial) .if \mode == LEGACY_MODE; \ 9: insn reg, addr; \ .section __ex_table,"a"; \ - PTR 9b, .L_exc; \ + PTR_WD 9b, .L_exc; \ .previous; \ /* This is enabled in EVA mode */ \ .else; \
@@ -356,7 +356,7 @@ EXPORT_SYMBOL(csum_partial) ((\to == USEROP) && (type == ST_INSN)); \ 9: __BUILD_EVA_INSN(insn##e, reg, addr); \ .section __ex_table,"a"; \ - PTR 9b, .L_exc; \ + PTR_WD 9b, .L_exc; \ .previous; \ .else; \ /* EVA without exception */ \
arch/mips/lib/memcpy.S +2 -2
@@ -116,7 +116,7 @@ .if \mode == LEGACY_MODE; \ 9: insn reg, addr; \ .section __ex_table,"a"; \ - PTR 9b, handler; \ + PTR_WD 9b, handler; \ .previous; \ /* This is assembled in EVA mode */ \ .else; \
@@ -125,7 +125,7 @@ ((\to == USEROP) && (type == ST_INSN)); \ 9: __BUILD_EVA_INSN(insn##e, reg, addr); \ .section __ex_table,"a"; \ - PTR 9b, handler; \ + PTR_WD 9b, handler; \ .previous; \ .else; \ /* \
arch/mips/lib/memset.S +1 -1
@@ -52,7 +52,7 @@ 9: ___BUILD_EVA_INSN(insn, reg, addr); \ .endif; \ .section __ex_table,"a"; \ - PTR 9b, handler; \ + PTR_WD 9b, handler; \ .previous .macro f_fill64 dst, offset, val, fixup, mode
arch/mips/lib/strncpy_user.S +2 -2
@@ -15,7 +15,7 @@ #define EX(insn,reg,addr,handler) \ 9: insn reg, addr; \ .section __ex_table,"a"; \ - PTR 9b, handler; \ + PTR_WD 9b, handler; \ .previous /*
@@ -59,7 +59,7 @@ LEAF(__strncpy_from_user_asm) jr ra .section __ex_table,"a" - PTR 1b, .Lfault + PTR_WD 1b, .Lfault .previous EXPORT_SYMBOL(__strncpy_from_user_asm)
arch/mips/lib/strnlen_user.S +1 -1
@@ -14,7 +14,7 @@ #define EX(insn,reg,addr,handler) \ 9: insn reg, addr; \ .section __ex_table,"a"; \ - PTR 9b, handler; \ + PTR_WD 9b, handler; \ .previous /*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 61/203 net: stmmac: dwmac-sun8i: use return val of readl_poll_timeout()
In reply to Greg Kroah-HartmanFrom: Jisheng Zhang <[email protected]>
[ Upstream commit 9e0db41e7a0b6f1271cbcfb16dbf5b8641b4e440 ]
When readl_poll_timeout() timeout, we'd better directly use its return value.
Before this patch:
[ 2.145528] dwmac-sun8i: probe of 4500000.ethernet failed with error -14
After this patch:
[ 2.138520] dwmac-sun8i: probe of 4500000.ethernet failed with error -110
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +1 -1
@@ -756,7 +756,7 @@ static int sun8i_dwmac_reset(struct stmmac_priv *priv)if (err) {dev_err (priv->device,"EMAC reset timeout\n" ); -return -EFAULT ; +return err; }return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 62/203 arm64: errata: Add detection for TRBE ignored system register writes
In reply to Greg Kroah-HartmanFrom: Anshuman Khandual <[email protected]>
[ Upstream commit 607a9afaae09cde21ece458a8f10cb99d3f94f14 ]
TRBE implementations affected by Arm erratum #2064142 might fail to write into certain system registers after the TRBE has been disabled. Under some conditions after TRBE has been disabled, writes into certain TRBE registers TRBLIMITR_EL1, TRBPTR_EL1, TRBBASER_EL1, TRBSR_EL1 and TRBTRG_EL1 will be ignored and not be effected. This adds a new errata ARM64_ERRATUM_2064142 in arm64 errata framework.
--- Documentation/arm64/silicon-errata.rst | 2 ++ arch/arm64/Kconfig | 18 ++++++++++++++++++ arch/arm64/kernel/cpu_errata.c | 9 +++++++++ arch/arm64/tools/cpucaps | 1 + 4 files changed, 30 insertions(+)
Documentation/arm64/silicon-errata.rst +2 -0
@@ -52,6 +52,8 @@ stable kernels. | Allwinner | A64/R18 | UNKNOWN1 | SUN50I_ERRATUM_UNKNOWN1 | +----------------+-----------------+-----------------+-----------------------------+ +----------------+-----------------+-----------------+-----------------------------+ +| ARM | Cortex-A510 | #2064142 | ARM64_ERRATUM_2064142 | ++----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 | +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 |
arch/arm64/Kconfig +18 -0
@@ -778,6 +778,24 @@ config ARM64_ERRATUM_2224489 If unsure, say Y. +config ARM64_ERRATUM_2064142 + bool "Cortex-A510: 2064142: workaround TRBE register writes while disabled" + depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in + default y + help + This option adds the workaround for ARM Cortex-A510 erratum 2064142. + + Affected Cortex-A510 core might fail to write into system registers after the + TRBE has been disabled. Under some conditions after the TRBE has been disabled + writes into TRBE registers TRBLIMITR_EL1, TRBPTR_EL1, TRBBASER_EL1, TRBSR_EL1, + and TRBTRG_EL1 will be ignored and will not be effected. + + Work around this in the driver by executing TSB CSYNC and DSB after collection + is stopped and before performing a system register write to one of the affected + registers. + + If unsure, say Y. + config CAVIUM_ERRATUM_22375 bool "Cavium erratum 22375, 24313" default y
arch/arm64/kernel/cpu_errata.c +9 -0
@@ -599,6 +599,15 @@ const struct arm64_cpu_capabilities arm64_errata[] = { .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE, CAP_MIDR_RANGE_LIST(trbe_write_out_of_range_cpus), }, +#endif +#ifdef CONFIG_ARM64_ERRATUM_2064142 + { + .desc = "ARM erratum 2064142", + .capability = ARM64_WORKAROUND_2064142, + + /* Cortex-A510 r0p0 - r0p2 */ + ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2) + }, #endif { }
arch/arm64/tools/cpucaps +1 -0
@@ -55,6 +55,7 @@ WORKAROUND_1418040 WORKAROUND_1463225 WORKAROUND_1508412 WORKAROUND_1542419 +WORKAROUND_2064142 WORKAROUND_TRBE_OVERWRITE_FILL_MODE WORKAROUND_TSB_FLUSH_FAILURE WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 63/203 arm64: errata: Add detection for TRBE invalid prohibited states
In reply to Greg Kroah-HartmanFrom: Anshuman Khandual <[email protected]>
[ Upstream commit 3bd94a8759de9b724b83a80942b0354acd7701eb ]
TRBE implementations affected by Arm erratum #2038923 might get TRBE into an inconsistent view on whether trace is prohibited within the CPU. As a result, the trace buffer or trace buffer state might be corrupted. This happens after TRBE buffer has been enabled by setting TRBLIMITR_EL1.E, followed by just a single context synchronization event before execution changes from a context, in which trace is prohibited to one where it isn't, or vice versa. In these mentioned conditions, the view of whether trace is prohibited is inconsistent between parts of the CPU, and the trace buffer or the trace buffer state might be corrupted. This adds a new errata ARM64_ERRATUM_2038923 in arm64 errata framework.
--- Documentation/arm64/silicon-errata.rst | 2 ++ arch/arm64/Kconfig | 23 +++++++++++++++++++++++ arch/arm64/kernel/cpu_errata.c | 9 +++++++++ arch/arm64/tools/cpucaps | 1 + 4 files changed, 35 insertions(+)
Documentation/arm64/silicon-errata.rst +2 -0
@@ -54,6 +54,8 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A510 | #2064142 | ARM64_ERRATUM_2064142 | +----------------+-----------------+-----------------+-----------------------------+ +| ARM | Cortex-A510 | #2038923 | ARM64_ERRATUM_2038923 | ++----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 | +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 |
arch/arm64/Kconfig +23 -0
@@ -796,6 +796,29 @@ config ARM64_ERRATUM_2064142 If unsure, say Y. +config ARM64_ERRATUM_2038923 + bool "Cortex-A510: 2038923: workaround TRBE corruption with enable" + depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in + default y + help + This option adds the workaround for ARM Cortex-A510 erratum 2038923. + + Affected Cortex-A510 core might cause an inconsistent view on whether trace is + prohibited within the CPU. As a result, the trace buffer or trace buffer state + might be corrupted. This happens after TRBE buffer has been enabled by setting + TRBLIMITR_EL1.E, followed by just a single context synchronization event before + execution changes from a context, in which trace is prohibited to one where it + isn't, or vice versa. In these mentioned conditions, the view of whether trace + is prohibited is inconsistent between parts of the CPU, and the trace buffer or + the trace buffer state might be corrupted. + + Work around this in the driver by preventing an inconsistent view of whether the + trace is prohibited or not based on TRBLIMITR_EL1.E by immediately following a + change to TRBLIMITR_EL1.E with at least one ISB instruction before an ERET, or + two ISB instructions if no ERET is to take place. + + If unsure, say Y. + config CAVIUM_ERRATUM_22375 bool "Cavium erratum 22375, 24313" default y
arch/arm64/kernel/cpu_errata.c +9 -0
@@ -609,6 +609,15 @@ const struct arm64_cpu_capabilities arm64_errata[] = { ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2) },#endif +#ifdef CONFIG_ARM64_ERRATUM_2038923 + { + .desc = "ARM erratum 2038923", + .capability = ARM64_WORKAROUND_2038923, + + /* Cortex-A510 r0p0 - r0p2 */ + ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2) + }, +#endif { } };
arch/arm64/tools/cpucaps +1 -0
@@ -56,6 +56,7 @@ WORKAROUND_1463225 WORKAROUND_1508412 WORKAROUND_1542419 WORKAROUND_2064142 +WORKAROUND_2038923 WORKAROUND_TRBE_OVERWRITE_FILL_MODE WORKAROUND_TSB_FLUSH_FAILURE WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 64/203 arm64: errata: Add detection for TRBE trace data corruption
In reply to Greg Kroah-HartmanFrom: Anshuman Khandual <[email protected]>
[ Upstream commit 708e8af4924ec2fdd5b81fe09192c6bac2f86935 ]
TRBE implementations affected by Arm erratum #1902691 might corrupt trace data or deadlock, when it's being written into the memory. So effectively TRBE is broken and hence cannot be used to capture trace data. This adds a new errata ARM64_ERRATUM_1902691 in arm64 errata framework.
--- Documentation/arm64/silicon-errata.rst | 2 ++ arch/arm64/Kconfig | 18 ++++++++++++++++++ arch/arm64/kernel/cpu_errata.c | 9 +++++++++ arch/arm64/tools/cpucaps | 1 + 4 files changed, 30 insertions(+)
Documentation/arm64/silicon-errata.rst +2 -0
@@ -56,6 +56,8 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A510 | #2038923 | ARM64_ERRATUM_2038923 | +----------------+-----------------+-----------------+-----------------------------+ +| ARM | Cortex-A510 | #1902691 | ARM64_ERRATUM_1902691 | ++----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 | +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 |
arch/arm64/Kconfig +18 -0
@@ -819,6 +819,24 @@ config ARM64_ERRATUM_2038923 If unsure, say Y. +config ARM64_ERRATUM_1902691 + bool "Cortex-A510: 1902691: workaround TRBE trace corruption" + depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in + default y + help + This option adds the workaround for ARM Cortex-A510 erratum 1902691. + + Affected Cortex-A510 core might cause trace data corruption, when being written + into the memory. Effectively TRBE is broken and hence cannot be used to capture + trace data. + + Work around this problem in the driver by just preventing TRBE initialization on + affected cpus. The firmware must have disabled the access to TRBE for the kernel + on such implementations. This will cover the kernel for any firmware that doesn't + do this already. + + If unsure, say Y. + config CAVIUM_ERRATUM_22375 bool "Cavium erratum 22375, 24313" default y
arch/arm64/kernel/cpu_errata.c +9 -0
@@ -617,6 +617,15 @@ const struct arm64_cpu_capabilities arm64_errata[] = {/* Cortex-A510 r0p0 - r0p2 */ ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2) }, +#endif +#ifdef CONFIG_ARM64_ERRATUM_1902691 + { + .desc = "ARM erratum 1902691", + .capability = ARM64_WORKAROUND_1902691, + + /* Cortex-A510 r0p0 - r0p1 */ + ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 1) + }, #endif { }
arch/arm64/tools/cpucaps +1 -0
@@ -57,6 +57,7 @@ WORKAROUND_1508412 WORKAROUND_1542419 WORKAROUND_2064142 WORKAROUND_2038923 +WORKAROUND_1902691 WORKAROUND_TRBE_OVERWRITE_FILL_MODE WORKAROUND_TSB_FLUSH_FAILURE WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 65/203 arm64: cpufeature: List early Cortex-A510 parts as having broken dbm
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
[ Upstream commit 297ae1eb23b04c5a46111ab53c8d0f69af43f402 ]
Versions of Cortex-A510 before r0p3 are affected by a hardware erratum where the hardware update of the dirty bit is not correctly ordered.
Add these cpus to the cpu_has_broken_dbm list.
--- Documentation/arm64/silicon-errata.rst | 2 ++ arch/arm64/Kconfig | 10 ++++++++++ arch/arm64/kernel/cpufeature.c | 3 +++ 3 files changed, 15 insertions(+)
Documentation/arm64/silicon-errata.rst +2 -0
@@ -98,6 +98,8 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A77 | #1508412 | ARM64_ERRATUM_1508412 | +----------------+-----------------+-----------------+-----------------------------+ +| ARM | Cortex-A510 | #2051678 | ARM64_ERRATUM_2051678 | ++----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A710 | #2119858 | ARM64_ERRATUM_2119858 | +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A710 | #2054223 | ARM64_ERRATUM_2054223 |
arch/arm64/Kconfig +10 -0
@@ -670,6 +670,16 @@ config ARM64_ERRATUM_1508412 config ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE bool +config ARM64_ERRATUM_2051678 + bool "Cortex-A510: 2051678: disable Hardware Update of the page table dirty bit" + help + This options adds the workaround for ARM Cortex-A510 erratum ARM64_ERRATUM_2051678. + Affected Coretex-A510 might not respect the ordering rules for + hardware update of the page table's dirty bit. The workaround + is to not enable the feature on affected CPUs. + + If unsure, say Y. + config ARM64_ERRATUM_2119858 bool "Cortex-A710/X2: 2119858: workaround TRBE overwriting trace data in FILL mode" default y
arch/arm64/kernel/cpufeature.c +3 -0
@@ -1634,6 +1634,9 @@ static bool cpu_has_broken_dbm(void) MIDR_ALL_VERSIONS(MIDR_CORTEX_A55), /* Kryo4xx Silver (rdpe => r1p0) */ MIDR_REV(MIDR_QCOM_KRYO_4XX_SILVER, 0xd, 0xe), +#endif +#ifdef CONFIG_ARM64_ERRATUM_2051678 + MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2),#endif {}, };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 66/203 kasan: test: fix compatibility with FORTIFY_SOURCE
In reply to Greg Kroah-HartmanFrom: Marco Elver <[email protected]>
[ Upstream commit 09c6304e38e440b93a9ebf3f3cf75cd6cb529f91 ]
With CONFIG_FORTIFY_SOURCE enabled, string functions will also perform dynamic checks using __builtin_object_size(ptr), which when failed will panic the kernel.
Because the KASAN test deliberately performs out-of-bounds operations, the kernel panics with FORTIFY_SOURCE, for example:
| kernel BUG at lib/string_helpers.c:910! | invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI | CPU: 1 PID: 137 Comm: kunit_try_catch Tainted: G B 5.16.0-rc3+ #3 | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 | RIP: 0010:fortify_panic+0x19/0x1b | ... | Call Trace: | kmalloc_oob_in_memset.cold+0x16/0x16 | ...
Fix it by also hiding ptr from the optimizer, which will ensure that __builtin_object_size() does not return a valid size, preventing fortified string functions from panicking.
--- lib/test_kasan.c | 5 +++++ 1 file changed, 5 insertions(+)
lib/test_kasan.c +5 -0
@@ -492,6 +492,7 @@ static void kmalloc_oob_in_memset(struct kunit *test) ptr =kmalloc (size,GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ptr); +OPTIMIZER_HIDE_VAR (ptr);OPTIMIZER_HIDE_VAR (size);KUNIT_EXPECT_KASAN_FAIL (test,memset (ptr,0 , size +KASAN_GRANULE_SIZE ));
@@ -515,6 +516,7 @@ static void kmalloc_memmove_negative_size(struct kunit *test)KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ptr);memset ((char *)ptr,0 ,64 ); +OPTIMIZER_HIDE_VAR (ptr);OPTIMIZER_HIDE_VAR (invalid_size);KUNIT_EXPECT_KASAN_FAIL (test,memmove ((char *)ptr, (char *)ptr +4 , invalid_size));
@@ -531,6 +533,7 @@ static void kmalloc_memmove_invalid_size(struct kunit *test)KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ptr);memset ((char *)ptr,0 ,64 ); +OPTIMIZER_HIDE_VAR (ptr);KUNIT_EXPECT_KASAN_FAIL (test,memmove ((char *)ptr, (char *)ptr +4 , invalid_size));kfree (ptr);
@@ -869,6 +872,7 @@ static void kasan_memchr(struct kunit *test) ptr =kmalloc (size,GFP_KERNEL | __GFP_ZERO);KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ptr); +OPTIMIZER_HIDE_VAR (ptr);OPTIMIZER_HIDE_VAR (size);KUNIT_EXPECT_KASAN_FAIL (test, kasan_ptr_result =memchr (ptr,'1' , size +1 ));
@@ -895,6 +899,7 @@ static void kasan_memcmp(struct kunit *test)KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ptr);memset (arr,0 ,sizeof (arr)); +OPTIMIZER_HIDE_VAR (ptr);OPTIMIZER_HIDE_VAR (size);KUNIT_EXPECT_KASAN_FAIL (test, kasan_int_result =memcmp (ptr, arr, size+1 ));
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 67/203 KVM: eventfd: Fix false positive RCU usage warning
In reply to Greg Kroah-HartmanFrom: Hou Wenlong <[email protected]>
[ Upstream commit 6a0c61703e3a5d67845a4b275e1d9d7bc1b5aad7 ]
Fix the following false positive warning:
=============================
WARNING: suspicious RCU usage
5.16.0-rc4+ #57 Not tainted
-----------------------------
arch/x86/kvm/../../../virt/kvm/eventfd.c:484 RCU-list traversed in non-reader section!!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
3 locks held by fc_vcpu 0/330:
#0: ffff8884835fc0b0 (&vcpu->mutex){+.+.}-{3:3}, at: kvm_vcpu_ioctl+0x88/0x6f0 [kvm] #1: ffffc90004c0bb68 (&kvm->srcu){....}-{0:0}, at: vcpu_enter_guest+0x600/0x1860 [kvm] #2: ffffc90004c0c1d0 (&kvm->irq_srcu){....}-{0:0}, at: kvm_notify_acked_irq+0x36/0x180 [kvm]
stack backtrace: CPU: 26 PID: 330 Comm: fc_vcpu 0 Not tainted 5.16.0-rc4+ Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x44/0x57 kvm_notify_acked_gsi+0x6b/0x70 [kvm] kvm_notify_acked_irq+0x8d/0x180 [kvm] kvm_ioapic_update_eoi+0x92/0x240 [kvm] kvm_apic_set_eoi_accelerated+0x2a/0xe0 [kvm] handle_apic_eoi_induced+0x3d/0x60 [kvm_intel] vmx_handle_exit+0x19c/0x6a0 [kvm_intel] vcpu_enter_guest+0x66e/0x1860 [kvm] kvm_arch_vcpu_ioctl_run+0x438/0x7f0 [kvm] kvm_vcpu_ioctl+0x38a/0x6f0 [kvm] __x64_sys_ioctl+0x89/0xc0 do_syscall_64+0x3a/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
Since kvm_unregister_irq_ack_notifier() does synchronize_srcu(&kvm->irq_srcu), kvm->irq_ack_notifier_list is protected by kvm->irq_srcu. In fact, kvm->irq_srcu SRCU read lock is held in kvm_notify_acked_irq(), making it a false positive warning. So use hlist_for_each_entry_srcu() instead of hlist_for_each_entry_rcu().
Message-Id: <f98bac4f5052bad2c26df9ad50f7019e40434512.1643265976.git.houwenlong.hwl@antgroup.com>
--- virt/kvm/eventfd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
virt/kvm/eventfd.c +4 -4
@@ -463,8 +463,8 @@ bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin) idx =srcu_read_lock (&kvm->irq_srcu); gsi =kvm_irq_map_chip_pin (kvm, irqchip, pin);if (gsi !=-1 ) -hlist_for_each_entry_rcu (kian, &kvm->irq_ack_notifier_list, - link) +hlist_for_each_entry_srcu (kian, &kvm->irq_ack_notifier_list, + link,srcu_read_lock_held (&kvm->irq_srcu))if (kian->gsi == gsi) {srcu_read_unlock (&kvm->irq_srcu, idx);return true;
@@ -480,8 +480,8 @@ void kvm_notify_acked_gsi(struct kvm *kvm, int gsi) {struct kvm_irq_ack_notifier *kian; -hlist_for_each_entry_rcu (kian, &kvm->irq_ack_notifier_list, - link) +hlist_for_each_entry_srcu (kian, &kvm->irq_ack_notifier_list, + link,srcu_read_lock_held (&kvm->irq_srcu))if (kian->gsi == gsi) kian->irq_acked (kian); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 68/203 KVM: nVMX: eVMCS: Filter out VM_EXIT_SAVE_VMX_PREEMPTION_TIMER
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit 7a601e2cf61558dfd534a9ecaad09f5853ad8204 ]
Enlightened VMCS v1 doesn't have VMX_PREEMPTION_TIMER_VALUE field, PIN_BASED_VMX_PREEMPTION_TIMER is also filtered out already so it makes sense to filter out VM_EXIT_SAVE_VMX_PREEMPTION_TIMER too.
Note, none of the currently existing Windows/Hyper-V versions are known to enable 'save VMX-preemption timer value' when eVMCS is in use, the change is aimed at making the filtering future proof.
Message-Id: <[email protected]>
--- arch/x86/kvm/vmx/evmcs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kvm/vmx/evmcs.h +3 -1
@@ -59,7 +59,9 @@ DECLARE_STATIC_KEY_FALSE(enable_evmcs); SECONDARY_EXEC_SHADOW_VMCS | \ SECONDARY_EXEC_TSC_SCALING | \ SECONDARY_EXEC_PAUSE_LOOP_EXITING) -#define EVMCS1_UNSUPPORTED_VMEXIT_CTRL (VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL) +#define EVMCS1_UNSUPPORTED_VMEXIT_CTRL \ + (VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL | \ + VM_EXIT_SAVE_VMX_PREEMPTION_TIMER)#define EVMCS1_UNSUPPORTED_VMENTRY_CTRL (VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL)#define EVMCS1_UNSUPPORTED_VMFUNC (VMX_VMFUNC_EPTP_SWITCHING)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 69/203 KVM: nVMX: Also filter MSR_IA32_VMX_TRUE_PINBASED_CTLS when eVMCS
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit f80ae0ef089a09e8c18da43a382c3caac9a424a7 ]
Similar to MSR_IA32_VMX_EXIT_CTLS/MSR_IA32_VMX_TRUE_EXIT_CTLS, MSR_IA32_VMX_ENTRY_CTLS/MSR_IA32_VMX_TRUE_ENTRY_CTLS pair, MSR_IA32_VMX_TRUE_PINBASED_CTLS needs to be filtered the same way MSR_IA32_VMX_PINBASED_CTLS is currently filtered as guests may solely rely on 'true' MSR data.
Note, none of the currently existing Windows/Hyper-V versions are known to stumble upon the unfiltered MSR_IA32_VMX_TRUE_PINBASED_CTLS, the change is aimed at making the filtering future proof.
Message-Id: <[email protected]>
--- arch/x86/kvm/vmx/evmcs.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kvm/vmx/evmcs.c +1 -0
@@ -361,6 +361,7 @@ void nested_evmcs_filter_control_msr(u32 msr_index, u64 *pdata)case MSR_IA32_VMX_PROCBASED_CTLS2 : ctl_high &= ~EVMCS1_UNSUPPORTED_2NDEXEC ;break ; +case MSR_IA32_VMX_TRUE_PINBASED_CTLS :case MSR_IA32_VMX_PINBASED_CTLS : ctl_high &= ~EVMCS1_UNSUPPORTED_PINCTRL ;break ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 70/203 KVM: SVM: Dont kill SEV guest if SMAP erratum triggers in usermode
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
[ Upstream commit cdf85e0c5dc766fc7fc779466280e454a6d04f87 ]
Inject a #GP instead of synthesizing triple fault to try to avoid killing the guest if emulation of an SEV guest fails due to encountering the SMAP erratum. The injected #GP may still be fatal to the guest, e.g. if the userspace process is providing critical functionality, but KVM should make every attempt to keep the guest alive.
Message-Id: <[email protected]>
--- arch/x86/kvm/svm/svm.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
arch/x86/kvm/svm/svm.c +15 -1
@@ -4530,7 +4530,21 @@ static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, void *insn, int i is_user =svm_get_cpl (vcpu) ==3 ;if (smap && (!smep || is_user)) {pr_err_ratelimited ("KVM: SEV Guest triggered AMD Erratum 1096\n" ); -kvm_make_request (KVM_REQ_TRIPLE_FAULT , vcpu); + +/* +* If the fault occurred in userspace, arbitrarily inject #GP +* to avoid killing the guest and to hopefully avoid confusing +* the guest kernel too much, e.g. injecting #PF would not be +* coherent with respect to the guest's page tables. Request +* triple fault if the fault occurred in the kernel as there's +* no fault that KVM can inject without confusing the guest. +* In practice, the triple fault is moot as no sane SEV kernel +* will execute from user memory while also running with SMAP=1. +*/ +if (is_user) +kvm_inject_gp (vcpu,0 ); +else +kvm_make_request (KVM_REQ_TRIPLE_FAULT , vcpu); }return false;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 71/203 KVM: VMX: Set vmcs.PENDING_DBG.BS on #DB in STI/MOVSS blocking shadow
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
[ Upstream commit b9bed78e2fa9571b7c983b20666efa0009030c71 ]
Set vmcs.GUEST_PENDING_DBG_EXCEPTIONS.BS, a.k.a. the pending single-step breakpoint flag, when re-injecting a #DB with RFLAGS.TF=1, and STI or MOVSS blocking is active. Setting the flag is necessary to make VM-Entry consistency checks happy, as VMX has an invariant that if RFLAGS.TF is set and STI/MOVSS blocking is true, then the previous instruction must have been STI or MOV/POP, and therefore a single-step #DB must be pending since the RFLAGS.TF cannot have been set by the previous instruction, i.e. the one instruction delay after setting RFLAGS.TF must have already expired.
Normally, the CPU sets vmcs.GUEST_PENDING_DBG_EXCEPTIONS.BS appropriately when recording guest state as part of a VM-Exit, but #DB VM-Exits intentionally do not treat the #DB as "guest state" as interception of the #DB effectively makes the #DB host-owned, thus KVM needs to manually set PENDING_DBG.BS when forwarding/re-injecting the #DB to the guest.
Note, although this bug can be triggered by guest userspace, doing so requires IOPL=3, and guest userspace running with IOPL=3 has full access to all I/O ports (from the guest's perspective) and can crash/reboot the guest any number of ways. IOPL=3 is required because STI blocking kicks in if and only if RFLAGS.IF is toggled 0=>1, and if CPL>IOPL, STI either takes a #GP or modifies RFLAGS.VIF, not RFLAGS.IF.
MOVSS blocking can be initiated by userspace, but can be coincident with a #DB if and only if DR7.GD=1 (General Detect enabled) and a MOV DR is executed in the MOVSS shadow. MOV DR #GPs at CPL>0, thus MOVSS blocking is problematic only for CPL0 (and only if the guest is crazy enough to access a DR in a MOVSS shadow). All other sources of #DBs are either suppressed by MOVSS blocking (single-step, code fetch, data, and I/O), are mutually exclusive with MOVSS blocking (T-bit task switch), or are already handled by KVM (ICEBP, a.k.a. INT1).
This bug was originally found by running tests[1] created for XSA-308[2]. Note that Xen's userspace test emits ICEBP in the MOVSS shadow, which is presumably why the Xen bug was deemed to be an exploitable DOS from guest userspace. KVM already handles ICEBP by skipping the ICEBP instruction and thus clears MOVSS blocking as a side effect of its "emulation".
[1] http://xenbits.xenproject.org/docs/xtf/xsa-308_2main_8c_source.html
[2] https://xenbits.xen.org/xsa/advisory-308.html
Message-Id: <[email protected]>
--- arch/x86/kvm/vmx/vmx.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
arch/x86/kvm/vmx/vmx.c +25 -0
@@ -4811,8 +4811,33 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu) dr6 =vmx_get_exit_qual (vcpu);if (!(vcpu->guest_debug & (KVM_GUESTDBG_SINGLESTEP |KVM_GUESTDBG_USE_HW_BP ))) { +/* +* If the #DB was due to ICEBP, a.k.a. INT1, skip the +* instruction. ICEBP generates a trap-like #DB, but +* despite its interception control being tied to #DB, +* is an instruction intercept, i.e. the VM-Exit occurs +* on the ICEBP itself. Note, skipping ICEBP also +* clears STI and MOVSS blocking. +* +* For all other #DBs, set vmcs.PENDING_DBG_EXCEPTIONS.BS +* if single-step is enabled in RFLAGS and STI or MOVSS +* blocking is active, as the CPU doesn't set the bit +* on VM-Exit due to #DB interception. VM-Entry has a +* consistency check that a single-step #DB is pending +* in this scenario as the previous instruction cannot +* have toggled RFLAGS.TF 0=>1 (because STI and POP/MOV +* don't modify RFLAGS), therefore the one instruction +* delay when activating single-step breakpoints must +* have already expired. Note, the CPU sets/clears BS +* as appropriate for all other VM-Exits types. +*/ if (is_icebp (intr_info))WARN_ON (!skip_emulated_instruction (vcpu)); +else if ((vmx_get_rflags (vcpu) &X86_EFLAGS_TF ) && + (vmcs_read32 (GUEST_INTERRUPTIBILITY_INFO ) & + (GUEST_INTR_STATE_STI |GUEST_INTR_STATE_MOV_SS ))) +vmcs_writel (GUEST_PENDING_DBG_EXCEPTIONS , +vmcs_readl (GUEST_PENDING_DBG_EXCEPTIONS ) |DR6_BS );kvm_queue_exception_p (vcpu,DB_VECTOR , dr6);return 1 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 72/203 KVM: x86: Report deprecated x87 features in supported CPUID
In reply to Greg Kroah-HartmanFrom: Jim Mattson <[email protected]>
[ Upstream commit e3bcfda012edd3564e12551b212afbd2521a1f68 ]
CPUID.(EAX=7,ECX=0):EBX.FDP_EXCPTN_ONLY[bit 6] and CPUID.(EAX=7,ECX=0):EBX.ZERO_FCS_FDS[bit 13] are "defeature" bits. Unlike most of the other CPUID feature bits, these bits are clear if the features are present and set if the features are not present. These bits should be reported in KVM_GET_SUPPORTED_CPUID, because if these bits are set on hardware, they cannot be cleared in the guest CPUID. Doing so would claim guest support for a feature that the hardware doesn't support and that can't be efficiently emulated.
Of course, any software (e.g WIN87EM.DLL) expecting these features to be present likely predates these CPUID feature bits and therefore doesn't know to check for them anyway.
Aaron Lewis added the corresponding X86_FEATURE macros in commit cbb99c0f5887 ("x86/cpufeatures: Add FDP_EXCPTN_ONLY and ZERO_FCS_FDS"), with the intention of reporting these bits in KVM_GET_SUPPORTED_CPUID, but I was unable to find a proposed patch on the kvm list.
Opportunistically reordered the CPUID_7_0_EBX capability bits from least to most significant.
Message-Id: <[email protected]>
--- arch/x86/kvm/cpuid.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
arch/x86/kvm/cpuid.c +7 -6
@@ -532,12 +532,13 @@ void kvm_set_cpu_caps(void) );kvm_cpu_cap_mask (CPUID_7_0_EBX , -F (FSGSBASE ) |F (SGX ) |F (BMI1 ) |F (HLE ) |F (AVX2 ) |F (SMEP ) | -F (BMI2 ) |F (ERMS ) |F (INVPCID ) |F (RTM ) |0 /*MPX*/ |F (RDSEED ) | -F (ADX ) |F (SMAP ) |F (AVX512IFMA ) |F (AVX512F ) |F (AVX512PF ) | -F (AVX512ER ) |F (AVX512CD ) |F (CLFLUSHOPT ) |F (CLWB ) |F (AVX512DQ ) | -F (SHA_NI ) |F (AVX512BW ) |F (AVX512VL ) |0 /*INTEL_PT*/ - ); +F (FSGSBASE ) |F (SGX ) |F (BMI1 ) |F (HLE ) |F (AVX2 ) | +F (FDP_EXCPTN_ONLY ) |F (SMEP ) |F (BMI2 ) |F (ERMS ) |F (INVPCID ) | +F (RTM ) |F (ZERO_FCS_FDS ) |0 /*MPX*/ |F (AVX512F ) | +F (AVX512DQ ) |F (RDSEED ) |F (ADX ) |F (SMAP ) |F (AVX512IFMA ) | +F (CLFLUSHOPT ) |F (CLWB ) |0 /*INTEL_PT*/ |F (AVX512PF ) | +F (AVX512ER ) |F (AVX512CD ) |F (SHA_NI ) |F (AVX512BW ) | +F (AVX512VL )); kvm_cpu_cap_mask(CPUID_7_ECX, F(AVX512VBMI) | F(LA57) | F(PKU) | 0 /*OSPKE*/ | F(RDPID) |
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 73/203 riscv: fix build with binutils 2.38
In reply to Greg Kroah-HartmanFrom: Aurelien Jarno <[email protected]>
commit 6df2a016c0c8a3d0933ef33dd192ea6606b115e3 upstream.
Quoted 1 line
From version 2.38, binutils default to ISA spec version 20191213. This
means that the csr read/write (csrr*/csrw*) instructions and fence.i instruction has separated from the I extension, become two standalone
extensions: Zicsr and Zifencei. As the kernel uses those instruction, this causes the following build failure:
CC arch/riscv/kernel/vdso/vgettimeofday.o
<<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h: Assembler messages:
<<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode csrr a5,0xc01' <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode csrr a5,0xc01' <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode csrr a5,0xc01' <<BUILDDIR>>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode csrr a5,0xc01'
The fix is to specify those extensions explicitely in -march. However as older binutils version do not support this, we first need to detect that.
--- arch/riscv/Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
arch/riscv/Makefile +6 -0
@@ -50,6 +50,12 @@ riscv-march-$(CONFIG_ARCH_RV32I) := rv32 riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima riscv-march-$(CONFIG_FPU) := $(riscv-march-y)fd riscv-march-$(CONFIG_RISCV_ISA_C) := $(riscv-march-y)c + +# Newer binutils versions default to ISA spec version 20191213 which moves some +# instructions from the I extension to the Zicsr and Zifencei extensions. +toolchain-need-zicsr-zifencei := $(call cc-option-yn, -march=$(riscv-march-y)_zicsr_zifencei) +riscv-march-$(toolchain-need-zicsr-zifencei) := $(riscv-march-y)_zicsr_zifencei + KBUILD_CFLAGS += -march=$(subst fd,,$(riscv-march-y)) KBUILD_AFLAGS += -march=$(riscv-march-y)
Greg Kroah-Hartman
maintainerPATCH 74/203 riscv: Fix XIP_FIXUP_FLASH_OFFSET
In reply to Greg Kroah-HartmanFrom: Myrtle Shah <[email protected]>
commit 3c04d84508b54fcf524093b0d4a718680ed67f0f upstream.
There were several problems with the calculation. Not only was an 'and' being computed into t1 but thrown away; but the 'and' itself would cause problems if the granularity of the XIP physical address was less than XIP_OFFSET - in my case I had the kernel image at 2MB in SPI flash.
--- arch/riscv/kernel/head.S | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
arch/riscv/kernel/head.S +5 -6
@@ -21,14 +21,13 @@ add \reg, \reg, t0 .endm .macro XIP_FIXUP_FLASH_OFFSET reg - la t1, __data_loc - li t0, XIP_OFFSET_MASK - and t1, t1, t0 - li t1, XIP_OFFSET - sub t0, t0, t1 - sub \reg, \reg, t0 + la t0, __data_loc + REG_L t1, _xip_phys_offset + sub \reg, \reg, t1 + add \reg, \reg, t0 .endm _xip_fixup: .dword CONFIG_PHYS_RAM_BASE - CONFIG_XIP_PHYS_ADDR - XIP_OFFSET +_xip_phys_offset: .dword CONFIG_XIP_PHYS_ADDR + XIP_OFFSET #else .macro XIP_FIXUP_OFFSET reg .endm
Greg Kroah-Hartman
maintainerPATCH 75/203 riscv: cpu-hotplug: clear cpu from numa map when teardown
In reply to Greg Kroah-HartmanFrom: Pingfan Liu <[email protected]>
commit f40fe31c01445f31253b15bef2412b33ae31093b upstream.
There is numa_add_cpu() when cpus online, accordingly, there should be numa_remove_cpu() when cpus offline.
--- arch/riscv/kernel/cpu-hotplug.c | 2 ++ 1 file changed, 2 insertions(+)
arch/riscv/kernel/cpu-hotplug.c +2 -0
@@ -12,6 +12,7 @@#include <linux/sched/hotplug.h> #include <asm/irq.h> #include <asm/cpu_ops.h> +#include <asm/numa.h> #include <asm/sbi.h> void cpu_stop (void );
@@ -46,6 +47,7 @@ int __cpu_disable(void)return ret;remove_cpu_topology (cpu); +numa_remove_cpu (cpu);set_cpu_online (cpu, false);irq_migrate_all_off_this_cpu ();
Greg Kroah-Hartman
maintainerPATCH 76/203 riscv/mm: Add XIP_FIXUP for phys_ram_base
In reply to Greg Kroah-HartmanFrom: Palmer Dabbelt <[email protected]>
commit 4b1c70aa8ed8249608bb991380cb8ff423edf49e upstream.
This manifests as a crash early in boot on VexRiscv.
--- arch/riscv/mm/init.c | 1 + 1 file changed, 1 insertion(+)
arch/riscv/mm/init.c +1 -0
@@ -41,6 +41,7 @@ phys_addr_t phys_ram_base __ro_after_iniEXPORT_SYMBOL (phys_ram_base);#ifdef CONFIG_XIP_KERNEL +#define phys_ram_base (*(phys_addr_t *)XIP_FIXUP(&phys_ram_base))extern char _xiprom[], _exiprom[], __data_loc;#endif
Greg Kroah-Hartman
maintainerPATCH 77/203 riscv: eliminate unreliable __builtin_frame_address(1)
In reply to Greg Kroah-HartmanFrom: Changbin Du <[email protected]>
commit 6a00ef4493706a23120057fafbc62379bcde11ec upstream.
I tried different pieces of code which uses __builtin_frame_address(1) (with both gcc version 7.5.0 and 10.3.0) to verify whether it works as expected on riscv64. The result is negative.
What the compiler had generated is as below:
31 fp = (unsigned long)__builtin_frame_address(1);
0xffffffff80006024 <+200>: ld s1,0(s0)
It takes '0(s0)' as the address of frame 1 (caller), but the actual address should be '-16(s0)'.
| ... | <-+
+-----------------+ |
| return address | |
| previous fp | |
| saved registers | |
| local variables | |
$fp --> | ... | |
+-----------------+ |
| return address | |
| previous fp --------+
| saved registers |
$sp --> | local variables |
+-----------------+This leads the kernel can not dump the full stack trace on riscv.
[ 7.222126][ T1] Call Trace: [ 7.222804][ T1] [<ffffffff80006058>] dump_backtrace+0x2c/0x3a
This problem is not exposed on most riscv builds just because the '0(s0)' occasionally is the address frame 2 (caller's caller), if only ra and fp are stored in frame 1 (caller).
| ... | <-+
+-----------------+ |
| return address | |
$fp --> | previous fp | |
+-----------------+ |
| return address | |
| previous fp --------+
| saved registers |
$sp --> | local variables |
+-----------------+This could be a *bug* of gcc that should be fixed. But as noted in gcc manual "Calling this function with a nonzero argument can have unpredictable effects, including crashing the calling program.", let's remove the '__builtin_frame_address(1)' in backtrace code.
With this fix now it can show full stack trace:
[ 10.444838][ T1] Call Trace: [ 10.446199][ T1] [<ffffffff8000606c>] dump_backtrace+0x2c/0x3a [ 10.447711][ T1] [<ffffffff800060ac>] show_stack+0x32/0x3e [ 10.448710][ T1] [<ffffffff80a005c0>] dump_stack_lvl+0x58/0x7a [ 10.449941][ T1] [<ffffffff80a005f6>] dump_stack+0x14/0x1c [ 10.450929][ T1] [<ffffffff804c04ee>] ubsan_epilogue+0x10/0x5a [ 10.451869][ T1] [<ffffffff804c092e>] __ubsan_handle_load_invalid_value+0x6c/0x78 [ 10.453049][ T1] [<ffffffff8018f834>] __pagevec_release+0x62/0x64 [ 10.455476][ T1] [<ffffffff80190830>] truncate_inode_pages_range+0x132/0x5be [ 10.456798][ T1] [<ffffffff80190ce0>] truncate_inode_pages+0x24/0x30 [ 10.457853][ T1] [<ffffffff8045bb04>] kill_bdev+0x32/0x3c
...
--- arch/riscv/kernel/stacktrace.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/riscv/kernel/stacktrace.c +5 -4
@@ -22,15 +22,16 @@ void notrace walk_stackframe(struct task bool (*fn)(void *, unsigned long), void *arg) { unsigned long fp, sp, pc; +int level =0 ;if (regs) { fp =frame_pointer (regs); sp =user_stack_pointer (regs); pc =instruction_pointer (regs); }else if (task ==NULL || task == current) { - fp = (unsigned long )__builtin_frame_address (1 ); - sp = (unsigned long )__builtin_frame_address (0 ); - pc = (unsigned long )__builtin_return_address (0 ); + fp = (unsigned long )__builtin_frame_address (0 ); + sp = sp_in_global; + pc = (unsigned long )walk_stackframe; }else {/* task blocked in __switch_to */ fp = task->thread.s[0 ];
@@ -42,7 +43,7 @@ void notrace walk_stackframe(struct taskunsigned long low, high;struct stackframe *frame; -if (unlikely (!__kernel_text_address (pc) || !fn (arg, pc))) +if (unlikely (!__kernel_text_address (pc) || (level++ >=1 && !fn (arg, pc))))break ;/* Validate frame pointer */
Greg Kroah-Hartman
maintainerPATCH 78/203 gfs2: Fix gfs2_release for non-writers regression
In reply to Greg Kroah-HartmanFrom: Bob Peterson <[email protected]>
commit d3add1a9519dcacd6e644ecac741c56cf18b67f5 upstream.
When a file is opened for writing, the vfs code (do_dentry_open) calls get_write_access for the inode, thus incrementing the inode's write count. That writer normally then creates a multi-block reservation for the inode (i_res) that can be re-used by other writers, which speeds up writes for applications that stupidly loop on open/write/close. When the writes are all done, the multi-block reservation should be deleted when the file is closed by the last "writer."
Commit 0ec9b9ea4f83 broke that concept when it moved the call to gfs2_rs_delete before the check for FMODE_WRITE. Non-writers have no business removing the multi-block reservations of writers. In fact, if someone opens and closes the file for RO while a writer has a multi-block reservation, the RO closer will delete the reservation midway through the write, and this results in:
kernel BUG at fs/gfs2/rgrp.c:677! (or thereabouts) which is:BUG_ON(rs->rs_requested); from function gfs2_rs_deltree.
This patch moves the check back inside the check for FMODE_WRITE.
--- fs/gfs2/file.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/gfs2/file.c +4 -3
@@ -704,10 +704,11 @@ static int gfs2_release(struct inode *inkfree (file->private_data); file->private_data =NULL ; -if (gfs2_rs_active (&ip->i_res)) -gfs2_rs_delete (ip, &inode->i_writecount); -if (file->f_mode &FMODE_WRITE ) +if (file->f_mode &FMODE_WRITE ) { +if (gfs2_rs_active (&ip->i_res)) +gfs2_rs_delete (ip, &inode->i_writecount);gfs2_qa_put (ip); + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 79/203 Revert "gfs2: check context in gfs2_glock_put"
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
commit 356b8103d4c495d5440e3e687db9026ec2b76043 upstream.
It turns out that the might_sleep() call that commit 660a6126f8c3 adds is triggering occasional data corruption in testing. We're not sure about the root cause yet, but since this commit was added as a debugging aid only, revert it for now.
This reverts commit 660a6126f8c3208f6df8d552039cda078a8426d1.
--- fs/gfs2/glock.c | 3 --- 1 file changed, 3 deletions(-)
fs/gfs2/glock.c +0 -3
@@ -301,9 +301,6 @@ void gfs2_glock_queue_put(struct gfs2_glvoid gfs2_glock_put (struct gfs2_glock *gl) { -/* last put could call sleepable dlm api */ -might_sleep (); -if (lockref_put_or_lock (&gl->gl_lockref))return ;
Greg Kroah-Hartman
maintainerPATCH 80/203 Revert "PCI/portdrv: Do not setup up IRQs if there are no users"
In reply to Greg Kroah-HartmanFrom: Bjorn Helgaas <[email protected]>
commit 075b7d363c675ef7fa03918881caeca3458e2a96 upstream.
This reverts commit 0e8ae5a6ff5952253cd7cc0260df838ab4c21009.
0e8ae5a6ff59 ("PCI/portdrv: Do not setup up IRQs if there are no users") reduced usage of IRQs when we don't think we need them. But Joey, Sergiu, and David reported choppy GUI rendering, systems that became unresponsive every few seconds, incorrect values reported by cpufreq, and high IRQ 16 CPU usage.
Joey bisected the issues to 0e8ae5a6ff59, so revert it until we figure out a better solution.
--- drivers/pci/pcie/portdrv_core.c | 47 ++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 30 deletions(-)
drivers/pci/pcie/portdrv_core.c +17 -30
@@ -166,6 +166,9 @@ static int pcie_init_service_irqs(struct {int ret, i; +for (i =0 ; i <PCIE_PORT_DEVICE_MAXSERVICES ; i++) + irqs[i] =-1 ; +/* * If we support PME but can't use MSI/MSI-X for it, we have to * fall back to INTx or other interrupts, e.g., a system shared
@@ -314,10 +317,8 @@ static int pcie_device_init(struct pci_d*/ int pcie_port_device_register (struct pci_dev *dev) { -int status, capabilities, irq_services, i, nr_service; -int irqs[PCIE_PORT_DEVICE_MAXSERVICES ] = { - [0 ...PCIE_PORT_DEVICE_MAXSERVICES -1 ] =-1 - }; +int status, capabilities, i, nr_service; +int irqs[PCIE_PORT_DEVICE_MAXSERVICES ];/* Enable PCI Express port device */ status =pci_enable_device (dev);
@@ -330,32 +331,18 @@ int pcie_port_device_register(struct pcireturn 0 ;pci_set_master (dev); - - irq_services =0 ; -if (IS_ENABLED (CONFIG_PCIE_PME )) - irq_services |=PCIE_PORT_SERVICE_PME ; -if (IS_ENABLED (CONFIG_PCIEAER )) - irq_services |=PCIE_PORT_SERVICE_AER ; -if (IS_ENABLED (CONFIG_HOTPLUG_PCI_PCIE )) - irq_services |=PCIE_PORT_SERVICE_HP ; -if (IS_ENABLED (CONFIG_PCIE_DPC )) - irq_services |=PCIE_PORT_SERVICE_DPC ; - irq_services &= capabilities; - -if (irq_services) { -/* -* Initialize service IRQs. Don't use service devices that -* require interrupts if there is no way to generate them. -* However, some drivers may have a polling mode (e.g. -* pciehp_poll_mode) that can be used in the absence of IRQs. -* Allow them to determine if that is to be used. -*/ - status =pcie_init_service_irqs (dev, irqs, irq_services); -if (status) { - irq_services &=PCIE_PORT_SERVICE_HP ; -if (!irq_services) - goto error_disable; - } +/* +* Initialize service irqs. Don't use service devices that +* require interrupts if there is no way to generate them. +* However, some drivers may have a polling mode (e.g. pciehp_poll_mode) +* that can be used in the absence of irqs. Allow them to determine +* if that is to be used. +*/ + status =pcie_init_service_irqs (dev, irqs, capabilities); +if (status) { + capabilities &=PCIE_PORT_SERVICE_HP ; +if (!capabilities) + goto error_disable; }/* Allocate child services if any */
Greg Kroah-Hartman
maintainerPATCH 81/203 ARM: dts: imx23-evk: Remove MX23_PAD_SSP1_DETECT from hog group
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
commit 42c9b28e6862d16db82a56f5667cf4d1f6658cf6 upstream.
Currently, SD card fails to mount due to the following pinctrl error:
[ 11.170000] imx23-pinctrl 80018000.pinctrl: pin SSP1_DETECT already requested by 80018000.pinctrl; cannot claim for 80010000.spi [ 11.180000] imx23-pinctrl 80018000.pinctrl: pin-65 (80010000.spi) status -22 [ 11.190000] imx23-pinctrl 80018000.pinctrl: could not request pin 65 (SSP1_DETECT) from group mmc0-pins-fixup.0 on device 80018000.pinctrl [ 11.200000] mxs-mmc 80010000.spi: Error applying setting, reverse things back
Fix it by removing the MX23_PAD_SSP1_DETECT pin from the hog group as it is already been used by the mmc0-pins-fixup pinctrl group.
With this change the rootfs can be mounted and the imx23-evk board can boot successfully.
--- arch/arm/boot/dts/imx23-evk.dts | 1 - 1 file changed, 1 deletion(-)
arch/arm/boot/dts/imx23-evk.dts +0 -1
@@ -79,7 +79,6 @@ MX23_PAD_LCD_RESET__GPIO_1_18 MX23_PAD_PWM3__GPIO_1_29 MX23_PAD_PWM4__GPIO_1_30 - MX23_PAD_SSP1_DETECT__SSP1_DETECT >; fsl,drive-strength = <MXS_DRIVE_4mA>; fsl,voltage = <MXS_VOLTAGE_HIGH>;
Greg Kroah-Hartman
maintainerPATCH 82/203 ARM: dts: Fix boot regression on Skomer
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
commit d9058d6a0e92d8e4a00855f8fe204792f42794db upstream.
The signal routing on the Skomer board was incorrect making it impossible to mount root from the SD card. Fix this up.
--- arch/arm/boot/dts/ste-ux500-samsung-skomer.dts | 4 ---- 1 file changed, 4 deletions(-)
arch/arm/boot/dts/ste-ux500-samsung-skomer.dts +0 -4
@@ -185,10 +185,6 @@ cap-sd-highspeed; cap-mmc-highspeed; /* All direction control is used */ - st,sig-dir-cmd; - st,sig-dir-dat0; - st,sig-dir-dat2; - st,sig-dir-dat31; st,sig-pin-fbclk; full-pwr-cycle; vmmc-supply = <&ab8500_ldo_aux3_reg>;
Greg Kroah-Hartman
maintainerPATCH 83/203 ARM: socfpga: fix missing RESET_CONTROLLER
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit 3037b174b1876aae6b2d1a27a878c681c78ccadc upstream.
The SocFPGA machine since commit b3ca9888f35f ("reset: socfpga: add an early reset driver for SoCFPGA") uses reset controller, so it should select RESET_CONTROLLER explicitly. Selecting ARCH_HAS_RESET_CONTROLLER is not enough because it affects only default choice still allowing a non-buildable configuration:
/usr/bin/arm-linux-gnueabi-ld: arch/arm/mach-socfpga/socfpga.o: in function `socfpga_init_irq':
arch/arm/mach-socfpga/socfpga.c:56: undefined reference to `socfpga_reset_init'
--- arch/arm/mach-socfpga/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-socfpga/Kconfig +2 -0
@@ -2,6 +2,7 @@ menuconfig ARCH_INTEL_SOCFPGA bool "Altera SOCFPGA family" depends on ARCH_MULTI_V7 + select ARCH_HAS_RESET_CONTROLLER select ARCH_SUPPORTS_BIG_ENDIAN select ARM_AMBA select ARM_GIC
@@ -18,6 +19,7 @@ menuconfig ARCH_INTEL_SOCFPGA select PL310_ERRATA_727915 select PL310_ERRATA_753970 if PL310 select PL310_ERRATA_769419 + select RESET_CONTROLLER if ARCH_INTEL_SOCFPGA config SOCFPGA_SUSPEND
Greg Kroah-Hartman
maintainerPATCH 84/203 nvme-tcp: fix bogus request completion when failing to send AER
In reply to Greg Kroah-HartmanFrom: Sagi Grimberg <[email protected]>
commit 63573807b27e0faf8065a28b1bbe1cbfb23c0130 upstream.
AER is not backed by a real request, hence we should not incorrectly assume that when failing to send a nvme command, it is a normal request but rather check if this is an aer and if so complete the aer (similar to the normal completion path).
--- drivers/nvme/host/tcp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/nvme/host/tcp.c +9 -1
@@ -913,7 +913,15 @@ static inline void nvme_tcp_done_send_restatic void nvme_tcp_fail_request (struct nvme_tcp_request *req) { -nvme_tcp_end_request (blk_mq_rq_from_pdu (req),NVME_SC_HOST_PATH_ERROR ); +if (nvme_tcp_async_req (req)) { +union nvme_result res = {}; + +nvme_complete_async_event (&req->queue->ctrl->ctrl, +cpu_to_le16 (NVME_SC_HOST_PATH_ERROR ), &res); + }else { +nvme_tcp_end_request (blk_mq_rq_from_pdu (req), +NVME_SC_HOST_PATH_ERROR ); + } }static int nvme_tcp_try_send_data (struct nvme_tcp_request *req)
Greg Kroah-Hartman
maintainerPATCH 85/203 ACPI/IORT: Check node revision for PMCG resources
In reply to Greg Kroah-HartmanFrom: Robin Murphy <[email protected]>
commit da5fb9e1ad3fbf632dce735f1bdad257ca528499 upstream.
The original version of the IORT PMCG definition had an oversight wherein there was no way to describe the second register page for an implementation using the recommended RELOC_CTRS feature. Although the spec was fixed, and the final patches merged to ACPICA and Linux written against the new version, it seems that some old firmware based on the original revision has survived and turned up in the wild.
Add a check for the original PMCG definition, and avoid filling in the second memory resource with nonsense if so. Otherwise it is likely that something horrible will happen when the PMCG driver attempts to probe.
--- drivers/acpi/arm64/iort.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/acpi/arm64/iort.c +11 -3
@@ -1361,9 +1361,17 @@ static void __init arm_smmu_v3_pmcg_init res[0 ].start = pmcg->page0_base_address; res[0 ].end = pmcg->page0_base_address +SZ_4K -1 ; res[0 ].flags =IORESOURCE_MEM ; - res[1 ].start = pmcg->page1_base_address; - res[1 ].end = pmcg->page1_base_address +SZ_4K -1 ; - res[1 ].flags =IORESOURCE_MEM ; +/* +* The initial version in DEN0049C lacked a way to describe register +* page 1, which makes it broken for most PMCG implementations; in +* that case, just let the driver fail gracefully if it expects to +* find a second memory resource. +*/ +if (node->revision >0 ) { + res[1 ].start = pmcg->page1_base_address; + res[1 ].end = pmcg->page1_base_address +SZ_4K -1 ; + res[1 ].flags =IORESOURCE_MEM ; + }if (pmcg->overflow_gsiv) acpi_iort_register_irq(pmcg->overflow_gsiv, "overflow",
Greg Kroah-Hartman
maintainerPATCH 86/203 PM: s2idle: ACPI: Fix wakeup interrupts handling
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
commit cb1f65c1e1424a4b5e4a86da8aa3b8fd8459c8ec upstream.
After commit e3728b50cd9b ("ACPI: PM: s2idle: Avoid possible race related to the EC GPE") wakeup interrupts occurring immediately after the one discarded by acpi_s2idle_wake() may be missed. Moreover, if the SCI triggers again immediately after the rearming in acpi_s2idle_wake(), that wakeup may be missed too.
The problem is that pm_system_irq_wakeup() only calls pm_system_wakeup() when pm_wakeup_irq is 0, but that's not the case any more after the interrupt causing acpi_s2idle_wake() to run until pm_wakeup_irq is cleared by the pm_wakeup_clear() call in s2idle_loop(). However, there may be wakeup interrupts occurring in that time frame and if that happens, they will be missed.
To address that issue first move the clearing of pm_wakeup_irq to the point at which it is known that the interrupt causing acpi_s2idle_wake() to tun will be discarded, before rearming the SCI for wakeup. Moreover, because that only reduces the size of the time window in which the issue may manifest itself, allow pm_system_irq_wakeup() to register two second wakeup interrupts in a row and, when discarding the first one, replace it with the second one. [Of course, this assumes that only one wakeup interrupt can be discarded in one go, but currently that is the case and I am not aware of any plans to change that.]
--- drivers/acpi/sleep.c | 1 + drivers/base/power/wakeup.c | 41 ++++++++++++++++++++++++++++++++++------- include/linux/suspend.h | 4 ++-- kernel/power/main.c | 5 ++++- kernel/power/process.c | 2 +- kernel/power/suspend.c | 2 -- 6 files changed, 42 insertions(+), 13 deletions(-)
drivers/acpi/sleep.c +1 -0
@@ -767,6 +767,7 @@ bool acpi_s2idle_wake(void)return true; } +pm_wakeup_clear (acpi_sci_irq);rearm_wake_irq (acpi_sci_irq); }
drivers/base/power/wakeup.c +34 -7
60 lines not on this page · raw message
include/linux/suspend.h +2 -2
@@ -496,14 +496,14 @@ extern void ksys_sync_helper(void);/* drivers/base/power/wakeup.c */ extern bool events_check_enabled; -extern unsigned int pm_wakeup_irq;extern suspend_state_t pm_suspend_target_state;extern bool pm_wakeup_pending (void );extern void pm_system_wakeup (void );extern void pm_system_cancel_wakeup (void ); -extern void pm_wakeup_clear (bool reset); +extern void pm_wakeup_clear (unsigned int irq_number);extern void pm_system_irq_wakeup (unsigned int irq_number); +extern unsigned int pm_wakeup_irq (void );extern bool pm_get_wakeup_count (unsigned int *count,bool block);extern bool pm_save_wakeup_count (unsigned int count);extern void pm_wakep_autosleep_enabled (bool set);
kernel/power/main.c +4 -1
@@ -504,7 +504,10 @@ static ssize_t pm_wakeup_irq_show(struct struct kobj_attribute *attr, char *buf) { - return pm_wakeup_irq ? sprintf(buf, "%u\n", pm_wakeup_irq) : -ENODATA; +if (!pm_wakeup_irq ()) +return -ENODATA ; + +return sprintf (buf,"%u\n" ,pm_wakeup_irq ()); }power_attr_ro (pm_wakeup_irq);
kernel/power/process.c +1 -1
@@ -134,7 +134,7 @@ int freeze_processes(void)if (!pm_freezing)atomic_inc (&system_freezing_cnt); -pm_wakeup_clear (true); +pm_wakeup_clear (0 );pr_info ("Freezing user space processes ... " ); pm_freezing = true; error =try_to_freeze_tasks (true);
kernel/power/suspend.c +0 -2
@@ -136,8 +136,6 @@ static void s2idle_loop(void)break ; } -pm_wakeup_clear (false); -s2idle_enter (); }
Greg Kroah-Hartman
maintainerPATCH 87/203 drm/amdgpu/display: change pipe policy for DCN 2.0
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit 6e7545ddb13416fd200e0b91c0acfd0404e2e27b upstream.
Fixes hangs on driver load with multiple displays on DCN 2.0 parts.
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +1 -1
@@ -1069,7 +1069,7 @@ static const struct dc_debug_options deb .timing_trace = false, .clock_trace = true, .disable_pplib_clock_request = true, - .pipe_split_policy = MPC_SPLIT_DYNAMIC, + .pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP, .force_single_disp_pipe_split = false, .disable_dcc = DCC_ENABLE, .vsr_support = true,
Greg Kroah-Hartman
maintainerPATCH 88/203 drm/rockchip: vop: Correct RK3399 VOP register fields
In reply to Greg Kroah-HartmanFrom: Brian Norris <[email protected]>
commit 9da1e9ab82c92d0e89fe44cad2cd7c2d18d64070 upstream.
Commit 7707f7227f09 ("drm/rockchip: Add support for afbc") switched up the rk3399_vop_big[] register windows, but it did so incorrectly.
The biggest problem is in rk3288_win23_data[] vs.
rk3368_win23_data[] .format field:
RK3288's format: VOP_REG(RK3288_WIN2_CTRL0, 0x7, 1) RK3368's format: VOP_REG(RK3368_WIN2_CTRL0, 0x3, 5)
Bits 5:6 (i.e., shift 5, mask 0x3) are correct for RK3399, according to the TRM.
There are a few other small differences between the 3288 and 3368 definitions that were swapped in commit 7707f7227f09. I reviewed them to the best of my ability according to the RK3399 TRM and fixed them up.
This fixes IOMMU issues (and display errors) when testing with BG24 color formats.
--- drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/rockchip/rockchip_vop_reg.c +5 -3
@@ -902,6 +902,7 @@ static const struct vop_win_phy rk3399_w .enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0), .format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1), .rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12), + .x_mir_en = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 21), .y_mir_en = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 22), .act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0), .dsp_info = VOP_REG(RK3288_WIN0_DSP_INFO, 0x0fff0fff, 0),
@@ -912,6 +913,7 @@ static const struct vop_win_phy rk3399_w .uv_vir = VOP_REG(RK3288_WIN0_VIR, 0x3fff, 16), .src_alpha_ctl = VOP_REG(RK3288_WIN0_SRC_ALPHA_CTRL, 0xff, 0), .dst_alpha_ctl = VOP_REG(RK3288_WIN0_DST_ALPHA_CTRL, 0xff, 0), + .channel = VOP_REG(RK3288_WIN0_CTRL2, 0xff, 0), };/*
@@ -922,11 +924,11 @@ static const struct vop_win_phy rk3399_wstatic const struct vop_win_data rk3399_vop_win_data[] = { { .base =0x00 , .phy = &rk3399_win01_data, .type =DRM_PLANE_TYPE_PRIMARY }, - { .base =0x40 , .phy = &rk3288_win01_data, + { .base =0x40 , .phy = &rk3368_win01_data, .type =DRM_PLANE_TYPE_OVERLAY }, - { .base =0x00 , .phy = &rk3288_win23_data, + { .base =0x00 , .phy = &rk3368_win23_data, .type =DRM_PLANE_TYPE_OVERLAY }, - { .base =0x50 , .phy = &rk3288_win23_data, + { .base =0x50 , .phy = &rk3368_win23_data, .type =DRM_PLANE_TYPE_CURSOR }, };
Greg Kroah-Hartman
maintainerPATCH 89/203 drm/i915: Disable DRRS on IVB/HSW port != A
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
commit ee59792c97176f12c1da31f29fc4c2aab187f06e upstream.
Currently we allow DRRS on IVB PCH ports, but we're missing a few programming steps meaning it is guaranteed to not work. And on HSW DRRS is not supported on anything but port A ever as only transcoder EDP has the M2/N2 registers (though I'm not sure if HSW ever has eDP on any other port).
Starting from BDW all transcoders have the dynamically reprogrammable M/N registers so DRRS could work on any port.
Stop initializing DRRS on ports where it cannot possibly work.
--- drivers/gpu/drm/i915/display/intel_drrs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/display/intel_drrs.c +8 -0
@@ -405,6 +405,7 @@ intel_drrs_init(struct intel_connector * struct drm_display_mode *fixed_mode) {struct drm_i915_private *dev_priv =to_i915 (connector->base.dev); +struct intel_encoder *encoder = connector->encoder;struct drm_display_mode *downclock_mode =NULL ;INIT_DELAYED_WORK (&dev_priv->drrs.work, intel_drrs_downclock_work);
@@ -416,6 +417,13 @@ intel_drrs_init(struct intel_connector *return NULL ; } +if ((DISPLAY_VER (dev_priv) <8 && !HAS_GMCH (dev_priv)) && + encoder->port !=PORT_A ) { +drm_dbg_kms (&dev_priv->drm, +"DRRS only supported on eDP port A\n" ); +return NULL ; + } +if (dev_priv->vbt.drrs_type !=SEAMLESS_DRRS_SUPPORT ) {drm_dbg_kms (&dev_priv->drm,"VBT doesn't support DRRS\n" );return NULL ;
Greg Kroah-Hartman
maintainerPATCH 90/203 drm/i915: Allow !join_mbus cases for adlp+ dbuf configuration
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
commit 8fd5a26e43859547790a7995494c952b708ab3b5 upstream.
Reintroduce the !join_mbus single pipe cases for adlp+.
Due to the mbus relative dbuf offsets in PLANE_BUF_CFG we need to know the actual slices used by the pipe when doing readout, even when mbus joining isn't enabled. Accurate readout will be needed to properly sanitize invalid BIOS dbuf configurations.
This will also make it much easier to play around with the !join_mbus configs for testin/workaround purposes.
--- drivers/gpu/drm/i915/intel_pm.c | 66 +++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +46 -20
@@ -4707,6 +4707,10 @@ static const struct dbuf_slice_conf_entr };static const struct dbuf_slice_conf_entry adlp_allowed_dbufs[] = { +/* +* Keep the join_mbus cases first so check_mbus_joined() +* will prefer them over the !join_mbus cases. +*/ { .active_pipes =BIT (PIPE_A ), .dbuf_mask = {
@@ -4722,6 +4726,20 @@ static const struct dbuf_slice_conf_entr .join_mbus = true, }, { + .active_pipes = BIT(PIPE_A), + .dbuf_mask = { + [PIPE_A] = BIT(DBUF_S1) | BIT(DBUF_S2), + }, + .join_mbus = false, + }, + { + .active_pipes = BIT(PIPE_B), + .dbuf_mask = { + [PIPE_B] = BIT(DBUF_S3) | BIT(DBUF_S4), + }, + .join_mbus = false, + }, + { .active_pipes = BIT(PIPE_A) | BIT(PIPE_B), .dbuf_mask = { [PIPE_A] = BIT(DBUF_S1) | BIT(DBUF_S2),
@@ -4837,13 +4855,14 @@ static bool adlp_check_mbus_joined(u8 acreturn check_mbus_joined (active_pipes, adlp_allowed_dbufs); } -static u8 compute_dbuf_slices (enum pipe pipe,u8 active_pipes, +static u8 compute_dbuf_slices (enum pipe pipe,u8 active_pipes,bool join_mbus,const struct dbuf_slice_conf_entry *dbuf_slices) {int i;for (i =0 ; i < dbuf_slices[i].active_pipes; i++) { -if (dbuf_slices[i].active_pipes == active_pipes) +if (dbuf_slices[i].active_pipes == active_pipes && + dbuf_slices[i].join_mbus == join_mbus)return dbuf_slices[i].dbuf_mask[pipe]; }return 0 ;
@@ -4854,7 +4873,7 @@ static u8 compute_dbuf_slices(enum pipe* returns correspondent DBuf slice mask as stated in BSpec for particular * platform. */ -static u8 icl_compute_dbuf_slices (enum pipe pipe,u8 active_pipes) +static u8 icl_compute_dbuf_slices (enum pipe pipe,u8 active_pipes,bool join_mbus) {/* * FIXME: For ICL this is still a bit unclear as prev BSpec revision
@@ -4868,37 +4887,41 @@ static u8 icl_compute_dbuf_slices(enum p* still here - we will need it once those additional constraints * pop up. */ -return compute_dbuf_slices (pipe, active_pipes, icl_allowed_dbufs); +return compute_dbuf_slices (pipe, active_pipes, join_mbus, + icl_allowed_dbufs); } -static u8 tgl_compute_dbuf_slices (enum pipe pipe,u8 active_pipes) +static u8 tgl_compute_dbuf_slices (enum pipe pipe,u8 active_pipes,bool join_mbus) { -return compute_dbuf_slices (pipe, active_pipes, tgl_allowed_dbufs); +return compute_dbuf_slices (pipe, active_pipes, join_mbus, + tgl_allowed_dbufs); } -static u32 adlp_compute_dbuf_slices (enum pipe pipe,u32 active_pipes) +static u8 adlp_compute_dbuf_slices (enum pipe pipe,u8 active_pipes,bool join_mbus) { -return compute_dbuf_slices (pipe, active_pipes, adlp_allowed_dbufs); +return compute_dbuf_slices (pipe, active_pipes, join_mbus, + adlp_allowed_dbufs); } -static u32 dg2_compute_dbuf_slices (enum pipe pipe,u32 active_pipes) +static u8 dg2_compute_dbuf_slices (enum pipe pipe,u8 active_pipes,bool join_mbus) { -return compute_dbuf_slices (pipe, active_pipes, dg2_allowed_dbufs); +return compute_dbuf_slices (pipe, active_pipes, join_mbus, + dg2_allowed_dbufs); } -static u8 skl_compute_dbuf_slices (struct intel_crtc *crtc,u8 active_pipes) +static u8 skl_compute_dbuf_slices (struct intel_crtc *crtc,u8 active_pipes,bool join_mbus) {struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);enum pipe pipe = crtc->pipe;if (IS_DG2 (dev_priv)) -return dg2_compute_dbuf_slices (pipe, active_pipes); +return dg2_compute_dbuf_slices (pipe, active_pipes, join_mbus);else if (IS_ALDERLAKE_P (dev_priv)) -return adlp_compute_dbuf_slices (pipe, active_pipes); +return adlp_compute_dbuf_slices (pipe, active_pipes, join_mbus);else if (DISPLAY_VER (dev_priv) ==12 ) -return tgl_compute_dbuf_slices (pipe, active_pipes); +return tgl_compute_dbuf_slices (pipe, active_pipes, join_mbus);else if (DISPLAY_VER (dev_priv) ==11 ) -return icl_compute_dbuf_slices (pipe, active_pipes); +return icl_compute_dbuf_slices (pipe, active_pipes, join_mbus);/* * For anything else just return one slice yet. * Should be extended for other platforms.
@@ -6109,11 +6132,16 @@ skl_compute_ddb(struct intel_atomic_statreturn ret; } +if (IS_ALDERLAKE_P (dev_priv)) + new_dbuf_state->joined_mbus = +adlp_check_mbus_joined (new_dbuf_state->active_pipes); +for_each_intel_crtc (&dev_priv->drm, crtc) {enum pipe pipe = crtc->pipe; new_dbuf_state->slices[pipe] = -skl_compute_dbuf_slices (crtc, new_dbuf_state->active_pipes); +skl_compute_dbuf_slices (crtc, new_dbuf_state->active_pipes, + new_dbuf_state->joined_mbus);if (old_dbuf_state->slices[pipe] == new_dbuf_state->slices[pipe])continue ;
@@ -6125,9 +6153,6 @@ skl_compute_ddb(struct intel_atomic_stat new_dbuf_state->enabled_slices =intel_dbuf_enabled_slices (new_dbuf_state); -if (IS_ALDERLAKE_P (dev_priv)) - new_dbuf_state->joined_mbus =adlp_check_mbus_joined (new_dbuf_state->active_pipes); -if (old_dbuf_state->enabled_slices != new_dbuf_state->enabled_slices || old_dbuf_state->joined_mbus != new_dbuf_state->joined_mbus) { ret =intel_atomic_serialize_global_state (&new_dbuf_state->base);
@@ -6628,7 +6653,8 @@ void skl_wm_get_hw_state(struct drm_i915 } dbuf_state->slices[pipe] = -skl_compute_dbuf_slices (crtc, dbuf_state->active_pipes); +skl_compute_dbuf_slices (crtc, dbuf_state->active_pipes, + dbuf_state->joined_mbus); dbuf_state->weight[pipe] =intel_crtc_ddb_weight (crtc_state);
Greg Kroah-Hartman
maintainerPATCH 91/203 drm/i915: Populate pipe dbuf slices more accurately during readout
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
commit 85bb289215cf37e05e9581b39b114db1293f9ecd upstream.
During readout we cannot assume the planes are actually using the slices they are supposed to use. The BIOS may have misprogrammed things and put the planes onto the wrong dbuf slices. So let's do the readout more carefully to make sure we really know which dbuf slices are actually in use by the pipe at the time.
--- drivers/gpu/drm/i915/intel_pm.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +8 -5
@@ -6633,6 +6633,7 @@ void skl_wm_get_hw_state(struct drm_i915enum pipe pipe = crtc->pipe;unsigned int mbus_offset;enum plane_id plane_id; +u8 slices;skl_pipe_wm_get_hw_state (crtc, &crtc_state->wm.skl.optimal); crtc_state->wm.skl.raw = crtc_state->wm.skl.optimal;
@@ -6652,20 +6653,22 @@ void skl_wm_get_hw_state(struct drm_i915skl_ddb_entry_union (&dbuf_state->ddb[pipe], ddb_uv); } - dbuf_state->slices[pipe] = -skl_compute_dbuf_slices (crtc, dbuf_state->active_pipes, - dbuf_state->joined_mbus); - dbuf_state->weight[pipe] =intel_crtc_ddb_weight (crtc_state);/* * Used for checking overlaps, so we need absolute * offsets instead of MBUS relative offsets. */ - mbus_offset =mbus_ddb_offset (dev_priv, dbuf_state->slices[pipe]); + slices =skl_compute_dbuf_slices (crtc, dbuf_state->active_pipes, + dbuf_state->joined_mbus); + mbus_offset =mbus_ddb_offset (dev_priv, slices); crtc_state->wm.skl.ddb.start = mbus_offset + dbuf_state->ddb[pipe].start; crtc_state->wm.skl.ddb.end = mbus_offset + dbuf_state->ddb[pipe].end; +/* The slices actually used by the planes on the pipe */ + dbuf_state->slices[pipe] = +skl_ddb_dbuf_slice_mask (dev_priv, &crtc_state->wm.skl.ddb); + drm_dbg_kms(&dev_priv->drm, "[CRTC:%d:%s] dbuf slices 0x%x, ddb (%d - %d), active pipes 0x%x, mbus joined: %s\n", crtc->base.base.id, crtc->base.name,
Greg Kroah-Hartman
maintainerPATCH 92/203 drm/i915: Workaround broken BIOS DBUF configuration on TGL/RKL
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
commit 4e6f55120c7eccf6f9323bb681632e23cbcb3f3c upstream.
On TGL/RKL the BIOS likes to use some kind of bogus DBUF layout that doesn't match what the spec recommends. With a single active pipe that is not going to be a problem, but with multiple pipes active skl_commit_modeset_enables() goes into an infinite loop since it can't figure out any order in which it can commit the pipes without causing DBUF overlaps between the planes.
We'd need some kind of extra DBUF defrag stage in between to make the transition possible. But that is clearly way too complex a solution, so in the name of simplicity let's just sanitize the DBUF state by simply turning off all planes when we detect a pipe encroaching on its neighbours' DBUF slices. We only have to disable the primary planes as all other planes should have already been disabled (if they somehow were enabled) by earlier sanitization steps.
And for good measure let's also sanitize in case the DBUF allocations of the pipes already seem to overlap each other.
--- drivers/gpu/drm/i915/display/intel_display.c | 1 drivers/gpu/drm/i915/intel_pm.c | 68 +++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_pm.h | 1 3 files changed, 70 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +1 -0
@@ -11901,6 +11901,7 @@ intel_modeset_setup_hw_state(struct drm_vlv_wm_sanitize (dev_priv); }else if (DISPLAY_VER (dev_priv) >=9 ) {skl_wm_get_hw_state (dev_priv); +skl_wm_sanitize (dev_priv); }else if (HAS_PCH_SPLIT (dev_priv)) {ilk_wm_get_hw_state (dev_priv); }
drivers/gpu/drm/i915/intel_pm.c +68 -0
74 lines not on this page · raw message
drivers/gpu/drm/i915/intel_pm.h +1 -0
@@ -47,6 +47,7 @@ void skl_pipe_wm_get_hw_state(struct int struct skl_pipe_wm *out);void g4x_wm_sanitize (struct drm_i915_private *dev_priv);void vlv_wm_sanitize (struct drm_i915_private *dev_priv); +void skl_wm_sanitize (struct drm_i915_private *dev_priv);bool intel_can_enable_sagv (struct drm_i915_private *dev_priv,const struct intel_bw_state *bw_state);void intel_sagv_pre_plane_update (struct intel_atomic_state *state);
Greg Kroah-Hartman
maintainerPATCH 93/203 ARM: dts: Fix timer regression for beagleboard revision c
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 23885389dbbbbc698986e77a45c1fc44a6e3632e ]
Commit e428e250fde6 ("ARM: dts: Configure system timers for omap3") caused a timer regression for beagleboard revision c where the system clockevent stops working if omap3isp module is unloaded.
Turns out we still have beagleboard revisions a-b4 capacitor c70 quirks applied that limit the usable timers for no good reason. This also affects the power management as we use the system clock instead of the 32k clock source.
Let's fix the issue by adding a new omap3-beagle-ab4.dts for the old timer quirks. This allows us to remove the timer quirks for later beagleboard revisions. We also need to update the related timer quirk check for the correct compatible property.
--- .../devicetree/bindings/arm/omap/omap.txt | 3 ++ arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/omap3-beagle-ab4.dts | 47 +++++++++++++++++++ arch/arm/boot/dts/omap3-beagle.dts | 33 ------------- drivers/clocksource/timer-ti-dm-systimer.c | 2 +- 5 files changed, 52 insertions(+), 34 deletions(-) create mode 100644 arch/arm/boot/dts/omap3-beagle-ab4.dts
Documentation/devicetree/bindings/arm/omap/omap.txt +3 -0
@@ -119,6 +119,9 @@ Boards (incomplete list of examples): - OMAP3 BeagleBoard : Low cost community board compatible = "ti,omap3-beagle", "ti,omap3430", "ti,omap3" +- OMAP3 BeagleBoard A to B4 : Early BeagleBoard revisions A to B4 with a timer quirk + compatible = "ti,omap3-beagle-ab4", "ti,omap3-beagle", "ti,omap3430", "ti,omap3" + - OMAP3 Tobi with Overo : Commercial expansion board with daughter board compatible = "gumstix,omap3-overo-tobi", "gumstix,omap3-overo", "ti,omap3430", "ti,omap3"
arch/arm/boot/dts/Makefile +1 -0
@@ -794,6 +794,7 @@ dtb-$(CONFIG_ARCH_OMAP3) += \ logicpd-som-lv-37xx-devkit.dtb \ omap3430-sdp.dtb \ omap3-beagle.dtb \ + omap3-beagle-ab4.dtb \ omap3-beagle-xm.dtb \ omap3-beagle-xm-ab.dtb \ omap3-cm-t3517.dtb \
arch/arm/boot/dts/omap3-beagle-ab4.dts new file +47 -0
47 lines not on this page · raw message
arch/arm/boot/dts/omap3-beagle.dts +0 -33
@@ -304,39 +304,6 @@ &usbhsehci { phys = <0 &hsusb2_phy>; }; -/* Unusable as clocksource because of unreliable oscillator */ -&counter32k { - status = "disabled"; -}; - -/* Unusable as clockevent because if unreliable oscillator, allow to idle */ -&timer1_target { - /delete-property/ti,no-reset-on-init; - /delete-property/ti,no-idle; - timer@0 { - /delete-property/ti,timer-alwon; - }; -}; - -/* Preferred always-on timer for clocksource */ -&timer12_target { - ti,no-reset-on-init; - ti,no-idle; - timer@0 { - /* Always clocked by secure_32k_fck */ - }; -}; - -/* Preferred timer for clockevent */ -&timer2_target { - ti,no-reset-on-init; - ti,no-idle; - timer@0 { - assigned-clocks = <&gpt2_fck>; - assigned-clock-parents = <&sys_ck>; - }; -}; - &twl_gpio { ti,use-leds; /* pullups: BIT(1) */
drivers/clocksource/timer-ti-dm-systimer.c +1 -1
@@ -241,7 +241,7 @@ static void __init dmtimer_systimer_assign_alwon(void)bool quirk_unreliable_oscillator = false;/* Quirk unreliable 32 KiHz oscillator with incomplete dts */ -if (of_machine_is_compatible ("ti,omap3-beagle" ) || +if (of_machine_is_compatible ("ti,omap3-beagle-ab4" ) ||of_machine_is_compatible ("timll,omap3-devkit8000" )) { quirk_unreliable_oscillator = true; counter_32k = -ENODEV ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 94/203 ARM: dts: meson: Fix the UART compatible strings
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 5225e1b87432dcf0d0fc3440824b91d04c1d6cc1 ]
The dt-bindings for the UART controller only allow the following values for Meson6 SoCs:
- "amlogic,meson6-uart", "amlogic,meson-ao-uart"
- "amlogic,meson6-uart"
Use the correct fallback compatible string "amlogic,meson-ao-uart" for AO UART. Drop the "amlogic,meson-uart" compatible string from the EE domain UART controllers.
--- arch/arm/boot/dts/meson.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/meson.dtsi +4 -4
@@ -59,7 +59,7 @@ hwrng: rng@8100 { }; uart_A: serial@84c0 { - compatible = "amlogic,meson6-uart", "amlogic,meson-uart"; + compatible = "amlogic,meson6-uart"; reg = <0x84c0 0x18>; interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>; fifo-size = <128>;
@@ -67,7 +67,7 @@ uart_A: serial@84c0 { }; uart_B: serial@84dc { - compatible = "amlogic,meson6-uart", "amlogic,meson-uart"; + compatible = "amlogic,meson6-uart"; reg = <0x84dc 0x18>; interrupts = <GIC_SPI 75 IRQ_TYPE_EDGE_RISING>; status = "disabled";
@@ -105,7 +105,7 @@ saradc: adc@8680 { }; uart_C: serial@8700 { - compatible = "amlogic,meson6-uart", "amlogic,meson-uart"; + compatible = "amlogic,meson6-uart"; reg = <0x8700 0x18>; interrupts = <GIC_SPI 93 IRQ_TYPE_EDGE_RISING>; status = "disabled";
@@ -228,7 +228,7 @@ ir_receiver: ir-receiver@480 { }; uart_AO: serial@4c0 { - compatible = "amlogic,meson6-uart", "amlogic,meson-ao-uart", "amlogic,meson-uart"; + compatible = "amlogic,meson6-uart", "amlogic,meson-ao-uart"; reg = <0x4c0 0x18>; interrupts = <GIC_SPI 90 IRQ_TYPE_EDGE_RISING>; status = "disabled";
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 95/203 ARM: dts: meson8: Fix the UART device-tree schema validation
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 57007bfb5469ba31cacf69d52195e8b75f43e32d ]
The dt-bindings for the UART controller only allow the following values for Meson8 SoCs:
- "amlogic,meson8-uart", "amlogic,meson-ao-uart"
- "amlogic,meson8-uart"
Use the correct fallback compatible string "amlogic,meson-ao-uart" for AO UART. Drop the "amlogic,meson-uart" compatible string from the EE domain UART controllers.
Also update the order of the clocks to match the order defined in the yaml schema.
--- arch/arm/boot/dts/meson8.dtsi | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
arch/arm/boot/dts/meson8.dtsi +12 -12
@@ -736,27 +736,27 @@ &timer_abcde { }; &uart_AO { - compatible = "amlogic,meson8-uart", "amlogic,meson-uart"; - clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_CLK81>; - clock-names = "baud", "xtal", "pclk"; + compatible = "amlogic,meson8-uart", "amlogic,meson-ao-uart"; + clocks = <&xtal>, <&clkc CLKID_CLK81>, <&clkc CLKID_CLK81>; + clock-names = "xtal", "pclk", "baud"; }; &uart_A { - compatible = "amlogic,meson8-uart", "amlogic,meson-uart"; - clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART0>; - clock-names = "baud", "xtal", "pclk"; + compatible = "amlogic,meson8-uart"; + clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; + clock-names = "xtal", "pclk", "baud"; }; &uart_B { - compatible = "amlogic,meson8-uart", "amlogic,meson-uart"; - clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART1>; - clock-names = "baud", "xtal", "pclk"; + compatible = "amlogic,meson8-uart"; + clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; + clock-names = "xtal", "pclk", "baud"; }; &uart_C { - compatible = "amlogic,meson8-uart", "amlogic,meson-uart"; - clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART2>; - clock-names = "baud", "xtal", "pclk"; + compatible = "amlogic,meson8-uart"; + clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; + clock-names = "xtal", "pclk", "baud"; }; &usb0 {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 96/203 ARM: dts: meson8b: Fix the UART device-tree schema validation
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 3375aa77135f6aeb1107ed839a2050a4118444bc ]
The dt-bindings for the UART controller only allow the following values for Meson8 SoCs:
- "amlogic,meson8b-uart", "amlogic,meson-ao-uart"
- "amlogic,meson8b-uart"
Use the correct fallback compatible string "amlogic,meson-ao-uart" for AO UART. Drop the "amlogic,meson-uart" compatible string from the EE domain UART controllers.
Also update the order of the clocks to match the order defined in the yaml bindings.
--- arch/arm/boot/dts/meson8b.dtsi | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
arch/arm/boot/dts/meson8b.dtsi +12 -12
@@ -724,27 +724,27 @@ &timer_abcde { }; &uart_AO { - compatible = "amlogic,meson8b-uart", "amlogic,meson-uart"; - clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_CLK81>; - clock-names = "baud", "xtal", "pclk"; + compatible = "amlogic,meson8b-uart", "amlogic,meson-ao-uart"; + clocks = <&xtal>, <&clkc CLKID_CLK81>, <&clkc CLKID_CLK81>; + clock-names = "xtal", "pclk", "baud"; }; &uart_A { - compatible = "amlogic,meson8b-uart", "amlogic,meson-uart"; - clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART0>; - clock-names = "baud", "xtal", "pclk"; + compatible = "amlogic,meson8b-uart"; + clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; + clock-names = "xtal", "pclk", "baud"; }; &uart_B { - compatible = "amlogic,meson8b-uart", "amlogic,meson-uart"; - clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART1>; - clock-names = "baud", "xtal", "pclk"; + compatible = "amlogic,meson8b-uart"; + clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; + clock-names = "xtal", "pclk", "baud"; }; &uart_C { - compatible = "amlogic,meson8b-uart", "amlogic,meson-uart"; - clocks = <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART2>; - clock-names = "baud", "xtal", "pclk"; + compatible = "amlogic,meson8b-uart"; + clocks = <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; + clock-names = "xtal", "pclk", "baud"; }; &usb0 {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 97/203 phy: broadcom: Kconfig: Fix PHY_BRCM_USB config option
In reply to Greg Kroah-HartmanFrom: Al Cooper <[email protected]>
[ Upstream commit 5070ce86246a8a4ebacd0c15b121e6b6325bc167 ]
The previous commit 4b402fa8e0b7 ("phy: phy-brcm-usb: support PHY on the BCM4908") added a second "default" line for ARCH_BCM_4908 above the original "default" line for ARCH_BRCMSTB. When two "default" lines are used, only the first is used and this change stopped the PHY_BRCM_USB option for being enabled for ARCH_BRCMSTB. The fix is to use one "default line with "||".
--- drivers/phy/broadcom/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/phy/broadcom/Kconfig +1 -2
@@ -97,8 +97,7 @@ config PHY_BRCM_USB depends on OF select GENERIC_PHY select SOC_BRCMSTB if ARCH_BRCMSTB - default ARCH_BCM4908 - default ARCH_BRCMSTB + default ARCH_BCM4908 || ARCH_BRCMSTB help Enable this to support the Broadcom STB USB PHY. This driver is required by the USB XHCI, EHCI and OHCI
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 98/203 tee: optee: do not check memref size on return from Secure World
In reply to Greg Kroah-HartmanFrom: Jerome Forissier <[email protected]>
[ Upstream commit abc8dc34d1f6e34ed346c6e3fc554127e421b769 ]
Commit c650b8dc7a79 ("tee: optee: do not check memref size on return from Secure World") was mistakenly lost in commit 4602c5842f64 ("optee:
refactor driver with internal callbacks"). Remove the unwanted code again.
--- drivers/tee/optee/smc_abi.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/tee/optee/smc_abi.c +0 -10
@@ -71,16 +71,6 @@ static int from_msg_param_tmp_mem(struct tee_param *p, u32 attr, 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; - } -return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 99/203 optee: add error checks in optee_ffa_do_call_with_arg()
In reply to Greg Kroah-HartmanFrom: Jens Wiklander <[email protected]>
[ Upstream commit 4064c461148ab129dfe5eaeea129b4af6cf4b9b7 ]
Adds error checking in optee_ffa_do_call_with_arg() for correctness.
--- drivers/tee/optee/ffa_abi.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/tee/optee/ffa_abi.c +12 -3
@@ -619,9 +619,18 @@ static int optee_ffa_do_call_with_arg(struct tee_context *ctx, .data2 = (u32)(shm->sec_world_id >> 32), .data3 = shm->offset, }; -struct optee_msg_arg *arg =tee_shm_get_va (shm,0 ); -unsigned int rpc_arg_offs =OPTEE_MSG_GET_ARG_SIZE (arg->num_params); -struct optee_msg_arg *rpc_arg =tee_shm_get_va (shm, rpc_arg_offs); +struct optee_msg_arg *arg; +unsigned int rpc_arg_offs; +struct optee_msg_arg *rpc_arg; + + arg =tee_shm_get_va (shm,0 ); +if (IS_ERR (arg)) +return PTR_ERR (arg); + + rpc_arg_offs =OPTEE_MSG_GET_ARG_SIZE (arg->num_params); + rpc_arg =tee_shm_get_va (shm, rpc_arg_offs); +if (IS_ERR (rpc_arg)) +return PTR_ERR (rpc_arg);return optee_ffa_yielding_call (ctx, &data, rpc_arg); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 100/203 staging: fbtft: Fix error path in fbtft_driver_module_init()
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 426aca16e903b387a0b0001d62207a745c67cfd3 ]
If registering the platform driver fails, the function must not return without undoing the spi driver registration first.
--- drivers/staging/fbtft/fbtft.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/fbtft/fbtft.h +4 -1
@@ -334,7 +334,10 @@ static int __init fbtft_driver_module_init(void) \ ret =spi_register_driver (&fbtft_driver_spi_driver); \if (ret <0 ) \return ret; \ -return platform_driver_register (&fbtft_driver_platform_driver); \ + ret =platform_driver_register (&fbtft_driver_platform_driver); \ +if (ret <0 ) \ +spi_unregister_driver (&fbtft_driver_spi_driver); \ +return ret; \ } \ \ static void __exit fbtft_driver_module_exit(void) \
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 101/203 ARM: dts: imx6qdl-udoo: Properly describe the SD card detect
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit 993d66140f8d1c1853a3b58b77b43b681eb64dee ]
GPIO7_IO00 is used as SD card detect.
Properly describe this in the devicetree.
--- arch/arm/boot/dts/imx6qdl-udoo.dtsi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx6qdl-udoo.dtsi +4 -1
@@ -5,6 +5,8 @@ * Author: Fabio Estevam <[email protected]> */ +#include <dt-bindings/gpio/gpio.h> + / { aliases { backlight = &backlight;
@@ -226,6 +228,7 @@ MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059 MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059 + MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x1b0b0 >; };
@@ -304,7 +307,7 @@ &usbotg { &usdhc3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc3>; - non-removable; + cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>; status = "okay"; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 102/203 phy: xilinx: zynqmp: Fix bus width setting for SGMII
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 37291f60d0822f191748c2a54ce63b0bc669020f ]
TX_PROT_BUS_WIDTH and RX_PROT_BUS_WIDTH are single registers with separate bit fields for each lane. The code in xpsgtr_phy_init_sgmii was not preserving the existing register value for other lanes, so enabling the PHY in SGMII mode on one lane zeroed out the settings for all other lanes, causing other PS-GTR peripherals such as USB3 to malfunction.
Use xpsgtr_clr_set to only manipulate the desired bits in the register.
--- drivers/phy/xilinx/phy-zynqmp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/phy/xilinx/phy-zynqmp.c +6 -5
@@ -134,7 +134,8 @@#define PROT_BUS_WIDTH_10 0x0#define PROT_BUS_WIDTH_20 0x1#define PROT_BUS_WIDTH_40 0x2 -#define PROT_BUS_WIDTH_SHIFT 2 +#define PROT_BUS_WIDTH_SHIFT (n) ((n) * 2) +#define PROT_BUS_WIDTH_MASK (n) GENMASK((n) * 2 + 1, (n) * 2)/* Number of GT lanes */ #define NUM_LANES 4
@@ -445,12 +446,12 @@ static void xpsgtr_phy_init_sata(struct xpsgtr_phy *gtr_phy)static void xpsgtr_phy_init_sgmii (struct xpsgtr_phy *gtr_phy) {struct xpsgtr_dev *gtr_dev = gtr_phy->dev; +u32 mask =PROT_BUS_WIDTH_MASK (gtr_phy->lane); +u32 val =PROT_BUS_WIDTH_10 <<PROT_BUS_WIDTH_SHIFT (gtr_phy->lane);/* Set SGMII protocol TX and RX bus width to 10 bits. */ -xpsgtr_write (gtr_dev,TX_PROT_BUS_WIDTH , -PROT_BUS_WIDTH_10 << (gtr_phy->lane *PROT_BUS_WIDTH_SHIFT )); -xpsgtr_write (gtr_dev,RX_PROT_BUS_WIDTH , -PROT_BUS_WIDTH_10 << (gtr_phy->lane *PROT_BUS_WIDTH_SHIFT )); +xpsgtr_clr_set (gtr_dev,TX_PROT_BUS_WIDTH , mask, val); +xpsgtr_clr_set (gtr_dev,RX_PROT_BUS_WIDTH , mask, val);xpsgtr_bypass_scrambler_8b10b (gtr_phy); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 103/203 phy: stm32: fix a refcount leak in stm32_usbphyc_pll_enable()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit cfc826c88a79e22ba5d8001556eb2c7efd8a01b6 ]
This error path needs to decrement "usbphyc->n_pll_cons.counter" before returning.
--- drivers/phy/st/phy-stm32-usbphyc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/st/phy-stm32-usbphyc.c +1 -1
@@ -304,7 +304,7 @@ static int stm32_usbphyc_pll_enable(struct stm32_usbphyc *usbphyc) ret =__stm32_usbphyc_pll_disable (usbphyc);if (ret) -return ret; + goto dec_n_pll_cons; } ret =stm32_usbphyc_regulators_enable (usbphyc);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 104/203 ARM: dts: imx7ulp: Fix assigned-clocks-parents typo
In reply to Greg Kroah-HartmanFrom: Rob Herring <[email protected]>
[ Upstream commit 6d58c5e21a3fe355ce6d1808e96d02a610265218 ]
The correct property name is 'assigned-clock-parents', not 'assigned-clocks-parents'. Though if the platform works with the typo, one has to wonder if the property is even needed.
--- arch/arm/boot/dts/imx7ulp.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx7ulp.dtsi +1 -1
@@ -259,7 +259,7 @@ wdog1: watchdog@403d0000 { interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; clocks = <&pcc2 IMX7ULP_CLK_WDG1>; assigned-clocks = <&pcc2 IMX7ULP_CLK_WDG1>; - assigned-clocks-parents = <&scg1 IMX7ULP_CLK_FIRC_BUS_CLK>; + assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC_BUS_CLK>; timeout-sec = <40>; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 105/203 arm64: dts: imx8mq: fix mipi_csi bidirectional port numbers
In reply to Greg Kroah-HartmanFrom: Martin Kepplinger <[email protected]>
[ Upstream commit 283d45145fbf460dbaf0229cacd7ed60ec52f364 ]
The port numbers for the imx8mq mipi csi controller are wrong and the mipi driver can't find any media devices as port@1 is connected to the CSI bridge, not port@0. And port@0 is connected to the source - the sensor. Fix this.
--- arch/arm64/boot/dts/freescale/imx8mq.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/freescale/imx8mq.dtsi +4 -4
@@ -1123,8 +1123,8 @@ ports { #address-cells = <1>; #size-cells = <0>; - port@0 { - reg = <0>; + port@1 { + reg = <1>; csi1_mipi_ep: endpoint { remote-endpoint = <&csi1_ep>;
@@ -1175,8 +1175,8 @@ ports { #address-cells = <1>; #size-cells = <0>; - port@0 { - reg = <0>; + port@1 { + reg = <1>; csi2_mipi_ep: endpoint { remote-endpoint = <&csi2_ep>;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 106/203 usb: f_fs: Fix use-after-free for epfile
In reply to Greg Kroah-HartmanFrom: Udipto Goswami <[email protected]>
[ Upstream commit ebe2b1add1055b903e2acd86b290a85297edc0b3 ]
Consider a case where ffs_func_eps_disable is called from ffs_func_disable as part of composition switch and at the same time ffs_epfile_release get called from userspace. ffs_epfile_release will free up the read buffer and call ffs_data_closed which in turn destroys ffs->epfiles and mark it as NULL. While this was happening the driver has already initialized the local epfile in ffs_func_eps_disable which is now freed and waiting to acquire the spinlock. Once spinlock is acquired the driver proceeds with the stale value of epfile and tries to free the already freed read buffer causing use-after-free.
Following is the illustration of the race:
CPU1 CPU2
ffs_func_eps_disable
epfiles (local copy)
ffs_epfile_release ffs_data_closed if (last file closed) ffs_data_reset ffs_data_clear ffs_epfiles_destroyspin_lock
dereference epfiles
Fix this races by taking epfiles local copy & assigning it under spinlock and if epfiles(local) is null then update it in ffs->epfiles then finally destroy it.
Extending the scope further from the race, protecting the ep related structures, and concurrent accesses.
--- drivers/usb/gadget/function/f_fs.c | 56 ++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 14 deletions(-)
drivers/usb/gadget/function/f_fs.c +42 -14
@@ -1711,16 +1711,24 @@ static void ffs_data_put(struct ffs_data *ffs)static void ffs_data_closed (struct ffs_data *ffs) { +struct ffs_epfile *epfiles; +unsigned long flags; +ENTER ();if (atomic_dec_and_test (&ffs->opened)) {if (ffs->no_disconnect) { ffs->state =FFS_DEACTIVATED ; -if (ffs->epfiles) { -ffs_epfiles_destroy (ffs->epfiles, - ffs->eps_count); - ffs->epfiles =NULL ; - } +spin_lock_irqsave (&ffs->eps_lock, flags); + epfiles = ffs->epfiles; + ffs->epfiles =NULL ; +spin_unlock_irqrestore (&ffs->eps_lock, + flags); + +if (epfiles) +ffs_epfiles_destroy (epfiles, + ffs->eps_count); +if (ffs->setup_state ==FFS_SETUP_PENDING )__ffs_ep0_stall (ffs); }else {
@@ -1767,14 +1775,27 @@ static struct ffs_data *ffs_data_new(const char *dev_name)static void ffs_data_clear (struct ffs_data *ffs) { +struct ffs_epfile *epfiles; +unsigned long flags; +ENTER ();ffs_closed (ffs);BUG_ON (ffs->gadget); -if (ffs->epfiles) { -ffs_epfiles_destroy (ffs->epfiles, ffs->eps_count); +spin_lock_irqsave (&ffs->eps_lock, flags); + epfiles = ffs->epfiles; + ffs->epfiles =NULL ; +spin_unlock_irqrestore (&ffs->eps_lock, flags); + +/* +* potential race possible between ffs_func_eps_disable +* & ffs_epfile_release therefore maintaining a local +* copy of epfile will save us from use-after-free. +*/ +if (epfiles) { +ffs_epfiles_destroy (epfiles, ffs->eps_count); ffs->epfiles =NULL ; }
@@ -1922,12 +1943,15 @@ static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count)static void ffs_func_eps_disable (struct ffs_function *func) { -struct ffs_ep *ep = func->eps; -struct ffs_epfile *epfile = func->ffs->epfiles; -unsigned count = func->ffs->eps_count; +struct ffs_ep *ep; +struct ffs_epfile *epfile; +unsigned short count;unsigned long flags;spin_lock_irqsave (&func->ffs->eps_lock, flags); + count = func->ffs->eps_count; + epfile = func->ffs->epfiles; + ep = func->eps;while (count--) {/* pending requests get nuked */ if (ep->ep)
@@ -1945,14 +1969,18 @@ static void ffs_func_eps_disable(struct ffs_function *func)static int ffs_func_eps_enable (struct ffs_function *func) { -struct ffs_data *ffs = func->ffs; -struct ffs_ep *ep = func->eps; -struct ffs_epfile *epfile = ffs->epfiles; -unsigned count = ffs->eps_count; +struct ffs_data *ffs; +struct ffs_ep *ep; +struct ffs_epfile *epfile; +unsigned short count;unsigned long flags;int ret =0 ;spin_lock_irqsave (&func->ffs->eps_lock, flags); + ffs = func->ffs; + ep = func->eps; + epfile = ffs->epfiles; + count = ffs->eps_count;while (count--) { ep->ep->driver_data = ep;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 107/203 arm64: Enable Cortex-A510 erratum 2051678 by default
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit a4b92cebc31d49b7e6ef0ce584c7f2a2e112877d ]
The recently added configuration option for Cortex A510 erratum 2051678 does not have a "default y" unlike other errata fixes. This appears to simply be an oversight since the help text suggests enabling the option if unsure and there's nothing in the commit log to suggest it is intentional.
--- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/Kconfig +1 -0
@@ -672,6 +672,7 @@ config ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE config ARM64_ERRATUM_2051678 bool "Cortex-A510: 2051678: disable Hardware Update of the page table dirty bit" + default y help This options adds the workaround for ARM Cortex-A510 erratum ARM64_ERRATUM_2051678. Affected Coretex-A510 might not respect the ordering rules for
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 108/203 phy: dphy: Correct clk_pre parameter
In reply to Greg Kroah-HartmanFrom: Liu Ying <[email protected]>
[ Upstream commit 9a8406ba1a9a2965c27e0db1d7753471d12ee9ff ]
The D-PHY specification (v1.2) explicitly mentions that the T-CLK-PRE parameter's unit is Unit Interval(UI) and the minimum value is 8. Also, kernel doc of the 'clk_pre' member of struct phy_configure_opts_mipi_dphy mentions that it should be in UI. However, the dphy core driver wrongly sets 'clk_pre' to 8000, which seems to hint that it's in picoseconds.
So, let's fix the dphy core driver to correctly reflect the T-CLK-PRE parameter's minimum value according to the D-PHY specification.
I'm assuming that all impacted custom drivers shall program values in TxByteClkHS cycles into hardware for the T-CLK-PRE parameter. The D-PHY specification mentions that the frequency of TxByteClkHS is exactly 1/8 the High-Speed(HS) bit rate(each HS bit consumes one UI). So, relevant custom driver code is changed to program those values as DIV_ROUND_UP(cfg->clk_pre, BITS_PER_BYTE), then.
Note that I've only tested the patch with RM67191 DSI panel on i.MX8mq EVK. Help is needed to test with other i.MX8mq, Meson and Rockchip platforms, as I don't have the hardwares.
--- drivers/gpu/drm/bridge/nwl-dsi.c | 12 +++++------- drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c | 3 ++- drivers/phy/phy-core-mipi-dphy.c | 4 ++-- drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c | 3 ++- 4 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/bridge/nwl-dsi.c +5 -7
@@ -7,6 +7,7 @@*/ #include <linux/bitfield.h> +#include <linux/bits.h> #include <linux/clk.h> #include <linux/irq.h> #include <linux/math64.h>
@@ -196,12 +197,9 @@ static u32 ps2bc(struct nwl_dsi *dsi, unsigned long long ps)/* * ui2bc - UI time periods to byte clock cycles */ -static u32 ui2bc (struct nwl_dsi *dsi,unsigned long long ui) +static u32 ui2bc (unsigned int ui) { -u32 bpp =mipi_dsi_pixel_format_to_bpp (dsi->format); - -return DIV64_U64_ROUND_UP (ui * dsi->lanes, - dsi->mode.clock *1000 * bpp); +return DIV_ROUND_UP (ui,BITS_PER_BYTE ); }/*
@@ -232,12 +230,12 @@ static int nwl_dsi_config_host(struct nwl_dsi *dsi) }/* values in byte clock cycles */ - cycles =ui2bc (dsi, cfg->clk_pre); + cycles =ui2bc (cfg->clk_pre);DRM_DEV_DEBUG_DRIVER (dsi->dev,"cfg_t_pre: 0x%x\n" , cycles);nwl_dsi_write (dsi,NWL_DSI_CFG_T_PRE , cycles); cycles =ps2bc (dsi, cfg->lpx + cfg->clk_prepare + cfg->clk_zero);DRM_DEV_DEBUG_DRIVER (dsi->dev,"cfg_tx_gap (pre): 0x%x\n" , cycles); - cycles +=ui2bc (dsi, cfg->clk_pre); + cycles +=ui2bc (cfg->clk_pre);DRM_DEV_DEBUG_DRIVER (dsi->dev,"cfg_t_post: 0x%x\n" , cycles);nwl_dsi_write (dsi,NWL_DSI_CFG_T_POST , cycles); cycles =ps2bc (dsi, cfg->hs_exit);
drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c +2 -1
@@ -9,6 +9,7 @@#include <linux/bitfield.h> #include <linux/bitops.h> +#include <linux/bits.h> #include <linux/clk.h> #include <linux/delay.h> #include <linux/io.h>
@@ -250,7 +251,7 @@ static int phy_meson_axg_mipi_dphy_power_on(struct phy *phy) (DIV_ROUND_UP (priv->config.clk_zero, temp) <<16 ) | (DIV_ROUND_UP(priv->config.clk_prepare, temp) << 24));regmap_write (priv->regmap,MIPI_DSI_CLK_TIM1 , -DIV_ROUND_UP (priv->config.clk_pre, temp)); +DIV_ROUND_UP (priv->config.clk_pre,BITS_PER_BYTE )); regmap_write(priv->regmap, MIPI_DSI_HS_TIM, DIV_ROUND_UP(priv->config.hs_exit, temp) |
drivers/phy/phy-core-mipi-dphy.c +2 -2
@@ -36,7 +36,7 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, cfg->clk_miss =0 ; cfg->clk_post =60000 +52 * ui; - cfg->clk_pre =8000 ; + cfg->clk_pre =8 ; cfg->clk_prepare =38000 ; cfg->clk_settle =95000 ; cfg->clk_term_en =0 ;
@@ -97,7 +97,7 @@ int phy_mipi_dphy_config_validate(struct phy_configure_opts_mipi_dphy *cfg)if (cfg->clk_post < (60000 +52 * ui))return -EINVAL ; -if (cfg->clk_pre <8000 ) +if (cfg->clk_pre <8 )return -EINVAL ;if (cfg->clk_prepare <38000 || cfg->clk_prepare >95000 )
drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c +2 -1
@@ -5,6 +5,7 @@* Author: Wyon Bi <[email protected]> */ +#include <linux/bits.h> #include <linux/kernel.h> #include <linux/clk.h> #include <linux/iopoll.h>
@@ -364,7 +365,7 @@ static void inno_dsidphy_mipi_mode_enable(struct inno_dsidphy *inno)* The value of counter for HS Tclk-pre * Tclk-pre = Tpin_txbyteclkhs * value */ - clk_pre =DIV_ROUND_UP (cfg->clk_pre, t_txbyteclkhs); + clk_pre =DIV_ROUND_UP (cfg->clk_pre,BITS_PER_BYTE );/* * The value of counter for HS Tlpx Time
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 109/203 gpio: aggregator: Fix calling into sleeping GPIO controllers
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 2cba05451a6d0c703bb74f1a250691404f27c4f1 ]
If the parent GPIO controller is a sleeping controller (e.g. a GPIO controller connected to I2C), getting or setting a GPIO triggers a might_sleep() warning. This happens because the GPIO Aggregator takes the can_sleep flag into account only for its internal locking, not for calling into the parent GPIO controller.
Fix this by using the gpiod_[gs]et*_cansleep() APIs when calling into a sleeping GPIO controller.
--- drivers/gpio/gpio-aggregator.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/gpio/gpio-aggregator.c +14 -4
@@ -278,7 +278,8 @@ static int gpio_fwd_get(struct gpio_chip *chip, unsigned int offset) {struct gpiochip_fwd *fwd =gpiochip_get_data (chip); -return gpiod_get_value (fwd->descs[offset]); +return chip->can_sleep ?gpiod_get_value_cansleep (fwd->descs[offset]) + :gpiod_get_value (fwd->descs[offset]); } static int gpio_fwd_get_multiple(struct gpiochip_fwd *fwd, unsigned long *mask,
@@ -293,7 +294,10 @@ static int gpio_fwd_get_multiple(struct gpiochip_fwd *fwd, unsigned long *mask,for_each_set_bit (i, mask, fwd->chip.ngpio) descs[j++] = fwd->descs[i]; - error =gpiod_get_array_value (j, descs,NULL , values); +if (fwd->chip.can_sleep) + error =gpiod_get_array_value_cansleep (j, descs,NULL , values); +else + error =gpiod_get_array_value (j, descs,NULL , values);if (error)return error;
@@ -328,7 +332,10 @@ static void gpio_fwd_set(struct gpio_chip *chip, unsigned int offset, int value) {struct gpiochip_fwd *fwd =gpiochip_get_data (chip); -gpiod_set_value (fwd->descs[offset], value); +if (chip->can_sleep) +gpiod_set_value_cansleep (fwd->descs[offset], value); +else +gpiod_set_value (fwd->descs[offset], value); } static void gpio_fwd_set_multiple(struct gpiochip_fwd *fwd, unsigned long *mask,
@@ -343,7 +350,10 @@ static void gpio_fwd_set_multiple(struct gpiochip_fwd *fwd, unsigned long *mask, descs[j++] = fwd->descs[i]; } -gpiod_set_array_value (j, descs,NULL , values); +if (fwd->chip.can_sleep) +gpiod_set_array_value_cansleep (j, descs,NULL , values); +else +gpiod_set_array_value (j, descs,NULL , values); } static void gpio_fwd_set_multiple_locked(struct gpio_chip *chip,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 110/203 NFS: Dont overfill uncached readdir pages
In reply to Greg Kroah-HartmanFrom: [email protected] <[email protected]>
[ Upstream commit d9c4e39c1f8f8a8ebaccf00b8f22c14364b2d27e ]
If we're doing an uncached read of the directory, then we ideally want to read only the exact set of entries that will fit in the buffer supplied by the getdents() system call. So unlike the case where we're reading into the page cache, let's send only one READDIR call, before trying to fill up the buffer.
--- fs/nfs/dir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/dir.c +2 -1
@@ -866,7 +866,8 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc, status =nfs_readdir_page_filler (desc, entry, pages, pglen, arrays, narrays); - }while (!status &&nfs_readdir_page_needs_filling (page)); + }while (!status &&nfs_readdir_page_needs_filling (page) && +page_mapping (page));nfs_readdir_free_pages (pages, array_size); out:
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 111/203 NFS: Dont skip directory entries when doing uncached readdir
In reply to Greg Kroah-HartmanFrom: [email protected] <[email protected]>
[ Upstream commit ce292d8faf41f62e0fb0c78476c6fce5d629235a ]
Ensure that we initialise desc->cache_entry_index correctly in uncached_readdir().
--- fs/nfs/dir.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/dir.c +1 -0
@@ -1041,6 +1041,7 @@ static int uncached_readdir(struct nfs_readdir_descriptor *desc) goto out; desc->page_index =0 ; + desc->cache_entry_index =0 ; desc->last_cookie = desc->dir_cookie; desc->duped =0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 112/203 NFS: Avoid duplicate uncached readdir calls on eof
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit e1d2699b96793d19388e302fa095e0da2c145701 ]
If we've reached the end of the directory, then cache that information in the context so that we don't need to do an uncached readdir in order to rediscover that fact.
--- fs/nfs/dir.c | 20 +++++++++++++++----- include/linux/nfs_fs.h | 1 + 2 files changed, 16 insertions(+), 5 deletions(-)
fs/nfs/dir.c +15 -5
@@ -79,6 +79,7 @@ static struct nfs_open_dir_context *alloc_nfs_open_dir_context(struct inode *dir ctx->dir_cookie =0 ; ctx->dup_cookie =0 ; ctx->page_index =0 ; + ctx->eof = false;spin_lock (&dir->i_lock);if (list_empty (&nfsi->open_files) && (nfsi->cache_validity &NFS_INO_DATA_INVAL_DEFER ))
@@ -167,6 +168,7 @@ struct nfs_readdir_descriptor {unsigned int cache_entry_index;signed char duped;bool plus; +bool eob;bool eof; };
@@ -988,7 +990,7 @@ static void nfs_do_filldir(struct nfs_readdir_descriptor *desc, ent = &array->array[i];if (!dir_emit (desc->ctx, ent->name, ent->name_len,nfs_compat_user_ino64 (ent->ino), ent->d_type)) { - desc->eof = true; + desc->eob = true;break ; }memcpy (desc->verf, verf,sizeof (desc->verf));
@@ -1004,7 +1006,7 @@ static void nfs_do_filldir(struct nfs_readdir_descriptor *desc, desc->duped =1 ; }if (array->page_is_eof) - desc->eof = true; + desc->eof = !desc->eob;kunmap (desc->page); dfprintk(DIRCACHE, "NFS: nfs_do_filldir() filling ended @ cookie %llu\n",
@@ -1047,7 +1049,7 @@ static int uncached_readdir(struct nfs_readdir_descriptor *desc) status =nfs_readdir_xdr_to_array (desc, desc->verf, verf, arrays, sz); -for (i =0 ; !desc->eof && i < sz && arrays[i]; i++) { +for (i =0 ; !desc->eob && i < sz && arrays[i]; i++) { desc->page = arrays[i];nfs_do_filldir (desc, verf); }
@@ -1106,9 +1108,15 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx) desc->duped = dir_ctx->duped; page_index = dir_ctx->page_index; desc->attr_gencount = dir_ctx->attr_gencount; + desc->eof = dir_ctx->eof;memcpy (desc->verf, dir_ctx->verf,sizeof (desc->verf));spin_unlock (&file->f_lock); +if (desc->eof) { + res =0 ; + goto out_free; + } +if (test_and_clear_bit (NFS_INO_FORCE_READDIR , &nfsi->flags) &&list_is_singular (&nfsi->open_files))invalidate_mapping_pages (inode->i_mapping, page_index +1 ,-1 );
@@ -1142,7 +1150,7 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)nfs_do_filldir (desc, nfsi->cookieverf);nfs_readdir_page_unlock_and_put_cached (desc); - }while (!desc->eof); + }while (!desc->eob && !desc->eof);spin_lock (&file->f_lock); dir_ctx->dir_cookie = desc->dir_cookie;
@@ -1150,9 +1158,10 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx) dir_ctx->duped = desc->duped; dir_ctx->attr_gencount = desc->attr_gencount; dir_ctx->page_index = desc->page_index; + dir_ctx->eof = desc->eof;memcpy (dir_ctx->verf, desc->verf,sizeof (dir_ctx->verf));spin_unlock (&file->f_lock); - +out_free:kfree (desc); out:
@@ -1194,6 +1203,7 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)if (offset ==0 )memset (dir_ctx->verf,0 ,sizeof (dir_ctx->verf)); dir_ctx->duped =0 ; + dir_ctx->eof = false; }spin_unlock (&filp->f_lock);return offset;
include/linux/nfs_fs.h +1 -0
@@ -105,6 +105,7 @@ struct nfs_open_dir_context {__u64 dup_cookie;pgoff_t page_index;signed char duped; +bool eof; };/*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 113/203 drm/vc4: hdmi: Allow DBLCLK modes even if horz timing is odd.
In reply to Greg Kroah-HartmanFrom: Dave Stevenson <[email protected]>
[ Upstream commit 1d118965965f89948236ebe23072bb1fca5e7832 ]
The 2711 pixel valve can't produce odd horizontal timings, and checks were added to vc4_hdmi_encoder_atomic_check and vc4_hdmi_encoder_mode_valid to filter out/block selection of such modes.
Modes with DRM_MODE_FLAG_DBLCLK double all the horizontal timing values before programming them into the PV. The PV values, therefore, can not be odd, and so the modes can be supported.
Amend the filtering appropriately.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/vc4/vc4_hdmi.c +2 -0
@@ -1090,6 +1090,7 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,unsigned long long tmds_rate;if (vc4_hdmi->variant->unsupported_odd_h_timings && + !(mode->flags &DRM_MODE_FLAG_DBLCLK ) && ((mode->hdisplay %2 ) || (mode->hsync_start %2 ) || (mode->hsync_end %2 ) || (mode->htotal %2 )))return -EINVAL ;
@@ -1137,6 +1138,7 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encoder,struct vc4_hdmi *vc4_hdmi =encoder_to_vc4_hdmi (encoder);if (vc4_hdmi->variant->unsupported_odd_h_timings && + !(mode->flags &DRM_MODE_FLAG_DBLCLK ) && ((mode->hdisplay %2 ) || (mode->hsync_start %2 ) || (mode->hsync_end %2 ) || (mode->htotal %2 )))return MODE_H_ILLEGAL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 114/203 misc: fastrpc: avoid double fput() on failed usercopy
In reply to Greg Kroah-HartmanFrom: Mathias Krause <[email protected]>
[ Upstream commit 46963e2e0629cb31c96b1d47ddd89dc3d8990b34 ]
If the copy back to userland fails for the FASTRPC_IOCTL_ALLOC_DMA_BUFF ioctl(), we shouldn't assume that 'buf->dmabuf' is still valid. In fact, dma_buf_fd() called fd_install() before, i.e. "consumed" one reference, leaving us with none.
Calling dma_buf_put() will therefore put a reference we no longer own, leading to a valid file descritor table entry for an already released 'file' object which is a straight use-after-free.
Simply avoid calling dma_buf_put() and rely on the process exit code to do the necessary cleanup, if needed, i.e. if the file descriptor is still valid.
--- drivers/misc/fastrpc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/misc/fastrpc.c +8 -1
@@ -1288,7 +1288,14 @@ static int fastrpc_dmabuf_alloc(struct fastrpc_user *fl, char __user *argp) }if (copy_to_user (argp, &bp,sizeof (bp))) { -dma_buf_put (buf->dmabuf); +/* +* The usercopy failed, but we can't do much about it, as +* dma_buf_fd() already called fd_install() and made the +* file descriptor accessible for the current process. It +* might already be closed and dmabuf no longer valid when +* we reach this point. Therefore "leak" the fd and rely on +* the process exit path to do any required cleanup. +*/ return -EFAULT ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 115/203 net: sparx5: Fix get_stat64 crash in tcpdump
In reply to Greg Kroah-HartmanFrom: Steen Hegelund <[email protected]>
[ Upstream commit ed14fc7a79ab43e9f2cb1fa9c1733fdc133bba30 ]
This problem was found with Sparx5 when the tcpdump tool requests the do_get_stats64 (sparx5_get_stats64) statistic.
The portstats pointer was incorrectly incremented when fetching priority based statistics.
--- drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c +1 -1
@@ -1103,7 +1103,7 @@ void sparx5_get_stats64(struct net_device *ndev, stats->tx_carrier_errors = portstats[spx5_stats_tx_csense_cnt]; stats->tx_window_errors = portstats[spx5_stats_tx_late_coll_cnt]; stats->rx_dropped = portstats[spx5_stats_ana_ac_port_stat_lsb_cnt]; -for (idx =0 ; idx <2 *SPX5_PRIOS ; ++idx, ++stats) +for (idx =0 ; idx <2 *SPX5_PRIOS ; ++idx) stats->rx_dropped += portstats[spx5_stats_green_p0_rx_port_drop + idx]; stats->tx_dropped = portstats[spx5_stats_tx_local_drop];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 116/203 netfilter: nft_payload: dont allow th access for fragments
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit a9e8503def0fd4ed89ade1f61c315f904581d439 ]
Loads relative to ->thoff naturally expect that this points to the transport header, but this is only true if pkt->fragoff == 0.
This has little effect for rulesets with connection tracking/nat because these enable ip defra. For other rulesets this prevents false matches.
--- net/netfilter/nft_exthdr.c | 2 +- net/netfilter/nft_payload.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-)
net/netfilter/nft_exthdr.c +1 -1
@@ -167,7 +167,7 @@ nft_tcp_header_pointer(const struct nft_pktinfo *pkt, {struct tcphdr *tcph; -if (pkt->tprot !=IPPROTO_TCP ) +if (pkt->tprot !=IPPROTO_TCP || pkt->fragoff)return NULL ; tcph =skb_header_pointer (pkt->skb,nft_thoff (pkt),sizeof (*tcph), buffer);
net/netfilter/nft_payload.c +5 -4
@@ -83,7 +83,7 @@ static int __nft_payload_inner_offset(struct nft_pktinfo *pkt) {unsigned int thoff =nft_thoff (pkt); -if (!(pkt->flags &NFT_PKTINFO_L4PROTO )) +if (!(pkt->flags &NFT_PKTINFO_L4PROTO ) || pkt->fragoff)return -1 ;switch (pkt->tprot) {
@@ -147,7 +147,7 @@ void nft_payload_eval(const struct nft_expr *expr, offset =skb_network_offset (skb);break ;case NFT_PAYLOAD_TRANSPORT_HEADER : -if (!(pkt->flags &NFT_PKTINFO_L4PROTO )) +if (!(pkt->flags &NFT_PKTINFO_L4PROTO ) || pkt->fragoff) goto err; offset =nft_thoff (pkt);break ;
@@ -657,7 +657,7 @@ static void nft_payload_set_eval(const struct nft_expr *expr, offset =skb_network_offset (skb);break ;case NFT_PAYLOAD_TRANSPORT_HEADER : -if (!(pkt->flags &NFT_PKTINFO_L4PROTO )) +if (!(pkt->flags &NFT_PKTINFO_L4PROTO ) || pkt->fragoff) goto err; offset =nft_thoff (pkt);break ;
@@ -696,7 +696,8 @@ static void nft_payload_set_eval(const struct nft_expr *expr,if (priv->csum_type ==NFT_PAYLOAD_CSUM_SCTP && pkt->tprot ==IPPROTO_SCTP && skb->ip_summed !=CHECKSUM_PARTIAL ) { -if (nft_payload_csum_sctp (skb,nft_thoff (pkt))) +if (pkt->fragoff ==0 && +nft_payload_csum_sctp (skb,nft_thoff (pkt))) goto err; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 117/203 netfilter: ctnetlink: disable helper autoassign
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit d1ca60efc53d665cf89ed847a14a510a81770b81 ]
When userspace, e.g. conntrackd, inserts an entry with a specified helper, its possible that the helper is lost immediately after its added:
ctnetlink_create_conntrack
-> nf_ct_helper_ext_add + assign helper
-> ctnetlink_setup_nat
-> ctnetlink_parse_nat_setup
-> parse_nat_setup -> nfnetlink_parse_nat_setup
-> nf_nat_setup_info
-> nf_conntrack_alter_reply
-> __nf_ct_try_assign_helper... and __nf_ct_try_assign_helper will zero the helper again.
Set IPS_HELPER bit to bypass auto-assign logic, its unwanted, just like when helper is assigned via ruleset.
Dropped old 'not strictly necessary' comment, it referred to use of rcu_assign_pointer() before it got replaced by RCU_INIT_POINTER().
NB: Fixes tag intentionally incorrect, this extends the referenced commit, but this change won't build without IPS_HELPER introduced there.
--- include/uapi/linux/netfilter/nf_conntrack_common.h | 2 +- net/netfilter/nf_conntrack_netlink.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
include/uapi/linux/netfilter/nf_conntrack_common.h +1 -1
@@ -106,7 +106,7 @@ enum ip_conntrack_status {IPS_NAT_CLASH =IPS_UNTRACKED , #endif -/* Conntrack got a helper explicitly attached via CT target. */ +/* Conntrack got a helper explicitly attached (ruleset, ctnetlink). */ IPS_HELPER_BIT =13 , IPS_HELPER = (1 << IPS_HELPER_BIT),
net/netfilter/nf_conntrack_netlink.c +2 -1
@@ -2311,7 +2311,8 @@ ctnetlink_create_conntrack(struct net *net,if (helper->from_nlattr) helper->from_nlattr (helpinfo, ct); -/* not in hash table yet so not strictly necessary */ +/* disable helper auto-assignment for this entry */ + ct->status |=IPS_HELPER ;RCU_INIT_POINTER (help->helper, helper); } }else {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 118/203 arm64: dts: meson-g12b-odroid-n2: fix typo dio2133
In reply to Greg Kroah-HartmanFrom: Dongjin Kim <[email protected]>
[ Upstream commit bc41099f060ea74ac8d02c51bd0f5f46d969bedf ]
Typo in audio amplifier node, dioo2133 -> dio2133
--- arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +2 -2
@@ -17,7 +17,7 @@ aliases { rtc1 = &vrtc; }; - dioo2133: audio-amplifier-0 { + dio2133: audio-amplifier-0 { compatible = "simple-audio-amplifier"; enable-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; VCC-supply = <&vcc_5v>;
@@ -219,7 +219,7 @@ sound { audio-widgets = "Line", "Lineout"; audio-aux-devs = <&tdmout_b>, <&tdmout_c>, <&tdmin_a>, <&tdmin_b>, <&tdmin_c>, <&tdmin_lb>, - <&dioo2133>; + <&dio2133>; audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", "TDMOUT_B IN 1", "FRDDR_B OUT 1", "TDMOUT_B IN 2", "FRDDR_C OUT 1",
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 119/203 arm64: dts: meson-sm1-odroid: use correct enable-gpio pin for tf-io regulator
In reply to Greg Kroah-HartmanFrom: Lutz Koschorreck <[email protected]>
[ Upstream commit 323ca765bfe9d637fa774373baec0bc41e51fcfa ]
The interrupt pin of the external ethernet phy is used, instead of the enable-gpio pin of the tf-io regulator. The GPIOE_2 pin is located in the gpio_ao bank.
This causes phy interrupt problems at system startup.
[ 76.645190] irq 36: nobody cared (try booting with the "irqpoll" option) [ 76.649617] CPU: 0 PID: 1416 Comm: irq/36-0.0:00 Not tainted 5.16.0 #2 [ 76.649629] Hardware name: Hardkernel ODROID-HC4 (DT) [ 76.649635] Call trace: [ 76.649638] dump_backtrace+0x0/0x1c8 [ 76.649658] show_stack+0x14/0x60 [ 76.649667] dump_stack_lvl+0x64/0x7c [ 76.649676] dump_stack+0x14/0x2c [ 76.649683] __report_bad_irq+0x38/0xe8 [ 76.649695] note_interrupt+0x220/0x3a0 [ 76.649704] handle_irq_event_percpu+0x58/0x88 [ 76.649713] handle_irq_event+0x44/0xd8 [ 76.649721] handle_fasteoi_irq+0xa8/0x130 [ 76.649730] generic_handle_domain_irq+0x38/0x58 [ 76.649738] gic_handle_irq+0x9c/0xb8 [ 76.649747] call_on_irq_stack+0x28/0x38 [ 76.649755] do_interrupt_handler+0x7c/0x80 [ 76.649763] el1_interrupt+0x34/0x80 [ 76.649772] el1h_64_irq_handler+0x14/0x20 [ 76.649781] el1h_64_irq+0x74/0x78 [ 76.649788] irq_finalize_oneshot.part.56+0x68/0xf8 [ 76.649796] irq_thread_fn+0x5c/0x98 [ 76.649804] irq_thread+0x13c/0x260 [ 76.649812] kthread+0x144/0x178 [ 76.649822] ret_from_fork+0x10/0x20 [ 76.649830] handlers: [ 76.653170] [<0000000025a6cd31>] irq_default_primary_handler threaded [<0000000093580eb7>] phy_interrupt [ 76.661256] Disabling IRQ #36
--- arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi +1 -1
@@ -48,7 +48,7 @@ tf_io: gpio-regulator-tf_io { regulator-max-microvolt = <3300000>; vin-supply = <&vcc_5v>; - enable-gpio = <&gpio GPIOE_2 GPIO_ACTIVE_HIGH>; + enable-gpio = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-always-on;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 120/203 arm64: dts: meson-sm1-bananapi-m5: fix wrong GPIO domain for GPIOE_2
In reply to Greg Kroah-HartmanFrom: Dongjin Kim <[email protected]>
[ Upstream commit a5be3e5d46f373fe1d2ee835c7ede31769c241cd ]
GPIOE_2 is in AO domain and "<&gpio GPIOE_2 ...>" changes the state of TF_PWR_EN of 'FC8731' on BPI-M5
--- arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts +1 -1
@@ -123,7 +123,7 @@ vddio_c: regulator-vddio_c { regulator-min-microvolt = <1800000>; regulator-max-microvolt = <3300000>; - enable-gpio = <&gpio GPIOE_2 GPIO_ACTIVE_HIGH>; + enable-gpio = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-always-on;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 121/203 arm64: dts: meson-sm1-odroid: fix boot loop after reboot
In reply to Greg Kroah-HartmanFrom: Lutz Koschorreck <[email protected]>
[ Upstream commit e6b03375132fefddc55cf700418cf794b3884e0c ]
Since the correct gpio pin is used for enabling tf-io regulator the system did not boot correctly after calling reboot.
[ 36.862443] reboot: Restarting system
bl31 reboot reason: 0xd
bl31 reboot reason: 0x0
system cmd 1. SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:B;RCY:0;SPINOR:0;CHK:1F;EMMC:800;NAND:81;SD?:0;SD:0;READ:0;0.0;CHK:0; bl2_stage_init 0x01bl2_stage_init 0x81
hw id:
SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:B;RCY:0;SPINOR:0;CHK:1F;EMMC:800;NAND:81;SD?:0;SD:400;USB:8;LOOP:1;...
Setting the gpio to open drain solves the issue.
--- arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi +1 -1
@@ -48,7 +48,7 @@ tf_io: gpio-regulator-tf_io { regulator-max-microvolt = <3300000>; vin-supply = <&vcc_5v>; - enable-gpio = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>; + enable-gpio = <&gpio_ao GPIOE_2 GPIO_OPEN_DRAIN>; enable-active-high; regulator-always-on;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 122/203 ixgbevf: Require large buffers for build_skb on 82599VF
In reply to Greg Kroah-HartmanFrom: Samuel Mendoza-Jonas <[email protected]>
[ Upstream commit fe68195daf34d5dddacd3f93dd3eafc4beca3a0e ]
Quoted 1 line
From 4.17 onwards the ixgbevf driver uses
build_skb()to build an skb
around new data in the page buffer shared with the ixgbe PF. This uses either a 2K or 3K buffer, and offsets the DMA mapping by NET_SKB_PAD + NET_IP_ALIGN. When using a smaller buffer RXDCTL is set to ensure the PF does not write a full 2K bytes into the buffer, which is actually 2K minus the offset.
However on the 82599 virtual function, the RXDCTL mechanism is not available. The driver attempts to work around this by using the SET_LPE mailbox method to lower the maximm frame size, but the ixgbe PF driver ignores this in order to keep the PF and all VFs in sync[0].
This means the PF will write up to the full 2K set in SRRCTL, causing it to write NET_SKB_PAD + NET_IP_ALIGN bytes past the end of the buffer. With 4K pages split into two buffers, this means it either writes NET_SKB_PAD + NET_IP_ALIGN bytes past the first buffer (and into the second), or NET_SKB_PAD + NET_IP_ALIGN bytes past the end of the DMA mapping.
Avoid this by only enabling build_skb when using "large" buffers (3K). These are placed in each half of an order-1 page, preventing the PF from writing past the end of the mapping.
[0]: Technically it only ever raises the max frame size, see ixgbe_set_vf_lpe() in ixgbe_sriov.c
--- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +7 -6
@@ -1984,14 +1984,15 @@ static void ixgbevf_set_rx_buffer_len(struct ixgbevf_adapter *adapter,if (adapter->flags &IXGBEVF_FLAGS_LEGACY_RX )return ; -set_ring_build_skb_enabled (rx_ring); +if (PAGE_SIZE <8192 ) +if (max_frame >IXGBEVF_MAX_FRAME_BUILD_SKB ) +set_ring_uses_large_buffer (rx_ring); -if (PAGE_SIZE <8192 ) { -if (max_frame <=IXGBEVF_MAX_FRAME_BUILD_SKB ) -return ; +/* 82599 can't rely on RXDCTL.RLPML to restrict the size of the frame */ +if (adapter->hw.mac.type == ixgbe_mac_82599_vf && !ring_uses_large_buffer (rx_ring)) +return ; -set_ring_uses_large_buffer (rx_ring); - } +set_ring_build_skb_enabled (rx_ring); }/**
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 123/203 tcp: take care of mixed splice()/sendmsg(MSG_ZEROCOPY) case
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit f8d9d938514f46c4892aff6bfe32f425e84d81cc ]
syzbot found that mixing sendpage() and sendmsg(MSG_ZEROCOPY) calls over the same TCP socket would again trigger the infamous warning in inet_sock_destruct()
WARN_ON(sk_forward_alloc_get(sk));
While Talal took into account a mix of regular copied data and MSG_ZEROCOPY one in the same skb, the sendpage() path has been forgotten.
We want the charging to happen for sendpage(), because pages could be coming from a pipe. What is missing is the downgrading of pure zerocopy status to make sure sk_forward_alloc will stay synced.
Add tcp_downgrade_zcopy_pure() helper so that we can use it from the two callers.
--- net/ipv4/tcp.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)
net/ipv4/tcp.c +19 -14
@@ -936,6 +936,22 @@ void tcp_remove_empty_skb(struct sock *sk) } } +/* skb changing from pure zc to mixed, must charge zc */ +static int tcp_downgrade_zcopy_pure (struct sock *sk,struct sk_buff *skb) +{ +if (unlikely (skb_zcopy_pure (skb))) { +u32 extra = skb->truesize - +SKB_TRUESIZE (skb_end_offset (skb)); + +if (!sk_wmem_schedule (sk, extra)) +return -ENOMEM ; + +sk_mem_charge (sk, extra); +skb_shinfo (skb)->flags &= ~SKBFL_PURE_ZEROCOPY ; + } +return 0 ; +} +static struct sk_buff *tcp_build_frag (struct sock *sk,int size_goal,int flags,struct page *page,int offset,size_t *size) {
@@ -971,7 +987,7 @@ static struct sk_buff *tcp_build_frag(struct sock *sk, int size_goal, int flags,tcp_mark_push (tp, skb); goto new_segment; } -if (!sk_wmem_schedule (sk, copy)) +if (tcp_downgrade_zcopy_pure (sk, skb) || !sk_wmem_schedule (sk, copy))return NULL ;if (can_coalesce) {
@@ -1319,19 +1335,8 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) copy =min_t (int, copy, pfrag->size - pfrag->offset); -/* skb changing from pure zc to mixed, must charge zc */ -if (unlikely (skb_zcopy_pure (skb))) { -u32 extra = skb->truesize - -SKB_TRUESIZE (skb_end_offset (skb)); - -if (!sk_wmem_schedule (sk, extra)) - goto wait_for_space; - -sk_mem_charge (sk, extra); -skb_shinfo (skb)->flags &= ~SKBFL_PURE_ZEROCOPY ; - } - -if (!sk_wmem_schedule (sk, copy)) +if (tcp_downgrade_zcopy_pure (sk, skb) || + !sk_wmem_schedule (sk, copy)) goto wait_for_space; err = skb_copy_to_page_nocache(sk, &msg->msg_iter, skb,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 124/203 net: mscc: ocelot: fix all IP traffic getting trapped to CPU with PTP over IP
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 59085208e4a2183998964844f8684fea0378128d ]
The filters for the PTP trap keys are incorrectly configured, in the sense that is2_entry_set() only looks at trap->key.ipv4.dport or trap->key.ipv6.dport if trap->key.ipv4.proto or trap->key.ipv6.proto is set to IPPROTO_TCP or IPPROTO_UDP.
But we don't do that, so is2_entry_set() goes through the "else" branch of the IP protocol check, and ends up installing a rule for "Any IP protocol match" (because msk is also 0). The UDP port is ignored.
This means that when we run "ptp4l -i swp0 -4", all IP traffic is trapped to the CPU, which hinders bridging.
Fix this by specifying the IP protocol in the VCAP IS2 filters for PTP over UDP.
--- drivers/net/ethernet/mscc/ocelot.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/mscc/ocelot.c +8 -0
@@ -1292,6 +1292,8 @@ static void ocelot_populate_ipv4_ptp_event_trap_key(struct ocelot_vcap_filter *trap) { trap->key_type =OCELOT_VCAP_KEY_IPV4 ; + trap->key.ipv4.proto.value[0 ] =IPPROTO_UDP ; + trap->key.ipv4.proto.mask[0 ] =0xff ; trap->key.ipv4.dport.value =PTP_EV_PORT ; trap->key.ipv4.dport.mask =0xffff ; }
@@ -1300,6 +1302,8 @@ static void ocelot_populate_ipv6_ptp_event_trap_key(struct ocelot_vcap_filter *trap) { trap->key_type =OCELOT_VCAP_KEY_IPV6 ; + trap->key.ipv4.proto.value[0 ] =IPPROTO_UDP ; + trap->key.ipv4.proto.mask[0 ] =0xff ; trap->key.ipv6.dport.value =PTP_EV_PORT ; trap->key.ipv6.dport.mask =0xffff ; }
@@ -1308,6 +1312,8 @@ static void ocelot_populate_ipv4_ptp_general_trap_key(struct ocelot_vcap_filter *trap) { trap->key_type =OCELOT_VCAP_KEY_IPV4 ; + trap->key.ipv4.proto.value[0 ] =IPPROTO_UDP ; + trap->key.ipv4.proto.mask[0 ] =0xff ; trap->key.ipv4.dport.value =PTP_GEN_PORT ; trap->key.ipv4.dport.mask =0xffff ; }
@@ -1316,6 +1322,8 @@ static void ocelot_populate_ipv6_ptp_general_trap_key(struct ocelot_vcap_filter *trap) { trap->key_type =OCELOT_VCAP_KEY_IPV6 ; + trap->key.ipv4.proto.value[0 ] =IPPROTO_UDP ; + trap->key.ipv4.proto.mask[0 ] =0xff ; trap->key.ipv6.dport.value =PTP_GEN_PORT ; trap->key.ipv6.dport.mask =0xffff ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 125/203 drm/panel: simple: Assign data from panel_dpi_probe() correctly
In reply to Greg Kroah-HartmanFrom: Christoph Niedermaier <[email protected]>
[ Upstream commit 6df4432a5eca101b5fd80fbee41d309f3d67928d ]
In the function panel_simple_probe() the pointer panel->desc is assigned to the passed pointer desc. If function panel_dpi_probe() is called panel->desc will be updated, but further on only desc will be evaluated. So update the desc pointer to be able to use the data from the function panel_dpi_probe().
--- drivers/gpu/drm/panel/panel-simple.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/panel/panel-simple.c +1 -0
@@ -588,6 +588,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) err =panel_dpi_probe (dev, panel);if (err) goto free_ddc; + desc = panel->desc; }else {if (!of_get_display_timing (dev->of_node,"panel-timing" , &dt))panel_simple_parse_panel_timing_node (dev, panel, &dt);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 126/203 s390/module: fix building test_modules_helpers.o with clang
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit e286f231eab410793f3e91c924e6dbd23edee05a ]
Move test_modules_return_* prototypes into a header file in order to placate -Wmissing-prototypes.
--- arch/s390/lib/test_modules.c | 3 --- arch/s390/lib/test_modules.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
arch/s390/lib/test_modules.c +0 -3
@@ -5,9 +5,6 @@#include "test_modules.h" -#define DECLARE_RETURN (i) int test_modules_return_ ## i(void) -REPEAT_10000 (DECLARE_RETURN ); -/* * Test that modules with many relocations are loaded properly. */
arch/s390/lib/test_modules.h +3 -0
@@ -47,4 +47,7 @@__REPEAT_10000_1 (f,8 ); \ __REPEAT_10000_1(f, 9) +#define DECLARE_RETURN (i) int test_modules_return_ ## i(void) +REPEAT_10000 (DECLARE_RETURN ); +#endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 127/203 ACPI: PM: s2idle: Cancel wakeup before dispatching EC GPE
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit dc0075ba7f387fe4c48a8c674b11ab6f374a6acc ]
Commit 4a9af6cac050 ("ACPI: EC: Rework flushing of EC work while suspended to idle") made acpi_ec_dispatch_gpe() check pm_wakeup_pending(), but that is before canceling the SCI wakeup, so pm_wakeup_pending() is always true. This causes the loop in acpi_ec_dispatch_gpe() to always terminate after one iteration which may not be correct.
Address this issue by canceling the SCI wakeup earlier, from acpi_ec_dispatch_gpe() itself.
--- drivers/acpi/ec.c | 10 ++++++++++ drivers/acpi/sleep.c | 14 ++++---------- 2 files changed, 14 insertions(+), 10 deletions(-)
drivers/acpi/ec.c +10 -0
@@ -2051,6 +2051,16 @@ bool acpi_ec_dispatch_gpe(void)if (acpi_any_gpe_status_set (first_ec->gpe))return true; +/* +* Cancel the SCI wakeup and process all pending events in case there +* are any wakeup ones in there. +* +* Note that if any non-EC GPEs are active at this point, the SCI will +* retrigger after the rearming in acpi_s2idle_wake(), so no events +* should be missed by canceling the wakeup here. +*/ +pm_system_cancel_wakeup (); +/* * Dispatch the EC GPE in-band, but do not report wakeup in any case * to allow the caller to process events properly after that.
drivers/acpi/sleep.c +4 -10
@@ -739,21 +739,15 @@ bool acpi_s2idle_wake(void)return true; } -/* Check non-EC GPE wakeups and dispatch the EC GPE. */ +/* +* Check non-EC GPE wakeups and if there are none, cancel the +* SCI-related wakeup and dispatch the EC GPE. +*/ if (acpi_ec_dispatch_gpe ()) {pm_pr_dbg ("ACPI non-EC GPE wakeup\n" );return true; } -/* -* Cancel the SCI wakeup and process all pending events in case -* there are any wakeup ones in there. -* -* Note that if any non-EC GPEs are active at this point, the -* SCI will retrigger after the rearming below, so no events -* should be missed by canceling the wakeup here. -*/ -pm_system_cancel_wakeup ();acpi_os_wait_events_complete ();/*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 128/203 gpiolib: Never return internal error codes to user space
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 95a4eed7dd5b7c1c3664a626174290686ddbee9f ]
Currently it's possible that character device interface may return the error codes which are not supposed to be seen by user space. In this case it's EPROBE_DEFER.
Wrap it to return -ENODEV instead as sysfs does.
--- drivers/gpio/gpiolib-cdev.c | 6 +++--- drivers/gpio/gpiolib-sysfs.c | 7 ++----- drivers/gpio/gpiolib.h | 12 ++++++++++++ 3 files changed, 17 insertions(+), 8 deletions(-)
drivers/gpio/gpiolib-cdev.c +3 -3
@@ -330,7 +330,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip) goto out_free_lh; } - ret =gpiod_request (desc, lh->label); + ret =gpiod_request_user (desc, lh->label);if (ret) goto out_free_lh; lh->descs[i] = desc;
@@ -1378,7 +1378,7 @@ static int linereq_create(struct gpio_device *gdev, void __user *ip) goto out_free_linereq; } - ret =gpiod_request (desc, lr->label); + ret =gpiod_request_user (desc, lr->label);if (ret) goto out_free_linereq;
@@ -1764,7 +1764,7 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip) } } - ret =gpiod_request (desc, le->label); + ret =gpiod_request_user (desc, le->label);if (ret) goto out_free_le; le->desc = desc;
drivers/gpio/gpiolib-sysfs.c +2 -5
@@ -475,12 +475,9 @@ static ssize_t export_store(struct class *class,* they may be undone on its behalf too. */ - status =gpiod_request (desc,"sysfs" ); -if (status) { -if (status == -EPROBE_DEFER ) - status = -ENODEV ; + status =gpiod_request_user (desc,"sysfs" ); +if (status) goto done; - } status =gpiod_set_transitory (desc, false);if (!status) {
drivers/gpio/gpiolib.h +12 -0
@@ -135,6 +135,18 @@ struct gpio_desc {int gpiod_request (struct gpio_desc *desc,const char *label);void gpiod_free (struct gpio_desc *desc); + +static inline int gpiod_request_user (struct gpio_desc *desc,const char *label) +{ +int ret; + + ret =gpiod_request (desc, label); +if (ret == -EPROBE_DEFER ) + ret = -ENODEV ; + +return ret; +} +int gpiod_configure_flags (struct gpio_desc *desc,const char *con_id,unsigned long lflags,enum gpiod_flags dflags);int gpio_set_debounce_timeout (struct gpio_desc *desc,unsigned int debounce);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 129/203 gpio: sifive: use the correct register to read output values
In reply to Greg Kroah-HartmanFrom: Niklas Cassel <[email protected]>
[ Upstream commit cc38ef936840ac29204d806deb4d1836ec509594 ]
Setting the output of a GPIO to 1 using gpiod_set_value(), followed by reading the same GPIO using gpiod_get_value(), will currently yield an incorrect result.
This is because the SiFive GPIO device stores the output values in reg_set, not reg_dat.
Supply the flag BGPIOF_READ_OUTPUT_REG_SET to bgpio_init() so that the generic driver reads the correct register.
--- drivers/gpio/gpio-sifive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-sifive.c +1 -1
@@ -223,7 +223,7 @@ static int sifive_gpio_probe(struct platform_device *pdev)NULL , chip->base +SIFIVE_GPIO_OUTPUT_EN , chip->base +SIFIVE_GPIO_INPUT_EN , - 0); + BGPIOF_READ_OUTPUT_REG_SET);if (ret) {dev_err (dev,"unable to init generic GPIO\n" );return ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 130/203 fbcon: Avoid cap set but not used warning
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
[ Upstream commit 50b10528aad568c95f772039d4b3093b4aea7439 ]
Fix this kernel test robot warning:
drivers/video/fbdev/core/fbcon.c: In function 'fbcon_init':
drivers/video/fbdev/core/fbcon.c:1028:6: warning: variable 'cap' set but not used [-Wunused-but-set-variable]
The cap variable is only used when CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is enabled. Drop the temporary variable and use info->flags instead.
--- drivers/video/fbdev/core/fbcon.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/video/fbdev/core/fbcon.c +3 -4
@@ -1025,7 +1025,7 @@ static void fbcon_init(struct vc_data *vc, int init)struct vc_data *svc = *default_mode;struct fbcon_display *t, *p = &fb_display[vc->vc_num];int logo =1 , new_rows, new_cols, rows, cols; -int cap, ret; +int ret;if (WARN_ON (info_idx ==-1 ))return ;
@@ -1034,7 +1034,6 @@ static void fbcon_init(struct vc_data *vc, int init) con2fb_map[vc->vc_num] = info_idx; info = registered_fb[con2fb_map[vc->vc_num]]; - cap = info->flags;if (logo_shown <0 && console_loglevel <=CONSOLE_LOGLEVEL_QUIET ) logo_shown =FBCON_LOGO_DONTSHOW ;
@@ -1137,8 +1136,8 @@ static void fbcon_init(struct vc_data *vc, int init) ops->graphics =0 ;#ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION -if ((cap &FBINFO_HWACCEL_COPYAREA ) && - !(cap &FBINFO_HWACCEL_DISABLED )) +if ((info->flags &FBINFO_HWACCEL_COPYAREA ) && + !(info->flags &FBINFO_HWACCEL_DISABLED )) p->scrollmode =SCROLL_MOVE ;else /* default to something safe */ p->scrollmode =SCROLL_REDRAW ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 131/203 SUNRPC: lock against ->sock changing during sysfs read
In reply to Greg Kroah-HartmanFrom: NeilBrown <[email protected]>
[ Upstream commit b49ea673e119f59c71645e2f65b3ccad857c90ee ]
->sock can be set to NULL asynchronously unless ->recv_mutex is held. So it is important to hold that mutex. Otherwise a sysfs read can trigger an oops.
Commit 17f09d3f619a ("SUNRPC: Check if the xprt is connected before handling sysfs reads") appears to attempt to fix this problem, but it only narrows the race window.
--- net/sunrpc/sysfs.c | 5 ++++- net/sunrpc/xprtsock.c | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-)
net/sunrpc/sysfs.c +4 -1
@@ -115,11 +115,14 @@ static ssize_t rpc_sysfs_xprt_srcaddr_show(struct kobject *kobj, } sock = container_of(xprt, struct sock_xprt, xprt); -if (kernel_getsockname (sock->sock, (struct sockaddr *)&saddr) <0 ) +mutex_lock (&sock->recv_mutex); +if (sock->sock ==NULL || +kernel_getsockname (sock->sock, (struct sockaddr *)&saddr) <0 ) goto out; ret =sprintf (buf,"%pISc\n" , &saddr); out: +mutex_unlock (&sock->recv_mutex);xprt_put (xprt);return ret +1 ; }
net/sunrpc/xprtsock.c +6 -1
@@ -1641,7 +1641,12 @@ static int xs_get_srcport(struct sock_xprt *transport)unsigned short get_srcport (struct rpc_xprt *xprt) { struct sock_xprt *sock = container_of(xprt, struct sock_xprt, xprt); -return xs_sock_getport (sock->sock); +unsigned short ret =0 ; +mutex_lock (&sock->recv_mutex); +if (sock->sock) + ret =xs_sock_getport (sock->sock); +mutex_unlock (&sock->recv_mutex); +return ret; }EXPORT_SYMBOL (get_srcport);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 132/203 gve: Recording rx queue before sending to napi
In reply to Greg Kroah-HartmanFrom: Tao Liu <[email protected]>
[ Upstream commit 084cbb2ec3af2d23be9de65fcc9493e21e265859 ]
This caused a significant performance degredation when using generic XDP with multiple queues.
--- drivers/net/ethernet/google/gve/gve_rx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/google/gve/gve_rx.c +1 -0
@@ -609,6 +609,7 @@ static bool gve_rx(struct gve_rx_ring *rx, netdev_features_t feat, *packet_size_bytes = skb->len + (skb->protocol ?ETH_HLEN :0 ); *work_done = work_cnt; +skb_record_rx_queue (skb, rx->q_num);if (skb_is_nonlinear (skb))napi_gro_frags (napi);else
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 133/203 bonding: pair enable_port with slave_arr_updates
In reply to Greg Kroah-HartmanFrom: Mahesh Bandewar <[email protected]>
[ Upstream commit 23de0d7b6f0e3f9a6283a882594c479949da1120 ]
When 803.2ad mode enables a participating port, it should update the slave-array. I have observed that the member links are participating and are part of the active aggregator while the traffic is egressing via only one member link (in a case where two links are participating). Via kprobes I discovered that slave-arr has only one link added while the other participating link wasn't part of the slave-arr.
I couldn't see what caused that situation but the simple code-walk through provided me hints that the enable_port wasn't always associated with the slave-array update.
--- drivers/net/bonding/bond_3ad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/bonding/bond_3ad.c +2 -1
@@ -1021,8 +1021,8 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)if (port->aggregator && port->aggregator->is_active && !__port_is_enabled (port)) { -__enable_port (port); + *update_slave_arr = true; } }break ;
@@ -1779,6 +1779,7 @@ static void ad_agg_selection_logic(struct aggregator *agg, port = port->next_port_in_aggregator) {__enable_port (port); } + *update_slave_arr = true; } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 134/203 net: dsa: mv88e6xxx: dont use devres for mdiobus
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit f53a2ce893b2c7884ef94471f170839170a4eba0 ]
As explained in commits:74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") 5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres")
mdiobus_free() will panic when called from devm_mdiobus_free() <- devres_release_all() <- __device_release_driver(), and that mdiobus was not previously unregistered.
The mv88e6xxx is an MDIO device, so the initial set of constraints that I thought would cause this (I2C or SPI buses which call ->remove on ->shutdown) do not apply. But there is one more which applies here.
If the DSA master itself is on a bus that calls ->remove from ->shutdown (like dpaa2-eth, which is on the fsl-mc bus), there is a device link between the switch and the DSA master, and device_links_unbind_consumers() will unbind the Marvell switch driver on shutdown.
systemd-shutdown[1]: Powering off.
mv88e6085 0x0000000008b96000:00 sw_gl0: Link is Down fsl-mc dpbp.9: Removing from iommu group 7 fsl-mc dpbp.8: Removing from iommu group 7
------------[ cut here ]------------ kernel BUG at drivers/net/phy/mdio_bus.c:677! Internal error: Oops - BUG: 0 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 5.16.5-00040-gdc05f73788e5 #15 pc : mdiobus_free+0x44/0x50 lr : devm_mdiobus_free+0x10/0x20 Call trace: mdiobus_free+0x44/0x50 devm_mdiobus_free+0x10/0x20 devres_release_all+0xa0/0x100 __device_release_driver+0x190/0x220 device_release_driver_internal+0xac/0xb0 device_links_unbind_consumers+0xd4/0x100 __device_release_driver+0x4c/0x220 device_release_driver_internal+0xac/0xb0 device_links_unbind_consumers+0xd4/0x100 __device_release_driver+0x94/0x220 device_release_driver+0x28/0x40 bus_remove_device+0x118/0x124 device_del+0x174/0x420 fsl_mc_device_remove+0x24/0x40 __fsl_mc_device_remove+0xc/0x20 device_for_each_child+0x58/0xa0 dprc_remove+0x90/0xb0 fsl_mc_driver_remove+0x20/0x5c __device_release_driver+0x21c/0x220 device_release_driver+0x28/0x40 bus_remove_device+0x118/0x124 device_del+0x174/0x420 fsl_mc_bus_remove+0x80/0x100 fsl_mc_bus_shutdown+0xc/0x1c platform_shutdown+0x20/0x30 device_shutdown+0x154/0x330 kernel_power_off+0x34/0x6c __do_sys_reboot+0x15c/0x250 __arm64_sys_reboot+0x20/0x30 invoke_syscall.constprop.0+0x4c/0xe0 do_el0_svc+0x4c/0x150 el0_svc+0x24/0xb0 el0t_64_sync_handler+0xa8/0xb0 el0t_64_sync+0x178/0x17c
So the same treatment must be applied to all DSA switch drivers, which
is: either use devres for both the mdiobus allocation and registration, or don't use devres at all.
The Marvell driver already has a good structure for mdiobus removal, so just plug in mdiobus_free and get rid of devres.
--- drivers/net/dsa/mv88e6xxx/chip.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +8 -3
@@ -3415,7 +3415,7 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,return err; } - bus =devm_mdiobus_alloc_size (chip->dev,sizeof (*mdio_bus)); + bus =mdiobus_alloc_size (sizeof (*mdio_bus));if (!bus)return -ENOMEM ;
@@ -3440,14 +3440,14 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,if (!external) { err =mv88e6xxx_g2_irq_mdio_setup (chip, bus);if (err) -return err; + goto out; } err =of_mdiobus_register (bus, np);if (err) {dev_err (chip->dev,"Cannot register MDIO bus (%d)\n" , err);mv88e6xxx_g2_irq_mdio_free (chip, bus); -return err; + goto out; }if (external)
@@ -3456,6 +3456,10 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,list_add (&mdio_bus->list, &chip->mdios);return 0 ; + +out: +mdiobus_free (bus); +return err; }static void mv88e6xxx_mdios_unregister (struct mv88e6xxx_chip *chip)
@@ -3471,6 +3475,7 @@ static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip)mv88e6xxx_g2_irq_mdio_free (chip, bus);mdiobus_unregister (bus); +mdiobus_free (bus); } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 135/203 net: dsa: ar9331: register the mdiobus under devres
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 50facd86e9fbc4b93fe02e5fe05776047f45dbfb ]
As explained in commits:74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") 5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres")
mdiobus_free() will panic when called from devm_mdiobus_free() <- devres_release_all() <- __device_release_driver(), and that mdiobus was not previously unregistered.
The ar9331 is an MDIO device, so the initial set of constraints that I thought would cause this (I2C or SPI buses which call ->remove on ->shutdown) do not apply. But there is one more which applies here.
If the DSA master itself is on a bus that calls ->remove from ->shutdown (like dpaa2-eth, which is on the fsl-mc bus), there is a device link between the switch and the DSA master, and device_links_unbind_consumers() will unbind the ar9331 switch driver on shutdown.
So the same treatment must be applied to all DSA switch drivers, which
is: either use devres for both the mdiobus allocation and registration, or don't use devres at all.
The ar9331 driver doesn't have a complex code structure for mdiobus removal, so just replace of_mdiobus_register with the devres variant in order to be all-devres and ensure that we don't free a still-registered bus.
--- drivers/net/dsa/qca/ar9331.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/dsa/qca/ar9331.c +1 -2
@@ -378,7 +378,7 @@ static int ar9331_sw_mbus_init(struct ar9331_sw_priv *priv)if (!mnp)return -ENODEV ; - ret =of_mdiobus_register (mbus, mnp); + ret =devm_of_mdiobus_register (dev, mbus, mnp);of_node_put (mnp);if (ret)return ret;
@@ -1091,7 +1091,6 @@ static void ar9331_sw_remove(struct mdio_device *mdiodev) }irq_domain_remove (priv->irqdomain); -mdiobus_unregister (priv->mbus);dsa_unregister_switch (&priv->ds);reset_control_assert (priv->sw_reset);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 136/203 net: dsa: bcm_sf2: dont use devres for mdiobus
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 08f1a20822349004bb9cc1b153ecb516e9f2889d ]
As explained in commits:74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") 5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres")
mdiobus_free() will panic when called from devm_mdiobus_free() <- devres_release_all() <- __device_release_driver(), and that mdiobus was not previously unregistered.
The Starfighter 2 is a platform device, so the initial set of constraints that I thought would cause this (I2C or SPI buses which call ->remove on ->shutdown) do not apply. But there is one more which applies here.
If the DSA master itself is on a bus that calls ->remove from ->shutdown (like dpaa2-eth, which is on the fsl-mc bus), there is a device link between the switch and the DSA master, and device_links_unbind_consumers() will unbind the bcm_sf2 switch driver on shutdown.
So the same treatment must be applied to all DSA switch drivers, which
is: either use devres for both the mdiobus allocation and registration, or don't use devres at all.
The bcm_sf2 driver has the code structure in place for orderly mdiobus removal, so just replace devm_mdiobus_alloc() with the non-devres variant, and add manual free where necessary, to ensure that we don't let devres free a still-registered bus.
--- drivers/net/dsa/bcm_sf2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/dsa/bcm_sf2.c +5 -2
@@ -584,7 +584,7 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds)get_device (&priv->master_mii_bus->dev); priv->master_mii_dn = dn; - priv->slave_mii_bus =devm_mdiobus_alloc (ds->dev); + priv->slave_mii_bus =mdiobus_alloc ();if (!priv->slave_mii_bus) {of_node_put (dn);return -ENOMEM ;
@@ -644,8 +644,10 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) } err =mdiobus_register (priv->slave_mii_bus); -if (err && dn) +if (err && dn) { +mdiobus_free (priv->slave_mii_bus);of_node_put (dn); + }return err; }
@@ -653,6 +655,7 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds)static void bcm_sf2_mdio_unregister (struct bcm_sf2_priv *priv) {mdiobus_unregister (priv->slave_mii_bus); +mdiobus_free (priv->slave_mii_bus);of_node_put (priv->master_mii_dn); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 137/203 net: dsa: felix: dont use devres for mdiobus
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 209bdb7ec6a28c7cdf580a0a98afbc9fc3b98932 ]
As explained in commits:74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") 5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres")
mdiobus_free() will panic when called from devm_mdiobus_free() <- devres_release_all() <- __device_release_driver(), and that mdiobus was not previously unregistered.
The Felix VSC9959 switch is a PCI device, so the initial set of constraints that I thought would cause this (I2C or SPI buses which call ->remove on ->shutdown) do not apply. But there is one more which applies here.
If the DSA master itself is on a bus that calls ->remove from ->shutdown (like dpaa2-eth, which is on the fsl-mc bus), there is a device link between the switch and the DSA master, and device_links_unbind_consumers() will unbind the felix switch driver on shutdown.
So the same treatment must be applied to all DSA switch drivers, which
is: either use devres for both the mdiobus allocation and registration, or don't use devres at all.
The felix driver has the code structure in place for orderly mdiobus removal, so just replace devm_mdiobus_alloc_size() with the non-devres variant, and add manual free where necessary, to ensure that we don't let devres free a still-registered bus.
--- drivers/net/dsa/ocelot/felix_vsc9959.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/dsa/ocelot/felix_vsc9959.c +3 -1
@@ -1064,7 +1064,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)return PTR_ERR (hw); } - bus =devm_mdiobus_alloc_size (dev,sizeof (*mdio_priv)); + bus =mdiobus_alloc_size (sizeof (*mdio_priv));if (!bus)return -ENOMEM ;
@@ -1084,6 +1084,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) rc =mdiobus_register (bus);if (rc <0 ) {dev_err (dev,"failed to register MDIO bus\n" ); +mdiobus_free (bus);return rc; }
@@ -1133,6 +1134,7 @@ static void vsc9959_mdio_bus_free(struct ocelot *ocelot)lynx_pcs_destroy (pcs); }mdiobus_unregister (felix->imdio); +mdiobus_free (felix->imdio); } static void vsc9959_sched_speed_set(struct ocelot *ocelot, int port,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 138/203 net: dsa: ocelot: seville: utilize of_mdiobus_register
In reply to Greg Kroah-HartmanFrom: Colin Foster <[email protected]>
[ Upstream commit 5186c4a05b9713138b762a49467a8ab9753cdb36 ]
Switch seville to use of_mdiobus_register(bus, NULL) instead of just mdiobus_register. This code is about to be pulled into a separate module that can optionally define ports by the device_node.
--- drivers/net/dsa/ocelot/seville_vsc9953.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/dsa/ocelot/seville_vsc9953.c +2 -1
@@ -10,6 +10,7 @@#include <linux/pcs-lynx.h> #include <linux/dsa/ocelot.h> #include <linux/iopoll.h> +#include <linux/of_mdio.h> #include "felix.h" #define MSCC_MIIM_CMD_OPR_WRITE BIT(1)
@@ -1108,7 +1109,7 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot)snprintf (bus->id,MII_BUS_ID_SIZE ,"%s-imdio" ,dev_name (dev));/* Needed in order to initialize the bus mutex lock */ - rc =mdiobus_register (bus); + rc =of_mdiobus_register (bus,NULL );if (rc <0 ) {dev_err (dev,"failed to register MDIO bus\n" );return rc;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 139/203 net: dsa: seville: register the mdiobus under devres
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit bd488afc3b39e045ba71aab472233f2a78726e7b ]
As explained in commits:74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") 5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres")
mdiobus_free() will panic when called from devm_mdiobus_free() <- devres_release_all() <- __device_release_driver(), and that mdiobus was not previously unregistered.
The Seville VSC9959 switch is a platform device, so the initial set of constraints that I thought would cause this (I2C or SPI buses which call ->remove on ->shutdown) do not apply. But there is one more which applies here.
If the DSA master itself is on a bus that calls ->remove from ->shutdown (like dpaa2-eth, which is on the fsl-mc bus), there is a device link between the switch and the DSA master, and device_links_unbind_consumers() will unbind the seville switch driver on shutdown.
So the same treatment must be applied to all DSA switch drivers, which
is: either use devres for both the mdiobus allocation and registration, or don't use devres at all.
The seville driver has a code structure that could accommodate both the mdiobus_unregister and mdiobus_free calls, but it has an external dependency upon mscc_miim_setup() from mdio-mscc-miim.c, which calls devm_mdiobus_alloc_size() on its behalf. So rather than restructuring that, and exporting yet one more symbol mscc_miim_teardown(), let's work with devres and replace of_mdiobus_register with the devres variant. When we use all-devres, we can ensure that devres doesn't free a still-registered bus (it either runs both callbacks, or none).
--- drivers/net/dsa/ocelot/seville_vsc9953.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/dsa/ocelot/seville_vsc9953.c +3 -2
@@ -1109,7 +1109,7 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot)snprintf (bus->id,MII_BUS_ID_SIZE ,"%s-imdio" ,dev_name (dev));/* Needed in order to initialize the bus mutex lock */ - rc =of_mdiobus_register (bus,NULL ); + rc =devm_of_mdiobus_register (dev, bus,NULL );if (rc <0 ) {dev_err (dev,"failed to register MDIO bus\n" );return rc;
@@ -1161,7 +1161,8 @@ static void vsc9953_mdio_bus_free(struct ocelot *ocelot)mdio_device_free (pcs->mdio);lynx_pcs_destroy (pcs); } -mdiobus_unregister (felix->imdio); + +/* mdiobus_unregister and mdiobus_free handled by devres */ }static const struct felix_info seville_info_vsc9953 = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 140/203 net: dsa: mt7530: fix kernel bug in mdiobus_free() when unbinding
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 9ffe3d09e32da45bb5a29cf2e80ec8d7534010c5 ]
Nobody in this driver calls mdiobus_unregister(), which is necessary if mdiobus_register() completes successfully. So if the devres callbacks that free the mdiobus get invoked (this is the case when unbinding the driver), mdiobus_free() will BUG if the mdiobus is still registered, which it is.
My speculation is that this is due to the fact that prior to commit ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register()") from June 2020, _devm_mdiobus_free() used to call mdiobus_unregister(). But at the time that the mt7530 support was introduced in May 2021, the API was already changed. It's therefore likely that the blamed patch was developed on an older tree, and incorrectly adapted to net-next. This makes the Fixes: tag correct.
Fix the problem by using the devres variant of mdiobus_register.
--- drivers/net/dsa/mt7530.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/mt7530.c +1 -1
@@ -2066,7 +2066,7 @@ mt7530_setup_mdio(struct mt7530_priv *priv)if (priv->irq)mt7530_setup_mdio_irq (priv); - ret =mdiobus_register (bus); + ret =devm_mdiobus_register (dev, bus);if (ret) {dev_err (dev,"failed to register MDIO bus: %d\n" , ret);if (priv->irq)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 141/203 net: dsa: lantiq_gswip: dont use devres for mdiobus
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 0d120dfb5d67edc5bcd1804e167dba2b30809afd ]
As explained in commits:74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") 5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres")
mdiobus_free() will panic when called from devm_mdiobus_free() <- devres_release_all() <- __device_release_driver(), and that mdiobus was not previously unregistered.
The GSWIP switch is a platform device, so the initial set of constraints that I thought would cause this (I2C or SPI buses which call ->remove on ->shutdown) do not apply. But there is one more which applies here.
If the DSA master itself is on a bus that calls ->remove from ->shutdown (like dpaa2-eth, which is on the fsl-mc bus), there is a device link between the switch and the DSA master, and device_links_unbind_consumers() will unbind the GSWIP switch driver on shutdown.
So the same treatment must be applied to all DSA switch drivers, which
is: either use devres for both the mdiobus allocation and registration, or don't use devres at all.
The gswip driver has the code structure in place for orderly mdiobus removal, so just replace devm_mdiobus_alloc() with the non-devres variant, and add manual free where necessary, to ensure that we don't let devres free a still-registered bus.
--- drivers/net/dsa/lantiq_gswip.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/net/dsa/lantiq_gswip.c +11 -3
@@ -498,8 +498,9 @@ static int gswip_mdio_rd(struct mii_bus *bus, int addr, int reg)static int gswip_mdio (struct gswip_priv *priv,struct device_node *mdio_np) {struct dsa_switch *ds = priv->ds; +int err; - ds->slave_mii_bus =devm_mdiobus_alloc (priv->dev); + ds->slave_mii_bus =mdiobus_alloc ();if (!ds->slave_mii_bus)return -ENOMEM ;
@@ -512,7 +513,11 @@ static int gswip_mdio(struct gswip_priv *priv, struct device_node *mdio_np) ds->slave_mii_bus->parent = priv->dev; ds->slave_mii_bus->phy_mask = ~ds->phys_mii_mask; -return of_mdiobus_register (ds->slave_mii_bus, mdio_np); + err =of_mdiobus_register (ds->slave_mii_bus, mdio_np); +if (err) +mdiobus_free (ds->slave_mii_bus); + +return err; } static int gswip_pce_table_entry_read(struct gswip_priv *priv,
@@ -2186,8 +2191,10 @@ static int gswip_probe(struct platform_device *pdev)gswip_mdio_mask (priv,GSWIP_MDIO_GLOB_ENABLE ,0 ,GSWIP_MDIO_GLOB );dsa_unregister_switch (priv->ds); mdio_bus: -if (mdio_np) +if (mdio_np) {mdiobus_unregister (priv->ds->slave_mii_bus); +mdiobus_free (priv->ds->slave_mii_bus); + } put_mdio_node:of_node_put (mdio_np);for (i =0 ; i < priv->num_gphy_fw; i++)
@@ -2210,6 +2217,7 @@ static int gswip_remove(struct platform_device *pdev)if (priv->ds->slave_mii_bus) {mdiobus_unregister (priv->ds->slave_mii_bus); +mdiobus_free (priv->ds->slave_mii_bus);of_node_put (priv->ds->slave_mii_bus->dev.of_node); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 142/203 ibmvnic: dont release napi in __ibmvnic_open()
In reply to Greg Kroah-HartmanFrom: Sukadev Bhattiprolu <[email protected]>
[ Upstream commit 61772b0908c640d0309c40f7d41d062ca4e979fa ]
If __ibmvnic_open() encounters an error such as when setting link state, it calls release_resources() which frees the napi structures needlessly. Instead, have __ibmvnic_open() only clean up the work it did so far (i.e. disable napi and irqs) and leave the rest to the callers.
If caller of __ibmvnic_open() is ibmvnic_open(), it should release the resources immediately. If the caller is do_reset() or do_hard_reset(), they will release the resources on the next reset.
This fixes following crash that occurred when running the drmgr command several times to add/remove a vnic interface:
[102056] ibmvnic 30000003 env3: Disabling rx_scrq[6] irq [102056] ibmvnic 30000003 env3: Disabling rx_scrq[7] irq [102056] ibmvnic 30000003 env3: Replenished 8 pools Kernel attempted to read user page (10) - exploit attempt? (uid: 0) BUG: Kernel NULL pointer dereference on read at 0x00000010 Faulting instruction address: 0xc000000000a3c840 Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries ... CPU: 9 PID: 102056 Comm: kworker/9:2 Kdump: loaded Not tainted 5.16.0-rc5-autotest-g6441998e2e37 #1 Workqueue: events_long __ibmvnic_reset [ibmvnic] NIP: c000000000a3c840 LR: c0080000029b5378 CTR: c000000000a3c820 REGS: c0000000548e37e0 TRAP: 0300 Not tainted (5.16.0-rc5-autotest-g6441998e2e37) MSR: 8000000000009033 <SF,EE,ME,IR,DR,RI,LE> CR: 28248484 XER: 00000004 CFAR: c0080000029bdd24 DAR: 0000000000000010 DSISR: 40000000 IRQMASK: 0 GPR00: c0080000029b55d0 c0000000548e3a80 c0000000028f0200 0000000000000000 ... NIP [c000000000a3c840] napi_enable+0x20/0xc0 LR [c0080000029b5378] __ibmvnic_open+0xf0/0x430 [ibmvnic] Call Trace: [c0000000548e3a80] [0000000000000006] 0x6 (unreliable) [c0000000548e3ab0] [c0080000029b55d0] __ibmvnic_open+0x348/0x430 [ibmvnic] [c0000000548e3b40] [c0080000029bcc28] __ibmvnic_reset+0x500/0xdf0 [ibmvnic] [c0000000548e3c60] [c000000000176228] process_one_work+0x288/0x570 [c0000000548e3d00] [c000000000176588] worker_thread+0x78/0x660 [c0000000548e3da0] [c0000000001822f0] kthread+0x1c0/0x1d0 [c0000000548e3e10] [c00000000000cf64] ret_from_kernel_thread+0x5c/0x64 Instruction dump: 7d2948f8 792307e0 4e800020 60000000 3c4c01eb 384239e0 f821ffd1 39430010 38a0fff6 e92d1100 f9210028 39200000 <e9030010> f9010020 60420000 e9210020 ---[ end trace 5f8033b08fd27706 ]---
--- drivers/net/ethernet/ibm/ibmvnic.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +9 -4
@@ -110,6 +110,7 @@ static void ibmvnic_tx_scrq_clean_buffer(struct ibmvnic_adapter *adapter, struct ibmvnic_sub_crq_queue *tx_scrq);static void free_long_term_buff (struct ibmvnic_adapter *adapter,struct ibmvnic_long_term_buff *ltb); +static void ibmvnic_disable_irqs (struct ibmvnic_adapter *adapter);struct ibmvnic_stat {char name[ETH_GSTRING_LEN ];
@@ -1418,7 +1419,7 @@ static int __ibmvnic_open(struct net_device *netdev) rc =set_link_state (adapter,IBMVNIC_LOGICAL_LNK_UP );if (rc) {ibmvnic_napi_disable (adapter); -release_resources (adapter); +ibmvnic_disable_irqs (adapter);return rc; }
@@ -1468,9 +1469,6 @@ static int ibmvnic_open(struct net_device *netdev) rc =init_resources (adapter);if (rc) {netdev_err (netdev,"failed to initialize resources\n" ); -release_resources (adapter); -release_rx_pools (adapter); -release_tx_pools (adapter); goto out; } }
@@ -1487,6 +1485,13 @@ static int ibmvnic_open(struct net_device *netdev) adapter->state =VNIC_OPEN ; rc =0 ; } + +if (rc) { +release_resources (adapter); +release_rx_pools (adapter); +release_tx_pools (adapter); + } +return rc; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 143/203 net: ethernet: litex: Add the dependency on HAS_IOMEM
In reply to Greg Kroah-HartmanFrom: Cai Huoqing <[email protected]>
[ Upstream commit 2427f03fb42f9dc14c53108f2c9b5563eb37e770 ]
The LiteX driver uses devm io function API which needs HAS_IOMEM enabled, so add the dependency on HAS_IOMEM.
--- drivers/net/ethernet/litex/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/litex/Kconfig +1 -1
@@ -17,7 +17,7 @@ if NET_VENDOR_LITEX config LITEX_LITEETH tristate "LiteX Ethernet support" - depends on OF + depends on OF && HAS_IOMEM help If you wish to compile a kernel for hardware with a LiteX LiteEth device then you should answer Y to this.
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 144/203 ipmr,ip6mr: acquire RTNL before calling ip[6]mr_free_table() on failure path
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 5611a00697c8ecc5aad04392bea629e9d6a20463 ]
ip[6]mr_free_table() can only be called under RTNL lock.
RTNL: assertion failed at net/core/dev.c (10367)
WARNING: CPU: 1 PID: 5890 at net/core/dev.c:10367 unregister_netdevice_many+0x1246/0x1850 net/core/dev.c:10367 Modules linked in: CPU: 1 PID: 5890 Comm: syz-executor.2 Not tainted 5.16.0-syzkaller-11627-g422ee58dc0ef #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:unregister_netdevice_many+0x1246/0x1850 net/core/dev.c:10367 Code: 0f 85 9b ee ff ff e8 69 07 4b fa ba 7f 28 00 00 48 c7 c6 00 90 ae 8a 48 c7 c7 40 90 ae 8a c6 05 6d b1 51 06 01 e8 8c 90 d8 01 <0f> 0b e9 70 ee ff ff e8 3e 07 4b fa 4c 89 e7 e8 86 2a 59 fa e9 ee RSP: 0018:ffffc900046ff6e0 EFLAGS: 00010286 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: ffff888050f51d00 RSI: ffffffff815fa008 RDI: fffff520008dfece RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: ffffffff815f3d6e R11: 0000000000000000 R12: 00000000fffffff4 R13: dffffc0000000000 R14: ffffc900046ff750 R15: ffff88807b7dc000 FS: 00007f4ab736e700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fee0b4f8990 CR3: 000000001e7d2000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> mroute_clean_tables+0x244/0xb40 net/ipv6/ip6mr.c:1509 ip6mr_free_table net/ipv6/ip6mr.c:389 [inline] ip6mr_rules_init net/ipv6/ip6mr.c:246 [inline] ip6mr_net_init net/ipv6/ip6mr.c:1306 [inline] ip6mr_net_init+0x3f0/0x4e0 net/ipv6/ip6mr.c:1298 ops_init+0xaf/0x470 net/core/net_namespace.c:140 setup_net+0x54f/0xbb0 net/core/net_namespace.c:331 copy_net_ns+0x318/0x760 net/core/net_namespace.c:475 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 copy_namespaces+0x391/0x450 kernel/nsproxy.c:178 copy_process+0x2e0c/0x7300 kernel/fork.c:2167 kernel_clone+0xe7/0xab0 kernel/fork.c:2555 __do_sys_clone+0xc8/0x110 kernel/fork.c:2672 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f4ab89f9059 Code: Unable to access opcode bytes at RIP 0x7f4ab89f902f. RSP: 002b:00007f4ab736e118 EFLAGS: 00000206 ORIG_RAX: 0000000000000038 RAX: ffffffffffffffda RBX: 00007f4ab8b0bf60 RCX: 00007f4ab89f9059 RDX: 0000000020000280 RSI: 0000000020000270 RDI: 0000000040200000 RBP: 00007f4ab8a5308d R08: 0000000020000300 R09: 0000000020000300 R10: 00000000200002c0 R11: 0000000000000206 R12: 0000000000000000 R13: 00007ffc3977cc1f R14: 00007f4ab736e300 R15: 0000000000022000 </TASK>
--- net/ipv4/ipmr.c | 2 ++ net/ipv6/ip6mr.c | 2 ++ 2 files changed, 4 insertions(+)
net/ipv4/ipmr.c +2 -0
@@ -261,7 +261,9 @@ static int __net_init ipmr_rules_init(struct net *net)return 0 ; err2: +rtnl_lock ();ipmr_free_table (mrt); +rtnl_unlock (); err1:fib_rules_unregister (ops);return err;
net/ipv6/ip6mr.c +2 -0
@@ -248,7 +248,9 @@ static int __net_init ip6mr_rules_init(struct net *net)return 0 ; err2: +rtnl_lock ();ip6mr_free_table (mrt); +rtnl_unlock (); err1:fib_rules_unregister (ops);return err;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 145/203 nfp: flower: fix ida_idx not being released
In reply to Greg Kroah-HartmanFrom: Louis Peens <[email protected]>
[ Upstream commit 7db788ad627aabff2b74d4f1a3b68516d0fee0d7 ]
When looking for a global mac index the extra NFP_TUN_PRE_TUN_IDX_BIT that gets set if nfp_flower_is_supported_bridge is true is not taken into account. Consequently the path that should release the ida_index in cleanup is never triggered, causing messages like:
nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex.
nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex.
nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex.after NFP_MAX_MAC_INDEX number of reconfigs. Ultimately this lead to new tunnel flows not being offloaded.
Fix this by unsetting the NFP_TUN_PRE_TUN_IDX_BIT before checking if the port is of type OTHER.
--- .../net/ethernet/netronome/nfp/flower/tunnel_conf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +8 -4
@@ -1011,6 +1011,7 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct net_device *netdev,struct nfp_flower_repr_priv *repr_priv;struct nfp_tun_offloaded_mac *entry;struct nfp_repr *repr; +u16 nfp_mac_idx;int ida_idx; entry =nfp_tunnel_lookup_offloaded_macs (app, mac);
@@ -1029,8 +1030,6 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct net_device *netdev, entry->bridge_count--;if (!entry->bridge_count && entry->ref_count) { -u16 nfp_mac_idx; - nfp_mac_idx = entry->index & ~NFP_TUN_PRE_TUN_IDX_BIT ;if (__nfp_tunnel_offload_mac (app, mac, nfp_mac_idx, false)) {
@@ -1046,7 +1045,6 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct net_device *netdev,/* If MAC is now used by 1 repr set the offloaded MAC index to port. */ if (entry->ref_count ==1 &&list_is_singular (&entry->repr_list)) { -u16 nfp_mac_idx;int port, err; repr_priv = list_first_entry(&entry->repr_list,
@@ -1074,8 +1072,14 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct net_device *netdev,WARN_ON_ONCE (rhashtable_remove_fast (&priv->tun.offloaded_macs, &entry->ht_node, offloaded_macs_params)); + +if (nfp_flower_is_supported_bridge (netdev)) + nfp_mac_idx = entry->index & ~NFP_TUN_PRE_TUN_IDX_BIT ; +else + nfp_mac_idx = entry->index; +/* If MAC has global ID then extract and free the ida entry. */ -if (nfp_tunnel_is_mac_idx_global (entry->index)) { +if (nfp_tunnel_is_mac_idx_global (nfp_mac_idx)) { ida_idx =nfp_tunnel_get_ida_from_global_mac_idx (entry->index);ida_simple_remove (&priv->tun.mac_off_ids, ida_idx); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 146/203 net: do not keep the dst cache when uncloning an skb dst and its metadata
In reply to Greg Kroah-HartmanFrom: Antoine Tenart <[email protected]>
[ Upstream commit cfc56f85e72f5b9c5c5be26dc2b16518d36a7868 ]
When uncloning an skb dst and its associated metadata a new dst+metadata is allocated and the tunnel information from the old metadata is copied over there.
The issue is the tunnel metadata has references to cached dst, which are copied along the way. When a dst+metadata refcount drops to 0 the metadata is freed including the cached dst entries. As they are also referenced in the initial dst+metadata, this ends up in UaFs.
In practice the above did not happen because of another issue, the dst+metadata was never freed because its refcount never dropped to 0 (this will be fixed in a subsequent patch).
Fix this by initializing the dst cache after copying the tunnel information from the old metadata to also unshare the dst cache.
--- include/net/dst_metadata.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
include/net/dst_metadata.h +13 -0
@@ -123,6 +123,19 @@ static inline struct metadata_dst *tun_dst_unclone(struct sk_buff *skb)memcpy (&new_md->u.tun_info, &md_dst->u.tun_info,sizeof (struct ip_tunnel_info ) + md_size); +#ifdef CONFIG_DST_CACHE +/* Unclone the dst cache if there is one */ +if (new_md->u.tun_info.dst_cache.cache) { +int ret; + + ret =dst_cache_init (&new_md->u.tun_info.dst_cache,GFP_ATOMIC ); +if (ret) { +metadata_dst_free (new_md); +return ERR_PTR (ret); + } + } +#endif +skb_dst_drop (skb);dst_hold (&new_md->dst);skb_dst_set (skb, &new_md->dst);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 147/203 net: fix a memleak when uncloning an skb dst and its metadata
In reply to Greg Kroah-HartmanFrom: Antoine Tenart <[email protected]>
[ Upstream commit 9eeabdf17fa0ab75381045c867c370f4cc75a613 ]
When uncloning an skb dst and its associated metadata, a new dst+metadata is allocated and later replaces the old one in the skb. This is helpful to have a non-shared dst+metadata attached to a specific skb.
The issue is the uncloned dst+metadata is initialized with a refcount of 1, which is increased to 2 before attaching it to the skb. When tun_dst_unclone returns, the dst+metadata is only referenced from a single place (the skb) while its refcount is 2. Its refcount will never drop to 0 (when the skb is consumed), leading to a memory leak.
Fix this by removing the call to dst_hold in tun_dst_unclone, as the dst+metadata refcount is already 1.
--- include/net/dst_metadata.h | 1 - 1 file changed, 1 deletion(-)
include/net/dst_metadata.h +0 -1
@@ -137,7 +137,6 @@ static inline struct metadata_dst *tun_dst_unclone(struct sk_buff *skb)#endif skb_dst_drop (skb); -dst_hold (&new_md->dst);skb_dst_set (skb, &new_md->dst);return new_md; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 148/203 veth: fix races around rq->rx_notify_masked
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 68468d8c4cd4222a4ca1f185ab5a1c14480d078c ]
veth being NETIF_F_LLTX enabled, we need to be more careful whenever we read/write rq->rx_notify_masked.
BUG: KCSAN: data-race in veth_xmit / veth_xmit
write to 0xffff888133d9a9f8 of 1 bytes by task 23552 on cpu 0:
__veth_xdp_flush drivers/net/veth.c:269 [inline] veth_xmit+0x307/0x470 drivers/net/veth.c:350 __netdev_start_xmit include/linux/netdevice.h:4683 [inline] netdev_start_xmit include/linux/netdevice.h:4697 [inline] xmit_one+0x105/0x2f0 net/core/dev.c:3473 dev_hard_start_xmit net/core/dev.c:3489 [inline] __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116 dev_queue_xmit+0x13/0x20 net/core/dev.c:4149 br_dev_queue_push_xmit+0x3ce/0x430 net/bridge/br_forward.c:53 NF_HOOK include/linux/netfilter.h:307 [inline] br_forward_finish net/bridge/br_forward.c:66 [inline] NF_HOOK include/linux/netfilter.h:307 [inline] __br_forward+0x2e4/0x400 net/bridge/br_forward.c:115 br_flood+0x521/0x5c0 net/bridge/br_forward.c:242 br_dev_xmit+0x8b6/0x960 __netdev_start_xmit include/linux/netdevice.h:4683 [inline] netdev_start_xmit include/linux/netdevice.h:4697 [inline] xmit_one+0x105/0x2f0 net/core/dev.c:3473 dev_hard_start_xmit net/core/dev.c:3489 [inline] __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116 dev_queue_xmit+0x13/0x20 net/core/dev.c:4149 neigh_hh_output include/net/neighbour.h:525 [inline] neigh_output include/net/neighbour.h:539 [inline] ip_finish_output2+0x6f8/0xb70 net/ipv4/ip_output.c:228 ip_finish_output+0xfb/0x240 net/ipv4/ip_output.c:316 NF_HOOK_COND include/linux/netfilter.h:296 [inline] ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:430 dst_output include/net/dst.h:451 [inline] ip_local_out net/ipv4/ip_output.c:126 [inline] ip_send_skb+0x6e/0xe0 net/ipv4/ip_output.c:1570 udp_send_skb+0x641/0x880 net/ipv4/udp.c:967 udp_sendmsg+0x12ea/0x14c0 net/ipv4/udp.c:1254 inet_sendmsg+0x5f/0x80 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg net/socket.c:725 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2413 ___sys_sendmsg net/socket.c:2467 [inline] __sys_sendmmsg+0x267/0x4c0 net/socket.c:2553 __do_sys_sendmmsg net/socket.c:2582 [inline] __se_sys_sendmmsg net/socket.c:2579 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2579 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
read to 0xffff888133d9a9f8 of 1 bytes by task 23563 on cpu 1:
__veth_xdp_flush drivers/net/veth.c:268 [inline] veth_xmit+0x2d6/0x470 drivers/net/veth.c:350 __netdev_start_xmit include/linux/netdevice.h:4683 [inline] netdev_start_xmit include/linux/netdevice.h:4697 [inline] xmit_one+0x105/0x2f0 net/core/dev.c:3473 dev_hard_start_xmit net/core/dev.c:3489 [inline] __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116 dev_queue_xmit+0x13/0x20 net/core/dev.c:4149 br_dev_queue_push_xmit+0x3ce/0x430 net/bridge/br_forward.c:53 NF_HOOK include/linux/netfilter.h:307 [inline] br_forward_finish net/bridge/br_forward.c:66 [inline] NF_HOOK include/linux/netfilter.h:307 [inline] __br_forward+0x2e4/0x400 net/bridge/br_forward.c:115 br_flood+0x521/0x5c0 net/bridge/br_forward.c:242 br_dev_xmit+0x8b6/0x960 __netdev_start_xmit include/linux/netdevice.h:4683 [inline] netdev_start_xmit include/linux/netdevice.h:4697 [inline] xmit_one+0x105/0x2f0 net/core/dev.c:3473 dev_hard_start_xmit net/core/dev.c:3489 [inline] __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116 dev_queue_xmit+0x13/0x20 net/core/dev.c:4149 neigh_hh_output include/net/neighbour.h:525 [inline] neigh_output include/net/neighbour.h:539 [inline] ip_finish_output2+0x6f8/0xb70 net/ipv4/ip_output.c:228 ip_finish_output+0xfb/0x240 net/ipv4/ip_output.c:316 NF_HOOK_COND include/linux/netfilter.h:296 [inline] ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:430 dst_output include/net/dst.h:451 [inline] ip_local_out net/ipv4/ip_output.c:126 [inline] ip_send_skb+0x6e/0xe0 net/ipv4/ip_output.c:1570 udp_send_skb+0x641/0x880 net/ipv4/udp.c:967 udp_sendmsg+0x12ea/0x14c0 net/ipv4/udp.c:1254 inet_sendmsg+0x5f/0x80 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg net/socket.c:725 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2413 ___sys_sendmsg net/socket.c:2467 [inline] __sys_sendmmsg+0x267/0x4c0 net/socket.c:2553 __do_sys_sendmmsg net/socket.c:2582 [inline] __se_sys_sendmmsg net/socket.c:2579 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2579 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
value changed: 0x00 -> 0x01
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 23563 Comm: syz-executor.5 Not tainted 5.17.0-rc2-syzkaller-00064-gc36c04c2e132 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- drivers/net/veth.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/veth.c +8 -5
@@ -272,9 +272,10 @@ static void __veth_xdp_flush(struct veth_rq *rq) {/* Write ptr_ring before reading rx_notify_masked */ smp_mb (); -if (!rq->rx_notify_masked) { - rq->rx_notify_masked = true; -napi_schedule (&rq->xdp_napi); +if (!READ_ONCE (rq->rx_notify_masked) && +napi_schedule_prep (&rq->xdp_napi)) { +WRITE_ONCE (rq->rx_notify_masked, true); +__napi_schedule (&rq->xdp_napi); } }
@@ -919,8 +920,10 @@ static int veth_poll(struct napi_struct *napi, int budget)/* Write rx_notify_masked before reading ptr_ring */ smp_store_mb (rq->rx_notify_masked, false);if (unlikely (!__ptr_ring_empty (&rq->xdp_ring))) { - rq->rx_notify_masked = true; -napi_schedule (&rq->xdp_napi); +if (napi_schedule_prep (&rq->xdp_napi)) { +WRITE_ONCE (rq->rx_notify_masked, true); +__napi_schedule (&rq->xdp_napi); + } } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 149/203 net: mdio: aspeed: Add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit bc1c3c3b10db4f37c41e6107751a8d450d9c431c ]
Fix loading of the driver when built as a module.
--- drivers/net/mdio/mdio-aspeed.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/mdio/mdio-aspeed.c +1 -0
@@ -148,6 +148,7 @@ static const struct of_device_id aspeed_mdio_of_match[] = { { .compatible = "aspeed,ast2600-mdio", }, { }, }; +MODULE_DEVICE_TABLE (of, aspeed_mdio_of_match);static struct platform_driver aspeed_mdio_driver = { .driver = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 150/203 tipc: rate limit warning for received illegal binding update
In reply to Greg Kroah-HartmanFrom: Jon Maloy <[email protected]>
[ Upstream commit c7223d687758462826a20e9735305d55bb874c70 ]
It would be easy to craft a message containing an illegal binding table update operation. This is handled correctly by the code, but the corresponding warning printout is not rate limited as is should be. We fix this now.
--- net/tipc/name_distr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/tipc/name_distr.c +1 -1
@@ -313,7 +313,7 @@ static bool tipc_update_nametbl(struct net *net, struct distr_item *i,pr_warn_ratelimited ("Failed to remove binding %u,%u from %u\n" , ua.sr.type, ua.sr.lower, node); }else { -pr_warn ("Unrecognized name table message received\n" ); +pr_warn_ratelimited ("Unknown name table message received\n" ); }return false; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 151/203 net: amd-xgbe: disable interrupts during pci removal
In reply to Greg Kroah-HartmanFrom: Raju Rangoju <[email protected]>
[ Upstream commit 68c2d6af1f1e469544d6cbe9a601d96fb9c00e7f ]
Hardware interrupts are enabled during the pci probe, however, they are not disabled during pci removal.
Disable all hardware interrupts during pci removal to avoid any issues.
--- drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/amd/xgbe/xgbe-pci.c +3 -0
@@ -418,6 +418,9 @@ static void xgbe_pci_remove(struct pci_dev *pdev)pci_free_irq_vectors (pdata->pcidev); +/* Disable all interrupts in the hardware */ +XP_IOWRITE (pdata,XP_INT_EN ,0x0 ); +xgbe_free_pdata (pdata); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 152/203 net: dsa: fix panic when DSA master device unbinds on shutdown
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit ee534378f00561207656663d93907583958339ae ]
Rafael reports that on a system with LX2160A and Marvell DSA switches, if a reboot occurs while the DSA master (dpaa2-eth) is up, the following panic can be seen:
systemd-shutdown[1]: Rebooting.
Unable to handle kernel paging request at virtual address 00a0000800000041 [00a0000800000041] address between user and kernel address ranges Internal error: Oops: 96000004 [#1] PREEMPT SMP CPU: 6 PID: 1 Comm: systemd-shutdow Not tainted 5.16.5-00042-g8f5585009b24 #32 pc : dsa_slave_netdevice_event+0x130/0x3e4 lr : raw_notifier_call_chain+0x50/0x6c Call trace: dsa_slave_netdevice_event+0x130/0x3e4 raw_notifier_call_chain+0x50/0x6c call_netdevice_notifiers_info+0x54/0xa0 __dev_close_many+0x50/0x130 dev_close_many+0x84/0x120 unregister_netdevice_many+0x130/0x710 unregister_netdevice_queue+0x8c/0xd0 unregister_netdev+0x20/0x30 dpaa2_eth_remove+0x68/0x190 fsl_mc_driver_remove+0x20/0x5c __device_release_driver+0x21c/0x220 device_release_driver_internal+0xac/0xb0 device_links_unbind_consumers+0xd4/0x100 __device_release_driver+0x94/0x220 device_release_driver+0x28/0x40 bus_remove_device+0x118/0x124 device_del+0x174/0x420 fsl_mc_device_remove+0x24/0x40 __fsl_mc_device_remove+0xc/0x20 device_for_each_child+0x58/0xa0 dprc_remove+0x90/0xb0 fsl_mc_driver_remove+0x20/0x5c __device_release_driver+0x21c/0x220 device_release_driver+0x28/0x40 bus_remove_device+0x118/0x124 device_del+0x174/0x420 fsl_mc_bus_remove+0x80/0x100 fsl_mc_bus_shutdown+0xc/0x1c platform_shutdown+0x20/0x30 device_shutdown+0x154/0x330 __do_sys_reboot+0x1cc/0x250 __arm64_sys_reboot+0x20/0x30 invoke_syscall.constprop.0+0x4c/0xe0 do_el0_svc+0x4c/0x150 el0_svc+0x24/0xb0 el0t_64_sync_handler+0xa8/0xb0 el0t_64_sync+0x178/0x17c
It can be seen from the stack trace that the problem is that the deregistration of the master causes a dev_close(), which gets notified as NETDEV_GOING_DOWN to dsa_slave_netdevice_event().
But dsa_switch_shutdown() has already run, and this has unregistered the DSA slave interfaces, and yet, the NETDEV_GOING_DOWN handler attempts to call dev_close_many() on those slave interfaces, leading to the problem.
The previous attempt to avoid the NETDEV_GOING_DOWN on the master after dsa_switch_shutdown() was called seems improper. Unregistering the slave interfaces is unnecessary and unhelpful. Instead, after the slaves have stopped being uppers of the DSA master, we can now reset to NULL the master->dsa_ptr pointer, which will make DSA start ignoring all future notifier events on the master.
--- net/dsa/dsa2.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-)
net/dsa/dsa2.c +6 -19
@@ -1609,7 +1609,6 @@ EXPORT_SYMBOL_GPL(dsa_unregister_switch);void dsa_switch_shutdown (struct dsa_switch *ds) {struct net_device *master, *slave_dev; -LIST_HEAD (unregister_list);struct dsa_port *dp;mutex_lock (&dsa2_mutex);
@@ -1620,25 +1619,13 @@ void dsa_switch_shutdown(struct dsa_switch *ds) slave_dev = dp->slave;netdev_upper_dev_unlink (master, slave_dev); -/* Just unlinking ourselves as uppers of the master is not -* sufficient. When the master net device unregisters, that will -* also call dev_close, which we will catch as NETDEV_GOING_DOWN -* and trigger a dev_close on our own devices (dsa_slave_close). -* In turn, that will call dev_mc_unsync on the master's net -* device. If the master is also a DSA switch port, this will -* trigger dsa_slave_set_rx_mode which will call dev_mc_sync on -* its own master. Lockdep will complain about the fact that -* all cascaded masters have the same dsa_master_addr_list_lock_key, -* which it normally would not do if the cascaded masters would -* be in a proper upper/lower relationship, which we've just -* destroyed. -* To suppress the lockdep warnings, let's actually unregister -* the DSA slave interfaces too, to avoid the nonsensical -* multicast address list synchronization on shutdown. -*/ -unregister_netdevice_queue (slave_dev, &unregister_list); } -unregister_netdevice_many (&unregister_list); + +/* Disconnect from further netdevice notifiers on the master, +* since netdev_uses_dsa() will now return false. +*/ +dsa_switch_for_each_cpu_port (dp, ds) + dp->master->dsa_ptr =NULL ;rtnl_unlock ();mutex_unlock (&dsa2_mutex);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 153/203 drm/amd/pm: fix hwmon node of power1_label create issue
In reply to Greg Kroah-HartmanFrom: Yang Wang <[email protected]>
[ Upstream commit a8b1e8636a3252daa729762b2e3cc9015cc91a5c ]
it will cause hwmon node of power1_label is not created.
v2:
the hwmon node of "power1_label" is always needed for all ASICs. and the patch will remove ASIC type check for "power1_label".
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -2
@@ -3451,8 +3451,7 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj, attr == &sensor_dev_attr_power2_cap_min.dev_attr.attr || attr == &sensor_dev_attr_power2_cap.dev_attr.attr || attr == &sensor_dev_attr_power2_cap_default.dev_attr.attr || - attr == &sensor_dev_attr_power2_label.dev_attr.attr || - attr == &sensor_dev_attr_power1_label.dev_attr.attr)) + attr == &sensor_dev_attr_power2_label.dev_attr.attr)) return 0;return effective_mode;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 154/203 mptcp: netlink: process IPv6 addrs in creating listening sockets
In reply to Greg Kroah-HartmanFrom: Kishen Maloor <[email protected]>
[ Upstream commit 029744cd4bc6e9eb3bd833b4a033348296d34645 ]
This change updates mptcp_pm_nl_create_listen_socket() to create listening sockets bound to IPv6 addresses (where IPv6 is supported).
--- net/mptcp/pm_netlink.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/mptcp/pm_netlink.c +6 -2
@@ -878,6 +878,7 @@ static int mptcp_pm_nl_append_new_local_addr(struct pm_nl_pernet *pernet,static int mptcp_pm_nl_create_listen_socket (struct sock *sk,struct mptcp_pm_addr_entry *entry) { +int addrlen =sizeof (struct sockaddr_in );struct sockaddr_storage addr;struct mptcp_sock *msk;struct socket *ssock;
@@ -902,8 +903,11 @@ static int mptcp_pm_nl_create_listen_socket(struct sock *sk, }mptcp_info2sockaddr (&entry->addr, &addr, entry->addr.family); - err =kernel_bind (ssock, (struct sockaddr *)&addr, -sizeof (struct sockaddr_in )); +#if IS_ENABLED (CONFIG_MPTCP_IPV6 ) +if (entry->addr.family ==AF_INET6 ) + addrlen =sizeof (struct sockaddr_in6 ); +#endif + err =kernel_bind (ssock, (struct sockaddr *)&addr, addrlen);if (err) {pr_warn ("kernel_bind error, err=%d" , err); goto out;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 155/203 dpaa2-eth: unregister the netdev before disconnecting from the PHY
In reply to Greg Kroah-HartmanFrom: Robert-Ionut Alexa <[email protected]>
[ Upstream commit 9ccc6e0c8959a019bb40f6b18704b142c04b19a8 ]
The netdev should be unregistered before we are disconnecting from the MAC/PHY so that the dev_close callback is called and the PHY and the phylink workqueues are actually stopped before we are disconnecting and destroying the phylink instance.
--- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +2 -2
@@ -4523,12 +4523,12 @@ static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev)#ifdef CONFIG_DEBUG_FS dpaa2_dbg_remove (priv);#endif + +unregister_netdev (net_dev);rtnl_lock ();dpaa2_eth_disconnect_mac (priv);rtnl_unlock (); -unregister_netdev (net_dev); -dpaa2_eth_dl_port_del (priv);dpaa2_eth_dl_traps_unregister (priv);dpaa2_eth_dl_free (priv);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 156/203 ice: fix an error code in ice_cfg_phy_fec()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 21338d58736ef70eaae5fd75d567a358ff7902f9 ]
Propagate the error code from ice_get_link_default_override() instead of returning success.
--- drivers/net/ethernet/intel/ice/ice_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_common.c +2 -1
@@ -3321,7 +3321,8 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg, !ice_fw_supports_report_dflt_cfg(hw)) {struct ice_link_default_override_tlv tlv; -if (ice_get_link_default_override (&tlv, pi)) + status =ice_get_link_default_override (&tlv, pi); +if (status) goto out; if (!(tlv.options & ICE_LINK_OVERRIDE_STRICT_MODE) &&
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 157/203 ice: fix IPIP and SIT TSO offload
In reply to Greg Kroah-HartmanFrom: Jesse Brandeburg <[email protected]>
[ Upstream commit 46b699c50c0304cdbd725d7740073a7f9d5edb10 ]
The driver was avoiding offload for IPIP (at least) frames due to parsing the inner header offsets incorrectly when trying to check lengths.
This length check works for VXLAN frames but fails on IPIP frames because skb_transport_offset points to the inner header in IPIP frames, which meant the subtraction of transport_header from inner_network_header returns a negative value (-20).
With the code before this patch, everything continued to work, but GSO was being used to segment, causing throughputs of 1.5Gb/s per thread. After this patch, throughput is more like 10Gb/s per thread for IPIP traffic.
--- .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h +1 -0
@@ -568,6 +568,7 @@ struct ice_tx_ctx_desc { (0x3FFFFULL << ICE_TXD_CTX_QW1_TSO_LEN_S)#define ICE_TXD_CTX_QW1_MSS_S 50 +#define ICE_TXD_CTX_MIN_MSS 64#define ICE_TXD_CTX_QW1_VSI_S 50#define ICE_TXD_CTX_QW1_VSI_M (0x3FFULL << ICE_TXD_CTX_QW1_VSI_S)
drivers/net/ethernet/intel/ice/ice_main.c +17 -8
@@ -8540,6 +8540,7 @@ ice_features_check(struct sk_buff *skb,struct net_device __always_unused *netdev, netdev_features_t features) { + bool gso = skb_is_gso(skb);size_t len;/* No point in doing any of this if neither checksum nor GSO are
@@ -8552,24 +8553,32 @@ ice_features_check(struct sk_buff *skb,/* We cannot support GSO if the MSS is going to be less than * 64 bytes. If it is then we need to drop support for GSO. */ -if (skb_is_gso (skb) && (skb_shinfo (skb)->gso_size <64 )) +if (gso && (skb_shinfo (skb)->gso_size <ICE_TXD_CTX_MIN_MSS )) features &= ~NETIF_F_GSO_MASK ; - len =skb_network_header (skb) - skb->data; + len =skb_network_offset (skb);if (len >ICE_TXD_MACLEN_MAX || len &0x1 ) goto out_rm_features; - len =skb_transport_header (skb) -skb_network_header (skb); + len =skb_network_header_len (skb);if (len >ICE_TXD_IPLEN_MAX || len &0x1 ) goto out_rm_features;if (skb->encapsulation) { - len =skb_inner_network_header (skb) -skb_transport_header (skb); -if (len >ICE_TXD_L4LEN_MAX || len &0x1 ) - goto out_rm_features; +/* this must work for VXLAN frames AND IPIP/SIT frames, and in +* the case of IPIP frames, the transport header pointer is +* after the inner header! So check to make sure that this +* is a GRE or UDP_TUNNEL frame before doing that math. +*/ +if (gso && (skb_shinfo (skb)->gso_type & + (SKB_GSO_GRE |SKB_GSO_UDP_TUNNEL ))) { + len =skb_inner_network_header (skb) - +skb_transport_header (skb); +if (len >ICE_TXD_L4LEN_MAX || len &0x1 ) + goto out_rm_features; + } - len =skb_inner_transport_header (skb) - -skb_inner_network_header (skb); + len =skb_inner_network_header_len (skb);if (len >ICE_TXD_IPLEN_MAX || len &0x1 ) goto out_rm_features; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 158/203 ice: Fix KASAN error in LAG NETDEV_UNREGISTER handler
In reply to Greg Kroah-HartmanFrom: Dave Ertman <[email protected]>
[ Upstream commit bea1898f65b9b7096cb4e73e97c83b94718f1fa1 ]
Currently, the same handler is called for both a NETDEV_BONDING_INFO LAG unlink notification as for a NETDEV_UNREGISTER call. This is causing a problem though, since the netdev_notifier_info passed has a different structure depending on which event is passed. The problem manifests as a call trace from a BUG: KASAN stack-out-of-bounds error.
Fix this by creating a handler specific to NETDEV_UNREGISTER that only is passed valid elements in the netdev_notifier_info struct for the NETDEV_UNREGISTER event.
Also included is the removal of an unbalanced dev_put on the peer_netdev and related braces.
--- drivers/net/ethernet/intel/ice/ice_lag.c | 34 +++++++++++++++++++----- 1 file changed, 28 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_lag.c +28 -6
@@ -204,17 +204,39 @@ ice_lag_unlink(struct ice_lag *lag, lag->upper_netdev =NULL ; } -if (lag->peer_netdev) { -dev_put (lag->peer_netdev); - lag->peer_netdev =NULL ; - } - + lag->peer_netdev =NULL ;ice_set_sriov_cap (pf);ice_set_rdma_cap (pf); lag->bonded = false; lag->role =ICE_LAG_NONE ; } +/** +* ice_lag_unregister - handle netdev unregister events +* @lag: LAG info struct +* @netdev: netdev reporting the event +*/ +static void ice_lag_unregister (struct ice_lag *lag,struct net_device *netdev) +{ +struct ice_pf *pf = lag->pf; + +/* check to see if this event is for this netdev +* check that we are in an aggregate +*/ +if (netdev != lag->netdev || !lag->bonded) +return ; + +if (lag->upper_netdev) { +dev_put (lag->upper_netdev); + lag->upper_netdev =NULL ; +ice_set_sriov_cap (pf); +ice_set_rdma_cap (pf); + } +/* perform some cleanup in case we come back */ + lag->bonded = false; + lag->role =ICE_LAG_NONE ; +} +/** * ice_lag_changeupper_event - handle LAG changeupper event * @lag: LAG info struct
@@ -307,7 +329,7 @@ ice_lag_event_handler(struct notifier_block *notif_blk, unsigned long event,ice_lag_info_event (lag, ptr);break ;case NETDEV_UNREGISTER : -ice_lag_unlink (lag, ptr); +ice_lag_unregister (lag, netdev);break ;default :break ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 159/203 ice: Avoid RTNL lock when re-creating auxiliary device
In reply to Greg Kroah-HartmanFrom: Dave Ertman <[email protected]>
[ Upstream commit 5dbbbd01cbba831233c6ea9a3e6bfa133606d3c0 ]
If a call to re-create the auxiliary device happens in a context that has already taken the RTNL lock, then the call flow that recreates auxiliary device can hang if there is another attempt to claim the RTNL lock by the auxiliary driver.
To avoid this, any call to re-create auxiliary devices that comes from an source that is holding the RTNL lock (e.g. netdev notifier when interface exits a bond) should execute in a separate thread. To accomplish this, add a flag to the PF that will be evaluated in the service task and dealt with there.
--- drivers/net/ethernet/intel/ice/ice.h | 3 ++- drivers/net/ethernet/intel/ice/ice_main.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice.h +2 -1
@@ -483,6 +483,7 @@ enum ice_pf_flags {ICE_FLAG_VF_TRUE_PROMISC_ENA ,ICE_FLAG_MDD_AUTO_RESET_VF ,ICE_FLAG_LINK_LENIENT_MODE_ENA , +ICE_FLAG_PLUG_AUX_DEV , ICE_PF_FLAGS_NBITS /* must be last */ };
@@ -880,7 +881,7 @@ static inline void ice_set_rdma_cap(struct ice_pf *pf)if (pf->hw.func_caps.common_cap.rdma && pf->num_rdma_msix) {set_bit (ICE_FLAG_RDMA_ENA , pf->flags);set_bit (ICE_FLAG_AUX_ENA , pf->flags); -ice_plug_aux_dev (pf); +set_bit (ICE_FLAG_PLUG_AUX_DEV , pf->flags); } }
drivers/net/ethernet/intel/ice/ice_main.c +3 -0
@@ -2235,6 +2235,9 @@ static void ice_service_task(struct work_struct *work)return ; } +if (test_and_clear_bit (ICE_FLAG_PLUG_AUX_DEV , pf->flags)) +ice_plug_aux_dev (pf); +ice_clean_adminq_subtask (pf);ice_check_media_subtask (pf);ice_check_for_hang_subtask (pf);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 160/203 net: mscc: ocelot: fix mutex lock error during ethtool stats read
In reply to Greg Kroah-HartmanFrom: Colin Foster <[email protected]>
[ Upstream commit 7fbf6795d127a3b1bb39b0e42579904cf6db1624 ]
An ongoing workqueue populates the stats buffer. At the same time, a user might query the statistics. While writing to the buffer is mutex-locked, reading from the buffer wasn't. This could lead to buggy reads by ethtool.
This patch fixes the former blamed commit, but the bug was introduced in the latter.
--- drivers/net/ethernet/mscc/ocelot.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/mscc/ocelot.c +7 -4
@@ -1609,12 +1609,11 @@ void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data) }EXPORT_SYMBOL (ocelot_get_strings); +/* Caller must hold &ocelot->stats_lock */ static void ocelot_update_stats (struct ocelot *ocelot) {int i, j; -mutex_lock (&ocelot->stats_lock); -for (i =0 ; i < ocelot->num_phys_ports; i++) {/* Configure the port to read the stats from */ ocelot_write (ocelot,SYS_STAT_CFG_STAT_VIEW (i),SYS_STAT_CFG );
@@ -1633,8 +1632,6 @@ static void ocelot_update_stats(struct ocelot *ocelot) ~(u64)U32_MAX) + val; } } - -mutex_unlock (&ocelot->stats_lock); }static void ocelot_check_stats_work (struct work_struct *work)
@@ -1643,7 +1640,9 @@ static void ocelot_check_stats_work(struct work_struct *work) struct ocelot *ocelot = container_of(del_work, struct ocelot, stats_work); +mutex_lock (&ocelot->stats_lock);ocelot_update_stats (ocelot); +mutex_unlock (&ocelot->stats_lock);queue_delayed_work (ocelot->stats_queue, &ocelot->stats_work,OCELOT_STATS_CHECK_DELAY );
@@ -1653,12 +1652,16 @@ void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data) {int i; +mutex_lock (&ocelot->stats_lock); +/* check and update now */ ocelot_update_stats (ocelot);/* Copy all counters */ for (i =0 ; i < ocelot->num_stats; i++) *data++ = ocelot->stats[port * ocelot->num_stats + i]; + +mutex_unlock (&ocelot->stats_lock); }EXPORT_SYMBOL (ocelot_get_ethtool_stats);
Signature · 1 line
2.34.1