5.11.16-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 5.11.16-rc1 review
This is the start of the stable review cycle for the 5.11.16 release. There are 122 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, 21 Apr 2021 13:05:09 +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.11.16-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.11.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.11.16-rc1
Daniel Borkmann <[email protected]>
bpf: Move sanitize_val_alu out of op switch
Daniel Borkmann <[email protected]>
bpf: Improve verifier error messages for users
Daniel Borkmann <[email protected]>
bpf: Rework ptr_limit into alu_limit and add common error path
Fredrik Strupe <[email protected]>
ARM: 9071/1: uprobes: Don't hook on thumb instructions
Daniel Borkmann <[email protected]>
bpf: Move off_reg into sanitize_ptr_alu
Daniel Borkmann <[email protected]>
bpf: Ensure off_reg has no mixed signed bounds for all types
Heiner Kallweit <[email protected]>
r8169: don't advertise pause in jumbo mode
Heiner Kallweit <[email protected]>
r8169: tweak max read request size for newer chips also in jumbo mtu mode
Walter Wu <[email protected]>
kasan: remove redundant config option
Arnd Bergmann <[email protected]>
kasan: fix hwasan build for gcc
Reiji Watanabe <[email protected]>
KVM: VMX: Don't use vcpu->run->internal.ndata as an array index
Sean Christopherson <[email protected]>
KVM: VMX: Convert vcpu_vmx.exit_reason to a union
Daniel Borkmann <[email protected]>
bpf: Use correct permission flag for mixed signed bounds arithmetic
Jernej Skrabec <[email protected]>
arm64: dts: allwinner: h6: beelink-gs1: Remove ext. 32 kHz osc reference
Andre Przywara <[email protected]>
arm64: dts: allwinner: Fix SD card CD GPIO for SOPine systems
Tony Lindgren <[email protected]>
ARM: OMAP2+: Fix uninitialized sr_inst
Russell King <[email protected]>
ARM: footbridge: fix PCI interrupt mapping
Vladimir Murzin <[email protected]>
ARM: 9069/1: NOMMU: Fix conversion for_each_membock() to for_each_mem_range()
Ard Biesheuvel <[email protected]>
ARM: 9063/1: mm: reduce maximum number of CPUs if DEBUG_KMAP_LOCAL is enabled
Tony Lindgren <[email protected]>
ARM: OMAP2+: Fix warning for omap_init_time_of()
Eric Dumazet <[email protected]>
gro: ensure frag0 meets IP header alignment
Vinay Kumar Yadav <[email protected]>
ch_ktls: do not send snd_una update to TCB in middle
Vinay Kumar Yadav <[email protected]>
ch_ktls: tcb close causes tls connection failure
Vinay Kumar Yadav <[email protected]>
ch_ktls: fix device connection close
Vinay Kumar Yadav <[email protected]>
ch_ktls: Fix kernel panic
Lijun Pan <[email protected]>
ibmvnic: remove duplicate napi_schedule call in open function
Lijun Pan <[email protected]>
ibmvnic: remove duplicate napi_schedule call in do_reset function
Lijun Pan <[email protected]>
ibmvnic: avoid calling napi_disable() twice
John Paul Adrian Glaubitz <glaubitz () physik ! fu-berlin ! de>
ia64: tools: remove inclusion of ia64-specific version of errno.h header
Randy Dunlap <[email protected]>
ia64: remove duplicate entries in generic_defconfig
Jakub Kicinski <[email protected]>
ethtool: pause: make sure we init driver stats
Jason Xing <[email protected]>
i40e: fix the panic when running bpf in xdpdrv mode
Lijun Pan <[email protected]>
ibmvnic: correctly use dev_consume/free_skb_irq
Jonathon Reinhart <[email protected]>
net: Make tcp_allowed_congestion_control readonly in non-init netns
Christophe Leroy <[email protected]>
mm: ptdump: fix build failure
Hristo Venev <[email protected]>
net: ip6_tunnel: Unregister catch-all devices
Hristo Venev <[email protected]>
net: sit: Unregister catch-all devices
Pali Rohár <[email protected]>
net: phy: marvell: fix detection of PHY on Topaz switches
Christophe JAILLET <[email protected]>
net: davicom: Fix regulator not turned off on failed probe
Aya Levin <[email protected]>
net/mlx5e: Fix setting of RS FEC mode
Pablo Neira Ayuso <[email protected]>
netfilter: nftables: clone set element expression template
Eric Dumazet <[email protected]>
netfilter: nft_limit: avoid possible divide error in nft_limit_init
wenxu <[email protected]>
net/mlx5e: fix ingress_ifindex check in mlx5e_flower_parse_meta
Claudiu Beznea <[email protected]>
net: macb: fix the restore of cmp registers
Hans de Goede <[email protected]>
drm/i915/display/vlv_dsi: Do not skip panel_pwr_cycle_delay when disabling the panel
Ciara Loftus <[email protected]>
libbpf: Fix potential NULL pointer dereference
Florian Westphal <[email protected]>
netfilter: arp_tables: add pre_exit hook for table unregister
Florian Westphal <[email protected]>
netfilter: bridge: add pre_exit hooks for ebtable unregistration
Vaibhav Jain <[email protected]>
libnvdimm/region: Fix nvdimm_has_flush() to handle ND_REGION_ASYNC
Colin Ian King <[email protected]>
ice: Fix potential infinite loop when using u8 loop counter
Pablo Neira Ayuso <[email protected]>
netfilter: conntrack: do not print icmpv6 as unknown via /proc
Pablo Neira Ayuso <[email protected]>
netfilter: flowtable: fix NAT IPv6 offload mangling
Yongxin Liu <[email protected]>
ixgbe: fix unbalanced device enable/disable in suspend/resume
Alexander Duyck <[email protected]>
ixgbe: Fix NULL pointer dereference in ethtool loopback test
Zack Rusin <[email protected]>
drm/vmwgfx: Make sure we unpin no longer needed buffers
Jolly Shah <[email protected]>
scsi: libsas: Reset num_scatter if libata marks qc as NODATA
Kefeng Wang <[email protected]>
riscv: Fix spelling mistake "SPARSEMEM" to "SPARSMEM"
Christian A. Ehrhardt <[email protected]>
vfio/pci: Add missing range check in vfio_pci_mmap
Nathan Chancellor <[email protected]>
arm64: alternatives: Move length validation in alternative_{insn, endif}Catalin Marinas <[email protected]>
arm64: mte: Ensure TIF_MTE_ASYNC_FAULT is set atomically
Peter Collingbourne <[email protected]>
arm64: fix inline asm in load_unaligned_zeropad()
Ville Syrjälä <[email protected]>
drm/i915: Don't zero out the Y plane's watermarks
Linus Torvalds <[email protected]>
readdir: make sure to verify directory entry for legacy interfaces too
Jaegeuk Kim <[email protected]>
dm verity fec: fix misaligned RS roots IO
Ping Cheng <[email protected]>
HID: wacom: set EV_KEY and EV_ABS only for non-HID_GENERIC type of devices
Arnd Bergmann <[email protected]>
Input: i8042 - fix Pegatron C15B ID entry
Caleb Connolly <[email protected]>
Input: s6sy761 - fix coordinate read bit shift
Or Cohen <[email protected]>
net/sctp: fix race condition in sctp_destroy_sock
Julian Braha <[email protected]>
lib: fix kconfig dependency on ARCH_WANT_FRAME_POINTERS
A. Cody Schuffelen <[email protected]>
virt_wifi: Return micros for BSS TSF values
Seevalamuthu Mariappan <[email protected]>
mac80211: clear sta->fast_rx when STA removed from 4-addr VLAN
Qingqing Zhuo <[email protected]>
drm/amd/display: Add missing mask for DCN3
Zheng Yongjun <[email protected]>
net: tipc: Fix spelling errors in net/tipc module
Aditya Pakki <[email protected]>
net/rds: Avoid potential use after free in rds_send_remove_from_sock
Guenter Roeck <[email protected]>
pcnet32: Use pci_resource_len to validate PCI resource
Alexander Aring <[email protected]>
net: ieee802154: forbid monitor for add llsec seclevel
Alexander Aring <[email protected]>
net: ieee802154: stop dump llsec seclevels for monitors
Alexander Aring <[email protected]>
net: ieee802154: forbid monitor for del llsec devkey
Alexander Aring <[email protected]>
net: ieee802154: forbid monitor for add llsec devkey
Alexander Aring <[email protected]>
net: ieee802154: stop dump llsec devkeys for monitors
Alexander Aring <[email protected]>
net: ieee802154: forbid monitor for del llsec dev
Alexander Aring <[email protected]>
net: ieee802154: forbid monitor for add llsec dev
Alexander Aring <[email protected]>
net: ieee802154: stop dump llsec devs for monitors
Alexander Aring <[email protected]>
net: ieee802154: forbid monitor for del llsec key
Alexander Aring <[email protected]>
net: ieee802154: forbid monitor for add llsec key
Alexander Aring <[email protected]>
net: ieee802154: stop dump llsec keys for monitors
Matt Chen <[email protected]>
iwlwifi: add support for Qu with AX201 device
Martin Wilck <[email protected]>
scsi: scsi_transport_srp: Don't block target in SRP_PORT_LOST state
Alexander Shiyan <[email protected]>
ASoC: fsl_esai: Fix TDM slot setup for I2S mode
Rob Clark <[email protected]>
drm/msm: Fix a5xx/a6xx timestamps
Arnd Bergmann <[email protected]>
ARM: omap1: fix building with clang IAS
Arnd Bergmann <[email protected]>
ARM: keystone: fix integer overflow warning
Christophe Leroy <[email protected]>
powerpc/signal32: Fix Oops on sigreturn with unmapped VDSO
Tong Zhu <[email protected]>
neighbour: Disregard DEAD dst in neigh_update
Jiri Olsa <[email protected]>
bpf: Take module reference for trampoline in module
Lv Yunlong <[email protected]>
gpu/xen: Fix a use after free in xen_drm_drv_init
Daniel Mack <[email protected]>
net: axienet: allow setups without MDIO
Ryan Lee <[email protected]>
ASoC: max98373: Added 30ms turn on/off time delay
Ryan Lee <[email protected]>
ASoC: max98373: Changed amp shutdown register as volatile
Xin Long <[email protected]>
xfrm: BEET mode doesn't support fragments for inner packets
Jiri Kosina <[email protected]>
iwlwifi: Fix softirq/hardirq disabling in iwl_pcie_enqueue_hcmd()
Wang Qing <[email protected]>
arc: kernel: Return -EFAULT if copy_to_user() fails
Tetsuo Handa <[email protected]>
lockdep: Add a missing initialization hint to the "INFO: Trying to register non-static key" message
Dimitar Dimitrov <[email protected]>
remoteproc: pru: Fix loading of GNU Binutils ELF
Tony Lindgren <[email protected]>
ARM: dts: Fix moving mmc devices with aliases for omap4 & 5
Tony Lindgren <[email protected]>
ARM: dts: Drop duplicate sha2md5_fck to fix clk_disable race
Rafael J. Wysocki <[email protected]>
ACPI: x86: Call acpi_boot_table_init() after acpi_table_upgrade()
Dave Jiang <[email protected]>
dmaengine: idxd: fix wq cleanup of WQCFG registers
Dave Jiang <[email protected]>
dmaengine: idxd: clear MSIX permission entry on shutdown
Dan Carpenter <[email protected]>
dmaengine: plx_dma: add a missing put_device() on error path
Lv Yunlong <[email protected]>
dmaengine: Fix a double free in dma_async_device_register
Andy Shevchenko <[email protected]>
dmaengine: dw: Make it dependent to HAS_IOMEM
Dave Jiang <[email protected]>
dmaengine: idxd: fix wq size store permission state
Dave Jiang <[email protected]>
dmaengine: idxd: fix opcap sysfs attribute output
Dave Jiang <[email protected]>
dmaengine: idxd: fix delta_rec and crc size field for completion record
Dave Jiang <[email protected]>
dmaengine: idxd: Fix clobbering of SWERR overflow bit on writeback
Matti Vaittinen <[email protected]>
gpio: sysfs: Obey valid_mask
Fabian Vogt <[email protected]>
Input: nspire-keypad - enable interrupts only when opened
Hauke Mehrtens <[email protected]>
mtd: rawnand: mtk: Fix WAITRDY break condition and timeout
Hans de Goede <[email protected]>
AMD_SFH: Add DMI quirk table for BIOS-es which don't set the activestatus bits
Hans de Goede <[email protected]>
AMD_SFH: Add sensor_mask module parameter
Hans de Goede <[email protected]>
AMD_SFH: Removed unused activecontrolstatus member from the amd_mp2_dev struct
-------------
Diffstat:
Makefile | 4 +- arch/arc/kernel/signal.c | 4 +- arch/arm/Kconfig | 8 +- arch/arm/boot/dts/omap4.dtsi | 5 + arch/arm/boot/dts/omap44xx-clocks.dtsi | 8 -- arch/arm/boot/dts/omap5.dtsi | 5 + arch/arm/mach-footbridge/cats-pci.c | 4 +- arch/arm/mach-footbridge/ebsa285-pci.c | 4 +- arch/arm/mach-footbridge/netwinder-pci.c | 2 +- arch/arm/mach-footbridge/personal-pci.c | 5 +- arch/arm/mach-keystone/keystone.c | 4 +- arch/arm/mach-omap1/ams-delta-fiq-handler.S | 1 + arch/arm/mach-omap2/board-generic.c | 2 +- arch/arm/mach-omap2/sr_device.c | 2 +- arch/arm/mm/mmu.c | 3 +- arch/arm/mm/pmsa-v7.c | 4 +- arch/arm/mm/pmsa-v8.c | 4 +- arch/arm/probes/uprobes/core.c | 4 +- arch/arm64/Kconfig | 6 +- .../boot/dts/allwinner/sun50i-a64-pine64-lts.dts | 4 + .../boot/dts/allwinner/sun50i-a64-sopine.dtsi | 2 +- .../boot/dts/allwinner/sun50i-h6-beelink-gs1.dts | 4 - arch/arm64/include/asm/alternative-macros.h | 8 +- arch/arm64/include/asm/word-at-a-time.h | 10 +- arch/arm64/kernel/entry.S | 10 +- arch/arm64/kernel/sleep.S | 2 +- arch/ia64/configs/generic_defconfig | 2 - arch/powerpc/kernel/signal_32.c | 20 ++- arch/riscv/Kconfig | 2 +- arch/x86/kernel/acpi/wakeup_64.S | 2 +- arch/x86/kernel/setup.c | 5 +- arch/x86/kvm/vmx/nested.c | 42 ++++--- arch/x86/kvm/vmx/vmx.c | 78 ++++++------ arch/x86/kvm/vmx/vmx.h | 25 +++- drivers/dma/dmaengine.c | 1 + drivers/dma/dw/Kconfig | 2 + drivers/dma/idxd/device.c | 65 ++++++++-- drivers/dma/idxd/idxd.h | 3 + drivers/dma/idxd/init.c | 11 +- drivers/dma/idxd/irq.c | 4 +- drivers/dma/idxd/sysfs.c | 19 +-- drivers/dma/plx_dma.c | 18 +-- drivers/gpio/gpiolib-sysfs.c | 8 ++ drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubp.h | 1 + drivers/gpu/drm/i915/display/vlv_dsi.c | 4 +- drivers/gpu/drm/i915/intel_pm.c | 4 +- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 4 +- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 2 + drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 4 + drivers/gpu/drm/xen/xen_drm_front.c | 6 +- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 40 +++++- drivers/hid/amd-sfh-hid/amd_sfh_pcie.h | 1 - drivers/hid/wacom_wac.c | 6 +- drivers/input/keyboard/nspire-keypad.c | 56 +++++---- drivers/input/serio/i8042-x86ia64io.h | 1 + drivers/input/touchscreen/s6sy761.c | 4 +- drivers/md/dm-verity-fec.c | 11 +- drivers/md/dm-verity-fec.h | 1 + drivers/mtd/nand/raw/mtk_nand.c | 4 +- drivers/net/dsa/mv88e6xxx/chip.c | 30 ++--- drivers/net/ethernet/amd/pcnet32.c | 5 +- drivers/net/ethernet/cadence/macb_main.c | 2 +- .../chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 102 ++------------- drivers/net/ethernet/davicom/dm9000.c | 6 +- drivers/net/ethernet/ibm/ibmvnic.c | 25 ++-- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 + drivers/net/ethernet/intel/ice/ice_dcb.c | 4 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 14 ++- drivers/net/ethernet/mellanox/mlx5/core/en/port.c | 23 +--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 3 + drivers/net/ethernet/realtek/r8169_main.c | 18 ++- drivers/net/ethernet/xilinx/xilinx_axienet.h | 12 ++ drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 12 +- drivers/net/phy/marvell.c | 32 ++++- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 1 + drivers/net/wireless/intel/iwlwifi/pcie/tx.c | 7 +- drivers/net/wireless/virt_wifi.c | 5 +- drivers/nvdimm/region_devs.c | 9 +- drivers/remoteproc/pru_rproc.c | 18 +++ drivers/scsi/libsas/sas_ata.c | 9 +- drivers/scsi/scsi_transport_srp.c | 2 +- drivers/vfio/pci/vfio_pci.c | 4 +- fs/readdir.c | 6 + include/linux/bpf.h | 2 + include/linux/kasan.h | 2 +- include/linux/marvell_phy.h | 5 +- include/linux/netfilter_arp/arp_tables.h | 5 +- include/linux/netfilter_bridge/ebtables.h | 5 +- include/uapi/linux/idxd.h | 4 +- kernel/bpf/trampoline.c | 30 +++++ kernel/bpf/verifier.c | 138 ++++++++++++++------- kernel/locking/lockdep.c | 3 +- lib/Kconfig.debug | 6 +- lib/Kconfig.kasan | 9 +- mm/kasan/common.c | 2 +- mm/kasan/kasan.h | 2 +- mm/kasan/report_generic.c | 2 +- mm/ptdump.c | 2 +- net/bridge/netfilter/ebtable_broute.c | 8 +- net/bridge/netfilter/ebtable_filter.c | 8 +- net/bridge/netfilter/ebtable_nat.c | 8 +- net/bridge/netfilter/ebtables.c | 30 ++++- net/core/dev.c | 3 +- net/core/neighbour.c | 2 +- net/ethtool/pause.c | 8 +- net/ieee802154/nl802154.c | 41 ++++++ net/ipv4/netfilter/arp_tables.c | 9 +- net/ipv4/netfilter/arptable_filter.c | 10 +- net/ipv4/sysctl_net_ipv4.c | 16 ++- net/ipv6/ip6_tunnel.c | 10 ++ net/ipv6/sit.c | 4 +- net/mac80211/cfg.c | 4 +- net/netfilter/nf_conntrack_standalone.c | 1 + net/netfilter/nf_flow_table_offload.c | 6 +- net/netfilter/nf_tables_api.c | 46 +++++-- net/netfilter/nft_limit.c | 4 +- net/rds/message.c | 1 + net/rds/send.c | 2 +- net/sctp/socket.c | 13 +- net/tipc/bearer.h | 6 +- net/tipc/net.c | 2 +- net/tipc/node.c | 2 +- net/xfrm/xfrm_output.c | 13 ++ scripts/Makefile.kasan | 20 +-- security/Kconfig.hardening | 4 +- sound/soc/codecs/max98373-i2c.c | 1 + sound/soc/codecs/max98373-sdw.c | 1 + sound/soc/codecs/max98373.c | 2 + sound/soc/fsl/fsl_esai.c | 8 +- tools/include/uapi/asm/errno.h | 2 - tools/lib/bpf/xsk.c | 5 +- 132 files changed, 924 insertions(+), 527 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/122 AMD_SFH: Removed unused activecontrolstatus member from the amd_mp2_dev struct
From: Hans de Goede <[email protected]>
[ Upstream commit a9e54f4b62dcfed4432a5a89b1cd5903737f6e83 ]
This value is only used once inside amd_mp2_get_sensor_num(), so there is no need to store this in the amd_mp2_dev struct, amd_mp2_get_sensor_num() can simple use a local variable for this.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 6 ++++-- drivers/hid/amd-sfh-hid/amd_sfh_pcie.h | 1 - 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +4 -2
@@ -76,9 +76,11 @@ void amd_stop_all_sensors(struct amd_mp2_dev *privdata)int amd_mp2_get_sensor_num (struct amd_mp2_dev *privdata,u8 *sensor_id) {int activestatus, num_of_sensors =0 ; +u32 activecontrolstatus; + + activecontrolstatus =readl (privdata->mmio +AMD_P2C_MSG3 ); + activestatus = activecontrolstatus >>4 ; - privdata->activecontrolstatus =readl (privdata->mmio +AMD_P2C_MSG3 ); - activestatus = privdata->activecontrolstatus >>4 ;if (ACEL_EN & activestatus) sensor_id[num_of_sensors++] = accel_idx;
drivers/hid/amd-sfh-hid/amd_sfh_pcie.h +0 -1
@@ -61,7 +61,6 @@ struct amd_mp2_dev {struct pci_dev *pdev;struct amdtp_cl_data *cl_data;void __iomem *mmio; -u32 activecontrolstatus; };struct amd_mp2_sensor_info {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 2/122 AMD_SFH: Add sensor_mask module parameter
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 952f7d10c6b1685c6700fb24cf4ecbcf26ede77e ]
Add a sensor_mask module parameter which can be used to override the sensor-mask read from the activestatus bits of the AMD_P2C_MSG3 registers. Some BIOS-es do not program the activestatus bits, leading to the AMD-SFH driver not registering any HID devices even though the laptop in question does actually have sensors.
While at it also fix the wrong indentation of the MAGNO_EN define.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +11 -3
@@ -22,9 +22,13 @@#define ACEL_EN BIT(0)#define GYRO_EN BIT(1) -#define MAGNO_EN BIT(2) +#define MAGNO_EN BIT(2)#define ALS_EN BIT(19) +static int sensor_mask_override =-1 ; +module_param_named (sensor_mask, sensor_mask_override, int,0444 ); +MODULE_PARM_DESC (sensor_mask,"override the detected sensors mask" ); +void amd_start_sensor (struct amd_mp2_dev *privdata,struct amd_mp2_sensor_info info) {union sfh_cmd_param cmd_param;
@@ -78,8 +82,12 @@ int amd_mp2_get_sensor_num(struct amd_mp2_dev *privdata, u8 *sensor_id)int activestatus, num_of_sensors =0 ;u32 activecontrolstatus; - activecontrolstatus =readl (privdata->mmio +AMD_P2C_MSG3 ); - activestatus = activecontrolstatus >>4 ; +if (sensor_mask_override >=0 ) { + activestatus = sensor_mask_override; + }else { + activecontrolstatus =readl (privdata->mmio +AMD_P2C_MSG3 ); + activestatus = activecontrolstatus >>4 ; + }if (ACEL_EN & activestatus) sensor_id[num_of_sensors++] = accel_idx;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 3/122 AMD_SFH: Add DMI quirk table for BIOS-es which dont set the activestatus bits
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 25615e454a0ec198254f17d2ed79b607cb755d0e ]
Some BIOS-es do not initialize the activestatus bits of the AMD_P2C_MSG3 register. This cause the AMD_SFH driver to not register any sensors even though the laptops in question do have sensors.
Add a DMI quirk-table for specifying sensor-mask overrides based on DMI match, to make the sensors work OOTB on these laptop models.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +24 -0
@@ -10,6 +10,7 @@#include <linux/bitops.h> #include <linux/delay.h> #include <linux/dma-mapping.h> +#include <linux/dmi.h> #include <linux/interrupt.h> #include <linux/io-64-nonatomic-lo-hi.h> #include <linux/module.h>
@@ -77,11 +78,34 @@ void amd_stop_all_sensors(struct amd_mp2_dev *privdata)writel (cmd_base.ul, privdata->mmio +AMD_C2P_MSG0 ); } +static const struct dmi_system_id dmi_sensor_mask_overrides[] = { + { + .matches = { +DMI_MATCH (DMI_PRODUCT_NAME ,"HP ENVY x360 Convertible 13-ag0xxx" ), + }, + .driver_data = (void *)(ACEL_EN |MAGNO_EN ), + }, + { + .matches = { +DMI_MATCH (DMI_PRODUCT_NAME ,"HP ENVY x360 Convertible 15-cp0xxx" ), + }, + .driver_data = (void *)(ACEL_EN |MAGNO_EN ), + }, + { } +}; +int amd_mp2_get_sensor_num (struct amd_mp2_dev *privdata,u8 *sensor_id) {int activestatus, num_of_sensors =0 ; +const struct dmi_system_id *dmi_id;u32 activecontrolstatus; +if (sensor_mask_override ==-1 ) { + dmi_id =dmi_first_match (dmi_sensor_mask_overrides); +if (dmi_id) + sensor_mask_override = (long )dmi_id->driver_data; + } +if (sensor_mask_override >=0 ) { activestatus = sensor_mask_override; }else {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 4/122 mtd: rawnand: mtk: Fix WAITRDY break condition and timeout
In reply to Greg Kroah-HartmanFrom: Hauke Mehrtens <[email protected]>
[ Upstream commit 2fb164f0ce95e504e2688b4f984893c29ebd19ab ]
This fixes NAND_OP_WAITRDY_INSTR operation in the driver. Without this change the driver waits till the system is busy, but we should wait till the busy flag is cleared. The readl_poll_timeout() function gets a break condition, not a wait condition.
In addition fix the timeout. The timeout_ms is given in ms, but the readl_poll_timeout() function takes the timeout in us. Multiple the given timeout by 1000 to convert it.
Without this change, the driver does not work at all, it doesn't even identify the NAND chip.
--- drivers/mtd/nand/raw/mtk_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/mtk_nand.c +2 -2
@@ -488,8 +488,8 @@ static int mtk_nfc_exec_instr(struct nand_chip *chip,return 0 ;case NAND_OP_WAITRDY_INSTR :return readl_poll_timeout (nfc->regs +NFI_STA , status, - status &STA_BUSY ,20 , - instr->ctx.waitrdy.timeout_ms); + !(status &STA_BUSY ),20 , + instr->ctx.waitrdy.timeout_ms *1000 );default :break ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 5/122 Input: nspire-keypad - enable interrupts only when opened
In reply to Greg Kroah-HartmanFrom: Fabian Vogt <[email protected]>
[ Upstream commit 69d5ff3e9e51e23d5d81bf48480aa5671be67a71 ]
The driver registers an interrupt handler in _probe, but didn't configure them until later when the _open function is called. In between, the keypad can fire an IRQ due to touchpad activity, which the handler ignores. This causes the kernel to disable the interrupt, blocking the keypad from working.
Fix this by disabling interrupts before registering the handler. Additionally, disable them in _close, so that they're only enabled while open.
--- drivers/input/keyboard/nspire-keypad.c | 56 ++++++++++++++------------ 1 file changed, 31 insertions(+), 25 deletions(-)
drivers/input/keyboard/nspire-keypad.c +31 -25
@@ -93,9 +93,15 @@ static irqreturn_t nspire_keypad_irq(int irq, void *dev_id)return IRQ_HANDLED ; } -static int nspire_keypad_chip_init (struct nspire_keypad *keypad) +static int nspire_keypad_open (struct input_dev *input) { +struct nspire_keypad *keypad =input_get_drvdata (input);unsigned long val =0 , cycles_per_us, delay_cycles, row_delay_cycles; +int error; + + error =clk_prepare_enable (keypad->clk); +if (error) +return error; cycles_per_us = (clk_get_rate (keypad->clk) /1000000 );if (cycles_per_us ==0 )
@@ -121,30 +127,6 @@ static int nspire_keypad_chip_init(struct nspire_keypad *keypad) keypad->int_mask =1 <<1 ;writel (keypad->int_mask, keypad->reg_base +KEYPAD_INTMSK ); -/* Disable GPIO interrupts to prevent hanging on touchpad */ -/* Possibly used to detect touchpad events */ -writel (0 , keypad->reg_base +KEYPAD_UNKNOWN_INT ); -/* Acknowledge existing interrupts */ -writel (~0 , keypad->reg_base +KEYPAD_UNKNOWN_INT_STS ); - -return 0 ; -} - -static int nspire_keypad_open (struct input_dev *input) -{ -struct nspire_keypad *keypad =input_get_drvdata (input); -int error; - - error =clk_prepare_enable (keypad->clk); -if (error) -return error; - - error =nspire_keypad_chip_init (keypad); -if (error) { -clk_disable_unprepare (keypad->clk); -return error; - } -return 0 ; }
@@ -152,6 +134,11 @@ static void nspire_keypad_close(struct input_dev *input) {struct nspire_keypad *keypad =input_get_drvdata (input); +/* Disable interrupts */ +writel (0 , keypad->reg_base +KEYPAD_INTMSK ); +/* Acknowledge existing interrupts */ +writel (~0 , keypad->reg_base +KEYPAD_INT ); +clk_disable_unprepare (keypad->clk); }
@@ -210,6 +197,25 @@ static int nspire_keypad_probe(struct platform_device *pdev)return -ENOMEM ; } + error =clk_prepare_enable (keypad->clk); +if (error) { +dev_err (&pdev->dev,"failed to enable clock\n" ); +return error; + } + +/* Disable interrupts */ +writel (0 , keypad->reg_base +KEYPAD_INTMSK ); +/* Acknowledge existing interrupts */ +writel (~0 , keypad->reg_base +KEYPAD_INT ); + +/* Disable GPIO interrupts to prevent hanging on touchpad */ +/* Possibly used to detect touchpad events */ +writel (0 , keypad->reg_base +KEYPAD_UNKNOWN_INT ); +/* Acknowledge existing GPIO interrupts */ +writel (~0 , keypad->reg_base +KEYPAD_UNKNOWN_INT_STS ); + +clk_disable_unprepare (keypad->clk); +input_set_drvdata (input, keypad); input->id.bustype =BUS_HOST ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 6/122 gpio: sysfs: Obey valid_mask
In reply to Greg Kroah-HartmanFrom: Matti Vaittinen <[email protected]>
[ Upstream commit 23cf00ddd2e1aacf1873e43f5e0c519c120daf7a ]
Do not allow exporting GPIOs which are set invalid by the driver's valid mask.
--- drivers/gpio/gpiolib-sysfs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpio/gpiolib-sysfs.c +8 -0
@@ -458,6 +458,8 @@ static ssize_t export_store(struct class *class,long gpio;struct gpio_desc *desc;int status; +struct gpio_chip *gc; +int offset; status =kstrtol (buf,0 , &gpio);if (status <0 )
@@ -469,6 +471,12 @@ static ssize_t export_store(struct class *class,pr_warn ("%s: invalid GPIO %ld\n" , __func__, gpio);return -EINVAL ; } + gc = desc->gdev->chip; + offset =gpio_chip_hwgpio (desc); +if (!gpiochip_line_is_valid (gc, offset)) { +pr_warn ("%s: GPIO %ld masked\n" , __func__, gpio); +return -EINVAL ; + }/* No extra locking here; FLAG_SYSFS just signifies that the * request and export were done by on behalf of userspace, so
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 7/122 dmaengine: idxd: Fix clobbering of SWERR overflow bit on writeback
In reply to Greg Kroah-HartmanFrom: Dave Jiang <[email protected]>
[ Upstream commit ea941ac294d75d0ace50797aebf0056f6f8f7a7f ]
Current code blindly writes over the SWERR and the OVERFLOW bits. Write back the bits actually read instead so the driver avoids clobbering the OVERFLOW bit that comes after the register is read.
--- drivers/dma/idxd/irq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/idxd/irq.c +3 -1
@@ -124,7 +124,9 @@ static int process_misc_interrupts(struct idxd_device *idxd, u32 cause)for (i =0 ; i <4 ; i++) idxd->sw_err.bits[i] =ioread64 (idxd->reg_base +IDXD_SWERR_OFFSET + i *sizeof (u64)); -iowrite64 (IDXD_SWERR_ACK , idxd->reg_base +IDXD_SWERR_OFFSET ); + +iowrite64 (idxd->sw_err.bits[0 ] &IDXD_SWERR_ACK , + idxd->reg_base +IDXD_SWERR_OFFSET );if (idxd->sw_err.valid && idxd->sw_err.wq_idx_valid) {int id = idxd->sw_err.wq_idx;
Signature · 1 line
2.30.2
Re: [PATCH 5.11 007/122] dmaengine: idxd: Fix clobbering of SWERR overflow bit on writeback
Hi!
Quoted 3 lines
Current code blindly writes over the SWERR and the OVERFLOW bits. Write back the bits actually read instead so the driver avoids clobbering the OVERFLOW bit that comes after the register is read.
I believe this is incorrect. Changelog explains that we need to preserve bits in the register...
drivers/dma/idxd/irq.c static int process_misc_interrupts(struct idxd_device *idxd, u32 cause) · line 129
Quoted 12 lines
drivers/dma/idxd/irq.c +3
-1@@ -124,7 +124,9 @@ static int process_misc_interrupts(struct idxd_device *idxd, u32 cause)for (i =0 ; i <4 ; i++) idxd->sw_err.bits[i] =ioread64 (idxd->reg_base +IDXD_SWERR_OFFSET + i *sizeof (u64)); -iowrite64 (IDXD_SWERR_ACK , idxd->reg_base +IDXD_SWERR_OFFSET ); + +iowrite64 (idxd->sw_err.bits[0 ] &IDXD_SWERR_ACK , + idxd->reg_base +IDXD_SWERR_OFFSET );
...but that is not what the code does.
I suspect it should be
drivers/dma/idxd/irq.c static int process_misc_interrupts(struct idxd_device *idxd, u32 cause) · line 131
Quoted 2 lines
drivers/dma/idxd/irq.c +2
-0+iowrite64 (idxd->sw_err.bits[0 ] |IDXD_SWERR_ACK , + idxd->reg_base +IDXD_SWERR_OFFSET );
Best regards,
Pavel
Signature · 1 line
http://www.livejournal.com/~pavelmachek
Re: [PATCH 5.11 007/122] dmaengine: idxd: Fix clobbering of SWERR overflow bit on writeback
Quoted 7 lines · Pavel Machek
Hi!
Quoted 3 lines
Current code blindly writes over the SWERR and the OVERFLOW bits. Write back the bits actually read instead so the driver avoids clobbering the OVERFLOW bit that comes after the register is read.
I believe this is incorrect. Changelog explains that we need to preserve bits in the register...
The code is correct, but I guess maybe badly explained by me. The IDXD_SWERR_ACK mask is IDXD_SWERR_VALID | IDXD_SWERR_OVERFLOW. When we do write 1 to clear, we want to AND the register value that was read with the mask so that we don't blindly clear the overflow bit under the scenario where we read the register and then another error comes in and set the overflow bit while we are in the interrupt handler.
Quoted 22 lines
drivers/dma/idxd/irq.c static int process_misc_interrupts(struct idxd_device *idxd, u32 cause) · line 129
Quoted 13 lines
drivers/dma/idxd/irq.c +3
-1@@ -124,7 +124,9 @@ static int process_misc_interrupts(struct idxd_device *idxd, u32 cause)for (i =0 ; i <4 ; i++) idxd->sw_err.bits[i] =ioread64 (idxd->reg_base +IDXD_SWERR_OFFSET + i *sizeof (u64)); -iowrite64 (IDXD_SWERR_ACK , idxd->reg_base +IDXD_SWERR_OFFSET ); + +iowrite64 (idxd->sw_err.bits[0 ] &IDXD_SWERR_ACK , + idxd->reg_base +IDXD_SWERR_OFFSET );...but that is not what the code does.
I suspect it should be
drivers/dma/idxd/irq.c static int process_misc_interrupts(struct idxd_device *idxd, u32 cause) · line 131
Quoted 2 lines
drivers/dma/idxd/irq.c +2
-0+iowrite64 (idxd->sw_err.bits[0 ] |IDXD_SWERR_ACK , + idxd->reg_base +IDXD_SWERR_OFFSET );Best regards,
Pavel
Greg Kroah-Hartman
maintainerPATCH 8/122 dmaengine: idxd: fix delta_rec and crc size field for completion record
In reply to Greg Kroah-HartmanFrom: Dave Jiang <[email protected]>
[ Upstream commit 4ac823e9cd85f66da274c951d21bf9f6b714b729 ]
The delta_rec_size and crc_val in the completion record should be 32bits and not 16bits.
--- include/uapi/linux/idxd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/idxd.h +2 -2
@@ -247,8 +247,8 @@ struct dsa_completion_record { uint32_t rsvd2:8; }; -uint16_t delta_rec_size; -uint16_t crc_val; +uint32_t delta_rec_size; +uint32_t crc_val;/* DIF check & strip */ struct {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 9/122 dmaengine: idxd: fix opcap sysfs attribute output
In reply to Greg Kroah-HartmanFrom: Dave Jiang <[email protected]>
[ Upstream commit ea6a5735d2a61b938a302eb3629272342a9e7c46 ]
The operation capability register is 256bits. The current output only prints out the first 64bits. Fix to output the entire 256bits. The current code omits operation caps from IAX devices.
--- drivers/dma/idxd/sysfs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/dma/idxd/sysfs.c +7 -1
@@ -1449,8 +1449,14 @@ static ssize_t op_cap_show(struct device *dev, {struct idxd_device *idxd = container_of(dev, struct idxd_device, conf_dev); +int i, rc =0 ; + +for (i =0 ; i <4 ; i++) + rc +=sysfs_emit_at (buf, rc,"%#llx " , idxd->hw.opcap.bits[i]); -return sprintf (buf,"%#llx\n" , idxd->hw.opcap.bits[0 ]); + rc--; + rc +=sysfs_emit_at (buf, rc,"\n" ); +return rc; }static DEVICE_ATTR_RO (op_cap);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 10/122 dmaengine: idxd: fix wq size store permission state
In reply to Greg Kroah-HartmanFrom: Dave Jiang <[email protected]>
[ Upstream commit 0fff71c5a311e1264988179f7dcc217fda15fadd ]
WQ size can only be changed when the device is disabled. Current code allows change when device is enabled but wq is disabled. Change the check to detect device state.
--- drivers/dma/idxd/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/idxd/sysfs.c +1 -1
@@ -989,7 +989,7 @@ static ssize_t wq_size_store(struct device *dev,if (!test_bit (IDXD_FLAG_CONFIGURABLE , &idxd->flags))return -EPERM ; -if (wq->state !=IDXD_WQ_DISABLED ) +if (idxd->state ==IDXD_DEV_ENABLED )return -EPERM ;if (size +total_claimed_wq_size (idxd) - wq->size > idxd->max_wq_size)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 11/122 dmaengine: dw: Make it dependent to HAS_IOMEM
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 88cd1d6191b13689094310c2405394e4ce36d061 ]
Some architectures do not provide devm_*() APIs. Hence make the driver dependent on HAVE_IOMEM.
--- drivers/dma/dw/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/dw/Kconfig +2 -0
@@ -10,6 +10,7 @@ config DW_DMAC_CORE config DW_DMAC tristate "Synopsys DesignWare AHB DMA platform driver" + depends on HAS_IOMEM select DW_DMAC_CORE help Support the Synopsys DesignWare AHB DMA controller. This
@@ -18,6 +19,7 @@ config DW_DMAC config DW_DMAC_PCI tristate "Synopsys DesignWare AHB DMA PCI driver" depends on PCI + depends on HAS_IOMEM select DW_DMAC_CORE help Support the Synopsys DesignWare AHB DMA controller on the
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 12/122 dmaengine: Fix a double free in dma_async_device_register
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit ea45b6008f8095db0cc09ad6e03c7785c2986197 ]
In the first list_for_each_entry() macro of dma_async_device_register, it gets the chan from list and calls __dma_async_device_channel_register (..,chan). We can see that chan->local is allocated by alloc_percpu() and it is freed chan->local by free_percpu(chan->local) when __dma_async_device_channel_register() failed.
But after __dma_async_device_channel_register() failed, the caller will goto err_out and freed the chan->local in the second time by free_percpu().
The cause of this problem is forget to set chan->local to NULL when chan->local was freed in __dma_async_device_channel_register(). My patch sets chan->local to NULL when the callee failed to avoid double free.
--- drivers/dma/dmaengine.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/dmaengine.c +1 -0
@@ -1086,6 +1086,7 @@ static int __dma_async_device_channel_register(struct dma_device *device,kfree (chan->dev); err_free_local:free_percpu (chan->local); + chan->local =NULL ;return rc; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 13/122 dmaengine: plx_dma: add a missing put_device() on error path
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 07503e6aefe4a6efd777062191944a14f03b3a18 ]
Add a missing put_device(&pdev->dev) if the call to dma_async_device_register(dma); fails.
--- drivers/dma/plx_dma.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/dma/plx_dma.c +11 -7
@@ -507,10 +507,8 @@ static int plx_dma_create(struct pci_dev *pdev) rc =request_irq (pci_irq_vector (pdev,0 ), plx_dma_isr,0 ,KBUILD_MODNAME , plxdev); -if (rc) { -kfree (plxdev); -return rc; - } +if (rc) + goto free_plx;spin_lock_init (&plxdev->ring_lock);tasklet_setup (&plxdev->desc_task, plx_dma_desc_task);
@@ -540,14 +538,20 @@ static int plx_dma_create(struct pci_dev *pdev) rc =dma_async_device_register (dma);if (rc) {pci_err (pdev,"Failed to register dma device: %d\n" , rc); -free_irq (pci_irq_vector (pdev,0 ), plxdev); -kfree (plxdev); -return rc; + goto put_device; }pci_set_drvdata (pdev, plxdev);return 0 ; + +put_device: +put_device (&pdev->dev); +free_irq (pci_irq_vector (pdev,0 ), plxdev); +free_plx: +kfree (plxdev); + +return rc; } static int plx_dma_probe(struct pci_dev *pdev,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 14/122 dmaengine: idxd: clear MSIX permission entry on shutdown
In reply to Greg Kroah-HartmanFrom: Dave Jiang <[email protected]>
[ Upstream commit 6df0e6c57dfc064af330071f372f11aa8c584997 ]
Add disabling/clearing of MSIX permission entries on device shutdown to mirror the enabling of the MSIX entries on probe. Current code left the MSIX enabled and the pasid entries still programmed at device shutdown.
--- drivers/dma/idxd/device.c | 30 ++++++++++++++++++++++++++++++ drivers/dma/idxd/idxd.h | 2 ++ drivers/dma/idxd/init.c | 11 ++--------- 3 files changed, 34 insertions(+), 9 deletions(-)
drivers/dma/idxd/device.c +30 -0
@@ -574,6 +574,36 @@ void idxd_device_drain_pasid(struct idxd_device *idxd, int pasid) }/* Device configuration bits */ +void idxd_msix_perm_setup (struct idxd_device *idxd) +{ +union msix_perm mperm; +int i, msixcnt; + + msixcnt =pci_msix_vec_count (idxd->pdev); +if (msixcnt <0 ) +return ; + + mperm.bits =0 ; + mperm.pasid = idxd->pasid; + mperm.pasid_en =device_pasid_enabled (idxd); +for (i =1 ; i < msixcnt; i++) +iowrite32 (mperm.bits, idxd->reg_base + idxd->msix_perm_offset + i *8 ); +} + +void idxd_msix_perm_clear (struct idxd_device *idxd) +{ +union msix_perm mperm; +int i, msixcnt; + + msixcnt =pci_msix_vec_count (idxd->pdev); +if (msixcnt <0 ) +return ; + + mperm.bits =0 ; +for (i =1 ; i < msixcnt; i++) +iowrite32 (mperm.bits, idxd->reg_base + idxd->msix_perm_offset + i *8 ); +} +static void idxd_group_config_write (struct idxd_group *group) {struct idxd_device *idxd = group->idxd;
drivers/dma/idxd/idxd.h +2 -0
@@ -316,6 +316,8 @@ void idxd_unregister_driver(void);struct bus_type *idxd_get_bus_type (struct idxd_device *idxd);/* device interrupt control */ +void idxd_msix_perm_setup (struct idxd_device *idxd); +void idxd_msix_perm_clear (struct idxd_device *idxd);irqreturn_t idxd_irq_handler (int vec,void *data);irqreturn_t idxd_misc_thread (int vec,void *data);irqreturn_t idxd_wq_thread (int irq,void *data);
drivers/dma/idxd/init.c +2 -9
@@ -61,7 +61,6 @@ static int idxd_setup_interrupts(struct idxd_device *idxd)struct idxd_irq_entry *irq_entry;int i, msixcnt;int rc =0 ; -union msix_perm mperm; msixcnt =pci_msix_vec_count (pdev);if (msixcnt <0 ) {
@@ -140,14 +139,7 @@ static int idxd_setup_interrupts(struct idxd_device *idxd) }idxd_unmask_error_interrupts (idxd); - -/* Setup MSIX permission table */ - mperm.bits =0 ; - mperm.pasid = idxd->pasid; - mperm.pasid_en =device_pasid_enabled (idxd); -for (i =1 ; i < msixcnt; i++) -iowrite32 (mperm.bits, idxd->reg_base + idxd->msix_perm_offset + i *8 ); - +idxd_msix_perm_setup (idxd);return 0 ; err_no_irq:
@@ -504,6 +496,7 @@ static void idxd_shutdown(struct pci_dev *pdev)idxd_flush_work_list (irq_entry); } +idxd_msix_perm_clear (idxd);destroy_workqueue (idxd->wq); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 15/122 dmaengine: idxd: fix wq cleanup of WQCFG registers
In reply to Greg Kroah-HartmanFrom: Dave Jiang <[email protected]>
[ Upstream commit ea9aadc06a9f10ad20a90edc0a484f1147d88a7a ]
A pre-release silicon erratum workaround where wq reset does not clear WQCFG registers was leaked into upstream code. Use wq reset command instead of blasting the MMIO region. This also address an issue where we clobber registers in future devices.
--- drivers/dma/idxd/device.c | 35 ++++++++++++++++++++++++----------- drivers/dma/idxd/idxd.h | 1 + drivers/dma/idxd/sysfs.c | 9 ++------- 3 files changed, 27 insertions(+), 18 deletions(-)
drivers/dma/idxd/device.c +24 -11
@@ -282,6 +282,22 @@ void idxd_wq_drain(struct idxd_wq *wq)idxd_cmd_exec (idxd,IDXD_CMD_DRAIN_WQ , operand,NULL ); } +void idxd_wq_reset (struct idxd_wq *wq) +{ +struct idxd_device *idxd = wq->idxd; +struct device *dev = &idxd->pdev->dev; +u32 operand; + +if (wq->state !=IDXD_WQ_ENABLED ) { +dev_dbg (dev,"WQ %d in wrong state: %d\n" , wq->id, wq->state); +return ; + } + + operand =BIT (wq->id %16 ) | ((wq->id /16 ) <<16 ); +idxd_cmd_exec (idxd,IDXD_CMD_RESET_WQ , operand,NULL ); + wq->state =IDXD_WQ_DISABLED ; +} +int idxd_wq_map_portal (struct idxd_wq *wq) {struct idxd_device *idxd = wq->idxd;
@@ -363,8 +379,6 @@ int idxd_wq_disable_pasid(struct idxd_wq *wq)void idxd_wq_disable_cleanup (struct idxd_wq *wq) {struct idxd_device *idxd = wq->idxd; -struct device *dev = &idxd->pdev->dev; -int i, wq_offset;lockdep_assert_held (&idxd->dev_lock);memset (wq->wqcfg,0 , idxd->wqcfg_size);
@@ -376,14 +390,6 @@ void idxd_wq_disable_cleanup(struct idxd_wq *wq) wq->ats_dis =0 ;clear_bit (WQ_FLAG_DEDICATED , &wq->flags);memset (wq->name,0 ,WQ_NAME_SIZE ); - -for (i =0 ; i <WQCFG_STRIDES (idxd); i++) { - wq_offset =WQCFG_OFFSET (idxd, wq->id, i); -iowrite32 (0 , idxd->reg_base + wq_offset); -dev_dbg (dev,"WQ[%d][%d][%#x]: %#x\n" , - wq->id, i, wq_offset, -ioread32 (idxd->reg_base + wq_offset)); - } }/* Device control bits */
@@ -672,7 +678,14 @@ static int idxd_wq_config_write(struct idxd_wq *wq)if (!wq->group)return 0 ; -memset (wq->wqcfg,0 , idxd->wqcfg_size); +/* +* Instead of memset the entire shadow copy of WQCFG, copy from the hardware after +* wq reset. This will copy back the sticky values that are present on some devices. +*/ +for (i =0 ; i <WQCFG_STRIDES (idxd); i++) { + wq_offset =WQCFG_OFFSET (idxd, wq->id, i); + wq->wqcfg->bits[i] =ioread32 (idxd->reg_base + wq_offset); + }/* byte 0-3 */ wq->wqcfg->wq_size = wq->size;
drivers/dma/idxd/idxd.h +1 -0
@@ -343,6 +343,7 @@ void idxd_wq_free_resources(struct idxd_wq *wq);int idxd_wq_enable (struct idxd_wq *wq);int idxd_wq_disable (struct idxd_wq *wq);void idxd_wq_drain (struct idxd_wq *wq); +void idxd_wq_reset (struct idxd_wq *wq);int idxd_wq_map_portal (struct idxd_wq *wq);void idxd_wq_unmap_portal (struct idxd_wq *wq);void idxd_wq_disable_cleanup (struct idxd_wq *wq);
drivers/dma/idxd/sysfs.c +2 -7
@@ -275,7 +275,6 @@ static void disable_wq(struct idxd_wq *wq) {struct idxd_device *idxd = wq->idxd;struct device *dev = &idxd->pdev->dev; -int rc;mutex_lock (&wq->wq_lock);dev_dbg (dev,"%s removing WQ %s\n" , __func__,dev_name (&wq->conf_dev));
@@ -296,17 +295,13 @@ static void disable_wq(struct idxd_wq *wq)idxd_wq_unmap_portal (wq);idxd_wq_drain (wq); - rc =idxd_wq_disable (wq); +idxd_wq_reset (wq);idxd_wq_free_resources (wq); wq->client_count =0 ;mutex_unlock (&wq->wq_lock); -if (rc <0 ) -dev_warn (dev,"Failed to disable %s: %d\n" , -dev_name (&wq->conf_dev), rc); -else -dev_info (dev,"wq %s disabled\n" ,dev_name (&wq->conf_dev)); +dev_info (dev,"wq %s disabled\n" ,dev_name (&wq->conf_dev)); }static int idxd_config_bus_remove (struct device *dev)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 16/122 ACPI: x86: Call acpi_boot_table_init() after acpi_table_upgrade()
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit 6998a8800d73116187aad542391ce3b2dd0f9e30 ]
Commit 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables") attempted to address an issue with reserving the memory occupied by ACPI tables, but it broke the initrd-based table override mechanism relied on by multiple users.
To restore the initrd-based ACPI table override functionality, move the acpi_boot_table_init() invocation in setup_arch() on x86 after the acpi_table_upgrade() one.
--- arch/x86/kernel/setup.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kernel/setup.c +2 -3
@@ -1046,9 +1046,6 @@ void __init setup_arch(char **cmdline_p)cleanup_highmap (); -/* Look for ACPI tables and reserve memory occupied by them. */ -acpi_boot_table_init (); -memblock_set_current_limit (ISA_END_ADDRESS );e820__memblock_setup ();
@@ -1133,6 +1130,8 @@ void __init setup_arch(char **cmdline_p)reserve_initrd ();acpi_table_upgrade (); +/* Look for ACPI tables and reserve memory occupied by them. */ +acpi_boot_table_init ();vsmp_init ();
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 17/122 ARM: dts: Drop duplicate sha2md5_fck to fix clk_disable race
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 140a776833957539c84301dbdb4c3013876de118 ]
We have a duplicate legacy clock defined for sha2md5_fck that can sometimes race with clk_disable() with the dts configured clock for OMAP4_SHA2MD5_CLKCTRL when unused clocks are disabled during boot causing an "Unhandled fault: imprecise external abort".
--- arch/arm/boot/dts/omap44xx-clocks.dtsi | 8 -------- 1 file changed, 8 deletions(-)
arch/arm/boot/dts/omap44xx-clocks.dtsi +0 -8
@@ -770,14 +770,6 @@ ti,max-div = <2>; }; - sha2md5_fck: sha2md5_fck@15c8 { - #clock-cells = <0>; - compatible = "ti,gate-clock"; - clocks = <&l3_div_ck>; - ti,bit-shift = <1>; - reg = <0x15c8>; - }; - usb_phy_cm_clk32k: usb_phy_cm_clk32k@640 { #clock-cells = <0>; compatible = "ti,gate-clock";
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 18/122 ARM: dts: Fix moving mmc devices with aliases for omap4 & 5
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 77335a040178a0456d4eabc8bf17a7ca3ee4a327 ]
Fix moving mmc devices with dts aliases as discussed on the lists. Without this we now have internal eMMC mmc1 show up as mmc2 compared to the earlier order of devices.
--- arch/arm/boot/dts/omap4.dtsi | 5 +++++ arch/arm/boot/dts/omap5.dtsi | 5 +++++ 2 files changed, 10 insertions(+)
arch/arm/boot/dts/omap4.dtsi +5 -0
@@ -22,6 +22,11 @@ i2c1 = &i2c2; i2c2 = &i2c3; i2c3 = &i2c4; + mmc0 = &mmc1; + mmc1 = &mmc2; + mmc2 = &mmc3; + mmc3 = &mmc4; + mmc4 = &mmc5; serial0 = &uart1; serial1 = &uart2; serial2 = &uart3;
arch/arm/boot/dts/omap5.dtsi +5 -0
@@ -25,6 +25,11 @@ i2c2 = &i2c3; i2c3 = &i2c4; i2c4 = &i2c5; + mmc0 = &mmc1; + mmc1 = &mmc2; + mmc2 = &mmc3; + mmc3 = &mmc4; + mmc4 = &mmc5; serial0 = &uart1; serial1 = &uart2; serial2 = &uart3;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 19/122 remoteproc: pru: Fix loading of GNU Binutils ELF
In reply to Greg Kroah-HartmanFrom: Dimitar Dimitrov <[email protected]>
[ Upstream commit e6d9423d31b2f9bdd0220fd0584e3bb6ed2c4e52 ]
PRU port of GNU Binutils lacks support for separate address spaces. PRU IRAM addresses are marked with artificial offset to differentiate them from DRAM addresses. Hence remoteproc must mask IRAM addresses coming from GNU ELF in order to get the true hardware address.
PRU firmware used for testing was the example in:
https://github.com/dinuxbg/pru-gcc-examples/tree/master/blinking-led/pru
--- drivers/remoteproc/pru_rproc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/remoteproc/pru_rproc.c +18 -0
@@ -450,6 +450,24 @@ static void *pru_i_da_to_va(struct pru_rproc *pru, u32 da, size_t len)if (len ==0 )return NULL ; +/* +* GNU binutils do not support multiple address spaces. The GNU +* linker's default linker script places IRAM at an arbitrary high +* offset, in order to differentiate it from DRAM. Hence we need to +* strip the artificial offset in the IRAM addresses coming from the +* ELF file. +* +* The TI proprietary linker would never set those higher IRAM address +* bits anyway. PRU architecture limits the program counter to 16-bit +* word-address range. This in turn corresponds to 18-bit IRAM +* byte-address range for ELF. +* +* Two more bits are added just in case to make the final 20-bit mask. +* Idea is to have a safeguard in case TI decides to add banking +* in future SoCs. +*/ + da &=0xfffff ; +if (da >=PRU_IRAM_DA && da + len <=PRU_IRAM_DA + pru->mem_regions[PRU_IOMEM_IRAM ].size) { offset = da -PRU_IRAM_DA ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 20/122 lockdep: Add a missing initialization hint to the "INFO: Trying to register non-static key" message
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 3a85969e9d912d5dd85362ee37b5f81266e00e77 ]
Since this message is printed when dynamically allocated spinlocks (e.g. kzalloc()) are used without initialization (e.g. spin_lock_init()), suggest to developers to check whether initialization functions for objects were called, before making developers wonder what annotation is missing.
[ mingo: Minor tweaks to the message. ]
--- kernel/locking/lockdep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/locking/lockdep.c +2 -1
@@ -930,7 +930,8 @@ static bool assign_lock_key(struct lockdep_map *lock)/* Debug-check: all keys must be persistent! */ debug_locks_off ();pr_err ("INFO: trying to register non-static key.\n" ); -pr_err ("the code is fine but needs lockdep annotation.\n" ); +pr_err ("The code is fine but needs lockdep annotation, or maybe\n" ); +pr_err ("you didn't initialize this object before use?\n" );pr_err ("turning off the locking correctness validator.\n" );dump_stack ();return false;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 21/122 arc: kernel: Return -EFAULT if copy_to_user() fails
In reply to Greg Kroah-HartmanFrom: Wang Qing <[email protected]>
[ Upstream commit 46e152186cd89d940b26726fff11eb3f4935b45a ]
The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete.
--- arch/arc/kernel/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arc/kernel/signal.c +2 -2
@@ -96,7 +96,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, sizeof(sf->uc.uc_mcontext.regs.scratch)); err |=__copy_to_user (&sf->uc.uc_sigmask, set,sizeof (sigset_t)); -return err; +return err ? -EFAULT :0 ; }static int restore_usr_regs (struct pt_regs *regs,struct rt_sigframe __user *sf)
@@ -110,7 +110,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) &(sf->uc.uc_mcontext.regs.scratch), sizeof(sf->uc.uc_mcontext.regs.scratch));if (err) -return err; +return -EFAULT ;set_current_blocked (&set); regs->bta = uregs.scratch.bta;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 22/122 iwlwifi: Fix softirq/hardirq disabling in iwl_pcie_enqueue_hcmd()
In reply to Greg Kroah-HartmanFrom: Jiri Kosina <[email protected]>
[ Upstream commit 2800aadc18a64c96b051bcb7da8a7df7d505db3f ]
It's possible for iwl_pcie_enqueue_hcmd() to be called with hard IRQs disabled (e.g. from LED core). We can't enable BHs in such a situation.
Turn the unconditional BH-enable/BH-disable code into hardirq-disable/conditional-enable.
This fixes the warning below.
WARNING: CPU: 1 PID: 1139 at kernel/softirq.c:178 __local_bh_enable_ip+0xa5/0xf0 CPU: 1 PID: 1139 Comm: NetworkManager Not tainted 5.12.0-rc1-00004-gb4ded168af79 #7 Hardware name: LENOVO 20K5S22R00/20K5S22R00, BIOS R0IET38W (1.16 ) 05/31/2017 RIP: 0010:__local_bh_enable_ip+0xa5/0xf0 Code: f7 69 e8 ee 23 14 00 fb 66 0f 1f 44 00 00 65 8b 05 f0 f4 f7 69 85 c0 74 3f 48 83 c4 08 5b c3 65 8b 05 9b fe f7 69 85 c0 75 8e <0f> 0b eb 8a 48 89 3c 24 e8 4e 20 14 00 48 8b 3c 24 eb 91 e8 13 4e RSP: 0018:ffffafd580b13298 EFLAGS: 00010046 RAX: 0000000000000000 RBX: 0000000000000201 RCX: 0000000000000000 RDX: 0000000000000003 RSI: 0000000000000201 RDI: ffffffffc1272389 RBP: ffff96517ae4c018 R08: 0000000000000001 R09: 0000000000000000 R10: ffffafd580b13178 R11: 0000000000000001 R12: ffff96517b060000 R13: 0000000000000000 R14: ffffffff80000000 R15: 0000000000000001 FS: 00007fc604ebefc0(0000) GS:ffff965267480000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055fb3fef13b2 CR3: 0000000109112004 CR4: 00000000003706e0 Call Trace: ? _raw_spin_unlock_bh+0x1f/0x30 iwl_pcie_enqueue_hcmd+0x5d9/0xa00 [iwlwifi] iwl_trans_txq_send_hcmd+0x6c/0x430 [iwlwifi] iwl_trans_send_cmd+0x88/0x170 [iwlwifi] ? lock_acquire+0x277/0x3d0 iwl_mvm_send_cmd+0x32/0x80 [iwlmvm] iwl_mvm_led_set+0xc2/0xe0 [iwlmvm] ? led_trigger_event+0x46/0x70 led_trigger_event+0x46/0x70 ieee80211_do_open+0x5c5/0xa20 [mac80211] ieee80211_open+0x67/0x90 [mac80211] __dev_open+0xd4/0x150 __dev_change_flags+0x19e/0x1f0 dev_change_flags+0x23/0x60 do_setlink+0x30d/0x1230 ? lock_is_held_type+0xb4/0x120 ? __nla_validate_parse.part.7+0x57/0xcb0 ? __lock_acquire+0x2e1/0x1a50 __rtnl_newlink+0x560/0x910 ? __lock_acquire+0x2e1/0x1a50 ? __lock_acquire+0x2e1/0x1a50 ? lock_acquire+0x277/0x3d0 ? sock_def_readable+0x5/0x290 ? lock_is_held_type+0xb4/0x120 ? find_held_lock+0x2d/0x90 ? sock_def_readable+0xb3/0x290 ? lock_release+0x166/0x2a0 ? lock_is_held_type+0x90/0x120 rtnl_newlink+0x47/0x70 rtnetlink_rcv_msg+0x25c/0x470 ? netlink_deliver_tap+0x97/0x3e0 ? validate_linkmsg+0x350/0x350 netlink_rcv_skb+0x50/0x100 netlink_unicast+0x1b2/0x280 netlink_sendmsg+0x336/0x450 sock_sendmsg+0x5b/0x60 ____sys_sendmsg+0x1ed/0x250 ? copy_msghdr_from_user+0x5c/0x90 ___sys_sendmsg+0x88/0xd0 ? lock_is_held_type+0xb4/0x120 ? find_held_lock+0x2d/0x90 ? lock_release+0x166/0x2a0 ? __fget_files+0xfe/0x1d0 ? __sys_sendmsg+0x5e/0xa0 __sys_sendmsg+0x5e/0xa0 ? lockdep_hardirqs_on_prepare+0xd9/0x170 do_syscall_64+0x33/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fc605c9572d Code: 28 89 54 24 1c 48 89 74 24 10 89 7c 24 08 e8 da ee ff ff 8b 54 24 1c 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 33 44 89 c7 48 89 44 24 08 e8 2e ef ff ff 48 RSP: 002b:00007fffc83789f0 EFLAGS: 00000293 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 000055ef468570c0 RCX: 00007fc605c9572d RDX: 0000000000000000 RSI: 00007fffc8378a30 RDI: 000000000000000c RBP: 0000000000000010 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000 R13: 00007fffc8378b80 R14: 00007fffc8378b7c R15: 0000000000000000 irq event stamp: 170785 hardirqs last enabled at (170783): [<ffffffff9609a8c2>] __local_bh_enable_ip+0x82/0xf0 hardirqs last disabled at (170784): [<ffffffff96a8613d>] _raw_read_lock_irqsave+0x8d/0x90 softirqs last enabled at (170782): [<ffffffffc1272389>] iwl_pcie_enqueue_hcmd+0x5d9/0xa00 [iwlwifi] softirqs last disabled at (170785): [<ffffffffc1271ec6>] iwl_pcie_enqueue_hcmd+0x116/0xa00 [iwlwifi]
--- drivers/net/wireless/intel/iwlwifi/pcie/tx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/tx.c +4 -3
@@ -929,6 +929,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,u32 cmd_pos;const u8 *cmddata[IWL_MAX_CMD_TBS_PER_TFD ];u16 cmdlen[IWL_MAX_CMD_TBS_PER_TFD ]; +unsigned long flags; if (WARN(!trans->wide_cmd_header && group_id > IWL_ALWAYS_LONG_GROUP,
@@ -1012,10 +1013,10 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, goto free_dup_buf; } -spin_lock_bh (&txq->lock); +spin_lock_irqsave (&txq->lock, flags);if (iwl_txq_space (trans, txq) < ((cmd->flags &CMD_ASYNC ) ?2 :1 )) { -spin_unlock_bh (&txq->lock); +spin_unlock_irqrestore (&txq->lock, flags);IWL_ERR (trans,"No space in command queue\n" );iwl_op_mode_cmd_queue_full (trans->op_mode);
@@ -1175,7 +1176,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, unlock_reg:spin_unlock (&trans_pcie->reg_lock); out: -spin_unlock_bh (&txq->lock); +spin_unlock_irqrestore (&txq->lock, flags); free_dup_buf:if (idx <0 )kfree (dup_buf);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 23/122 xfrm: BEET mode doesnt support fragments for inner packets
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 68dc022d04eb0fd60a540e242dcb11ec1bee07e2 ]
BEET mode replaces the IP(6) Headers with new IP(6) Headers when sending packets. However, when it's a fragment before the replacement, currently kernel keeps the fragment flag and replace the address field then encaps it with ESP. It would cause in RX side the fragments to get reassembled before decapping with ESP, which is incorrect.
In Xiumei's testing, these fragments went over an xfrm interface and got encapped with ESP in the device driver, and the traffic was broken.
I don't have a good way to fix it, but only to warn this out in dmesg.
--- net/xfrm/xfrm_output.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/xfrm/xfrm_output.c +13 -0
@@ -660,6 +660,12 @@ static int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb) {int err; +if (x->outer_mode.encap ==XFRM_MODE_BEET && +ip_is_fragment (ip_hdr (skb))) { +net_warn_ratelimited ("BEET mode doesn't support inner IPv4 fragments\n" ); +return -EAFNOSUPPORT ; + } + err =xfrm4_tunnel_check_size (skb);if (err)return err;
@@ -705,8 +711,15 @@ out:static int xfrm6_extract_output (struct xfrm_state *x,struct sk_buff *skb) {#if IS_ENABLED (CONFIG_IPV6 ) +unsigned int ptr =0 ;int err; +if (x->outer_mode.encap ==XFRM_MODE_BEET && +ipv6_find_hdr (skb, &ptr,NEXTHDR_FRAGMENT ,NULL ,NULL ) >=0 ) { +net_warn_ratelimited ("BEET mode doesn't support inner IPv6 fragments\n" ); +return -EAFNOSUPPORT ; + } + err =xfrm6_tunnel_check_size (skb);if (err)return err;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 24/122 ASoC: max98373: Changed amp shutdown register as volatile
In reply to Greg Kroah-HartmanFrom: Ryan Lee <[email protected]>
[ Upstream commit a23f9099ff1541f15704e96b784d3846d2a4483d ]
0x20FF(amp global enable) register was defined as non-volatile, but it is not. Overheating, overcurrent can cause amp shutdown in hardware.
'regmap_write' compare register readback value before writing to avoid same value writing. 'regmap_read' just read cache not actual hardware value for the non-volatile register. When amp is internally shutdown by some reason, next 'AMP ON' command can be ignored because regmap think amp is already ON.
--- sound/soc/codecs/max98373-i2c.c | 1 + sound/soc/codecs/max98373-sdw.c | 1 + 2 files changed, 2 insertions(+)
sound/soc/codecs/max98373-i2c.c +1 -0
@@ -446,6 +446,7 @@ static bool max98373_volatile_reg(struct device *dev, unsigned int reg)case MAX98373_R2054_MEAS_ADC_PVDD_CH_READBACK :case MAX98373_R2055_MEAS_ADC_THERM_CH_READBACK :case MAX98373_R20B6_BDE_CUR_STATE_READBACK : +case MAX98373_R20FF_GLOBAL_SHDN :case MAX98373_R21FF_REV_ID :return true;default :
sound/soc/codecs/max98373-sdw.c +1 -0
@@ -220,6 +220,7 @@ static bool max98373_volatile_reg(struct device *dev, unsigned int reg)case MAX98373_R2054_MEAS_ADC_PVDD_CH_READBACK :case MAX98373_R2055_MEAS_ADC_THERM_CH_READBACK :case MAX98373_R20B6_BDE_CUR_STATE_READBACK : +case MAX98373_R20FF_GLOBAL_SHDN :case MAX98373_R21FF_REV_ID :/* SoundWire Control Port Registers */ case MAX98373_R0040_SCP_INIT_STAT_1 ... MAX98373_R0070_SCP_FRAME_CTLR:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 25/122 ASoC: max98373: Added 30ms turn on/off time delay
In reply to Greg Kroah-HartmanFrom: Ryan Lee <[email protected]>
[ Upstream commit 3a27875e91fb9c29de436199d20b33f9413aea77 ]
Amp requires 10 ~ 30ms for the power ON and OFF.
Added 30ms delay for stability.
--- sound/soc/codecs/max98373.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/codecs/max98373.c +2 -0
@@ -28,11 +28,13 @@ static int max98373_dac_event(struct snd_soc_dapm_widget *w,regmap_update_bits (max98373->regmap,MAX98373_R20FF_GLOBAL_SHDN ,MAX98373_GLOBAL_EN_MASK ,1 ); +usleep_range (30000 ,31000 );break ;case SND_SOC_DAPM_POST_PMD :regmap_update_bits (max98373->regmap,MAX98373_R20FF_GLOBAL_SHDN ,MAX98373_GLOBAL_EN_MASK ,0 ); +usleep_range (30000 ,31000 ); max98373->tdm_mode = false;break ;default :
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 26/122 net: axienet: allow setups without MDIO
In reply to Greg Kroah-HartmanFrom: Daniel Mack <[email protected]>
[ Upstream commit de9c7854e6e1589f639c6352112956d08243b659 ]
In setups with fixed-link settings there is no mdio node in DTS. axienet_probe() already handles that gracefully but lp->mii_bus is then NULL.
Fix code that tries to blindly grab the MDIO lock by introducing two helper functions that make the locking conditional.
--- drivers/net/ethernet/xilinx/xilinx_axienet.h | 12 ++++++++++++ drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 12 ++++++------ 2 files changed, 18 insertions(+), 6 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet.h +12 -0
@@ -497,6 +497,18 @@ static inline u32 axinet_ior_read_mcr(struct axienet_local *lp)return axienet_ior (lp,XAE_MDIO_MCR_OFFSET ); } +static inline void axienet_lock_mii (struct axienet_local *lp) +{ +if (lp->mii_bus) +mutex_lock (&lp->mii_bus->mdio_lock); +} + +static inline void axienet_unlock_mii (struct axienet_local *lp) +{ +if (lp->mii_bus) +mutex_unlock (&lp->mii_bus->mdio_lock); +} +/** * axienet_iow - Memory mapped Axi Ethernet register write * @lp: Pointer to axienet local structure
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +6 -6
@@ -1053,9 +1053,9 @@ static int axienet_open(struct net_device *ndev)* including the MDIO. MDIO must be disabled before resetting. * Hold MDIO bus lock to avoid MDIO accesses during the reset. */ -mutex_lock (&lp->mii_bus->mdio_lock); +axienet_lock_mii (lp); ret =axienet_device_reset (ndev); -mutex_unlock (&lp->mii_bus->mdio_lock); +axienet_unlock_mii (lp); ret =phylink_of_phy_connect (lp->phylink, lp->dev->of_node,0 );if (ret) {
@@ -1148,9 +1148,9 @@ static int axienet_stop(struct net_device *ndev) }/* Do a reset to ensure DMA is really stopped */ -mutex_lock (&lp->mii_bus->mdio_lock); +axienet_lock_mii (lp);__axienet_device_reset (lp); -mutex_unlock (&lp->mii_bus->mdio_lock); +axienet_unlock_mii (lp);cancel_work_sync (&lp->dma_err_task);
@@ -1664,9 +1664,9 @@ static void axienet_dma_err_handler(struct work_struct *work)* including the MDIO. MDIO must be disabled before resetting. * Hold MDIO bus lock to avoid MDIO accesses during the reset. */ -mutex_lock (&lp->mii_bus->mdio_lock); +axienet_lock_mii (lp);__axienet_device_reset (lp); -mutex_unlock (&lp->mii_bus->mdio_lock); +axienet_unlock_mii (lp);for (i =0 ; i < lp->tx_bd_num; i++) { cur_p = &lp->tx_bd_v[i];
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 27/122 gpu/xen: Fix a use after free in xen_drm_drv_init
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit 52762efa2b256ed1c5274e5177cbd52ee11a2f6a ]
In function displback_changed, has the call chain displback_connect(front_info)->xen_drm_drv_init(front_info). We can see that drm_info is assigned to front_info->drm_info and drm_info is freed in fail branch in xen_drm_drv_init().
Later displback_disconnect(front_info) is called and it calls xen_drm_drv_fini(front_info) cause a use after free by drm_info = front_info->drm_info statement.
My patch has done two things. First fixes the fail label which drm_info = kzalloc() failed and still free the drm_info. Second sets front_info->drm_info to NULL to avoid uaf.
--- drivers/gpu/drm/xen/xen_drm_front.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/xen/xen_drm_front.c +4 -2
@@ -521,7 +521,7 @@ static int xen_drm_drv_init(struct xen_drm_front_info *front_info) drm_dev =drm_dev_alloc (&xen_drm_driver, dev);if (IS_ERR (drm_dev)) { ret =PTR_ERR (drm_dev); - goto fail; + goto fail_dev; } drm_info->drm_dev = drm_dev;
@@ -551,8 +551,10 @@ fail_modeset:drm_kms_helper_poll_fini (drm_dev);drm_mode_config_cleanup (drm_dev);drm_dev_put (drm_dev); -fail: +fail_dev:kfree (drm_info); + front_info->drm_info =NULL ; +fail:return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 28/122 bpf: Take module reference for trampoline in module
In reply to Greg Kroah-HartmanFrom: Jiri Olsa <[email protected]>
[ Upstream commit 861de02e5f3f2a104eecc5af1d248cb7bf8c5f75 ]
Currently module can be unloaded even if there's a trampoline register in it. It's easily reproduced by running in parallel:
# while :; do ./test_progs -t module_attach; done # while :; do rmmod bpf_testmod; sleep 0.5; done
Taking the module reference in case the trampoline's ip is within the module code. Releasing it when the trampoline's ip is unregistered.
--- include/linux/bpf.h | 2 ++ kernel/bpf/trampoline.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+)
include/linux/bpf.h +2 -0
@@ -41,6 +41,7 @@ struct bpf_local_storage;struct bpf_local_storage_map ;struct kobject ;struct mem_cgroup ; +struct module ;extern struct idr btf_idr;extern spinlock_t btf_idr_lock;
@@ -630,6 +631,7 @@ struct bpf_trampoline {/* Executable image of trampoline */ struct bpf_tramp_image *cur_image;u64 selector; +struct module *mod; };struct bpf_attach_target_info {
kernel/bpf/trampoline.c +30 -0
@@ -9,6 +9,7 @@#include <linux/btf.h> #include <linux/rcupdate_trace.h> #include <linux/rcupdate_wait.h> +#include <linux/module.h> /* dummy _ops. The verifier will operate on target program's ops. */ const struct bpf_verifier_ops bpf_extension_verifier_ops = {
@@ -87,6 +88,26 @@ out:return tr; } +static int bpf_trampoline_module_get (struct bpf_trampoline *tr) +{ +struct module *mod; +int err =0 ; + +preempt_disable (); + mod =__module_text_address ((unsigned long ) tr->func.addr); +if (mod && !try_module_get (mod)) + err = -ENOENT ; +preempt_enable (); + tr->mod = mod; +return err; +} + +static void bpf_trampoline_module_put (struct bpf_trampoline *tr) +{ +module_put (tr->mod); + tr->mod =NULL ; +} +static int is_ftrace_location (void *ip) {long addr;
@@ -108,6 +129,9 @@ static int unregister_fentry(struct bpf_trampoline *tr, void *old_addr) ret =unregister_ftrace_direct ((long )ip, (long )old_addr); else ret =bpf_arch_text_poke (ip,BPF_MOD_CALL , old_addr,NULL ); + +if (!ret) +bpf_trampoline_module_put (tr);return ret; }
@@ -134,10 +158,16 @@ static int register_fentry(struct bpf_trampoline *tr, void *new_addr)return ret; tr->func.ftrace_managed = ret; +if (bpf_trampoline_module_get (tr)) +return -ENOENT ; +if (tr->func.ftrace_managed) ret =register_ftrace_direct ((long )ip, (long )new_addr);else ret =bpf_arch_text_poke (ip,BPF_MOD_CALL ,NULL , new_addr); + +if (ret) +bpf_trampoline_module_put (tr);return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 29/122 neighbour: Disregard DEAD dst in neigh_update
In reply to Greg Kroah-HartmanFrom: Tong Zhu <[email protected]>
[ Upstream commit d47ec7a0a7271dda08932d6208e4ab65ab0c987c ]
After a short network outage, the dst_entry is timed out and put in DST_OBSOLETE_DEAD. We are in this code because arp reply comes from this neighbour after network recovers. There is a potential race condition that dst_entry is still in DST_OBSOLETE_DEAD. With that, another neighbour lookup causes more harm than good.
In best case all packets in arp_queue are lost. This is counterproductive to the original goal of finding a better path for those packets.
I observed a worst case with 4.x kernel where a dst_entry in DST_OBSOLETE_DEAD state is associated with loopback net_device. It leads to an ethernet header with all zero addresses. A packet with all zero source MAC address is quite deadly with mac80211, ath9k and 802.11 block ack. It fails ieee80211_find_sta_by_ifaddr in ath9k (xmit.c). Ath9k flushes tx queue (ath_tx_complete_aggr). BAW (block ack window) is not updated. BAW logic is damaged and ath9k transmission is disabled.
--- net/core/neighbour.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/neighbour.c +1 -1
@@ -1380,7 +1380,7 @@ static int __neigh_update(struct neighbour *neigh, const u8 *lladdr,* we can reinject the packet there. */ n2 =NULL ; -if (dst) { +if (dst && dst->obsolete !=DST_OBSOLETE_DEAD ) { n2 =dst_neigh_lookup_skb (dst, skb);if (n2) n1 = n2;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 30/122 powerpc/signal32: Fix Oops on sigreturn with unmapped VDSO
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit acca57217c688c5bbbd5140974533d81e8757cc9 ]
PPC32 encounters a KUAP fault when trying to handle a signal with VDSO unmapped.
Kernel attempted to read user page (7fc07ec0) - exploit attempt? (uid: 0) BUG: Unable to handle kernel data access on read at 0x7fc07ec0 Faulting instruction address: 0xc00111d4 Oops: Kernel access of bad area, sig: 11 [#1] BE PAGE_SIZE=16K PREEMPT CMPC885 CPU: 0 PID: 353 Comm: sigreturn_vdso Not tainted 5.12.0-rc4-s3k-dev-01553-gb30c310ea220 #4814 NIP: c00111d4 LR: c0005a28 CTR: 00000000 REGS: cadb3dd0 TRAP: 0300 Not tainted (5.12.0-rc4-s3k-dev-01553-gb30c310ea220) MSR: 00009032 <EE,ME,IR,DR,RI> CR: 48000884 XER: 20000000 DAR: 7fc07ec0 DSISR: 88000000 GPR00: c0007788 cadb3e90 c28d4a40 7fc07ec0 7fc07ed0 000004e0 7fc07ce0 00000000 GPR08: 00000001 00000001 7fc07ec0 00000000 28000282 1001b828 100a0920 00000000 GPR16: 100cac0c 100b0000 105c43a4 105c5685 100d0000 100d0000 100d0000 100b2e9e GPR24: ffffffff 105c43c8 00000000 7fc07ec8 cadb3f40 cadb3ec8 c28d4a40 00000000 NIP [c00111d4] flush_icache_range+0x90/0xb4 LR [c0005a28] handle_signal32+0x1bc/0x1c4 Call Trace: [cadb3e90] [100d0000] 0x100d0000 (unreliable) [cadb3ec0] [c0007788] do_notify_resume+0x260/0x314 [cadb3f20] [c000c764] syscall_exit_prepare+0x120/0x184 [cadb3f30] [c00100b4] ret_from_syscall+0xc/0x28 --- interrupt: c00 at 0xfe807f8 NIP: 0fe807f8 LR: 10001060 CTR: c0139378 REGS: cadb3f40 TRAP: 0c00 Not tainted (5.12.0-rc4-s3k-dev-01553-gb30c310ea220) MSR: 0000d032 <EE,PR,ME,IR,DR,RI> CR: 28000482 XER: 20000000 GPR00: 00000025 7fc081c0 77bb1690 00000000 0000000a 28000482 00000001 0ff03a38 GPR08: 0000d032 00006de5 c28d4a40 00000009 88000482 1001b828 100a0920 00000000 GPR16: 100cac0c 100b0000 105c43a4 105c5685 100d0000 100d0000 100d0000 100b2e9e GPR24: ffffffff 105c43c8 00000000 77ba7628 10002398 10010000 10002124 00024000 NIP [0fe807f8] 0xfe807f8 LR [10001060] 0x10001060 --- interrupt: c00 Instruction dump: 38630010 7c001fac 38630010 4200fff0 7c0004ac 4c00012c 4e800020 7c001fac 2c0a0000 38630010 4082ffcc 4bffffe4 <7c00186c> 2c070000 39430010 4082ff8c ---[ end trace 3973fb72b049cb06 ]---
This is because flush_icache_range() is called on user addresses.
The same problem was detected some time ago on PPC64. It was fixed by enabling KUAP in commit 59bee45b9712 ("powerpc/mm: Fix missing KUAP disable in flush_coherent_icache()").
PPC32 doesn't use flush_coherent_icache() and fallbacks on clean_dcache_range() and invalidate_icache_range().
We could fix it similarly by enabling user access in those functions, but this is overkill for just flushing two instructions.
The two instructions are 8 bytes aligned, so a single dcbst/icbi is enough to flush them. Do like __patch_instruction() and inline a dcbst followed by an icbi just after the write of the instructions, while user access is still allowed. The isync is not required because rfi will be used to return to user.
icbi() is handled as a read so read-write user access is needed.
--- arch/powerpc/kernel/signal_32.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
arch/powerpc/kernel/signal_32.c +8 -12
@@ -775,7 +775,7 @@ int handle_rt_signal32(struct ksignal *ksig, sigset_t *oldset,else prepare_save_user_regs (1 ); -if (!user_write_access_begin (frame,sizeof (*frame))) +if (!user_access_begin (frame,sizeof (*frame))) goto badframe;/* Put the siginfo & fill in most of the ucontext */
@@ -809,17 +809,15 @@ int handle_rt_signal32(struct ksignal *ksig, sigset_t *oldset,unsafe_put_user (PPC_INST_ADDI + __NR_rt_sigreturn, &mctx->mc_pad[0 ], failed);unsafe_put_user (PPC_INST_SC , &mctx->mc_pad[1 ], failed); + asm("dcbst %y0; sync; icbi %y0; sync" ::"Z" (mctx->mc_pad[0 ])); }unsafe_put_sigset_t (&frame->uc.uc_sigmask, oldset, failed); -user_write_access_end (); +user_access_end ();if (copy_siginfo_to_user (&frame->info, &ksig->info)) goto badframe; -if (tramp == (unsigned long )mctx->mc_pad) -flush_icache_range (tramp, tramp +2 *sizeof (unsigned long )); - regs->link = tramp;#ifdef CONFIG_PPC_FPU_REGS
@@ -844,7 +842,7 @@ int handle_rt_signal32(struct ksignal *ksig, sigset_t *oldset,return 0 ; failed: -user_write_access_end (); +user_access_end (); badframe:signal_fault (tsk, regs,"handle_rt_signal32" , frame);
@@ -879,7 +877,7 @@ int handle_signal32(struct ksignal *ksig, sigset_t *oldset,else prepare_save_user_regs (1 ); -if (!user_write_access_begin (frame,sizeof (*frame))) +if (!user_access_begin (frame,sizeof (*frame))) goto badframe; sc = (struct sigcontext __user *) &frame->sctx;
@@ -908,11 +906,9 @@ int handle_signal32(struct ksignal *ksig, sigset_t *oldset,/* Set up the sigreturn trampoline: li r0,sigret; sc */ unsafe_put_user (PPC_INST_ADDI + __NR_sigreturn, &mctx->mc_pad[0 ], failed);unsafe_put_user (PPC_INST_SC , &mctx->mc_pad[1 ], failed); + asm("dcbst %y0; sync; icbi %y0; sync" ::"Z" (mctx->mc_pad[0 ])); } -user_write_access_end (); - -if (tramp == (unsigned long )mctx->mc_pad) -flush_icache_range (tramp, tramp +2 *sizeof (unsigned long )); +user_access_end (); regs->link = tramp;
@@ -934,7 +930,7 @@ int handle_signal32(struct ksignal *ksig, sigset_t *oldset,return 0 ; failed: -user_write_access_end (); +user_access_end (); badframe:signal_fault (tsk, regs,"handle_signal32" , frame);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 31/122 ARM: keystone: fix integer overflow warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 844b85dda2f569943e1e018fdd63b6f7d1d6f08e ]
clang warns about an impossible condition when building with 32-bit phys_addr_t:
arch/arm/mach-keystone/keystone.c:79:16: error: result of comparison of constant 51539607551 with expression of type 'phys_addr_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
mem_end > KEYSTONE_HIGH_PHYS_END) {
~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~
arch/arm/mach-keystone/keystone.c:78:16: error: result of comparison of constant 34359738368 with expression of type 'phys_addr_t' (aka 'unsigned int') is always true [-Werror,-Wtautological-constant-out-of-range-compare]
if (mem_start < KEYSTONE_HIGH_PHYS_START ||
~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~Change the temporary variable to a fixed-size u64 to avoid the warning.
--- arch/arm/mach-keystone/keystone.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-keystone/keystone.c +2 -2
@@ -65,7 +65,7 @@ static void __init keystone_init(void)static long long __init keystone_pv_fixup (void ) {long long offset; -phys_addr_t mem_start, mem_end; +u64 mem_start, mem_end; mem_start =memblock_start_of_DRAM (); mem_end =memblock_end_of_DRAM ();
@@ -78,7 +78,7 @@ static long long __init keystone_pv_fixup(void)if (mem_start <KEYSTONE_HIGH_PHYS_START || mem_end >KEYSTONE_HIGH_PHYS_END ) {pr_crit ("Invalid address space for memory (%08llx-%08llx)\n" , - (u64 )mem_start, (u64 )mem_end); + mem_start, mem_end);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 32/122 ARM: omap1: fix building with clang IAS
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 28399a5a6d569c9bdb612345e4933046ca37cde5 ]
The clang integrated assembler fails to build one file with a complex asm instruction:
arch/arm/mach-omap1/ams-delta-fiq-handler.S:249:2: error: invalid instruction, any one of the following would fix this:
mov r10, #(1 << (((NR_IRQS_LEGACY + 12) - NR_IRQS_LEGACY) % 32)) @ set deferred_fiq bit
^arch/arm/mach-omap1/ams-delta-fiq-handler.S:249:2: note: instruction requires: armv6t2
mov r10, #(1 << (((NR_IRQS_LEGACY + 12) - NR_IRQS_LEGACY) % 32)) @ set deferred_fiq bit
^arch/arm/mach-omap1/ams-delta-fiq-handler.S:249:2: note: instruction requires: thumb2
mov r10, #(1 << (((NR_IRQS_LEGACY + 12) - NR_IRQS_LEGACY) % 32)) @ set deferred_fiq bit
^
The problem is that 'NR_IRQS_LEGACY' is not defined here. Apparently gas does not care because we first add and then subtract this number, leading to the immediate value to be the same regardless of the specific definition of NR_IRQS_LEGACY.
Neither the way that 'gas' just silently builds this file, nor the way that clang IAS makes nonsensical suggestions for how to fix it is great. Fortunately there is an easy fix, which is to #include the header that contains the definition.
--- arch/arm/mach-omap1/ams-delta-fiq-handler.S | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-omap1/ams-delta-fiq-handler.S +1 -0
@@ -15,6 +15,7 @@ #include <linux/platform_data/gpio-omap.h> #include <asm/assembler.h> +#include <asm/irq.h> #include "ams-delta-fiq.h" #include "board-ams-delta.h"
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 33/122 drm/msm: Fix a5xx/a6xx timestamps
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit 9fbd3088351b92e8c2cef6e37a39decb12a8d5bb ]
They were reading a counter that was configured to ALWAYS_COUNT (ie. cycles that the GPU is doing something) rather than ALWAYS_ON. This isn't the thing that userspace is looking for.
Message-Id: <[email protected]>
--- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 4 ++-- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +2 -2
@@ -1239,8 +1239,8 @@ static int a5xx_pm_suspend(struct msm_gpu *gpu)static int a5xx_get_timestamp (struct msm_gpu *gpu,uint64_t *value) { - *value =gpu_read64 (gpu,REG_A5XX_RBBM_PERFCTR_CP_0_LO , -REG_A5XX_RBBM_PERFCTR_CP_0_HI ); + *value =gpu_read64 (gpu,REG_A5XX_RBBM_ALWAYSON_COUNTER_LO , +REG_A5XX_RBBM_ALWAYSON_COUNTER_HI );return 0 ; }
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +2 -2
@@ -1227,8 +1227,8 @@ static int a6xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value)/* Force the GPU power on so we can read this register */ a6xx_gmu_set_oob (&a6xx_gpu->gmu,GMU_OOB_PERFCOUNTER_SET ); - *value =gpu_read64 (gpu,REG_A6XX_RBBM_PERFCTR_CP_0_LO , -REG_A6XX_RBBM_PERFCTR_CP_0_HI ); + *value =gpu_read64 (gpu,REG_A6XX_CP_ALWAYS_ON_COUNTER_LO , +REG_A6XX_CP_ALWAYS_ON_COUNTER_HI );a6xx_gmu_clear_oob (&a6xx_gpu->gmu,GMU_OOB_PERFCOUNTER_SET );mutex_unlock (&perfcounter_oob);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 34/122 ASoC: fsl_esai: Fix TDM slot setup for I2S mode
In reply to Greg Kroah-HartmanFrom: Alexander Shiyan <[email protected]>
[ Upstream commit e7a48c710defa0e0fef54d42b7d9e4ab596e2761 ]
When using the driver in I2S TDM mode, the fsl_esai_startup() function rewrites the number of slots previously set by the fsl_esai_set_dai_tdm_slot() function to 2.
To fix this, let's use the saved slot count value or, if TDM is not used and the number of slots is not set, the driver will use the default value (2), which is set by fsl_esai_probe().
--- sound/soc/fsl/fsl_esai.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
sound/soc/fsl/fsl_esai.c +5 -3
@@ -524,11 +524,13 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream,ESAI_SAICR_SYNC , esai_priv->synchronous ? ESAI_SAICR_SYNC : 0); -/* Set a default slot number -- 2 */ +/* Set slots count */ regmap_update_bits (esai_priv->regmap,REG_ESAI_TCCR , - ESAI_xCCR_xDC_MASK,ESAI_xCCR_xDC (2 )); + ESAI_xCCR_xDC_MASK, +ESAI_xCCR_xDC (esai_priv->slots));regmap_update_bits (esai_priv->regmap,REG_ESAI_RCCR , - ESAI_xCCR_xDC_MASK,ESAI_xCCR_xDC (2 )); + ESAI_xCCR_xDC_MASK, +ESAI_xCCR_xDC (esai_priv->slots)); }return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 35/122 scsi: scsi_transport_srp: Dont block target in SRP_PORT_LOST state
In reply to Greg Kroah-HartmanFrom: Martin Wilck <[email protected]>
[ Upstream commit 5cd0f6f57639c5afbb36100c69281fee82c95ee7 ]
rport_dev_loss_timedout() sets the rport state to SRP_PORT_LOST and the SCSI target state to SDEV_TRANSPORT_OFFLINE. If this races with srp_reconnect_work(), a warning is printed:
Mar 27 18:48:07 ictm1604s01h4 kernel: dev_loss_tmo expired for SRP port-18:1 / host18. Mar 27 18:48:07 ictm1604s01h4 kernel: ------------[ cut here ]------------ Mar 27 18:48:07 ictm1604s01h4 kernel: scsi_internal_device_block(18:0:0:100) failed: ret = -22 Mar 27 18:48:07 ictm1604s01h4 kernel: Call Trace: Mar 27 18:48:07 ictm1604s01h4 kernel: ? scsi_target_unblock+0x50/0x50 [scsi_mod] Mar 27 18:48:07 ictm1604s01h4 kernel: starget_for_each_device+0x80/0xb0 [scsi_mod] Mar 27 18:48:07 ictm1604s01h4 kernel: target_block+0x24/0x30 [scsi_mod] Mar 27 18:48:07 ictm1604s01h4 kernel: device_for_each_child+0x57/0x90 Mar 27 18:48:07 ictm1604s01h4 kernel: srp_reconnect_rport+0xe4/0x230 [scsi_transport_srp] Mar 27 18:48:07 ictm1604s01h4 kernel: srp_reconnect_work+0x40/0xc0 [scsi_transport_srp]
Avoid this by not trying to block targets for rports in SRP_PORT_LOST state.
--- drivers/scsi/scsi_transport_srp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_transport_srp.c +1 -1
@@ -541,7 +541,7 @@ int srp_reconnect_rport(struct srp_rport *rport) res =mutex_lock_interruptible (&rport->mutex);if (res) goto out; -if (rport->state !=SRP_RPORT_FAIL_FAST ) +if (rport->state !=SRP_RPORT_FAIL_FAST && rport->state !=SRP_RPORT_LOST )/* * sdev state must be SDEV_TRANSPORT_OFFLINE, transition * to SDEV_BLOCK is illegal. Calling scsi_target_unblock()
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 36/122 iwlwifi: add support for Qu with AX201 device
In reply to Greg Kroah-HartmanFrom: Matt Chen <[email protected]>
[ Upstream commit 97195d3cad852063208a1cd4f4d073459547a415 ]
Add this specific Samsung AX201 sku to driver so it can be detected and initialized successfully.
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +1 -0
@@ -628,6 +628,7 @@ static const struct iwl_dev_info iwl_dev_info_table[] = {IWL_DEV_INFO (0x4DF0 ,0x1652 , killer1650i_2ax_cfg_qu_b0_hr_b0,NULL ),IWL_DEV_INFO (0x4DF0 ,0x2074 , iwl_ax201_cfg_qu_hr,NULL ),IWL_DEV_INFO (0x4DF0 ,0x4070 , iwl_ax201_cfg_qu_hr,NULL ), +IWL_DEV_INFO (0x4DF0 ,0x6074 , iwl_ax201_cfg_qu_hr,NULL ), _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_MAC_TYPE_PU, IWL_CFG_ANY,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 37/122 net: ieee802154: stop dump llsec keys for monitors
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit fb3c5cdf88cd504ef11d59e8d656f4bc896c6922 ]
This patch stops dumping llsec keys for monitors which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors.
--- net/ieee802154/nl802154.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ieee802154/nl802154.c +5 -0
@@ -1498,6 +1498,11 @@ nl802154_dump_llsec_key(struct sk_buff *skb, struct netlink_callback *cb)if (err)return err; +if (wpan_dev->iftype ==NL802154_IFTYPE_MONITOR ) { + err = skb->len; + goto out_err; + } +if (!wpan_dev->netdev) { err = -EINVAL ; goto out_err;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 38/122 net: ieee802154: forbid monitor for add llsec key
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 08470c5453339369bd3d590c4cbb0b5961cdcbb6 ]
This patch forbids to add llsec key for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors.
--- net/ieee802154/nl802154.c | 3 +++ 1 file changed, 3 insertions(+)
net/ieee802154/nl802154.c +3 -0
@@ -1557,6 +1557,9 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info)struct ieee802154_llsec_key_id id = { };u32 commands[NL802154_CMD_FRAME_NR_IDS /32 ] = { }; +if (wpan_dev->iftype ==NL802154_IFTYPE_MONITOR ) +return -EOPNOTSUPP ; +if (!info->attrs[NL802154_ATTR_SEC_KEY ] ||nla_parse_nested_deprecated (attrs,NL802154_KEY_ATTR_MAX , info->attrs[NL802154_ATTR_SEC_KEY ], nl802154_key_policy, info->extack))return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 39/122 net: ieee802154: forbid monitor for del llsec key
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit b6e2949544a183f590ae6f3ef2d1aaaa2c44e38a ]
This patch forbids to del llsec key for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors.
--- net/ieee802154/nl802154.c | 3 +++ 1 file changed, 3 insertions(+)
net/ieee802154/nl802154.c +3 -0
@@ -1609,6 +1609,9 @@ static int nl802154_del_llsec_key(struct sk_buff *skb, struct genl_info *info)struct nlattr *attrs[NL802154_KEY_ATTR_MAX +1 ];struct ieee802154_llsec_key_id id; +if (wpan_dev->iftype ==NL802154_IFTYPE_MONITOR ) +return -EOPNOTSUPP ; +if (!info->attrs[NL802154_ATTR_SEC_KEY ] ||nla_parse_nested_deprecated (attrs,NL802154_KEY_ATTR_MAX , info->attrs[NL802154_ATTR_SEC_KEY ], nl802154_key_policy, info->extack))return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 40/122 net: ieee802154: stop dump llsec devs for monitors
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 5582d641e6740839c9b83efd1fbf9bcd00b6f5fc ]
This patch stops dumping llsec devs for monitors which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors.
--- net/ieee802154/nl802154.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ieee802154/nl802154.c +5 -0
@@ -1677,6 +1677,11 @@ nl802154_dump_llsec_dev(struct sk_buff *skb, struct netlink_callback *cb)if (err)return err; +if (wpan_dev->iftype ==NL802154_IFTYPE_MONITOR ) { + err = skb->len; + goto out_err; + } +if (!wpan_dev->netdev) { err = -EINVAL ; goto out_err;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 41/122 net: ieee802154: forbid monitor for add llsec dev
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 5303f956b05a2886ff42890908156afaec0f95ac ]
This patch forbids to add llsec dev for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors.
--- net/ieee802154/nl802154.c | 3 +++ 1 file changed, 3 insertions(+)
net/ieee802154/nl802154.c +3 -0
@@ -1768,6 +1768,9 @@ static int nl802154_add_llsec_dev(struct sk_buff *skb, struct genl_info *info)struct wpan_dev *wpan_dev = dev->ieee802154_ptr;struct ieee802154_llsec_device dev_desc; +if (wpan_dev->iftype ==NL802154_IFTYPE_MONITOR ) +return -EOPNOTSUPP ; +if (ieee802154_llsec_parse_device (info->attrs[NL802154_ATTR_SEC_DEVICE ], &dev_desc) <0 )return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 42/122 net: ieee802154: forbid monitor for del llsec dev
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit ad8f9de1f3566686af35b1c6b43240726541da61 ]
This patch forbids to del llsec dev for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors.
--- net/ieee802154/nl802154.c | 3 +++ 1 file changed, 3 insertions(+)
net/ieee802154/nl802154.c +3 -0
@@ -1786,6 +1786,9 @@ static int nl802154_del_llsec_dev(struct sk_buff *skb, struct genl_info *info)struct nlattr *attrs[NL802154_DEV_ATTR_MAX +1 ];__le64 extended_addr; +if (wpan_dev->iftype ==NL802154_IFTYPE_MONITOR ) +return -EOPNOTSUPP ; +if (!info->attrs[NL802154_ATTR_SEC_DEVICE ] ||nla_parse_nested_deprecated (attrs,NL802154_DEV_ATTR_MAX , info->attrs[NL802154_ATTR_SEC_DEVICE ], nl802154_dev_policy, info->extack))return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 43/122 net: ieee802154: stop dump llsec devkeys for monitors
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 080d1a57a94d93e70f84b7a360baa351388c574f ]
This patch stops dumping llsec devkeys for monitors which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors.
--- net/ieee802154/nl802154.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ieee802154/nl802154.c +5 -0
@@ -1858,6 +1858,11 @@ nl802154_dump_llsec_devkey(struct sk_buff *skb, struct netlink_callback *cb)if (err)return err; +if (wpan_dev->iftype ==NL802154_IFTYPE_MONITOR ) { + err = skb->len; + goto out_err; + } +if (!wpan_dev->netdev) { err = -EINVAL ; goto out_err;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 44/122 net: ieee802154: forbid monitor for add llsec devkey
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit a347b3b394868fef15b16f143719df56184be81d ]
This patch forbids to add llsec devkey for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors.
--- net/ieee802154/nl802154.c | 3 +++ 1 file changed, 3 insertions(+)
net/ieee802154/nl802154.c +3 -0
@@ -1920,6 +1920,9 @@ static int nl802154_add_llsec_devkey(struct sk_buff *skb, struct genl_info *infostruct ieee802154_llsec_device_key key;__le64 extended_addr; +if (wpan_dev->iftype ==NL802154_IFTYPE_MONITOR ) +return -EOPNOTSUPP ; +if (!info->attrs[NL802154_ATTR_SEC_DEVKEY ] ||nla_parse_nested_deprecated (attrs,NL802154_DEVKEY_ATTR_MAX , info->attrs[NL802154_ATTR_SEC_DEVKEY ], nl802154_devkey_policy, info->extack) <0 )return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 45/122 net: ieee802154: forbid monitor for del llsec devkey
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 6fb8045319ef172dc88a8142e7f8b58c7608137e ]
This patch forbids to del llsec devkey for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors.
--- net/ieee802154/nl802154.c | 3 +++ 1 file changed, 3 insertions(+)
net/ieee802154/nl802154.c +3 -0
@@ -1954,6 +1954,9 @@ static int nl802154_del_llsec_devkey(struct sk_buff *skb, struct genl_info *infostruct ieee802154_llsec_device_key key;__le64 extended_addr; +if (wpan_dev->iftype ==NL802154_IFTYPE_MONITOR ) +return -EOPNOTSUPP ; +if (!info->attrs[NL802154_ATTR_SEC_DEVKEY ] ||nla_parse_nested_deprecated (attrs,NL802154_DEVKEY_ATTR_MAX , info->attrs[NL802154_ATTR_SEC_DEVKEY ], nl802154_devkey_policy, info->extack))return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 46/122 net: ieee802154: stop dump llsec seclevels for monitors
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 4c9b4f55ad1f5a4b6206ac4ea58f273126d21925 ]
This patch stops dumping llsec seclevels for monitors which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors.
--- net/ieee802154/nl802154.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ieee802154/nl802154.c +5 -0
@@ -2031,6 +2031,11 @@ nl802154_dump_llsec_seclevel(struct sk_buff *skb, struct netlink_callback *cb)if (err)return err; +if (wpan_dev->iftype ==NL802154_IFTYPE_MONITOR ) { + err = skb->len; + goto out_err; + } +if (!wpan_dev->netdev) { err = -EINVAL ; goto out_err;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 47/122 net: ieee802154: forbid monitor for add llsec seclevel
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 9ec87e322428d4734ac647d1a8e507434086993d ]
This patch forbids to add llsec seclevel for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors.
--- net/ieee802154/nl802154.c | 3 +++ 1 file changed, 3 insertions(+)
net/ieee802154/nl802154.c +3 -0
@@ -2120,6 +2120,9 @@ static int nl802154_add_llsec_seclevel(struct sk_buff *skb,struct wpan_dev *wpan_dev = dev->ieee802154_ptr;struct ieee802154_llsec_seclevel sl; +if (wpan_dev->iftype ==NL802154_IFTYPE_MONITOR ) +return -EOPNOTSUPP ; +if (llsec_parse_seclevel (info->attrs[NL802154_ATTR_SEC_LEVEL ], &sl) <0 )return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 48/122 pcnet32: Use pci_resource_len to validate PCI resource
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 66c3f05ddc538ee796321210c906b6ae6fc0792a ]
pci_resource_start() is not a good indicator to determine if a PCI resource exists or not, since the resource may start at address 0. This is seen when trying to instantiate the driver in qemu for riscv32 or riscv64.
pci 0000:00:01.0: reg 0x10: [io 0x0000-0x001f] pci 0000:00:01.0: reg 0x14: [mem 0x00000000-0x0000001f]
...
pcnet32: card has no PCI IO resources, aborting
Use pci_resouce_len() instead.
--- drivers/net/ethernet/amd/pcnet32.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/amd/pcnet32.c +3 -2
@@ -1534,8 +1534,7 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent) }pci_set_master (pdev); - ioaddr =pci_resource_start (pdev,0 ); -if (!ioaddr) { +if (!pci_resource_len (pdev,0 )) {if (pcnet32_debug &NETIF_MSG_PROBE )pr_err ("card has no PCI IO resources, aborting\n" ); err = -ENODEV ;
@@ -1548,6 +1547,8 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent)pr_err ("architecture does not support 32bit PCI busmaster DMA\n" ); goto err_disable_dev; } + + ioaddr =pci_resource_start (pdev,0 );if (!request_region (ioaddr,PCNET32_TOTAL_SIZE ,"pcnet32_probe_pci" )) {if (pcnet32_debug &NETIF_MSG_PROBE )pr_err ("io address range already allocated\n" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 49/122 net/rds: Avoid potential use after free in rds_send_remove_from_sock
In reply to Greg Kroah-HartmanFrom: Aditya Pakki <[email protected]>
[ Upstream commit 0c85a7e87465f2d4cbc768e245f4f45b2f299b05 ]
In case of rs failure in rds_send_remove_from_sock(), the 'rm' resource is freed and later under spinlock, causing potential use-after-free. Set the free pointer to NULL to avoid undefined behavior.
--- net/rds/message.c | 1 + net/rds/send.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
net/rds/message.c +1 -0
@@ -180,6 +180,7 @@ void rds_message_put(struct rds_message *rm)rds_message_purge (rm);kfree (rm); + rm =NULL ; } }EXPORT_SYMBOL_GPL (rds_message_put);
net/rds/send.c +1 -1
@@ -665,7 +665,7 @@ static void rds_send_remove_from_sock(struct list_head *messages, int status) unlock_and_drop:spin_unlock_irqrestore (&rm->m_rs_lock, flags);rds_message_put (rm); -if (was_on_sock) +if (was_on_sock && rm)rds_message_put (rm); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 50/122 net: tipc: Fix spelling errors in net/tipc module
In reply to Greg Kroah-HartmanFrom: Zheng Yongjun <[email protected]>
[ Upstream commit a79ace4b312953c5835fafb12adc3cb6878b26bd ]
These patches fix a series of spelling errors in net/tipc module.
--- net/tipc/bearer.h | 6 +++--- net/tipc/net.c | 2 +- net/tipc/node.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
net/tipc/bearer.h +3 -3
@@ -154,9 +154,9 @@ struct tipc_media {* care of initializing all other fields. */ struct tipc_bearer { -void __rcu *media_ptr;/* initalized by media */ -u32 mtu;/* initalized by media */ -struct tipc_media_addr addr;/* initalized by media */ +void __rcu *media_ptr;/* initialized by media */ +u32 mtu;/* initialized by media */ +struct tipc_media_addr addr;/* initialized by media */ char name[TIPC_MAX_BEARER_NAME ];struct tipc_media *media;struct tipc_media_addr bcast_addr;
net/tipc/net.c +1 -1
@@ -89,7 +89,7 @@* - A spin lock to protect the registry of kernel/driver users (reg.c) * - A global spin_lock (tipc_port_lock), which only task is to ensure * consistency where more than one port is involved in an operation, -* i.e., whe a port is part of a linked list of ports. +* i.e., when a port is part of a linked list of ports. * There are two such lists; 'port_list', which is used for management, * and 'wait_list', which is used to queue ports during congestion. *
net/tipc/node.c +1 -1
@@ -1734,7 +1734,7 @@ int tipc_node_xmit(struct net *net, struct sk_buff_head *list, }/* tipc_node_xmit_skb(): send single buffer to destination -* Buffers sent via this functon are generally TIPC_SYSTEM_IMPORTANCE +* Buffers sent via this function are generally TIPC_SYSTEM_IMPORTANCE * messages, which will not be rejected * The only exception is datagram messages rerouted after secondary * lookup, which are rare and safe to dispose of anyway.
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 51/122 drm/amd/display: Add missing mask for DCN3
In reply to Greg Kroah-HartmanFrom: Qingqing Zhuo <[email protected]>
[ Upstream commit df7232c4c676be29f1cf45058ec156c1183539ff ]
[Why]
DCN3 is not reusing DCN1 mask_sh_list, causingSURFACE_FLIP_INT_MASK missing in the mapping.
[How]
Add the corresponding entry to DCN3 list.
--- drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubp.h | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubp.h +1 -0
@@ -133,6 +133,7 @@HUBP_SF (HUBPREQ0_DCSURF_SURFACE_CONTROL ,SECONDARY_SURFACE_DCC_EN , mask_sh),\HUBP_SF (HUBPREQ0_DCSURF_SURFACE_CONTROL ,SECONDARY_SURFACE_DCC_IND_BLK , mask_sh),\HUBP_SF (HUBPREQ0_DCSURF_SURFACE_CONTROL ,SECONDARY_SURFACE_DCC_IND_BLK_C , mask_sh),\ +HUBP_SF (HUBPREQ0_DCSURF_SURFACE_FLIP_INTERRUPT ,SURFACE_FLIP_INT_MASK , mask_sh),\HUBP_SF (HUBPRET0_HUBPRET_CONTROL ,DET_BUF_PLANE1_BASE_ADDRESS , mask_sh),\HUBP_SF (HUBPRET0_HUBPRET_CONTROL ,CROSSBAR_SRC_CB_B , mask_sh),\ HUBP_SF(HUBPRET0_HUBPRET_CONTROL, CROSSBAR_SRC_CR_R, mask_sh),\
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 52/122 mac80211: clear sta->fast_rx when STA removed from 4-addr VLAN
In reply to Greg Kroah-HartmanFrom: Seevalamuthu Mariappan <[email protected]>
[ Upstream commit dd0b45538146cb6a54d6da7663b8c3afd16ebcfd ]
In some race conditions, with more clients and traffic configuration, below crash is seen when making the interface down. sta->fast_rx wasn't cleared when STA gets removed from 4-addr AP_VLAN interface. The crash is due to try accessing 4-addr AP_VLAN interface's net_device (fast_rx->dev) which has been deleted already.
Resolve this by clearing sta->fast_rx pointer when STA removes from a 4-addr VLAN.
[ 239.449529] Unable to handle kernel NULL pointer dereference at virtual address 00000004
[ 239.449531] pgd = 80204000
...
[ 239.481496] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.4.60 #227
[ 239.481591] Hardware name: Generic DT based system
[ 239.487665] task: be05b700 ti: be08e000 task.ti: be08e000
[ 239.492360] PC is at get_rps_cpu+0x2d4/0x31c
[ 239.497823] LR is at 0xbe08fc54
...
[ 239.778574] [<80739740>] (get_rps_cpu) from [<8073cb10>] (netif_receive_skb_internal+0x8c/0xac)
[ 239.786722] [<8073cb10>] (netif_receive_skb_internal) from [<8073d578>] (napi_gro_receive+0x48/0xc4)
[ 239.795267] [<8073d578>] (napi_gro_receive) from [<c7b83e8c>] (ieee80211_mark_rx_ba_filtered_frames+0xbcc/0x12d4 [mac80211])
[ 239.804776] [<c7b83e8c>] (ieee80211_mark_rx_ba_filtered_frames [mac80211]) from [<c7b84d4c>] (ieee80211_rx_napi+0x7b8/0x8c8 [mac8
0211])
[ 239.815857] [<c7b84d4c>] (ieee80211_rx_napi [mac80211]) from [<c7f63d7c>] (ath11k_dp_process_rx+0x7bc/0x8c8 [ath11k])
[ 239.827757] [<c7f63d7c>] (ath11k_dp_process_rx [ath11k]) from [<c7f5b6c4>] (ath11k_dp_service_srng+0x2c0/0x2e0 [ath11k])
[ 239.838484] [<c7f5b6c4>] (ath11k_dp_service_srng [ath11k]) from [<7f55b7dc>] (ath11k_ahb_ext_grp_napi_poll+0x20/0x84 [ath11k_ahb]
)
[ 239.849419] [<7f55b7dc>] (ath11k_ahb_ext_grp_napi_poll [ath11k_ahb]) from [<8073ce1c>] (net_rx_action+0xe0/0x28c)
[ 239.860945] [<8073ce1c>] (net_rx_action) from [<80324868>] (__do_softirq+0xe4/0x228)
[ 239.871269] [<80324868>] (__do_softirq) from [<80324c48>] (irq_exit+0x98/0x108)
[ 239.879080] [<80324c48>] (irq_exit) from [<8035c59c>] (__handle_domain_irq+0x90/0xb4)
[ 239.886114] [<8035c59c>] (__handle_domain_irq) from [<8030137c>] (gic_handle_irq+0x50/0x94)
[ 239.894100] [<8030137c>] (gic_handle_irq) from [<803024c0>] (__irq_svc+0x40/0x74)--- net/mac80211/cfg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/mac80211/cfg.c +3 -1
@@ -1788,8 +1788,10 @@ static int ieee80211_change_station(struct wiphy *wiphy, }if (sta->sdata->vif.type ==NL80211_IFTYPE_AP_VLAN && - sta->sdata->u.vlan.sta) + sta->sdata->u.vlan.sta) { +ieee80211_clear_fast_rx (sta);RCU_INIT_POINTER (sta->sdata->u.vlan.sta,NULL ); + }if (test_sta_flag (sta,WLAN_STA_AUTHORIZED ))ieee80211_vif_dec_num_mcast (sta->sdata);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 53/122 virt_wifi: Return micros for BSS TSF values
In reply to Greg Kroah-HartmanFrom: A. Cody Schuffelen <[email protected]>
[ Upstream commit b57aa17f07c9270e576ef7df09f142978b5a75f0 ]
cfg80211_inform_bss expects to receive a TSF value, but is given the time since boot in nanoseconds. TSF values are expected to be at microsecond scale rather than nanosecond scale.
--- drivers/net/wireless/virt_wifi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/virt_wifi.c +3 -2
@@ -12,6 +12,7 @@#include <net/cfg80211.h> #include <net/rtnetlink.h> #include <linux/etherdevice.h> +#include <linux/math64.h> #include <linux/module.h> static struct wiphy *common_wiphy;
@@ -168,11 +169,11 @@ static void virt_wifi_scan_result(struct work_struct *work) scan_result.work);struct wiphy *wiphy =priv_to_wiphy (priv);struct cfg80211_scan_info scan_info = { .aborted = false }; +u64 tsf =div_u64 (ktime_get_boottime_ns (),1000 ); informed_bss =cfg80211_inform_bss (wiphy, &channel_5ghz,CFG80211_BSS_FTYPE_PRESP , - fake_router_bssid, -ktime_get_boottime_ns (), + fake_router_bssid, tsf,WLAN_CAPABILITY_ESS ,0 , (void *)&ssid,sizeof (ssid),DBM_TO_MBM (-50 ),GFP_KERNEL );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 54/122 lib: fix kconfig dependency on ARCH_WANT_FRAME_POINTERS
In reply to Greg Kroah-HartmanFrom: Julian Braha <[email protected]>
[ Upstream commit 7d37cb2c912dc5c25ffac784a4f9b98c06c6bd08 ]
When LATENCYTOP, LOCKDEP, or FAULT_INJECTION_STACKTRACE_FILTER is enabled and ARCH_WANT_FRAME_POINTERS is disabled, Kbuild gives a warning such as:
WARNING: unmet direct dependencies detected for FRAME_POINTER
Depends on [n]: DEBUG_KERNEL [=y] && (M68K || UML || SUPERH) || ARCH_WANT_FRAME_POINTERS [=n] || MCOUNT [=n]
Selected by [y]:
- LATENCYTOP [=y] && DEBUG_KERNEL [=y] && STACKTRACE_SUPPORT [=y] && PROC_FS [=y] && !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86
Depending on ARCH_WANT_FRAME_POINTERS causes a recursive dependency error. ARCH_WANT_FRAME_POINTERS is to be selected by the architecture, and is not supposed to be overridden by other config options.
--- lib/Kconfig.debug | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/Kconfig.debug +3 -3
@@ -1325,7 +1325,7 @@ config LOCKDEP bool depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT select STACKTRACE - select FRAME_POINTER if !MIPS && !PPC && !ARM && !S390 && !MICROBLAZE && !ARC && !X86 + depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86 select KALLSYMS select KALLSYMS_ALL
@@ -1619,7 +1619,7 @@ config LATENCYTOP depends on DEBUG_KERNEL depends on STACKTRACE_SUPPORT depends on PROC_FS - select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86 + depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86 select KALLSYMS select KALLSYMS_ALL select STACKTRACE
@@ -1872,7 +1872,7 @@ config FAULT_INJECTION_STACKTRACE_FILTER depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT depends on !X86_64 select STACKTRACE - select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM && !ARC && !X86 + depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86 help Provide stacktrace filter for fault-injection capabilities
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 55/122 net/sctp: fix race condition in sctp_destroy_sock
In reply to Greg Kroah-HartmanFrom: Or Cohen <[email protected]>
commit b166a20b07382b8bc1dcee2a448715c9c2c81b5b upstream.
If sctp_destroy_sock is called without sock_net(sk)->sctp.addr_wq_lock held and sp->do_auto_asconf is true, then an element is removed from the auto_asconf_splist without any proper locking.
This can happen in the following functions:
1. In sctp_accept, if sctp_sock_migrate fails.
2. In inet_create or inet6_create, if there is a bpf program attached to BPF_CGROUP_INET_SOCK_CREATE which denies creation of the sctp socket.
The bug is fixed by acquiring addr_wq_lock in sctp_destroy_sock instead of sctp_close.
This addresses CVE-2021-23133.
--- net/sctp/socket.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
net/sctp/socket.c +5 -8
@@ -1520,11 +1520,9 @@ static void sctp_close(struct sock *sk,/* Supposedly, no process has access to the socket, but * the net layers still may. -* Also, sctp_destroy_sock() needs to be called with addr_wq_lock -* held and that should be grabbed before socket lock. */ -spin_lock_bh (&net->sctp.addr_wq_lock); -bh_lock_sock_nested (sk); +local_bh_disable (); +bh_lock_sock (sk);/* Hold the sock, since sk_common_release() will put sock_put() * and we have just a little more cleanup.
@@ -1533,7 +1531,7 @@ static void sctp_close(struct sock *sk,sk_common_release (sk);bh_unlock_sock (sk); -spin_unlock_bh (&net->sctp.addr_wq_lock); +local_bh_enable ();sock_put (sk);
@@ -4993,9 +4991,6 @@ static int sctp_init_sock(struct sock *ssk_sockets_allocated_inc (sk);sock_prot_inuse_add (net, sk->sk_prot,1 ); -/* Nothing can fail after this block, otherwise -* sctp_destroy_sock() will be called without addr_wq_lock held -*/ if (net->sctp.default_auto_asconf) {spin_lock (&sock_net (sk)->sctp.addr_wq_lock); list_add_tail(&sp->auto_asconf_list,
@@ -5030,7 +5025,9 @@ static void sctp_destroy_sock(struct socif (sp->do_auto_asconf) { sp->do_auto_asconf =0 ; +spin_lock_bh (&sock_net (sk)->sctp.addr_wq_lock);list_del (&sp->auto_asconf_list); +spin_unlock_bh (&sock_net (sk)->sctp.addr_wq_lock); }sctp_endpoint_free (sp->ep);local_bh_disable ();
Greg Kroah-Hartman
maintainerPATCH 56/122 Input: s6sy761 - fix coordinate read bit shift
In reply to Greg Kroah-HartmanFrom: Caleb Connolly <[email protected]>
commit 30b3f68715595dee7fe4d9bd91a2252c3becdf0a upstream.
The touch coordinate register contains the following:
byte 3 byte 2 byte 1
+--------+--------+ +-----------------+ +-----------------+ | | | | | | | | X[3:0] | Y[3:0] | | Y[11:4] | | X[11:4] | | | | | | | | +--------+--------+ +-----------------+ +-----------------+
Bytes 2 and 1 need to be shifted left by 4 bits, the least significant nibble of each is stored in byte 3. Currently they are only being shifted by 3 causing the reported coordinates to be incorrect.
This matches downstream examples, and has been confirmed on my device (OnePlus 7 Pro).
--- drivers/input/touchscreen/s6sy761.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/touchscreen/s6sy761.c +2 -2
@@ -145,8 +145,8 @@ static void s6sy761_report_coordinates(su8 major = event[4 ];u8 minor = event[5 ];u8 z = event[6 ] &S6SY761_MASK_Z ; -u16 x = (event[1 ] <<3 ) | ((event[3 ] &S6SY761_MASK_X ) >>4 ); -u16 y = (event[2 ] <<3 ) | (event[3 ] &S6SY761_MASK_Y ); +u16 x = (event[1 ] <<4 ) | ((event[3 ] &S6SY761_MASK_X ) >>4 ); +u16 y = (event[2 ] <<4 ) | (event[3 ] &S6SY761_MASK_Y );input_mt_slot (sdata->input, tid);
Greg Kroah-Hartman
maintainerPATCH 57/122 Input: i8042 - fix Pegatron C15B ID entry
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit daa58c8eec0a65ac8e2e77ff3ea8a233d8eec954 upstream.
The Zenbook Flip entry that was added overwrites a previous one because of a typo:
In file included from drivers/input/serio/i8042.h:23,
from drivers/input/serio/i8042.c:131:
drivers/input/serio/i8042-x86ia64io.h:591:28: error: initialized field overwritten [-Werror=override-init]
591 | .matches = {
| ^drivers/input/serio/i8042-x86ia64io.h:591:28: note: (near initialization for 'i8042_dmi_noselftest_table[0].matches')
Add the missing separator between the two.
--- drivers/input/serio/i8042-x86ia64io.h | 1 + 1 file changed, 1 insertion(+)
drivers/input/serio/i8042-x86ia64io.h +1 -0
@@ -588,6 +588,7 @@ static const struct dmi_system_id i8042_DMI_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ),DMI_MATCH (DMI_CHASSIS_TYPE ,"10" ),/* Notebook */ }, + }, { .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), DMI_MATCH(DMI_CHASSIS_TYPE, "31"), /* Convertible Notebook */
Greg Kroah-Hartman
maintainerPATCH 58/122 HID: wacom: set EV_KEY and EV_ABS only for non-HID_GENERIC type of devices
In reply to Greg Kroah-HartmanFrom: Ping Cheng <[email protected]>
commit 276559d8d02c2709281578976ca2f53bc62063d4 upstream.
Valid HID_GENERIC type of devices set EV_KEY and EV_ABS by wacom_map_usage. When *_input_capabilities are reached, those devices should already have their proper EV_* set. EV_KEY and EV_ABS only need to be set for non-HID_GENERIC type of devices in *_input_capabilities.
Devices that don't support HID descitoprs will pass back to hid-input for registration without being accidentally rejected by the introduction of
patch: "Input: refuse to register absolute devices without absinfo"
--- drivers/hid/wacom_wac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/hid/wacom_wac.c +2 -4
@@ -3574,8 +3574,6 @@ int wacom_setup_pen_input_capabilities(s {struct wacom_features *features = &wacom_wac->features; - input_dev->evbit[0 ] |=BIT_MASK (EV_KEY ) |BIT_MASK (EV_ABS ); -if (!(features->device_type &WACOM_DEVICETYPE_PEN ))return -ENODEV ;
@@ -3590,6 +3588,7 @@ int wacom_setup_pen_input_capabilities(sreturn 0 ; } + input_dev->evbit[0 ] |=BIT_MASK (EV_KEY ) |BIT_MASK (EV_ABS );__set_bit (BTN_TOUCH , input_dev->keybit);__set_bit (ABS_MISC , input_dev->absbit);
@@ -3742,8 +3741,6 @@ int wacom_setup_touch_input_capabilities {struct wacom_features *features = &wacom_wac->features; - input_dev->evbit[0 ] |=BIT_MASK (EV_KEY ) |BIT_MASK (EV_ABS ); -if (!(features->device_type &WACOM_DEVICETYPE_TOUCH ))return -ENODEV ;
@@ -3756,6 +3753,7 @@ int wacom_setup_touch_input_capabilities/* setup has already been done */ return 0 ; + input_dev->evbit[0 ] |=BIT_MASK (EV_KEY ) |BIT_MASK (EV_ABS );__set_bit (BTN_TOUCH , input_dev->keybit);if (features->touch_max ==1 ) {
Greg Kroah-Hartman
maintainerPATCH 59/122 dm verity fec: fix misaligned RS roots IO
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
commit 8ca7cab82bda4eb0b8064befeeeaa38106cac637 upstream.
commit df7b59ba9245 ("dm verity: fix FEC for RS roots unaligned to block size") introduced the possibility for misaligned roots IO relative to the underlying device's logical block size. E.g. Android's default RS roots=2 results in dm_bufio->block_size=1024, which causes the following EIO if the logical block size of the device is 4096, given v->data_dev_block_bits=12:
E sd 0 : 0:0:0: [sda] tag#30 request not aligned to the logical block size
E blk_update_request: I/O error, dev sda, sector 10368424 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0 E device-mapper: verity-fec: 254:8: FEC 9244672: parity read failed (block 18056): -5
Fix this by onlu using f->roots for dm_bufio blocksize IFF it is aligned to v->data_dev_block_bits.
--- drivers/md/dm-verity-fec.c | 11 ++++++++--- drivers/md/dm-verity-fec.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/md/dm-verity-fec.c +8 -3
@@ -65,7 +65,7 @@ static u8 *fec_read_parity(struct dm_veru8 *res; position = (index + rsb) * v->fec->roots; - block =div64_u64_rem (position, v->fec->roots <<SECTOR_SHIFT , &rem); + block =div64_u64_rem (position, v->fec->io_size, &rem); *offset = (unsigned )rem; res =dm_bufio_read (v->fec->bufio, block, buf);
@@ -154,7 +154,7 @@ static int fec_decode_bufs(struct dm_ver/* read the next block when we run out of parity bytes */ offset += v->fec->roots; -if (offset >= v->fec->roots <<SECTOR_SHIFT ) { +if (offset >= v->fec->io_size) {dm_bufio_release (buf); par =fec_read_parity (v, rsb, block_offset, &offset, &buf);
@@ -742,8 +742,13 @@ int verity_fec_ctr(struct dm_verity *v)return -E2BIG ; } +if ((f->roots <<SECTOR_SHIFT ) & ((1 << v->data_dev_block_bits) -1 )) + f->io_size =1 << v->data_dev_block_bits; +else + f->io_size = v->fec->roots <<SECTOR_SHIFT ; + f->bufio =dm_bufio_client_create (f->dev->bdev, - f->roots <<SECTOR_SHIFT , + f->io_size,1 ,0 ,NULL ,NULL );if (IS_ERR (f->bufio)) { ti->error ="Cannot initialize FEC bufio client" ;
drivers/md/dm-verity-fec.h +1 -0
@@ -36,6 +36,7 @@ struct dm_verity_fec {struct dm_dev *dev;/* parity data device */ struct dm_bufio_client *data_bufio;/* for data dev access */ struct dm_bufio_client *bufio;/* for parity data access */ +size_t io_size;/* IO size for roots */ sector_t start;/* parity data start in blocks */ sector_t blocks;/* number of blocks covered */ sector_t rounds;/* number of interleaving rounds */
Greg Kroah-Hartman
maintainerPATCH 60/122 readdir: make sure to verify directory entry for legacy interfaces too
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
commit 0c93ac69407d63a85be0129aa55ffaec27ffebd3 upstream.
This does the directory entry name verification for the legacy "fillonedir" (and compat) interface that goes all the way back to the dark ages before we had a proper dirent, and the readdir() system call returned just a single entry at a time.
Nobody should use this interface unless you still have binaries from 1991, but let's do it right.
This came up during discussions about unsafe_copy_to_user() and proper checking of all the inputs to it, as the networking layer is looking to use it in a few new places. So let's make sure the _old_ users do it all right and proper, before we add new ones.
See also commit 8a23eb804ca4 ("Make filldir[64]() verify the directory entry filename is valid") which did the proper modern interfaces that people actually use. It had a note:
Note that I didn't bother adding the checks to any legacy interfaces that nobody uses.
which this now corrects. Note that we really don't care about POSIX and the presense of '/' in a directory entry, but verify_dirent_name() also ends up doing the proper name length verification which is what the input checking discussion was about.
[ Another option would be to remove the support for this particular very
old interface: any binaries that use it are likely a.out binaries, and they will no longer run anyway since we removed a.out binftm support in commit eac616557050 ("x86: Deprecate a.out support").
But I'm not sure which came first: getdents() or ELF support, so let's pretend somebody might still have a working binary that uses the legacy readdir() case.. ]
--- fs/readdir.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/readdir.c +6 -0
@@ -150,6 +150,9 @@ static int fillonedir(struct dir_contextif (buf->result)return -EINVAL ; + buf->result =verify_dirent_name (name, namlen); +if (buf->result <0 ) +return buf->result; d_ino = ino;if (sizeof (d_ino) <sizeof (ino) && d_ino != ino) { buf->result = -EOVERFLOW ;
@@ -405,6 +408,9 @@ static int compat_fillonedir(struct dir_if (buf->result)return -EINVAL ; + buf->result =verify_dirent_name (name, namlen); +if (buf->result <0 ) +return buf->result; d_ino = ino;if (sizeof (d_ino) <sizeof (ino) && d_ino != ino) { buf->result = -EOVERFLOW ;
Greg Kroah-Hartman
maintainerPATCH 61/122 drm/i915: Dont zero out the Y planes watermarks
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
commit bf52dc49ba0101f648b4c3ea26b812061406b0d4 upstream.
Don't zero out the watermarks for the Y plane since we've already computed them when computing the UV plane's watermarks (since the UV plane always appears before ethe Y plane when iterating through the planes).
This leads to allocating no DDB for the Y plane since .min_ddb_alloc also gets zeroed. And that of course leads to underruns when scanning out planar formats.
--- drivers/gpu/drm/i915/intel_pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -2
@@ -5539,12 +5539,12 @@ static int icl_build_plane_wm(struct intstruct skl_plane_wm *wm = &crtc_state->wm.skl.raw.planes[plane_id];int ret; -memset (wm,0 ,sizeof (*wm)); -/* Watermarks calculated in master */ if (plane_state->planar_slave)return 0 ; +memset (wm,0 ,sizeof (*wm)); +if (plane_state->planar_linked_plane) {const struct drm_framebuffer *fb = plane_state->hw.fb;enum plane_id y_plane_id = plane_state->planar_linked_plane->id;
Greg Kroah-Hartman
maintainerPATCH 62/122 arm64: fix inline asm in load_unaligned_zeropad()
In reply to Greg Kroah-HartmanFrom: Peter Collingbourne <[email protected]>
commit 185f2e5f51c2029efd9dd26cceb968a44fe053c6 upstream.
The inline asm's addr operand is marked as input-only, however in the case where an exception is taken it may be modified by the BIC instruction on the exception path. Fix the problem by using a temporary register as the destination register for the BIC instruction.
--- arch/arm64/include/asm/word-at-a-time.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm64/include/asm/word-at-a-time.h +5 -5
@@ -53,7 +53,7 @@ static inline unsigned long find_zero(un*/ static inline unsigned long load_unaligned_zeropad (const void *addr) { -unsigned long ret, offset; +unsigned long ret, tmp;/* Load word from unaligned pointer addr */ asm(
@@ -61,9 +61,9 @@ static inline unsigned long load_unalign"2:\n" " .pushsection .fixup,\"ax\"\n" " .align 2\n" -"3: and %1, %2, #0x7\n" -" bic %2, %2, #0x7\n" -" ldr %0, [%2]\n" +"3: bic %1, %2, #0x7\n" +" ldr %0, [%1]\n" +" and %1, %2, #0x7\n" " lsl %1, %1, #0x3\n" #ifndef __AARCH64EB__" lsr %0, %0, %1\n"
@@ -73,7 +73,7 @@ static inline unsigned long load_unalign" b 2b\n" " .popsection\n" _ASM_EXTABLE(1b ,3b ) - : "=&r" (ret), "=&r" (offset) + : "=&r" (ret), "=&r" (tmp) : "r" (addr), "Q" (*(unsigned long *)addr)); return ret;
Greg Kroah-Hartman
maintainerPATCH 63/122 arm64: mte: Ensure TIF_MTE_ASYNC_FAULT is set atomically
In reply to Greg Kroah-HartmanFrom: Catalin Marinas <[email protected]>
commit 2decad92f4731fac9755a083fcfefa66edb7d67d upstream.
The entry from EL0 code checks the TFSRE0_EL1 register for any asynchronous tag check faults in user space and sets the TIF_MTE_ASYNC_FAULT flag. This is not done atomically, potentially racing with another CPU calling set_tsk_thread_flag().
Replace the non-atomic ORR+STR with an STSET instruction. While STSET requires ARMv8.1 and an assembler that understands LSE atomics, the MTE feature is part of ARMv8.5 and already requires an updated assembler.
--- arch/arm64/Kconfig | 6 +++++- arch/arm64/kernel/entry.S | 10 ++++++---- 2 files changed, 11 insertions(+), 5 deletions(-)
arch/arm64/Kconfig +5 -1
@@ -1399,10 +1399,13 @@ config ARM64_PAN config AS_HAS_LDAPR def_bool $(as-instr,.arch_extension rcpc) +config AS_HAS_LSE_ATOMICS + def_bool $(as-instr,.arch_extension lse) + config ARM64_LSE_ATOMICS bool default ARM64_USE_LSE_ATOMICS - depends on $(as-instr,.arch_extension lse) + depends on AS_HAS_LSE_ATOMICS config ARM64_USE_LSE_ATOMICS bool "Atomic instructions"
@@ -1659,6 +1662,7 @@ config ARM64_MTE default y depends on ARM64_AS_HAS_MTE && ARM64_TAGGED_ADDR_ABI depends on AS_HAS_ARMV8_5 + depends on AS_HAS_LSE_ATOMICS # Required for tag checking in the uaccess routines depends on ARM64_PAN select ARCH_USES_HIGH_VMA_FLAGS
arch/arm64/kernel/entry.S +6 -4
@@ -148,16 +148,18 @@ alternative_cb_end .endm /* Check for MTE asynchronous tag check faults */ - .macro check_mte_async_tcf, flgs, tmp + .macro check_mte_async_tcf, tmp, ti_flags #ifdef CONFIG_ARM64_MTE + .arch_extension lse alternative_if_not ARM64_MTE b 1f alternative_else_nop_endif mrs_s \tmp, SYS_TFSRE0_EL1 tbz \tmp, #SYS_TFSR_EL1_TF0_SHIFT, 1f /* Asynchronous TCF occurred for TTBR0 access, set the TI flag */ - orr \flgs, \flgs, #_TIF_MTE_ASYNC_FAULT - str \flgs, [tsk, #TSK_TI_FLAGS] + mov \tmp, #_TIF_MTE_ASYNC_FAULT + add \ti_flags, tsk, #TSK_TI_FLAGS + stset \tmp, [\ti_flags] msr_s SYS_TFSRE0_EL1, xzr 1: #endif
@@ -244,7 +246,7 @@ alternative_else_nop_endif disable_step_tsk x19, x20 /* Check for asynchronous tag check faults in user space */ - check_mte_async_tcf x19, x22 + check_mte_async_tcf x22, x23 apply_ssbd 1, x22, x23 ptrauth_keys_install_kernel tsk, x20, x22, x23
Greg Kroah-Hartman
maintainerPATCH 64/122 arm64: alternatives: Move length validation in alternative_{insn, endif}
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit 22315a2296f4c251fa92aec45fbbae37e9301b6c upstream.
After commit 2decad92f473 ("arm64: mte: Ensure TIF_MTE_ASYNC_FAULT is set atomically"), LLVM's integrated assembler fails to build entry.S:
<instantiation>:5:7: error: expected assembly-time absolute expression
.org . - (664b-663b) + (662b-661b)
^
<instantiation>:6:7: error: expected assembly-time absolute expression
.org . - (662b-661b) + (664b-663b)
^The root cause is LLVM's assembler has a one-pass design, meaning it cannot figure out these instruction lengths when the .org directive is outside of the subsection that they are in, which was changed by the .arch_extension directive added in the above commit.
Apply the same fix from commit 966a0acce2fc ("arm64/alternatives: move length validation inside the subsection") to the alternative_endif macro, shuffling the .org directives so that the length validation happen will always happen in the same subsections. alternative_insn has not shown any issue yet but it appears that it could have the same issue in the future so just preemptively change it.
--- arch/arm64/include/asm/alternative-macros.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/include/asm/alternative-macros.h +4 -4
@@ -97,9 +97,9 @@ .popsection .subsection 1 663: \insn2 -664: .previous - .org . - (664b-663b) + (662b-661b) +664: .org . - (664b-663b) + (662b-661b) .org . - (662b-661b) + (664b-663b) + .previous .endif .endm
@@ -169,11 +169,11 @@*/ .macro alternative_endif 664: + .org . - (664b-663b) + (662b-661b) + .org . - (662b-661b) + (664b-663b) .if .Lasm_alt_mode==0 .previous .endif - .org . - (664b-663b) + (662b-661b) - .org . - (662b-661b) + (664b-663b) .endm/*
Greg Kroah-Hartman
maintainerPATCH 65/122 vfio/pci: Add missing range check in vfio_pci_mmap
In reply to Greg Kroah-HartmanFrom: Christian A. Ehrhardt <[email protected]>
commit 909290786ea335366e21d7f1ed5812b90f2f0a92 upstream.
When mmaping an extra device region verify that the region index derived from the mmap offset is valid.
Message-Id: <[email protected]>
--- drivers/vfio/pci/vfio_pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/vfio/pci/vfio_pci.c +3 -1
@@ -1658,6 +1658,8 @@ static int vfio_pci_mmap(void *device_da index = vma->vm_pgoff >> (VFIO_PCI_OFFSET_SHIFT -PAGE_SHIFT ); +if (index >=VFIO_PCI_NUM_REGIONS + vdev->num_regions) +return -EINVAL ;if (vma->vm_end < vma->vm_start)return -EINVAL ;if ((vma->vm_flags &VM_SHARED ) ==0 )
@@ -1666,7 +1668,7 @@ static int vfio_pci_mmap(void *device_daint regnum = index -VFIO_PCI_NUM_REGIONS ;struct vfio_pci_region *region = vdev->region + regnum; -if (region && region->ops && region->ops->mmap && +if (region->ops && region->ops->mmap && (region->flags &VFIO_REGION_INFO_FLAG_MMAP ))return region->ops->mmap (vdev, region, vma);return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 66/122 riscv: Fix spelling mistake "SPARSEMEM" to "SPARSMEM"
In reply to Greg Kroah-HartmanFrom: Kefeng Wang <[email protected]>
commit 199fc6b8dee7d6d50467a57e0dc7e3e1b7d59966 upstream.
There is a spelling mistake when SPARSEMEM Kconfig copy.
--- arch/riscv/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/Kconfig +1 -1
@@ -147,7 +147,7 @@ config ARCH_FLATMEM_ENABLE config ARCH_SPARSEMEM_ENABLE def_bool y depends on MMU - select SPARSEMEM_STATIC if 32BIT && SPARSMEM + select SPARSEMEM_STATIC if 32BIT && SPARSEMEM select SPARSEMEM_VMEMMAP_ENABLE if 64BIT config ARCH_SELECT_MEMORY_MODEL
Greg Kroah-Hartman
maintainerPATCH 67/122 scsi: libsas: Reset num_scatter if libata marks qc as NODATA
In reply to Greg Kroah-HartmanFrom: Jolly Shah <[email protected]>
commit 176ddd89171ddcf661862d90c5d257877f7326d6 upstream.
When the cache_type for the SCSI device is changed, the SCSI layer issues a MODE_SELECT command. The caching mode details are communicated via a request buffer associated with the SCSI command with data direction set as DMA_TO_DEVICE (scsi_mode_select()). When this command reaches the libata layer, as a part of generic initial setup, libata layer sets up the scatterlist for the command using the SCSI command (ata_scsi_qc_new()). This command is then translated by the libata layer into ATA_CMD_SET_FEATURES (ata_scsi_mode_select_xlat()). The libata layer treats this as a non-data command (ata_mselect_caching()), since it only needs an ATA taskfile to pass the caching on/off information to the device. It does not need the scatterlist that has been setup, so it does not perform dma_map_sg() on the scatterlist (ata_qc_issue()). Unfortunately, when this command reaches the libsas layer (sas_ata_qc_issue()), libsas layer sees it as a non-data command with a scatterlist. It cannot extract the correct DMA length since the scatterlist has not been mapped with dma_map_sg() for a DMA operation. When this partially constructed SAS task reaches pm80xx LLDD, it results in the following warning:
"pm80xx_chip_sata_req 6058: The sg list address start_addr=0x0000000000000000 data_len=0x0end_addr_high=0xffffffff end_addr_low=0xffffffff has crossed 4G boundary"
Update libsas to handle ATA non-data commands separately so num_scatter and total_xfer_len remain 0.
--- drivers/scsi/libsas/sas_ata.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/scsi/libsas/sas_ata.c +4 -5
@@ -201,18 +201,17 @@ static unsigned int sas_ata_qc_issue(strmemcpy (task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len); task->total_xfer_len = qc->nbytes; task->num_scatter = qc->n_elem; + task->data_dir = qc->dma_dir; + }else if (qc->tf.protocol ==ATA_PROT_NODATA ) { + task->data_dir =DMA_NONE ; }else {for_each_sg (qc->sg, sg, qc->n_elem, si) xfer +=sg_dma_len (sg); task->total_xfer_len = xfer; task->num_scatter = si; - } - -if (qc->tf.protocol ==ATA_PROT_NODATA ) - task->data_dir =DMA_NONE ; -else task->data_dir = qc->dma_dir; + } task->scatter = qc->sg; task->ata_task.retry_count =1 ; task->task_state_flags =SAS_TASK_STATE_PENDING ;
Greg Kroah-Hartman
maintainerPATCH 68/122 drm/vmwgfx: Make sure we unpin no longer needed buffers
In reply to Greg Kroah-HartmanFrom: Zack Rusin <[email protected]>
commit ab4d9913632b1e5ffcf3365783e98718b3c83c7f upstream.
We were not correctly unpinning no longer needed buffers. In particular vmw_buffer_object, which is internally often pinned on creation wasn't unpinned on destruction and none of the internal MOB buffers were unpinned before being put back. Technically this existed for a long time but commit 57fcd550eb15 ("drm/ttm: Warn on pinning without holding a reference") introduced a WARN_ON which was filling up the kernel logs rather quickly.
Quite frankly internal usage of vmw_buffer_object and in general pinning needs to be refactored in vmwgfx but for now this makes it work.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 4 ++++ 2 files changed, 6 insertions(+)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +2 -0
@@ -1554,6 +1554,8 @@ static inline void vmw_bo_unreference(st *buf =NULL ;if (tmp_buf !=NULL ) { +if (tmp_buf->base.pin_count >0 ) +ttm_bo_unpin (&tmp_buf->base);ttm_bo_put (&tmp_buf->base); } }
drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +4 -0
@@ -277,6 +277,7 @@ out_no_setup: &batch->otables[i]); } +ttm_bo_unpin (batch->otable_bo);ttm_bo_put (batch->otable_bo); batch->otable_bo =NULL ;return ret;
@@ -342,6 +343,7 @@ static void vmw_otable_batch_takedown(stvmw_bo_fence_single (bo,NULL );ttm_bo_unreserve (bo); +ttm_bo_unpin (batch->otable_bo);ttm_bo_put (batch->otable_bo); batch->otable_bo =NULL ; }
@@ -528,6 +530,7 @@ static void vmw_mob_pt_setup(struct vmw_void vmw_mob_destroy (struct vmw_mob *mob) {if (mob->pt_bo) { +ttm_bo_unpin (mob->pt_bo);ttm_bo_put (mob->pt_bo); mob->pt_bo =NULL ; }
@@ -643,6 +646,7 @@ int vmw_mob_bind(struct vmw_private *dev out_no_cmd_space:vmw_fifo_resource_dec (dev_priv);if (pt_set_up) { +ttm_bo_unpin (mob->pt_bo);ttm_bo_put (mob->pt_bo); mob->pt_bo =NULL ; }
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Greg Kroah-Hartman
maintainerPATCH 69/122 ixgbe: Fix NULL pointer dereference in ethtool loopback test
In reply to Greg Kroah-HartmanFrom: Alexander Duyck <[email protected]>
commit 31166efb1cee348eb6314e9c0095d84cbeb66b9d upstream.
The ixgbe driver currently generates a NULL pointer dereference when performing the ethtool loopback test. This is due to the fact that there isn't a q_vector associated with the test ring when it is setup as interrupts are not normally added to the test rings.
To address this I have added code that will check for a q_vector before returning a napi_id value. If a q_vector is not present it will return a value of 0.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +8 -1
@@ -6540,6 +6540,13 @@ err_setup_tx:return err; } +static int ixgbe_rx_napi_id (struct ixgbe_ring *rx_ring) +{ +struct ixgbe_q_vector *q_vector = rx_ring->q_vector; + +return q_vector ? q_vector->napi.napi_id :0 ; +} +/** * ixgbe_setup_rx_resources - allocate Rx resources (Descriptors) * @adapter: pointer to ixgbe_adapter
@@ -6587,7 +6594,7 @@ int ixgbe_setup_rx_resources(struct ixgb/* XDP RX-queue info */ if (xdp_rxq_info_reg (&rx_ring->xdp_rxq, adapter->netdev, - rx_ring->queue_index, rx_ring->q_vector->napi.napi_id) <0 ) + rx_ring->queue_index,ixgbe_rx_napi_id (rx_ring)) <0 ) goto err; rx_ring->xdp_prog = adapter->xdp_prog;
Greg Kroah-Hartman
maintainerPATCH 70/122 ixgbe: fix unbalanced device enable/disable in suspend/resume
In reply to Greg Kroah-HartmanFrom: Yongxin Liu <[email protected]>
commit debb9df311582c83fe369baa35fa4b92e8a9c58a upstream.
pci_disable_device() called in __ixgbe_shutdown() decreases dev->enable_cnt by 1. pci_enable_device_mem() which increases dev->enable_cnt by 1, was removed from ixgbe_resume() in commit 6f82b2558735 ("ixgbe: use generic power management"). This caused unbalanced increase/decrease. So add pci_enable_device_mem() back.
Fix the following call trace.
ixgbe 0000:17:00.1: disabling already-disabled device
Call Trace: __ixgbe_shutdown+0x10a/0x1e0 [ixgbe] ixgbe_suspend+0x32/0x70 [ixgbe] pci_pm_suspend+0x87/0x160 ? pci_pm_freeze+0xd0/0xd0 dpm_run_callback+0x42/0x170 __device_suspend+0x114/0x460 async_suspend+0x1f/0xa0 async_run_entry_fn+0x3c/0xf0 process_one_work+0x1dd/0x410 worker_thread+0x34/0x3f0 ? cancel_delayed_work+0x90/0x90 kthread+0x14c/0x170 ? kthread_park+0x90/0x90 ret_from_fork+0x1f/0x30
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +5 -0
@@ -6903,6 +6903,11 @@ static int __maybe_unused ixgbe_resume(s adapter->hw.hw_addr = adapter->io_addr; + err =pci_enable_device_mem (pdev); +if (err) { +e_dev_err ("Cannot enable PCI device from suspend\n" ); +return err; + }smp_mb__before_atomic ();clear_bit (__IXGBE_DISABLED, &adapter->state);pci_set_master (pdev);
Greg Kroah-Hartman
maintainerPATCH 71/122 netfilter: flowtable: fix NAT IPv6 offload mangling
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
commit 0e07e25b481aa021e4b48085ecb8a049e9614510 upstream.
Fix out-of-bound access in the address array.
--- net/netfilter/nf_flow_table_offload.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/netfilter/nf_flow_table_offload.c +3 -3
@@ -305,12 +305,12 @@ static void flow_offload_ipv6_mangle(str const __be32 *addr, const __be32 *mask) { struct flow_action_entry *entry; -int i; +int i, j; -for (i =0 ; i <sizeof (struct in6_addr ) /sizeof (u32); i +=sizeof (u32)) { +for (i =0 , j =0 ; i <sizeof (struct in6_addr ) /sizeof (u32); i +=sizeof (u32), j++) { entry =flow_action_entry_next (flow_rule);flow_offload_mangle (entry,FLOW_ACT_MANGLE_HDR_TYPE_IP6 , - offset + i, &addr[i], mask); + offset + i, &addr[j], mask); } }
Greg Kroah-Hartman
maintainerPATCH 72/122 netfilter: conntrack: do not print icmpv6 as unknown via /proc
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
commit fbea31808ca124dd73ff6bb1e67c9af4607c3e32 upstream.
/proc/net/nf_conntrack shows icmpv6 as unknown.
--- net/netfilter/nf_conntrack_standalone.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/nf_conntrack_standalone.c +1 -0
@@ -266,6 +266,7 @@ static const char* l4proto_name(u16 protcase IPPROTO_GRE :return "gre" ;case IPPROTO_SCTP :return "sctp" ;case IPPROTO_UDPLITE :return "udplite" ; +case IPPROTO_ICMPV6 :return "icmpv6" ; }return "unknown" ;
Greg Kroah-Hartman
maintainerPATCH 73/122 ice: Fix potential infinite loop when using u8 loop counter
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
commit ef963ae427aa4669905e0a96b3bd9d44dc85db32 upstream.
A for-loop is using a u8 loop counter that is being compared to a u32 cmp_dcbcfg->numapp to check for the end of the loop. If cmp_dcbcfg->numapp is larger than 255 then the counter j will wrap around to zero and hence an infinite loop occurs. Fix this by making counter j the same type as cmp_dcbcfg->numapp.
Addresses-Coverity: ("Infinite loop")
--- drivers/net/ethernet/intel/ice/ice_dcb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_dcb.c +2 -2
@@ -747,8 +747,8 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_ce struct ice_port_info *pi) {u32 status, tlv_status =le32_to_cpu (cee_cfg->tlv_status); -u32 ice_aqc_cee_status_mask, ice_aqc_cee_status_shift; -u8 i, j, err, sync, oper, app_index, ice_app_sel_type; +u32 ice_aqc_cee_status_mask, ice_aqc_cee_status_shift, j; +u8 i, err, sync, oper, app_index, ice_app_sel_type;u16 app_prio =le16_to_cpu (cee_cfg->oper_app_prio);u16 ice_aqc_cee_app_mask, ice_aqc_cee_app_shift;struct ice_dcbx_cfg *cmp_dcbcfg, *dcbcfg;
Greg Kroah-Hartman
maintainerPATCH 74/122 libnvdimm/region: Fix nvdimm_has_flush() to handle ND_REGION_ASYNC
In reply to Greg Kroah-HartmanFrom: Vaibhav Jain <[email protected]>
commit a2948b17f6b936fc52f86c0f92c46d2f91928b79 upstream.
In case a platform doesn't provide explicit flush-hints but provides an explicit flush callback via ND_REGION_ASYNC region flag, then nvdimm_has_flush() still returns '0' indicating that writes do not require flushing. This happens on PPC64 with patch at [1] applied, where 'deep_flush' of a region was denied even though an explicit flush function was provided.
Fix this by adding a condition to nvdimm_has_flush() to test for the ND_REGION_ASYNC flag on the region and see if a 'region->flush' callback is assigned.
--- drivers/nvdimm/region_devs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/nvdimm/region_devs.c +7 -2
@@ -1239,6 +1239,11 @@ int nvdimm_has_flush(struct nd_region *n || !IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API))return -ENXIO ; +/* Test if an explicit flush function is defined */ +if (test_bit (ND_REGION_ASYNC , &nd_region->flags) && nd_region->flush) +return 1 ; + +/* Test if any flush hints for the region are available */ for (i =0 ; i < nd_region->ndr_mappings; i++) {struct nd_mapping *nd_mapping = &nd_region->mapping[i];struct nvdimm *nvdimm = nd_mapping->nvdimm;
@@ -1249,8 +1254,8 @@ int nvdimm_has_flush(struct nd_region *n }/* -* The platform defines dimm devices without hints, assume -* platform persistence mechanism like ADR +* The platform defines dimm devices without hints nor explicit flush, +* assume platform persistence mechanism like ADR */ return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 75/122 netfilter: bridge: add pre_exit hooks for ebtable unregistration
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
commit 7ee3c61dcd28bf6e290e06ad382f13511dc790e9 upstream.
Just like ip/ip6/arptables, the hooks have to be removed, then synchronize_rcu() has to be called to make sure no more packets are being processed before the ruleset data is released.
Place the hook unregistration in the pre_exit hook, then call the new ebtables pre_exit function from there.
Years ago, when first netns support got added for netfilter+ebtables, this used an older (now removed) netfilter hook unregister API, that did a unconditional synchronize_rcu().
Now that all is done with call_rcu, ebtable_{filter,nat,broute} pernet exit handlers may free the ebtable ruleset while packets are still in flight.
This can only happens on module removal, not during netns exit.
The new function expects the table name, not the table struct.
This is because upcoming patch set (targeting -next) will remove all net->xt.{nat,filter,broute}_table instances, this makes it necessary to avoid external references to those member variables.
The existing APIs will be converted, so follow the upcoming scheme of passing name + hook type instead.
--- include/linux/netfilter_bridge/ebtables.h | 5 +++-- net/bridge/netfilter/ebtable_broute.c | 8 +++++++- net/bridge/netfilter/ebtable_filter.c | 8 +++++++- net/bridge/netfilter/ebtable_nat.c | 8 +++++++- net/bridge/netfilter/ebtables.c | 30 +++++++++++++++++++++++++++--- 5 files changed, 51 insertions(+), 8 deletions(-)
include/linux/netfilter_bridge/ebtables.h +3 -2
@@ -110,8 +110,9 @@ extern int ebt_register_table(struct netconst struct ebt_table *table, const struct nf_hook_ops *ops, struct ebt_table **res); -extern void ebt_unregister_table (struct net *net,struct ebt_table *table, -const struct nf_hook_ops *); +extern void ebt_unregister_table (struct net *net,struct ebt_table *table); +void ebt_unregister_table_pre_exit (struct net *net,const char *tablename, +const struct nf_hook_ops *ops);extern unsigned int ebt_do_table (struct sk_buff *skb,const struct nf_hook_state *state,struct ebt_table *table);
net/bridge/netfilter/ebtable_broute.c +7 -1
@@ -105,14 +105,20 @@ static int __net_init broute_net_init(st &net->xt.broute_table); } +static void __net_exit broute_net_pre_exit(struct net *net) +{ +ebt_unregister_table_pre_exit (net,"broute" , &ebt_ops_broute); +} + static void __net_exit broute_net_exit(struct net *net) { -ebt_unregister_table (net, net->xt.broute_table, &ebt_ops_broute); +ebt_unregister_table (net, net->xt.broute_table); }static struct pernet_operations broute_net_ops = { .init = broute_net_init, .exit = broute_net_exit, + .pre_exit = broute_net_pre_exit, };static int __init ebtable_broute_init (void )
net/bridge/netfilter/ebtable_filter.c +7 -1
@@ -99,14 +99,20 @@ static int __net_init frame_filter_net_i &net->xt.frame_filter); } +static void __net_exit frame_filter_net_pre_exit(struct net *net) +{ +ebt_unregister_table_pre_exit (net,"filter" , ebt_ops_filter); +} + static void __net_exit frame_filter_net_exit(struct net *net) { -ebt_unregister_table (net, net->xt.frame_filter, ebt_ops_filter); +ebt_unregister_table (net, net->xt.frame_filter); }static struct pernet_operations frame_filter_net_ops = { .init = frame_filter_net_init, .exit = frame_filter_net_exit, + .pre_exit = frame_filter_net_pre_exit, };static int __init ebtable_filter_init (void )
net/bridge/netfilter/ebtable_nat.c +7 -1
@@ -99,14 +99,20 @@ static int __net_init frame_nat_net_init &net->xt.frame_nat); } +static void __net_exit frame_nat_net_pre_exit(struct net *net) +{ +ebt_unregister_table_pre_exit (net,"nat" , ebt_ops_nat); +} + static void __net_exit frame_nat_net_exit(struct net *net) { -ebt_unregister_table (net, net->xt.frame_nat, ebt_ops_nat); +ebt_unregister_table (net, net->xt.frame_nat); }static struct pernet_operations frame_nat_net_ops = { .init = frame_nat_net_init, .exit = frame_nat_net_exit, + .pre_exit = frame_nat_net_pre_exit, };static int __init ebtable_nat_init (void )
net/bridge/netfilter/ebtables.c +27 -3
@@ -1232,10 +1232,34 @@ out:return ret; } -void ebt_unregister_table (struct net *net,struct ebt_table *table, -const struct nf_hook_ops *ops) +static struct ebt_table *__ebt_find_table (struct net *net,const char *name) +{ +struct ebt_table *t; + +mutex_lock (&ebt_mutex); + +list_for_each_entry (t, &net->xt.tables[NFPROTO_BRIDGE ], list) { +if (strcmp (t->name, name) ==0 ) { +mutex_unlock (&ebt_mutex); +return t; + } + } + +mutex_unlock (&ebt_mutex); +return NULL ; +} + +void ebt_unregister_table_pre_exit (struct net *net,const char *name,const struct nf_hook_ops *ops) +{ +struct ebt_table *table =__ebt_find_table (net, name); + +if (table) +nf_unregister_net_hooks (net, ops,hweight32 (table->valid_hooks)); +} +EXPORT_SYMBOL (ebt_unregister_table_pre_exit); + +void ebt_unregister_table (struct net *net,struct ebt_table *table) { -nf_unregister_net_hooks (net, ops,hweight32 (table->valid_hooks));__ebt_unregister_table (net, table); }
Greg Kroah-Hartman
maintainerPATCH 76/122 netfilter: arp_tables: add pre_exit hook for table unregister
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
commit d163a925ebbc6eb5b562b0f1d72c7e817aa75c40 upstream.
Same problem that also existed in iptables/ip(6)tables, when arptable_filter is removed there is no longer a wait period before the table/ruleset is free'd.
Unregister the hook in pre_exit, then remove the table in the exit function.
This used to work correctly because the old nf_hook_unregister API did unconditional synchronize_net.
The per-net hook unregister function uses call_rcu instead.
--- include/linux/netfilter_arp/arp_tables.h | 5 +++-- net/ipv4/netfilter/arp_tables.c | 9 +++++++-- net/ipv4/netfilter/arptable_filter.c | 10 +++++++++- 3 files changed, 19 insertions(+), 5 deletions(-)
include/linux/netfilter_arp/arp_tables.h +3 -2
@@ -52,8 +52,9 @@ extern void *arpt_alloc_initial_table(coint arpt_register_table (struct net *net,const struct xt_table *table,const struct arpt_replace *repl,const struct nf_hook_ops *ops,struct xt_table **res); -void arpt_unregister_table (struct net *net,struct xt_table *table, -const struct nf_hook_ops *ops); +void arpt_unregister_table (struct net *net,struct xt_table *table); +void arpt_unregister_table_pre_exit (struct net *net,struct xt_table *table, +const struct nf_hook_ops *ops);extern unsigned int arpt_do_table (struct sk_buff *skb,const struct nf_hook_state *state,struct xt_table *table);
net/ipv4/netfilter/arp_tables.c +7 -2
@@ -1541,10 +1541,15 @@ out_free:return ret; } -void arpt_unregister_table (struct net *net,struct xt_table *table, -const struct nf_hook_ops *ops) +void arpt_unregister_table_pre_exit (struct net *net,struct xt_table *table, +const struct nf_hook_ops *ops) {nf_unregister_net_hooks (net, ops,hweight32 (table->valid_hooks)); +} +EXPORT_SYMBOL (arpt_unregister_table_pre_exit); + +void arpt_unregister_table (struct net *net,struct xt_table *table) +{__arpt_unregister_table (net, table); }
net/ipv4/netfilter/arptable_filter.c +9 -1
@@ -56,16 +56,24 @@ static int __net_init arptable_filter_tareturn err; } +static void __net_exit arptable_filter_net_pre_exit(struct net *net) +{ +if (net->ipv4.arptable_filter) +arpt_unregister_table_pre_exit (net, net->ipv4.arptable_filter, + arpfilter_ops); +} + static void __net_exit arptable_filter_net_exit(struct net *net) {if (!net->ipv4.arptable_filter)return ; -arpt_unregister_table (net, net->ipv4.arptable_filter, arpfilter_ops); +arpt_unregister_table (net, net->ipv4.arptable_filter); net->ipv4.arptable_filter =NULL ; }static struct pernet_operations arptable_filter_net_ops = { .exit = arptable_filter_net_exit, + .pre_exit = arptable_filter_net_pre_exit, };static int __init arptable_filter_init (void )
Greg Kroah-Hartman
maintainerPATCH 77/122 libbpf: Fix potential NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: Ciara Loftus <[email protected]>
commit afd0be7299533bb2e2b09104399d8a467ecbd2c5 upstream.
Wait until after the UMEM is checked for null to dereference it.
--- tools/lib/bpf/xsk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/lib/bpf/xsk.c +3 -2
@@ -777,18 +777,19 @@ int xsk_socket__create_shared(struct xskstruct xsk_ring_cons *comp, const struct xsk_socket_config *usr_config) { + bool unmap, rx_setup_done = false, tx_setup_done = false;void *rx_map =NULL , *tx_map =NULL ;struct sockaddr_xdp sxdp = {};struct xdp_mmap_offsets off;struct xsk_socket *xsk;struct xsk_ctx *ctx;int err, ifindex; -bool unmap = umem->fill_save != fill; -bool rx_setup_done = false, tx_setup_done = false;if (!umem || !xsk_ptr || !(rx || tx))return -EFAULT ; + unmap = umem->fill_save != fill; + xsk =calloc (1 ,sizeof (*xsk));if (!xsk)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 78/122 drm/i915/display/vlv_dsi: Do not skip panel_pwr_cycle_delay when disabling the panel
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit aee6f25e9c911323aa89a200e1bb160c1613ed3d upstream.
After the recently added commit fe0f1e3bfdfe ("drm/i915: Shut down displays gracefully on reboot"), the DSI panel on a Cherry Trail based Predia Basic tablet would no longer properly light up after reboot.
I've managed to reproduce this without rebooting by doing:
chvt 3; echo 1 > /sys/class/graphics/fb0/blank;\
echo 0 > /sys/class/graphics/fb0/blank
Which rapidly turns the panel off and back on again.
The vlv_dsi.c code uses an intel_dsi_msleep() helper for the various delays used for panel on/off, since starting with MIPI-sequences version >= 3 the delays are already included inside the MIPI-sequences.
The problems exposed by the "Shut down displays gracefully on reboot" change, show that using this helper for the panel_pwr_cycle_delay is not the right thing to do. This has not been noticed until now because normally the panel never is cycled off and directly on again in quick succession.
Change the msleep for the panel_pwr_cycle_delay to a normal msleep() call to avoid the panel staying black after a quick off + on cycle.
--- drivers/gpu/drm/i915/display/vlv_dsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/vlv_dsi.c +2 -2
@@ -992,14 +992,14 @@ static void intel_dsi_post_disable(struc* FIXME As we do with eDP, just make a note of the time here * and perform the wait before the next panel power on. */ -intel_dsi_msleep (intel_dsi, intel_dsi->panel_pwr_cycle_delay); +msleep (intel_dsi->panel_pwr_cycle_delay); }static void intel_dsi_shutdown (struct intel_encoder *encoder) {struct intel_dsi *intel_dsi =enc_to_intel_dsi (encoder); -intel_dsi_msleep (intel_dsi, intel_dsi->panel_pwr_cycle_delay); +msleep (intel_dsi->panel_pwr_cycle_delay); } static bool intel_dsi_get_hw_state(struct intel_encoder *encoder,
Greg Kroah-Hartman
maintainerPATCH 79/122 net: macb: fix the restore of cmp registers
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
commit a714e27ea8bdee2b238748029d31472d0a65b611 upstream.
Commit a14d273ba159 ("net: macb: restore cmp registers on resume path") introduces the restore of CMP registers on resume path. In case the IP doesn't support type 2 screeners (zero on DCFG8 register) the struct macb::rx_fs_list::list is not initialized and thus the list_for_each_entry(item, &bp->rx_fs_list.list, list) loop introduced in commit a14d273ba159 ("net: macb: restore cmp registers on resume path") will access an uninitialized list leading to crash. Thus, initialize the struct macb::rx_fs_list::list without taking into account if the IP supports type 2 screeners or not.
--- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/cadence/macb_main.c +1 -1
@@ -3914,6 +3914,7 @@ static int macb_init(struct platform_dev reg =gem_readl (bp,DCFG8 ); bp->max_tuples =min ((GEM_BFEXT (SCR2CMP , reg) /3 ),GEM_BFEXT (T2SCR , reg)); +INIT_LIST_HEAD (&bp->rx_fs_list.list);if (bp->max_tuples >0 ) {/* also needs one ethtype match to check IPv4 */ if (GEM_BFEXT (SCR2ETH , reg) >0 ) {
@@ -3924,7 +3925,6 @@ static int macb_init(struct platform_dev/* Filtering is supported in hw but don't enable it in kernel now */ dev->hw_features |=NETIF_F_NTUPLE ;/* init Rx flow definitions */ -INIT_LIST_HEAD (&bp->rx_fs_list.list); bp->rx_fs_list.count =0 ;spin_lock_init (&bp->rx_fs_lock); }else
Greg Kroah-Hartman
maintainerPATCH 80/122 net/mlx5e: fix ingress_ifindex check in mlx5e_flower_parse_meta
In reply to Greg Kroah-HartmanFrom: wenxu <[email protected]>
commit e3e0f9b279705154b951d579dc3d8b7041710e24 upstream.
In the nft_offload there is the mate flow_dissector with no ingress_ifindex but with ingress_iftype that only be used in the software. So if the mask of ingress_ifindex in meta is 0, this meta check should be bypass.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +3 -0
@@ -2194,6 +2194,9 @@ static int mlx5e_flower_parse_meta(strucreturn 0 ;flow_rule_match_meta (rule, &match); +if (!match.mask->ingress_ifindex) +return 0 ; +if (match.mask->ingress_ifindex !=0xFFFFFFFF ) {NL_SET_ERR_MSG_MOD (extack,"Unsupported ingress ifindex mask" );return -EOPNOTSUPP ;
Greg Kroah-Hartman
maintainerPATCH 81/122 netfilter: nft_limit: avoid possible divide error in nft_limit_init
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit b895bdf5d643b6feb7c60856326dd4feb6981560 upstream.
div_u64() divides u64 by u32.
nft_limit_init() wants to divide u64 by u64, use the appropriate math function (div64_u64)
divide error: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 8390 Comm: syz-executor188 Not tainted 5.12.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:div_u64_rem include/linux/math64.h:28 [inline] RIP: 0010:div_u64 include/linux/math64.h:127 [inline] RIP: 0010:nft_limit_init+0x2a2/0x5e0 net/netfilter/nft_limit.c:85 Code: ef 4c 01 eb 41 0f 92 c7 48 89 de e8 38 a5 22 fa 4d 85 ff 0f 85 97 02 00 00 e8 ea 9e 22 fa 4c 0f af f3 45 89 ed 31 d2 4c 89 f0 <49> f7 f5 49 89 c6 e8 d3 9e 22 fa 48 8d 7d 48 48 b8 00 00 00 00 00 RSP: 0018:ffffc90009447198 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000200000000000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff875152e6 RDI: 0000000000000003 RBP: ffff888020f80908 R08: 0000200000000000 R09: 0000000000000000 R10: ffffffff875152d8 R11: 0000000000000000 R12: ffffc90009447270 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 FS: 000000000097a300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000200001c4 CR3: 0000000026a52000 CR4: 00000000001506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: nf_tables_newexpr net/netfilter/nf_tables_api.c:2675 [inline] nft_expr_init+0x145/0x2d0 net/netfilter/nf_tables_api.c:2713 nft_set_elem_expr_alloc+0x27/0x280 net/netfilter/nf_tables_api.c:5160 nf_tables_newset+0x1997/0x3150 net/netfilter/nf_tables_api.c:4321 nfnetlink_rcv_batch+0x85a/0x21b0 net/netfilter/nfnetlink.c:456 nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:580 [inline] nfnetlink_rcv+0x3af/0x420 net/netfilter/nfnetlink.c:598 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1338 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1927 sock_sendmsg_nosec net/socket.c:654 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:674 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2350 ___sys_sendmsg+0xf3/0x170 net/socket.c:2404 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2433 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae
--- net/netfilter/nft_limit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nft_limit.c +2 -2
@@ -76,13 +76,13 @@ static int nft_limit_init(struct nft_limreturn -EOVERFLOW ;if (pkts) { - tokens =div_u64 (limit->nsecs, limit->rate) * limit->burst; + tokens =div64_u64 (limit->nsecs, limit->rate) * limit->burst; }else {/* The token bucket size limits the number of tokens can be * accumulated. tokens_max specifies the bucket size. * tokens_max = unit * (rate + burst) / rate. */ - tokens =div_u64 (limit->nsecs * (limit->rate + limit->burst), + tokens =div64_u64 (limit->nsecs * (limit->rate + limit->burst), limit->rate); }
Greg Kroah-Hartman
maintainerPATCH 82/122 netfilter: nftables: clone set element expression template
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
commit 4d8f9065830e526c83199186c5f56a6514f457d2 upstream.
memcpy() breaks when using connlimit in set elements. Use nft_expr_clone() to initialize the connlimit expression list, otherwise connlimit garbage collector crashes when walking on the list head copy.
[ 493.064656] Workqueue: events_power_efficient nft_rhash_gc [nf_tables] [ 493.064685] RIP: 0010:find_or_evict+0x5a/0x90 [nf_conncount] [ 493.064694] Code: 2b 43 40 83 f8 01 77 0d 48 c7 c0 f5 ff ff ff 44 39 63 3c 75 df 83 6d 18 01 48 8b 43 08 48 89 de 48 8b 13 48 8b 3d ee 2f 00 00 <48> 89 42 08 48 89 10 48 b8 00 01 00 00 00 00 ad de 48 89 03 48 83 [ 493.064699] RSP: 0018:ffffc90000417dc0 EFLAGS: 00010297 [ 493.064704] RAX: 0000000000000000 RBX: ffff888134f38410 RCX: 0000000000000000 [ 493.064708] RDX: 0000000000000000 RSI: ffff888134f38410 RDI: ffff888100060cc0 [ 493.064711] RBP: ffff88812ce594a8 R08: ffff888134f38438 R09: 00000000ebb9025c [ 493.064714] R10: ffffffff8219f838 R11: 0000000000000017 R12: 0000000000000001 [ 493.064718] R13: ffffffff82146740 R14: ffff888134f38410 R15: 0000000000000000 [ 493.064721] FS: 0000000000000000(0000) GS:ffff88840e440000(0000) knlGS:0000000000000000 [ 493.064725] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 493.064729] CR2: 0000000000000008 CR3: 00000001330aa002 CR4: 00000000001706e0 [ 493.064733] Call Trace: [ 493.064737] nf_conncount_gc_list+0x8f/0x150 [nf_conncount] [ 493.064746] nft_rhash_gc+0x106/0x390 [nf_tables]
--- net/netfilter/nf_tables_api.c | 46 +++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 12 deletions(-)
net/netfilter/nf_tables_api.c +34 -12
@@ -5263,16 +5263,35 @@ err_expr:return -ENOMEM ; } -static void nft_set_elem_expr_setup (const struct nft_set_ext *ext,int i, -struct nft_expr *expr_array[]) +static int nft_set_elem_expr_setup (struct nft_ctx *ctx, +const struct nft_set_ext *ext, +struct nft_expr *expr_array[], +u32 num_exprs) {struct nft_set_elem_expr *elem_expr =nft_set_ext_expr (ext); -struct nft_expr *expr =nft_setelem_expr_at (elem_expr, elem_expr->size); +struct nft_expr *expr; +int i, err; -memcpy (expr, expr_array[i], expr_array[i]->ops->size); - elem_expr->size += expr_array[i]->ops->size; -kfree (expr_array[i]); - expr_array[i] =NULL ; +for (i =0 ; i < num_exprs; i++) { + expr =nft_setelem_expr_at (elem_expr, elem_expr->size); + err =nft_expr_clone (expr, expr_array[i]); +if (err <0 ) + goto err_elem_expr_setup; + + elem_expr->size += expr_array[i]->ops->size; +nft_expr_destroy (ctx, expr_array[i]); + expr_array[i] =NULL ; + } + +return 0 ; + +err_elem_expr_setup: +for (; i < num_exprs; i++) { +nft_expr_destroy (ctx, expr_array[i]); + expr_array[i] =NULL ; + } + +return -ENOMEM ; } static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set,
@@ -5524,12 +5543,15 @@ static int nft_add_set_elem(struct nft_c *nft_set_ext_obj (ext) = obj; obj->use++; } -for (i =0 ; i < num_exprs; i++) -nft_set_elem_expr_setup (ext, i, expr_array); + err =nft_set_elem_expr_setup (ctx, ext, expr_array, num_exprs); +if (err <0 ) + goto err_elem_expr; trans =nft_trans_elem_alloc (ctx,NFT_MSG_NEWSETELEM , set); -if (trans ==NULL ) - goto err_trans; +if (trans ==NULL ) { + err = -ENOMEM ; + goto err_elem_expr; + } ext->genmask =nft_genmask_cur (ctx->net) |NFT_SET_ELEM_BUSY_MASK ; err = set->ops->insert (ctx->net, set, &elem, &ext2);
@@ -5573,7 +5595,7 @@ err_set_full: set->ops->remove (ctx->net, set, &elem); err_element_clash:kfree (trans); -err_trans: +err_elem_expr:if (obj) obj->use--;
Greg Kroah-Hartman
maintainerPATCH 83/122 net/mlx5e: Fix setting of RS FEC mode
In reply to Greg Kroah-HartmanFrom: Aya Levin <[email protected]>
commit 7a320c9db3e73fb6c4f9a331087df9df18767221 upstream.
Change register setting from bit number to bit mask.
--- drivers/net/ethernet/mellanox/mlx5/core/en/port.c | 23 +++------------------- 1 file changed, 4 insertions(+), 19 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/port.c +4 -19
@@ -387,21 +387,6 @@ enum mlx5e_fec_supported_link_mode { *_policy = MLX5_GET(pplm_reg, _buf, fec_override_admin_##link); \ }while (0 ) -#define MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY (buf, policy, write, link) \ - do { \ - unsigned long policy_long; \ - u16 *__policy = &(policy); \ - bool _write = (write); \ - \ - policy_long = *__policy; \ - if (_write && *__policy) \ - *__policy = find_first_bit(&policy_long, \ - sizeof(policy_long) * BITS_PER_BYTE);\ - MLX5E_FEC_OVERRIDE_ADMIN_POLICY(buf, *__policy, _write, link); \ - if (!_write && *__policy) \ - *__policy = 1 << *__policy; \ - } while (0) -/* get/set FEC admin field for a given speed */ static int mlx5e_fec_admin_field(u32 *pplm, u16 *fec_policy, bool write,enum mlx5e_fec_supported_link_mode link_mode)
@@ -423,16 +408,16 @@ static int mlx5e_fec_admin_field(u32 *pp MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 100g);break ;case MLX5E_FEC_SUPPORTED_LINK_MODE_50G_1X : - MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(pplm, *fec_policy, write, 50g_1x); + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 50g_1x);break ;case MLX5E_FEC_SUPPORTED_LINK_MODE_100G_2X : - MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(pplm, *fec_policy, write, 100g_2x); + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 100g_2x);break ;case MLX5E_FEC_SUPPORTED_LINK_MODE_200G_4X : - MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(pplm, *fec_policy, write, 200g_4x); + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 200g_4x);break ;case MLX5E_FEC_SUPPORTED_LINK_MODE_400G_8X : - MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(pplm, *fec_policy, write, 400g_8x); + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 400g_8x);break ;default :return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 84/122 net: davicom: Fix regulator not turned off on failed probe
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit 31457db3750c0b0ed229d836f2609fdb8a5b790e upstream.
When the probe fails, we must disable the regulator that was previously enabled.
This patch is a follow-up to commit ac88c531a5b3
("net: davicom: Fix regulator not turned off on failed probe") which missed one case.
--- drivers/net/ethernet/davicom/dm9000.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/davicom/dm9000.c +4 -2
@@ -1471,8 +1471,10 @@ dm9000_probe(struct platform_device *pde/* Init network device */ ndev =alloc_etherdev (sizeof (struct board_info )); -if (!ndev) -return -ENOMEM ; +if (!ndev) { + ret = -ENOMEM ; + goto out_regulator_disable; + }SET_NETDEV_DEV (ndev, &pdev->dev);
Greg Kroah-Hartman
maintainerPATCH 85/122 net: phy: marvell: fix detection of PHY on Topaz switches
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 1fe976d308acb6374c899a4ee8025a0a016e453e upstream.
Since commit fee2d546414d ("net: phy: marvell: mv88e6390 temperature sensor reading"), Linux reports the temperature of Topaz hwmon as constant -75°C.
This is because switches from the Topaz family (88E6141 / 88E6341) have the address of the temperature sensor register different from Peridot.
This address is instead compatible with 88E1510 PHYs, as was used for Topaz before the above mentioned commit.
Create a new mapping table between switch family and PHY ID for families which don't have a model number. And define PHY IDs for Topaz and Peridot families.
Create a new PHY ID and a new PHY driver for Topaz's internal PHY. The only difference from Peridot's PHY driver is the HWMON probing method.
Prior this change Topaz's internal PHY is detected by kernel as:
PHY [...] driver [Marvell 88E6390] (irq=63)
And afterwards as:
PHY [...] driver [Marvell 88E6341 Family] (irq=63)
--- drivers/net/dsa/mv88e6xxx/chip.c | 30 +++++++++++++----------------- drivers/net/phy/marvell.c | 32 +++++++++++++++++++++++++++++--- include/linux/marvell_phy.h | 5 +++-- 3 files changed, 45 insertions(+), 22 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +13 -17
@@ -3002,10 +3002,17 @@ out_resources:return err; } +/* prod_id for switch families which do not have a PHY model number */ +static const u16 family_prod_id_table[] = { + [MV88E6XXX_FAMILY_6341 ] =MV88E6XXX_PORT_SWITCH_ID_PROD_6341 , + [MV88E6XXX_FAMILY_6390 ] =MV88E6XXX_PORT_SWITCH_ID_PROD_6390 , +}; +static int mv88e6xxx_mdio_read (struct mii_bus *bus,int phy,int reg) {struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv;struct mv88e6xxx_chip *chip = mdio_bus->chip; +u16 prod_id;u16 val;int err;
@@ -3016,23 +3023,12 @@ static int mv88e6xxx_mdio_read(struct mi err = chip->info->ops->phy_read (chip, bus, phy, reg, &val);mv88e6xxx_reg_unlock (chip); -if (reg ==MII_PHYSID2 ) { -/* Some internal PHYs don't have a model number. */ -if (chip->info->family !=MV88E6XXX_FAMILY_6165 ) -/* Then there is the 6165 family. It gets is -* PHYs correct. But it can also have two -* SERDES interfaces in the PHY address -* space. And these don't have a model -* number. But they are not PHYs, so we don't -* want to give them something a PHY driver -* will recognise. -* -* Use the mv88e6390 family model number -* instead, for anything which really could be -* a PHY, -*/ -if (!(val &0x3f0 )) - val |=MV88E6XXX_PORT_SWITCH_ID_PROD_6390 >>4 ; +/* Some internal PHYs don't have a model number. */ +if (reg ==MII_PHYSID2 && !(val &0x3f0 ) && + chip->info->family <ARRAY_SIZE (family_prod_id_table)) { + prod_id = family_prod_id_table[chip->info->family]; +if (prod_id) + val |= prod_id >>4 ; }return err ? err : val;
drivers/net/phy/marvell.c +29 -3
@@ -3019,9 +3019,34 @@ static struct phy_driver marvell_drivers .get_stats = marvell_get_stats, }, { - .phy_id = MARVELL_PHY_ID_88E6390, + .phy_id = MARVELL_PHY_ID_88E6341_FAMILY, .phy_id_mask = MARVELL_PHY_ID_MASK, - .name = "Marvell 88E6390", + .name = "Marvell 88E6341 Family", +/* PHY_GBIT_FEATURES */ + .flags = PHY_POLL_CABLE_TEST, + .probe = m88e1510_probe, + .config_init = marvell_config_init, + .config_aneg = m88e6390_config_aneg, + .read_status = marvell_read_status, + .config_intr = marvell_config_intr, + .handle_interrupt = marvell_handle_interrupt, + .resume = genphy_resume, + .suspend = genphy_suspend, + .read_page = marvell_read_page, + .write_page = marvell_write_page, + .get_sset_count = marvell_get_sset_count, + .get_strings = marvell_get_strings, + .get_stats = marvell_get_stats, + .get_tunable = m88e1540_get_tunable, + .set_tunable = m88e1540_set_tunable, + .cable_test_start = marvell_vct7_cable_test_start, + .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, + .cable_test_get_status = marvell_vct7_cable_test_get_status, + }, + { + .phy_id = MARVELL_PHY_ID_88E6390_FAMILY, + .phy_id_mask = MARVELL_PHY_ID_MASK, + .name = "Marvell 88E6390 Family",/* PHY_GBIT_FEATURES */ .flags = PHY_POLL_CABLE_TEST, .probe = m88e6390_probe,
@@ -3105,7 +3130,8 @@ static struct mdio_device_id __maybe_unu { MARVELL_PHY_ID_88E1540, MARVELL_PHY_ID_MASK }, { MARVELL_PHY_ID_88E1545, MARVELL_PHY_ID_MASK }, { MARVELL_PHY_ID_88E3016, MARVELL_PHY_ID_MASK }, - { MARVELL_PHY_ID_88E6390, MARVELL_PHY_ID_MASK }, + { MARVELL_PHY_ID_88E6341_FAMILY, MARVELL_PHY_ID_MASK }, + { MARVELL_PHY_ID_88E6390_FAMILY, MARVELL_PHY_ID_MASK }, { MARVELL_PHY_ID_88E1340S, MARVELL_PHY_ID_MASK }, { MARVELL_PHY_ID_88E1548P, MARVELL_PHY_ID_MASK }, { }
include/linux/marvell_phy.h +3 -2
@@ -28,11 +28,12 @@/* Marvel 88E1111 in Finisar SFP module with modified PHY ID */ #define MARVELL_PHY_ID_88E1111_FINISAR 0x01ff0cc0 -/* The MV88e6390 Ethernet switch contains embedded PHYs. These PHYs do +/* These Ethernet switch families contain embedded PHYs, but they do * not have a model ID. So the switch driver traps reads to the ID2 * register and returns the switch family ID */ -#define MARVELL_PHY_ID_88E6390 0x01410f90 +#define MARVELL_PHY_ID_88E6341_FAMILY 0x01410f41 +#define MARVELL_PHY_ID_88E6390_FAMILY 0x01410f90#define MARVELL_PHY_FAMILY_ID (id) ((id) >> 4)
Greg Kroah-Hartman
maintainerPATCH 86/122 net: sit: Unregister catch-all devices
In reply to Greg Kroah-HartmanFrom: Hristo Venev <[email protected]>
commit 610f8c0fc8d46e0933955ce13af3d64484a4630a upstream.
A sit interface created without a local or a remote address is linked into the sit_net::tunnels_wc list of its original namespace. When deleting a network namespace, delete the devices that have been moved.
The following script triggers a null pointer dereference if devices linked in a deleted sit_net remain:
for i in seq 1 30; do
ip netns add ns-test
ip netns exec ns-test ip link add dev veth0 type veth peer veth1 ip netns exec ns-test ip link add dev sit$i type sit dev veth0 ip netns exec ns-test ip link set dev sit$i netns $$ ip netns del ns-test
done
for i in seq 1 30; do
ip link del dev sit$i
done
--- net/ipv6/sit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv6/sit.c +2 -2
@@ -1867,9 +1867,9 @@ static void __net_exit sit_destroy_tunneif (dev->rtnl_link_ops == &sit_link_ops)unregister_netdevice_queue (dev, head); -for (prio =1 ; prio <4 ; prio++) { +for (prio =0 ; prio <4 ; prio++) {int h; -for (h =0 ; h <IP6_SIT_HASH_SIZE ; h++) { +for (h =0 ; h < (prio ?IP6_SIT_HASH_SIZE :1 ); h++) {struct ip_tunnel *t; t =rtnl_dereference (sitn->tunnels[prio][h]);
Greg Kroah-Hartman
maintainerPATCH 87/122 net: ip6_tunnel: Unregister catch-all devices
In reply to Greg Kroah-HartmanFrom: Hristo Venev <[email protected]>
commit 941ea91e87a6e879ed82dad4949f6234f2702bec upstream.
Similarly to the sit case, we need to remove the tunnels with no addresses that have been moved to another network namespace.
--- net/ipv6/ip6_tunnel.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/ipv6/ip6_tunnel.c +10 -0
@@ -2244,6 +2244,16 @@ static void __net_exit ip6_tnl_destroy_t t =rtnl_dereference (t->next); } } + + t =rtnl_dereference (ip6n->tnls_wc[0 ]); +while (t) { +/* If dev is in the same netns, it has already +* been added to the list by the previous loop. +*/ +if (!net_eq (dev_net (t->dev), net)) +unregister_netdevice_queue (t->dev, list); + t =rtnl_dereference (t->next); + } }static int __net_init ip6_tnl_init_net (struct net *net)
Greg Kroah-Hartman
maintainerPATCH 88/122 mm: ptdump: fix build failure
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 458376913d86bed2fb781b4952eb6861675ef3be upstream.
READ_ONCE() cannot be used for reading PTEs. Use ptep_get() instead, to avoid the following errors:
CC mm/ptdump.o
In file included from <command-line>:
mm/ptdump.c: In function 'ptdump_pte_entry':
include/linux/compiler_types.h:320:38: error: call to '__compiletime_assert_207' declared with attribute error: Unsupported access size for {READ,WRITE}_ONCE().
320 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
include/linux/compiler_types.h:301:4: note: in definition of macro '__compiletime_assert'
301 | prefix ## suffix(); \
| ^~~~~~
include/linux/compiler_types.h:320:2: note: in expansion of macro '_compiletime_assert'
320 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:36:2: note: in expansion of macro 'compiletime_assert'
36 | compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
| ^~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:49:2: note: in expansion of macro 'compiletime_assert_rwonce_type'
49 | compiletime_assert_rwonce_type(x); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/ptdump.c:114:14: note: in expansion of macro 'READ_ONCE'
114 | pte_t val = READ_ONCE(*pte);
| ^~~~~~~~~ make[2]: *** [mm/ptdump.o] Error 1
See commit 481e980a7c19 ("mm: Allow arches to provide ptep_get()") and commit c0e1c8c22beb ("powerpc/8xx: Provide ptep_get() with 16k pages") for details.
--- mm/ptdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/ptdump.c +1 -1
@@ -111,7 +111,7 @@ static int ptdump_pte_entry(pte_t *pte, unsigned long next, struct mm_walk *walk) { struct ptdump_state *st = walk->private; -pte_t val =READ_ONCE (*pte); +pte_t val =ptep_get (pte);if (st->effective_prot) st->effective_prot (st,4 ,pte_val (val));
Greg Kroah-Hartman
maintainerPATCH 89/122 net: Make tcp_allowed_congestion_control readonly in non-init netns
In reply to Greg Kroah-HartmanFrom: Jonathon Reinhart <[email protected]>
commit 97684f0970f6e112926de631fdd98d9693c7e5c1 upstream.
Currently, tcp_allowed_congestion_control is global and writable; writing to it in any net namespace will leak into all other net namespaces.
tcp_available_congestion_control and tcp_allowed_congestion_control are the only sysctls in ipv4_net_table (the per-netns sysctl table) with a NULL data pointer; their handlers (proc_tcp_available_congestion_control and proc_allowed_congestion_control) have no other way of referencing a struct net. Thus, they operate globally.
Because ipv4_net_table does not use designated initializers, there is no easy way to fix up this one "bad" table entry. However, the data pointer updating logic shouldn't be applied to NULL pointers anyway, so we instead force these entries to be read-only.
These sysctls used to exist in ipv4_table (init-net only), but they were moved to the per-net ipv4_net_table, presumably without realizing that tcp_allowed_congestion_control was writable and thus introduced a leak.
Because the intent of that commit was only to know (i.e. read) "which congestion algorithms are available or allowed", this read-only solution should be sufficient.
The logic added in recent commit31c4d2f160eb: ("net: Ensure net namespace isolation of sysctls") does not and cannot check for NULL data pointers, because other table entries (e.g. /proc/sys/net/netfilter/nf_log/) have .data=NULL but use other methods (.extra2) to access the struct net.
--- net/ipv4/sysctl_net_ipv4.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
net/ipv4/sysctl_net_ipv4.c +13 -3
@@ -1369,9 +1369,19 @@ static __net_init int ipv4_sysctl_init_nif (!table) goto err_alloc; -/* Update the variables to point into the current struct net */ -for (i =0 ; i <ARRAY_SIZE (ipv4_net_table) -1 ; i++) - table[i].data += (void *)net - (void *)&init_net; +for (i =0 ; i <ARRAY_SIZE (ipv4_net_table) -1 ; i++) { +if (table[i].data) { +/* Update the variables to point into +* the current struct net +*/ + table[i].data += (void *)net - (void *)&init_net; + }else { +/* Entries without data pointer are global; +* Make them read-only in non-init_net ns +*/ + table[i].mode &= ~0222 ; + } + } } net->ipv4.ipv4_hdr =register_net_sysctl (net,"net/ipv4" , table);
Greg Kroah-Hartman
maintainerPATCH 90/122 ibmvnic: correctly use dev_consume/free_skb_irq
In reply to Greg Kroah-HartmanFrom: Lijun Pan <[email protected]>
commit ca09bf7bb109a37a7ff05f230bb3fa3627e6625f upstream.
It is more correct to use dev_kfree_skb_irq when packets are dropped, and to use dev_consume_skb_irq when packets are consumed.
--- drivers/net/ethernet/ibm/ibmvnic.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +7 -4
@@ -3274,9 +3274,6 @@ restart_loop: next =ibmvnic_next_scrq (adapter, scrq);for (i =0 ; i < next->tx_comp.num_comps; i++) { -if (next->tx_comp.rcs[i]) -dev_err (dev,"tx error %x\n" , - next->tx_comp.rcs[i]); index =be32_to_cpu (next->tx_comp.correlators[i]);if (index &IBMVNIC_TSO_POOL_MASK ) { tx_pool = &adapter->tso_pool[pool];
@@ -3290,7 +3287,13 @@ restart_loop: num_entries += txbuff->num_entries;if (txbuff->skb) { total_bytes += txbuff->skb->len; -dev_consume_skb_irq (txbuff->skb); +if (next->tx_comp.rcs[i]) { +dev_err (dev,"tx error %x\n" , + next->tx_comp.rcs[i]); +dev_kfree_skb_irq (txbuff->skb); + }else { +dev_consume_skb_irq (txbuff->skb); + } txbuff->skb =NULL ; }else { netdev_warn(adapter->netdev,
Greg Kroah-Hartman
maintainerPATCH 91/122 i40e: fix the panic when running bpf in xdpdrv mode
In reply to Greg Kroah-HartmanFrom: Jason Xing <[email protected]>
commit 4e39a072a6a0fc422ba7da5e4336bdc295d70211 upstream.
Fix this panic by adding more rules to calculate the value of @rss_size_max which could be used in allocating the queues when bpf is loaded, which, however, could cause the failure and then trigger the NULL pointer of vsi->rx_rings. Prio to this fix, the machine doesn't care about how many cpus are online and then allocates 256 queues on the machine with 32 cpus online actually.
Once the load of bpf begins, the log will go like this "failed to get tracking for 256 queues for VSI 0 err -12" and this "setup of MAIN VSI failed".
Thus, I attach the key information of the crash-log here.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 RIP: 0010:i40e_xdp+0xdd/0x1b0 [i40e] Call Trace: [2160294.717292] ? i40e_reconfig_rss_queues+0x170/0x170 [i40e] [2160294.717666] dev_xdp_install+0x4f/0x70 [2160294.718036] dev_change_xdp_fd+0x11f/0x230 [2160294.718380] ? dev_disable_lro+0xe0/0xe0 [2160294.718705] do_setlink+0xac7/0xe70 [2160294.719035] ? __nla_parse+0xed/0x120 [2160294.719365] rtnl_newlink+0x73b/0x860
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +6 -0
@@ -11863,6 +11863,7 @@ static int i40e_sw_init(struct i40e_pf * {int err =0 ;int size; +u16 pow;/* Set default capability flags */ pf->flags = I40E_FLAG_RX_CSUM_ENABLED |
@@ -11881,6 +11882,11 @@ static int i40e_sw_init(struct i40e_pf * pf->rss_table_size = pf->hw.func_caps.rss_table_size; pf->rss_size_max =min_t (int, pf->rss_size_max, pf->hw.func_caps.num_tx_qp); + +/* find the next higher power-of-2 of num cpus */ + pow =roundup_pow_of_two (num_online_cpus ()); + pf->rss_size_max =min_t (int, pf->rss_size_max, pow); +if (pf->hw.func_caps.rss) { pf->flags |=I40E_FLAG_RSS_ENABLED ; pf->alloc_rss_size = min_t(int, pf->rss_size_max,
Greg Kroah-Hartman
maintainerPATCH 92/122 ethtool: pause: make sure we init driver stats
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
commit 16756d3e77ad58cd07e36cbed724aa13ae5a0278 upstream.
The intention was for pause statistics to not be reported when driver does not have the relevant callback (only report an empty netlink nest). What happens currently we report all 0s instead. Make sure statistics are initialized to "not set" (which is -1) so the dumping code skips them.
--- net/ethtool/pause.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/ethtool/pause.c +4 -4
@@ -38,16 +38,16 @@ static int pause_prepare_data(const struif (!dev->ethtool_ops->get_pauseparam)return -EOPNOTSUPP ; +ethtool_stats_init ((u64 *)&data->pausestat, +sizeof (data->pausestat) /8 ); + ret =ethnl_ops_begin (dev);if (ret <0 )return ret; dev->ethtool_ops->get_pauseparam (dev, &data->pauseparam);if (req_base->flags ÐTOOL_FLAG_STATS && - dev->ethtool_ops->get_pause_stats) { -ethtool_stats_init ((u64 *)&data->pausestat, -sizeof (data->pausestat) /8 ); + dev->ethtool_ops->get_pause_stats) dev->ethtool_ops->get_pause_stats (dev, &data->pausestat); - }ethnl_ops_complete (dev);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 93/122 ia64: remove duplicate entries in generic_defconfig
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 19d000d93303e05bd7b1326e3de9df05a41b25b5 upstream.
Fix ia64 generic_defconfig duplicate entries, as warned by:
arch/ia64/configs/generic_defconfig: warning: override: reassigning to symbol ATA: => 58 arch/ia64/configs/generic_defconfig: warning: override: reassigning to symbol ATA_PIIX: => 59
These 2 symbols still have the same value as in the removed lines.
--- arch/ia64/configs/generic_defconfig | 2 -- 1 file changed, 2 deletions(-)
arch/ia64/configs/generic_defconfig +0 -2
@@ -55,8 +55,6 @@ CONFIG_CHR_DEV_SG=m CONFIG_SCSI_FC_ATTRS=y CONFIG_SCSI_SYM53C8XX_2=y CONFIG_SCSI_QLOGIC_1280=y -CONFIG_ATA=y -CONFIG_ATA_PIIX=y CONFIG_SATA_VITESSE=y CONFIG_MD=y CONFIG_BLK_DEV_MD=m
Greg Kroah-Hartman
maintainerPATCH 94/122 ia64: tools: remove inclusion of ia64-specific version of errno.h header
In reply to Greg Kroah-HartmanFrom: John Paul Adrian Glaubitz <glaubitz () physik ! fu-berlin ! de>
commit 17786fea414393813b56e33a1a01b2dfa03c0915 upstream.
There is no longer an ia64-specific version of the errno.h header below arch/ia64/include/uapi/asm/, so trying to build tools/bpf fails with:
CC /usr/src/linux/tools/bpf/bpftool/btf_dumper.o
In file included from /usr/src/linux/tools/include/linux/err.h:8,
from btf_dumper.c:11:
/usr/src/linux/tools/include/uapi/asm/errno.h:13:10: fatal error: ../../../arch/ia64/include/uapi/asm/errno.h: No such file or directory
13 | #include "../../../arch/ia64/include/uapi/asm/errno.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~compilation terminated.
Thus, just remove the inclusion of the ia64-specific errno.h so that the build will use the generic errno.h header on this target which was used there anyway as the ia64-specific errno.h was just a wrapper for the generic header.
--- tools/include/uapi/asm/errno.h | 2 -- 1 file changed, 2 deletions(-)
tools/include/uapi/asm/errno.h +0 -2
@@ -9,8 +9,6 @@#include "../../../arch/alpha/include/uapi/asm/errno.h" #elif defined(__mips__)#include "../../../arch/mips/include/uapi/asm/errno.h" -#elif defined(__ia64__) -#include "../../../arch/ia64/include/uapi/asm/errno.h" #elif defined(__xtensa__)#include "../../../arch/xtensa/include/uapi/asm/errno.h" #else
Greg Kroah-Hartman
maintainerPATCH 95/122 ibmvnic: avoid calling napi_disable() twice
In reply to Greg Kroah-HartmanFrom: Lijun Pan <[email protected]>
commit 0775ebc4cf8554bdcd2c212669a0868ab68df5c0 upstream.
__ibmvnic_open calls napi_disable without checking whether NAPI polling has already been disabled or not. This could cause napi_disable being called twice, which could generate deadlock. For example, the first napi_disable will spin until NAPI_STATE_SCHED is cleared by napi_complete_done, then set it again.
When napi_disable is called the second time, it will loop infinitely because no dev->poll will be running to clear NAPI_STATE_SCHED.
To prevent above scenario from happening, call ibmvnic_napi_disable() which checks if napi is disabled or not before calling napi_disable.
--- drivers/net/ethernet/ibm/ibmvnic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +1 -2
@@ -1180,8 +1180,7 @@ static int __ibmvnic_open(struct net_dev rc =set_link_state (adapter,IBMVNIC_LOGICAL_LNK_UP );if (rc) { -for (i =0 ; i < adapter->req_rx_queues; i++) -napi_disable (&adapter->napi[i]); +ibmvnic_napi_disable (adapter);release_resources (adapter);return rc; }
Greg Kroah-Hartman
maintainerPATCH 96/122 ibmvnic: remove duplicate napi_schedule call in do_reset function
In reply to Greg Kroah-HartmanFrom: Lijun Pan <[email protected]>
commit d3a6abccbd272aea7dc2c6f984bb5a2c11278e44 upstream.
During adapter reset, do_reset/do_hard_reset calls ibmvnic_open(), which will calls napi_schedule if previous state is VNIC_CLOSED (i.e, the reset case, and "ifconfig down" case). So there is no need for do_reset to call napi_schedule again at the end of the function though napi_schedule will neglect the request if napi is already scheduled.
--- drivers/net/ethernet/ibm/ibmvnic.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +1 -5
@@ -2025,7 +2025,7 @@ static int do_reset(struct ibmvnic_adaptu64 old_num_rx_queues, old_num_tx_queues;u64 old_num_rx_slots, old_num_tx_slots;struct net_device *netdev = adapter->netdev; -int i, rc; +int rc; netdev_dbg(adapter->netdev, "[S:%d FOP:%d] Reset reason %d, reset_state %d\n",
@@ -2171,10 +2171,6 @@ static int do_reset(struct ibmvnic_adapt/* refresh device's multicast list */ ibmvnic_set_multi (netdev); -/* kick napi */ -for (i =0 ; i < adapter->req_rx_queues; i++) -napi_schedule (&adapter->napi[i]); -if (adapter->reset_reason ==VNIC_RESET_FAILOVER || adapter->reset_reason ==VNIC_RESET_MOBILITY )__netdev_notify_peers (netdev);
Greg Kroah-Hartman
maintainerPATCH 97/122 ibmvnic: remove duplicate napi_schedule call in open function
In reply to Greg Kroah-HartmanFrom: Lijun Pan <[email protected]>
commit 7c451f3ef676c805a4b77a743a01a5c21a250a73 upstream.
Remove the unnecessary napi_schedule() call in __ibmvnic_open() since interrupt_rx() calls napi_schedule_prep/__napi_schedule during every receive interrupt.
--- drivers/net/ethernet/ibm/ibmvnic.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +0 -5
@@ -1187,11 +1187,6 @@ static int __ibmvnic_open(struct net_devnetif_tx_start_all_queues (netdev); -if (prev_state ==VNIC_CLOSED ) { -for (i =0 ; i < adapter->req_rx_queues; i++) -napi_schedule (&adapter->napi[i]); - } - adapter->state =VNIC_OPEN ;return rc; }
Greg Kroah-Hartman
maintainerPATCH 98/122 ch_ktls: Fix kernel panic
In reply to Greg Kroah-HartmanFrom: Vinay Kumar Yadav <[email protected]>
commit 1a73e427b824133940c2dd95ebe26b6dce1cbf10 upstream.
Taking page refcount is not ideal and causes kernel panic sometimes. It's better to take tx_ctx lock for the complete skb transmit, to avoid page cleanup if ACK received in middle.
--- drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 24 ++-------- 1 file changed, 5 insertions(+), 19 deletions(-)
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c +5 -19
@@ -2015,12 +2015,11 @@ static int chcr_ktls_xmit(struct sk_buff* we will send the complete record again. */ +spin_lock_irqsave (&tx_ctx->base.lock, flags); + do { - int i; cxgb4_reclaim_completed_tx(adap, &q->q, true); - /* lock taken */ - spin_lock_irqsave(&tx_ctx->base.lock, flags); /* fetch the tls record */ record = tls_get_record(&tx_ctx->base, tcp_seq, &tx_info->record_no);
@@ -2079,11 +2078,11 @@ static int chcr_ktls_xmit(struct sk_buff tls_end_offset, skb_offset, 0); -spin_unlock_irqrestore (&tx_ctx->base.lock, flags);if (ret) {/* free the refcount taken earlier */ if (tls_end_offset < data_len)dev_kfree_skb_any (skb); +spin_unlock_irqrestore (&tx_ctx->base.lock, flags); goto out; }
@@ -2093,16 +2092,6 @@ static int chcr_ktls_xmit(struct sk_buffcontinue ; } -/* increase page reference count of the record, so that there -* won't be any chance of page free in middle if in case stack -* receives ACK and try to delete the record. -*/ -for (i =0 ; i < record->num_frags; i++) -__skb_frag_ref (&record->frags[i]); -/* lock cleared */ -spin_unlock_irqrestore (&tx_ctx->base.lock, flags); - -/* if a tls record is finishing in this SKB */ if (tls_end_offset <= data_len) { ret = chcr_end_part_handler(tx_info, skb, record,
@@ -2127,13 +2116,9 @@ static int chcr_ktls_xmit(struct sk_buff data_len =0 ; } -/* clear the frag ref count which increased locally before */ -for (i =0 ; i < record->num_frags; i++) { -/* clear the frag ref count */ -__skb_frag_unref (&record->frags[i]); - }/* if any failure, come out from the loop. */ if (ret) { +spin_unlock_irqrestore (&tx_ctx->base.lock, flags);if (th->fin)dev_kfree_skb_any (skb);
@@ -2148,6 +2133,7 @@ static int chcr_ktls_xmit(struct sk_buff }while (data_len >0 ); +spin_unlock_irqrestore (&tx_ctx->base.lock, flags);atomic64_inc (&port_stats->ktls_tx_encrypted_packets);atomic64_add (skb_data_len, &port_stats->ktls_tx_encrypted_bytes);
Greg Kroah-Hartman
maintainerPATCH 99/122 ch_ktls: fix device connection close
In reply to Greg Kroah-HartmanFrom: Vinay Kumar Yadav <[email protected]>
commit bc16efd2430652f894ae34b1de5eccc3bf0d2810 upstream.
When sge queue is full and chcr_ktls_xmit_wr_complete() returns failure, skb is not freed if it is not the last tls record in this skb, causes refcount never gets freed and tls_dev_del() never gets called on this connection.
--- drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c +6 -0
@@ -1740,7 +1740,9 @@ static int chcr_end_part_handler(struct struct sge_eth_txq *q, u32 skb_offset, u32 tls_end_offset, bool last_wr) { + bool free_skb_if_tx_fails = false;struct sk_buff *nskb =NULL ; +/* check if it is a complete record */ if (tls_end_offset == record->len) { nskb = skb;
@@ -1763,6 +1765,8 @@ static int chcr_end_part_handler(structif (last_wr)dev_kfree_skb_any (skb); +else + free_skb_if_tx_fails = true; last_wr = true;
@@ -1774,6 +1778,8 @@ static int chcr_end_part_handler(struct record->num_frags, (last_wr && tcp_push_no_fin), mss)) { +if (free_skb_if_tx_fails) +dev_kfree_skb_any (skb); goto out; } tx_info->prev_seq = record->end_seq;
Greg Kroah-Hartman
maintainerPATCH 100/122 ch_ktls: tcb close causes tls connection failure
In reply to Greg Kroah-HartmanFrom: Vinay Kumar Yadav <[email protected]>
commit 21d8c25e3f4b9052a471ced8f47b531956eb9963 upstream.
HW doesn't need marking TCB closed. This TCB state change sometimes causes problem to the new connection which gets the same tid.
--- drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 19 ---------- 1 file changed, 19 deletions(-)
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c +0 -19
@@ -355,18 +355,6 @@ static int chcr_set_tcb_field(struct chc }/* -* chcr_ktls_mark_tcb_close: mark tcb state to CLOSE -* @tx_info - driver specific tls info. -* return: NET_TX_OK/NET_XMIT_DROP. -*/ -static int chcr_ktls_mark_tcb_close (struct chcr_ktls_info *tx_info) -{ -return chcr_set_tcb_field (tx_info,TCB_T_STATE_W , -TCB_T_STATE_V (TCB_T_STATE_M ), -CHCR_TCB_STATE_CLOSED ,1 ); -} - -/* * chcr_ktls_dev_del: call back for tls_dev_del. * Remove the tid and l2t entry and close the connection. * it per connection basis.
@@ -400,8 +388,6 @@ static void chcr_ktls_dev_del(struct net/* clear tid */ if (tx_info->tid !=-1 ) { -/* clear tcb state and then release tid */ -chcr_ktls_mark_tcb_close (tx_info);cxgb4_remove_tid (&tx_info->adap->tids, tx_info->tx_chan, tx_info->tid, tx_info->ip_family); }
@@ -579,7 +565,6 @@ static int chcr_ktls_dev_add(struct net_return 0 ; free_tid: -chcr_ktls_mark_tcb_close (tx_info);#if IS_ENABLED (CONFIG_IPV6 )/* clear clip entry */ if (tx_info->ip_family ==AF_INET6 )
@@ -677,10 +662,6 @@ static int chcr_ktls_cpl_act_open_rpl(stif (tx_info->pending_close) {spin_unlock (&tx_info->lock);if (!status) { -/* it's a late success, tcb status is establised, -* mark it close. -*/ -chcr_ktls_mark_tcb_close (tx_info);cxgb4_remove_tid (&tx_info->adap->tids, tx_info->tx_chan, tid, tx_info->ip_family); }
Greg Kroah-Hartman
maintainerPATCH 101/122 ch_ktls: do not send snd_una update to TCB in middle
In reply to Greg Kroah-HartmanFrom: Vinay Kumar Yadav <[email protected]>
commit e8a4155567b3c903f49cbf89b8017e9cc22c4fe4 upstream.
snd_una update should not be done when the same skb is being sent out.chcr_short_record_handler() sends it again even though SND_UNA update is already sent for the skb in chcr_ktls_xmit(), which causes mismatch in un-acked TCP seq number, later causes problem in sending out complete record.
--- drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 53 ---------- 1 file changed, 53 deletions(-)
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c +0 -53
@@ -1650,54 +1650,6 @@ static void chcr_ktls_copy_record_in_skb }/* -* chcr_ktls_update_snd_una: Reset the SEND_UNA. It will be done to avoid -* sending the same segment again. It will discard the segment which is before -* the current tx max. -* @tx_info - driver specific tls info. -* @q - TX queue. -* return: NET_TX_OK/NET_XMIT_DROP. -*/ -static int chcr_ktls_update_snd_una (struct chcr_ktls_info *tx_info, -struct sge_eth_txq *q) -{ -struct fw_ulptx_wr *wr; -unsigned int ndesc; -int credits; -void *pos; -u32 len; - - len =sizeof (*wr) +roundup (CHCR_SET_TCB_FIELD_LEN ,16 ); - ndesc =DIV_ROUND_UP (len,64 ); - - credits =chcr_txq_avail (&q->q) - ndesc; -if (unlikely (credits <0 )) { -chcr_eth_txq_stop (q); -return NETDEV_TX_BUSY ; - } - - pos = &q->q.desc[q->q.pidx]; - - wr = pos; -/* ULPTX wr */ - wr->op_to_compl =htonl (FW_WR_OP_V (FW_ULPTX_WR )); - wr->cookie =0 ; -/* fill len in wr field */ - wr->flowid_len16 =htonl (FW_WR_LEN16_V (DIV_ROUND_UP (len,16 ))); - - pos +=sizeof (*wr); - - pos =chcr_write_cpl_set_tcb_ulp (tx_info, q, tx_info->tid, pos, -TCB_SND_UNA_RAW_W , -TCB_SND_UNA_RAW_V (TCB_SND_UNA_RAW_M ), -TCB_SND_UNA_RAW_V (0 ),0 ); - -chcr_txq_advance (&q->q, ndesc); -cxgb4_ring_tx_db (tx_info->adap, &q->q, ndesc); - -return 0 ; -} - -/* * chcr_end_part_handler: This handler will handle the record which * is complete or if record's end part is received. T6 adapter has a issue that * it can't send out TAG with partial record so if its an end part then we have
@@ -1897,11 +1849,6 @@ static int chcr_short_record_handler(str/* reset tcp_seq as per the prior_data_required len */ tcp_seq -= prior_data_len; } -/* reset snd una, so the middle record won't send the already -* sent part. -*/ -if (chcr_ktls_update_snd_una (tx_info, q)) - goto out;atomic64_inc (&tx_info->adap->ch_ktls_stats.ktls_tx_middle_pkts); }else {atomic64_inc (&tx_info->adap->ch_ktls_stats.ktls_tx_start_pkts);
Greg Kroah-Hartman
maintainerPATCH 102/122 gro: ensure frag0 meets IP header alignment
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 38ec4944b593fd90c5ef42aaaa53e66ae5769d04 upstream.
After commit 0f6925b3e8da ("virtio_net: Do not pull payload in skb->head") Guenter Roeck reported one failure in his tests using sh architecture.
After much debugging, we have been able to spot silent unaligned accesses in inet_gro_receive()
The issue at hand is that upper networking stacks assume their header is word-aligned. Low level drivers are supposed to reserve NET_IP_ALIGN bytes before the Ethernet header to make that happen.
This patch hardens skb_gro_reset_offset() to not allow frag0 fast-path if the fragment is not properly aligned.
Some arches like x86, arm64 and powerpc do not care and define NET_IP_ALIGN as 0, this extra check will be a NOP for them.
Note that if frag0 is not used, GRO will call pskb_may_pull() as many times as needed to pull network and transport headers.
--- net/core/dev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/dev.c +2 -1
@@ -5877,7 +5877,8 @@ static void skb_gro_reset_offset(structNAPI_GRO_CB (skb)->frag0_len =0 ;if (!skb_headlen (skb) && pinfo->nr_frags && - !PageHighMem (skb_frag_page (frag0))) { + !PageHighMem (skb_frag_page (frag0)) && + (!NET_IP_ALIGN || !(skb_frag_off (frag0) &3 ))) {NAPI_GRO_CB (skb)->frag0 =skb_frag_address (frag0); NAPI_GRO_CB(skb)->frag0_len = min_t(unsigned int, skb_frag_size(frag0),
Greg Kroah-Hartman
maintainerPATCH 103/122 ARM: OMAP2+: Fix warning for omap_init_time_of()
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit a3efe3f6d0eb64363f74af4b0e8ba6d19415cef2 ]
Fix warning: no previous prototype for 'omap_init_time_of'.
--- arch/arm/mach-omap2/board-generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/board-generic.c +1 -1
@@ -33,7 +33,7 @@ static void __init __maybe_unused omap_generic_init(void) }/* Clocks are needed early, see drivers/clocksource for the rest */ -void __init __maybe_unused omap_init_time_of (void ) +static void __init __maybe_unused omap_init_time_of (void ) {omap_clk_init ();timer_probe ();
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 104/122 ARM: 9063/1: mm: reduce maximum number of CPUs if DEBUG_KMAP_LOCAL is enabled
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit d624833f5984d484c5e3196f34b926f9e71dafee ]
The debugging code for kmap_local() doubles the number of per-CPU fixmap slots allocated for kmap_local(), in order to use half of them as guard regions. This causes the fixmap region to grow downwards beyond the start of its reserved window if the supported number of CPUs is large, and collide with the newly added virtual DT mapping right below it, which is obviously not good.
One manifestation of this is EFI boot on a kernel built with NR_CPUS=32 and CONFIG_DEBUG_KMAP_LOCAL=y, which may pass the FDT in highmem, resulting in block entries below the fixmap region that the fixmap code misidentifies as fixmap table entries, and subsequently tries to dereference using a phys-to-virt translation that is only valid for lowmem. This results in a cryptic splat such as the one below.
ftrace: allocating 45548 entries in 89 pages
8<--- cut here ---
Unable to handle kernel paging request at virtual address fc6006f0 pgd = (ptrval) [fc6006f0] *pgd=80000040207003, *pmd=00000000 Internal error: Oops: a06 [#1] SMP ARM Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 5.11.0+ #382 Hardware name: Generic DT based system PC is at cpu_ca15_set_pte_ext+0x24/0x30 LR is at __set_fixmap+0xe4/0x118 pc : [<c041ac9c>] lr : [<c04189d8>] psr: 400000d3 sp : c1601ed8 ip : 00400000 fp : 00800000 r10: 0000071f r9 : 00421000 r8 : 00c00000 r7 : 00c00000 r6 : 0000071f r5 : ffade000 r4 : 4040171f r3 : 00c00000 r2 : 4040171f r1 : c041ac78 r0 : fc6006f0 Flags: nZcv IRQs off FIQs off Mode SVC_32 ISA ARM Segment none Control: 30c5387d Table: 40203000 DAC: 00000001 Process swapper (pid: 0, stack limit = 0x(ptrval))
So let's limit CONFIG_NR_CPUS to 16 when CONFIG_DEBUG_KMAP_LOCAL=y. Also, fix the BUILD_BUG_ON() check that was supposed to catch this, by checking whether the region grows below the start address rather than above the end address.
--- arch/arm/Kconfig | 8 +++++++- arch/arm/mm/mmu.c | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-)
arch/arm/Kconfig +7 -1
@@ -1310,9 +1310,15 @@ config KASAN_SHADOW_OFFSET config NR_CPUS int "Maximum number of CPUs (2-32)" - range 2 32 + range 2 16 if DEBUG_KMAP_LOCAL + range 2 32 if !DEBUG_KMAP_LOCAL depends on SMP default "4" + help + The maximum number of CPUs that the kernel can support. + Up to 32 CPUs can be supported, or up to 16 if kmap_local() + debugging is enabled, which uses half of the per-CPU fixmap + slots as guard regions. config HOTPLUG_CPU bool "Support for hot-pluggable CPUs"
arch/arm/mm/mmu.c +1 -2
@@ -388,8 +388,7 @@ void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot)pte_t *pte =pte_offset_fixmap (pmd_off_k (vaddr), vaddr);/* Make sure fixmap region does not exceed available allocation. */ -BUILD_BUG_ON (FIXADDR_START + (__end_of_fixed_addresses *PAGE_SIZE ) > -FIXADDR_END ); +BUILD_BUG_ON (__fix_to_virt (__end_of_fixed_addresses) <FIXADDR_START );BUG_ON (idx >= __end_of_fixed_addresses);/* we only support device mappings until pgprot_kernel has been set */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 105/122 ARM: 9069/1: NOMMU: Fix conversion for_each_membock() to for_each_mem_range()
In reply to Greg Kroah-HartmanFrom: Vladimir Murzin <[email protected]>
[ Upstream commit 45c2f70cba3a7eff34574103b2e2b901a5f771aa ]
for_each_mem_range() uses a loop variable, yet looking into code it is not just iteration counter but more complex entity which encodes information about memblock. Thus condition i == 0 looks fragile. Indeed, it broke boot of R-class platforms since it never took i == 0 path (due to i was set to 1). Fix that with restoring original flag check.
--- arch/arm/mm/pmsa-v7.c | 4 +++- arch/arm/mm/pmsa-v8.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
arch/arm/mm/pmsa-v7.c +3 -1
@@ -235,6 +235,7 @@ void __init pmsav7_adjust_lowmem_bounds(void)phys_addr_t mem_end;phys_addr_t reg_start, reg_end;unsigned int mem_max_regions; +bool first = true;int num;u64 i;
@@ -263,7 +264,7 @@ void __init pmsav7_adjust_lowmem_bounds(void)#endif for_each_mem_range (i, ®_start, ®_end) { -if (i ==0 ) { +if (first) {phys_addr_t phys_offset =PHYS_OFFSET ;/*
@@ -275,6 +276,7 @@ void __init pmsav7_adjust_lowmem_bounds(void) mem_start = reg_start; mem_end = reg_end; specified_mem_size = mem_end - mem_start; + first = false; }else {/* * memblock auto merges contiguous blocks, remove
arch/arm/mm/pmsa-v8.c +3 -1
@@ -95,10 +95,11 @@ void __init pmsav8_adjust_lowmem_bounds(void) {phys_addr_t mem_end;phys_addr_t reg_start, reg_end; +bool first = true;u64 i;for_each_mem_range (i, ®_start, ®_end) { -if (i ==0 ) { +if (first) {phys_addr_t phys_offset =PHYS_OFFSET ;/*
@@ -107,6 +108,7 @@ void __init pmsav8_adjust_lowmem_bounds(void)if (reg_start != phys_offset)panic ("First memory bank must be contiguous from PHYS_OFFSET" ); mem_end = reg_end; + first = false; }else {/* * memblock auto merges contiguous blocks, remove
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 106/122 ARM: footbridge: fix PCI interrupt mapping
In reply to Greg Kroah-HartmanFrom: Russell King <[email protected]>
[ Upstream commit 30e3b4f256b4e366a61658c294f6a21b8626dda7 ]
Since commit 30fdfb929e82 ("PCI: Add a call to pci_assign_irq() in pci_device_probe()"), the PCI code will call the IRQ mapping function whenever a PCI driver is probed. If these are marked as __init, this causes an oops if a PCI driver is loaded or bound after the kernel has initialised.
--- arch/arm/mach-footbridge/cats-pci.c | 4 ++-- arch/arm/mach-footbridge/ebsa285-pci.c | 4 ++-- arch/arm/mach-footbridge/netwinder-pci.c | 2 +- arch/arm/mach-footbridge/personal-pci.c | 5 ++--- 4 files changed, 7 insertions(+), 8 deletions(-)
arch/arm/mach-footbridge/cats-pci.c +2 -2
@@ -15,14 +15,14 @@#include <asm/mach-types.h> /* cats host-specific stuff */ -static int irqmap_cats[]__initdata = {IRQ_PCI ,IRQ_IN0 ,IRQ_IN1 ,IRQ_IN3 }; +static int irqmap_cats[] = {IRQ_PCI ,IRQ_IN0 ,IRQ_IN1 ,IRQ_IN3 };static u8 cats_no_swizzle (struct pci_dev *dev,u8 *pin) {return 0 ; } -static int __init cats_map_irq (const struct pci_dev *dev,u8 slot,u8 pin) +static int cats_map_irq (const struct pci_dev *dev,u8 slot,u8 pin) {if (dev->irq >=255 )return -1 ;/* not a valid interrupt. */
arch/arm/mach-footbridge/ebsa285-pci.c +2 -2
@@ -14,9 +14,9 @@#include <asm/mach/pci.h> #include <asm/mach-types.h> -static int irqmap_ebsa285[]__initdata = {IRQ_IN3 ,IRQ_IN1 ,IRQ_IN0 ,IRQ_PCI }; +static int irqmap_ebsa285[] = {IRQ_IN3 ,IRQ_IN1 ,IRQ_IN0 ,IRQ_PCI }; -static int __init ebsa285_map_irq (const struct pci_dev *dev,u8 slot,u8 pin) +static int ebsa285_map_irq (const struct pci_dev *dev,u8 slot,u8 pin) {if (dev->vendor ==PCI_VENDOR_ID_CONTAQ && dev->device ==PCI_DEVICE_ID_CONTAQ_82C693 )
arch/arm/mach-footbridge/netwinder-pci.c +1 -1
@@ -18,7 +18,7 @@* We now use the slot ID instead of the device identifiers to select * which interrupt is routed where. */ -static int __init netwinder_map_irq (const struct pci_dev *dev,u8 slot,u8 pin) +static int netwinder_map_irq (const struct pci_dev *dev,u8 slot,u8 pin) {switch (slot) {case 0 :/* host bridge */
arch/arm/mach-footbridge/personal-pci.c +2 -3
@@ -14,13 +14,12 @@#include <asm/mach/pci.h> #include <asm/mach-types.h> -static int irqmap_personal_server[]__initdata = { +static int irqmap_personal_server[] = {IRQ_IN0 ,IRQ_IN1 ,IRQ_IN2 ,IRQ_IN3 ,0 ,0 ,0 ,IRQ_DOORBELLHOST ,IRQ_DMA1 ,IRQ_DMA2 ,IRQ_PCI }; -static int __init personal_server_map_irq (const struct pci_dev *dev,u8 slot, -u8 pin) +static int personal_server_map_irq (const struct pci_dev *dev,u8 slot,u8 pin) {unsigned char line;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 107/122 ARM: OMAP2+: Fix uninitialized sr_inst
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit fc85dc42a38405099f97aa2af709fe9504a82508 ]
Fix uninitialized sr_inst.
--- arch/arm/mach-omap2/sr_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/sr_device.c +1 -1
@@ -188,7 +188,7 @@ static const char * const dra7_sr_instances[] = {int __init omap_devinit_smartreflex (void ) { -const char *const *sr_inst; +const char *const *sr_inst =NULL ;int i, nr_sr =0 ;if (soc_is_omap44xx ()) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 108/122 arm64: dts: allwinner: Fix SD card CD GPIO for SOPine systems
In reply to Greg Kroah-HartmanFrom: Andre Przywara <[email protected]>
[ Upstream commit 3dd4ce4185df6798dcdcc3669bddb35899d7d5e1 ]
Commit 941432d00768 ("arm64: dts: allwinner: Drop non-removable from SoPine/LTS SD card") enabled the card detect GPIO for the SOPine module, along the way with the Pine64-LTS, which share the same base .dtsi.
However while both boards indeed have a working CD GPIO on PF6, the polarity is different: the SOPine modules uses a "push-pull" socket, which has an active-high switch, while the Pine64-LTS use the more traditional push-push socket and the common active-low switch.
Fix the polarity in the sopine.dtsi, and overwrite it in the LTS board .dts, to make the SD card work again on systems using SOPine modules.
--- arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts | 4 ++++ arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts +4 -0
@@ -8,3 +8,7 @@ compatible = "pine64,pine64-lts", "allwinner,sun50i-r18", "allwinner,sun50i-a64"; }; + +&mmc0 { + cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 push-push switch */ +};
arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi +1 -1
@@ -34,7 +34,7 @@ vmmc-supply = <®_dcdc1>; disable-wp; bus-width = <4>; - cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */ + cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 push-pull switch */ status = "okay"; };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 109/122 arm64: dts: allwinner: h6: beelink-gs1: Remove ext. 32 kHz osc reference
In reply to Greg Kroah-HartmanFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 7a2f6e69e9c1060a7a09c1f8322ccb8d942b3078 ]
Although every Beelink GS1 seems to have external 32768 Hz oscillator, it works only on one from four tested. There are more reports of RTC issues elsewhere, like Armbian forum.
One Beelink GS1 owner read RTC osc status register on Android which shipped with the box. Reported value indicated problems with external oscillator.
In order to fix RTC and related issues (HDMI-CEC and suspend/resume with Crust) on all boards, switch to internal oscillator.
--- arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts | 4 ---- 1 file changed, 4 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts +0 -4
@@ -289,10 +289,6 @@ vcc-pm-supply = <®_aldo1>; }; -&rtc { - clocks = <&ext_osc32k>; -}; - &spdif { status = "okay"; };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 110/122 bpf: Use correct permission flag for mixed signed bounds arithmetic
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
[ Upstream commit 9601148392520e2e134936e76788fc2a6371e7be ]
We forbid adding unknown scalars with mixed signed bounds due to the spectre v1 masking mitigation. Hence this also needs bypass_spec_v1 flag instead of allow_ptr_leaks.
--- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/verifier.c +1 -1
@@ -5578,7 +5578,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, dst, reg_type_str[ptr_reg->type]);return -EACCES ;case PTR_TO_MAP_VALUE : -if (!env->allow_ptr_leaks && !known && (smin_val <0 ) != (smax_val <0 )) { +if (!env->env->bypass_spec_v1 && !known && (smin_val <0 ) != (smax_val <0 )) {verbose (env,"R%d has unknown scalar with mixed signed bounds, pointer arithmetic with it prohibited for !root\n" , off_reg == dst_reg ? dst : src);return -EACCES ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 111/122 KVM: VMX: Convert vcpu_vmx.exit_reason to a union
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
[ Upstream commit 8e53324021645f820a01bf8aa745711c802c8542 ]
Convert vcpu_vmx.exit_reason from a u32 to a union (of size u32). The full VM_EXIT_REASON field is comprised of a 16-bit basic exit reason in bits 15:0, and single-bit modifiers in bits 31:16.
Historically, KVM has only had to worry about handling the "failed VM-Entry" modifier, which could only be set in very specific flows and required dedicated handling. I.e. manually stripping the FAILED_VMENTRY bit was a somewhat viable approach. But even with only a single bit to worry about, KVM has had several bugs related to comparing a basic exit reason against the full exit reason store in vcpu_vmx.
Upcoming Intel features, e.g. SGX, will add new modifier bits that can be set on more or less any VM-Exit, as opposed to the significantly more restricted FAILED_VMENTRY, i.e. correctly handling everything in one-off flows isn't scalable. Tracking exit reason in a union forces code to explicitly choose between consuming the full exit reason and the basic exit, and is a convenient way to document and access the modifiers.
No functional change intended.
Message-Id: <[email protected]>
--- arch/x86/kvm/vmx/nested.c | 42 +++++++++++++++--------- arch/x86/kvm/vmx/vmx.c | 68 ++++++++++++++++++++------------------- arch/x86/kvm/vmx/vmx.h | 25 +++++++++++++- 3 files changed, 86 insertions(+), 49 deletions(-)
arch/x86/kvm/vmx/nested.c +27 -15
@@ -3330,7 +3330,11 @@ enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu,struct vmcs12 *vmcs12 =get_vmcs12 (vcpu);enum vm_entry_failure_code entry_failure_code;bool evaluate_pending_interrupts; -u32 exit_reason, failed_index; +union vmx_exit_reason exit_reason = { + .basic =EXIT_REASON_INVALID_STATE , + .failed_vmentry =1 , + }; +u32 failed_index;if (kvm_check_request (KVM_REQ_TLB_FLUSH_CURRENT , vcpu))kvm_vcpu_flush_tlb_current (vcpu);
@@ -3382,7 +3386,7 @@ enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu,if (nested_vmx_check_guest_state (vcpu, vmcs12, &entry_failure_code)) { - exit_reason =EXIT_REASON_INVALID_STATE ; + exit_reason.basic =EXIT_REASON_INVALID_STATE ; vmcs12->exit_qualification = entry_failure_code; goto vmentry_fail_vmexit; }
@@ -3393,7 +3397,7 @@ enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, vcpu->arch.tsc_offset += vmcs12->tsc_offset;if (prepare_vmcs02 (vcpu, vmcs12, &entry_failure_code)) { - exit_reason =EXIT_REASON_INVALID_STATE ; + exit_reason.basic =EXIT_REASON_INVALID_STATE ; vmcs12->exit_qualification = entry_failure_code; goto vmentry_fail_vmexit_guest_mode; }
@@ -3403,7 +3407,7 @@ enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, vmcs12->vm_entry_msr_load_addr, vmcs12->vm_entry_msr_load_count);if (failed_index) { - exit_reason =EXIT_REASON_MSR_LOAD_FAIL ; + exit_reason.basic =EXIT_REASON_MSR_LOAD_FAIL ; vmcs12->exit_qualification = failed_index; goto vmentry_fail_vmexit_guest_mode; }
@@ -3471,7 +3475,7 @@ enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu,return NVMX_VMENTRY_VMEXIT ;load_vmcs12_host_state (vcpu, vmcs12); - vmcs12->vm_exit_reason = exit_reason |VMX_EXIT_REASONS_FAILED_VMENTRY ; + vmcs12->vm_exit_reason = exit_reason.full;if (enable_shadow_vmcs || vmx->nested.hv_evmcs) vmx->nested.need_vmcs12_to_shadow_sync = true;return NVMX_VMENTRY_VMEXIT ;
@@ -5559,7 +5563,12 @@ static int handle_vmfunc(struct kvm_vcpu *vcpu)return kvm_skip_emulated_instruction (vcpu); fail: -nested_vmx_vmexit (vcpu, vmx->exit_reason, +/* +* This is effectively a reflected VM-Exit, as opposed to a synthesized +* nested VM-Exit. Pass the original exit reason, i.e. don't hardcode +* EXIT_REASON_VMFUNC as the exit reason. +*/ +nested_vmx_vmexit (vcpu, vmx->exit_reason.full,vmx_get_intr_info (vcpu),vmx_get_exit_qual (vcpu));return 1 ;
@@ -5627,7 +5636,8 @@ static bool nested_vmx_exit_handled_io(struct kvm_vcpu *vcpu,* MSR bitmap. This may be the case even when L0 doesn't use MSR bitmaps. */ static bool nested_vmx_exit_handled_msr (struct kvm_vcpu *vcpu, -struct vmcs12 *vmcs12,u32 exit_reason) +struct vmcs12 *vmcs12, +union vmx_exit_reason exit_reason) {u32 msr_index =kvm_rcx_read (vcpu);gpa_t bitmap;
@@ -5641,7 +5651,7 @@ static bool nested_vmx_exit_handled_msr(struct kvm_vcpu *vcpu,* First we need to figure out which of the four to use: */ bitmap = vmcs12->msr_bitmap; -if (exit_reason ==EXIT_REASON_MSR_WRITE ) +if (exit_reason.basic ==EXIT_REASON_MSR_WRITE ) bitmap +=2048 ;if (msr_index >=0xc0000000 ) { msr_index -=0xc0000000 ;
@@ -5778,11 +5788,12 @@ static bool nested_vmx_exit_handled_mtf(struct vmcs12 *vmcs12)* Return true if L0 wants to handle an exit from L2 regardless of whether or not * L1 wants the exit. Only call this when in is_guest_mode (L2). */ -static bool nested_vmx_l0_wants_exit (struct kvm_vcpu *vcpu,u32 exit_reason) +static bool nested_vmx_l0_wants_exit (struct kvm_vcpu *vcpu, +union vmx_exit_reason exit_reason) {u32 intr_info; -switch ((u16 )exit_reason) { +switch ((u16 )exit_reason.basic) {case EXIT_REASON_EXCEPTION_NMI : intr_info =vmx_get_intr_info (vcpu);if (is_nmi (intr_info))
@@ -5838,12 +5849,13 @@ static bool nested_vmx_l0_wants_exit(struct kvm_vcpu *vcpu, u32 exit_reason)* Return 1 if L1 wants to intercept an exit from L2. Only call this when in * is_guest_mode (L2). */ -static bool nested_vmx_l1_wants_exit (struct kvm_vcpu *vcpu,u32 exit_reason) +static bool nested_vmx_l1_wants_exit (struct kvm_vcpu *vcpu, +union vmx_exit_reason exit_reason) {struct vmcs12 *vmcs12 =get_vmcs12 (vcpu);u32 intr_info; -switch ((u16 )exit_reason) { +switch ((u16 )exit_reason.basic) {case EXIT_REASON_EXCEPTION_NMI : intr_info =vmx_get_intr_info (vcpu);if (is_nmi (intr_info))
@@ -5962,7 +5974,7 @@ static bool nested_vmx_l1_wants_exit(struct kvm_vcpu *vcpu, u32 exit_reason)bool nested_vmx_reflect_vmexit (struct kvm_vcpu *vcpu) {struct vcpu_vmx *vmx =to_vmx (vcpu); -u32 exit_reason = vmx->exit_reason; +union vmx_exit_reason exit_reason = vmx->exit_reason;unsigned long exit_qual;u32 exit_intr_info;
@@ -5981,7 +5993,7 @@ bool nested_vmx_reflect_vmexit(struct kvm_vcpu *vcpu) goto reflect_vmexit; } -trace_kvm_nested_vmexit (exit_reason, vcpu,KVM_ISA_VMX ); +trace_kvm_nested_vmexit (exit_reason.full, vcpu,KVM_ISA_VMX );/* If L0 (KVM) wants the exit, it trumps L1's desires. */ if (nested_vmx_l0_wants_exit (vcpu, exit_reason))
@@ -6007,7 +6019,7 @@ bool nested_vmx_reflect_vmexit(struct kvm_vcpu *vcpu) exit_qual =vmx_get_exit_qual (vcpu); reflect_vmexit: -nested_vmx_vmexit (vcpu, exit_reason, exit_intr_info, exit_qual); +nested_vmx_vmexit (vcpu, exit_reason.full, exit_intr_info, exit_qual);return true; }
arch/x86/kvm/vmx/vmx.c +35 -33
157 lines not on this page · raw message
arch/x86/kvm/vmx/vmx.h +24 -1
@@ -70,6 +70,29 @@ struct pt_desc {struct pt_ctx guest; }; +union vmx_exit_reason { +struct { +u32 basic :16 ; +u32 reserved16 :1 ; +u32 reserved17 :1 ; +u32 reserved18 :1 ; +u32 reserved19 :1 ; +u32 reserved20 :1 ; +u32 reserved21 :1 ; +u32 reserved22 :1 ; +u32 reserved23 :1 ; +u32 reserved24 :1 ; +u32 reserved25 :1 ; +u32 reserved26 :1 ; +u32 enclave_mode :1 ; +u32 smi_pending_mtf :1 ; +u32 smi_from_vmx_root :1 ; +u32 reserved30 :1 ; +u32 failed_vmentry :1 ; + }; +u32 full; +}; +/* * The nested_vmx structure is part of vcpu_vmx, and holds information we need * for correct emulation of VMX (i.e., nested VMX) on this vcpu.
@@ -244,7 +267,7 @@ struct vcpu_vmx {int vpid;bool emulation_required; -u32 exit_reason; +union vmx_exit_reason exit_reason;/* Posted interrupt descriptor */ struct pi_desc pi_desc;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 112/122 KVM: VMX: Dont use vcpu->run->internal.ndata as an array index
In reply to Greg Kroah-HartmanFrom: Reiji Watanabe <[email protected]>
[ Upstream commit 04c4f2ee3f68c9a4bf1653d15f1a9a435ae33f7a ]
__vmx_handle_exit() uses vcpu->run->internal.ndata as an index for an array access. Since vcpu->run is (can be) mapped to a user address space with a writer permission, the 'ndata' could be updated by the user process at anytime (the user process can set it to outside the bounds of the array).
So, it is not safe that __vmx_handle_exit() uses the 'ndata' that way.
Message-Id: <[email protected]>
--- arch/x86/kvm/vmx/vmx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/kvm/vmx/vmx.c +5 -5
@@ -5986,19 +5986,19 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) exit_reason.basic != EXIT_REASON_PML_FULL && exit_reason.basic != EXIT_REASON_APIC_ACCESS && exit_reason.basic != EXIT_REASON_TASK_SWITCH)) { +int ndata =3 ; + vcpu->run->exit_reason =KVM_EXIT_INTERNAL_ERROR ; vcpu->run->internal.suberror =KVM_INTERNAL_ERROR_DELIVERY_EV ; - vcpu->run->internal.ndata =3 ; vcpu->run->internal.data[0 ] = vectoring_info; vcpu->run->internal.data[1 ] = exit_reason.full; vcpu->run->internal.data[2 ] = vcpu->arch.exit_qualification;if (exit_reason.basic ==EXIT_REASON_EPT_MISCONFIG ) { - vcpu->run->internal.ndata++; - vcpu->run->internal.data[3 ] = + vcpu->run->internal.data[ndata++] =vmcs_read64 (GUEST_PHYSICAL_ADDRESS ); } - vcpu->run->internal.data[vcpu->run->internal.ndata++] = - vcpu->arch.last_vmentry_cpu; + vcpu->run->internal.data[ndata++] = vcpu->arch.last_vmentry_cpu; + vcpu->run->internal.ndata = ndata;return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 113/122 kasan: fix hwasan build for gcc
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 5c595ac4c776c44b5c59de22ab43b3fe256d9fbb ]
gcc-11 adds support for -fsanitize=kernel-hwaddress, so it becomes possible to enable CONFIG_KASAN_SW_TAGS.
Unfortunately this fails to build at the moment, because the corresponding command line arguments use llvm specific syntax.
Change it to use the cc-param macro instead, which works on both clang and gcc.
--- scripts/Makefile.kasan | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
scripts/Makefile.kasan +6 -6
@@ -2,6 +2,8 @@ CFLAGS_KASAN_NOSANITIZE := -fno-builtin KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET) +cc-param = $(call cc-option, -mllvm -$(1), $(call cc-option, --param $(1))) + ifdef CONFIG_KASAN_GENERIC ifdef CONFIG_KASAN_INLINE
@@ -12,8 +14,6 @@ endif CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address -cc-param = $(call cc-option, -mllvm -$(1), $(call cc-option, --param $(1))) - # -fasan-shadow-offset fails without -fsanitize CFLAGS_KASAN_SHADOW := $(call cc-option, -fsanitize=kernel-address \ -fasan-shadow-offset=$(KASAN_SHADOW_OFFSET), \
@@ -36,14 +36,14 @@ endif # CONFIG_KASAN_GENERIC ifdef CONFIG_KASAN_SW_TAGS ifdef CONFIG_KASAN_INLINE - instrumentation_flags := -mllvm -hwasan-mapping-offset=$(KASAN_SHADOW_OFFSET) + instrumentation_flags := $(call cc-param,hwasan-mapping-offset=$(KASAN_SHADOW_OFFSET)) else - instrumentation_flags := -mllvm -hwasan-instrument-with-calls=1 + instrumentation_flags := $(call cc-param,hwasan-instrument-with-calls=1) endif CFLAGS_KASAN := -fsanitize=kernel-hwaddress \ - -mllvm -hwasan-instrument-stack=$(CONFIG_KASAN_STACK) \ - -mllvm -hwasan-use-short-granules=0 \ + $(call cc-param,hwasan-instrument-stack=$(CONFIG_KASAN_STACK)) \ + $(call cc-param,hwasan-use-short-granules=0) \ $(instrumentation_flags) endif # CONFIG_KASAN_SW_TAGS
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 114/122 kasan: remove redundant config option
In reply to Greg Kroah-HartmanFrom: Walter Wu <[email protected]>
[ Upstream commit 02c587733c8161355a43e6e110c2e29bd0acff72 ]
CONFIG_KASAN_STACK and CONFIG_KASAN_STACK_ENABLE both enable KASAN stack instrumentation, but we should only need one config, so that we remove CONFIG_KASAN_STACK_ENABLE and make CONFIG_KASAN_STACK workable. see [1].
When enable KASAN stack instrumentation, then for gcc we could do no prompt and default value y, and for clang prompt and default value n.
This patch fixes the following compilation warning:
include/linux/kasan.h:333:30: warning: 'CONFIG_KASAN_STACK' is not defined, evaluates to 0 [-Wundef]
[[email protected]: fix merge snafu]
--- arch/arm64/kernel/sleep.S | 2 +- arch/x86/kernel/acpi/wakeup_64.S | 2 +- include/linux/kasan.h | 2 +- lib/Kconfig.kasan | 9 ++------- mm/kasan/common.c | 2 +- mm/kasan/kasan.h | 2 +- mm/kasan/report_generic.c | 2 +- scripts/Makefile.kasan | 10 ++++++++-- security/Kconfig.hardening | 4 ++-- 9 files changed, 18 insertions(+), 17 deletions(-)
arch/arm64/kernel/sleep.S +1 -1
@@ -133,7 +133,7 @@ SYM_FUNC_START(_cpu_resume) */ bl cpu_do_resume -#if defined(CONFIG_KASAN) && CONFIG_KASAN_STACK +#if defined(CONFIG_KASAN) && defined(CONFIG_KASAN_STACK) mov x0, sp bl kasan_unpoison_task_stack_below #endif
arch/x86/kernel/acpi/wakeup_64.S +1 -1
@@ -112,7 +112,7 @@ SYM_FUNC_START(do_suspend_lowlevel) movq pt_regs_r14(%rax), %r14 movq pt_regs_r15(%rax), %r15 -#if defined(CONFIG_KASAN) && CONFIG_KASAN_STACK +#if defined(CONFIG_KASAN) && defined(CONFIG_KASAN_STACK) /* * The suspend path may have poisoned some areas deeper in the stack, * which we now need to unpoison.
include/linux/kasan.h +1 -1
@@ -306,7 +306,7 @@ static inline void kasan_kfree_large(void *ptr, unsigned long ip) {}#endif /* CONFIG_KASAN */ -#if defined(CONFIG_KASAN ) &&CONFIG_KASAN_STACK +#if defined(CONFIG_KASAN ) && defined(CONFIG_KASAN_STACK )void kasan_unpoison_task_stack (struct task_struct *task);#else static inline void kasan_unpoison_task_stack (struct task_struct *task) {}
lib/Kconfig.kasan +2 -7
@@ -138,9 +138,10 @@ config KASAN_INLINE endchoice -config KASAN_STACK_ENABLE +config KASAN_STACK bool "Enable stack instrumentation (unsafe)" if CC_IS_CLANG && !COMPILE_TEST depends on KASAN_GENERIC || KASAN_SW_TAGS + default y if CC_IS_GCC help The LLVM stack address sanitizer has a know problem that causes excessive stack usage in a lot of functions, see
@@ -154,12 +155,6 @@ config KASAN_STACK_ENABLE CONFIG_COMPILE_TEST. On gcc it is assumed to always be safe to use and enabled by default. -config KASAN_STACK - int - depends on KASAN_GENERIC || KASAN_SW_TAGS - default 1 if KASAN_STACK_ENABLE || CC_IS_GCC - default 0 - config KASAN_SW_TAGS_IDENTIFY bool "Enable memory corruption identification" depends on KASAN_SW_TAGS
mm/kasan/common.c +1 -1
@@ -63,7 +63,7 @@ void __kasan_unpoison_range(const void *address, size_t size)unpoison_range (address, size); } -#if CONFIG_KASAN_STACK +#ifdef CONFIG_KASAN_STACK /* Unpoison the entire stack for a task. */ void kasan_unpoison_task_stack (struct task_struct *task) {
mm/kasan/kasan.h +1 -1
@@ -224,7 +224,7 @@ void *find_first_bad_addr(void *addr, size_t size);const char *get_bug_type (struct kasan_access_info *info);void metadata_fetch_row (char *buffer,void *row); -#if defined(CONFIG_KASAN_GENERIC ) &&CONFIG_KASAN_STACK +#if defined(CONFIG_KASAN_GENERIC ) && defined(CONFIG_KASAN_STACK )void print_address_stack_frame (const void *addr);#else static inline void print_address_stack_frame (const void *addr) { }
mm/kasan/report_generic.c +1 -1
@@ -128,7 +128,7 @@ void metadata_fetch_row(char *buffer, void *row)memcpy (buffer,kasan_mem_to_shadow (row),META_BYTES_PER_ROW ); } -#if CONFIG_KASAN_STACK +#ifdef CONFIG_KASAN_STACK static bool __must_check tokenize_frame_descr (const char **frame_descr,char *token,size_t max_tok_len,unsigned long *value)
scripts/Makefile.kasan +8 -2
@@ -4,6 +4,12 @@ KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET) cc-param = $(call cc-option, -mllvm -$(1), $(call cc-option, --param $(1))) +ifdef CONFIG_KASAN_STACK + stack_enable := 1 +else + stack_enable := 0 +endif + ifdef CONFIG_KASAN_GENERIC ifdef CONFIG_KASAN_INLINE
@@ -27,7 +33,7 @@ else CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \ $(call cc-param,asan-globals=1) \ $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ - $(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) \ + $(call cc-param,asan-stack=$(stack_enable)) \ $(call cc-param,asan-instrument-allocas=1) endif
@@ -42,7 +48,7 @@ else endif CFLAGS_KASAN := -fsanitize=kernel-hwaddress \ - $(call cc-param,hwasan-instrument-stack=$(CONFIG_KASAN_STACK)) \ + $(call cc-param,hwasan-instrument-stack=$(stack_enable)) \ $(call cc-param,hwasan-use-short-granules=0) \ $(instrumentation_flags)
security/Kconfig.hardening +2 -2
@@ -64,7 +64,7 @@ choice config GCC_PLUGIN_STRUCTLEAK_BYREF bool "zero-init structs passed by reference (strong)" depends on GCC_PLUGINS - depends on !(KASAN && KASAN_STACK=1) + depends on !(KASAN && KASAN_STACK) select GCC_PLUGIN_STRUCTLEAK help Zero-initialize any structures on the stack that may
@@ -82,7 +82,7 @@ choice config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL bool "zero-init anything passed by reference (very strong)" depends on GCC_PLUGINS - depends on !(KASAN && KASAN_STACK=1) + depends on !(KASAN && KASAN_STACK) select GCC_PLUGIN_STRUCTLEAK help Zero-initialize any stack variables that may be passed
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 115/122 r8169: tweak max read request size for newer chips also in jumbo mtu mode
In reply to Greg Kroah-HartmanFrom: Heiner Kallweit <[email protected]>
[ Upstream commit 5e00e16cb98935bcf06f51931876d898c226f65c ]
So far we don't increase the max read request size if we switch to jumbo mode before bringing up the interface for the first time. Let's change this.
--- drivers/net/ethernet/realtek/r8169_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +5 -4
@@ -2342,13 +2342,14 @@ static void r8168b_1_hw_jumbo_disable(struct rtl8169_private *tp)static void rtl_jumbo_config (struct rtl8169_private *tp) {bool jumbo = tp->dev->mtu >ETH_DATA_LEN ; +int readrq =4096 ;rtl_unlock_config_regs (tp);switch (tp->mac_version) {case RTL_GIGA_MAC_VER_12 :case RTL_GIGA_MAC_VER_17 :if (jumbo) { -pcie_set_readrq (tp->pci_dev,512 ); + readrq =512 ;r8168b_1_hw_jumbo_enable (tp); }else {r8168b_1_hw_jumbo_disable (tp);
@@ -2356,7 +2357,7 @@ static void rtl_jumbo_config(struct rtl8169_private *tp)break ; case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_26:if (jumbo) { -pcie_set_readrq (tp->pci_dev,512 ); + readrq =512 ;r8168c_hw_jumbo_enable (tp); }else {r8168c_hw_jumbo_disable (tp);
@@ -2381,8 +2382,8 @@ static void rtl_jumbo_config(struct rtl8169_private *tp) }rtl_lock_config_regs (tp); -if (!jumbo &&pci_is_pcie (tp->pci_dev) && tp->supports_gmii) -pcie_set_readrq (tp->pci_dev,4096 ); +if (pci_is_pcie (tp->pci_dev) && tp->supports_gmii) +pcie_set_readrq (tp->pci_dev, readrq); }DECLARE_RTL_COND (rtl_chipcmd_cond)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 116/122 r8169: dont advertise pause in jumbo mode
In reply to Greg Kroah-HartmanFrom: Heiner Kallweit <[email protected]>
[ Upstream commit 453a77894efa4d9b6ef9644d74b9419c47ac427c ]
It has been reported [0] that using pause frames in jumbo mode impacts performance. There's no available chip documentation, but vendor drivers r8168 and r8125 don't advertise pause in jumbo mode. So let's do the same, according to Roman it fixes the issue.
[0] https://bugzilla.kernel.org/show_bug.cgi?id=212617
--- drivers/net/ethernet/realtek/r8169_main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +7 -2
@@ -2384,6 +2384,13 @@ static void rtl_jumbo_config(struct rtl8169_private *tp)if (pci_is_pcie (tp->pci_dev) && tp->supports_gmii)pcie_set_readrq (tp->pci_dev, readrq); + +/* Chip doesn't support pause in jumbo mode */ +linkmode_mod_bit (ETHTOOL_LINK_MODE_Pause_BIT, + tp->phydev->advertising, !jumbo); +linkmode_mod_bit (ETHTOOL_LINK_MODE_Asym_Pause_BIT, + tp->phydev->advertising, !jumbo); +phy_start_aneg (tp->phydev); }DECLARE_RTL_COND (rtl_chipcmd_cond)
@@ -4662,8 +4669,6 @@ static int r8169_phy_connect(struct rtl8169_private *tp)if (!tp->supports_gmii)phy_set_max_speed (phydev,SPEED_100 ); -phy_support_asym_pause (phydev); -phy_attached_info (phydev);return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 117/122 bpf: Ensure off_reg has no mixed signed bounds for all types
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
[ Upstream commit 24c109bb1537c12c02aeed2d51a347b4d6a9b76e ]
The mixed signed bounds check really belongs into retrieve_ptr_limit() instead of outside of it in adjust_ptr_min_max_vals(). The reason is that this check is not tied to PTR_TO_MAP_VALUE only, but to all pointer types that we handle in retrieve_ptr_limit() and given errors from the latter propagate back to adjust_ptr_min_max_vals() and lead to rejection of the program, it's a better place to reside to avoid anything slipping through for future types. The reason why we must reject such off_reg is that we otherwise would not be able to derive a mask, see details in 9d7eceede769 ("bpf: restrict unknown scalars of mixed signed bounds for unprivileged").
--- kernel/bpf/verifier.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
kernel/bpf/verifier.c +9 -10
@@ -5385,12 +5385,18 @@ static struct bpf_insn_aux_data *cur_aux(struct bpf_verifier_env *env) }static int retrieve_ptr_limit (const struct bpf_reg_state *ptr_reg, -u32 *ptr_limit,u8 opcode,bool off_is_neg) +const struct bpf_reg_state *off_reg, +u32 *ptr_limit,u8 opcode) { +bool off_is_neg = off_reg->smin_value <0 ;bool mask_to_left = (opcode ==BPF_ADD && off_is_neg) || (opcode ==BPF_SUB && !off_is_neg);u32 off, max; +if (!tnum_is_const (off_reg->var_off) && + (off_reg->smin_value <0 ) != (off_reg->smax_value <0 )) +return -EACCES ; +switch (ptr_reg->type) {case PTR_TO_STACK :/* Offset 0 is out-of-bounds, but acceptable start for the
@@ -5483,7 +5489,7 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env, alu_state |= ptr_is_dst_reg ?BPF_ALU_SANITIZE_SRC :BPF_ALU_SANITIZE_DST ; - err =retrieve_ptr_limit (ptr_reg, &alu_limit, opcode, off_is_neg); + err =retrieve_ptr_limit (ptr_reg, off_reg, &alu_limit, opcode);if (err <0 )return err;
@@ -5528,8 +5534,8 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, smin_ptr = ptr_reg->smin_value, smax_ptr = ptr_reg->smax_value;u64 umin_val = off_reg->umin_value, umax_val = off_reg->umax_value, umin_ptr = ptr_reg->umin_value, umax_ptr = ptr_reg->umax_value; -u32 dst = insn->dst_reg, src = insn->src_reg;u8 opcode =BPF_OP (insn->code); +u32 dst = insn->dst_reg;int ret; dst_reg = ®s[dst];
@@ -5577,13 +5583,6 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,verbose (env,"R%d pointer arithmetic on %s prohibited\n" , dst, reg_type_str[ptr_reg->type]);return -EACCES ; -case PTR_TO_MAP_VALUE : -if (!env->env->bypass_spec_v1 && !known && (smin_val <0 ) != (smax_val <0 )) { -verbose (env,"R%d has unknown scalar with mixed signed bounds, pointer arithmetic with it prohibited for !root\n" , - off_reg == dst_reg ? dst : src); -return -EACCES ; - } - fallthrough;default :break ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 118/122 bpf: Move off_reg into sanitize_ptr_alu
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
[ Upstream commit 6f55b2f2a1178856c19bbce2f71449926e731914 ]
Small refactor to drag off_reg into sanitize_ptr_alu(), so we later on can use off_reg for generalizing some of the checks for all pointer types.
--- kernel/bpf/verifier.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
kernel/bpf/verifier.c +5 -4
@@ -5463,11 +5463,12 @@ static int sanitize_val_alu(struct bpf_verifier_env *env,static int sanitize_ptr_alu (struct bpf_verifier_env *env,struct bpf_insn *insn,const struct bpf_reg_state *ptr_reg, -struct bpf_reg_state *dst_reg, -bool off_is_neg) +const struct bpf_reg_state *off_reg, +struct bpf_reg_state *dst_reg) {struct bpf_verifier_state *vstate = env->cur_state;struct bpf_insn_aux_data *aux =cur_aux (env); +bool off_is_neg = off_reg->smin_value <0 ;bool ptr_is_dst_reg = ptr_reg == dst_reg;u8 opcode =BPF_OP (insn->code);u32 alu_state, alu_limit;
@@ -5602,7 +5603,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,switch (opcode) {case BPF_ADD : - ret =sanitize_ptr_alu (env, insn, ptr_reg, dst_reg, smin_val <0 ); + ret =sanitize_ptr_alu (env, insn, ptr_reg, off_reg, dst_reg);if (ret <0 ) {verbose (env,"R%d tried to add from different maps, paths, or prohibited types\n" , dst);return ret;
@@ -5657,7 +5658,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, }break ;case BPF_SUB : - ret =sanitize_ptr_alu (env, insn, ptr_reg, dst_reg, smin_val <0 ); + ret =sanitize_ptr_alu (env, insn, ptr_reg, off_reg, dst_reg);if (ret <0 ) {verbose (env,"R%d tried to sub from different maps, paths, or prohibited types\n" , dst);return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 119/122 ARM: 9071/1: uprobes: Dont hook on thumb instructions
In reply to Greg Kroah-HartmanFrom: Fredrik Strupe <[email protected]>
commit d2f7eca60b29006285d57c7035539e33300e89e5 upstream.
Since uprobes is not supported for thumb, check that the thumb bit is not set when matching the uprobes instruction hooks.
The Arm UDF instructions used for uprobes triggering (UPROBE_SWBP_ARM_INSN and UPROBE_SS_ARM_INSN) coincidentally share the same encoding as a pair of unallocated 32-bit thumb instructions (not UDF) when the condition code is 0b1111 (0xf). This in effect makes it possible to trigger the uprobes functionality from thumb, and at that using two unallocated instructions which are not permanently undefined.
--- arch/arm/probes/uprobes/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/probes/uprobes/core.c +2 -2
@@ -204,7 +204,7 @@ unsigned long uprobe_get_swbp_addr(strucstatic struct undef_hook uprobes_arm_break_hook = { .instr_mask =0x0fffffff , .instr_val = (UPROBE_SWBP_ARM_INSN &0x0fffffff ), - .cpsr_mask =MODE_MASK , + .cpsr_mask = (PSR_T_BIT |MODE_MASK ), .cpsr_val =USR_MODE , .fn = uprobe_trap_handler, };
@@ -212,7 +212,7 @@ static struct undef_hook uprobes_arm_brestatic struct undef_hook uprobes_arm_ss_hook = { .instr_mask =0x0fffffff , .instr_val = (UPROBE_SS_ARM_INSN &0x0fffffff ), - .cpsr_mask =MODE_MASK , + .cpsr_mask = (PSR_T_BIT |MODE_MASK ), .cpsr_val =USR_MODE , .fn = uprobe_trap_handler, };
Greg Kroah-Hartman
maintainerPATCH 120/122 bpf: Rework ptr_limit into alu_limit and add common error path
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
commit b658bbb844e28f1862867f37e8ca11a8e2aa94a3 upstream.
Small refactor with no semantic changes in order to consolidate the max ptr_limit boundary check.
--- kernel/bpf/verifier.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
kernel/bpf/verifier.c +13 -8
@@ -5386,12 +5386,12 @@ static struct bpf_insn_aux_data *cur_auxstatic int retrieve_ptr_limit (const struct bpf_reg_state *ptr_reg,const struct bpf_reg_state *off_reg, -u32 *ptr_limit,u8 opcode) +u32 *alu_limit,u8 opcode) {bool off_is_neg = off_reg->smin_value <0 ;bool mask_to_left = (opcode ==BPF_ADD && off_is_neg) || (opcode ==BPF_SUB && !off_is_neg); -u32 off, max; +u32 off, max =0 , ptr_limit =0 ;if (!tnum_is_const (off_reg->var_off) && (off_reg->smin_value <0 ) != (off_reg->smax_value <0 ))
@@ -5408,22 +5408,27 @@ static int retrieve_ptr_limit(const stru*/ off = ptr_reg->off + ptr_reg->var_off.value;if (mask_to_left) - *ptr_limit =MAX_BPF_STACK + off; + ptr_limit =MAX_BPF_STACK + off;else - *ptr_limit = -off -1 ; -return *ptr_limit >= max ? -ERANGE :0 ; + ptr_limit = -off -1 ; +break ;case PTR_TO_MAP_VALUE : max = ptr_reg->map_ptr->value_size;if (mask_to_left) { - *ptr_limit = ptr_reg->umax_value + ptr_reg->off; + ptr_limit = ptr_reg->umax_value + ptr_reg->off; }else { off = ptr_reg->smin_value + ptr_reg->off; - *ptr_limit = ptr_reg->map_ptr->value_size - off -1 ; + ptr_limit = ptr_reg->map_ptr->value_size - off -1 ; } -return *ptr_limit >= max ? -ERANGE :0 ; +break ;default :return -EINVAL ; } + +if (ptr_limit >= max) +return -ERANGE ; + *alu_limit = ptr_limit; +return 0 ; } static bool can_skip_alu_sanitation(const struct bpf_verifier_env *env,
Greg Kroah-Hartman
maintainerPATCH 121/122 bpf: Improve verifier error messages for users
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
commit a6aaece00a57fa6f22575364b3903dfbccf5345d upstream.
Consolidate all error handling and provide more user-friendly error messages from sanitize_ptr_alu() and sanitize_val_alu().
--- kernel/bpf/verifier.c | 86 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 63 insertions(+), 23 deletions(-)
kernel/bpf/verifier.c +63 -23
@@ -5384,6 +5384,14 @@ static struct bpf_insn_aux_data *cur_auxreturn &env->insn_aux_data[env->insn_idx]; } +enum { +REASON_BOUNDS =-1 , +REASON_TYPE =-2 , +REASON_PATHS =-3 , +REASON_LIMIT =-4 , +REASON_STACK =-5 , +}; +static int retrieve_ptr_limit (const struct bpf_reg_state *ptr_reg,const struct bpf_reg_state *off_reg,u32 *alu_limit,u8 opcode)
@@ -5395,7 +5403,7 @@ static int retrieve_ptr_limit(const struif (!tnum_is_const (off_reg->var_off) && (off_reg->smin_value <0 ) != (off_reg->smax_value <0 )) -return -EACCES ; +return REASON_BOUNDS ;switch (ptr_reg->type) {case PTR_TO_STACK :
@@ -5422,11 +5430,11 @@ static int retrieve_ptr_limit(const stru }break ;default : -return -EINVAL ; +return REASON_TYPE ; }if (ptr_limit >= max) -return -ERANGE ; +return REASON_LIMIT ; *alu_limit = ptr_limit;return 0 ; }
@@ -5446,7 +5454,7 @@ static int update_alu_sanitation_state(sif (aux->alu_state && (aux->alu_state != alu_state || aux->alu_limit != alu_limit)) -return -EACCES ; +return REASON_PATHS ;/* Corresponding fixup done in fixup_bpf_calls(). */ aux->alu_state = alu_state;
@@ -5519,7 +5527,46 @@ do_sim: ret =push_stack (env, env->insn_idx +1 , env->insn_idx, true);if (!ptr_is_dst_reg && ret) *dst_reg = tmp; -return !ret ? -EFAULT :0 ; +return !ret ?REASON_STACK :0 ; +} + +static int sanitize_err (struct bpf_verifier_env *env, +const struct bpf_insn *insn,int reason, +const struct bpf_reg_state *off_reg, +const struct bpf_reg_state *dst_reg) +{ +static const char *err ="pointer arithmetic with it prohibited for !root" ; +const char *op =BPF_OP (insn->code) ==BPF_ADD ?"add" :"sub" ; +u32 dst = insn->dst_reg, src = insn->src_reg; + +switch (reason) { +case REASON_BOUNDS : +verbose (env,"R%d has unknown scalar with mixed signed bounds, %s\n" , + off_reg == dst_reg ? dst : src, err); +break ; +case REASON_TYPE : +verbose (env,"R%d has pointer with unsupported alu operation, %s\n" , + off_reg == dst_reg ? src : dst, err); +break ; +case REASON_PATHS : +verbose (env,"R%d tried to %s from different maps, paths or scalars, %s\n" , + dst, op, err); +break ; +case REASON_LIMIT : +verbose (env,"R%d tried to %s beyond pointer bounds, %s\n" , + dst, op, err); +break ; +case REASON_STACK : +verbose (env,"R%d could not be pushed for speculative verification, %s\n" , + dst, err); +break ; +default : +verbose (env,"verifier internal error: unknown reason (%d)\n" , + reason); +break ; + } + +return -EACCES ; }/* Handles arithmetic on a pointer and a scalar: computes new min/max and var_off.
@@ -5609,10 +5656,9 @@ static int adjust_ptr_min_max_vals(strucswitch (opcode) {case BPF_ADD : ret =sanitize_ptr_alu (env, insn, ptr_reg, off_reg, dst_reg); -if (ret <0 ) { -verbose (env,"R%d tried to add from different maps, paths, or prohibited types\n" , dst); -return ret; - } +if (ret <0 ) +return sanitize_err (env, insn, ret, off_reg, dst_reg); +/* We can take a fixed offset as long as it doesn't overflow * the s32 'off' field */
@@ -5664,10 +5710,9 @@ static int adjust_ptr_min_max_vals(strucbreak ;case BPF_SUB : ret =sanitize_ptr_alu (env, insn, ptr_reg, off_reg, dst_reg); -if (ret <0 ) { -verbose (env,"R%d tried to sub from different maps, paths, or prohibited types\n" , dst); -return ret; - } +if (ret <0 ) +return sanitize_err (env, insn, ret, off_reg, dst_reg); +if (dst_reg == off_reg) {/* scalar -= pointer. Creates an unknown scalar */ verbose(env, "R%d tried to subtract pointer from scalar\n",
@@ -6357,9 +6402,8 @@ static int adjust_scalar_min_max_vals(sts32 s32_min_val, s32_max_val;u32 u32_min_val, u32_max_val;u64 insn_bitness = (BPF_CLASS (insn->code) ==BPF_ALU64 ) ?64 :32 ; -u32 dst = insn->dst_reg; -int ret;bool alu32 = (BPF_CLASS (insn->code) !=BPF_ALU64 ); +int ret; smin_val = src_reg.smin_value; smax_val = src_reg.smax_value;
@@ -6418,20 +6462,16 @@ static int adjust_scalar_min_max_vals(stswitch (opcode) {case BPF_ADD : ret =sanitize_val_alu (env, insn); -if (ret <0 ) { -verbose (env,"R%d tried to add from different pointers or scalars\n" , dst); -return ret; - } +if (ret <0 ) +return sanitize_err (env, insn, ret,NULL ,NULL );scalar32_min_max_add (dst_reg, &src_reg);scalar_min_max_add (dst_reg, &src_reg); dst_reg->var_off =tnum_add (dst_reg->var_off, src_reg.var_off);break ;case BPF_SUB : ret =sanitize_val_alu (env, insn); -if (ret <0 ) { -verbose (env,"R%d tried to sub from different pointers or scalars\n" , dst); -return ret; - } +if (ret <0 ) +return sanitize_err (env, insn, ret,NULL ,NULL );scalar32_min_max_sub (dst_reg, &src_reg);scalar_min_max_sub (dst_reg, &src_reg); dst_reg->var_off =tnum_sub (dst_reg->var_off, src_reg.var_off);
Greg Kroah-Hartman
maintainerPATCH 122/122 bpf: Move sanitize_val_alu out of op switch
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
commit f528819334881fd622fdadeddb3f7edaed8b7c9b upstream.
Add a small sanitize_needed() helper function and move sanitize_val_alu() out of the main opcode switch. In upcoming work, we'll move sanitize_ptr_alu() as well out of its opcode switch so this helps to streamline both.
--- kernel/bpf/verifier.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
kernel/bpf/verifier.c +11 -6
@@ -5473,6 +5473,11 @@ static int sanitize_val_alu(struct bpf_vreturn update_alu_sanitation_state (aux,BPF_ALU_NON_POINTER ,0 ); } +static bool sanitize_needed (u8 opcode) +{ +return opcode ==BPF_ADD || opcode ==BPF_SUB ; +} + static int sanitize_ptr_alu(struct bpf_verifier_env *env, struct bpf_insn *insn, const struct bpf_reg_state *ptr_reg,
@@ -6445,6 +6450,12 @@ static int adjust_scalar_min_max_vals(streturn 0 ; } +if (sanitize_needed (opcode)) { + ret =sanitize_val_alu (env, insn); +if (ret <0 ) +return sanitize_err (env, insn, ret,NULL ,NULL ); + } +/* Calculate sign/unsigned bounds and tnum for alu32 and alu64 bit ops. * There are two classes of instructions: The first class we track both * alu32 and alu64 sign/unsigned bounds independently this provides the
@@ -6461,17 +6472,11 @@ static int adjust_scalar_min_max_vals(st*/ switch (opcode) {case BPF_ADD : - ret =sanitize_val_alu (env, insn); -if (ret <0 ) -return sanitize_err (env, insn, ret,NULL ,NULL );scalar32_min_max_add (dst_reg, &src_reg);scalar_min_max_add (dst_reg, &src_reg); dst_reg->var_off =tnum_add (dst_reg->var_off, src_reg.var_off);break ;case BPF_SUB : - ret =sanitize_val_alu (env, insn); -if (ret <0 ) -return sanitize_err (env, insn, ret,NULL ,NULL );scalar32_min_max_sub (dst_reg, &src_reg);scalar_min_max_sub (dst_reg, &src_reg); dst_reg->var_off =tnum_sub (dst_reg->var_off, src_reg.var_off);
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.11.16 release. There are 122 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, 21 Apr 2021 13:05:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.11.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.11.y
and the diffstat can be found below.thanks,
greg k-h
5.11.16-rc1 Successfully Compiled and booted on my Raspberry PI 4b (8g) (bcm2711)
Greg Kroah-Hartman
maintainerQuoted 15 lines · Fox Chen
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.11.16 release. There are 122 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, 21 Apr 2021 13:05:09 +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.11.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.11.y
and the diffstat can be found below.
Quoted 8 lines
Quoted 4 lines
thanks,
greg k-h
5.11.16-rc1 Successfully Compiled and booted on my Raspberry PI 4b (8g) (bcm2711)
Tested-by Fox Chen <[email protected]>
Thanks for testing and letting me know.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.11.16 release. There are 122 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, 21 Apr 2021 13:05:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.11.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.11.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.11.16 release. There are 122 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, 21 Apr 2021 13:05:09 +0000. Anything received after that time might be too late.
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 461 pass: 461 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.11.16 release. There are 122 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, 21 Apr 2021 13:05:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.11.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.11.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.11:
12 builds: 12 pass, 0 fail
28 boots: 28 pass, 0 fail
70 tests: 70 pass, 0 failLinux version: 5.11.16-rc1-gf34f787f0e47
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Greg Kroah-Hartman
maintainerQuoted 28 lines · Jon Hunter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.11.16 release. There are 122 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, 21 Apr 2021 13:05:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.11.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.11.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.11:
12 builds: 12 pass, 0 fail 28 boots: 28 pass, 0 fail 70 tests: 70 pass, 0 failLinux version: 5.11.16-rc1-gf34f787f0e47
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
Quoted 7 lines
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000, tegra20-ventana, tegra210-p2371-2180, tegra210-p3450-0000, tegra30-cardhu-a04Tested-by Jon Hunter <[email protected]>Jon
Thanks for testing and letting me know.
greg k-h
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.11.16 release. There are 122 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, 21 Apr 2021 13:05:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.11.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.11.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 5.11.16-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git branch: linux-5.11.y
* git commit: f34f787f0e47983f4f18c818b2cf23f5e3bf576e
* git describe: v5.11.15-123-gf34f787f0e47
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.11.y/build/v5.11.15-123-gf34f787f0e47
## No regressions (compared to v5.11.14-24-g7825299a896f)
## No fixes (compared to v5.11.14-24-g7825299a896f)
## Test result summary
total: 76776, pass: 63385, fail: 2827, skip: 10320, xfail: 244,
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 192 total, 192 passed, 0 failed
* arm64: 26 total, 26 passed, 0 failed
* dragonboard-410c: 2 total, 2 passed, 0 failed
* hi6220-hikey: 2 total, 2 passed, 0 failed
* i386: 26 total, 26 passed, 0 failed
* juno-r2: 2 total, 2 passed, 0 failed
* mips: 45 total, 45 passed, 0 failed
* parisc: 9 total, 9 passed, 0 failed
* powerpc: 27 total, 27 passed, 0 failed
* riscv: 21 total, 21 passed, 0 failed
* s390: 18 total, 18 passed, 0 failed
* sh: 18 total, 18 passed, 0 failed
* sparc: 9 total, 9 passed, 0 failed
* x15: 1 total, 0 passed, 1 failed
* x86: 2 total, 2 passed, 0 failed
* x86_64: 26 total, 26 passed, 0 failed
## Test suites summary
* fwts
* igt-gpu-tools
* install-android-platform-tools-r2600
* kselftest-
* kselftest-android
* kselftest-bpf
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-lkdtm
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-vsyscall-mode-native-
* kselftest-vsyscall-mode-none-
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* perf
* rcutorture
* ssuite
* v4l2-compliance
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 160 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.11.16 release. There are 122 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, 21 Apr 2021 13:05:09 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.11.16-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.11.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.## Build
* kernel: 5.11.16-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git branch: linux-5.11.y
* git commit:f34f787f0e47983f4f18c818b2cf23f5e3bf576e
* git describe: v5.11.15-123-gf34f787f0e47
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.11.y/build/v5.11.15-123-gf34f787f0e47## No regressions (compared to v5.11.14-24-g7825299a896f)
## No fixes (compared to v5.11.14-24-g7825299a896f)
## Test result summary
total: 76776, pass: 63385, fail: 2827, skip: 10320, xfail: 244,## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 192 total, 192 passed, 0 failed
* arm64: 26 total, 26 passed, 0 failed
* dragonboard-410c: 2 total, 2 passed, 0 failed
* hi6220-hikey: 2 total, 2 passed, 0 failed
* i386: 26 total, 26 passed, 0 failed
* juno-r2: 2 total, 2 passed, 0 failed
* mips: 45 total, 45 passed, 0 failed
* parisc: 9 total, 9 passed, 0 failed
* powerpc: 27 total, 27 passed, 0 failed
* riscv: 21 total, 21 passed, 0 failed
* s390: 18 total, 18 passed, 0 failed
* sh: 18 total, 18 passed, 0 failed
* sparc: 9 total, 9 passed, 0 failed
* x15: 1 total, 0 passed, 1 failed
* x86: 2 total, 2 passed, 0 failed
*x86_64: 26 total, 26 passed, 0 failed## Test suites summary
* fwts
* igt-gpu-tools
* install-android-platform-tools-r2600
* kselftest-
* kselftest-android
* kselftest-bpf
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-lkdtm
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-vsyscall-mode-native-
* kselftest-vsyscall-mode-none-
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* perf
* rcutorture
* ssuite
* v4l2-compliance
Quoted 3 lines
--
Linaro LKFT
https://lkft.linaro.org
Thanks for testing and letting me know.
greg k-h