From 9f441a3d149344cbc8514d1577c7f1e4ac26fc09 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Mon, 6 Apr 2020 14:51:28 +0200 Subject: [PATCH] Move Odroid XU4 DEV branch to 5.6.y Also update all patches and configs --- config/kernel/linux-odroidxu4-current.config | 4 +- config/kernel/linux-odroidxu4-dev.config | 75 +- config/kernel/linux-odroidxu4-legacy.config | 4 +- config/sources/families/odroidxu4.conf | 2 +- .../03-patch-5.4.28-29.patch | 5915 +++++++++++++++++ .../03-patch-5.4.29-30.patch | 994 +++ .../0000-remove-stock-8188eu-8812au.patch | 4 +- .../odroidxu4-legacy/patch-4.14.174-175.patch | 4354 ++++++++++++ 8 files changed, 11334 insertions(+), 18 deletions(-) create mode 100644 patch/kernel/odroidxu4-current/03-patch-5.4.28-29.patch create mode 100644 patch/kernel/odroidxu4-current/03-patch-5.4.29-30.patch create mode 100644 patch/kernel/odroidxu4-legacy/patch-4.14.174-175.patch diff --git a/config/kernel/linux-odroidxu4-current.config b/config/kernel/linux-odroidxu4-current.config index 61c0c6007d..96fa92d1c9 100644 --- a/config/kernel/linux-odroidxu4-current.config +++ b/config/kernel/linux-odroidxu4-current.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.4.28 Kernel Configuration +# Linux/arm 5.4.30 Kernel Configuration # # @@ -2337,6 +2337,8 @@ CONFIG_RTL8822BU=m CONFIG_RTL8188EU=m CONFIG_RTL8821CU=m CONFIG_88XXAU=m +CONFIG_RTL8189FS=m +CONFIG_RTL8189ES=m CONFIG_WLAN_VENDOR_ZYDAS=y CONFIG_USB_ZD1201=m CONFIG_ZD1211RW=m diff --git a/config/kernel/linux-odroidxu4-dev.config b/config/kernel/linux-odroidxu4-dev.config index 6bafdb83c2..b2e1c20629 100644 --- a/config/kernel/linux-odroidxu4-dev.config +++ b/config/kernel/linux-odroidxu4-dev.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.5.1 Kernel Configuration +# Linux/arm 5.6.2 Kernel Configuration # # @@ -14,7 +14,7 @@ CONFIG_CC_HAS_ASM_GOTO=y CONFIG_CC_HAS_ASM_INLINE=y CONFIG_CC_HAS_WARN_MAYBE_UNINITIALIZED=y CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_EXTABLE_SORT=y +CONFIG_BUILDTIME_TABLE_SORT=y # # General setup @@ -109,6 +109,7 @@ CONFIG_CPU_ISOLATION=y # # RCU Subsystem # +CONFIG_TREE_RCU=y CONFIG_PREEMPT_RCU=y # CONFIG_RCU_EXPERT is not set CONFIG_SRCU=y @@ -172,6 +173,7 @@ CONFIG_RD_LZMA=y CONFIG_RD_XZ=y CONFIG_RD_LZO=y CONFIG_RD_LZ4=y +# CONFIG_BOOT_CONFIG is not set CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_SYSCTL=y @@ -295,7 +297,7 @@ CONFIG_ARCH_EXYNOS4=y CONFIG_ARCH_EXYNOS5=y # -# EXYNOS SoCs +# Exynos SoCs # CONFIG_SOC_EXYNOS3250=y CONFIG_CPU_EXYNOS4210=y @@ -733,6 +735,7 @@ CONFIG_BLK_CGROUP_RWSTAT=y CONFIG_BLK_DEV_BSG=y CONFIG_BLK_DEV_BSGLIB=y CONFIG_BLK_DEV_INTEGRITY=y +CONFIG_BLK_DEV_INTEGRITY_T10=m CONFIG_BLK_DEV_ZONED=y CONFIG_BLK_DEV_THROTTLING=y CONFIG_BLK_DEV_THROTTLING_LOW=y @@ -863,8 +866,6 @@ CONFIG_NET_KEY=y CONFIG_NET_KEY_MIGRATE=y # CONFIG_XDP_SOCKETS is not set CONFIG_INET=y -CONFIG_WIREGUARD=m -# CONFIG_WIREGUARD_DEBUG is not set CONFIG_IP_MULTICAST=y CONFIG_IP_ADVANCED_ROUTER=y CONFIG_IP_FIB_TRIE_STATS=y @@ -894,6 +895,7 @@ CONFIG_NET_FOU_IP_TUNNELS=y CONFIG_INET_AH=m CONFIG_INET_ESP=m # CONFIG_INET_ESP_OFFLOAD is not set +# CONFIG_INET_ESPINTCP is not set CONFIG_INET_IPCOMP=m CONFIG_INET_XFRM_TUNNEL=m CONFIG_INET_TUNNEL=m @@ -951,6 +953,7 @@ CONFIG_IPV6_PIMSM_V2=y # CONFIG_IPV6_SEG6_LWTUNNEL is not set # CONFIG_IPV6_SEG6_HMAC is not set # CONFIG_NETLABEL is not set +# CONFIG_MPTCP is not set CONFIG_NETWORK_SECMARK=y CONFIG_NET_PTP_CLASSIFY=y CONFIG_NETWORK_PHY_TIMESTAMPING=y @@ -1416,8 +1419,10 @@ CONFIG_NET_SCH_CAKE=m CONFIG_NET_SCH_FQ=m CONFIG_NET_SCH_HHF=m CONFIG_NET_SCH_PIE=m +CONFIG_NET_SCH_FQ_PIE=m CONFIG_NET_SCH_INGRESS=m CONFIG_NET_SCH_PLUG=m +CONFIG_NET_SCH_ETS=m CONFIG_NET_SCH_DEFAULT=y CONFIG_DEFAULT_FQ=y # CONFIG_DEFAULT_CODEL is not set @@ -1497,6 +1502,8 @@ CONFIG_OPENVSWITCH_GRE=m CONFIG_OPENVSWITCH_VXLAN=m CONFIG_VSOCKETS=m CONFIG_VSOCKETS_DIAG=m +CONFIG_VSOCKETS_LOOPBACK=m +CONFIG_VIRTIO_VSOCKETS_COMMON=m CONFIG_NETLINK_DIAG=m CONFIG_MPLS=y CONFIG_NET_MPLS_GSO=m @@ -1687,6 +1694,7 @@ CONFIG_LWTUNNEL_BPF=y CONFIG_DST_CACHE=y CONFIG_GRO_CELLS=y # CONFIG_FAILOVER is not set +CONFIG_ETHTOOL_NETLINK=y CONFIG_HAVE_EBPF_JIT=y # @@ -1946,6 +1954,8 @@ CONFIG_MII=y CONFIG_NET_CORE=y CONFIG_BONDING=m CONFIG_DUMMY=m +CONFIG_WIREGUARD=m +# CONFIG_WIREGUARD_DEBUG is not set # CONFIG_EQUALIZER is not set # CONFIG_IFB is not set CONFIG_NET_TEAM=m @@ -2091,6 +2101,7 @@ CONFIG_AX88796B_PHY=m # CONFIG_BCM7XXX_PHY is not set # CONFIG_BCM87XX_PHY is not set # CONFIG_BROADCOM_PHY is not set +# CONFIG_BCM84881_PHY is not set # CONFIG_CICADA_PHY is not set # CONFIG_CORTINA_PHY is not set # CONFIG_DAVICOM_PHY is not set @@ -2299,10 +2310,13 @@ CONFIG_WLAN_VENDOR_TI=y # CONFIG_WL12XX is not set # CONFIG_WL18XX is not set # CONFIG_WLCORE is not set +CONFIG_RTL8723DS=m CONFIG_RTL8822BU=m CONFIG_RTL8188EU=m CONFIG_RTL8821CU=m -CONFIG_RTL8812AU=m +CONFIG_88XXAU=m +CONFIG_RTL8189FS=m +CONFIG_RTL8189ES=m CONFIG_WLAN_VENDOR_ZYDAS=y CONFIG_USB_ZD1201=m CONFIG_ZD1211RW=m @@ -2631,6 +2645,7 @@ CONFIG_DEVMEM=y CONFIG_SERIAL_EARLYCON=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +# CONFIG_SERIAL_8250_16550A_VARIANTS is not set # CONFIG_SERIAL_8250_FINTEK is not set # CONFIG_SERIAL_8250_CONSOLE is not set CONFIG_SERIAL_8250_DMA=y @@ -2752,7 +2767,6 @@ CONFIG_I2C_S3C2410=y # # CONFIG_I2C_DIOLAN_U2C is not set # CONFIG_I2C_PARPORT is not set -# CONFIG_I2C_PARPORT_LIGHT is not set # CONFIG_I2C_ROBOTFUZZ_OSIF is not set # CONFIG_I2C_TAOS_EVM is not set CONFIG_I2C_TINY_USB=m @@ -2851,10 +2865,12 @@ CONFIG_GPIO_GENERIC=m # CONFIG_GPIO_GENERIC_PLATFORM is not set # CONFIG_GPIO_GRGPIO is not set # CONFIG_GPIO_HLWD is not set +CONFIG_GPIO_LOGICVC=m # CONFIG_GPIO_MB86S7X is not set # CONFIG_GPIO_MPC8XXX is not set # CONFIG_GPIO_PL061 is not set CONFIG_GPIO_SAMA5D2_PIOBU=m +# CONFIG_GPIO_SIFIVE is not set CONFIG_GPIO_SYSCON=m # CONFIG_GPIO_XILINX is not set # CONFIG_GPIO_ZEVIO is not set @@ -2878,6 +2894,7 @@ CONFIG_GPIO_GW_PLD=m # MFD GPIO expanders # CONFIG_GPIO_BD70528=m +CONFIG_GPIO_BD71828=m # CONFIG_HTC_EGPIO is not set CONFIG_GPIO_TQMX86=m # CONFIG_GPIO_WM8994 is not set @@ -3005,6 +3022,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_ADM1026 is not set # CONFIG_SENSORS_ADM1029 is not set # CONFIG_SENSORS_ADM1031 is not set +CONFIG_SENSORS_ADM1177=m # CONFIG_SENSORS_ADM9240 is not set # CONFIG_SENSORS_ADT7310 is not set # CONFIG_SENSORS_ADT7410 is not set @@ -3050,6 +3068,7 @@ CONFIG_SENSORS_LTC2947_SPI=m # CONFIG_SENSORS_MAX1668 is not set # CONFIG_SENSORS_MAX197 is not set # CONFIG_SENSORS_MAX31722 is not set +CONFIG_SENSORS_MAX31730=m # CONFIG_SENSORS_MAX6621 is not set # CONFIG_SENSORS_MAX6639 is not set # CONFIG_SENSORS_MAX6642 is not set @@ -3143,6 +3162,7 @@ CONFIG_THERMAL_GOV_STEP_WISE=y # CONFIG_THERMAL_GOV_BANG_BANG is not set # CONFIG_THERMAL_GOV_USER_SPACE is not set CONFIG_CPU_THERMAL=y +CONFIG_CPU_FREQ_THERMAL=y # CONFIG_CLOCK_THERMAL is not set # CONFIG_DEVFREQ_THERMAL is not set CONFIG_THERMAL_EMULATION=y @@ -3297,6 +3317,7 @@ CONFIG_MFD_TQMX86=m CONFIG_MFD_WM8994=y # CONFIG_MFD_ROHM_BD718XX is not set CONFIG_MFD_ROHM_BD70528=m +CONFIG_MFD_ROHM_BD71828=m # CONFIG_MFD_STPMIC1 is not set CONFIG_MFD_STMFX=m # end of Multifunction device drivers @@ -3311,6 +3332,7 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y # CONFIG_REGULATOR_AD5398 is not set # CONFIG_REGULATOR_ANATOP is not set # CONFIG_REGULATOR_BD70528 is not set +CONFIG_REGULATOR_BD71828=m # CONFIG_REGULATOR_DA9210 is not set # CONFIG_REGULATOR_DA9211 is not set # CONFIG_REGULATOR_FAN53555 is not set @@ -3335,12 +3357,15 @@ CONFIG_REGULATOR_MAX77686=y CONFIG_REGULATOR_MAX77693=y CONFIG_REGULATOR_MAX77802=y # CONFIG_REGULATOR_MCP16502 is not set +CONFIG_REGULATOR_MP8859=m +CONFIG_REGULATOR_MPQ7920=m # CONFIG_REGULATOR_MT6311 is not set # CONFIG_REGULATOR_PFUZE100 is not set # CONFIG_REGULATOR_PV88060 is not set # CONFIG_REGULATOR_PV88080 is not set # CONFIG_REGULATOR_PV88090 is not set # CONFIG_REGULATOR_PWM is not set +CONFIG_REGULATOR_ROHM=m CONFIG_REGULATOR_S2MPA01=y CONFIG_REGULATOR_S2MPS11=y CONFIG_REGULATOR_S5M8767=y @@ -3961,7 +3986,6 @@ CONFIG_DRM_SCHED=y # CONFIG_DRM_HDLCD is not set # CONFIG_DRM_MALI_DISPLAY is not set CONFIG_DRM_KOMEDA=m -# CONFIG_DRM_KOMEDA_ERROR_PRINT is not set # end of ARM devices # @@ -4011,6 +4035,7 @@ CONFIG_DRM_PANEL=y # Display Panels # # CONFIG_DRM_PANEL_ARM_VERSATILE is not set +CONFIG_DRM_PANEL_BOE_HIMAX8279D=m # CONFIG_DRM_PANEL_LVDS is not set CONFIG_DRM_PANEL_SIMPLE=y # CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D is not set @@ -4019,6 +4044,7 @@ CONFIG_DRM_PANEL_SIMPLE=y # CONFIG_DRM_PANEL_INNOLUX_P079ZCA is not set # CONFIG_DRM_PANEL_JDI_LT070ME05000 is not set # CONFIG_DRM_PANEL_KINGDISPLAY_KD097D04 is not set +CONFIG_DRM_PANEL_LEADTEK_LTK500HD1829=m CONFIG_DRM_PANEL_SAMSUNG_LD9040=y # CONFIG_DRM_PANEL_LG_LB035Q02 is not set # CONFIG_DRM_PANEL_LG_LG4573 is not set @@ -4044,11 +4070,13 @@ CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0=y # CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set # CONFIG_DRM_PANEL_SITRONIX_ST7701 is not set # CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set +CONFIG_DRM_PANEL_SONY_ACX424AKP=m # CONFIG_DRM_PANEL_SONY_ACX565AKM is not set # CONFIG_DRM_PANEL_TPO_TD028TTEC1 is not set # CONFIG_DRM_PANEL_TPO_TD043MTEA1 is not set # CONFIG_DRM_PANEL_TPO_TPG110 is not set # CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA is not set +CONFIG_DRM_PANEL_XINPENG_XPP055C272=m # end of Display Panels CONFIG_DRM_BRIDGE=y @@ -4057,10 +4085,9 @@ CONFIG_DRM_PANEL_BRIDGE=y # # Display Interface Bridges # -# CONFIG_DRM_ANALOGIX_ANX78XX is not set # CONFIG_DRM_CDNS_DSI is not set # CONFIG_DRM_DUMB_VGA_DAC is not set -# CONFIG_DRM_LVDS_ENCODER is not set +CONFIG_DRM_LVDS_CODEC=m # CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW is not set CONFIG_DRM_NXP_PTN3460=y CONFIG_DRM_PARADE_PS8622=y @@ -4072,6 +4099,8 @@ CONFIG_DRM_TOSHIBA_TC358764=y # CONFIG_DRM_TOSHIBA_TC358767 is not set # CONFIG_DRM_TI_TFP410 is not set # CONFIG_DRM_TI_SN65DSI86 is not set +CONFIG_DRM_ANALOGIX_ANX6345=m +# CONFIG_DRM_ANALOGIX_ANX78XX is not set CONFIG_DRM_ANALOGIX_DP=y # CONFIG_DRM_I2C_ADV7511 is not set # end of Display Interface Bridges @@ -4159,6 +4188,7 @@ CONFIG_BACKLIGHT_QCOM_WLED=m # CONFIG_BACKLIGHT_LV5207LP is not set # CONFIG_BACKLIGHT_BD6107 is not set # CONFIG_BACKLIGHT_ARCXCNN is not set +CONFIG_BACKLIGHT_LED=m # end of Backlight & LCD device support CONFIG_VIDEOMODE_HELPERS=y @@ -4428,6 +4458,7 @@ CONFIG_SND_SOC_WM8994=m # CONFIG_SND_SOC_MAX9759 is not set # CONFIG_SND_SOC_MT6351 is not set CONFIG_SND_SOC_MT6358=m +CONFIG_SND_SOC_MT6660=m # CONFIG_SND_SOC_NAU8540 is not set # CONFIG_SND_SOC_NAU8810 is not set CONFIG_SND_SOC_NAU8822=m @@ -5079,6 +5110,7 @@ CONFIG_SYNC_FILE=y # CONFIG_SW_SYNC is not set # CONFIG_UDMABUF is not set # CONFIG_DMABUF_SELFTESTS is not set +# CONFIG_DMABUF_HEAPS is not set # end of DMABUF options # CONFIG_AUXDISPLAY is not set @@ -5150,6 +5182,7 @@ CONFIG_ARM_ARCH_TIMER=y CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y CONFIG_CLKSRC_EXYNOS_MCT=y CONFIG_CLKSRC_SAMSUNG_PWM=y +# CONFIG_MICROCHIP_PIT64B is not set # end of Clock Source drivers # CONFIG_MAILBOX is not set @@ -5209,6 +5242,7 @@ CONFIG_EXYNOS_IOMMU=y # # NXP/Freescale QorIQ SoC drivers # +# CONFIG_QUICC_ENGINE is not set # CONFIG_FSL_RCPM is not set # end of NXP/Freescale QorIQ SoC drivers @@ -5303,6 +5337,8 @@ CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 # CONFIG_ADXL372_I2C is not set # CONFIG_BMA180 is not set # CONFIG_BMA220 is not set +CONFIG_BMA400=m +CONFIG_BMA400_I2C=m # CONFIG_BMC150_ACCEL is not set # CONFIG_DA280 is not set # CONFIG_DA311 is not set @@ -5330,6 +5366,7 @@ CONFIG_HID_SENSOR_ACCEL_3D=m # # Analog to digital converters # +CONFIG_AD7091R5=m # CONFIG_AD7124 is not set # CONFIG_AD7266 is not set # CONFIG_AD7291 is not set @@ -5354,6 +5391,7 @@ CONFIG_EXYNOS_ADC=y # CONFIG_HX711 is not set # CONFIG_LTC2471 is not set # CONFIG_LTC2485 is not set +CONFIG_LTC2496=m # CONFIG_LTC2497 is not set # CONFIG_MAX1027 is not set # CONFIG_MAX11100 is not set @@ -5659,6 +5697,7 @@ CONFIG_HID_SENSOR_DEVICE_ROTATION=m CONFIG_BMP280=m CONFIG_BMP280_I2C=m CONFIG_BMP280_SPI=m +CONFIG_DLHL60D=m CONFIG_DPS310=m CONFIG_HID_SENSOR_PRESS=m # CONFIG_HP03 is not set @@ -5685,6 +5724,7 @@ CONFIG_HID_SENSOR_PRESS=m # CONFIG_ISL29501 is not set # CONFIG_LIDAR_LITE_V2 is not set # CONFIG_MB1232 is not set +CONFIG_PING=m # CONFIG_RFD77402 is not set # CONFIG_SRF04 is not set # CONFIG_SX9500 is not set @@ -5729,6 +5769,7 @@ CONFIG_ARM_GIC=y CONFIG_ARM_GIC_MAX_NR=1 CONFIG_GIC_NON_BANKED=y # CONFIG_AL_FIC is not set +CONFIG_EXYNOS_IRQ_COMBINER=y # end of IRQ chip support # CONFIG_IPACK_BUS is not set @@ -5757,6 +5798,7 @@ CONFIG_PHY_EXYNOS4X12_USB2=y CONFIG_PHY_EXYNOS5250_USB2=y CONFIG_PHY_EXYNOS5_USBDRD=y CONFIG_PHY_EXYNOS5250_SATA=y +CONFIG_PHY_INTEL_EMMC=m # end of PHY Subsystem # CONFIG_POWERCAP is not set @@ -5859,12 +5901,15 @@ CONFIG_F2FS_FS_POSIX_ACL=y CONFIG_F2FS_FS_SECURITY=y CONFIG_F2FS_CHECK_FS=y # CONFIG_F2FS_FAULT_INJECTION is not set +# CONFIG_F2FS_FS_COMPRESSION is not set +CONFIG_ZONEFS_FS=m CONFIG_FS_POSIX_ACL=y CONFIG_EXPORTFS=y CONFIG_EXPORTFS_BLOCK_OPS=y CONFIG_FILE_LOCKING=y CONFIG_MANDATORY_FILE_LOCKING=y CONFIG_FS_ENCRYPTION=y +CONFIG_FS_ENCRYPTION_ALGS=y # CONFIG_FS_VERITY is not set CONFIG_FSNOTIFY=y CONFIG_DNOTIFY=y @@ -5887,7 +5932,6 @@ CONFIG_OVERLAY_FS=m # CONFIG_OVERLAY_FS_REDIRECT_DIR is not set CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y # CONFIG_OVERLAY_FS_INDEX is not set -# CONFIG_OVERLAY_FS_XINO_AUTO is not set # CONFIG_OVERLAY_FS_METACOPY is not set # @@ -6000,6 +6044,7 @@ CONFIG_NFS_V4_SECURITY_LABEL=y CONFIG_ROOT_NFS=y # CONFIG_NFS_USE_LEGACY_DNS is not set CONFIG_NFS_USE_KERNEL_DNS=y +CONFIG_NFS_DISABLE_UDP_SUPPORT=y CONFIG_NFSD=m CONFIG_NFSD_V2_ACL=y CONFIG_NFSD_V3=y @@ -6009,6 +6054,7 @@ CONFIG_NFSD_PNFS=y CONFIG_NFSD_BLOCKLAYOUT=y CONFIG_NFSD_SCSILAYOUT=y CONFIG_NFSD_FLEXFILELAYOUT=y +# CONFIG_NFSD_V4_2_INTER_SSC is not set # CONFIG_NFSD_V4_SECURITY_LABEL is not set CONFIG_GRACE_PERIOD=y CONFIG_LOCKD=y @@ -6118,6 +6164,8 @@ CONFIG_SECURITY_SELINUX_BOOTPARAM=y CONFIG_SECURITY_SELINUX_DEVELOP=y CONFIG_SECURITY_SELINUX_AVC_STATS=y CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=0 +CONFIG_SECURITY_SELINUX_SIDTAB_HASH_BITS=9 +CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE=256 # CONFIG_SECURITY_SMACK is not set # CONFIG_SECURITY_TOMOYO is not set CONFIG_SECURITY_APPARMOR=y @@ -6601,7 +6649,9 @@ CONFIG_CONTEXT_SWITCH_TRACER=y CONFIG_TRACING=y CONFIG_TRACING_SUPPORT=y CONFIG_FTRACE=y +# CONFIG_BOOTTIME_TRACING is not set # CONFIG_FUNCTION_TRACER is not set +# CONFIG_STACK_TRACER is not set # CONFIG_PREEMPTIRQ_EVENTS is not set # CONFIG_IRQSOFF_TRACER is not set # CONFIG_PREEMPT_TRACER is not set @@ -6613,7 +6663,6 @@ CONFIG_FTRACE=y CONFIG_BRANCH_PROFILE_NONE=y # CONFIG_PROFILE_ANNOTATED_BRANCHES is not set # CONFIG_PROFILE_ALL_BRANCHES is not set -# CONFIG_STACK_TRACER is not set # CONFIG_BLK_DEV_IO_TRACE is not set CONFIG_UPROBE_EVENTS=y CONFIG_BPF_EVENTS=y @@ -6622,9 +6671,9 @@ CONFIG_PROBE_EVENTS=y # CONFIG_TRACE_EVENT_INJECT is not set # CONFIG_TRACEPOINT_BENCHMARK is not set # CONFIG_RING_BUFFER_BENCHMARK is not set +# CONFIG_TRACE_EVAL_MAP_FILE is not set # CONFIG_RING_BUFFER_STARTUP_TEST is not set # CONFIG_PREEMPTIRQ_DELAY_TEST is not set -# CONFIG_TRACE_EVAL_MAP_FILE is not set # CONFIG_SAMPLES is not set CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y # CONFIG_STRICT_DEVMEM is not set diff --git a/config/kernel/linux-odroidxu4-legacy.config b/config/kernel/linux-odroidxu4-legacy.config index da0734686b..642972ab66 100644 --- a/config/kernel/linux-odroidxu4-legacy.config +++ b/config/kernel/linux-odroidxu4-legacy.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 4.14.174 Kernel Configuration +# Linux/arm 4.14.175 Kernel Configuration # CONFIG_ARM=y CONFIG_ARM_HAS_SG_CHAIN=y @@ -2144,6 +2144,8 @@ CONFIG_RTL8822BU=m CONFIG_RTL8188EU=m # CONFIG_RTL8821CU is not set CONFIG_88XXAU=m +CONFIG_RTL8189FS=m +CONFIG_RTL8189ES=m CONFIG_WLAN_VENDOR_ZYDAS=y CONFIG_USB_ZD1201=m CONFIG_ZD1211RW=m diff --git a/config/sources/families/odroidxu4.conf b/config/sources/families/odroidxu4.conf index a5331b16e0..500ea663dc 100644 --- a/config/sources/families/odroidxu4.conf +++ b/config/sources/families/odroidxu4.conf @@ -25,7 +25,7 @@ case $BRANCH in ;; dev) - KERNELBRANCH='branch:linux-5.5.y' + KERNELBRANCH='branch:linux-5.6.y' ;; esac diff --git a/patch/kernel/odroidxu4-current/03-patch-5.4.28-29.patch b/patch/kernel/odroidxu4-current/03-patch-5.4.28-29.patch new file mode 100644 index 0000000000..6c1f8e36f8 --- /dev/null +++ b/patch/kernel/odroidxu4-current/03-patch-5.4.28-29.patch @@ -0,0 +1,5915 @@ +diff --git a/Documentation/devicetree/bindings/net/fsl-fman.txt b/Documentation/devicetree/bindings/net/fsl-fman.txt +index 299c0dcd67db..1316f0aec0cf 100644 +--- a/Documentation/devicetree/bindings/net/fsl-fman.txt ++++ b/Documentation/devicetree/bindings/net/fsl-fman.txt +@@ -110,6 +110,13 @@ PROPERTIES + Usage: required + Definition: See soc/fsl/qman.txt and soc/fsl/bman.txt + ++- fsl,erratum-a050385 ++ Usage: optional ++ Value type: boolean ++ Definition: A boolean property. Indicates the presence of the ++ erratum A050385 which indicates that DMA transactions that are ++ split can result in a FMan lock. ++ + ============================================================================= + FMan MURAM Node + +diff --git a/Makefile b/Makefile +index b015cc894123..8cb72071a842 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 28 ++SUBLEVEL = 29 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi +index 6481d2b7d6b6..c6be65249f42 100644 +--- a/arch/arm/boot/dts/dra7.dtsi ++++ b/arch/arm/boot/dts/dra7.dtsi +@@ -148,6 +148,7 @@ + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x0 0x0 0xc0000000>; ++ dma-ranges = <0x80000000 0x0 0x80000000 0x80000000>; + ti,hwmods = "l3_main_1", "l3_main_2"; + reg = <0x0 0x44000000 0x0 0x1000000>, + <0x0 0x45000000 0x0 0x1000>; +diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi +index 1fb7937638f0..041646fabb2d 100644 +--- a/arch/arm/boot/dts/omap5.dtsi ++++ b/arch/arm/boot/dts/omap5.dtsi +@@ -143,6 +143,7 @@ + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0 0 0xc0000000>; ++ dma-ranges = <0x80000000 0x0 0x80000000 0x80000000>; + ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3"; + reg = <0 0x44000000 0 0x2000>, + <0 0x44800000 0 0x3000>, +diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +index 3bec3e0a81b2..397140454132 100644 +--- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts ++++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +@@ -482,7 +482,8 @@ + }; + + &usbphy { +- usb0_id_det-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */ ++ usb0_id_det-gpios = <&pio 7 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH11 */ ++ usb0_vbus_power-supply = <&usb_power_supply>; + usb0_vbus-supply = <®_drivevbus>; + usb1_vbus-supply = <®_vmain>; + usb2_vbus-supply = <®_vmain>; +diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi +index 6082ae022136..d237162a8744 100644 +--- a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi ++++ b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi +@@ -20,6 +20,8 @@ + }; + + &fman0 { ++ fsl,erratum-a050385; ++ + /* these aliases provide the FMan ports mapping */ + enet0: ethernet@e0000 { + }; +diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c +index 2db3b7c4de16..a353f88d299d 100644 +--- a/arch/x86/mm/ioremap.c ++++ b/arch/x86/mm/ioremap.c +@@ -115,6 +115,9 @@ static void __ioremap_check_other(resource_size_t addr, struct ioremap_desc *des + if (!sev_active()) + return; + ++ if (!IS_ENABLED(CONFIG_EFI)) ++ return; ++ + if (efi_mem_type(addr) == EFI_RUNTIME_SERVICES_DATA) + desc->flags |= IORES_MAP_ENCRYPTED; + } +diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c +index 393d251798c0..4d2a7a764602 100644 +--- a/arch/x86/net/bpf_jit_comp32.c ++++ b/arch/x86/net/bpf_jit_comp32.c +@@ -2039,10 +2039,12 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, + } + /* and dreg_lo,sreg_lo */ + EMIT2(0x23, add_2reg(0xC0, sreg_lo, dreg_lo)); +- /* and dreg_hi,sreg_hi */ +- EMIT2(0x23, add_2reg(0xC0, sreg_hi, dreg_hi)); +- /* or dreg_lo,dreg_hi */ +- EMIT2(0x09, add_2reg(0xC0, dreg_lo, dreg_hi)); ++ if (is_jmp64) { ++ /* and dreg_hi,sreg_hi */ ++ EMIT2(0x23, add_2reg(0xC0, sreg_hi, dreg_hi)); ++ /* or dreg_lo,dreg_hi */ ++ EMIT2(0x09, add_2reg(0xC0, dreg_lo, dreg_hi)); ++ } + goto emit_cond_jmp; + } + case BPF_JMP | BPF_JSET | BPF_K: +diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c +index 827530dae682..ce59a3f32eac 100644 +--- a/drivers/acpi/sleep.c ++++ b/drivers/acpi/sleep.c +@@ -977,6 +977,16 @@ static int acpi_s2idle_prepare_late(void) + return 0; + } + ++static void acpi_s2idle_sync(void) ++{ ++ /* ++ * The EC driver uses the system workqueue and an additional special ++ * one, so those need to be flushed too. ++ */ ++ acpi_ec_flush_work(); ++ acpi_os_wait_events_complete(); /* synchronize Notify handling */ ++} ++ + static bool acpi_s2idle_wake(void) + { + if (!acpi_sci_irq_valid()) +@@ -1021,13 +1031,8 @@ static bool acpi_s2idle_wake(void) + * should be missed by canceling the wakeup here. + */ + pm_system_cancel_wakeup(); +- /* +- * The EC driver uses the system workqueue and an additional +- * special one, so those need to be flushed too. +- */ +- acpi_os_wait_events_complete(); /* synchronize EC GPE processing */ +- acpi_ec_flush_work(); +- acpi_os_wait_events_complete(); /* synchronize Notify handling */ ++ ++ acpi_s2idle_sync(); + + /* + * The SCI is in the "suspended" state now and it cannot produce +@@ -1055,6 +1060,13 @@ static void acpi_s2idle_restore_early(void) + + static void acpi_s2idle_restore(void) + { ++ /* ++ * Drain pending events before restoring the working-state configuration ++ * of GPEs. ++ */ ++ acpi_os_wait_events_complete(); /* synchronize GPE processing */ ++ acpi_s2idle_sync(); ++ + s2idle_wakeup = false; + + acpi_enable_all_runtime_gpes(); +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c +index 1787e3ad9c44..d33528033042 100644 +--- a/drivers/ata/ahci.c ++++ b/drivers/ata/ahci.c +@@ -393,6 +393,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { + { PCI_VDEVICE(INTEL, 0xa252), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0xa256), board_ahci }, /* Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0xa356), board_ahci }, /* Cannon Lake PCH-H RAID */ ++ { PCI_VDEVICE(INTEL, 0x06d7), board_ahci }, /* Comet Lake-H RAID */ + { PCI_VDEVICE(INTEL, 0x0f22), board_ahci_mobile }, /* Bay Trail AHCI */ + { PCI_VDEVICE(INTEL, 0x0f23), board_ahci_mobile }, /* Bay Trail AHCI */ + { PCI_VDEVICE(INTEL, 0x22a3), board_ahci_mobile }, /* Cherry Tr. AHCI */ +diff --git a/drivers/base/memory.c b/drivers/base/memory.c +index 84c4e1f72cbd..5a8c430fb8ff 100644 +--- a/drivers/base/memory.c ++++ b/drivers/base/memory.c +@@ -114,30 +114,13 @@ static ssize_t phys_index_show(struct device *dev, + } + + /* +- * Show whether the memory block is likely to be offlineable (or is already +- * offline). Once offline, the memory block could be removed. The return +- * value does, however, not indicate that there is a way to remove the +- * memory block. ++ * Legacy interface that we cannot remove. Always indicate "removable" ++ * with CONFIG_MEMORY_HOTREMOVE - bad heuristic. + */ + static ssize_t removable_show(struct device *dev, struct device_attribute *attr, + char *buf) + { +- struct memory_block *mem = to_memory_block(dev); +- unsigned long pfn; +- int ret = 1, i; +- +- if (mem->state != MEM_ONLINE) +- goto out; +- +- for (i = 0; i < sections_per_block; i++) { +- if (!present_section_nr(mem->start_section_nr + i)) +- continue; +- pfn = section_nr_to_pfn(mem->start_section_nr + i); +- ret &= is_mem_section_removable(pfn, PAGES_PER_SECTION); +- } +- +-out: +- return sprintf(buf, "%d\n", ret); ++ return sprintf(buf, "%d\n", (int)IS_ENABLED(CONFIG_MEMORY_HOTREMOVE)); + } + + /* +diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c +index 2317d4e3daaf..36933e2b3b0d 100644 +--- a/drivers/clocksource/hyperv_timer.c ++++ b/drivers/clocksource/hyperv_timer.c +@@ -233,7 +233,8 @@ static u64 notrace read_hv_clock_tsc(struct clocksource *arg) + + static u64 read_hv_sched_clock_tsc(void) + { +- return read_hv_clock_tsc(NULL) - hv_sched_clock_offset; ++ return (read_hv_clock_tsc(NULL) - hv_sched_clock_offset) * ++ (NSEC_PER_SEC / HV_CLOCK_HZ); + } + + static struct clocksource hyperv_cs_tsc = { +@@ -258,7 +259,8 @@ static u64 notrace read_hv_clock_msr(struct clocksource *arg) + + static u64 read_hv_sched_clock_msr(void) + { +- return read_hv_clock_msr(NULL) - hv_sched_clock_offset; ++ return (read_hv_clock_msr(NULL) - hv_sched_clock_offset) * ++ (NSEC_PER_SEC / HV_CLOCK_HZ); + } + + static struct clocksource hyperv_cs_msr = { +diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c +index 1f98e988c0d3..a3fb450a9ca8 100644 +--- a/drivers/gpio/gpiolib-acpi.c ++++ b/drivers/gpio/gpiolib-acpi.c +@@ -21,18 +21,21 @@ + #include "gpiolib.h" + #include "gpiolib-acpi.h" + +-#define QUIRK_NO_EDGE_EVENTS_ON_BOOT 0x01l +-#define QUIRK_NO_WAKEUP 0x02l +- + static int run_edge_events_on_boot = -1; + module_param(run_edge_events_on_boot, int, 0444); + MODULE_PARM_DESC(run_edge_events_on_boot, + "Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto"); + +-static int honor_wakeup = -1; +-module_param(honor_wakeup, int, 0444); +-MODULE_PARM_DESC(honor_wakeup, +- "Honor the ACPI wake-capable flag: 0=no, 1=yes, -1=auto"); ++static char *ignore_wake; ++module_param(ignore_wake, charp, 0444); ++MODULE_PARM_DESC(ignore_wake, ++ "controller@pin combos on which to ignore the ACPI wake flag " ++ "ignore_wake=controller@pin[,controller@pin[,...]]"); ++ ++struct acpi_gpiolib_dmi_quirk { ++ bool no_edge_events_on_boot; ++ char *ignore_wake; ++}; + + /** + * struct acpi_gpio_event - ACPI GPIO event handler data +@@ -202,6 +205,57 @@ static void acpi_gpiochip_request_irqs(struct acpi_gpio_chip *acpi_gpio) + acpi_gpiochip_request_irq(acpi_gpio, event); + } + ++static bool acpi_gpio_in_ignore_list(const char *controller_in, int pin_in) ++{ ++ const char *controller, *pin_str; ++ int len, pin; ++ char *endp; ++ ++ controller = ignore_wake; ++ while (controller) { ++ pin_str = strchr(controller, '@'); ++ if (!pin_str) ++ goto err; ++ ++ len = pin_str - controller; ++ if (len == strlen(controller_in) && ++ strncmp(controller, controller_in, len) == 0) { ++ pin = simple_strtoul(pin_str + 1, &endp, 10); ++ if (*endp != 0 && *endp != ',') ++ goto err; ++ ++ if (pin == pin_in) ++ return true; ++ } ++ ++ controller = strchr(controller, ','); ++ if (controller) ++ controller++; ++ } ++ ++ return false; ++err: ++ pr_err_once("Error invalid value for gpiolib_acpi.ignore_wake: %s\n", ++ ignore_wake); ++ return false; ++} ++ ++static bool acpi_gpio_irq_is_wake(struct device *parent, ++ struct acpi_resource_gpio *agpio) ++{ ++ int pin = agpio->pin_table[0]; ++ ++ if (agpio->wake_capable != ACPI_WAKE_CAPABLE) ++ return false; ++ ++ if (acpi_gpio_in_ignore_list(dev_name(parent), pin)) { ++ dev_info(parent, "Ignoring wakeup on pin %d\n", pin); ++ return false; ++ } ++ ++ return true; ++} ++ + static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares, + void *context) + { +@@ -282,7 +336,7 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares, + event->handle = evt_handle; + event->handler = handler; + event->irq = irq; +- event->irq_is_wake = honor_wakeup && agpio->wake_capable == ACPI_WAKE_CAPABLE; ++ event->irq_is_wake = acpi_gpio_irq_is_wake(chip->parent, agpio); + event->pin = pin; + event->desc = desc; + +@@ -1321,7 +1375,9 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] = { + DMI_MATCH(DMI_SYS_VENDOR, "MINIX"), + DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"), + }, +- .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT, ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) { ++ .no_edge_events_on_boot = true, ++ }, + }, + { + /* +@@ -1334,16 +1390,20 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] = { + DMI_MATCH(DMI_SYS_VENDOR, "Wortmann_AG"), + DMI_MATCH(DMI_PRODUCT_NAME, "TERRA_PAD_1061"), + }, +- .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT, ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) { ++ .no_edge_events_on_boot = true, ++ }, + }, + { + /* +- * Various HP X2 10 Cherry Trail models use an external +- * embedded-controller connected via I2C + an ACPI GPIO +- * event handler. The embedded controller generates various +- * spurious wakeup events when suspended. So disable wakeup +- * for its handler (it uses the only ACPI GPIO event handler). +- * This breaks wakeup when opening the lid, the user needs ++ * HP X2 10 models with Cherry Trail SoC + TI PMIC use an ++ * external embedded-controller connected via I2C + an ACPI GPIO ++ * event handler on INT33FF:01 pin 0, causing spurious wakeups. ++ * When suspending by closing the LID, the power to the USB ++ * keyboard is turned off, causing INT0002 ACPI events to ++ * trigger once the XHCI controller notices the keyboard is ++ * gone. So INT0002 events cause spurious wakeups too. Ignoring ++ * EC wakes breaks wakeup when opening the lid, the user needs + * to press the power-button to wakeup the system. The + * alternative is suspend simply not working, which is worse. + */ +@@ -1351,33 +1411,46 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP x2 Detachable 10-p0XX"), + }, +- .driver_data = (void *)QUIRK_NO_WAKEUP, ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) { ++ .ignore_wake = "INT33FF:01@0,INT0002:00@2", ++ }, ++ }, ++ { ++ /* ++ * HP X2 10 models with Bay Trail SoC + AXP288 PMIC use an ++ * external embedded-controller connected via I2C + an ACPI GPIO ++ * event handler on INT33FC:02 pin 28, causing spurious wakeups. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"), ++ DMI_MATCH(DMI_BOARD_NAME, "815D"), ++ }, ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) { ++ .ignore_wake = "INT33FC:02@28", ++ }, + }, + {} /* Terminating entry */ + }; + + static int acpi_gpio_setup_params(void) + { ++ const struct acpi_gpiolib_dmi_quirk *quirk = NULL; + const struct dmi_system_id *id; +- long quirks = 0; + + id = dmi_first_match(gpiolib_acpi_quirks); + if (id) +- quirks = (long)id->driver_data; ++ quirk = id->driver_data; + + if (run_edge_events_on_boot < 0) { +- if (quirks & QUIRK_NO_EDGE_EVENTS_ON_BOOT) ++ if (quirk && quirk->no_edge_events_on_boot) + run_edge_events_on_boot = 0; + else + run_edge_events_on_boot = 1; + } + +- if (honor_wakeup < 0) { +- if (quirks & QUIRK_NO_WAKEUP) +- honor_wakeup = 0; +- else +- honor_wakeup = 1; +- } ++ if (ignore_wake == NULL && quirk && quirk->ignore_wake) ++ ignore_wake = quirk->ignore_wake; + + return 0; + } +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c +index 484fa6560adc..a8cf55eb54d8 100644 +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -2194,9 +2194,16 @@ static void gpiochip_irq_disable(struct irq_data *d) + { + struct gpio_chip *chip = irq_data_get_irq_chip_data(d); + ++ /* ++ * Since we override .irq_disable() we need to mimic the ++ * behaviour of __irq_disable() in irq/chip.c. ++ * First call .irq_disable() if it exists, else mimic the ++ * behaviour of mask_irq() which calls .irq_mask() if ++ * it exists. ++ */ + if (chip->irq.irq_disable) + chip->irq.irq_disable(d); +- else ++ else if (chip->irq.chip->irq_mask) + chip->irq.chip->irq_mask(d); + gpiochip_disable_irq(chip, d->hwirq); + } +diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c +index 80934ca17260..c086262cc181 100644 +--- a/drivers/gpu/drm/amd/amdgpu/soc15.c ++++ b/drivers/gpu/drm/amd/amdgpu/soc15.c +@@ -84,6 +84,13 @@ + #define HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK 0x00010000L + #define HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK 0x00020000L + #define mmHDP_MEM_POWER_CTRL_BASE_IDX 0 ++ ++/* for Vega20/arcturus regiter offset change */ ++#define mmROM_INDEX_VG20 0x00e4 ++#define mmROM_INDEX_VG20_BASE_IDX 0 ++#define mmROM_DATA_VG20 0x00e5 ++#define mmROM_DATA_VG20_BASE_IDX 0 ++ + /* + * Indirect registers accessor + */ +@@ -304,6 +311,8 @@ static bool soc15_read_bios_from_rom(struct amdgpu_device *adev, + { + u32 *dw_ptr; + u32 i, length_dw; ++ uint32_t rom_index_offset; ++ uint32_t rom_data_offset; + + if (bios == NULL) + return false; +@@ -316,11 +325,23 @@ static bool soc15_read_bios_from_rom(struct amdgpu_device *adev, + dw_ptr = (u32 *)bios; + length_dw = ALIGN(length_bytes, 4) / 4; + ++ switch (adev->asic_type) { ++ case CHIP_VEGA20: ++ case CHIP_ARCTURUS: ++ rom_index_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX_VG20); ++ rom_data_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA_VG20); ++ break; ++ default: ++ rom_index_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX); ++ rom_data_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA); ++ break; ++ } ++ + /* set rom index to 0 */ +- WREG32(SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX), 0); ++ WREG32(rom_index_offset, 0); + /* read out the rom data */ + for (i = 0; i < length_dw; i++) +- dw_ptr[i] = RREG32(SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA)); ++ dw_ptr[i] = RREG32(rom_data_offset); + + return true; + } +diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +index 3b7769a3e67e..c13dce760098 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +@@ -269,6 +269,117 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_0_soc = { + .use_urgent_burst_bw = 0 + }; + ++struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv14_soc = { ++ .clock_limits = { ++ { ++ .state = 0, ++ .dcfclk_mhz = 560.0, ++ .fabricclk_mhz = 560.0, ++ .dispclk_mhz = 513.0, ++ .dppclk_mhz = 513.0, ++ .phyclk_mhz = 540.0, ++ .socclk_mhz = 560.0, ++ .dscclk_mhz = 171.0, ++ .dram_speed_mts = 8960.0, ++ }, ++ { ++ .state = 1, ++ .dcfclk_mhz = 694.0, ++ .fabricclk_mhz = 694.0, ++ .dispclk_mhz = 642.0, ++ .dppclk_mhz = 642.0, ++ .phyclk_mhz = 600.0, ++ .socclk_mhz = 694.0, ++ .dscclk_mhz = 214.0, ++ .dram_speed_mts = 11104.0, ++ }, ++ { ++ .state = 2, ++ .dcfclk_mhz = 875.0, ++ .fabricclk_mhz = 875.0, ++ .dispclk_mhz = 734.0, ++ .dppclk_mhz = 734.0, ++ .phyclk_mhz = 810.0, ++ .socclk_mhz = 875.0, ++ .dscclk_mhz = 245.0, ++ .dram_speed_mts = 14000.0, ++ }, ++ { ++ .state = 3, ++ .dcfclk_mhz = 1000.0, ++ .fabricclk_mhz = 1000.0, ++ .dispclk_mhz = 1100.0, ++ .dppclk_mhz = 1100.0, ++ .phyclk_mhz = 810.0, ++ .socclk_mhz = 1000.0, ++ .dscclk_mhz = 367.0, ++ .dram_speed_mts = 16000.0, ++ }, ++ { ++ .state = 4, ++ .dcfclk_mhz = 1200.0, ++ .fabricclk_mhz = 1200.0, ++ .dispclk_mhz = 1284.0, ++ .dppclk_mhz = 1284.0, ++ .phyclk_mhz = 810.0, ++ .socclk_mhz = 1200.0, ++ .dscclk_mhz = 428.0, ++ .dram_speed_mts = 16000.0, ++ }, ++ /*Extra state, no dispclk ramping*/ ++ { ++ .state = 5, ++ .dcfclk_mhz = 1200.0, ++ .fabricclk_mhz = 1200.0, ++ .dispclk_mhz = 1284.0, ++ .dppclk_mhz = 1284.0, ++ .phyclk_mhz = 810.0, ++ .socclk_mhz = 1200.0, ++ .dscclk_mhz = 428.0, ++ .dram_speed_mts = 16000.0, ++ }, ++ }, ++ .num_states = 5, ++ .sr_exit_time_us = 8.6, ++ .sr_enter_plus_exit_time_us = 10.9, ++ .urgent_latency_us = 4.0, ++ .urgent_latency_pixel_data_only_us = 4.0, ++ .urgent_latency_pixel_mixed_with_vm_data_us = 4.0, ++ .urgent_latency_vm_data_only_us = 4.0, ++ .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096, ++ .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096, ++ .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096, ++ .pct_ideal_dram_sdp_bw_after_urgent_pixel_only = 40.0, ++ .pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm = 40.0, ++ .pct_ideal_dram_sdp_bw_after_urgent_vm_only = 40.0, ++ .max_avg_sdp_bw_use_normal_percent = 40.0, ++ .max_avg_dram_bw_use_normal_percent = 40.0, ++ .writeback_latency_us = 12.0, ++ .ideal_dram_bw_after_urgent_percent = 40.0, ++ .max_request_size_bytes = 256, ++ .dram_channel_width_bytes = 2, ++ .fabric_datapath_to_dcn_data_return_bytes = 64, ++ .dcn_downspread_percent = 0.5, ++ .downspread_percent = 0.38, ++ .dram_page_open_time_ns = 50.0, ++ .dram_rw_turnaround_time_ns = 17.5, ++ .dram_return_buffer_per_channel_bytes = 8192, ++ .round_trip_ping_latency_dcfclk_cycles = 131, ++ .urgent_out_of_order_return_per_channel_bytes = 256, ++ .channel_interleave_bytes = 256, ++ .num_banks = 8, ++ .num_chans = 8, ++ .vmm_page_size_bytes = 4096, ++ .dram_clock_change_latency_us = 404.0, ++ .dummy_pstate_latency_us = 5.0, ++ .writeback_dram_clock_change_latency_us = 23.0, ++ .return_bus_width_bytes = 64, ++ .dispclk_dppclk_vco_speed_mhz = 3850, ++ .xfc_bus_transport_time_us = 20, ++ .xfc_xbuf_latency_tolerance_us = 4, ++ .use_urgent_burst_bw = 0 ++}; ++ + struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv12_soc = { 0 }; + + #ifndef mmDP0_DP_DPHY_INTERNAL_CTRL +@@ -3135,6 +3246,9 @@ static void patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_s + static struct _vcs_dpi_soc_bounding_box_st *get_asic_rev_soc_bb( + uint32_t hw_internal_rev) + { ++ if (ASICREV_IS_NAVI14_M(hw_internal_rev)) ++ return &dcn2_0_nv14_soc; ++ + if (ASICREV_IS_NAVI12_P(hw_internal_rev)) + return &dcn2_0_nv12_soc; + +diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +index 2d5cbfda3ca7..9c262daf5816 100644 +--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c ++++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +@@ -55,6 +55,7 @@ static const char * const decon_clks_name[] = { + struct decon_context { + struct device *dev; + struct drm_device *drm_dev; ++ void *dma_priv; + struct exynos_drm_crtc *crtc; + struct exynos_drm_plane planes[WINDOWS_NR]; + struct exynos_drm_plane_config configs[WINDOWS_NR]; +@@ -644,7 +645,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data) + + decon_clear_channels(ctx->crtc); + +- return exynos_drm_register_dma(drm_dev, dev); ++ return exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv); + } + + static void decon_unbind(struct device *dev, struct device *master, void *data) +@@ -654,7 +655,7 @@ static void decon_unbind(struct device *dev, struct device *master, void *data) + decon_disable(ctx->crtc); + + /* detach this sub driver from iommu mapping if supported. */ +- exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev); ++ exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, &ctx->dma_priv); + } + + static const struct component_ops decon_component_ops = { +diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c +index f0640950bd46..6fd40410dfd2 100644 +--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c ++++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c +@@ -40,6 +40,7 @@ + struct decon_context { + struct device *dev; + struct drm_device *drm_dev; ++ void *dma_priv; + struct exynos_drm_crtc *crtc; + struct exynos_drm_plane planes[WINDOWS_NR]; + struct exynos_drm_plane_config configs[WINDOWS_NR]; +@@ -127,13 +128,13 @@ static int decon_ctx_initialize(struct decon_context *ctx, + + decon_clear_channels(ctx->crtc); + +- return exynos_drm_register_dma(drm_dev, ctx->dev); ++ return exynos_drm_register_dma(drm_dev, ctx->dev, &ctx->dma_priv); + } + + static void decon_ctx_remove(struct decon_context *ctx) + { + /* detach this sub driver from iommu mapping if supported. */ +- exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev); ++ exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, &ctx->dma_priv); + } + + static u32 decon_calc_clkdiv(struct decon_context *ctx, +diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c +index 9ebc02768847..619f81435c1b 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_dma.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c +@@ -58,7 +58,7 @@ static inline void clear_dma_max_seg_size(struct device *dev) + * mapping. + */ + static int drm_iommu_attach_device(struct drm_device *drm_dev, +- struct device *subdrv_dev) ++ struct device *subdrv_dev, void **dma_priv) + { + struct exynos_drm_private *priv = drm_dev->dev_private; + int ret; +@@ -74,7 +74,14 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev, + return ret; + + if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) { +- if (to_dma_iommu_mapping(subdrv_dev)) ++ /* ++ * Keep the original DMA mapping of the sub-device and ++ * restore it on Exynos DRM detach, otherwise the DMA ++ * framework considers it as IOMMU-less during the next ++ * probe (in case of deferred probe or modular build) ++ */ ++ *dma_priv = to_dma_iommu_mapping(subdrv_dev); ++ if (*dma_priv) + arm_iommu_detach_device(subdrv_dev); + + ret = arm_iommu_attach_device(subdrv_dev, priv->mapping); +@@ -98,19 +105,21 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev, + * mapping + */ + static void drm_iommu_detach_device(struct drm_device *drm_dev, +- struct device *subdrv_dev) ++ struct device *subdrv_dev, void **dma_priv) + { + struct exynos_drm_private *priv = drm_dev->dev_private; + +- if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) ++ if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) { + arm_iommu_detach_device(subdrv_dev); +- else if (IS_ENABLED(CONFIG_IOMMU_DMA)) ++ arm_iommu_attach_device(subdrv_dev, *dma_priv); ++ } else if (IS_ENABLED(CONFIG_IOMMU_DMA)) + iommu_detach_device(priv->mapping, subdrv_dev); + + clear_dma_max_seg_size(subdrv_dev); + } + +-int exynos_drm_register_dma(struct drm_device *drm, struct device *dev) ++int exynos_drm_register_dma(struct drm_device *drm, struct device *dev, ++ void **dma_priv) + { + struct exynos_drm_private *priv = drm->dev_private; + +@@ -137,13 +146,14 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev) + priv->mapping = mapping; + } + +- return drm_iommu_attach_device(drm, dev); ++ return drm_iommu_attach_device(drm, dev, dma_priv); + } + +-void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev) ++void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev, ++ void **dma_priv) + { + if (IS_ENABLED(CONFIG_EXYNOS_IOMMU)) +- drm_iommu_detach_device(drm, dev); ++ drm_iommu_detach_device(drm, dev, dma_priv); + } + + void exynos_drm_cleanup_dma(struct drm_device *drm) +diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h +index d4014ba592fd..735f436c857c 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h ++++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h +@@ -223,8 +223,10 @@ static inline bool is_drm_iommu_supported(struct drm_device *drm_dev) + return priv->mapping ? true : false; + } + +-int exynos_drm_register_dma(struct drm_device *drm, struct device *dev); +-void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev); ++int exynos_drm_register_dma(struct drm_device *drm, struct device *dev, ++ void **dma_priv); ++void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev, ++ void **dma_priv); + void exynos_drm_cleanup_dma(struct drm_device *drm); + + #ifdef CONFIG_DRM_EXYNOS_DPI +diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c +index 8ea2e1d77802..29ab8be8604c 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c +@@ -97,6 +97,7 @@ struct fimc_scaler { + struct fimc_context { + struct exynos_drm_ipp ipp; + struct drm_device *drm_dev; ++ void *dma_priv; + struct device *dev; + struct exynos_drm_ipp_task *task; + struct exynos_drm_ipp_formats *formats; +@@ -1133,7 +1134,7 @@ static int fimc_bind(struct device *dev, struct device *master, void *data) + + ctx->drm_dev = drm_dev; + ipp->drm_dev = drm_dev; +- exynos_drm_register_dma(drm_dev, dev); ++ exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv); + + exynos_drm_ipp_register(dev, ipp, &ipp_funcs, + DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE | +@@ -1153,7 +1154,7 @@ static void fimc_unbind(struct device *dev, struct device *master, + struct exynos_drm_ipp *ipp = &ctx->ipp; + + exynos_drm_ipp_unregister(dev, ipp); +- exynos_drm_unregister_dma(drm_dev, dev); ++ exynos_drm_unregister_dma(drm_dev, dev, &ctx->dma_priv); + } + + static const struct component_ops fimc_component_ops = { +diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c +index 8d0a929104e5..34e6b22173fa 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c +@@ -167,6 +167,7 @@ static struct fimd_driver_data exynos5420_fimd_driver_data = { + struct fimd_context { + struct device *dev; + struct drm_device *drm_dev; ++ void *dma_priv; + struct exynos_drm_crtc *crtc; + struct exynos_drm_plane planes[WINDOWS_NR]; + struct exynos_drm_plane_config configs[WINDOWS_NR]; +@@ -1090,7 +1091,7 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) + if (is_drm_iommu_supported(drm_dev)) + fimd_clear_channels(ctx->crtc); + +- return exynos_drm_register_dma(drm_dev, dev); ++ return exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv); + } + + static void fimd_unbind(struct device *dev, struct device *master, +@@ -1100,7 +1101,7 @@ static void fimd_unbind(struct device *dev, struct device *master, + + fimd_disable(ctx->crtc); + +- exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev); ++ exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, &ctx->dma_priv); + + if (ctx->encoder) + exynos_dpi_remove(ctx->encoder); +diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c +index 2a3382d43bc9..fcee33a43aca 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c +@@ -232,6 +232,7 @@ struct g2d_runqueue_node { + + struct g2d_data { + struct device *dev; ++ void *dma_priv; + struct clk *gate_clk; + void __iomem *regs; + int irq; +@@ -1409,7 +1410,7 @@ static int g2d_bind(struct device *dev, struct device *master, void *data) + return ret; + } + +- ret = exynos_drm_register_dma(drm_dev, dev); ++ ret = exynos_drm_register_dma(drm_dev, dev, &g2d->dma_priv); + if (ret < 0) { + dev_err(dev, "failed to enable iommu.\n"); + g2d_fini_cmdlist(g2d); +@@ -1434,7 +1435,7 @@ static void g2d_unbind(struct device *dev, struct device *master, void *data) + priv->g2d_dev = NULL; + + cancel_work_sync(&g2d->runqueue_work); +- exynos_drm_unregister_dma(g2d->drm_dev, dev); ++ exynos_drm_unregister_dma(g2d->drm_dev, dev, &g2d->dma_priv); + } + + static const struct component_ops g2d_component_ops = { +diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c +index 88b6fcaa20be..45e9aee8366a 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c +@@ -97,6 +97,7 @@ struct gsc_scaler { + struct gsc_context { + struct exynos_drm_ipp ipp; + struct drm_device *drm_dev; ++ void *dma_priv; + struct device *dev; + struct exynos_drm_ipp_task *task; + struct exynos_drm_ipp_formats *formats; +@@ -1169,7 +1170,7 @@ static int gsc_bind(struct device *dev, struct device *master, void *data) + + ctx->drm_dev = drm_dev; + ctx->drm_dev = drm_dev; +- exynos_drm_register_dma(drm_dev, dev); ++ exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv); + + exynos_drm_ipp_register(dev, ipp, &ipp_funcs, + DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE | +@@ -1189,7 +1190,7 @@ static void gsc_unbind(struct device *dev, struct device *master, + struct exynos_drm_ipp *ipp = &ctx->ipp; + + exynos_drm_ipp_unregister(dev, ipp); +- exynos_drm_unregister_dma(drm_dev, dev); ++ exynos_drm_unregister_dma(drm_dev, dev, &ctx->dma_priv); + } + + static const struct component_ops gsc_component_ops = { +diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c +index b98482990d1a..dafa87b82052 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c +@@ -56,6 +56,7 @@ struct rot_variant { + struct rot_context { + struct exynos_drm_ipp ipp; + struct drm_device *drm_dev; ++ void *dma_priv; + struct device *dev; + void __iomem *regs; + struct clk *clock; +@@ -243,7 +244,7 @@ static int rotator_bind(struct device *dev, struct device *master, void *data) + + rot->drm_dev = drm_dev; + ipp->drm_dev = drm_dev; +- exynos_drm_register_dma(drm_dev, dev); ++ exynos_drm_register_dma(drm_dev, dev, &rot->dma_priv); + + exynos_drm_ipp_register(dev, ipp, &ipp_funcs, + DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE, +@@ -261,7 +262,7 @@ static void rotator_unbind(struct device *dev, struct device *master, + struct exynos_drm_ipp *ipp = &rot->ipp; + + exynos_drm_ipp_unregister(dev, ipp); +- exynos_drm_unregister_dma(rot->drm_dev, rot->dev); ++ exynos_drm_unregister_dma(rot->drm_dev, rot->dev, &rot->dma_priv); + } + + static const struct component_ops rotator_component_ops = { +diff --git a/drivers/gpu/drm/exynos/exynos_drm_scaler.c b/drivers/gpu/drm/exynos/exynos_drm_scaler.c +index 497973e9b2c5..93c43c8d914e 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_scaler.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_scaler.c +@@ -39,6 +39,7 @@ struct scaler_data { + struct scaler_context { + struct exynos_drm_ipp ipp; + struct drm_device *drm_dev; ++ void *dma_priv; + struct device *dev; + void __iomem *regs; + struct clk *clock[SCALER_MAX_CLK]; +@@ -450,7 +451,7 @@ static int scaler_bind(struct device *dev, struct device *master, void *data) + + scaler->drm_dev = drm_dev; + ipp->drm_dev = drm_dev; +- exynos_drm_register_dma(drm_dev, dev); ++ exynos_drm_register_dma(drm_dev, dev, &scaler->dma_priv); + + exynos_drm_ipp_register(dev, ipp, &ipp_funcs, + DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE | +@@ -470,7 +471,8 @@ static void scaler_unbind(struct device *dev, struct device *master, + struct exynos_drm_ipp *ipp = &scaler->ipp; + + exynos_drm_ipp_unregister(dev, ipp); +- exynos_drm_unregister_dma(scaler->drm_dev, scaler->dev); ++ exynos_drm_unregister_dma(scaler->drm_dev, scaler->dev, ++ &scaler->dma_priv); + } + + static const struct component_ops scaler_component_ops = { +diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c +index 7b24338fad3c..22f494145411 100644 +--- a/drivers/gpu/drm/exynos/exynos_mixer.c ++++ b/drivers/gpu/drm/exynos/exynos_mixer.c +@@ -94,6 +94,7 @@ struct mixer_context { + struct platform_device *pdev; + struct device *dev; + struct drm_device *drm_dev; ++ void *dma_priv; + struct exynos_drm_crtc *crtc; + struct exynos_drm_plane planes[MIXER_WIN_NR]; + unsigned long flags; +@@ -894,12 +895,14 @@ static int mixer_initialize(struct mixer_context *mixer_ctx, + } + } + +- return exynos_drm_register_dma(drm_dev, mixer_ctx->dev); ++ return exynos_drm_register_dma(drm_dev, mixer_ctx->dev, ++ &mixer_ctx->dma_priv); + } + + static void mixer_ctx_remove(struct mixer_context *mixer_ctx) + { +- exynos_drm_unregister_dma(mixer_ctx->drm_dev, mixer_ctx->dev); ++ exynos_drm_unregister_dma(mixer_ctx->drm_dev, mixer_ctx->dev, ++ &mixer_ctx->dma_priv); + } + + static int mixer_enable_vblank(struct exynos_drm_crtc *crtc) +diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c +index 8497c7a95dd4..224f830f77f9 100644 +--- a/drivers/i2c/busses/i2c-hix5hd2.c ++++ b/drivers/i2c/busses/i2c-hix5hd2.c +@@ -477,6 +477,7 @@ static int hix5hd2_i2c_remove(struct platform_device *pdev) + i2c_del_adapter(&priv->adap); + pm_runtime_disable(priv->dev); + pm_runtime_set_suspended(priv->dev); ++ clk_disable_unprepare(priv->clk); + + return 0; + } +diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c +index 5a1235fd86bb..32cd62188a3d 100644 +--- a/drivers/i2c/busses/i2c-nvidia-gpu.c ++++ b/drivers/i2c/busses/i2c-nvidia-gpu.c +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -75,20 +76,15 @@ static void gpu_enable_i2c_bus(struct gpu_i2c_dev *i2cd) + + static int gpu_i2c_check_status(struct gpu_i2c_dev *i2cd) + { +- unsigned long target = jiffies + msecs_to_jiffies(1000); + u32 val; ++ int ret; + +- do { +- val = readl(i2cd->regs + I2C_MST_CNTL); +- if (!(val & I2C_MST_CNTL_CYCLE_TRIGGER)) +- break; +- if ((val & I2C_MST_CNTL_STATUS) != +- I2C_MST_CNTL_STATUS_BUS_BUSY) +- break; +- usleep_range(500, 600); +- } while (time_is_after_jiffies(target)); +- +- if (time_is_before_jiffies(target)) { ++ ret = readl_poll_timeout(i2cd->regs + I2C_MST_CNTL, val, ++ !(val & I2C_MST_CNTL_CYCLE_TRIGGER) || ++ (val & I2C_MST_CNTL_STATUS) != I2C_MST_CNTL_STATUS_BUS_BUSY, ++ 500, 1000 * USEC_PER_MSEC); ++ ++ if (ret) { + dev_err(i2cd->dev, "i2c timeout error %x\n", val); + return -ETIMEDOUT; + } +diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c +index 2a770b8dca00..10ae6c6eab0a 100644 +--- a/drivers/infiniband/core/device.c ++++ b/drivers/infiniband/core/device.c +@@ -899,7 +899,9 @@ static int add_one_compat_dev(struct ib_device *device, + cdev->dev.parent = device->dev.parent; + rdma_init_coredev(cdev, device, read_pnet(&rnet->net)); + cdev->dev.release = compatdev_release; +- dev_set_name(&cdev->dev, "%s", dev_name(&device->dev)); ++ ret = dev_set_name(&cdev->dev, "%s", dev_name(&device->dev)); ++ if (ret) ++ goto add_err; + + ret = device_add(&cdev->dev); + if (ret) +diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c +index ad4301ecfa59..ef4b0c7061e4 100644 +--- a/drivers/infiniband/core/nldev.c ++++ b/drivers/infiniband/core/nldev.c +@@ -863,6 +863,10 @@ static int nldev_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh, + + nla_strlcpy(name, tb[RDMA_NLDEV_ATTR_DEV_NAME], + IB_DEVICE_NAME_MAX); ++ if (strlen(name) == 0) { ++ err = -EINVAL; ++ goto done; ++ } + err = ib_device_rename(device, name); + goto done; + } +@@ -1468,7 +1472,7 @@ static int nldev_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, + + nla_strlcpy(ibdev_name, tb[RDMA_NLDEV_ATTR_DEV_NAME], + sizeof(ibdev_name)); +- if (strchr(ibdev_name, '%')) ++ if (strchr(ibdev_name, '%') || strlen(ibdev_name) == 0) + return -EINVAL; + + nla_strlcpy(type, tb[RDMA_NLDEV_ATTR_LINK_TYPE], sizeof(type)); +diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c +index 2d5608315dc8..75e7ec017836 100644 +--- a/drivers/infiniband/core/security.c ++++ b/drivers/infiniband/core/security.c +@@ -349,16 +349,11 @@ static struct ib_ports_pkeys *get_new_pps(const struct ib_qp *qp, + else if (qp_pps) + new_pps->main.pkey_index = qp_pps->main.pkey_index; + +- if ((qp_attr_mask & IB_QP_PKEY_INDEX) && (qp_attr_mask & IB_QP_PORT)) ++ if (((qp_attr_mask & IB_QP_PKEY_INDEX) && ++ (qp_attr_mask & IB_QP_PORT)) || ++ (qp_pps && qp_pps->main.state != IB_PORT_PKEY_NOT_VALID)) + new_pps->main.state = IB_PORT_PKEY_VALID; + +- if (!(qp_attr_mask & (IB_QP_PKEY_INDEX | IB_QP_PORT)) && qp_pps) { +- new_pps->main.port_num = qp_pps->main.port_num; +- new_pps->main.pkey_index = qp_pps->main.pkey_index; +- if (qp_pps->main.state != IB_PORT_PKEY_NOT_VALID) +- new_pps->main.state = IB_PORT_PKEY_VALID; +- } +- + if (qp_attr_mask & IB_QP_ALT_PATH) { + new_pps->alt.port_num = qp_attr->alt_port_num; + new_pps->alt.pkey_index = qp_attr->alt_pkey_index; +diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c +index 1235ffb2389b..da229eab5903 100644 +--- a/drivers/infiniband/core/user_mad.c ++++ b/drivers/infiniband/core/user_mad.c +@@ -1129,17 +1129,30 @@ static const struct file_operations umad_sm_fops = { + .llseek = no_llseek, + }; + ++static struct ib_umad_port *get_port(struct ib_device *ibdev, ++ struct ib_umad_device *umad_dev, ++ unsigned int port) ++{ ++ if (!umad_dev) ++ return ERR_PTR(-EOPNOTSUPP); ++ if (!rdma_is_port_valid(ibdev, port)) ++ return ERR_PTR(-EINVAL); ++ if (!rdma_cap_ib_mad(ibdev, port)) ++ return ERR_PTR(-EOPNOTSUPP); ++ ++ return &umad_dev->ports[port - rdma_start_port(ibdev)]; ++} ++ + static int ib_umad_get_nl_info(struct ib_device *ibdev, void *client_data, + struct ib_client_nl_info *res) + { +- struct ib_umad_device *umad_dev = client_data; ++ struct ib_umad_port *port = get_port(ibdev, client_data, res->port); + +- if (!rdma_is_port_valid(ibdev, res->port)) +- return -EINVAL; ++ if (IS_ERR(port)) ++ return PTR_ERR(port); + + res->abi = IB_USER_MAD_ABI_VERSION; +- res->cdev = &umad_dev->ports[res->port - rdma_start_port(ibdev)].dev; +- ++ res->cdev = &port->dev; + return 0; + } + +@@ -1154,15 +1167,13 @@ MODULE_ALIAS_RDMA_CLIENT("umad"); + static int ib_issm_get_nl_info(struct ib_device *ibdev, void *client_data, + struct ib_client_nl_info *res) + { +- struct ib_umad_device *umad_dev = +- ib_get_client_data(ibdev, &umad_client); ++ struct ib_umad_port *port = get_port(ibdev, client_data, res->port); + +- if (!rdma_is_port_valid(ibdev, res->port)) +- return -EINVAL; ++ if (IS_ERR(port)) ++ return PTR_ERR(port); + + res->abi = IB_USER_MAD_ABI_VERSION; +- res->cdev = &umad_dev->ports[res->port - rdma_start_port(ibdev)].sm_dev; +- ++ res->cdev = &port->sm_dev; + return 0; + } + +diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c +index 45f48cde6b9d..ff664355de55 100644 +--- a/drivers/infiniband/hw/mlx5/cq.c ++++ b/drivers/infiniband/hw/mlx5/cq.c +@@ -330,6 +330,22 @@ static void mlx5_handle_error_cqe(struct mlx5_ib_dev *dev, + dump_cqe(dev, cqe); + } + ++static void handle_atomics(struct mlx5_ib_qp *qp, struct mlx5_cqe64 *cqe64, ++ u16 tail, u16 head) ++{ ++ u16 idx; ++ ++ do { ++ idx = tail & (qp->sq.wqe_cnt - 1); ++ if (idx == head) ++ break; ++ ++ tail = qp->sq.w_list[idx].next; ++ } while (1); ++ tail = qp->sq.w_list[idx].next; ++ qp->sq.last_poll = tail; ++} ++ + static void free_cq_buf(struct mlx5_ib_dev *dev, struct mlx5_ib_cq_buf *buf) + { + mlx5_frag_buf_free(dev->mdev, &buf->frag_buf); +@@ -368,7 +384,7 @@ static void get_sig_err_item(struct mlx5_sig_err_cqe *cqe, + } + + static void sw_comp(struct mlx5_ib_qp *qp, int num_entries, struct ib_wc *wc, +- int *npolled, int is_send) ++ int *npolled, bool is_send) + { + struct mlx5_ib_wq *wq; + unsigned int cur; +@@ -383,10 +399,16 @@ static void sw_comp(struct mlx5_ib_qp *qp, int num_entries, struct ib_wc *wc, + return; + + for (i = 0; i < cur && np < num_entries; i++) { +- wc->wr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)]; ++ unsigned int idx; ++ ++ idx = (is_send) ? wq->last_poll : wq->tail; ++ idx &= (wq->wqe_cnt - 1); ++ wc->wr_id = wq->wrid[idx]; + wc->status = IB_WC_WR_FLUSH_ERR; + wc->vendor_err = MLX5_CQE_SYNDROME_WR_FLUSH_ERR; + wq->tail++; ++ if (is_send) ++ wq->last_poll = wq->w_list[idx].next; + np++; + wc->qp = &qp->ibqp; + wc++; +@@ -476,6 +498,7 @@ repoll: + wqe_ctr = be16_to_cpu(cqe64->wqe_counter); + idx = wqe_ctr & (wq->wqe_cnt - 1); + handle_good_req(wc, cqe64, wq, idx); ++ handle_atomics(*cur_qp, cqe64, wq->last_poll, idx); + wc->wr_id = wq->wrid[idx]; + wq->tail = wq->wqe_head[idx] + 1; + wc->status = IB_WC_SUCCESS; +diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c +index 9a918db9e8db..0a160fd1383a 100644 +--- a/drivers/infiniband/hw/mlx5/main.c ++++ b/drivers/infiniband/hw/mlx5/main.c +@@ -5638,9 +5638,10 @@ mlx5_ib_counter_alloc_stats(struct rdma_counter *counter) + const struct mlx5_ib_counters *cnts = + get_counters(dev, counter->port - 1); + +- /* Q counters are in the beginning of all counters */ + return rdma_alloc_hw_stats_struct(cnts->names, +- cnts->num_q_counters, ++ cnts->num_q_counters + ++ cnts->num_cong_counters + ++ cnts->num_ext_ppcnt_counters, + RDMA_HW_STATS_DEFAULT_LIFESPAN); + } + +diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h +index 1a98ee2e01c4..a9ce46c4c1ae 100644 +--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h ++++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h +@@ -283,6 +283,7 @@ struct mlx5_ib_wq { + unsigned head; + unsigned tail; + u16 cur_post; ++ u16 last_poll; + void *cur_edge; + }; + +diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c +index 0865373bd12d..881decb1309a 100644 +--- a/drivers/infiniband/hw/mlx5/qp.c ++++ b/drivers/infiniband/hw/mlx5/qp.c +@@ -3725,6 +3725,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, + qp->sq.cur_post = 0; + if (qp->sq.wqe_cnt) + qp->sq.cur_edge = get_sq_edge(&qp->sq, 0); ++ qp->sq.last_poll = 0; + qp->db.db[MLX5_RCV_DBR] = 0; + qp->db.db[MLX5_SND_DBR] = 0; + } +@@ -6131,6 +6132,10 @@ struct ib_wq *mlx5_ib_create_wq(struct ib_pd *pd, + if (udata->outlen && udata->outlen < min_resp_len) + return ERR_PTR(-EINVAL); + ++ if (!capable(CAP_SYS_RAWIO) && ++ init_attr->create_flags & IB_WQ_FLAGS_DELAY_DROP) ++ return ERR_PTR(-EPERM); ++ + dev = to_mdev(pd->device); + switch (init_attr->wq_type) { + case IB_WQT_RQ: +diff --git a/drivers/infiniband/sw/rdmavt/cq.c b/drivers/infiniband/sw/rdmavt/cq.c +index a85571a4cf57..0fee3c87776b 100644 +--- a/drivers/infiniband/sw/rdmavt/cq.c ++++ b/drivers/infiniband/sw/rdmavt/cq.c +@@ -327,7 +327,7 @@ void rvt_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata) + if (cq->ip) + kref_put(&cq->ip->ref, rvt_release_mmap_info); + else +- vfree(cq->queue); ++ vfree(cq->kqueue); + } + + /** +diff --git a/drivers/input/input.c b/drivers/input/input.c +index ee6c3234df36..e2eb9b9b8363 100644 +--- a/drivers/input/input.c ++++ b/drivers/input/input.c +@@ -190,6 +190,7 @@ static void input_repeat_key(struct timer_list *t) + input_value_sync + }; + ++ input_set_timestamp(dev, ktime_get()); + input_pass_values(dev, vals, ARRAY_SIZE(vals)); + + if (dev->rep[REP_PERIOD]) +diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c +index 2c666fb34625..4d2036209b45 100644 +--- a/drivers/input/mouse/synaptics.c ++++ b/drivers/input/mouse/synaptics.c +@@ -186,6 +186,7 @@ static const char * const smbus_pnp_ids[] = { + "SYN3052", /* HP EliteBook 840 G4 */ + "SYN3221", /* HP 15-ay000 */ + "SYN323d", /* HP Spectre X360 13-w013dx */ ++ "SYN3257", /* HP Envy 13-ad105ng */ + NULL + }; + +diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c +index 6ed9f22e6401..fe245439adee 100644 +--- a/drivers/input/touchscreen/raydium_i2c_ts.c ++++ b/drivers/input/touchscreen/raydium_i2c_ts.c +@@ -432,7 +432,7 @@ static int raydium_i2c_write_object(struct i2c_client *client, + return 0; + } + +-static bool raydium_i2c_boot_trigger(struct i2c_client *client) ++static int raydium_i2c_boot_trigger(struct i2c_client *client) + { + static const u8 cmd[7][6] = { + { 0x08, 0x0C, 0x09, 0x00, 0x50, 0xD7 }, +@@ -457,10 +457,10 @@ static bool raydium_i2c_boot_trigger(struct i2c_client *client) + } + } + +- return false; ++ return 0; + } + +-static bool raydium_i2c_fw_trigger(struct i2c_client *client) ++static int raydium_i2c_fw_trigger(struct i2c_client *client) + { + static const u8 cmd[5][11] = { + { 0, 0x09, 0x71, 0x0C, 0x09, 0x00, 0x50, 0xD7, 0, 0, 0 }, +@@ -483,7 +483,7 @@ static bool raydium_i2c_fw_trigger(struct i2c_client *client) + } + } + +- return false; ++ return 0; + } + + static int raydium_i2c_check_path(struct i2c_client *client) +diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c +index 6a9a1b987520..9e393b9c5091 100644 +--- a/drivers/iommu/dmar.c ++++ b/drivers/iommu/dmar.c +@@ -371,7 +371,8 @@ dmar_find_dmaru(struct acpi_dmar_hardware_unit *drhd) + { + struct dmar_drhd_unit *dmaru; + +- list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list) ++ list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list, ++ dmar_rcu_check()) + if (dmaru->segment == drhd->segment && + dmaru->reg_base_addr == drhd->address) + return dmaru; +diff --git a/drivers/iommu/intel-iommu-debugfs.c b/drivers/iommu/intel-iommu-debugfs.c +index 471f05d452e0..bdf095e9dbe0 100644 +--- a/drivers/iommu/intel-iommu-debugfs.c ++++ b/drivers/iommu/intel-iommu-debugfs.c +@@ -32,38 +32,42 @@ struct iommu_regset { + + #define IOMMU_REGSET_ENTRY(_reg_) \ + { DMAR_##_reg_##_REG, __stringify(_reg_) } +-static const struct iommu_regset iommu_regs[] = { ++ ++static const struct iommu_regset iommu_regs_32[] = { + IOMMU_REGSET_ENTRY(VER), +- IOMMU_REGSET_ENTRY(CAP), +- IOMMU_REGSET_ENTRY(ECAP), + IOMMU_REGSET_ENTRY(GCMD), + IOMMU_REGSET_ENTRY(GSTS), +- IOMMU_REGSET_ENTRY(RTADDR), +- IOMMU_REGSET_ENTRY(CCMD), + IOMMU_REGSET_ENTRY(FSTS), + IOMMU_REGSET_ENTRY(FECTL), + IOMMU_REGSET_ENTRY(FEDATA), + IOMMU_REGSET_ENTRY(FEADDR), + IOMMU_REGSET_ENTRY(FEUADDR), +- IOMMU_REGSET_ENTRY(AFLOG), + IOMMU_REGSET_ENTRY(PMEN), + IOMMU_REGSET_ENTRY(PLMBASE), + IOMMU_REGSET_ENTRY(PLMLIMIT), ++ IOMMU_REGSET_ENTRY(ICS), ++ IOMMU_REGSET_ENTRY(PRS), ++ IOMMU_REGSET_ENTRY(PECTL), ++ IOMMU_REGSET_ENTRY(PEDATA), ++ IOMMU_REGSET_ENTRY(PEADDR), ++ IOMMU_REGSET_ENTRY(PEUADDR), ++}; ++ ++static const struct iommu_regset iommu_regs_64[] = { ++ IOMMU_REGSET_ENTRY(CAP), ++ IOMMU_REGSET_ENTRY(ECAP), ++ IOMMU_REGSET_ENTRY(RTADDR), ++ IOMMU_REGSET_ENTRY(CCMD), ++ IOMMU_REGSET_ENTRY(AFLOG), + IOMMU_REGSET_ENTRY(PHMBASE), + IOMMU_REGSET_ENTRY(PHMLIMIT), + IOMMU_REGSET_ENTRY(IQH), + IOMMU_REGSET_ENTRY(IQT), + IOMMU_REGSET_ENTRY(IQA), +- IOMMU_REGSET_ENTRY(ICS), + IOMMU_REGSET_ENTRY(IRTA), + IOMMU_REGSET_ENTRY(PQH), + IOMMU_REGSET_ENTRY(PQT), + IOMMU_REGSET_ENTRY(PQA), +- IOMMU_REGSET_ENTRY(PRS), +- IOMMU_REGSET_ENTRY(PECTL), +- IOMMU_REGSET_ENTRY(PEDATA), +- IOMMU_REGSET_ENTRY(PEADDR), +- IOMMU_REGSET_ENTRY(PEUADDR), + IOMMU_REGSET_ENTRY(MTRRCAP), + IOMMU_REGSET_ENTRY(MTRRDEF), + IOMMU_REGSET_ENTRY(MTRR_FIX64K_00000), +@@ -126,10 +130,16 @@ static int iommu_regset_show(struct seq_file *m, void *unused) + * by adding the offset to the pointer (virtual address). + */ + raw_spin_lock_irqsave(&iommu->register_lock, flag); +- for (i = 0 ; i < ARRAY_SIZE(iommu_regs); i++) { +- value = dmar_readq(iommu->reg + iommu_regs[i].offset); ++ for (i = 0 ; i < ARRAY_SIZE(iommu_regs_32); i++) { ++ value = dmar_readl(iommu->reg + iommu_regs_32[i].offset); ++ seq_printf(m, "%-16s\t0x%02x\t\t0x%016llx\n", ++ iommu_regs_32[i].regs, iommu_regs_32[i].offset, ++ value); ++ } ++ for (i = 0 ; i < ARRAY_SIZE(iommu_regs_64); i++) { ++ value = dmar_readq(iommu->reg + iommu_regs_64[i].offset); + seq_printf(m, "%-16s\t0x%02x\t\t0x%016llx\n", +- iommu_regs[i].regs, iommu_regs[i].offset, ++ iommu_regs_64[i].regs, iommu_regs_64[i].offset, + value); + } + raw_spin_unlock_irqrestore(&iommu->register_lock, flag); +@@ -271,9 +281,16 @@ static int dmar_translation_struct_show(struct seq_file *m, void *unused) + { + struct dmar_drhd_unit *drhd; + struct intel_iommu *iommu; ++ u32 sts; + + rcu_read_lock(); + for_each_active_iommu(iommu, drhd) { ++ sts = dmar_readl(iommu->reg + DMAR_GSTS_REG); ++ if (!(sts & DMA_GSTS_TES)) { ++ seq_printf(m, "DMA Remapping is not enabled on %s\n", ++ iommu->name); ++ continue; ++ } + root_tbl_walk(m, iommu); + seq_putc(m, '\n'); + } +@@ -343,6 +360,7 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused) + struct dmar_drhd_unit *drhd; + struct intel_iommu *iommu; + u64 irta; ++ u32 sts; + + rcu_read_lock(); + for_each_active_iommu(iommu, drhd) { +@@ -352,7 +370,8 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused) + seq_printf(m, "Remapped Interrupt supported on IOMMU: %s\n", + iommu->name); + +- if (iommu->ir_table) { ++ sts = dmar_readl(iommu->reg + DMAR_GSTS_REG); ++ if (iommu->ir_table && (sts & DMA_GSTS_IRES)) { + irta = virt_to_phys(iommu->ir_table->base); + seq_printf(m, " IR table address:%llx\n", irta); + ir_tbl_remap_entry_show(m, iommu); +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c +index 1c2b3e78056f..9d47b227e557 100644 +--- a/drivers/iommu/intel-iommu.c ++++ b/drivers/iommu/intel-iommu.c +@@ -4961,6 +4961,9 @@ int __init intel_iommu_init(void) + + down_write(&dmar_global_lock); + ++ if (!no_iommu) ++ intel_iommu_debugfs_init(); ++ + if (no_iommu || dmar_disabled) { + /* + * We exit the function here to ensure IOMMU's remapping and +@@ -5056,7 +5059,6 @@ int __init intel_iommu_init(void) + pr_info("Intel(R) Virtualization Technology for Directed I/O\n"); + + intel_iommu_enabled = 1; +- intel_iommu_debugfs_init(); + + return 0; + +diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c +index 039963a7765b..198ddfb8d2b1 100644 +--- a/drivers/media/usb/b2c2/flexcop-usb.c ++++ b/drivers/media/usb/b2c2/flexcop-usb.c +@@ -511,6 +511,9 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb) + return ret; + } + ++ if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1) ++ return -ENODEV; ++ + switch (fc_usb->udev->speed) { + case USB_SPEED_LOW: + err("cannot handle USB speed because it is too slow."); +@@ -544,9 +547,6 @@ static int flexcop_usb_probe(struct usb_interface *intf, + struct flexcop_device *fc = NULL; + int ret; + +- if (intf->cur_altsetting->desc.bNumEndpoints < 1) +- return -ENODEV; +- + if ((fc = flexcop_device_kmalloc(sizeof(struct flexcop_usb))) == NULL) { + err("out of memory\n"); + return -ENOMEM; +diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c +index e53c58ab6488..ef62dd6c5ae4 100644 +--- a/drivers/media/usb/dvb-usb/dib0700_core.c ++++ b/drivers/media/usb/dvb-usb/dib0700_core.c +@@ -818,7 +818,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf) + + /* Starting in firmware 1.20, the RC info is provided on a bulk pipe */ + +- if (intf->altsetting[0].desc.bNumEndpoints < rc_ep + 1) ++ if (intf->cur_altsetting->desc.bNumEndpoints < rc_ep + 1) + return -ENODEV; + + purb = usb_alloc_urb(0, GFP_KERNEL); +@@ -838,7 +838,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf) + * Some devices like the Hauppauge NovaTD model 52009 use an interrupt + * endpoint, while others use a bulk one. + */ +- e = &intf->altsetting[0].endpoint[rc_ep].desc; ++ e = &intf->cur_altsetting->endpoint[rc_ep].desc; + if (usb_endpoint_dir_in(e)) { + if (usb_endpoint_xfer_bulk(e)) { + pipe = usb_rcvbulkpipe(d->udev, rc_ep); +diff --git a/drivers/media/usb/gspca/ov519.c b/drivers/media/usb/gspca/ov519.c +index f417dfc0b872..0afe70a3f9a2 100644 +--- a/drivers/media/usb/gspca/ov519.c ++++ b/drivers/media/usb/gspca/ov519.c +@@ -3477,6 +3477,11 @@ static void ov511_mode_init_regs(struct sd *sd) + return; + } + ++ if (alt->desc.bNumEndpoints < 1) { ++ sd->gspca_dev.usb_err = -ENODEV; ++ return; ++ } ++ + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + reg_w(sd, R51x_FIFO_PSIZE, packet_size >> 5); + +@@ -3603,6 +3608,11 @@ static void ov518_mode_init_regs(struct sd *sd) + return; + } + ++ if (alt->desc.bNumEndpoints < 1) { ++ sd->gspca_dev.usb_err = -ENODEV; ++ return; ++ } ++ + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + ov518_reg_w32(sd, R51x_FIFO_PSIZE, packet_size & ~7, 2); + +diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx.c b/drivers/media/usb/gspca/stv06xx/stv06xx.c +index 79653d409951..95673fc0a99c 100644 +--- a/drivers/media/usb/gspca/stv06xx/stv06xx.c ++++ b/drivers/media/usb/gspca/stv06xx/stv06xx.c +@@ -282,6 +282,9 @@ static int stv06xx_start(struct gspca_dev *gspca_dev) + return -EIO; + } + ++ if (alt->desc.bNumEndpoints < 1) ++ return -ENODEV; ++ + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + err = stv06xx_write_bridge(sd, STV_ISO_SIZE_L, packet_size); + if (err < 0) +@@ -306,11 +309,21 @@ out: + + static int stv06xx_isoc_init(struct gspca_dev *gspca_dev) + { ++ struct usb_interface_cache *intfc; + struct usb_host_interface *alt; + struct sd *sd = (struct sd *) gspca_dev; + ++ intfc = gspca_dev->dev->actconfig->intf_cache[0]; ++ ++ if (intfc->num_altsetting < 2) ++ return -ENODEV; ++ ++ alt = &intfc->altsetting[1]; ++ ++ if (alt->desc.bNumEndpoints < 1) ++ return -ENODEV; ++ + /* Start isoc bandwidth "negotiation" at max isoc bandwidth */ +- alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1]; + alt->endpoint[0].desc.wMaxPacketSize = + cpu_to_le16(sd->sensor->max_packet_size[gspca_dev->curr_mode]); + +@@ -323,6 +336,10 @@ static int stv06xx_isoc_nego(struct gspca_dev *gspca_dev) + struct usb_host_interface *alt; + struct sd *sd = (struct sd *) gspca_dev; + ++ /* ++ * Existence of altsetting and endpoint was verified in ++ * stv06xx_isoc_init() ++ */ + alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1]; + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + min_packet_size = sd->sensor->min_packet_size[gspca_dev->curr_mode]; +diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c b/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c +index 6d1007715ff7..ae382b3b5f7f 100644 +--- a/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c ++++ b/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c +@@ -185,6 +185,10 @@ static int pb0100_start(struct sd *sd) + alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt); + if (!alt) + return -ENODEV; ++ ++ if (alt->desc.bNumEndpoints < 1) ++ return -ENODEV; ++ + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + + /* If we don't have enough bandwidth use a lower framerate */ +diff --git a/drivers/media/usb/gspca/xirlink_cit.c b/drivers/media/usb/gspca/xirlink_cit.c +index 934a90bd78c2..c579b100f066 100644 +--- a/drivers/media/usb/gspca/xirlink_cit.c ++++ b/drivers/media/usb/gspca/xirlink_cit.c +@@ -1442,6 +1442,9 @@ static int cit_get_packet_size(struct gspca_dev *gspca_dev) + return -EIO; + } + ++ if (alt->desc.bNumEndpoints < 1) ++ return -ENODEV; ++ + return le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + } + +@@ -2626,6 +2629,7 @@ static int sd_start(struct gspca_dev *gspca_dev) + + static int sd_isoc_init(struct gspca_dev *gspca_dev) + { ++ struct usb_interface_cache *intfc; + struct usb_host_interface *alt; + int max_packet_size; + +@@ -2641,8 +2645,17 @@ static int sd_isoc_init(struct gspca_dev *gspca_dev) + break; + } + ++ intfc = gspca_dev->dev->actconfig->intf_cache[0]; ++ ++ if (intfc->num_altsetting < 2) ++ return -ENODEV; ++ ++ alt = &intfc->altsetting[1]; ++ ++ if (alt->desc.bNumEndpoints < 1) ++ return -ENODEV; ++ + /* Start isoc bandwidth "negotiation" at max isoc bandwidth */ +- alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1]; + alt->endpoint[0].desc.wMaxPacketSize = cpu_to_le16(max_packet_size); + + return 0; +@@ -2665,6 +2678,9 @@ static int sd_isoc_nego(struct gspca_dev *gspca_dev) + break; + } + ++ /* ++ * Existence of altsetting and endpoint was verified in sd_isoc_init() ++ */ + alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1]; + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + if (packet_size <= min_packet_size) +diff --git a/drivers/media/usb/usbtv/usbtv-core.c b/drivers/media/usb/usbtv/usbtv-core.c +index 5095c380b2c1..ee9c656d121f 100644 +--- a/drivers/media/usb/usbtv/usbtv-core.c ++++ b/drivers/media/usb/usbtv/usbtv-core.c +@@ -56,7 +56,7 @@ int usbtv_set_regs(struct usbtv *usbtv, const u16 regs[][2], int size) + + ret = usb_control_msg(usbtv->udev, pipe, USBTV_REQUEST_REG, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, +- value, index, NULL, 0, 0); ++ value, index, NULL, 0, USB_CTRL_GET_TIMEOUT); + if (ret < 0) + return ret; + } +diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c +index 3d9284a09ee5..b249f037900c 100644 +--- a/drivers/media/usb/usbtv/usbtv-video.c ++++ b/drivers/media/usb/usbtv/usbtv-video.c +@@ -800,7 +800,8 @@ static int usbtv_s_ctrl(struct v4l2_ctrl *ctrl) + ret = usb_control_msg(usbtv->udev, + usb_rcvctrlpipe(usbtv->udev, 0), USBTV_CONTROL_REG, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, +- 0, USBTV_BASE + 0x0244, (void *)data, 3, 0); ++ 0, USBTV_BASE + 0x0244, (void *)data, 3, ++ USB_CTRL_GET_TIMEOUT); + if (ret < 0) + goto error; + } +@@ -851,7 +852,7 @@ static int usbtv_s_ctrl(struct v4l2_ctrl *ctrl) + ret = usb_control_msg(usbtv->udev, usb_sndctrlpipe(usbtv->udev, 0), + USBTV_CONTROL_REG, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, +- 0, index, (void *)data, size, 0); ++ 0, index, (void *)data, size, USB_CTRL_SET_TIMEOUT); + + error: + if (ret < 0) +diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c +index 63d6b147b21e..41da73ce2e98 100644 +--- a/drivers/media/v4l2-core/v4l2-device.c ++++ b/drivers/media/v4l2-core/v4l2-device.c +@@ -179,6 +179,7 @@ static void v4l2_subdev_release(struct v4l2_subdev *sd) + + if (sd->internal_ops && sd->internal_ops->release) + sd->internal_ops->release(sd); ++ sd->devnode = NULL; + module_put(owner); + } + +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index abf8f5eb0a1c..26644b7ec13e 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -1732,8 +1732,11 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from, + * the erase operation does not exceed the max_busy_timeout, we should + * use R1B response. Or we need to prevent the host from doing hw busy + * detection, which is done by converting to a R1 response instead. ++ * Note, some hosts requires R1B, which also means they are on their own ++ * when it comes to deal with the busy timeout. + */ +- if (card->host->max_busy_timeout && ++ if (!(card->host->caps & MMC_CAP_NEED_RSP_BUSY) && ++ card->host->max_busy_timeout && + busy_timeout > card->host->max_busy_timeout) { + cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; + } else { +diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c +index c8804895595f..b7159e243323 100644 +--- a/drivers/mmc/core/mmc.c ++++ b/drivers/mmc/core/mmc.c +@@ -1911,9 +1911,12 @@ static int mmc_sleep(struct mmc_host *host) + * If the max_busy_timeout of the host is specified, validate it against + * the sleep cmd timeout. A failure means we need to prevent the host + * from doing hw busy detection, which is done by converting to a R1 +- * response instead of a R1B. ++ * response instead of a R1B. Note, some hosts requires R1B, which also ++ * means they are on their own when it comes to deal with the busy ++ * timeout. + */ +- if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) { ++ if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && host->max_busy_timeout && ++ (timeout_ms > host->max_busy_timeout)) { + cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; + } else { + cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; +diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c +index 09113b9ad679..18a7afb2a5b2 100644 +--- a/drivers/mmc/core/mmc_ops.c ++++ b/drivers/mmc/core/mmc_ops.c +@@ -538,10 +538,12 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, + * If the cmd timeout and the max_busy_timeout of the host are both + * specified, let's validate them. A failure means we need to prevent + * the host from doing hw busy detection, which is done by converting +- * to a R1 response instead of a R1B. ++ * to a R1 response instead of a R1B. Note, some hosts requires R1B, ++ * which also means they are on their own when it comes to deal with the ++ * busy timeout. + */ +- if (timeout_ms && host->max_busy_timeout && +- (timeout_ms > host->max_busy_timeout)) ++ if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && timeout_ms && ++ host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) + use_r1b_resp = false; + + cmd.opcode = MMC_SWITCH; +diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c +index 083e7e053c95..d3135249b2e4 100644 +--- a/drivers/mmc/host/sdhci-omap.c ++++ b/drivers/mmc/host/sdhci-omap.c +@@ -1134,6 +1134,9 @@ static int sdhci_omap_probe(struct platform_device *pdev) + host->mmc_host_ops.execute_tuning = sdhci_omap_execute_tuning; + host->mmc_host_ops.enable_sdio_irq = sdhci_omap_enable_sdio_irq; + ++ /* R1B responses is required to properly manage HW busy detection. */ ++ mmc->caps |= MMC_CAP_NEED_RSP_BUSY; ++ + ret = sdhci_setup_host(host); + if (ret) + goto err_put_sync; +diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c +index 403ac44a7378..a25c3a4d3f6c 100644 +--- a/drivers/mmc/host/sdhci-tegra.c ++++ b/drivers/mmc/host/sdhci-tegra.c +@@ -1552,6 +1552,9 @@ static int sdhci_tegra_probe(struct platform_device *pdev) + if (tegra_host->soc_data->nvquirks & NVQUIRK_ENABLE_DDR50) + host->mmc->caps |= MMC_CAP_1_8V_DDR; + ++ /* R1B responses is required to properly manage HW busy detection. */ ++ host->mmc->caps |= MMC_CAP_NEED_RSP_BUSY; ++ + tegra_sdhci_parse_dt(host); + + tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power", +diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig +index df1c7989e13d..df3cd2589bcf 100644 +--- a/drivers/net/Kconfig ++++ b/drivers/net/Kconfig +@@ -106,6 +106,7 @@ config NET_FC + config IFB + tristate "Intermediate Functional Block support" + depends on NET_CLS_ACT ++ select NET_REDIRECT + ---help--- + This is an intermediate driver that allows sharing of + resources. +diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c +index 2f5c287eac95..a3664281a33f 100644 +--- a/drivers/net/can/slcan.c ++++ b/drivers/net/can/slcan.c +@@ -625,7 +625,10 @@ err_free_chan: + tty->disc_data = NULL; + clear_bit(SLF_INUSE, &sl->flags); + slc_free_netdev(sl->dev); ++ /* do not call free_netdev before rtnl_unlock */ ++ rtnl_unlock(); + free_netdev(sl->dev); ++ return err; + + err_exit: + rtnl_unlock(); +diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c +index 1d8d36de4d20..e0e932f0aed1 100644 +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -566,7 +566,7 @@ mt7530_mib_reset(struct dsa_switch *ds) + static void + mt7530_port_set_status(struct mt7530_priv *priv, int port, int enable) + { +- u32 mask = PMCR_TX_EN | PMCR_RX_EN; ++ u32 mask = PMCR_TX_EN | PMCR_RX_EN | PMCR_FORCE_LNK; + + if (enable) + mt7530_set(priv, MT7530_PMCR_P(port), mask); +@@ -1439,7 +1439,7 @@ static void mt7530_phylink_mac_config(struct dsa_switch *ds, int port, + mcr_new &= ~(PMCR_FORCE_SPEED_1000 | PMCR_FORCE_SPEED_100 | + PMCR_FORCE_FDX | PMCR_TX_FC_EN | PMCR_RX_FC_EN); + mcr_new |= PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | PMCR_BACKOFF_EN | +- PMCR_BACKPR_EN | PMCR_FORCE_MODE | PMCR_FORCE_LNK; ++ PMCR_BACKPR_EN | PMCR_FORCE_MODE; + + /* Are we connected to external phy */ + if (port == 5 && dsa_is_user_port(ds, 5)) +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c +index f0cddf250cfd..26325f7b3c1f 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -3652,13 +3652,15 @@ err_disable_device: + + /*****************************************************************************/ + +-/* ena_remove - Device Removal Routine ++/* __ena_shutoff - Helper used in both PCI remove/shutdown routines + * @pdev: PCI device information struct ++ * @shutdown: Is it a shutdown operation? If false, means it is a removal + * +- * ena_remove is called by the PCI subsystem to alert the driver +- * that it should release a PCI device. ++ * __ena_shutoff is a helper routine that does the real work on shutdown and ++ * removal paths; the difference between those paths is with regards to whether ++ * dettach or unregister the netdevice. + */ +-static void ena_remove(struct pci_dev *pdev) ++static void __ena_shutoff(struct pci_dev *pdev, bool shutdown) + { + struct ena_adapter *adapter = pci_get_drvdata(pdev); + struct ena_com_dev *ena_dev; +@@ -3677,13 +3679,17 @@ static void ena_remove(struct pci_dev *pdev) + + cancel_work_sync(&adapter->reset_task); + +- rtnl_lock(); ++ rtnl_lock(); /* lock released inside the below if-else block */ + ena_destroy_device(adapter, true); +- rtnl_unlock(); +- +- unregister_netdev(netdev); +- +- free_netdev(netdev); ++ if (shutdown) { ++ netif_device_detach(netdev); ++ dev_close(netdev); ++ rtnl_unlock(); ++ } else { ++ rtnl_unlock(); ++ unregister_netdev(netdev); ++ free_netdev(netdev); ++ } + + ena_com_rss_destroy(ena_dev); + +@@ -3698,6 +3704,30 @@ static void ena_remove(struct pci_dev *pdev) + vfree(ena_dev); + } + ++/* ena_remove - Device Removal Routine ++ * @pdev: PCI device information struct ++ * ++ * ena_remove is called by the PCI subsystem to alert the driver ++ * that it should release a PCI device. ++ */ ++ ++static void ena_remove(struct pci_dev *pdev) ++{ ++ __ena_shutoff(pdev, false); ++} ++ ++/* ena_shutdown - Device Shutdown Routine ++ * @pdev: PCI device information struct ++ * ++ * ena_shutdown is called by the PCI subsystem to alert the driver that ++ * a shutdown/reboot (or kexec) is happening and device must be disabled. ++ */ ++ ++static void ena_shutdown(struct pci_dev *pdev) ++{ ++ __ena_shutoff(pdev, true); ++} ++ + #ifdef CONFIG_PM + /* ena_suspend - PM suspend callback + * @pdev: PCI device information struct +@@ -3747,6 +3777,7 @@ static struct pci_driver ena_pci_driver = { + .id_table = ena_pci_tbl, + .probe = ena_probe, + .remove = ena_remove, ++ .shutdown = ena_shutdown, + #ifdef CONFIG_PM + .suspend = ena_suspend, + .resume = ena_resume, +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c +index 57c88e157f86..6862594b49ab 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c +@@ -6863,12 +6863,12 @@ skip_rdma: + } + ena |= FUNC_BACKING_STORE_CFG_REQ_DFLT_ENABLES; + rc = bnxt_hwrm_func_backing_store_cfg(bp, ena); +- if (rc) ++ if (rc) { + netdev_err(bp->dev, "Failed configuring context mem, rc = %d.\n", + rc); +- else +- ctx->flags |= BNXT_CTX_FLAG_INITED; +- ++ return rc; ++ } ++ ctx->flags |= BNXT_CTX_FLAG_INITED; + return 0; + } + +@@ -7387,14 +7387,22 @@ static int bnxt_hwrm_port_qstats_ext(struct bnxt *bp) + pri2cos = &resp2->pri0_cos_queue_id; + for (i = 0; i < 8; i++) { + u8 queue_id = pri2cos[i]; ++ u8 queue_idx; + ++ /* Per port queue IDs start from 0, 10, 20, etc */ ++ queue_idx = queue_id % 10; ++ if (queue_idx > BNXT_MAX_QUEUE) { ++ bp->pri2cos_valid = false; ++ goto qstats_done; ++ } + for (j = 0; j < bp->max_q; j++) { + if (bp->q_ids[j] == queue_id) +- bp->pri2cos[i] = j; ++ bp->pri2cos_idx[i] = queue_idx; + } + } + bp->pri2cos_valid = 1; + } ++qstats_done: + mutex_unlock(&bp->hwrm_cmd_lock); + return rc; + } +@@ -11595,6 +11603,10 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh) + bp->rx_nr_rings++; + bp->cp_nr_rings++; + } ++ if (rc) { ++ bp->tx_nr_rings = 0; ++ bp->rx_nr_rings = 0; ++ } + return rc; + } + +@@ -11887,12 +11899,12 @@ init_err_cleanup: + init_err_pci_clean: + bnxt_free_hwrm_short_cmd_req(bp); + bnxt_free_hwrm_resources(bp); +- bnxt_free_ctx_mem(bp); +- kfree(bp->ctx); +- bp->ctx = NULL; + kfree(bp->fw_health); + bp->fw_health = NULL; + bnxt_cleanup_pci(bp); ++ bnxt_free_ctx_mem(bp); ++ kfree(bp->ctx); ++ bp->ctx = NULL; + + init_err_free: + free_netdev(dev); +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h +index 2e6ad53fdc75..cda7ba31095a 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h +@@ -1688,7 +1688,7 @@ struct bnxt { + u16 fw_rx_stats_ext_size; + u16 fw_tx_stats_ext_size; + u16 hw_ring_stats_size; +- u8 pri2cos[8]; ++ u8 pri2cos_idx[8]; + u8 pri2cos_valid; + + u16 hwrm_max_req_len; +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c +index fb6f30d0d1d0..b1511bcffb1b 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c +@@ -479,24 +479,26 @@ static int bnxt_dcbnl_ieee_getets(struct net_device *dev, struct ieee_ets *ets) + { + struct bnxt *bp = netdev_priv(dev); + struct ieee_ets *my_ets = bp->ieee_ets; ++ int rc; + + ets->ets_cap = bp->max_tc; + + if (!my_ets) { +- int rc; +- + if (bp->dcbx_cap & DCB_CAP_DCBX_HOST) + return 0; + + my_ets = kzalloc(sizeof(*my_ets), GFP_KERNEL); + if (!my_ets) +- return 0; ++ return -ENOMEM; + rc = bnxt_hwrm_queue_cos2bw_qcfg(bp, my_ets); + if (rc) +- return 0; ++ goto error; + rc = bnxt_hwrm_queue_pri2cos_qcfg(bp, my_ets); + if (rc) +- return 0; ++ goto error; ++ ++ /* cache result */ ++ bp->ieee_ets = my_ets; + } + + ets->cbs = my_ets->cbs; +@@ -505,6 +507,9 @@ static int bnxt_dcbnl_ieee_getets(struct net_device *dev, struct ieee_ets *ets) + memcpy(ets->tc_tsa, my_ets->tc_tsa, sizeof(ets->tc_tsa)); + memcpy(ets->prio_tc, my_ets->prio_tc, sizeof(ets->prio_tc)); + return 0; ++error: ++ kfree(my_ets); ++ return rc; + } + + static int bnxt_dcbnl_ieee_setets(struct net_device *dev, struct ieee_ets *ets) +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +index cfa647d5b44d..fb1ab58da9fa 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +@@ -589,25 +589,25 @@ skip_ring_stats: + if (bp->pri2cos_valid) { + for (i = 0; i < 8; i++, j++) { + long n = bnxt_rx_bytes_pri_arr[i].base_off + +- bp->pri2cos[i]; ++ bp->pri2cos_idx[i]; + + buf[j] = le64_to_cpu(*(rx_port_stats_ext + n)); + } + for (i = 0; i < 8; i++, j++) { + long n = bnxt_rx_pkts_pri_arr[i].base_off + +- bp->pri2cos[i]; ++ bp->pri2cos_idx[i]; + + buf[j] = le64_to_cpu(*(rx_port_stats_ext + n)); + } + for (i = 0; i < 8; i++, j++) { + long n = bnxt_tx_bytes_pri_arr[i].base_off + +- bp->pri2cos[i]; ++ bp->pri2cos_idx[i]; + + buf[j] = le64_to_cpu(*(tx_port_stats_ext + n)); + } + for (i = 0; i < 8; i++, j++) { + long n = bnxt_tx_pkts_pri_arr[i].base_off + +- bp->pri2cos[i]; ++ bp->pri2cos_idx[i]; + + buf[j] = le64_to_cpu(*(tx_port_stats_ext + n)); + } +diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c +index 928bfea5457b..3a45ac8f0e01 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c +@@ -1324,8 +1324,9 @@ static inline void t6_fill_tnl_lso(struct sk_buff *skb, + int t4_sge_eth_txq_egress_update(struct adapter *adap, struct sge_eth_txq *eq, + int maxreclaim) + { ++ unsigned int reclaimed, hw_cidx; + struct sge_txq *q = &eq->q; +- unsigned int reclaimed; ++ int hw_in_use; + + if (!q->in_use || !__netif_tx_trylock(eq->txq)) + return 0; +@@ -1333,12 +1334,17 @@ int t4_sge_eth_txq_egress_update(struct adapter *adap, struct sge_eth_txq *eq, + /* Reclaim pending completed TX Descriptors. */ + reclaimed = reclaim_completed_tx(adap, &eq->q, maxreclaim, true); + ++ hw_cidx = ntohs(READ_ONCE(q->stat->cidx)); ++ hw_in_use = q->pidx - hw_cidx; ++ if (hw_in_use < 0) ++ hw_in_use += q->size; ++ + /* If the TX Queue is currently stopped and there's now more than half + * the queue available, restart it. Otherwise bail out since the rest + * of what we want do here is with the possibility of shipping any + * currently buffered Coalesced TX Work Request. + */ +- if (netif_tx_queue_stopped(eq->txq) && txq_avail(q) > (q->size / 2)) { ++ if (netif_tx_queue_stopped(eq->txq) && hw_in_use < (q->size / 2)) { + netif_tx_wake_queue(eq->txq); + eq->q.restarts++; + } +@@ -1469,16 +1475,7 @@ out_free: dev_kfree_skb_any(skb); + * has opened up. + */ + eth_txq_stop(q); +- +- /* If we're using the SGE Doorbell Queue Timer facility, we +- * don't need to ask the Firmware to send us Egress Queue CIDX +- * Updates: the Hardware will do this automatically. And +- * since we send the Ingress Queue CIDX Updates to the +- * corresponding Ethernet Response Queue, we'll get them very +- * quickly. +- */ +- if (!q->dbqt) +- wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F; ++ wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F; + } + + wr = (void *)&q->q.desc[q->q.pidx]; +@@ -1792,16 +1789,7 @@ static netdev_tx_t cxgb4_vf_eth_xmit(struct sk_buff *skb, + * has opened up. + */ + eth_txq_stop(txq); +- +- /* If we're using the SGE Doorbell Queue Timer facility, we +- * don't need to ask the Firmware to send us Egress Queue CIDX +- * Updates: the Hardware will do this automatically. And +- * since we send the Ingress Queue CIDX Updates to the +- * corresponding Ethernet Response Queue, we'll get them very +- * quickly. +- */ +- if (!txq->dbqt) +- wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F; ++ wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F; + } + + /* Start filling in our Work Request. Note that we do _not_ handle +@@ -2924,26 +2912,6 @@ static void t4_tx_completion_handler(struct sge_rspq *rspq, + } + + txq = &s->ethtxq[pi->first_qset + rspq->idx]; +- +- /* We've got the Hardware Consumer Index Update in the Egress Update +- * message. If we're using the SGE Doorbell Queue Timer mechanism, +- * these Egress Update messages will be our sole CIDX Updates we get +- * since we don't want to chew up PCIe bandwidth for both Ingress +- * Messages and Status Page writes. However, The code which manages +- * reclaiming successfully DMA'ed TX Work Requests uses the CIDX value +- * stored in the Status Page at the end of the TX Queue. It's easiest +- * to simply copy the CIDX Update value from the Egress Update message +- * to the Status Page. Also note that no Endian issues need to be +- * considered here since both are Big Endian and we're just copying +- * bytes consistently ... +- */ +- if (txq->dbqt) { +- struct cpl_sge_egr_update *egr; +- +- egr = (struct cpl_sge_egr_update *)rsp; +- WRITE_ONCE(txq->q.stat->cidx, egr->cidx); +- } +- + t4_sge_eth_txq_egress_update(adapter, txq, -1); + } + +diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +index e130233b5085..00c4beb760c3 100644 +--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c ++++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +@@ -2770,9 +2770,7 @@ static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl) + headroom = (u16)(bl->priv_data_size + DPAA_PARSE_RESULTS_SIZE + + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE); + +- return DPAA_FD_DATA_ALIGNMENT ? ALIGN(headroom, +- DPAA_FD_DATA_ALIGNMENT) : +- headroom; ++ return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT); + } + + static int dpaa_eth_probe(struct platform_device *pdev) +diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig +index 0139cb9042ec..34150182cc35 100644 +--- a/drivers/net/ethernet/freescale/fman/Kconfig ++++ b/drivers/net/ethernet/freescale/fman/Kconfig +@@ -8,3 +8,31 @@ config FSL_FMAN + help + Freescale Data-Path Acceleration Architecture Frame Manager + (FMan) support ++ ++config DPAA_ERRATUM_A050385 ++ bool ++ depends on ARM64 && FSL_DPAA ++ default y ++ help ++ DPAA FMan erratum A050385 software workaround implementation: ++ align buffers, data start, SG fragment length to avoid FMan DMA ++ splits. ++ FMAN DMA read or writes under heavy traffic load may cause FMAN ++ internal resource leak thus stopping further packet processing. ++ The FMAN internal queue can overflow when FMAN splits single ++ read or write transactions into multiple smaller transactions ++ such that more than 17 AXI transactions are in flight from FMAN ++ to interconnect. When the FMAN internal queue overflows, it can ++ stall further packet processing. The issue can occur with any ++ one of the following three conditions: ++ 1. FMAN AXI transaction crosses 4K address boundary (Errata ++ A010022) ++ 2. FMAN DMA address for an AXI transaction is not 16 byte ++ aligned, i.e. the last 4 bits of an address are non-zero ++ 3. Scatter Gather (SG) frames have more than one SG buffer in ++ the SG list and any one of the buffers, except the last ++ buffer in the SG list has data size that is not a multiple ++ of 16 bytes, i.e., other than 16, 32, 48, 64, etc. ++ With any one of the above three conditions present, there is ++ likelihood of stalled FMAN packet processing, especially under ++ stress with multiple ports injecting line-rate traffic. +diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c +index 210749bf1eac..4c2fa13a7dd7 100644 +--- a/drivers/net/ethernet/freescale/fman/fman.c ++++ b/drivers/net/ethernet/freescale/fman/fman.c +@@ -1,5 +1,6 @@ + /* + * Copyright 2008-2015 Freescale Semiconductor Inc. ++ * Copyright 2020 NXP + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: +@@ -566,6 +567,10 @@ struct fman_cfg { + u32 qmi_def_tnums_thresh; + }; + ++#ifdef CONFIG_DPAA_ERRATUM_A050385 ++static bool fman_has_err_a050385; ++#endif ++ + static irqreturn_t fman_exceptions(struct fman *fman, + enum fman_exceptions exception) + { +@@ -2514,6 +2519,14 @@ struct fman *fman_bind(struct device *fm_dev) + } + EXPORT_SYMBOL(fman_bind); + ++#ifdef CONFIG_DPAA_ERRATUM_A050385 ++bool fman_has_errata_a050385(void) ++{ ++ return fman_has_err_a050385; ++} ++EXPORT_SYMBOL(fman_has_errata_a050385); ++#endif ++ + static irqreturn_t fman_err_irq(int irq, void *handle) + { + struct fman *fman = (struct fman *)handle; +@@ -2841,6 +2854,11 @@ static struct fman *read_dts_node(struct platform_device *of_dev) + goto fman_free; + } + ++#ifdef CONFIG_DPAA_ERRATUM_A050385 ++ fman_has_err_a050385 = ++ of_property_read_bool(fm_node, "fsl,erratum-a050385"); ++#endif ++ + return fman; + + fman_node_put: +diff --git a/drivers/net/ethernet/freescale/fman/fman.h b/drivers/net/ethernet/freescale/fman/fman.h +index 935c317fa696..f2ede1360f03 100644 +--- a/drivers/net/ethernet/freescale/fman/fman.h ++++ b/drivers/net/ethernet/freescale/fman/fman.h +@@ -1,5 +1,6 @@ + /* + * Copyright 2008-2015 Freescale Semiconductor Inc. ++ * Copyright 2020 NXP + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: +@@ -398,6 +399,10 @@ u16 fman_get_max_frm(void); + + int fman_get_rx_extra_headroom(void); + ++#ifdef CONFIG_DPAA_ERRATUM_A050385 ++bool fman_has_errata_a050385(void); ++#endif ++ + struct fman *fman_bind(struct device *dev); + + #endif /* __FM_H */ +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +index 0c8d2269bc46..403e0f089f2a 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +@@ -1596,7 +1596,7 @@ static int hns3_setup_tc(struct net_device *netdev, void *type_data) + netif_dbg(h, drv, netdev, "setup tc: num_tc=%u\n", tc); + + return (kinfo->dcb_ops && kinfo->dcb_ops->setup_tc) ? +- kinfo->dcb_ops->setup_tc(h, tc, prio_tc) : -EOPNOTSUPP; ++ kinfo->dcb_ops->setup_tc(h, tc ? tc : 1, prio_tc) : -EOPNOTSUPP; + } + + static int hns3_nic_setup_tc(struct net_device *dev, enum tc_setup_type type, +diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c +index 6b1a81df1465..a10ae28ebc8a 100644 +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -2804,11 +2804,10 @@ static int mvneta_poll(struct napi_struct *napi, int budget) + /* For the case where the last mvneta_poll did not process all + * RX packets + */ +- rx_queue = fls(((cause_rx_tx >> 8) & 0xff)); +- + cause_rx_tx |= pp->neta_armada3700 ? pp->cause_rx_tx : + port->cause_rx_tx; + ++ rx_queue = fls(((cause_rx_tx >> 8) & 0xff)); + if (rx_queue) { + rx_queue = rx_queue - 1; + if (pp->bm_priv) +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h +index 9c8427698238..55ceabf077b2 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h +@@ -371,6 +371,7 @@ enum { + + struct mlx5e_sq_wqe_info { + u8 opcode; ++ u8 num_wqebbs; + + /* Auxiliary data for different opcodes. */ + union { +@@ -1058,6 +1059,7 @@ int mlx5e_modify_rq_state(struct mlx5e_rq *rq, int curr_state, int next_state); + void mlx5e_activate_rq(struct mlx5e_rq *rq); + void mlx5e_deactivate_rq(struct mlx5e_rq *rq); + void mlx5e_free_rx_descs(struct mlx5e_rq *rq); ++void mlx5e_free_rx_in_progress_descs(struct mlx5e_rq *rq); + void mlx5e_activate_icosq(struct mlx5e_icosq *icosq); + void mlx5e_deactivate_icosq(struct mlx5e_icosq *icosq); + +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/health.h b/drivers/net/ethernet/mellanox/mlx5/core/en/health.h +index d3693fa547ac..e54f70d9af22 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/health.h ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/health.h +@@ -10,8 +10,7 @@ + + static inline bool cqe_syndrome_needs_recover(u8 syndrome) + { +- return syndrome == MLX5_CQE_SYNDROME_LOCAL_LENGTH_ERR || +- syndrome == MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR || ++ return syndrome == MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR || + syndrome == MLX5_CQE_SYNDROME_LOCAL_PROT_ERR || + syndrome == MLX5_CQE_SYNDROME_WR_FLUSH_ERR; + } +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +index b860569d4247..9fa4b98001d5 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +@@ -90,7 +90,7 @@ static int mlx5e_rx_reporter_err_icosq_cqe_recover(void *ctx) + goto out; + + mlx5e_reset_icosq_cc_pc(icosq); +- mlx5e_free_rx_descs(rq); ++ mlx5e_free_rx_in_progress_descs(rq); + clear_bit(MLX5E_SQ_STATE_RECOVERING, &icosq->state); + mlx5e_activate_icosq(icosq); + mlx5e_activate_rq(rq); +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +index a226277b0980..f07b1399744e 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +@@ -181,10 +181,12 @@ mlx5e_tx_dma_unmap(struct device *pdev, struct mlx5e_sq_dma *dma) + + static inline void mlx5e_rqwq_reset(struct mlx5e_rq *rq) + { +- if (rq->wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) ++ if (rq->wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) { + mlx5_wq_ll_reset(&rq->mpwqe.wq); +- else ++ rq->mpwqe.actual_wq_head = 0; ++ } else { + mlx5_wq_cyc_reset(&rq->wqe.wq); ++ } + } + + /* SW parser related functions */ +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +index e5e91cbcbc31..ee7c753e9ea0 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +@@ -824,6 +824,29 @@ int mlx5e_wait_for_min_rx_wqes(struct mlx5e_rq *rq, int wait_time) + return -ETIMEDOUT; + } + ++void mlx5e_free_rx_in_progress_descs(struct mlx5e_rq *rq) ++{ ++ struct mlx5_wq_ll *wq; ++ u16 head; ++ int i; ++ ++ if (rq->wq_type != MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) ++ return; ++ ++ wq = &rq->mpwqe.wq; ++ head = wq->head; ++ ++ /* Outstanding UMR WQEs (in progress) start at wq->head */ ++ for (i = 0; i < rq->mpwqe.umr_in_progress; i++) { ++ rq->dealloc_wqe(rq, head); ++ head = mlx5_wq_ll_get_wqe_next_ix(wq, head); ++ } ++ ++ rq->mpwqe.actual_wq_head = wq->head; ++ rq->mpwqe.umr_in_progress = 0; ++ rq->mpwqe.umr_completed = 0; ++} ++ + void mlx5e_free_rx_descs(struct mlx5e_rq *rq) + { + __be16 wqe_ix_be; +@@ -831,14 +854,8 @@ void mlx5e_free_rx_descs(struct mlx5e_rq *rq) + + if (rq->wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) { + struct mlx5_wq_ll *wq = &rq->mpwqe.wq; +- u16 head = wq->head; +- int i; + +- /* Outstanding UMR WQEs (in progress) start at wq->head */ +- for (i = 0; i < rq->mpwqe.umr_in_progress; i++) { +- rq->dealloc_wqe(rq, head); +- head = mlx5_wq_ll_get_wqe_next_ix(wq, head); +- } ++ mlx5e_free_rx_in_progress_descs(rq); + + while (!mlx5_wq_ll_is_empty(wq)) { + struct mlx5e_rx_wqe_ll *wqe; +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +index 82cffb3a9964..1d295a7afc8c 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +@@ -477,6 +477,7 @@ static inline void mlx5e_fill_icosq_frag_edge(struct mlx5e_icosq *sq, + /* fill sq frag edge with nops to avoid wqe wrapping two pages */ + for (; wi < edge_wi; wi++) { + wi->opcode = MLX5_OPCODE_NOP; ++ wi->num_wqebbs = 1; + mlx5e_post_nop(wq, sq->sqn, &sq->pc); + } + } +@@ -525,6 +526,7 @@ static int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix) + umr_wqe->uctrl.xlt_offset = cpu_to_be16(xlt_offset); + + sq->db.ico_wqe[pi].opcode = MLX5_OPCODE_UMR; ++ sq->db.ico_wqe[pi].num_wqebbs = MLX5E_UMR_WQEBBS; + sq->db.ico_wqe[pi].umr.rq = rq; + sq->pc += MLX5E_UMR_WQEBBS; + +@@ -628,17 +630,14 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq) + + ci = mlx5_wq_cyc_ctr2ix(&sq->wq, sqcc); + wi = &sq->db.ico_wqe[ci]; ++ sqcc += wi->num_wqebbs; + +- if (likely(wi->opcode == MLX5_OPCODE_UMR)) { +- sqcc += MLX5E_UMR_WQEBBS; ++ if (likely(wi->opcode == MLX5_OPCODE_UMR)) + wi->umr.rq->mpwqe.umr_completed++; +- } else if (likely(wi->opcode == MLX5_OPCODE_NOP)) { +- sqcc++; +- } else { ++ else if (unlikely(wi->opcode != MLX5_OPCODE_NOP)) + netdev_WARN_ONCE(cq->channel->netdev, + "Bad OPCODE in ICOSQ WQE info: 0x%x\n", + wi->opcode); +- } + + } while (!last_wqe); + +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c +index 257a7c9f7a14..800d34ed8a96 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c +@@ -78,6 +78,7 @@ void mlx5e_trigger_irq(struct mlx5e_icosq *sq) + u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc); + + sq->db.ico_wqe[pi].opcode = MLX5_OPCODE_NOP; ++ sq->db.ico_wqe[pi].num_wqebbs = 1; + nopwqe = mlx5e_post_nop(wq, sq->sqn, &sq->pc); + mlx5e_notify_hw(wq, sq->pc, sq->uar_map, &nopwqe->ctrl); + } +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +index 004c56c2fc0c..b2dfa2b5366f 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +@@ -930,7 +930,6 @@ static int dr_actions_l2_rewrite(struct mlx5dr_domain *dmn, + + action->rewrite.data = (void *)ops; + action->rewrite.num_of_actions = i; +- action->rewrite.chunk->byte_size = i * sizeof(*ops); + + ret = mlx5dr_send_postsend_action(dmn, action); + if (ret) { +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c +index c7f10d4f8f8d..095ec7b1399d 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c +@@ -558,7 +558,8 @@ int mlx5dr_send_postsend_action(struct mlx5dr_domain *dmn, + int ret; + + send_info.write.addr = (uintptr_t)action->rewrite.data; +- send_info.write.length = action->rewrite.chunk->byte_size; ++ send_info.write.length = action->rewrite.num_of_actions * ++ DR_MODIFY_ACTION_SIZE; + send_info.write.lkey = 0; + send_info.remote_addr = action->rewrite.chunk->mr_addr; + send_info.rkey = action->rewrite.chunk->rkey; +diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c +index 615455a21567..f3d1f9411d10 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c +@@ -1318,36 +1318,64 @@ static void mlxsw_pci_mbox_free(struct mlxsw_pci *mlxsw_pci, + mbox->mapaddr); + } + +-static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxsw_pci, +- const struct pci_device_id *id) ++static int mlxsw_pci_sys_ready_wait(struct mlxsw_pci *mlxsw_pci, ++ const struct pci_device_id *id, ++ u32 *p_sys_status) + { + unsigned long end; +- char mrsr_pl[MLXSW_REG_MRSR_LEN]; +- int err; ++ u32 val; + +- mlxsw_reg_mrsr_pack(mrsr_pl); +- err = mlxsw_reg_write(mlxsw_pci->core, MLXSW_REG(mrsr), mrsr_pl); +- if (err) +- return err; + if (id->device == PCI_DEVICE_ID_MELLANOX_SWITCHX2) { + msleep(MLXSW_PCI_SW_RESET_TIMEOUT_MSECS); + return 0; + } + +- /* We must wait for the HW to become responsive once again. */ ++ /* We must wait for the HW to become responsive. */ + msleep(MLXSW_PCI_SW_RESET_WAIT_MSECS); + + end = jiffies + msecs_to_jiffies(MLXSW_PCI_SW_RESET_TIMEOUT_MSECS); + do { +- u32 val = mlxsw_pci_read32(mlxsw_pci, FW_READY); +- ++ val = mlxsw_pci_read32(mlxsw_pci, FW_READY); + if ((val & MLXSW_PCI_FW_READY_MASK) == MLXSW_PCI_FW_READY_MAGIC) + return 0; + cond_resched(); + } while (time_before(jiffies, end)); ++ ++ *p_sys_status = val & MLXSW_PCI_FW_READY_MASK; ++ + return -EBUSY; + } + ++static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxsw_pci, ++ const struct pci_device_id *id) ++{ ++ struct pci_dev *pdev = mlxsw_pci->pdev; ++ char mrsr_pl[MLXSW_REG_MRSR_LEN]; ++ u32 sys_status; ++ int err; ++ ++ err = mlxsw_pci_sys_ready_wait(mlxsw_pci, id, &sys_status); ++ if (err) { ++ dev_err(&pdev->dev, "Failed to reach system ready status before reset. Status is 0x%x\n", ++ sys_status); ++ return err; ++ } ++ ++ mlxsw_reg_mrsr_pack(mrsr_pl); ++ err = mlxsw_reg_write(mlxsw_pci->core, MLXSW_REG(mrsr), mrsr_pl); ++ if (err) ++ return err; ++ ++ err = mlxsw_pci_sys_ready_wait(mlxsw_pci, id, &sys_status); ++ if (err) { ++ dev_err(&pdev->dev, "Failed to reach system ready status after reset. Status is 0x%x\n", ++ sys_status); ++ return err; ++ } ++ ++ return 0; ++} ++ + static int mlxsw_pci_alloc_irq_vectors(struct mlxsw_pci *mlxsw_pci) + { + int err; +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c +index 54275624718b..336e5ecc68f8 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c +@@ -637,12 +637,12 @@ static int mlxsw_sp_mr_vif_resolve(struct mlxsw_sp_mr_table *mr_table, + return 0; + + err_erif_unresolve: +- list_for_each_entry_from_reverse(erve, &mr_vif->route_evif_list, +- vif_node) ++ list_for_each_entry_continue_reverse(erve, &mr_vif->route_evif_list, ++ vif_node) + mlxsw_sp_mr_route_evif_unresolve(mr_table, erve); + err_irif_unresolve: +- list_for_each_entry_from_reverse(irve, &mr_vif->route_ivif_list, +- vif_node) ++ list_for_each_entry_continue_reverse(irve, &mr_vif->route_ivif_list, ++ vif_node) + mlxsw_sp_mr_route_ivif_unresolve(mr_table, irve); + mr_vif->rif = NULL; + return err; +diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c +index a2cef6a004e7..5ebfc3e66331 100644 +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -6812,7 +6812,7 @@ static int rtl_alloc_irq(struct rtl8169_private *tp) + RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~MSIEnable); + rtl_lock_config_regs(tp); + /* fall through */ +- case RTL_GIGA_MAC_VER_07 ... RTL_GIGA_MAC_VER_24: ++ case RTL_GIGA_MAC_VER_07 ... RTL_GIGA_MAC_VER_17: + flags = PCI_IRQ_LEGACY; + break; + default: +@@ -6903,6 +6903,13 @@ static int r8169_mdio_register(struct rtl8169_private *tp) + if (!tp->phydev) { + mdiobus_unregister(new_bus); + return -ENODEV; ++ } else if (!tp->phydev->drv) { ++ /* Most chip versions fail with the genphy driver. ++ * Therefore ensure that the dedicated PHY driver is loaded. ++ */ ++ dev_err(&pdev->dev, "realtek.ko not loaded, maybe it needs to be added to initramfs?\n"); ++ mdiobus_unregister(new_bus); ++ return -EUNATCH; + } + + /* PHY will be woken up in rtl_open() */ +@@ -7064,15 +7071,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + int chipset, region; + int jumbo_max, rc; + +- /* Some tools for creating an initramfs don't consider softdeps, then +- * r8169.ko may be in initramfs, but realtek.ko not. Then the generic +- * PHY driver is used that doesn't work with most chip versions. +- */ +- if (!driver_find("RTL8201CP Ethernet", &mdio_bus_type)) { +- dev_err(&pdev->dev, "realtek.ko not loaded, maybe it needs to be added to initramfs?\n"); +- return -ENOENT; +- } +- + dev = devm_alloc_etherdev(&pdev->dev, sizeof (*tp)); + if (!dev) + return -ENOMEM; +diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +index c56fcbb37066..38767d797914 100644 +--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c ++++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +@@ -2279,7 +2279,7 @@ static int __init sxgbe_cmdline_opt(char *str) + if (!str || !*str) + return -EINVAL; + while ((opt = strsep(&str, ",")) != NULL) { +- if (!strncmp(opt, "eee_timer:", 6)) { ++ if (!strncmp(opt, "eee_timer:", 10)) { + if (kstrtoint(opt + 10, 0, &eee_timer)) + goto err; + } +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +index e2e469c37a4d..9f9aaa47a8dc 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +@@ -1411,7 +1411,7 @@ static int rk_gmac_probe(struct platform_device *pdev) + + ret = rk_gmac_clk_init(plat_dat); + if (ret) +- return ret; ++ goto err_remove_config_dt; + + ret = rk_gmac_powerup(plat_dat->bsp_priv); + if (ret) +diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c +index 5c6b7fc04ea6..730ab57201bd 100644 +--- a/drivers/net/geneve.c ++++ b/drivers/net/geneve.c +@@ -1845,8 +1845,6 @@ static void geneve_destroy_tunnels(struct net *net, struct list_head *head) + if (!net_eq(dev_net(geneve->dev), net)) + unregister_netdevice_queue(geneve->dev, head); + } +- +- WARN_ON_ONCE(!list_empty(&gn->sock_list)); + } + + static void __net_exit geneve_exit_batch_net(struct list_head *net_list) +@@ -1861,6 +1859,12 @@ static void __net_exit geneve_exit_batch_net(struct list_head *net_list) + /* unregister the devices gathered above */ + unregister_netdevice_many(&list); + rtnl_unlock(); ++ ++ list_for_each_entry(net, net_list, exit_list) { ++ const struct geneve_net *gn = net_generic(net, geneve_net_id); ++ ++ WARN_ON_ONCE(!list_empty(&gn->sock_list)); ++ } + } + + static struct pernet_operations geneve_net_ops = { +diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c +index 242b9b0943f8..7fe306e76281 100644 +--- a/drivers/net/ifb.c ++++ b/drivers/net/ifb.c +@@ -75,7 +75,7 @@ static void ifb_ri_tasklet(unsigned long _txp) + } + + while ((skb = __skb_dequeue(&txp->tq)) != NULL) { +- skb->tc_redirected = 0; ++ skb->redirected = 0; + skb->tc_skip_classify = 1; + + u64_stats_update_begin(&txp->tsync); +@@ -96,7 +96,7 @@ static void ifb_ri_tasklet(unsigned long _txp) + rcu_read_unlock(); + skb->skb_iif = txp->dev->ifindex; + +- if (!skb->tc_from_ingress) { ++ if (!skb->from_ingress) { + dev_queue_xmit(skb); + } else { + skb_pull_rcsum(skb, skb->mac_len); +@@ -243,7 +243,7 @@ static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev) + txp->rx_bytes += skb->len; + u64_stats_update_end(&txp->rsync); + +- if (!skb->tc_redirected || !skb->skb_iif) { ++ if (!skb->redirected || !skb->skb_iif) { + dev_kfree_skb(skb); + dev->stats.rx_dropped++; + return NETDEV_TX_OK; +diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c +index 6497a5c45220..32c627702ac5 100644 +--- a/drivers/net/macsec.c ++++ b/drivers/net/macsec.c +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + + #include + +@@ -3236,6 +3237,8 @@ static int macsec_newlink(struct net *net, struct net_device *dev, + real_dev = __dev_get_by_index(net, nla_get_u32(tb[IFLA_LINK])); + if (!real_dev) + return -ENODEV; ++ if (real_dev->type != ARPHRD_ETHER) ++ return -EINVAL; + + dev->priv_flags |= IFF_MACSEC; + +diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c +index 52e80434e45e..31a559513362 100644 +--- a/drivers/net/phy/dp83867.c ++++ b/drivers/net/phy/dp83867.c +@@ -25,7 +25,8 @@ + #define DP83867_CFG3 0x1e + + /* Extended Registers */ +-#define DP83867_CFG4 0x0031 ++#define DP83867_FLD_THR_CFG 0x002e ++#define DP83867_CFG4 0x0031 + #define DP83867_CFG4_SGMII_ANEG_MASK (BIT(5) | BIT(6)) + #define DP83867_CFG4_SGMII_ANEG_TIMER_11MS (3 << 5) + #define DP83867_CFG4_SGMII_ANEG_TIMER_800US (2 << 5) +@@ -74,6 +75,7 @@ + #define DP83867_STRAP_STS2_CLK_SKEW_RX_MASK GENMASK(2, 0) + #define DP83867_STRAP_STS2_CLK_SKEW_RX_SHIFT 0 + #define DP83867_STRAP_STS2_CLK_SKEW_NONE BIT(2) ++#define DP83867_STRAP_STS2_STRAP_FLD BIT(10) + + /* PHY CTRL bits */ + #define DP83867_PHYCR_FIFO_DEPTH_SHIFT 14 +@@ -103,6 +105,9 @@ + /* CFG4 bits */ + #define DP83867_CFG4_PORT_MIRROR_EN BIT(0) + ++/* FLD_THR_CFG */ ++#define DP83867_FLD_THR_CFG_ENERGY_LOST_THR_MASK 0x7 ++ + enum { + DP83867_PORT_MIRROING_KEEP, + DP83867_PORT_MIRROING_EN, +@@ -318,6 +323,20 @@ static int dp83867_config_init(struct phy_device *phydev) + phy_clear_bits_mmd(phydev, DP83867_DEVADDR, DP83867_CFG4, + BIT(7)); + ++ bs = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_STRAP_STS2); ++ if (bs & DP83867_STRAP_STS2_STRAP_FLD) { ++ /* When using strap to enable FLD, the ENERGY_LOST_FLD_THR will ++ * be set to 0x2. This may causes the PHY link to be unstable - ++ * the default value 0x1 need to be restored. ++ */ ++ ret = phy_modify_mmd(phydev, DP83867_DEVADDR, ++ DP83867_FLD_THR_CFG, ++ DP83867_FLD_THR_CFG_ENERGY_LOST_THR_MASK, ++ 0x1); ++ if (ret) ++ return ret; ++ } ++ + if (phy_interface_is_rgmii(phydev)) { + val = phy_read(phydev, MII_DP83867_PHYCTRL); + if (val < 0) +diff --git a/drivers/net/phy/mdio-bcm-unimac.c b/drivers/net/phy/mdio-bcm-unimac.c +index 4a28fb29adaa..fbd36891ee64 100644 +--- a/drivers/net/phy/mdio-bcm-unimac.c ++++ b/drivers/net/phy/mdio-bcm-unimac.c +@@ -242,11 +242,9 @@ static int unimac_mdio_probe(struct platform_device *pdev) + return -ENOMEM; + } + +- priv->clk = devm_clk_get(&pdev->dev, NULL); +- if (PTR_ERR(priv->clk) == -EPROBE_DEFER) ++ priv->clk = devm_clk_get_optional(&pdev->dev, NULL); ++ if (IS_ERR(priv->clk)) + return PTR_ERR(priv->clk); +- else +- priv->clk = NULL; + + ret = clk_prepare_enable(priv->clk); + if (ret) +diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c +index 88d409e48c1f..aad6809ebe39 100644 +--- a/drivers/net/phy/mdio-mux-bcm-iproc.c ++++ b/drivers/net/phy/mdio-mux-bcm-iproc.c +@@ -288,8 +288,13 @@ static int mdio_mux_iproc_suspend(struct device *dev) + static int mdio_mux_iproc_resume(struct device *dev) + { + struct iproc_mdiomux_desc *md = dev_get_drvdata(dev); ++ int rc; + +- clk_prepare_enable(md->core_clk); ++ rc = clk_prepare_enable(md->core_clk); ++ if (rc) { ++ dev_err(md->dev, "failed to enable core clk\n"); ++ return rc; ++ } + mdio_mux_iproc_config(md); + + return 0; +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index 5754bb6ca0ee..6c738a271257 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -1210,6 +1210,7 @@ static const struct usb_device_id products[] = { + {QMI_FIXED_INTF(0x1435, 0xd182, 5)}, /* Wistron NeWeb D18 */ + {QMI_FIXED_INTF(0x1435, 0xd191, 4)}, /* Wistron NeWeb D19Q1 */ + {QMI_QUIRK_SET_DTR(0x1508, 0x1001, 4)}, /* Fibocom NL668 series */ ++ {QMI_FIXED_INTF(0x1690, 0x7588, 4)}, /* ASKEY WWHC050 */ + {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */ + {QMI_FIXED_INTF(0x16d8, 0x6007, 0)}, /* CMOTech CHE-628S */ + {QMI_FIXED_INTF(0x16d8, 0x6008, 0)}, /* CMOTech CMU-301 */ +diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c +index 283dfeb406ad..93690f77ec9c 100644 +--- a/drivers/net/vxlan.c ++++ b/drivers/net/vxlan.c +@@ -2779,10 +2779,19 @@ static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan, + /* Setup stats when device is created */ + static int vxlan_init(struct net_device *dev) + { ++ struct vxlan_dev *vxlan = netdev_priv(dev); ++ int err; ++ + dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); + if (!dev->tstats) + return -ENOMEM; + ++ err = gro_cells_init(&vxlan->gro_cells, dev); ++ if (err) { ++ free_percpu(dev->tstats); ++ return err; ++ } ++ + return 0; + } + +@@ -3043,8 +3052,6 @@ static void vxlan_setup(struct net_device *dev) + + vxlan->dev = dev; + +- gro_cells_init(&vxlan->gro_cells, dev); +- + for (h = 0; h < FDB_HASH_SIZE; ++h) { + spin_lock_init(&vxlan->hash_lock[h]); + INIT_HLIST_HEAD(&vxlan->fdb_head[h]); +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +index c59cbb8cbdd7..c54fe6650018 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +@@ -1181,7 +1181,7 @@ int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm) + + static int iwl_mvm_ppag_init(struct iwl_mvm *mvm) + { +- return -ENOENT; ++ return 0; + } + #endif /* CONFIG_ACPI */ + +diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h +index 917729807514..e17f70b4d199 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h +@@ -561,6 +561,7 @@ static inline void clear_pci_tx_desc_content(__le32 *__pdesc, int _size) + rxmcs == DESC92C_RATE11M) + + struct phy_status_rpt { ++ u8 padding[2]; + u8 ch_corr[2]; + u8 cck_sig_qual_ofdm_pwdb_all; + u8 cck_agc_rpt_ofdm_cfosho_a; +diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c +index 0cc9ac856fe2..ed2123129e0e 100644 +--- a/drivers/nfc/fdp/fdp.c ++++ b/drivers/nfc/fdp/fdp.c +@@ -184,7 +184,7 @@ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type) + const struct firmware *fw; + struct sk_buff *skb; + unsigned long len; +- u8 max_size, payload_size; ++ int max_size, payload_size; + int rc = 0; + + if ((type == NCI_PATCH_TYPE_OTP && !info->otp_patch) || +@@ -207,8 +207,7 @@ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type) + + while (len) { + +- payload_size = min_t(unsigned long, (unsigned long) max_size, +- len); ++ payload_size = min_t(unsigned long, max_size, len); + + skb = nci_skb_alloc(ndev, (NCI_CTRL_HDR_SIZE + payload_size), + GFP_KERNEL); +diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c +index bd6129db6417..c34a6df712ad 100644 +--- a/drivers/of/of_mdio.c ++++ b/drivers/of/of_mdio.c +@@ -268,6 +268,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) + rc = of_mdiobus_register_phy(mdio, child, addr); + if (rc && rc != -ENODEV) + goto unregister; ++ break; + } + } + } +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c +index b727d1e34523..fe70e9875bde 100644 +--- a/drivers/s390/net/qeth_core_main.c ++++ b/drivers/s390/net/qeth_core_main.c +@@ -1244,7 +1244,6 @@ static int qeth_osa_set_output_queues(struct qeth_card *card, bool single) + if (count == 1) + dev_info(&card->gdev->dev, "Priority Queueing not supported\n"); + +- card->qdio.default_out_queue = single ? 0 : QETH_DEFAULT_QUEUE; + card->qdio.no_out_queues = count; + return 0; + } +@@ -2634,12 +2633,12 @@ static int qeth_init_input_buffer(struct qeth_card *card, + buf->rx_skb = netdev_alloc_skb(card->dev, + QETH_RX_PULL_LEN + ETH_HLEN); + if (!buf->rx_skb) +- return 1; ++ return -ENOMEM; + } + + pool_entry = qeth_find_free_buffer_pool_entry(card); + if (!pool_entry) +- return 1; ++ return -ENOBUFS; + + /* + * since the buffer is accessed only from the input_tasklet +@@ -2671,10 +2670,15 @@ int qeth_init_qdio_queues(struct qeth_card *card) + /* inbound queue */ + qdio_reset_buffers(card->qdio.in_q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q); + memset(&card->rx, 0, sizeof(struct qeth_rx)); ++ + qeth_initialize_working_pool_list(card); + /*give only as many buffers to hardware as we have buffer pool entries*/ +- for (i = 0; i < card->qdio.in_buf_pool.buf_count - 1; ++i) +- qeth_init_input_buffer(card, &card->qdio.in_q->bufs[i]); ++ for (i = 0; i < card->qdio.in_buf_pool.buf_count - 1; i++) { ++ rc = qeth_init_input_buffer(card, &card->qdio.in_q->bufs[i]); ++ if (rc) ++ return rc; ++ } ++ + card->qdio.in_q->next_buf_to_init = + card->qdio.in_buf_pool.buf_count - 1; + rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_INPUT, 0, 0, +diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c +index 079c04bc448a..7a57b61f0340 100644 +--- a/drivers/scsi/ipr.c ++++ b/drivers/scsi/ipr.c +@@ -9947,6 +9947,7 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, + ioa_cfg->max_devs_supported = ipr_max_devs; + + if (ioa_cfg->sis64) { ++ host->max_channel = IPR_MAX_SIS64_BUSES; + host->max_id = IPR_MAX_SIS64_TARGETS_PER_BUS; + host->max_lun = IPR_MAX_SIS64_LUNS_PER_TARGET; + if (ipr_max_devs > IPR_MAX_SIS64_DEVS) +@@ -9955,6 +9956,7 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, + + ((sizeof(struct ipr_config_table_entry64) + * ioa_cfg->max_devs_supported))); + } else { ++ host->max_channel = IPR_VSET_BUS; + host->max_id = IPR_MAX_NUM_TARGETS_PER_BUS; + host->max_lun = IPR_MAX_NUM_LUNS_PER_TARGET; + if (ipr_max_devs > IPR_MAX_PHYSICAL_DEVS) +@@ -9964,7 +9966,6 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, + * ioa_cfg->max_devs_supported))); + } + +- host->max_channel = IPR_VSET_BUS; + host->unique_id = host->host_no; + host->max_cmd_len = IPR_MAX_CDB_LEN; + host->can_queue = ioa_cfg->max_cmds; +diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h +index a67baeb36d1f..b97aa9ac2ffe 100644 +--- a/drivers/scsi/ipr.h ++++ b/drivers/scsi/ipr.h +@@ -1300,6 +1300,7 @@ struct ipr_resource_entry { + #define IPR_ARRAY_VIRTUAL_BUS 0x1 + #define IPR_VSET_VIRTUAL_BUS 0x2 + #define IPR_IOAFP_VIRTUAL_BUS 0x3 ++#define IPR_MAX_SIS64_BUSES 0x4 + + #define IPR_GET_RES_PHYS_LOC(res) \ + (((res)->bus << 24) | ((res)->target << 8) | (res)->lun) +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c +index ac2e88ec1190..6a2f8bacface 100644 +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -3171,9 +3171,11 @@ static int sd_revalidate_disk(struct gendisk *disk) + if (sd_validate_opt_xfer_size(sdkp, dev_max)) { + q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks); + rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks); +- } else ++ } else { ++ q->limits.io_opt = 0; + rw_max = min_not_zero(logical_to_sectors(sdp, dev_max), + (sector_t)BLK_DEF_MAX_SECTORS); ++ } + + /* Do not exceed controller limit */ + rw_max = min(rw_max, queue_max_hw_sectors(q)); +diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c +index 0a23727d0dc3..871441658f0e 100644 +--- a/drivers/staging/kpc2000/kpc2000/core.c ++++ b/drivers/staging/kpc2000/kpc2000/core.c +@@ -110,10 +110,10 @@ static ssize_t cpld_reconfigure(struct device *dev, + const char *buf, size_t count) + { + struct kp2000_device *pcard = dev_get_drvdata(dev); +- long wr_val; ++ unsigned long wr_val; + int rv; + +- rv = kstrtol(buf, 0, &wr_val); ++ rv = kstrtoul(buf, 0, &wr_val); + if (rv < 0) + return rv; + if (wr_val > 7) +diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c +index 845c8817281c..f7f09c0d273f 100644 +--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c ++++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c +@@ -32,6 +32,7 @@ static const struct usb_device_id rtw_usb_id_tbl[] = { + /****** 8188EUS ********/ + {USB_DEVICE(0x056e, 0x4008)}, /* Elecom WDC-150SU2M */ + {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ ++ {USB_DEVICE(0x0B05, 0x18F0)}, /* ASUS USB-N10 Nano B1 */ + {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ + {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ + {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ +diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c +index 28d372a0663a..e29c14e0ed49 100644 +--- a/drivers/staging/wlan-ng/hfa384x_usb.c ++++ b/drivers/staging/wlan-ng/hfa384x_usb.c +@@ -3374,6 +3374,8 @@ static void hfa384x_int_rxmonitor(struct wlandevice *wlandev, + WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)) { + pr_debug("overlen frm: len=%zd\n", + skblen - sizeof(struct p80211_caphdr)); ++ ++ return; + } + + skb = dev_alloc_skb(skblen); +diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c +index b5ba176004c1..d8d86761b790 100644 +--- a/drivers/staging/wlan-ng/prism2usb.c ++++ b/drivers/staging/wlan-ng/prism2usb.c +@@ -180,6 +180,7 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface) + + cancel_work_sync(&hw->link_bh); + cancel_work_sync(&hw->commsqual_bh); ++ cancel_work_sync(&hw->usb_work); + + /* Now we complete any outstanding commands + * and tell everyone who is waiting for their +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c +index 47f09a6ce7bd..84d6f7df09a4 100644 +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -923,16 +923,16 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss) + + mutex_lock(&acm->port.mutex); + +- if ((ss->close_delay != old_close_delay) || +- (ss->closing_wait != old_closing_wait)) { +- if (!capable(CAP_SYS_ADMIN)) ++ if (!capable(CAP_SYS_ADMIN)) { ++ if ((ss->close_delay != old_close_delay) || ++ (ss->closing_wait != old_closing_wait)) + retval = -EPERM; +- else { +- acm->port.close_delay = close_delay; +- acm->port.closing_wait = closing_wait; +- } +- } else +- retval = -EOPNOTSUPP; ++ else ++ retval = -EOPNOTSUPP; ++ } else { ++ acm->port.close_delay = close_delay; ++ acm->port.closing_wait = closing_wait; ++ } + + mutex_unlock(&acm->port.mutex); + return retval; +diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c +index 5a44b70372d9..fa9922c0c910 100644 +--- a/drivers/usb/musb/musb_host.c ++++ b/drivers/usb/musb/musb_host.c +@@ -1462,10 +1462,7 @@ done: + * We need to map sg if the transfer_buffer is + * NULL. + */ +- if (!urb->transfer_buffer) +- qh->use_sg = true; +- +- if (qh->use_sg) { ++ if (!urb->transfer_buffer) { + /* sg_miter_start is already done in musb_ep_program */ + if (!sg_miter_next(&qh->sg_miter)) { + dev_err(musb->controller, "error: sg list empty\n"); +@@ -1473,9 +1470,8 @@ done: + status = -EINVAL; + goto done; + } +- urb->transfer_buffer = qh->sg_miter.addr; + length = min_t(u32, length, qh->sg_miter.length); +- musb_write_fifo(hw_ep, length, urb->transfer_buffer); ++ musb_write_fifo(hw_ep, length, qh->sg_miter.addr); + qh->sg_miter.consumed = length; + sg_miter_stop(&qh->sg_miter); + } else { +@@ -1484,11 +1480,6 @@ done: + + qh->segsize = length; + +- if (qh->use_sg) { +- if (offset + length >= urb->transfer_buffer_length) +- qh->use_sg = false; +- } +- + musb_ep_select(mbase, epnum); + musb_writew(epio, MUSB_TXCSR, + MUSB_TXCSR_H_WZC_BITS | MUSB_TXCSR_TXPKTRDY); +@@ -2003,8 +1994,10 @@ finish: + urb->actual_length += xfer_len; + qh->offset += xfer_len; + if (done) { +- if (qh->use_sg) ++ if (qh->use_sg) { + qh->use_sg = false; ++ urb->transfer_buffer = NULL; ++ } + + if (urb->status == -EINPROGRESS) + urb->status = status; +diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c +index 5737add6a2a4..4cca0b836f43 100644 +--- a/drivers/usb/serial/io_edgeport.c ++++ b/drivers/usb/serial/io_edgeport.c +@@ -710,7 +710,7 @@ static void edge_interrupt_callback(struct urb *urb) + /* grab the txcredits for the ports if available */ + position = 2; + portNumber = 0; +- while ((position < length) && ++ while ((position < length - 1) && + (portNumber < edge_serial->serial->num_ports)) { + txCredits = data[position] | (data[position+1] << 8); + if (txCredits) { +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c +index 0b5dcf973d94..8bfffca3e4ae 100644 +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -1992,8 +1992,14 @@ static const struct usb_device_id option_ids[] = { + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */ ++ { USB_DEVICE_INTERFACE_CLASS(0x1435, 0xd191, 0xff), /* Wistron Neweb D19Q1 */ ++ .driver_info = RSVD(1) | RSVD(4) }, ++ { USB_DEVICE_INTERFACE_CLASS(0x1690, 0x7588, 0xff), /* ASKEY WWHC050 */ ++ .driver_info = RSVD(1) | RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2031, 0xff), /* Olicard 600 */ + .driver_info = RSVD(4) }, ++ { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2033, 0xff), /* BroadMobi BM806U */ ++ .driver_info = RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2060, 0xff), /* BroadMobi BM818 */ + .driver_info = RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ +diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c +index b86195e4dc6c..b378cd780ed5 100644 +--- a/fs/afs/cmservice.c ++++ b/fs/afs/cmservice.c +@@ -243,6 +243,17 @@ static void afs_cm_destructor(struct afs_call *call) + call->buffer = NULL; + } + ++/* ++ * Abort a service call from within an action function. ++ */ ++static void afs_abort_service_call(struct afs_call *call, u32 abort_code, int error, ++ const char *why) ++{ ++ rxrpc_kernel_abort_call(call->net->socket, call->rxcall, ++ abort_code, error, why); ++ afs_set_call_complete(call, error, 0); ++} ++ + /* + * The server supplied a list of callbacks that it wanted to break. + */ +@@ -510,8 +521,7 @@ static void SRXAFSCB_ProbeUuid(struct work_struct *work) + if (memcmp(r, &call->net->uuid, sizeof(call->net->uuid)) == 0) + afs_send_empty_reply(call); + else +- rxrpc_kernel_abort_call(call->net->socket, call->rxcall, +- 1, 1, "K-1"); ++ afs_abort_service_call(call, 1, 1, "K-1"); + + afs_put_call(call); + _leave(""); +diff --git a/fs/afs/fs_probe.c b/fs/afs/fs_probe.c +index cfe62b154f68..e1b9ed679045 100644 +--- a/fs/afs/fs_probe.c ++++ b/fs/afs/fs_probe.c +@@ -145,6 +145,7 @@ static int afs_do_probe_fileserver(struct afs_net *net, + read_lock(&server->fs_lock); + ac.alist = rcu_dereference_protected(server->addresses, + lockdep_is_held(&server->fs_lock)); ++ afs_get_addrlist(ac.alist); + read_unlock(&server->fs_lock); + + atomic_set(&server->probe_outstanding, ac.alist->nr_addrs); +@@ -163,6 +164,7 @@ static int afs_do_probe_fileserver(struct afs_net *net, + + if (!in_progress) + afs_fs_probe_done(server); ++ afs_put_addrlist(ac.alist); + return in_progress; + } + +diff --git a/fs/afs/internal.h b/fs/afs/internal.h +index 759e0578012c..d5efb1debebf 100644 +--- a/fs/afs/internal.h ++++ b/fs/afs/internal.h +@@ -154,7 +154,7 @@ struct afs_call { + }; + unsigned char unmarshall; /* unmarshalling phase */ + unsigned char addr_ix; /* Address in ->alist */ +- bool incoming; /* T if incoming call */ ++ bool drop_ref; /* T if need to drop ref for incoming call */ + bool send_pages; /* T if data from mapping should be sent */ + bool need_attention; /* T if RxRPC poked us */ + bool async; /* T if asynchronous */ +@@ -1203,8 +1203,16 @@ static inline void afs_set_call_complete(struct afs_call *call, + ok = true; + } + spin_unlock_bh(&call->state_lock); +- if (ok) ++ if (ok) { + trace_afs_call_done(call); ++ ++ /* Asynchronous calls have two refs to release - one from the alloc and ++ * one queued with the work item - and we can't just deallocate the ++ * call because the work item may be queued again. ++ */ ++ if (call->drop_ref) ++ afs_put_call(call); ++ } + } + + /* +diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c +index 61498d9f06ef..ef1d09f8920b 100644 +--- a/fs/afs/rxrpc.c ++++ b/fs/afs/rxrpc.c +@@ -18,7 +18,6 @@ struct workqueue_struct *afs_async_calls; + + static void afs_wake_up_call_waiter(struct sock *, struct rxrpc_call *, unsigned long); + static void afs_wake_up_async_call(struct sock *, struct rxrpc_call *, unsigned long); +-static void afs_delete_async_call(struct work_struct *); + static void afs_process_async_call(struct work_struct *); + static void afs_rx_new_call(struct sock *, struct rxrpc_call *, unsigned long); + static void afs_rx_discard_new_call(struct rxrpc_call *, unsigned long); +@@ -169,7 +168,7 @@ void afs_put_call(struct afs_call *call) + int n = atomic_dec_return(&call->usage); + int o = atomic_read(&net->nr_outstanding_calls); + +- trace_afs_call(call, afs_call_trace_put, n + 1, o, ++ trace_afs_call(call, afs_call_trace_put, n, o, + __builtin_return_address(0)); + + ASSERTCMP(n, >=, 0); +@@ -402,8 +401,10 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) + /* If the call is going to be asynchronous, we need an extra ref for + * the call to hold itself so the caller need not hang on to its ref. + */ +- if (call->async) ++ if (call->async) { + afs_get_call(call, afs_call_trace_get); ++ call->drop_ref = true; ++ } + + /* create a call */ + rxcall = rxrpc_kernel_begin_call(call->net->socket, srx, call->key, +@@ -584,8 +585,6 @@ static void afs_deliver_to_call(struct afs_call *call) + done: + if (call->type->done) + call->type->done(call); +- if (state == AFS_CALL_COMPLETE && call->incoming) +- afs_put_call(call); + out: + _leave(""); + return; +@@ -604,11 +603,7 @@ call_complete: + long afs_wait_for_call_to_complete(struct afs_call *call, + struct afs_addr_cursor *ac) + { +- signed long rtt2, timeout; + long ret; +- bool stalled = false; +- u64 rtt; +- u32 life, last_life; + bool rxrpc_complete = false; + + DECLARE_WAITQUEUE(myself, current); +@@ -619,14 +614,6 @@ long afs_wait_for_call_to_complete(struct afs_call *call, + if (ret < 0) + goto out; + +- rtt = rxrpc_kernel_get_rtt(call->net->socket, call->rxcall); +- rtt2 = nsecs_to_jiffies64(rtt) * 2; +- if (rtt2 < 2) +- rtt2 = 2; +- +- timeout = rtt2; +- rxrpc_kernel_check_life(call->net->socket, call->rxcall, &last_life); +- + add_wait_queue(&call->waitq, &myself); + for (;;) { + set_current_state(TASK_UNINTERRUPTIBLE); +@@ -637,37 +624,19 @@ long afs_wait_for_call_to_complete(struct afs_call *call, + call->need_attention = false; + __set_current_state(TASK_RUNNING); + afs_deliver_to_call(call); +- timeout = rtt2; + continue; + } + + if (afs_check_call_state(call, AFS_CALL_COMPLETE)) + break; + +- if (!rxrpc_kernel_check_life(call->net->socket, call->rxcall, &life)) { ++ if (!rxrpc_kernel_check_life(call->net->socket, call->rxcall)) { + /* rxrpc terminated the call. */ + rxrpc_complete = true; + break; + } + +- if (call->intr && timeout == 0 && +- life == last_life && signal_pending(current)) { +- if (stalled) +- break; +- __set_current_state(TASK_RUNNING); +- rxrpc_kernel_probe_life(call->net->socket, call->rxcall); +- timeout = rtt2; +- stalled = true; +- continue; +- } +- +- if (life != last_life) { +- timeout = rtt2; +- last_life = life; +- stalled = false; +- } +- +- timeout = schedule_timeout(timeout); ++ schedule(); + } + + remove_wait_queue(&call->waitq, &myself); +@@ -735,7 +704,7 @@ static void afs_wake_up_async_call(struct sock *sk, struct rxrpc_call *rxcall, + + u = atomic_fetch_add_unless(&call->usage, 1, 0); + if (u != 0) { +- trace_afs_call(call, afs_call_trace_wake, u, ++ trace_afs_call(call, afs_call_trace_wake, u + 1, + atomic_read(&call->net->nr_outstanding_calls), + __builtin_return_address(0)); + +@@ -744,21 +713,6 @@ static void afs_wake_up_async_call(struct sock *sk, struct rxrpc_call *rxcall, + } + } + +-/* +- * Delete an asynchronous call. The work item carries a ref to the call struct +- * that we need to release. +- */ +-static void afs_delete_async_call(struct work_struct *work) +-{ +- struct afs_call *call = container_of(work, struct afs_call, async_work); +- +- _enter(""); +- +- afs_put_call(call); +- +- _leave(""); +-} +- + /* + * Perform I/O processing on an asynchronous call. The work item carries a ref + * to the call struct that we either need to release or to pass on. +@@ -774,16 +728,6 @@ static void afs_process_async_call(struct work_struct *work) + afs_deliver_to_call(call); + } + +- if (call->state == AFS_CALL_COMPLETE) { +- /* We have two refs to release - one from the alloc and one +- * queued with the work item - and we can't just deallocate the +- * call because the work item may be queued again. +- */ +- call->async_work.func = afs_delete_async_call; +- if (!queue_work(afs_async_calls, &call->async_work)) +- afs_put_call(call); +- } +- + afs_put_call(call); + _leave(""); + } +@@ -810,6 +754,7 @@ void afs_charge_preallocation(struct work_struct *work) + if (!call) + break; + ++ call->drop_ref = true; + call->async = true; + call->state = AFS_CALL_SV_AWAIT_OP_ID; + init_waitqueue_head(&call->waitq); +diff --git a/fs/ceph/file.c b/fs/ceph/file.c +index cd09e63d682b..ce54a1b12819 100644 +--- a/fs/ceph/file.c ++++ b/fs/ceph/file.c +@@ -1415,10 +1415,13 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from) + struct inode *inode = file_inode(file); + struct ceph_inode_info *ci = ceph_inode(inode); + struct ceph_fs_client *fsc = ceph_inode_to_client(inode); ++ struct ceph_osd_client *osdc = &fsc->client->osdc; + struct ceph_cap_flush *prealloc_cf; + ssize_t count, written = 0; + int err, want, got; + bool direct_lock = false; ++ u32 map_flags; ++ u64 pool_flags; + loff_t pos; + loff_t limit = max(i_size_read(inode), fsc->max_file_size); + +@@ -1481,8 +1484,12 @@ retry_snap: + goto out; + } + +- /* FIXME: not complete since it doesn't account for being at quota */ +- if (ceph_osdmap_flag(&fsc->client->osdc, CEPH_OSDMAP_FULL)) { ++ down_read(&osdc->lock); ++ map_flags = osdc->osdmap->flags; ++ pool_flags = ceph_pg_pool_flags(osdc->osdmap, ci->i_layout.pool_id); ++ up_read(&osdc->lock); ++ if ((map_flags & CEPH_OSDMAP_FULL) || ++ (pool_flags & CEPH_POOL_FLAG_FULL)) { + err = -ENOSPC; + goto out; + } +@@ -1575,7 +1582,8 @@ retry_snap: + } + + if (written >= 0) { +- if (ceph_osdmap_flag(&fsc->client->osdc, CEPH_OSDMAP_NEARFULL)) ++ if ((map_flags & CEPH_OSDMAP_NEARFULL) || ++ (pool_flags & CEPH_POOL_FLAG_NEARFULL)) + iocb->ki_flags |= IOCB_DSYNC; + written = generic_write_sync(iocb, written); + } +diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c +index ccfcc66aaf44..923be9399b21 100644 +--- a/fs/ceph/snap.c ++++ b/fs/ceph/snap.c +@@ -1155,5 +1155,6 @@ void ceph_cleanup_snapid_map(struct ceph_mds_client *mdsc) + pr_err("snapid map %llx -> %x still in use\n", + sm->snap, sm->dev); + } ++ kfree(sm); + } + } +diff --git a/fs/libfs.c b/fs/libfs.c +index 1463b038ffc4..5fd9cc0e2ac9 100644 +--- a/fs/libfs.c ++++ b/fs/libfs.c +@@ -821,7 +821,7 @@ int simple_attr_open(struct inode *inode, struct file *file, + { + struct simple_attr *attr; + +- attr = kmalloc(sizeof(*attr), GFP_KERNEL); ++ attr = kzalloc(sizeof(*attr), GFP_KERNEL); + if (!attr) + return -ENOMEM; + +@@ -861,9 +861,11 @@ ssize_t simple_attr_read(struct file *file, char __user *buf, + if (ret) + return ret; + +- if (*ppos) { /* continued read */ ++ if (*ppos && attr->get_buf[0]) { ++ /* continued read */ + size = strlen(attr->get_buf); +- } else { /* first read */ ++ } else { ++ /* first read */ + u64 val; + ret = attr->get(attr->data, &val); + if (ret) +diff --git a/fs/nfs/client.c b/fs/nfs/client.c +index 30838304a0bf..a05f77f9c21e 100644 +--- a/fs/nfs/client.c ++++ b/fs/nfs/client.c +@@ -153,6 +153,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init) + if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL) + goto error_0; + ++ clp->cl_minorversion = cl_init->minorversion; + clp->cl_nfs_mod = cl_init->nfs_mod; + if (!try_module_get(clp->cl_nfs_mod->owner)) + goto error_dealloc; +diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c +index 3800ab6f08fa..a6dcc2151e77 100644 +--- a/fs/nfs/fscache.c ++++ b/fs/nfs/fscache.c +@@ -31,6 +31,7 @@ static DEFINE_SPINLOCK(nfs_fscache_keys_lock); + struct nfs_server_key { + struct { + uint16_t nfsversion; /* NFS protocol version */ ++ uint32_t minorversion; /* NFSv4 minor version */ + uint16_t family; /* address family */ + __be16 port; /* IP port */ + } hdr; +@@ -55,6 +56,7 @@ void nfs_fscache_get_client_cookie(struct nfs_client *clp) + + memset(&key, 0, sizeof(key)); + key.hdr.nfsversion = clp->rpc_ops->version; ++ key.hdr.minorversion = clp->cl_minorversion; + key.hdr.family = clp->cl_addr.ss_family; + + switch (clp->cl_addr.ss_family) { +diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c +index da6204025a2d..914feab64702 100644 +--- a/fs/nfs/nfs4client.c ++++ b/fs/nfs/nfs4client.c +@@ -216,7 +216,6 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init) + INIT_LIST_HEAD(&clp->cl_ds_clients); + rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client"); + clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED; +- clp->cl_minorversion = cl_init->minorversion; + clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion]; + clp->cl_mig_gen = 1; + #if IS_ENABLED(CONFIG_NFS_V4_1) +diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h +index e081b56f1c1d..5e601975745f 100644 +--- a/include/linux/ceph/osdmap.h ++++ b/include/linux/ceph/osdmap.h +@@ -37,6 +37,9 @@ int ceph_spg_compare(const struct ceph_spg *lhs, const struct ceph_spg *rhs); + #define CEPH_POOL_FLAG_HASHPSPOOL (1ULL << 0) /* hash pg seed and pool id + together */ + #define CEPH_POOL_FLAG_FULL (1ULL << 1) /* pool is full */ ++#define CEPH_POOL_FLAG_FULL_QUOTA (1ULL << 10) /* pool ran out of quota, ++ will set FULL too */ ++#define CEPH_POOL_FLAG_NEARFULL (1ULL << 11) /* pool is nearfull */ + + struct ceph_pg_pool_info { + struct rb_node node; +@@ -304,5 +307,6 @@ extern struct ceph_pg_pool_info *ceph_pg_pool_by_id(struct ceph_osdmap *map, + + extern const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64 id); + extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name); ++u64 ceph_pg_pool_flags(struct ceph_osdmap *map, u64 id); + + #endif +diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h +index 3eb0e55665b4..c004bced9b91 100644 +--- a/include/linux/ceph/rados.h ++++ b/include/linux/ceph/rados.h +@@ -143,8 +143,10 @@ extern const char *ceph_osd_state_name(int s); + /* + * osd map flag bits + */ +-#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC) */ +-#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC) */ ++#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC), ++ not set since ~luminous */ ++#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC), ++ not set since ~luminous */ + #define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */ + #define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */ + #define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */ +diff --git a/include/linux/dmar.h b/include/linux/dmar.h +index d3ea390336f3..f397e52c2d9d 100644 +--- a/include/linux/dmar.h ++++ b/include/linux/dmar.h +@@ -74,11 +74,13 @@ extern struct list_head dmar_drhd_units; + dmar_rcu_check()) + + #define for_each_active_drhd_unit(drhd) \ +- list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \ ++ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \ ++ dmar_rcu_check()) \ + if (drhd->ignored) {} else + + #define for_each_active_iommu(i, drhd) \ +- list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \ ++ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \ ++ dmar_rcu_check()) \ + if (i=drhd->iommu, drhd->ignored) {} else + + #define for_each_iommu(i, drhd) \ +diff --git a/include/linux/dsa/8021q.h b/include/linux/dsa/8021q.h +index 0aa803c451a3..c620d9139c28 100644 +--- a/include/linux/dsa/8021q.h ++++ b/include/linux/dsa/8021q.h +@@ -28,8 +28,6 @@ int dsa_8021q_rx_switch_id(u16 vid); + + int dsa_8021q_rx_source_port(u16 vid); + +-struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb); +- + #else + + int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index, +@@ -64,11 +62,6 @@ int dsa_8021q_rx_source_port(u16 vid) + return 0; + } + +-struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb) +-{ +- return NULL; +-} +- + #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */ + + #endif /* _NET_DSA_8021Q_H */ +diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h +index 7d3f2ced92d1..73c66a3a33ae 100644 +--- a/include/linux/ieee80211.h ++++ b/include/linux/ieee80211.h +@@ -2102,14 +2102,14 @@ ieee80211_he_spr_size(const u8 *he_spr_ie) + { + struct ieee80211_he_spr *he_spr = (void *)he_spr_ie; + u8 spr_len = sizeof(struct ieee80211_he_spr); +- u32 he_spr_params; ++ u8 he_spr_params; + + /* Make sure the input is not NULL */ + if (!he_spr_ie) + return 0; + + /* Calc required length */ +- he_spr_params = le32_to_cpu(he_spr->he_sr_control); ++ he_spr_params = he_spr->he_sr_control; + if (he_spr_params & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT) + spr_len++; + if (he_spr_params & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT) +diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h +index 6d8bf4bdf240..1e5dad8b8e59 100644 +--- a/include/linux/intel-iommu.h ++++ b/include/linux/intel-iommu.h +@@ -120,6 +120,8 @@ + + #define dmar_readq(a) readq(a) + #define dmar_writeq(a,v) writeq(v,a) ++#define dmar_readl(a) readl(a) ++#define dmar_writel(a, v) writel(v, a) + + #define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4) + #define DMAR_VER_MINOR(v) ((v) & 0x0f) +diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h +index ae703ea3ef48..8faca7b52543 100644 +--- a/include/linux/memcontrol.h ++++ b/include/linux/memcontrol.h +@@ -705,6 +705,7 @@ static inline unsigned long lruvec_page_state_local(struct lruvec *lruvec, + void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, + int val); + void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, int val); ++void mod_memcg_obj_state(void *p, int idx, int val); + + static inline void mod_lruvec_state(struct lruvec *lruvec, + enum node_stat_item idx, int val) +@@ -1128,6 +1129,10 @@ static inline void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, + __mod_node_page_state(page_pgdat(page), idx, val); + } + ++static inline void mod_memcg_obj_state(void *p, int idx, int val) ++{ ++} ++ + static inline + unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, + gfp_t gfp_mask, +@@ -1432,6 +1437,8 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg) + return memcg ? memcg->kmemcg_id : -1; + } + ++struct mem_cgroup *mem_cgroup_from_obj(void *p); ++ + #else + + static inline int memcg_kmem_charge(struct page *page, gfp_t gfp, int order) +@@ -1473,6 +1480,11 @@ static inline void memcg_put_cache_ids(void) + { + } + ++static inline struct mem_cgroup *mem_cgroup_from_obj(void *p) ++{ ++ return NULL; ++} ++ + #endif /* CONFIG_MEMCG_KMEM */ + + #endif /* _LINUX_MEMCONTROL_H */ +diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h +index ba703384bea0..4c5eb3aa8e72 100644 +--- a/include/linux/mmc/host.h ++++ b/include/linux/mmc/host.h +@@ -333,6 +333,7 @@ struct mmc_host { + MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \ + MMC_CAP_UHS_DDR50) + #define MMC_CAP_SYNC_RUNTIME_PM (1 << 21) /* Synced runtime PM suspends. */ ++#define MMC_CAP_NEED_RSP_BUSY (1 << 22) /* Commands with R1B can't use R1. */ + #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ + #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ + #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */ +diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h +index 6ae88b0c1c31..955e1370f033 100644 +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -634,8 +634,8 @@ typedef unsigned char *sk_buff_data_t; + * @offload_l3_fwd_mark: Packet was L3-forwarded in hardware + * @tc_skip_classify: do not classify packet. set by IFB device + * @tc_at_ingress: used within tc_classify to distinguish in/egress +- * @tc_redirected: packet was redirected by a tc action +- * @tc_from_ingress: if tc_redirected, tc_at_ingress at time of redirect ++ * @redirected: packet was redirected by packet classifier ++ * @from_ingress: packet was redirected from the ingress path + * @peeked: this packet has been seen already, so stats have been + * done for it, don't do them again + * @nf_trace: netfilter packet trace flag +@@ -816,8 +816,10 @@ struct sk_buff { + #ifdef CONFIG_NET_CLS_ACT + __u8 tc_skip_classify:1; + __u8 tc_at_ingress:1; +- __u8 tc_redirected:1; +- __u8 tc_from_ingress:1; ++#endif ++#ifdef CONFIG_NET_REDIRECT ++ __u8 redirected:1; ++ __u8 from_ingress:1; + #endif + #ifdef CONFIG_TLS_DEVICE + __u8 decrypted:1; +@@ -4514,5 +4516,31 @@ static inline __wsum lco_csum(struct sk_buff *skb) + return csum_partial(l4_hdr, csum_start - l4_hdr, partial); + } + ++static inline bool skb_is_redirected(const struct sk_buff *skb) ++{ ++#ifdef CONFIG_NET_REDIRECT ++ return skb->redirected; ++#else ++ return false; ++#endif ++} ++ ++static inline void skb_set_redirected(struct sk_buff *skb, bool from_ingress) ++{ ++#ifdef CONFIG_NET_REDIRECT ++ skb->redirected = 1; ++ skb->from_ingress = from_ingress; ++ if (skb->from_ingress) ++ skb->tstamp = 0; ++#endif ++} ++ ++static inline void skb_reset_redirect(struct sk_buff *skb) ++{ ++#ifdef CONFIG_NET_REDIRECT ++ skb->redirected = 0; ++#endif ++} ++ + #endif /* __KERNEL__ */ + #endif /* _LINUX_SKBUFF_H */ +diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h +index 1abae3c340a5..299240df79e4 100644 +--- a/include/net/af_rxrpc.h ++++ b/include/net/af_rxrpc.h +@@ -58,9 +58,7 @@ int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t, + rxrpc_user_attach_call_t, unsigned long, gfp_t, + unsigned int); + void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64); +-bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *, +- u32 *); +-void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *); ++bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *); + u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *); + bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *, + ktime_t *); +diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h +index d334e4609dd4..9fb7cf1cdf36 100644 +--- a/include/net/sch_generic.h ++++ b/include/net/sch_generic.h +@@ -675,22 +675,6 @@ void __qdisc_calculate_pkt_len(struct sk_buff *skb, + const struct qdisc_size_table *stab); + int skb_do_redirect(struct sk_buff *); + +-static inline void skb_reset_tc(struct sk_buff *skb) +-{ +-#ifdef CONFIG_NET_CLS_ACT +- skb->tc_redirected = 0; +-#endif +-} +- +-static inline bool skb_is_tc_redirected(const struct sk_buff *skb) +-{ +-#ifdef CONFIG_NET_CLS_ACT +- return skb->tc_redirected; +-#else +- return false; +-#endif +-} +- + static inline bool skb_at_tc_ingress(const struct sk_buff *skb) + { + #ifdef CONFIG_NET_CLS_ACT +diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h +index 564ba1b5cf57..c612cabbc378 100644 +--- a/include/trace/events/afs.h ++++ b/include/trace/events/afs.h +@@ -233,7 +233,7 @@ enum afs_cb_break_reason { + EM(afs_call_trace_get, "GET ") \ + EM(afs_call_trace_put, "PUT ") \ + EM(afs_call_trace_wake, "WAKE ") \ +- E_(afs_call_trace_work, "WORK ") ++ E_(afs_call_trace_work, "QUEUE") + + #define afs_server_traces \ + EM(afs_server_trace_alloc, "ALLOC ") \ +diff --git a/include/uapi/linux/serio.h b/include/uapi/linux/serio.h +index 50e991952c97..ed2a96f43ce4 100644 +--- a/include/uapi/linux/serio.h ++++ b/include/uapi/linux/serio.h +@@ -9,7 +9,7 @@ + #ifndef _UAPI_SERIO_H + #define _UAPI_SERIO_H + +- ++#include + #include + + #define SPIOCSTYPE _IOW('q', 0x01, unsigned long) +@@ -18,10 +18,10 @@ + /* + * bit masks for use in "interrupt" flags (3rd argument) + */ +-#define SERIO_TIMEOUT BIT(0) +-#define SERIO_PARITY BIT(1) +-#define SERIO_FRAME BIT(2) +-#define SERIO_OOB_DATA BIT(3) ++#define SERIO_TIMEOUT _BITUL(0) ++#define SERIO_PARITY _BITUL(1) ++#define SERIO_FRAME _BITUL(2) ++#define SERIO_OOB_DATA _BITUL(3) + + /* + * Serio types +diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c +index 29c7c06c6bd6..b774e2210f7d 100644 +--- a/kernel/bpf/btf.c ++++ b/kernel/bpf/btf.c +@@ -2309,7 +2309,7 @@ static int btf_enum_check_member(struct btf_verifier_env *env, + + struct_size = struct_type->size; + bytes_offset = BITS_ROUNDDOWN_BYTES(struct_bits_off); +- if (struct_size - bytes_offset < sizeof(int)) { ++ if (struct_size - bytes_offset < member_type->size) { + btf_verifier_log_member(env, struct_type, member, + "Member exceeds struct_size"); + return -EINVAL; +diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c +index 8bd69062fbe5..869e2e1860e8 100644 +--- a/kernel/bpf/cgroup.c ++++ b/kernel/bpf/cgroup.c +@@ -228,6 +228,9 @@ cleanup: + for (i = 0; i < NR; i++) + bpf_prog_array_free(arrays[i]); + ++ for (p = cgroup_parent(cgrp); p; p = cgroup_parent(p)) ++ cgroup_bpf_put(p); ++ + percpu_ref_exit(&cgrp->bpf.refcnt); + + return -ENOMEM; +@@ -300,8 +303,8 @@ int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, + { + struct list_head *progs = &cgrp->bpf.progs[type]; + struct bpf_prog *old_prog = NULL; +- struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE], +- *old_storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {NULL}; ++ struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {}; ++ struct bpf_cgroup_storage *old_storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {}; + enum bpf_cgroup_storage_type stype; + struct bpf_prog_list *pl; + bool pl_was_allocated; +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c +index b2817d0929b3..a0b76b360d6f 100644 +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -979,17 +979,6 @@ static void __reg_bound_offset(struct bpf_reg_state *reg) + reg->umax_value)); + } + +-static void __reg_bound_offset32(struct bpf_reg_state *reg) +-{ +- u64 mask = 0xffffFFFF; +- struct tnum range = tnum_range(reg->umin_value & mask, +- reg->umax_value & mask); +- struct tnum lo32 = tnum_cast(reg->var_off, 4); +- struct tnum hi32 = tnum_lshift(tnum_rshift(reg->var_off, 32), 32); +- +- reg->var_off = tnum_or(hi32, tnum_intersect(lo32, range)); +-} +- + /* Reset the min/max bounds of a register */ + static void __mark_reg_unbounded(struct bpf_reg_state *reg) + { +@@ -5452,10 +5441,6 @@ static void reg_set_min_max(struct bpf_reg_state *true_reg, + /* We might have learned some bits from the bounds. */ + __reg_bound_offset(false_reg); + __reg_bound_offset(true_reg); +- if (is_jmp32) { +- __reg_bound_offset32(false_reg); +- __reg_bound_offset32(true_reg); +- } + /* Intersecting with the old var_off might have improved our bounds + * slightly. e.g. if umax was 0x7f...f and var_off was (0; 0xf...fc), + * then new var_off is (0; 0x7f...fc) which improves our umax. +@@ -5565,10 +5550,6 @@ static void reg_set_min_max_inv(struct bpf_reg_state *true_reg, + /* We might have learned some bits from the bounds. */ + __reg_bound_offset(false_reg); + __reg_bound_offset(true_reg); +- if (is_jmp32) { +- __reg_bound_offset32(false_reg); +- __reg_bound_offset32(true_reg); +- } + /* Intersecting with the old var_off might have improved our bounds + * slightly. e.g. if umax was 0x7f...f and var_off was (0; 0xf...fc), + * then new var_off is (0; 0x7f...fc) which improves our umax. +diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c +index 7f83f4121d8d..f684c82efc2e 100644 +--- a/kernel/cgroup/cgroup-v1.c ++++ b/kernel/cgroup/cgroup-v1.c +@@ -473,6 +473,7 @@ static void *cgroup_pidlist_next(struct seq_file *s, void *v, loff_t *pos) + */ + p++; + if (p >= end) { ++ (*pos)++; + return NULL; + } else { + *pos = *p; +@@ -783,7 +784,7 @@ void cgroup1_release_agent(struct work_struct *work) + + pathbuf = kmalloc(PATH_MAX, GFP_KERNEL); + agentbuf = kstrdup(cgrp->root->release_agent_path, GFP_KERNEL); +- if (!pathbuf || !agentbuf) ++ if (!pathbuf || !agentbuf || !strlen(agentbuf)) + goto out; + + spin_lock_irq(&css_set_lock); +diff --git a/kernel/fork.c b/kernel/fork.c +index 755d8160e001..27c0ef30002e 100644 +--- a/kernel/fork.c ++++ b/kernel/fork.c +@@ -394,8 +394,8 @@ static void account_kernel_stack(struct task_struct *tsk, int account) + mod_zone_page_state(page_zone(first_page), NR_KERNEL_STACK_KB, + THREAD_SIZE / 1024 * account); + +- mod_memcg_page_state(first_page, MEMCG_KERNEL_STACK_KB, +- account * (THREAD_SIZE / 1024)); ++ mod_memcg_obj_state(stack, MEMCG_KERNEL_STACK_KB, ++ account * (THREAD_SIZE / 1024)); + } + } + +diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c +index 55b080101a20..b304c17d53a3 100644 +--- a/kernel/irq/manage.c ++++ b/kernel/irq/manage.c +@@ -284,7 +284,11 @@ int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask, + + if (desc->affinity_notify) { + kref_get(&desc->affinity_notify->kref); +- schedule_work(&desc->affinity_notify->work); ++ if (!schedule_work(&desc->affinity_notify->work)) { ++ /* Work was already scheduled, drop our extra ref */ ++ kref_put(&desc->affinity_notify->kref, ++ desc->affinity_notify->release); ++ } + } + irqd_set(data, IRQD_AFFINITY_SET); + +@@ -384,7 +388,10 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify) + raw_spin_unlock_irqrestore(&desc->lock, flags); + + if (old_notify) { +- cancel_work_sync(&old_notify->work); ++ if (cancel_work_sync(&old_notify->work)) { ++ /* Pending work had a ref, put that one too */ ++ kref_put(&old_notify->kref, old_notify->release); ++ } + kref_put(&old_notify->kref, old_notify->release); + } + +diff --git a/mm/memcontrol.c b/mm/memcontrol.c +index d804efb372e2..5d0575d633d2 100644 +--- a/mm/memcontrol.c ++++ b/mm/memcontrol.c +@@ -786,6 +786,17 @@ void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, int val) + rcu_read_unlock(); + } + ++void mod_memcg_obj_state(void *p, int idx, int val) ++{ ++ struct mem_cgroup *memcg; ++ ++ rcu_read_lock(); ++ memcg = mem_cgroup_from_obj(p); ++ if (memcg) ++ mod_memcg_state(memcg, idx, val); ++ rcu_read_unlock(); ++} ++ + /** + * __count_memcg_events - account VM events in a cgroup + * @memcg: the memory cgroup +@@ -2778,6 +2789,33 @@ static void commit_charge(struct page *page, struct mem_cgroup *memcg, + } + + #ifdef CONFIG_MEMCG_KMEM ++/* ++ * Returns a pointer to the memory cgroup to which the kernel object is charged. ++ * ++ * The caller must ensure the memcg lifetime, e.g. by taking rcu_read_lock(), ++ * cgroup_mutex, etc. ++ */ ++struct mem_cgroup *mem_cgroup_from_obj(void *p) ++{ ++ struct page *page; ++ ++ if (mem_cgroup_disabled()) ++ return NULL; ++ ++ page = virt_to_head_page(p); ++ ++ /* ++ * Slab pages don't have page->mem_cgroup set because corresponding ++ * kmem caches can be reparented during the lifetime. That's why ++ * memcg_from_slab_page() should be used instead. ++ */ ++ if (PageSlab(page)) ++ return memcg_from_slab_page(page); ++ ++ /* All other pages use page->mem_cgroup */ ++ return page->mem_cgroup; ++} ++ + static int memcg_alloc_cache_id(void) + { + int id, size; +diff --git a/mm/sparse.c b/mm/sparse.c +index a18ad9390d9f..78bbecd904c3 100644 +--- a/mm/sparse.c ++++ b/mm/sparse.c +@@ -789,6 +789,12 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, + ms->usage = NULL; + } + memmap = sparse_decode_mem_map(ms->section_mem_map, section_nr); ++ /* ++ * Mark the section invalid so that valid_section() ++ * return false. This prevents code from dereferencing ++ * ms->usage array. ++ */ ++ ms->section_mem_map &= ~SECTION_HAS_MEM_MAP; + } + + if (section_is_early && memmap) +diff --git a/mm/swapfile.c b/mm/swapfile.c +index dab43523afdd..891a3ef48651 100644 +--- a/mm/swapfile.c ++++ b/mm/swapfile.c +@@ -2892,10 +2892,6 @@ static int claim_swapfile(struct swap_info_struct *p, struct inode *inode) + p->bdev = inode->i_sb->s_bdev; + } + +- inode_lock(inode); +- if (IS_SWAPFILE(inode)) +- return -EBUSY; +- + return 0; + } + +@@ -3150,17 +3146,22 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) + mapping = swap_file->f_mapping; + inode = mapping->host; + +- /* If S_ISREG(inode->i_mode) will do inode_lock(inode); */ + error = claim_swapfile(p, inode); + if (unlikely(error)) + goto bad_swap; + ++ inode_lock(inode); ++ if (IS_SWAPFILE(inode)) { ++ error = -EBUSY; ++ goto bad_swap_unlock_inode; ++ } ++ + /* + * Read the swap header. + */ + if (!mapping->a_ops->readpage) { + error = -EINVAL; +- goto bad_swap; ++ goto bad_swap_unlock_inode; + } + page = read_mapping_page(mapping, 0, swap_file); + if (IS_ERR(page)) { +@@ -3172,14 +3173,14 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) + maxpages = read_swap_header(p, swap_header, inode); + if (unlikely(!maxpages)) { + error = -EINVAL; +- goto bad_swap; ++ goto bad_swap_unlock_inode; + } + + /* OK, set up the swap map and apply the bad block list */ + swap_map = vzalloc(maxpages); + if (!swap_map) { + error = -ENOMEM; +- goto bad_swap; ++ goto bad_swap_unlock_inode; + } + + if (bdi_cap_stable_pages_required(inode_to_bdi(inode))) +@@ -3204,7 +3205,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) + GFP_KERNEL); + if (!cluster_info) { + error = -ENOMEM; +- goto bad_swap; ++ goto bad_swap_unlock_inode; + } + + for (ci = 0; ci < nr_cluster; ci++) +@@ -3213,7 +3214,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) + p->percpu_cluster = alloc_percpu(struct percpu_cluster); + if (!p->percpu_cluster) { + error = -ENOMEM; +- goto bad_swap; ++ goto bad_swap_unlock_inode; + } + for_each_possible_cpu(cpu) { + struct percpu_cluster *cluster; +@@ -3227,13 +3228,13 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) + + error = swap_cgroup_swapon(p->type, maxpages); + if (error) +- goto bad_swap; ++ goto bad_swap_unlock_inode; + + nr_extents = setup_swap_map_and_extents(p, swap_header, swap_map, + cluster_info, maxpages, &span); + if (unlikely(nr_extents < 0)) { + error = nr_extents; +- goto bad_swap; ++ goto bad_swap_unlock_inode; + } + /* frontswap enabled? set up bit-per-page map for frontswap */ + if (IS_ENABLED(CONFIG_FRONTSWAP)) +@@ -3273,7 +3274,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) + + error = init_swap_address_space(p->type, maxpages); + if (error) +- goto bad_swap; ++ goto bad_swap_unlock_inode; + + /* + * Flush any pending IO and dirty mappings before we start using this +@@ -3283,7 +3284,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) + error = inode_drain_writes(inode); + if (error) { + inode->i_flags &= ~S_SWAPFILE; +- goto bad_swap; ++ goto bad_swap_unlock_inode; + } + + mutex_lock(&swapon_mutex); +@@ -3308,6 +3309,8 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) + + error = 0; + goto out; ++bad_swap_unlock_inode: ++ inode_unlock(inode); + bad_swap: + free_percpu(p->percpu_cluster); + p->percpu_cluster = NULL; +@@ -3315,6 +3318,7 @@ bad_swap: + set_blocksize(p->bdev, p->old_block_size); + blkdev_put(p->bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL); + } ++ inode = NULL; + destroy_swap_extents(p); + swap_cgroup_swapoff(p->type); + spin_lock(&swap_lock); +@@ -3326,13 +3330,8 @@ bad_swap: + kvfree(frontswap_map); + if (inced_nr_rotate_swap) + atomic_dec(&nr_rotate_swap); +- if (swap_file) { +- if (inode) { +- inode_unlock(inode); +- inode = NULL; +- } ++ if (swap_file) + filp_close(swap_file, NULL); +- } + out: + if (page && !IS_ERR(page)) { + kunmap(page); +diff --git a/net/Kconfig b/net/Kconfig +index 3101bfcbdd7a..0b2fecc83452 100644 +--- a/net/Kconfig ++++ b/net/Kconfig +@@ -52,6 +52,9 @@ config NET_INGRESS + config NET_EGRESS + bool + ++config NET_REDIRECT ++ bool ++ + config SKB_EXTENSIONS + bool + +diff --git a/net/bpfilter/main.c b/net/bpfilter/main.c +index 77396a098fbe..efea4874743e 100644 +--- a/net/bpfilter/main.c ++++ b/net/bpfilter/main.c +@@ -10,7 +10,7 @@ + #include + #include "msgfmt.h" + +-int debug_fd; ++FILE *debug_f; + + static int handle_get_cmd(struct mbox_request *cmd) + { +@@ -35,9 +35,10 @@ static void loop(void) + struct mbox_reply reply; + int n; + ++ fprintf(debug_f, "testing the buffer\n"); + n = read(0, &req, sizeof(req)); + if (n != sizeof(req)) { +- dprintf(debug_fd, "invalid request %d\n", n); ++ fprintf(debug_f, "invalid request %d\n", n); + return; + } + +@@ -47,7 +48,7 @@ static void loop(void) + + n = write(1, &reply, sizeof(reply)); + if (n != sizeof(reply)) { +- dprintf(debug_fd, "reply failed %d\n", n); ++ fprintf(debug_f, "reply failed %d\n", n); + return; + } + } +@@ -55,9 +56,10 @@ static void loop(void) + + int main(void) + { +- debug_fd = open("/dev/kmsg", 00000002); +- dprintf(debug_fd, "Started bpfilter\n"); ++ debug_f = fopen("/dev/kmsg", "w"); ++ setvbuf(debug_f, 0, _IOLBF, 0); ++ fprintf(debug_f, "Started bpfilter\n"); + loop(); +- close(debug_fd); ++ fclose(debug_f); + return 0; + } +diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c +index 4e0de14f80bb..2a6e63a8edbe 100644 +--- a/net/ceph/osdmap.c ++++ b/net/ceph/osdmap.c +@@ -710,6 +710,15 @@ int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name) + } + EXPORT_SYMBOL(ceph_pg_poolid_by_name); + ++u64 ceph_pg_pool_flags(struct ceph_osdmap *map, u64 id) ++{ ++ struct ceph_pg_pool_info *pi; ++ ++ pi = __lookup_pg_pool(&map->pg_pools, id); ++ return pi ? pi->flags : 0; ++} ++EXPORT_SYMBOL(ceph_pg_pool_flags); ++ + static void __remove_pg_pool(struct rb_root *root, struct ceph_pg_pool_info *pi) + { + rb_erase(&pi->node, root); +diff --git a/net/core/dev.c b/net/core/dev.c +index db8c229e0f4a..931dfdcbabf1 100644 +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -4237,7 +4237,7 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb, + /* Reinjected packets coming from act_mirred or similar should + * not get XDP generic processing. + */ +- if (skb_is_tc_redirected(skb)) ++ if (skb_is_redirected(skb)) + return XDP_PASS; + + /* XDP packets must be linear and must have sufficient headroom +@@ -4786,7 +4786,7 @@ skip_taps: + goto out; + } + #endif +- skb_reset_tc(skb); ++ skb_reset_redirect(skb); + skip_classify: + if (pfmemalloc && !skb_pfmemalloc_protocol(skb)) + goto drop; +diff --git a/net/core/pktgen.c b/net/core/pktgen.c +index 48b1e429857c..cb3b565ff5ad 100644 +--- a/net/core/pktgen.c ++++ b/net/core/pktgen.c +@@ -3362,7 +3362,7 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) + /* skb was 'freed' by stack, so clean few + * bits and reuse it + */ +- skb_reset_tc(skb); ++ skb_reset_redirect(skb); + } while (--burst > 0); + goto out; /* Skips xmit_mode M_START_XMIT */ + } else if (pkt_dev->xmit_mode == M_QUEUE_XMIT) { +diff --git a/net/core/sock_map.c b/net/core/sock_map.c +index 405397801bb0..8291568b707f 100644 +--- a/net/core/sock_map.c ++++ b/net/core/sock_map.c +@@ -233,8 +233,11 @@ static void sock_map_free(struct bpf_map *map) + struct bpf_stab *stab = container_of(map, struct bpf_stab, map); + int i; + ++ /* After the sync no updates or deletes will be in-flight so it ++ * is safe to walk map and remove entries without risking a race ++ * in EEXIST update case. ++ */ + synchronize_rcu(); +- raw_spin_lock_bh(&stab->lock); + for (i = 0; i < stab->map.max_entries; i++) { + struct sock **psk = &stab->sks[i]; + struct sock *sk; +@@ -248,7 +251,6 @@ static void sock_map_free(struct bpf_map *map) + release_sock(sk); + } + } +- raw_spin_unlock_bh(&stab->lock); + + /* wait for psock readers accessing its map link */ + synchronize_rcu(); +@@ -863,10 +865,13 @@ static void sock_hash_free(struct bpf_map *map) + struct hlist_node *node; + int i; + ++ /* After the sync no updates or deletes will be in-flight so it ++ * is safe to walk map and remove entries without risking a race ++ * in EEXIST update case. ++ */ + synchronize_rcu(); + for (i = 0; i < htab->buckets_num; i++) { + bucket = sock_hash_select_bucket(htab, i); +- raw_spin_lock_bh(&bucket->lock); + hlist_for_each_entry_safe(elem, node, &bucket->head, node) { + hlist_del_rcu(&elem->node); + lock_sock(elem->sk); +@@ -875,7 +880,6 @@ static void sock_hash_free(struct bpf_map *map) + rcu_read_unlock(); + release_sock(elem->sk); + } +- raw_spin_unlock_bh(&bucket->lock); + } + + /* wait for psock readers accessing its map link */ +diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c +index 9e5a883a9f0c..ebe73848d1cf 100644 +--- a/net/dsa/tag_8021q.c ++++ b/net/dsa/tag_8021q.c +@@ -299,49 +299,6 @@ struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev, + } + EXPORT_SYMBOL_GPL(dsa_8021q_xmit); + +-/* In the DSA packet_type handler, skb->data points in the middle of the VLAN +- * tag, after tpid and before tci. This is because so far, ETH_HLEN +- * (DMAC, SMAC, EtherType) bytes were pulled. +- * There are 2 bytes of VLAN tag left in skb->data, and upper +- * layers expect the 'real' EtherType to be consumed as well. +- * Coincidentally, a VLAN header is also of the same size as +- * the number of bytes that need to be pulled. +- * +- * skb_mac_header skb->data +- * | | +- * v v +- * | | | | | | | | | | | | | | | | | | | +- * +-----------------------+-----------------------+-------+-------+-------+ +- * | Destination MAC | Source MAC | TPID | TCI | EType | +- * +-----------------------+-----------------------+-------+-------+-------+ +- * ^ | | +- * |<--VLAN_HLEN-->to <---VLAN_HLEN---> +- * from | +- * >>>>>>> v +- * >>>>>>> | | | | | | | | | | | | | | | +- * >>>>>>> +-----------------------+-----------------------+-------+ +- * >>>>>>> | Destination MAC | Source MAC | EType | +- * +-----------------------+-----------------------+-------+ +- * ^ ^ +- * (now part of | | +- * skb->head) skb_mac_header skb->data +- */ +-struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb) +-{ +- u8 *from = skb_mac_header(skb); +- u8 *dest = from + VLAN_HLEN; +- +- memmove(dest, from, ETH_HLEN - VLAN_HLEN); +- skb_pull(skb, VLAN_HLEN); +- skb_push(skb, ETH_HLEN); +- skb_reset_mac_header(skb); +- skb_reset_mac_len(skb); +- skb_pull_rcsum(skb, ETH_HLEN); +- +- return skb; +-} +-EXPORT_SYMBOL_GPL(dsa_8021q_remove_header); +- + static const struct dsa_device_ops dsa_8021q_netdev_ops = { + .name = "8021q", + .proto = DSA_TAG_PROTO_8021Q, +diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c +index 9c3114179690..9169b63a89e3 100644 +--- a/net/dsa/tag_brcm.c ++++ b/net/dsa/tag_brcm.c +@@ -140,6 +140,8 @@ static struct sk_buff *brcm_tag_rcv_ll(struct sk_buff *skb, + /* Remove Broadcom tag and update checksum */ + skb_pull_rcsum(skb, BRCM_TAG_LEN); + ++ skb->offload_fwd_mark = 1; ++ + return skb; + } + #endif +diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c +index 63ef2a14c934..12f3ce52e62e 100644 +--- a/net/dsa/tag_sja1105.c ++++ b/net/dsa/tag_sja1105.c +@@ -238,14 +238,14 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb, + { + struct sja1105_meta meta = {0}; + int source_port, switch_id; +- struct vlan_ethhdr *hdr; ++ struct ethhdr *hdr; + u16 tpid, vid, tci; + bool is_link_local; + bool is_tagged; + bool is_meta; + +- hdr = vlan_eth_hdr(skb); +- tpid = ntohs(hdr->h_vlan_proto); ++ hdr = eth_hdr(skb); ++ tpid = ntohs(hdr->h_proto); + is_tagged = (tpid == ETH_P_SJA1105); + is_link_local = sja1105_is_link_local(skb); + is_meta = sja1105_is_meta_frame(skb); +@@ -254,7 +254,12 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb, + + if (is_tagged) { + /* Normal traffic path. */ +- tci = ntohs(hdr->h_vlan_TCI); ++ skb_push_rcsum(skb, ETH_HLEN); ++ __skb_vlan_pop(skb, &tci); ++ skb_pull_rcsum(skb, ETH_HLEN); ++ skb_reset_network_header(skb); ++ skb_reset_transport_header(skb); ++ + vid = tci & VLAN_VID_MASK; + source_port = dsa_8021q_rx_source_port(vid); + switch_id = dsa_8021q_rx_switch_id(vid); +@@ -283,12 +288,6 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb, + return NULL; + } + +- /* Delete/overwrite fake VLAN header, DSA expects to not find +- * it there, see dsa_switch_rcv: skb_push(skb, ETH_HLEN). +- */ +- if (is_tagged) +- skb = dsa_8021q_remove_header(skb); +- + return sja1105_rcv_meta_state_machine(skb, &meta, is_link_local, + is_meta); + } +diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c +index 27dc65d7de67..002f341f3564 100644 +--- a/net/hsr/hsr_framereg.c ++++ b/net/hsr/hsr_framereg.c +@@ -482,12 +482,9 @@ int hsr_get_node_data(struct hsr_priv *hsr, + struct hsr_port *port; + unsigned long tdiff; + +- rcu_read_lock(); + node = find_node_by_addr_A(&hsr->node_db, addr); +- if (!node) { +- rcu_read_unlock(); +- return -ENOENT; /* No such entry */ +- } ++ if (!node) ++ return -ENOENT; + + ether_addr_copy(addr_b, node->macaddress_B); + +@@ -522,7 +519,5 @@ int hsr_get_node_data(struct hsr_priv *hsr, + *addr_b_ifindex = -1; + } + +- rcu_read_unlock(); +- + return 0; + } +diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c +index 8dc0547f01d0..fae21c863b1f 100644 +--- a/net/hsr/hsr_netlink.c ++++ b/net/hsr/hsr_netlink.c +@@ -251,15 +251,16 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info) + if (!na) + goto invalid; + +- hsr_dev = __dev_get_by_index(genl_info_net(info), +- nla_get_u32(info->attrs[HSR_A_IFINDEX])); ++ rcu_read_lock(); ++ hsr_dev = dev_get_by_index_rcu(genl_info_net(info), ++ nla_get_u32(info->attrs[HSR_A_IFINDEX])); + if (!hsr_dev) +- goto invalid; ++ goto rcu_unlock; + if (!is_hsr_master(hsr_dev)) +- goto invalid; ++ goto rcu_unlock; + + /* Send reply */ +- skb_out = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); ++ skb_out = genlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC); + if (!skb_out) { + res = -ENOMEM; + goto fail; +@@ -313,12 +314,10 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info) + res = nla_put_u16(skb_out, HSR_A_IF1_SEQ, hsr_node_if1_seq); + if (res < 0) + goto nla_put_failure; +- rcu_read_lock(); + port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_A); + if (port) + res = nla_put_u32(skb_out, HSR_A_IF1_IFINDEX, + port->dev->ifindex); +- rcu_read_unlock(); + if (res < 0) + goto nla_put_failure; + +@@ -328,20 +327,22 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info) + res = nla_put_u16(skb_out, HSR_A_IF2_SEQ, hsr_node_if2_seq); + if (res < 0) + goto nla_put_failure; +- rcu_read_lock(); + port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_B); + if (port) + res = nla_put_u32(skb_out, HSR_A_IF2_IFINDEX, + port->dev->ifindex); +- rcu_read_unlock(); + if (res < 0) + goto nla_put_failure; + ++ rcu_read_unlock(); ++ + genlmsg_end(skb_out, msg_head); + genlmsg_unicast(genl_info_net(info), skb_out, info->snd_portid); + + return 0; + ++rcu_unlock: ++ rcu_read_unlock(); + invalid: + netlink_ack(skb_in, nlmsg_hdr(skb_in), -EINVAL, NULL); + return 0; +@@ -351,6 +352,7 @@ nla_put_failure: + /* Fall through */ + + fail: ++ rcu_read_unlock(); + return res; + } + +@@ -358,16 +360,14 @@ fail: + */ + static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info) + { +- /* For receiving */ +- struct nlattr *na; ++ unsigned char addr[ETH_ALEN]; + struct net_device *hsr_dev; +- +- /* For sending */ + struct sk_buff *skb_out; +- void *msg_head; + struct hsr_priv *hsr; +- void *pos; +- unsigned char addr[ETH_ALEN]; ++ bool restart = false; ++ struct nlattr *na; ++ void *pos = NULL; ++ void *msg_head; + int res; + + if (!info) +@@ -377,15 +377,17 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info) + if (!na) + goto invalid; + +- hsr_dev = __dev_get_by_index(genl_info_net(info), +- nla_get_u32(info->attrs[HSR_A_IFINDEX])); ++ rcu_read_lock(); ++ hsr_dev = dev_get_by_index_rcu(genl_info_net(info), ++ nla_get_u32(info->attrs[HSR_A_IFINDEX])); + if (!hsr_dev) +- goto invalid; ++ goto rcu_unlock; + if (!is_hsr_master(hsr_dev)) +- goto invalid; ++ goto rcu_unlock; + ++restart: + /* Send reply */ +- skb_out = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); ++ skb_out = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_ATOMIC); + if (!skb_out) { + res = -ENOMEM; + goto fail; +@@ -399,18 +401,26 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info) + goto nla_put_failure; + } + +- res = nla_put_u32(skb_out, HSR_A_IFINDEX, hsr_dev->ifindex); +- if (res < 0) +- goto nla_put_failure; ++ if (!restart) { ++ res = nla_put_u32(skb_out, HSR_A_IFINDEX, hsr_dev->ifindex); ++ if (res < 0) ++ goto nla_put_failure; ++ } + + hsr = netdev_priv(hsr_dev); + +- rcu_read_lock(); +- pos = hsr_get_next_node(hsr, NULL, addr); ++ if (!pos) ++ pos = hsr_get_next_node(hsr, NULL, addr); + while (pos) { + res = nla_put(skb_out, HSR_A_NODE_ADDR, ETH_ALEN, addr); + if (res < 0) { +- rcu_read_unlock(); ++ if (res == -EMSGSIZE) { ++ genlmsg_end(skb_out, msg_head); ++ genlmsg_unicast(genl_info_net(info), skb_out, ++ info->snd_portid); ++ restart = true; ++ goto restart; ++ } + goto nla_put_failure; + } + pos = hsr_get_next_node(hsr, pos, addr); +@@ -422,15 +432,18 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info) + + return 0; + ++rcu_unlock: ++ rcu_read_unlock(); + invalid: + netlink_ack(skb_in, nlmsg_hdr(skb_in), -EINVAL, NULL); + return 0; + + nla_put_failure: +- kfree_skb(skb_out); ++ nlmsg_free(skb_out); + /* Fall through */ + + fail: ++ rcu_read_unlock(); + return res; + } + +@@ -457,6 +470,7 @@ static struct genl_family hsr_genl_family __ro_after_init = { + .version = 1, + .maxattr = HSR_A_MAX, + .policy = hsr_genl_policy, ++ .netnsok = true, + .module = THIS_MODULE, + .ops = hsr_ops, + .n_ops = ARRAY_SIZE(hsr_ops), +diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c +index fbfd0db182b7..a9104d42aafb 100644 +--- a/net/hsr/hsr_slave.c ++++ b/net/hsr/hsr_slave.c +@@ -145,16 +145,16 @@ int hsr_add_port(struct hsr_priv *hsr, struct net_device *dev, + if (!port) + return -ENOMEM; + ++ port->hsr = hsr; ++ port->dev = dev; ++ port->type = type; ++ + if (type != HSR_PT_MASTER) { + res = hsr_portdev_setup(dev, port); + if (res) + goto fail_dev_setup; + } + +- port->hsr = hsr; +- port->dev = dev; +- port->type = type; +- + list_add_tail_rcu(&port->port_list, &hsr->ports); + synchronize_rcu(); + +diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig +index 03381f3e12ba..a926de2e42b5 100644 +--- a/net/ipv4/Kconfig ++++ b/net/ipv4/Kconfig +@@ -303,6 +303,7 @@ config SYN_COOKIES + + config NET_IPVTI + tristate "Virtual (secure) IP: tunneling" ++ depends on IPV6 || IPV6=n + select INET_TUNNEL + select NET_IP_TUNNEL + select XFRM +diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c +index 71c78d223dfd..48bf3b9be475 100644 +--- a/net/ipv4/fib_frontend.c ++++ b/net/ipv4/fib_frontend.c +@@ -1007,7 +1007,9 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) + return -ENOENT; + } + ++ rcu_read_lock(); + err = fib_table_dump(tb, skb, cb, &filter); ++ rcu_read_unlock(); + return skb->len ? : err; + } + +diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c +index 10636fb6093e..85ba1453ba5c 100644 +--- a/net/ipv4/ip_gre.c ++++ b/net/ipv4/ip_gre.c +@@ -1149,6 +1149,24 @@ static int ipgre_netlink_parms(struct net_device *dev, + if (data[IFLA_GRE_FWMARK]) + *fwmark = nla_get_u32(data[IFLA_GRE_FWMARK]); + ++ return 0; ++} ++ ++static int erspan_netlink_parms(struct net_device *dev, ++ struct nlattr *data[], ++ struct nlattr *tb[], ++ struct ip_tunnel_parm *parms, ++ __u32 *fwmark) ++{ ++ struct ip_tunnel *t = netdev_priv(dev); ++ int err; ++ ++ err = ipgre_netlink_parms(dev, data, tb, parms, fwmark); ++ if (err) ++ return err; ++ if (!data) ++ return 0; ++ + if (data[IFLA_GRE_ERSPAN_VER]) { + t->erspan_ver = nla_get_u8(data[IFLA_GRE_ERSPAN_VER]); + +@@ -1272,45 +1290,70 @@ static void ipgre_tap_setup(struct net_device *dev) + ip_tunnel_setup(dev, gre_tap_net_id); + } + +-static int ipgre_newlink(struct net *src_net, struct net_device *dev, +- struct nlattr *tb[], struct nlattr *data[], +- struct netlink_ext_ack *extack) ++static int ++ipgre_newlink_encap_setup(struct net_device *dev, struct nlattr *data[]) + { +- struct ip_tunnel_parm p; + struct ip_tunnel_encap ipencap; +- __u32 fwmark = 0; +- int err; + + if (ipgre_netlink_encap_parms(data, &ipencap)) { + struct ip_tunnel *t = netdev_priv(dev); +- err = ip_tunnel_encap_setup(t, &ipencap); ++ int err = ip_tunnel_encap_setup(t, &ipencap); + + if (err < 0) + return err; + } + ++ return 0; ++} ++ ++static int ipgre_newlink(struct net *src_net, struct net_device *dev, ++ struct nlattr *tb[], struct nlattr *data[], ++ struct netlink_ext_ack *extack) ++{ ++ struct ip_tunnel_parm p; ++ __u32 fwmark = 0; ++ int err; ++ ++ err = ipgre_newlink_encap_setup(dev, data); ++ if (err) ++ return err; ++ + err = ipgre_netlink_parms(dev, data, tb, &p, &fwmark); + if (err < 0) + return err; + return ip_tunnel_newlink(dev, tb, &p, fwmark); + } + ++static int erspan_newlink(struct net *src_net, struct net_device *dev, ++ struct nlattr *tb[], struct nlattr *data[], ++ struct netlink_ext_ack *extack) ++{ ++ struct ip_tunnel_parm p; ++ __u32 fwmark = 0; ++ int err; ++ ++ err = ipgre_newlink_encap_setup(dev, data); ++ if (err) ++ return err; ++ ++ err = erspan_netlink_parms(dev, data, tb, &p, &fwmark); ++ if (err) ++ return err; ++ return ip_tunnel_newlink(dev, tb, &p, fwmark); ++} ++ + static int ipgre_changelink(struct net_device *dev, struct nlattr *tb[], + struct nlattr *data[], + struct netlink_ext_ack *extack) + { + struct ip_tunnel *t = netdev_priv(dev); +- struct ip_tunnel_encap ipencap; + __u32 fwmark = t->fwmark; + struct ip_tunnel_parm p; + int err; + +- if (ipgre_netlink_encap_parms(data, &ipencap)) { +- err = ip_tunnel_encap_setup(t, &ipencap); +- +- if (err < 0) +- return err; +- } ++ err = ipgre_newlink_encap_setup(dev, data); ++ if (err) ++ return err; + + err = ipgre_netlink_parms(dev, data, tb, &p, &fwmark); + if (err < 0) +@@ -1323,8 +1366,34 @@ static int ipgre_changelink(struct net_device *dev, struct nlattr *tb[], + t->parms.i_flags = p.i_flags; + t->parms.o_flags = p.o_flags; + +- if (strcmp(dev->rtnl_link_ops->kind, "erspan")) +- ipgre_link_update(dev, !tb[IFLA_MTU]); ++ ipgre_link_update(dev, !tb[IFLA_MTU]); ++ ++ return 0; ++} ++ ++static int erspan_changelink(struct net_device *dev, struct nlattr *tb[], ++ struct nlattr *data[], ++ struct netlink_ext_ack *extack) ++{ ++ struct ip_tunnel *t = netdev_priv(dev); ++ __u32 fwmark = t->fwmark; ++ struct ip_tunnel_parm p; ++ int err; ++ ++ err = ipgre_newlink_encap_setup(dev, data); ++ if (err) ++ return err; ++ ++ err = erspan_netlink_parms(dev, data, tb, &p, &fwmark); ++ if (err < 0) ++ return err; ++ ++ err = ip_tunnel_changelink(dev, tb, &p, fwmark); ++ if (err < 0) ++ return err; ++ ++ t->parms.i_flags = p.i_flags; ++ t->parms.o_flags = p.o_flags; + + return 0; + } +@@ -1515,8 +1584,8 @@ static struct rtnl_link_ops erspan_link_ops __read_mostly = { + .priv_size = sizeof(struct ip_tunnel), + .setup = erspan_setup, + .validate = erspan_validate, +- .newlink = ipgre_newlink, +- .changelink = ipgre_changelink, ++ .newlink = erspan_newlink, ++ .changelink = erspan_changelink, + .dellink = ip_tunnel_dellink, + .get_size = ipgre_get_size, + .fill_info = ipgre_fill_info, +diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c +index 79eef5db336a..8ecaf0f26973 100644 +--- a/net/ipv4/ip_vti.c ++++ b/net/ipv4/ip_vti.c +@@ -187,17 +187,39 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev, + int mtu; + + if (!dst) { +- struct rtable *rt; +- +- fl->u.ip4.flowi4_oif = dev->ifindex; +- fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC; +- rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4); +- if (IS_ERR(rt)) { ++ switch (skb->protocol) { ++ case htons(ETH_P_IP): { ++ struct rtable *rt; ++ ++ fl->u.ip4.flowi4_oif = dev->ifindex; ++ fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC; ++ rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4); ++ if (IS_ERR(rt)) { ++ dev->stats.tx_carrier_errors++; ++ goto tx_error_icmp; ++ } ++ dst = &rt->dst; ++ skb_dst_set(skb, dst); ++ break; ++ } ++#if IS_ENABLED(CONFIG_IPV6) ++ case htons(ETH_P_IPV6): ++ fl->u.ip6.flowi6_oif = dev->ifindex; ++ fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC; ++ dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6); ++ if (dst->error) { ++ dst_release(dst); ++ dst = NULL; ++ dev->stats.tx_carrier_errors++; ++ goto tx_error_icmp; ++ } ++ skb_dst_set(skb, dst); ++ break; ++#endif ++ default: + dev->stats.tx_carrier_errors++; + goto tx_error_icmp; + } +- dst = &rt->dst; +- skb_dst_set(skb, dst); + } + + dst_hold(dst); +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c +index deb466fc3d1f..e378ff17f8c6 100644 +--- a/net/ipv4/tcp.c ++++ b/net/ipv4/tcp.c +@@ -2943,8 +2943,10 @@ static int do_tcp_setsockopt(struct sock *sk, int level, + err = -EPERM; + else if (tp->repair_queue == TCP_SEND_QUEUE) + WRITE_ONCE(tp->write_seq, val); +- else if (tp->repair_queue == TCP_RECV_QUEUE) ++ else if (tp->repair_queue == TCP_RECV_QUEUE) { + WRITE_ONCE(tp->rcv_nxt, val); ++ WRITE_ONCE(tp->copied_seq, val); ++ } + else + err = -EINVAL; + break; +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c +index 660b24fe041e..c8d03c1b4c6b 100644 +--- a/net/ipv4/tcp_output.c ++++ b/net/ipv4/tcp_output.c +@@ -1048,6 +1048,10 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, + + if (unlikely(!skb)) + return -ENOBUFS; ++ /* retransmit skbs might have a non zero value in skb->dev ++ * because skb->dev is aliased with skb->rbnode.rb_left ++ */ ++ skb->dev = NULL; + } + + inet = inet_sk(sk); +@@ -2976,8 +2980,12 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) + + tcp_skb_tsorted_save(skb) { + nskb = __pskb_copy(skb, MAX_TCP_HEADER, GFP_ATOMIC); +- err = nskb ? tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC) : +- -ENOBUFS; ++ if (nskb) { ++ nskb->dev = NULL; ++ err = tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC); ++ } else { ++ err = -ENOBUFS; ++ } + } tcp_skb_tsorted_restore(skb); + + if (!err) { +diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c +index 524006aa0d78..cc6180e08a4f 100644 +--- a/net/ipv6/ip6_vti.c ++++ b/net/ipv6/ip6_vti.c +@@ -311,7 +311,7 @@ static int vti6_rcv(struct sk_buff *skb) + + if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { + rcu_read_unlock(); +- return 0; ++ goto discard; + } + + ipv6h = ipv6_hdr(skb); +@@ -450,15 +450,33 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) + int mtu; + + if (!dst) { +- fl->u.ip6.flowi6_oif = dev->ifindex; +- fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC; +- dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6); +- if (dst->error) { +- dst_release(dst); +- dst = NULL; ++ switch (skb->protocol) { ++ case htons(ETH_P_IP): { ++ struct rtable *rt; ++ ++ fl->u.ip4.flowi4_oif = dev->ifindex; ++ fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC; ++ rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4); ++ if (IS_ERR(rt)) ++ goto tx_err_link_failure; ++ dst = &rt->dst; ++ skb_dst_set(skb, dst); ++ break; ++ } ++ case htons(ETH_P_IPV6): ++ fl->u.ip6.flowi6_oif = dev->ifindex; ++ fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC; ++ dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6); ++ if (dst->error) { ++ dst_release(dst); ++ dst = NULL; ++ goto tx_err_link_failure; ++ } ++ skb_dst_set(skb, dst); ++ break; ++ default: + goto tx_err_link_failure; + } +- skb_dst_set(skb, dst); + } + + dst_hold(dst); +diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c +index c8ad20c28c43..70ea4cc126d1 100644 +--- a/net/mac80211/debugfs_sta.c ++++ b/net/mac80211/debugfs_sta.c +@@ -5,7 +5,7 @@ + * Copyright 2007 Johannes Berg + * Copyright 2013-2014 Intel Mobile Communications GmbH + * Copyright(c) 2016 Intel Deutschland GmbH +- * Copyright (C) 2018 - 2019 Intel Corporation ++ * Copyright (C) 2018 - 2020 Intel Corporation + */ + + #include +@@ -78,6 +78,7 @@ static const char * const sta_flag_names[] = { + FLAG(MPSP_OWNER), + FLAG(MPSP_RECIPIENT), + FLAG(PS_DELIVER), ++ FLAG(USES_ENCRYPTION), + #undef FLAG + }; + +diff --git a/net/mac80211/key.c b/net/mac80211/key.c +index 0f889b919b06..efc1acc6543c 100644 +--- a/net/mac80211/key.c ++++ b/net/mac80211/key.c +@@ -6,7 +6,7 @@ + * Copyright 2007-2008 Johannes Berg + * Copyright 2013-2014 Intel Mobile Communications GmbH + * Copyright 2015-2017 Intel Deutschland GmbH +- * Copyright 2018-2019 Intel Corporation ++ * Copyright 2018-2020 Intel Corporation + */ + + #include +@@ -262,22 +262,29 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) + sta ? sta->sta.addr : bcast_addr, ret); + } + +-int ieee80211_set_tx_key(struct ieee80211_key *key) ++static int _ieee80211_set_tx_key(struct ieee80211_key *key, bool force) + { + struct sta_info *sta = key->sta; + struct ieee80211_local *local = key->local; + + assert_key_lock(local); + ++ set_sta_flag(sta, WLAN_STA_USES_ENCRYPTION); ++ + sta->ptk_idx = key->conf.keyidx; + +- if (!ieee80211_hw_check(&local->hw, AMPDU_KEYBORDER_SUPPORT)) ++ if (force || !ieee80211_hw_check(&local->hw, AMPDU_KEYBORDER_SUPPORT)) + clear_sta_flag(sta, WLAN_STA_BLOCK_BA); + ieee80211_check_fast_xmit(sta); + + return 0; + } + ++int ieee80211_set_tx_key(struct ieee80211_key *key) ++{ ++ return _ieee80211_set_tx_key(key, false); ++} ++ + static void ieee80211_pairwise_rekey(struct ieee80211_key *old, + struct ieee80211_key *new) + { +@@ -441,11 +448,8 @@ static int ieee80211_key_replace(struct ieee80211_sub_if_data *sdata, + if (pairwise) { + rcu_assign_pointer(sta->ptk[idx], new); + if (new && +- !(new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX)) { +- sta->ptk_idx = idx; +- clear_sta_flag(sta, WLAN_STA_BLOCK_BA); +- ieee80211_check_fast_xmit(sta); +- } ++ !(new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX)) ++ _ieee80211_set_tx_key(new, true); + } else { + rcu_assign_pointer(sta->gtk[idx], new); + } +diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c +index d69983370381..38a0383dfbcf 100644 +--- a/net/mac80211/mesh_hwmp.c ++++ b/net/mac80211/mesh_hwmp.c +@@ -1152,7 +1152,8 @@ int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata, + } + } + +- if (!(mpath->flags & MESH_PATH_RESOLVING)) ++ if (!(mpath->flags & MESH_PATH_RESOLVING) && ++ mesh_path_sel_is_hwmp(sdata)) + mesh_queue_preq(mpath, PREQ_Q_F_START); + + if (skb_queue_len(&mpath->frame_queue) >= MESH_FRAME_QUEUE_LEN) +diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c +index 8d3a2389b055..21b1422b1b1c 100644 +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -4,7 +4,7 @@ + * Copyright 2006-2007 Jiri Benc + * Copyright 2013-2014 Intel Mobile Communications GmbH + * Copyright (C) 2015 - 2017 Intel Deutschland GmbH +- * Copyright (C) 2018-2019 Intel Corporation ++ * Copyright (C) 2018-2020 Intel Corporation + */ + + #include +@@ -1032,6 +1032,11 @@ static void __sta_info_destroy_part2(struct sta_info *sta) + might_sleep(); + lockdep_assert_held(&local->sta_mtx); + ++ while (sta->sta_state == IEEE80211_STA_AUTHORIZED) { ++ ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC); ++ WARN_ON_ONCE(ret); ++ } ++ + /* now keys can no longer be reached */ + ieee80211_free_sta_keys(local, sta); + +diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h +index 369c2dddce52..be1d9dfa760d 100644 +--- a/net/mac80211/sta_info.h ++++ b/net/mac80211/sta_info.h +@@ -98,6 +98,7 @@ enum ieee80211_sta_info_flags { + WLAN_STA_MPSP_OWNER, + WLAN_STA_MPSP_RECIPIENT, + WLAN_STA_PS_DELIVER, ++ WLAN_STA_USES_ENCRYPTION, + + NUM_WLAN_STA_FLAGS, + }; +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index cbd273c0b275..c8fc29f0efcf 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -5,7 +5,7 @@ + * Copyright 2006-2007 Jiri Benc + * Copyright 2007 Johannes Berg + * Copyright 2013-2014 Intel Mobile Communications GmbH +- * Copyright (C) 2018 Intel Corporation ++ * Copyright (C) 2018, 2020 Intel Corporation + * + * Transmit and frame generation functions. + */ +@@ -590,10 +590,13 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; + +- if (unlikely(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) ++ if (unlikely(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) { + tx->key = NULL; +- else if (tx->sta && +- (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx]))) ++ return TX_CONTINUE; ++ } ++ ++ if (tx->sta && ++ (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx]))) + tx->key = key; + else if (ieee80211_is_group_privacy_action(tx->skb) && + (key = rcu_dereference(tx->sdata->default_multicast_key))) +@@ -654,6 +657,9 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) + if (!skip_hw && tx->key && + tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) + info->control.hw_key = &tx->key->conf; ++ } else if (!ieee80211_is_mgmt(hdr->frame_control) && tx->sta && ++ test_sta_flag(tx->sta, WLAN_STA_USES_ENCRYPTION)) { ++ return TX_DROP; + } + + return TX_CONTINUE; +@@ -5061,6 +5067,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, + struct ieee80211_local *local = sdata->local; + struct sk_buff *skb; + struct ethhdr *ehdr; ++ u32 ctrl_flags = 0; + u32 flags; + + /* Only accept CONTROL_PORT_PROTOCOL configured in CONNECT/ASSOCIATE +@@ -5070,6 +5077,9 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, + proto != cpu_to_be16(ETH_P_PREAUTH)) + return -EINVAL; + ++ if (proto == sdata->control_port_protocol) ++ ctrl_flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO; ++ + if (unencrypted) + flags = IEEE80211_TX_INTFL_DONT_ENCRYPT; + else +@@ -5095,7 +5105,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, + skb_reset_mac_header(skb); + + local_bh_disable(); +- __ieee80211_subif_start_xmit(skb, skb->dev, flags, 0); ++ __ieee80211_subif_start_xmit(skb, skb->dev, flags, ctrl_flags); + local_bh_enable(); + + return 0; +diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c +index b9e7dd6e60ce..e92aa6b7eb80 100644 +--- a/net/netfilter/nf_flow_table_ip.c ++++ b/net/netfilter/nf_flow_table_ip.c +@@ -189,6 +189,7 @@ static int nf_flow_tuple_ip(struct sk_buff *skb, const struct net_device *dev, + if (!pskb_may_pull(skb, thoff + sizeof(*ports))) + return -1; + ++ iph = ip_hdr(skb); + ports = (struct flow_ports *)(skb_network_header(skb) + thoff); + + tuple->src_v4.s_addr = iph->saddr; +@@ -449,6 +450,7 @@ static int nf_flow_tuple_ipv6(struct sk_buff *skb, const struct net_device *dev, + if (!pskb_may_pull(skb, thoff + sizeof(*ports))) + return -1; + ++ ip6h = ipv6_hdr(skb); + ports = (struct flow_ports *)(skb_network_header(skb) + thoff); + + tuple->src_v6 = ip6h->saddr; +diff --git a/net/netfilter/nft_fwd_netdev.c b/net/netfilter/nft_fwd_netdev.c +index aba11c2333f3..3087e23297db 100644 +--- a/net/netfilter/nft_fwd_netdev.c ++++ b/net/netfilter/nft_fwd_netdev.c +@@ -28,6 +28,9 @@ static void nft_fwd_netdev_eval(const struct nft_expr *expr, + struct nft_fwd_netdev *priv = nft_expr_priv(expr); + int oif = regs->data[priv->sreg_dev]; + ++ /* This is used by ifb only. */ ++ skb_set_redirected(pkt->skb, true); ++ + nf_fwd_netdev_egress(pkt, oif); + regs->verdict.code = NF_STOLEN; + } +@@ -190,6 +193,13 @@ nla_put_failure: + return -1; + } + ++static int nft_fwd_validate(const struct nft_ctx *ctx, ++ const struct nft_expr *expr, ++ const struct nft_data **data) ++{ ++ return nft_chain_validate_hooks(ctx->chain, (1 << NF_NETDEV_INGRESS)); ++} ++ + static struct nft_expr_type nft_fwd_netdev_type; + static const struct nft_expr_ops nft_fwd_neigh_netdev_ops = { + .type = &nft_fwd_netdev_type, +@@ -197,6 +207,7 @@ static const struct nft_expr_ops nft_fwd_neigh_netdev_ops = { + .eval = nft_fwd_neigh_eval, + .init = nft_fwd_neigh_init, + .dump = nft_fwd_neigh_dump, ++ .validate = nft_fwd_validate, + }; + + static const struct nft_expr_ops nft_fwd_netdev_ops = { +@@ -205,6 +216,7 @@ static const struct nft_expr_ops nft_fwd_netdev_ops = { + .eval = nft_fwd_netdev_eval, + .init = nft_fwd_netdev_init, + .dump = nft_fwd_netdev_dump, ++ .validate = nft_fwd_validate, + .offload = nft_fwd_netdev_offload, + }; + +diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c +index 20edb7c25e22..1d63ab3a878a 100644 +--- a/net/packet/af_packet.c ++++ b/net/packet/af_packet.c +@@ -2172,6 +2172,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, + struct timespec ts; + __u32 ts_status; + bool is_drop_n_account = false; ++ unsigned int slot_id = 0; + bool do_vnet = false; + + /* struct tpacket{2,3}_hdr is aligned to a multiple of TPACKET_ALIGNMENT. +@@ -2274,6 +2275,13 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, + if (!h.raw) + goto drop_n_account; + ++ if (po->tp_version <= TPACKET_V2) { ++ slot_id = po->rx_ring.head; ++ if (test_bit(slot_id, po->rx_ring.rx_owner_map)) ++ goto drop_n_account; ++ __set_bit(slot_id, po->rx_ring.rx_owner_map); ++ } ++ + if (do_vnet && + virtio_net_hdr_from_skb(skb, h.raw + macoff - + sizeof(struct virtio_net_hdr), +@@ -2379,7 +2387,10 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, + #endif + + if (po->tp_version <= TPACKET_V2) { ++ spin_lock(&sk->sk_receive_queue.lock); + __packet_set_status(po, h.raw, status); ++ __clear_bit(slot_id, po->rx_ring.rx_owner_map); ++ spin_unlock(&sk->sk_receive_queue.lock); + sk->sk_data_ready(sk); + } else { + prb_clear_blk_fill_status(&po->rx_ring); +@@ -4276,6 +4287,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, + { + struct pgv *pg_vec = NULL; + struct packet_sock *po = pkt_sk(sk); ++ unsigned long *rx_owner_map = NULL; + int was_running, order = 0; + struct packet_ring_buffer *rb; + struct sk_buff_head *rb_queue; +@@ -4361,6 +4373,12 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, + } + break; + default: ++ if (!tx_ring) { ++ rx_owner_map = bitmap_alloc(req->tp_frame_nr, ++ GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO); ++ if (!rx_owner_map) ++ goto out_free_pg_vec; ++ } + break; + } + } +@@ -4390,6 +4408,8 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, + err = 0; + spin_lock_bh(&rb_queue->lock); + swap(rb->pg_vec, pg_vec); ++ if (po->tp_version <= TPACKET_V2) ++ swap(rb->rx_owner_map, rx_owner_map); + rb->frame_max = (req->tp_frame_nr - 1); + rb->head = 0; + rb->frame_size = req->tp_frame_size; +@@ -4421,6 +4441,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, + } + + out_free_pg_vec: ++ bitmap_free(rx_owner_map); + if (pg_vec) + free_pg_vec(pg_vec, order, req->tp_block_nr); + out: +diff --git a/net/packet/internal.h b/net/packet/internal.h +index 82fb2b10f790..907f4cd2a718 100644 +--- a/net/packet/internal.h ++++ b/net/packet/internal.h +@@ -70,7 +70,10 @@ struct packet_ring_buffer { + + unsigned int __percpu *pending_refcnt; + +- struct tpacket_kbdq_core prb_bdqc; ++ union { ++ unsigned long *rx_owner_map; ++ struct tpacket_kbdq_core prb_bdqc; ++ }; + }; + + extern struct mutex fanout_mutex; +diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c +index 4a6ca9723a12..a293238fe1e7 100644 +--- a/net/rxrpc/af_rxrpc.c ++++ b/net/rxrpc/af_rxrpc.c +@@ -371,44 +371,17 @@ EXPORT_SYMBOL(rxrpc_kernel_end_call); + * rxrpc_kernel_check_life - Check to see whether a call is still alive + * @sock: The socket the call is on + * @call: The call to check +- * @_life: Where to store the life value + * +- * Allow a kernel service to find out whether a call is still alive - ie. we're +- * getting ACKs from the server. Passes back in *_life a number representing +- * the life state which can be compared to that returned by a previous call and +- * return true if the call is still alive. +- * +- * If the life state stalls, rxrpc_kernel_probe_life() should be called and +- * then 2RTT waited. ++ * Allow a kernel service to find out whether a call is still alive - ++ * ie. whether it has completed. + */ + bool rxrpc_kernel_check_life(const struct socket *sock, +- const struct rxrpc_call *call, +- u32 *_life) ++ const struct rxrpc_call *call) + { +- *_life = call->acks_latest; + return call->state != RXRPC_CALL_COMPLETE; + } + EXPORT_SYMBOL(rxrpc_kernel_check_life); + +-/** +- * rxrpc_kernel_probe_life - Poke the peer to see if it's still alive +- * @sock: The socket the call is on +- * @call: The call to check +- * +- * In conjunction with rxrpc_kernel_check_life(), allow a kernel service to +- * find out whether a call is still alive by pinging it. This should cause the +- * life state to be bumped in about 2*RTT. +- * +- * The must be called in TASK_RUNNING state on pain of might_sleep() objecting. +- */ +-void rxrpc_kernel_probe_life(struct socket *sock, struct rxrpc_call *call) +-{ +- rxrpc_propose_ACK(call, RXRPC_ACK_PING, 0, true, false, +- rxrpc_propose_ack_ping_for_check_life); +- rxrpc_send_ack_packet(call, true, NULL); +-} +-EXPORT_SYMBOL(rxrpc_kernel_probe_life); +- + /** + * rxrpc_kernel_get_epoch - Retrieve the epoch value from a call. + * @sock: The socket the call is on +diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h +index 7d730c438404..394d18857979 100644 +--- a/net/rxrpc/ar-internal.h ++++ b/net/rxrpc/ar-internal.h +@@ -675,7 +675,6 @@ struct rxrpc_call { + + /* transmission-phase ACK management */ + ktime_t acks_latest_ts; /* Timestamp of latest ACK received */ +- rxrpc_serial_t acks_latest; /* serial number of latest ACK received */ + rxrpc_seq_t acks_lowest_nak; /* Lowest NACK in the buffer (or ==tx_hard_ack) */ + rxrpc_seq_t acks_lost_top; /* tx_top at the time lost-ack ping sent */ + rxrpc_serial_t acks_lost_ping; /* Serial number of probe ACK */ +diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c +index ef10fbf71b15..69e09d69c896 100644 +--- a/net/rxrpc/input.c ++++ b/net/rxrpc/input.c +@@ -882,7 +882,6 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) + before(prev_pkt, call->ackr_prev_seq)) + goto out; + call->acks_latest_ts = skb->tstamp; +- call->acks_latest = sp->hdr.serial; + + call->ackr_first_seq = first_soft_ack; + call->ackr_prev_seq = prev_pkt; +diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c +index f3232a00970f..0586546c20d7 100644 +--- a/net/sched/act_ct.c ++++ b/net/sched/act_ct.c +@@ -739,7 +739,7 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla, + if (goto_ch) + tcf_chain_put_by_act(goto_ch); + if (params) +- kfree_rcu(params, rcu); ++ call_rcu(¶ms->rcu, tcf_ct_params_free); + if (res == ACT_P_CREATED) + tcf_idr_insert(tn, *a); + +diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c +index f0df0d90b8bd..27f624971121 100644 +--- a/net/sched/act_mirred.c ++++ b/net/sched/act_mirred.c +@@ -284,10 +284,8 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a, + + /* mirror is always swallowed */ + if (is_redirect) { +- skb2->tc_redirected = 1; +- skb2->tc_from_ingress = skb2->tc_at_ingress; +- if (skb2->tc_from_ingress) +- skb2->tstamp = 0; ++ skb_set_redirected(skb2, skb2->tc_at_ingress); ++ + /* let's the caller reinsert the packet, if possible */ + if (use_reinsert) { + res->ingress = want_ingress; +diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c +index 6f8786b06bde..5efa3e7ace15 100644 +--- a/net/sched/cls_route.c ++++ b/net/sched/cls_route.c +@@ -534,8 +534,8 @@ static int route4_change(struct net *net, struct sk_buff *in_skb, + fp = &b->ht[h]; + for (pfp = rtnl_dereference(*fp); pfp; + fp = &pfp->next, pfp = rtnl_dereference(*fp)) { +- if (pfp == f) { +- *fp = f->next; ++ if (pfp == fold) { ++ rcu_assign_pointer(*fp, fold->next); + break; + } + } +diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c +index 09b7dc5fe7e0..9904299424a1 100644 +--- a/net/sched/cls_tcindex.c ++++ b/net/sched/cls_tcindex.c +@@ -261,8 +261,10 @@ static void tcindex_partial_destroy_work(struct work_struct *work) + struct tcindex_data, + rwork); + ++ rtnl_lock(); + kfree(p->perfect); + kfree(p); ++ rtnl_unlock(); + } + + static void tcindex_free_perfect_hash(struct tcindex_data *cp) +@@ -357,6 +359,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, + + if (tcindex_alloc_perfect_hash(net, cp) < 0) + goto errout; ++ cp->alloc_hash = cp->hash; + for (i = 0; i < min(cp->hash, p->hash); i++) + cp->perfect[i].res = p->perfect[i].res; + balloc = 1; +diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c +index b2905b03a432..2eaac2ff380f 100644 +--- a/net/sched/sch_cbs.c ++++ b/net/sched/sch_cbs.c +@@ -181,6 +181,11 @@ static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch) + s64 credits; + int len; + ++ /* The previous packet is still being sent */ ++ if (now < q->last) { ++ qdisc_watchdog_schedule_ns(&q->watchdog, q->last); ++ return NULL; ++ } + if (q->credits < 0) { + credits = timediff_to_credits(now - q->last, q->idleslope); + +@@ -212,7 +217,12 @@ static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch) + credits += q->credits; + + q->credits = max_t(s64, credits, q->locredit); +- q->last = now; ++ /* Estimate of the transmission of the last byte of the packet in ns */ ++ if (unlikely(atomic64_read(&q->port_rate) == 0)) ++ q->last = now; ++ else ++ q->last = now + div64_s64(len * NSEC_PER_SEC, ++ atomic64_read(&q->port_rate)); + + return skb; + } +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c +index 321c132747ce..dbb6a14968ef 100644 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -16407,7 +16407,7 @@ void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac, + goto nla_put_failure; + + if ((sta_opmode->changed & STA_OPMODE_MAX_BW_CHANGED) && +- nla_put_u8(msg, NL80211_ATTR_CHANNEL_WIDTH, sta_opmode->bw)) ++ nla_put_u32(msg, NL80211_ATTR_CHANNEL_WIDTH, sta_opmode->bw)) + goto nla_put_failure; + + if ((sta_opmode->changed & STA_OPMODE_N_SS_CHANGED) && +diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c +index 189ef15acbbc..64486ad81341 100644 +--- a/net/xfrm/xfrm_device.c ++++ b/net/xfrm/xfrm_device.c +@@ -390,6 +390,7 @@ static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void + return xfrm_dev_feat_change(dev); + + case NETDEV_DOWN: ++ case NETDEV_UNREGISTER: + return xfrm_dev_down(dev); + } + return NOTIFY_DONE; +diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c +index f2d1e573ea55..264cf05a4eaa 100644 +--- a/net/xfrm/xfrm_policy.c ++++ b/net/xfrm/xfrm_policy.c +@@ -431,7 +431,9 @@ EXPORT_SYMBOL(xfrm_policy_destroy); + + static void xfrm_policy_kill(struct xfrm_policy *policy) + { ++ write_lock_bh(&policy->lock); + policy->walk.dead = 1; ++ write_unlock_bh(&policy->lock); + + atomic_inc(&policy->genid); + +diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c +index b88ba45ff1ac..e6cfaa680ef3 100644 +--- a/net/xfrm/xfrm_user.c ++++ b/net/xfrm/xfrm_user.c +@@ -110,7 +110,8 @@ static inline int verify_sec_ctx_len(struct nlattr **attrs) + return 0; + + uctx = nla_data(rt); +- if (uctx->len != (sizeof(struct xfrm_user_sec_ctx) + uctx->ctx_len)) ++ if (uctx->len > nla_len(rt) || ++ uctx->len != (sizeof(struct xfrm_user_sec_ctx) + uctx->ctx_len)) + return -EINVAL; + + return 0; +@@ -2273,6 +2274,9 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh, + xfrm_mark_get(attrs, &mark); + + err = verify_newpolicy_info(&ua->policy); ++ if (err) ++ goto free_state; ++ err = verify_sec_ctx_len(attrs); + if (err) + goto free_state; + +diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l +index 5c6c3fd557d7..b3b7270300de 100644 +--- a/scripts/dtc/dtc-lexer.l ++++ b/scripts/dtc/dtc-lexer.l +@@ -23,7 +23,6 @@ LINECOMMENT "//".*\n + #include "srcpos.h" + #include "dtc-parser.tab.h" + +-YYLTYPE yylloc; + extern bool treesource_error; + + /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ +diff --git a/tools/perf/Makefile b/tools/perf/Makefile +index 7902a5681fc8..b8fc7d972be9 100644 +--- a/tools/perf/Makefile ++++ b/tools/perf/Makefile +@@ -35,7 +35,7 @@ endif + # Only pass canonical directory names as the output directory: + # + ifneq ($(O),) +- FULL_O := $(shell readlink -f $(O) || echo $(O)) ++ FULL_O := $(shell cd $(PWD); readlink -f $(O) || echo $(O)) + endif + + # +diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c +index b659466ea498..bf50f464234f 100644 +--- a/tools/perf/util/probe-file.c ++++ b/tools/perf/util/probe-file.c +@@ -206,6 +206,9 @@ static struct strlist *__probe_file__get_namelist(int fd, bool include_group) + } else + ret = strlist__add(sl, tev.event); + clear_probe_trace_event(&tev); ++ /* Skip if there is same name multi-probe event in the list */ ++ if (ret == -EEXIST) ++ ret = 0; + if (ret < 0) + break; + } +diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c +index 9ecea45da4ca..aaf3b24fffa4 100644 +--- a/tools/perf/util/probe-finder.c ++++ b/tools/perf/util/probe-finder.c +@@ -615,14 +615,19 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod, + return -EINVAL; + } + +- /* Try to get actual symbol name from symtab */ +- symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); ++ if (dwarf_entrypc(sp_die, &eaddr) == 0) { ++ /* If the DIE has entrypc, use it. */ ++ symbol = dwarf_diename(sp_die); ++ } else { ++ /* Try to get actual symbol name and address from symtab */ ++ symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); ++ eaddr = sym.st_value; ++ } + if (!symbol) { + pr_warning("Failed to find symbol at 0x%lx\n", + (unsigned long)paddr); + return -ENOENT; + } +- eaddr = sym.st_value; + + tp->offset = (unsigned long)(paddr - eaddr); + tp->address = (unsigned long)paddr; +diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c +index 3f893b99b337..555cb338a71a 100644 +--- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c ++++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c +@@ -82,7 +82,7 @@ static struct pci_access *pci_acc; + static struct pci_dev *amd_fam14h_pci_dev; + static int nbp1_entered; + +-struct timespec start_time; ++static struct timespec start_time; + static unsigned long long timediff; + + #ifdef DEBUG +diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c +index f634aeb65c5f..7fb4f7a291ad 100644 +--- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c ++++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c +@@ -19,7 +19,7 @@ struct cpuidle_monitor cpuidle_sysfs_monitor; + + static unsigned long long **previous_count; + static unsigned long long **current_count; +-struct timespec start_time; ++static struct timespec start_time; + static unsigned long long timediff; + + static int cpuidle_get_count_percent(unsigned int id, double *percent, +diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +index d3c3e6e7aa26..3d54fd433626 100644 +--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c ++++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +@@ -27,6 +27,8 @@ struct cpuidle_monitor *all_monitors[] = { + 0 + }; + ++int cpu_count; ++ + static struct cpuidle_monitor *monitors[MONITORS_MAX]; + static unsigned int avail_monitors; + +diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h +index a2d901d3bfaf..eafef38f1982 100644 +--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h ++++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h +@@ -25,7 +25,7 @@ + #endif + #define CSTATE_DESC_LEN 60 + +-int cpu_count; ++extern int cpu_count; + + /* Hard to define the right names ...: */ + enum power_range_e { +diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include +index ded7a950dc40..6d2f3a1b2249 100644 +--- a/tools/scripts/Makefile.include ++++ b/tools/scripts/Makefile.include +@@ -1,8 +1,8 @@ + # SPDX-License-Identifier: GPL-2.0 + ifneq ($(O),) + ifeq ($(origin O), command line) +- dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),) +- ABSOLUTE_O := $(shell cd $(O) ; pwd) ++ dummy := $(if $(shell cd $(PWD); test -d $(O) || echo $(O)),$(error O=$(O) does not exist),) ++ ABSOLUTE_O := $(shell cd $(PWD); cd $(O) ; pwd) + OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) + COMMAND_O := O=$(ABSOLUTE_O) + ifeq ($(objtree),) diff --git a/patch/kernel/odroidxu4-current/03-patch-5.4.29-30.patch b/patch/kernel/odroidxu4-current/03-patch-5.4.29-30.patch new file mode 100644 index 0000000000..c8305cdf6c --- /dev/null +++ b/patch/kernel/odroidxu4-current/03-patch-5.4.29-30.patch @@ -0,0 +1,994 @@ +diff --git a/Makefile b/Makefile +index 8cb72071a842..e1f41756f475 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 29 ++SUBLEVEL = 30 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts +index b75af21069f9..4c3f606e5b8d 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts ++++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts +@@ -112,6 +112,7 @@ + &sdhci { + #address-cells = <1>; + #size-cells = <0>; ++ pinctrl-names = "default"; + pinctrl-0 = <&emmc_gpio34 &gpclk2_gpio43>; + bus-width = <4>; + mmc-pwrseq = <&wifi_pwrseq>; +diff --git a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi +index 881cea0b61ba..31fa37d2fe47 100644 +--- a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi ++++ b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi +@@ -107,14 +107,14 @@ + regulators { + vdd_arm: buck1 { + regulator-name = "vdd_arm"; +- regulator-min-microvolt = <730000>; ++ regulator-min-microvolt = <925000>; + regulator-max-microvolt = <1380000>; + regulator-always-on; + }; + + vdd_soc: buck2 { + regulator-name = "vdd_soc"; +- regulator-min-microvolt = <730000>; ++ regulator-min-microvolt = <1150000>; + regulator-max-microvolt = <1380000>; + regulator-always-on; + }; +diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts +index 63659880eeb3..7f2ddb78da5f 100644 +--- a/arch/arm/boot/dts/omap3-n900.dts ++++ b/arch/arm/boot/dts/omap3-n900.dts +@@ -849,34 +849,46 @@ + compatible = "ti,omap2-onenand"; + reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */ + ++ /* ++ * These timings are based on CONFIG_OMAP_GPMC_DEBUG=y reported ++ * bootloader set values when booted with v5.1 ++ * (OneNAND Manufacturer: Samsung): ++ * ++ * cs0 GPMC_CS_CONFIG1: 0xfb001202 ++ * cs0 GPMC_CS_CONFIG2: 0x00111100 ++ * cs0 GPMC_CS_CONFIG3: 0x00020200 ++ * cs0 GPMC_CS_CONFIG4: 0x11001102 ++ * cs0 GPMC_CS_CONFIG5: 0x03101616 ++ * cs0 GPMC_CS_CONFIG6: 0x90060000 ++ */ + gpmc,sync-read; + gpmc,sync-write; + gpmc,burst-length = <16>; + gpmc,burst-read; + gpmc,burst-wrap; + gpmc,burst-write; +- gpmc,device-width = <2>; /* GPMC_DEVWIDTH_16BIT */ +- gpmc,mux-add-data = <2>; /* GPMC_MUX_AD */ ++ gpmc,device-width = <2>; ++ gpmc,mux-add-data = <2>; + gpmc,cs-on-ns = <0>; +- gpmc,cs-rd-off-ns = <87>; +- gpmc,cs-wr-off-ns = <87>; ++ gpmc,cs-rd-off-ns = <102>; ++ gpmc,cs-wr-off-ns = <102>; + gpmc,adv-on-ns = <0>; +- gpmc,adv-rd-off-ns = <10>; +- gpmc,adv-wr-off-ns = <10>; +- gpmc,oe-on-ns = <15>; +- gpmc,oe-off-ns = <87>; ++ gpmc,adv-rd-off-ns = <12>; ++ gpmc,adv-wr-off-ns = <12>; ++ gpmc,oe-on-ns = <12>; ++ gpmc,oe-off-ns = <102>; + gpmc,we-on-ns = <0>; +- gpmc,we-off-ns = <87>; +- gpmc,rd-cycle-ns = <112>; +- gpmc,wr-cycle-ns = <112>; +- gpmc,access-ns = <81>; +- gpmc,page-burst-access-ns = <15>; ++ gpmc,we-off-ns = <102>; ++ gpmc,rd-cycle-ns = <132>; ++ gpmc,wr-cycle-ns = <132>; ++ gpmc,access-ns = <96>; ++ gpmc,page-burst-access-ns = <18>; + gpmc,bus-turnaround-ns = <0>; + gpmc,cycle2cycle-delay-ns = <0>; + gpmc,wait-monitoring-ns = <0>; +- gpmc,clk-activation-ns = <5>; +- gpmc,wr-data-mux-bus-ns = <30>; +- gpmc,wr-access-ns = <81>; ++ gpmc,clk-activation-ns = <6>; ++ gpmc,wr-data-mux-bus-ns = <36>; ++ gpmc,wr-access-ns = <96>; + gpmc,sync-clk-ps = <15000>; + + /* +diff --git a/arch/arm/boot/dts/ox810se.dtsi b/arch/arm/boot/dts/ox810se.dtsi +index 9f6c2b660ed3..0755e5864c4a 100644 +--- a/arch/arm/boot/dts/ox810se.dtsi ++++ b/arch/arm/boot/dts/ox810se.dtsi +@@ -323,8 +323,8 @@ + interrupt-controller; + reg = <0 0x200>; + #interrupt-cells = <1>; +- valid-mask = <0xFFFFFFFF>; +- clear-mask = <0>; ++ valid-mask = <0xffffffff>; ++ clear-mask = <0xffffffff>; + }; + + timer0: timer@200 { +diff --git a/arch/arm/boot/dts/ox820.dtsi b/arch/arm/boot/dts/ox820.dtsi +index c9b327732063..90846a7655b4 100644 +--- a/arch/arm/boot/dts/ox820.dtsi ++++ b/arch/arm/boot/dts/ox820.dtsi +@@ -240,8 +240,8 @@ + reg = <0 0x200>; + interrupts = ; + #interrupt-cells = <1>; +- valid-mask = <0xFFFFFFFF>; +- clear-mask = <0>; ++ valid-mask = <0xffffffff>; ++ clear-mask = <0xffffffff>; + }; + + timer0: timer@200 { +diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi +index c9c2688db66d..80f4dc34df34 100644 +--- a/arch/arm/boot/dts/sun8i-r40.dtsi ++++ b/arch/arm/boot/dts/sun8i-r40.dtsi +@@ -266,6 +266,16 @@ + #phy-cells = <1>; + }; + ++ ahci: sata@1c18000 { ++ compatible = "allwinner,sun8i-r40-ahci"; ++ reg = <0x01c18000 0x1000>; ++ interrupts = ; ++ clocks = <&ccu CLK_BUS_SATA>, <&ccu CLK_SATA>; ++ resets = <&ccu RST_BUS_SATA>; ++ reset-names = "ahci"; ++ status = "disabled"; ++ }; ++ + ehci1: usb@1c19000 { + compatible = "allwinner,sun8i-r40-ehci", "generic-ehci"; + reg = <0x01c19000 0x100>; +@@ -557,17 +567,6 @@ + #size-cells = <0>; + }; + +- ahci: sata@1c18000 { +- compatible = "allwinner,sun8i-r40-ahci"; +- reg = <0x01c18000 0x1000>; +- interrupts = ; +- clocks = <&ccu CLK_BUS_SATA>, <&ccu CLK_SATA>; +- resets = <&ccu RST_BUS_SATA>; +- reset-names = "ahci"; +- status = "disabled"; +- +- }; +- + gmac: ethernet@1c50000 { + compatible = "allwinner,sun8i-r40-gmac"; + syscon = <&ccu>; +diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts +index 4223a2352d45..dde50c88f5e3 100644 +--- a/arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts ++++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts +@@ -119,12 +119,12 @@ + + ethernet@e4000 { + phy-handle = <&rgmii_phy1>; +- phy-connection-type = "rgmii-txid"; ++ phy-connection-type = "rgmii-id"; + }; + + ethernet@e6000 { + phy-handle = <&rgmii_phy2>; +- phy-connection-type = "rgmii-txid"; ++ phy-connection-type = "rgmii-id"; + }; + + ethernet@e8000 { +diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts +index 6a6514d0e5a9..274339759114 100644 +--- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts ++++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts +@@ -127,12 +127,12 @@ + &fman0 { + ethernet@e4000 { + phy-handle = <&rgmii_phy1>; +- phy-connection-type = "rgmii"; ++ phy-connection-type = "rgmii-id"; + }; + + ethernet@e6000 { + phy-handle = <&rgmii_phy2>; +- phy-connection-type = "rgmii"; ++ phy-connection-type = "rgmii-id"; + }; + + ethernet@e8000 { +diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h +index 324e7d5ab37e..5e5dc05d63a0 100644 +--- a/arch/arm64/include/asm/alternative.h ++++ b/arch/arm64/include/asm/alternative.h +@@ -221,7 +221,7 @@ alternative_endif + + .macro user_alt, label, oldinstr, newinstr, cond + 9999: alternative_insn "\oldinstr", "\newinstr", \cond +- _ASM_EXTABLE 9999b, \label ++ _asm_extable 9999b, \label + .endm + + /* +diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c +index fbef740704d0..b8b2072742a5 100644 +--- a/drivers/clk/imx/clk-scu.c ++++ b/drivers/clk/imx/clk-scu.c +@@ -43,12 +43,12 @@ struct imx_sc_msg_req_set_clock_rate { + __le32 rate; + __le16 resource; + u8 clk; +-} __packed; ++} __packed __aligned(4); + + struct req_get_clock_rate { + __le16 resource; + u8 clk; +-} __packed; ++} __packed __aligned(4); + + struct resp_get_clock_rate { + __le32 rate; +@@ -84,7 +84,7 @@ struct imx_sc_msg_get_clock_parent { + struct req_get_clock_parent { + __le16 resource; + u8 clk; +- } __packed req; ++ } __packed __aligned(4) req; + struct resp_get_clock_parent { + u8 parent; + } resp; +@@ -121,7 +121,7 @@ struct imx_sc_msg_req_clock_enable { + u8 clk; + u8 enable; + u8 autog; +-} __packed; ++} __packed __aligned(4); + + static inline struct clk_scu *to_clk_scu(struct clk_hw *hw) + { +diff --git a/drivers/clk/ti/clk-43xx.c b/drivers/clk/ti/clk-43xx.c +index 2782d91838ac..2cca1ced913d 100644 +--- a/drivers/clk/ti/clk-43xx.c ++++ b/drivers/clk/ti/clk-43xx.c +@@ -78,7 +78,7 @@ static const struct omap_clkctrl_reg_data am4_gfx_l3_clkctrl_regs[] __initconst + }; + + static const struct omap_clkctrl_reg_data am4_l4_rtc_clkctrl_regs[] __initconst = { +- { AM4_L4_RTC_RTC_CLKCTRL, NULL, CLKF_SW_SUP, "clk_32768_ck" }, ++ { AM4_L4_RTC_RTC_CLKCTRL, NULL, CLKF_SW_SUP, "clkdiv32k_ick" }, + { 0 }, + }; + +diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c +index a3fb450a9ca8..b2e186047014 100644 +--- a/drivers/gpio/gpiolib-acpi.c ++++ b/drivers/gpio/gpiolib-acpi.c +@@ -1430,6 +1430,21 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] = { + .ignore_wake = "INT33FC:02@28", + }, + }, ++ { ++ /* ++ * HP X2 10 models with Cherry Trail SoC + AXP288 PMIC use an ++ * external embedded-controller connected via I2C + an ACPI GPIO ++ * event handler on INT33FF:01 pin 0, causing spurious wakeups. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "HP"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"), ++ DMI_MATCH(DMI_BOARD_NAME, "813E"), ++ }, ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) { ++ .ignore_wake = "INT33FF:01@0", ++ }, ++ }, + {} /* Terminating entry */ + }; + +diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c +index 58579baf3f7a..45cc840d8e2e 100644 +--- a/drivers/net/ethernet/micrel/ks8851_mll.c ++++ b/drivers/net/ethernet/micrel/ks8851_mll.c +@@ -156,6 +156,50 @@ static int msg_enable; + * chip is busy transferring packet data (RX/TX FIFO accesses). + */ + ++/** ++ * ks_check_endian - Check whether endianness of the bus is correct ++ * @ks : The chip information ++ * ++ * The KS8851-16MLL EESK pin allows selecting the endianness of the 16bit ++ * bus. To maintain optimum performance, the bus endianness should be set ++ * such that it matches the endianness of the CPU. ++ */ ++ ++static int ks_check_endian(struct ks_net *ks) ++{ ++ u16 cider; ++ ++ /* ++ * Read CIDER register first, however read it the "wrong" way around. ++ * If the endian strap on the KS8851-16MLL in incorrect and the chip ++ * is operating in different endianness than the CPU, then the meaning ++ * of BE[3:0] byte-enable bits is also swapped such that: ++ * BE[3,2,1,0] becomes BE[1,0,3,2] ++ * ++ * Luckily for us, the byte-enable bits are the top four MSbits of ++ * the address register and the CIDER register is at offset 0xc0. ++ * Hence, by reading address 0xc0c0, which is not impacted by endian ++ * swapping, we assert either BE[3:2] or BE[1:0] while reading the ++ * CIDER register. ++ * ++ * If the bus configuration is correct, reading 0xc0c0 asserts ++ * BE[3:2] and this read returns 0x0000, because to read register ++ * with bottom two LSbits of address set to 0, BE[1:0] must be ++ * asserted. ++ * ++ * If the bus configuration is NOT correct, reading 0xc0c0 asserts ++ * BE[1:0] and this read returns non-zero 0x8872 value. ++ */ ++ iowrite16(BE3 | BE2 | KS_CIDER, ks->hw_addr_cmd); ++ cider = ioread16(ks->hw_addr); ++ if (!cider) ++ return 0; ++ ++ netdev_err(ks->netdev, "incorrect EESK endian strap setting\n"); ++ ++ return -EINVAL; ++} ++ + /** + * ks_rdreg16 - read 16 bit register from device + * @ks : The chip information +@@ -166,7 +210,7 @@ static int msg_enable; + + static u16 ks_rdreg16(struct ks_net *ks, int offset) + { +- ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02)); ++ ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02)); + iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); + return ioread16(ks->hw_addr); + } +@@ -181,7 +225,7 @@ static u16 ks_rdreg16(struct ks_net *ks, int offset) + + static void ks_wrreg16(struct ks_net *ks, int offset, u16 value) + { +- ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02)); ++ ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02)); + iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); + iowrite16(value, ks->hw_addr); + } +@@ -197,7 +241,7 @@ static inline void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len) + { + len >>= 1; + while (len--) +- *wptr++ = be16_to_cpu(ioread16(ks->hw_addr)); ++ *wptr++ = (u16)ioread16(ks->hw_addr); + } + + /** +@@ -211,7 +255,7 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len) + { + len >>= 1; + while (len--) +- iowrite16(cpu_to_be16(*wptr++), ks->hw_addr); ++ iowrite16(*wptr++, ks->hw_addr); + } + + static void ks_disable_int(struct ks_net *ks) +@@ -1218,6 +1262,10 @@ static int ks8851_probe(struct platform_device *pdev) + goto err_free; + } + ++ err = ks_check_endian(ks); ++ if (err) ++ goto err_free; ++ + netdev->irq = platform_get_irq(pdev, 0); + + if ((int)netdev->irq < 0) { +diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c +index 52ef1419b671..2b1a3a6ee8db 100644 +--- a/drivers/platform/x86/pmc_atom.c ++++ b/drivers/platform/x86/pmc_atom.c +@@ -383,6 +383,14 @@ static const struct dmi_system_id critclk_systems[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "3I380D"), + }, + }, ++ { ++ /* pmc_plt_clk* - are used for ethernet controllers */ ++ .ident = "Lex 2I385SW", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Lex BayTrail"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "2I385SW"), ++ }, ++ }, + { + /* pmc_plt_clk* - are used for ethernet controllers */ + .ident = "Beckhoff CB3163", +diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c +index 494e2672ebd7..07573de70445 100644 +--- a/drivers/tty/serial/sprd_serial.c ++++ b/drivers/tty/serial/sprd_serial.c +@@ -1103,14 +1103,13 @@ static int sprd_remove(struct platform_device *dev) + if (sup) { + uart_remove_one_port(&sprd_uart_driver, &sup->port); + sprd_port[sup->port.line] = NULL; ++ sprd_rx_free_buf(sup); + sprd_ports_num--; + } + + if (!sprd_ports_num) + uart_unregister_driver(&sprd_uart_driver); + +- sprd_rx_free_buf(sup); +- + return 0; + } + +diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c +index d7d2e4b844bc..7556139cd0da 100644 +--- a/drivers/tty/vt/selection.c ++++ b/drivers/tty/vt/selection.c +@@ -88,6 +88,11 @@ void clear_selection(void) + } + EXPORT_SYMBOL_GPL(clear_selection); + ++bool vc_is_sel(struct vc_data *vc) ++{ ++ return vc == sel_cons; ++} ++ + /* + * User settable table: what characters are to be considered alphabetic? + * 128 bits. Locked by the console lock. +diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c +index e9e27ba69d5d..fa9433e6cdc7 100644 +--- a/drivers/tty/vt/vt.c ++++ b/drivers/tty/vt/vt.c +@@ -890,8 +890,9 @@ static void hide_softcursor(struct vc_data *vc) + + static void hide_cursor(struct vc_data *vc) + { +- if (vc == sel_cons) ++ if (vc_is_sel(vc)) + clear_selection(); ++ + vc->vc_sw->con_cursor(vc, CM_ERASE); + hide_softcursor(vc); + } +@@ -901,7 +902,7 @@ static void set_cursor(struct vc_data *vc) + if (!con_is_fg(vc) || console_blanked || vc->vc_mode == KD_GRAPHICS) + return; + if (vc->vc_deccm) { +- if (vc == sel_cons) ++ if (vc_is_sel(vc)) + clear_selection(); + add_softcursor(vc); + if ((vc->vc_cursor_type & 0x0f) != 1) +@@ -1074,6 +1075,17 @@ static void visual_deinit(struct vc_data *vc) + module_put(vc->vc_sw->owner); + } + ++static void vc_port_destruct(struct tty_port *port) ++{ ++ struct vc_data *vc = container_of(port, struct vc_data, port); ++ ++ kfree(vc); ++} ++ ++static const struct tty_port_operations vc_port_ops = { ++ .destruct = vc_port_destruct, ++}; ++ + int vc_allocate(unsigned int currcons) /* return 0 on success */ + { + struct vt_notifier_param param; +@@ -1099,6 +1111,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ + + vc_cons[currcons].d = vc; + tty_port_init(&vc->port); ++ vc->port.ops = &vc_port_ops; + INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); + + visual_init(vc, currcons, 1); +@@ -1207,7 +1220,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, + } + } + +- if (vc == sel_cons) ++ if (vc_is_sel(vc)) + clear_selection(); + + old_rows = vc->vc_rows; +@@ -3253,6 +3266,7 @@ static int con_install(struct tty_driver *driver, struct tty_struct *tty) + + tty->driver_data = vc; + vc->port.tty = tty; ++ tty_port_get(&vc->port); + + if (!tty->winsize.ws_row && !tty->winsize.ws_col) { + tty->winsize.ws_row = vc_cons[currcons].d->vc_rows; +@@ -3288,6 +3302,13 @@ static void con_shutdown(struct tty_struct *tty) + console_unlock(); + } + ++static void con_cleanup(struct tty_struct *tty) ++{ ++ struct vc_data *vc = tty->driver_data; ++ ++ tty_port_put(&vc->port); ++} ++ + static int default_color = 7; /* white */ + static int default_italic_color = 2; // green (ASCII) + static int default_underline_color = 3; // cyan (ASCII) +@@ -3412,7 +3433,8 @@ static const struct tty_operations con_ops = { + .throttle = con_throttle, + .unthrottle = con_unthrottle, + .resize = vt_resize, +- .shutdown = con_shutdown ++ .shutdown = con_shutdown, ++ .cleanup = con_cleanup, + }; + + static struct cdev vc0_cdev; +diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c +index ee6c91ef1f6c..daf61c28ba76 100644 +--- a/drivers/tty/vt/vt_ioctl.c ++++ b/drivers/tty/vt/vt_ioctl.c +@@ -39,11 +39,32 @@ + #include + #include + +-char vt_dont_switch; +-extern struct tty_driver *console_driver; ++bool vt_dont_switch; + +-#define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count) +-#define VT_BUSY(i) (VT_IS_IN_USE(i) || i == fg_console || vc_cons[i].d == sel_cons) ++static inline bool vt_in_use(unsigned int i) ++{ ++ const struct vc_data *vc = vc_cons[i].d; ++ ++ /* ++ * console_lock must be held to prevent the vc from being deallocated ++ * while we're checking whether it's in-use. ++ */ ++ WARN_CONSOLE_UNLOCKED(); ++ ++ return vc && kref_read(&vc->port.kref) > 1; ++} ++ ++static inline bool vt_busy(int i) ++{ ++ if (vt_in_use(i)) ++ return true; ++ if (i == fg_console) ++ return true; ++ if (vc_is_sel(vc_cons[i].d)) ++ return true; ++ ++ return false; ++} + + /* + * Console (vt and kd) routines, as defined by USL SVR4 manual, and by +@@ -289,16 +310,14 @@ static int vt_disallocate(unsigned int vc_num) + int ret = 0; + + console_lock(); +- if (VT_BUSY(vc_num)) ++ if (vt_busy(vc_num)) + ret = -EBUSY; + else if (vc_num) + vc = vc_deallocate(vc_num); + console_unlock(); + +- if (vc && vc_num >= MIN_NR_CONSOLES) { +- tty_port_destroy(&vc->port); +- kfree(vc); +- } ++ if (vc && vc_num >= MIN_NR_CONSOLES) ++ tty_port_put(&vc->port); + + return ret; + } +@@ -311,17 +330,15 @@ static void vt_disallocate_all(void) + + console_lock(); + for (i = 1; i < MAX_NR_CONSOLES; i++) +- if (!VT_BUSY(i)) ++ if (!vt_busy(i)) + vc[i] = vc_deallocate(i); + else + vc[i] = NULL; + console_unlock(); + + for (i = 1; i < MAX_NR_CONSOLES; i++) { +- if (vc[i] && i >= MIN_NR_CONSOLES) { +- tty_port_destroy(&vc[i]->port); +- kfree(vc[i]); +- } ++ if (vc[i] && i >= MIN_NR_CONSOLES) ++ tty_port_put(&vc[i]->port); + } + } + +@@ -335,22 +352,13 @@ int vt_ioctl(struct tty_struct *tty, + { + struct vc_data *vc = tty->driver_data; + struct console_font_op op; /* used in multiple places here */ +- unsigned int console; ++ unsigned int console = vc->vc_num; + unsigned char ucval; + unsigned int uival; + void __user *up = (void __user *)arg; + int i, perm; + int ret = 0; + +- console = vc->vc_num; +- +- +- if (!vc_cons_allocated(console)) { /* impossible? */ +- ret = -ENOIOCTLCMD; +- goto out; +- } +- +- + /* + * To have permissions to do most of the vt ioctls, we either have + * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG. +@@ -641,15 +649,16 @@ int vt_ioctl(struct tty_struct *tty, + struct vt_stat __user *vtstat = up; + unsigned short state, mask; + +- /* Review: FIXME: Console lock ? */ + if (put_user(fg_console + 1, &vtstat->v_active)) + ret = -EFAULT; + else { + state = 1; /* /dev/tty0 is always open */ ++ console_lock(); /* required by vt_in_use() */ + for (i = 0, mask = 2; i < MAX_NR_CONSOLES && mask; + ++i, mask <<= 1) +- if (VT_IS_IN_USE(i)) ++ if (vt_in_use(i)) + state |= mask; ++ console_unlock(); + ret = put_user(state, &vtstat->v_state); + } + break; +@@ -659,10 +668,11 @@ int vt_ioctl(struct tty_struct *tty, + * Returns the first available (non-opened) console. + */ + case VT_OPENQRY: +- /* FIXME: locking ? - but then this is a stupid API */ ++ console_lock(); /* required by vt_in_use() */ + for (i = 0; i < MAX_NR_CONSOLES; ++i) +- if (! VT_IS_IN_USE(i)) ++ if (!vt_in_use(i)) + break; ++ console_unlock(); + uival = i < MAX_NR_CONSOLES ? (i+1) : -1; + goto setint; + +@@ -1011,12 +1021,12 @@ int vt_ioctl(struct tty_struct *tty, + case VT_LOCKSWITCH: + if (!capable(CAP_SYS_TTY_CONFIG)) + return -EPERM; +- vt_dont_switch = 1; ++ vt_dont_switch = true; + break; + case VT_UNLOCKSWITCH: + if (!capable(CAP_SYS_TTY_CONFIG)) + return -EPERM; +- vt_dont_switch = 0; ++ vt_dont_switch = false; + break; + case VT_GETHIFONTMASK: + ret = put_user(vc->vc_hi_font_mask, +@@ -1180,14 +1190,9 @@ long vt_compat_ioctl(struct tty_struct *tty, + { + struct vc_data *vc = tty->driver_data; + struct console_font_op op; /* used in multiple places here */ +- unsigned int console = vc->vc_num; + void __user *up = compat_ptr(arg); + int perm; + +- +- if (!vc_cons_allocated(console)) /* impossible? */ +- return -ENOIOCTLCMD; +- + /* + * To have permissions to do most of the vt ioctls, we either have + * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG. +diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h +index c4458dc6a757..76371aaae2d1 100644 +--- a/include/linux/ceph/messenger.h ++++ b/include/linux/ceph/messenger.h +@@ -175,9 +175,10 @@ struct ceph_msg_data { + #endif /* CONFIG_BLOCK */ + struct ceph_bvec_iter bvec_pos; + struct { +- struct page **pages; /* NOT OWNER. */ ++ struct page **pages; + size_t length; /* total # bytes */ + unsigned int alignment; /* first page */ ++ bool own_pages; + }; + struct ceph_pagelist *pagelist; + }; +@@ -356,8 +357,8 @@ extern void ceph_con_keepalive(struct ceph_connection *con); + extern bool ceph_con_keepalive_expired(struct ceph_connection *con, + unsigned long interval); + +-extern void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages, +- size_t length, size_t alignment); ++void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages, ++ size_t length, size_t alignment, bool own_pages); + extern void ceph_msg_data_add_pagelist(struct ceph_msg *msg, + struct ceph_pagelist *pagelist); + #ifdef CONFIG_BLOCK +diff --git a/include/linux/selection.h b/include/linux/selection.h +index e2c1f96bf059..5b890ef5b59f 100644 +--- a/include/linux/selection.h ++++ b/include/linux/selection.h +@@ -11,8 +11,8 @@ + #include + #include + +-extern struct vc_data *sel_cons; + struct tty_struct; ++struct vc_data; + + extern void clear_selection(void); + extern int set_selection_user(const struct tiocl_selection __user *sel, +@@ -24,6 +24,8 @@ extern int sel_loadlut(char __user *p); + extern int mouse_reporting(void); + extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry); + ++bool vc_is_sel(struct vc_data *vc); ++ + extern int console_blanked; + + extern const unsigned char color_table[]; +diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h +index 8dc77e40bc03..ded5c48598f3 100644 +--- a/include/linux/vt_kern.h ++++ b/include/linux/vt_kern.h +@@ -135,7 +135,7 @@ extern int do_unbind_con_driver(const struct consw *csw, int first, int last, + int deflt); + int vty_init(const struct file_operations *console_fops); + +-extern char vt_dont_switch; ++extern bool vt_dont_switch; + extern int default_utf8; + extern int global_cursor_default; + +diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c +index b774e2210f7d..b03087f110eb 100644 +--- a/kernel/bpf/btf.c ++++ b/kernel/bpf/btf.c +@@ -3460,7 +3460,7 @@ int btf_get_info_by_fd(const struct btf *btf, + union bpf_attr __user *uattr) + { + struct bpf_btf_info __user *uinfo; +- struct bpf_btf_info info = {}; ++ struct bpf_btf_info info; + u32 info_copy, btf_copy; + void __user *ubtf; + u32 uinfo_len; +@@ -3469,6 +3469,7 @@ int btf_get_info_by_fd(const struct btf *btf, + uinfo_len = attr->info.info_len; + + info_copy = min_t(u32, uinfo_len, sizeof(info)); ++ memset(&info, 0, sizeof(info)); + if (copy_from_user(&info, uinfo, info_copy)) + return -EFAULT; + +diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c +index ace1cfaa24b6..14f4a76b44d5 100644 +--- a/kernel/bpf/syscall.c ++++ b/kernel/bpf/syscall.c +@@ -2325,7 +2325,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, + union bpf_attr __user *uattr) + { + struct bpf_prog_info __user *uinfo = u64_to_user_ptr(attr->info.info); +- struct bpf_prog_info info = {}; ++ struct bpf_prog_info info; + u32 info_len = attr->info.info_len; + struct bpf_prog_stats stats; + char __user *uinsns; +@@ -2337,6 +2337,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, + return err; + info_len = min_t(u32, sizeof(info), info_len); + ++ memset(&info, 0, sizeof(info)); + if (copy_from_user(&info, uinfo, info_len)) + return -EFAULT; + +@@ -2600,7 +2601,7 @@ static int bpf_map_get_info_by_fd(struct bpf_map *map, + union bpf_attr __user *uattr) + { + struct bpf_map_info __user *uinfo = u64_to_user_ptr(attr->info.info); +- struct bpf_map_info info = {}; ++ struct bpf_map_info info; + u32 info_len = attr->info.info_len; + int err; + +@@ -2609,6 +2610,7 @@ static int bpf_map_get_info_by_fd(struct bpf_map *map, + return err; + info_len = min_t(u32, sizeof(info), info_len); + ++ memset(&info, 0, sizeof(info)); + info.type = map->map_type; + info.id = map->id; + info.key_size = map->key_size; +@@ -2836,7 +2838,7 @@ out: + + SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, uattr, unsigned int, size) + { +- union bpf_attr attr = {}; ++ union bpf_attr attr; + int err; + + if (sysctl_unprivileged_bpf_disabled && !capable(CAP_SYS_ADMIN)) +@@ -2848,6 +2850,7 @@ SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, uattr, unsigned int, siz + size = min_t(u32, size, sizeof(attr)); + + /* copy attributes from user space, may be less than sizeof(bpf_attr) */ ++ memset(&attr, 0, sizeof(attr)); + if (copy_from_user(&attr, uattr, size) != 0) + return -EFAULT; + +diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c +index e4cb3db2ee77..3d2e9f944e0f 100644 +--- a/net/ceph/messenger.c ++++ b/net/ceph/messenger.c +@@ -3250,12 +3250,16 @@ static struct ceph_msg_data *ceph_msg_data_add(struct ceph_msg *msg) + + static void ceph_msg_data_destroy(struct ceph_msg_data *data) + { +- if (data->type == CEPH_MSG_DATA_PAGELIST) ++ if (data->type == CEPH_MSG_DATA_PAGES && data->own_pages) { ++ int num_pages = calc_pages_for(data->alignment, data->length); ++ ceph_release_page_vector(data->pages, num_pages); ++ } else if (data->type == CEPH_MSG_DATA_PAGELIST) { + ceph_pagelist_release(data->pagelist); ++ } + } + + void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages, +- size_t length, size_t alignment) ++ size_t length, size_t alignment, bool own_pages) + { + struct ceph_msg_data *data; + +@@ -3267,6 +3271,7 @@ void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages, + data->pages = pages; + data->length = length; + data->alignment = alignment & ~PAGE_MASK; ++ data->own_pages = own_pages; + + msg->data_length += length; + } +diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c +index ba45b074a362..2352afa62d1f 100644 +--- a/net/ceph/osd_client.c ++++ b/net/ceph/osd_client.c +@@ -962,7 +962,7 @@ static void ceph_osdc_msg_data_add(struct ceph_msg *msg, + BUG_ON(length > (u64) SIZE_MAX); + if (length) + ceph_msg_data_add_pages(msg, osd_data->pages, +- length, osd_data->alignment); ++ length, osd_data->alignment, false); + } else if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGELIST) { + BUG_ON(!length); + ceph_msg_data_add_pagelist(msg, osd_data->pagelist); +@@ -4436,9 +4436,7 @@ static void handle_watch_notify(struct ceph_osd_client *osdc, + CEPH_MSG_DATA_PAGES); + *lreq->preply_pages = data->pages; + *lreq->preply_len = data->length; +- } else { +- ceph_release_page_vector(data->pages, +- calc_pages_for(0, data->length)); ++ data->own_pages = false; + } + } + lreq->notify_finish_error = return_code; +@@ -5500,9 +5498,6 @@ out_unlock_osdc: + return m; + } + +-/* +- * TODO: switch to a msg-owned pagelist +- */ + static struct ceph_msg *alloc_msg_with_page_vector(struct ceph_msg_header *hdr) + { + struct ceph_msg *m; +@@ -5516,7 +5511,6 @@ static struct ceph_msg *alloc_msg_with_page_vector(struct ceph_msg_header *hdr) + + if (data_len) { + struct page **pages; +- struct ceph_osd_data osd_data; + + pages = ceph_alloc_page_vector(calc_pages_for(0, data_len), + GFP_NOIO); +@@ -5525,9 +5519,7 @@ static struct ceph_msg *alloc_msg_with_page_vector(struct ceph_msg_header *hdr) + return NULL; + } + +- ceph_osd_data_pages_init(&osd_data, pages, data_len, 0, false, +- false); +- ceph_osdc_msg_data_add(m, &osd_data); ++ ceph_msg_data_add_pages(m, pages, data_len, 0, true); + } + + return m; +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index c8fc29f0efcf..41da41cb5c40 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3596,8 +3596,26 @@ begin: + tx.skb = skb; + tx.sdata = vif_to_sdata(info->control.vif); + +- if (txq->sta) ++ if (txq->sta) { + tx.sta = container_of(txq->sta, struct sta_info, sta); ++ /* ++ * Drop unicast frames to unauthorised stations unless they are ++ * EAPOL frames from the local station. ++ */ ++ if (unlikely(ieee80211_is_data(hdr->frame_control) && ++ !ieee80211_vif_is_mesh(&tx.sdata->vif) && ++ tx.sdata->vif.type != NL80211_IFTYPE_OCB && ++ !is_multicast_ether_addr(hdr->addr1) && ++ !test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) && ++ (!(info->control.flags & ++ IEEE80211_TX_CTRL_PORT_CTRL_PROTO) || ++ !ether_addr_equal(tx.sdata->vif.addr, ++ hdr->addr2)))) { ++ I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); ++ ieee80211_free_txskb(&local->hw, skb); ++ goto begin; ++ } ++ } + + /* + * The key can be removed while the packet was queued, so need to call +diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c +index eec9b282c047..4b07b1cc22dc 100644 +--- a/tools/perf/util/map.c ++++ b/tools/perf/util/map.c +@@ -90,7 +90,7 @@ static inline bool replace_android_lib(const char *filename, char *newfilename) + return true; + } + +- if (!strncmp(filename, "/system/lib/", 11)) { ++ if (!strncmp(filename, "/system/lib/", 12)) { + char *ndk, *app; + const char *arch; + size_t ndk_length; diff --git a/patch/kernel/odroidxu4-legacy/0000-remove-stock-8188eu-8812au.patch b/patch/kernel/odroidxu4-legacy/0000-remove-stock-8188eu-8812au.patch index 5fc1a6f1af..56ef076c12 100644 --- a/patch/kernel/odroidxu4-legacy/0000-remove-stock-8188eu-8812au.patch +++ b/patch/kernel/odroidxu4-legacy/0000-remove-stock-8188eu-8812au.patch @@ -21,6 +21,6 @@ index 7534683db..1d3d4d7db 100644 -obj-$(CONFIG_RTL8812AU) += rtl8812au/ -obj-$(CONFIG_RTL8188EU) += rtl8188eu/ + obj-$(CONFIG_RTL8189ES) += rtl8189es/ + obj-$(CONFIG_RTL8189FS) += rtl8189fs/ obj-$(CONFIG_88XXAU) += rtl8812au/ - obj-$(CONFIG_RTL8812AU) += rtl8812au/ - obj-$(CONFIG_RTL8821CU) += rtl8811cu/ diff --git a/patch/kernel/odroidxu4-legacy/patch-4.14.174-175.patch b/patch/kernel/odroidxu4-legacy/patch-4.14.174-175.patch new file mode 100644 index 0000000000..ba46f78bb1 --- /dev/null +++ b/patch/kernel/odroidxu4-legacy/patch-4.14.174-175.patch @@ -0,0 +1,4354 @@ +diff --git a/Documentation/devicetree/bindings/net/fsl-fman.txt b/Documentation/devicetree/bindings/net/fsl-fman.txt +index df873d1f3b7c..2aaae210317b 100644 +--- a/Documentation/devicetree/bindings/net/fsl-fman.txt ++++ b/Documentation/devicetree/bindings/net/fsl-fman.txt +@@ -110,6 +110,13 @@ PROPERTIES + Usage: required + Definition: See soc/fsl/qman.txt and soc/fsl/bman.txt + ++- fsl,erratum-a050385 ++ Usage: optional ++ Value type: boolean ++ Definition: A boolean property. Indicates the presence of the ++ erratum A050385 which indicates that DMA transactions that are ++ split can result in a FMan lock. ++ + ============================================================================= + FMan MURAM Node + +diff --git a/Makefile b/Makefile +index edc6b62bd892..3b792208fbc2 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 4 + PATCHLEVEL = 14 +-SUBLEVEL = 174 ++SUBLEVEL = 175 + EXTRAVERSION = + NAME = Petit Gorille + +diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts +index b8565fc33eea..e5f2cca86f04 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts ++++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts +@@ -118,6 +118,7 @@ + &sdhci { + #address-cells = <1>; + #size-cells = <0>; ++ pinctrl-names = "default"; + pinctrl-0 = <&emmc_gpio34 &gpclk2_gpio43>; + mmc-pwrseq = <&wifi_pwrseq>; + non-removable; +diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi +index fec965009b9f..f271c564d57d 100644 +--- a/arch/arm/boot/dts/dra7.dtsi ++++ b/arch/arm/boot/dts/dra7.dtsi +@@ -137,6 +137,7 @@ + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x0 0x0 0xc0000000>; ++ dma-ranges = <0x80000000 0x0 0x80000000 0x80000000>; + ti,hwmods = "l3_main_1", "l3_main_2"; + reg = <0x0 0x44000000 0x0 0x1000000>, + <0x0 0x45000000 0x0 0x1000>; +@@ -302,6 +303,7 @@ + device_type = "pci"; + ranges = <0x81000000 0 0 0x03000 0 0x00010000 + 0x82000000 0 0x20013000 0x13000 0 0xffed000>; ++ dma-ranges = <0x02000000 0x0 0x00000000 0x00000000 0x1 0x00000000>; + bus-range = <0x00 0xff>; + #interrupt-cells = <1>; + num-lanes = <1>; +@@ -356,6 +358,7 @@ + device_type = "pci"; + ranges = <0x81000000 0 0 0x03000 0 0x00010000 + 0x82000000 0 0x30013000 0x13000 0 0xffed000>; ++ dma-ranges = <0x02000000 0x0 0x00000000 0x00000000 0x1 0x00000000>; + bus-range = <0x00 0xff>; + #interrupt-cells = <1>; + num-lanes = <1>; +diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi +index eaff2a5751dd..bc3f53c79e9d 100644 +--- a/arch/arm/boot/dts/omap5.dtsi ++++ b/arch/arm/boot/dts/omap5.dtsi +@@ -131,6 +131,7 @@ + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0 0 0xc0000000>; ++ dma-ranges = <0x80000000 0x0 0x80000000 0x80000000>; + ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3"; + reg = <0 0x44000000 0 0x2000>, + <0 0x44800000 0 0x3000>, +diff --git a/arch/arm/boot/dts/ox810se.dtsi b/arch/arm/boot/dts/ox810se.dtsi +index 46aa6db8353a..3d2f91234f1a 100644 +--- a/arch/arm/boot/dts/ox810se.dtsi ++++ b/arch/arm/boot/dts/ox810se.dtsi +@@ -322,8 +322,8 @@ + interrupt-controller; + reg = <0 0x200>; + #interrupt-cells = <1>; +- valid-mask = <0xFFFFFFFF>; +- clear-mask = <0>; ++ valid-mask = <0xffffffff>; ++ clear-mask = <0xffffffff>; + }; + + timer0: timer@200 { +diff --git a/arch/arm/boot/dts/ox820.dtsi b/arch/arm/boot/dts/ox820.dtsi +index 459207536a46..8355cb034525 100644 +--- a/arch/arm/boot/dts/ox820.dtsi ++++ b/arch/arm/boot/dts/ox820.dtsi +@@ -239,8 +239,8 @@ + reg = <0 0x200>; + interrupts = ; + #interrupt-cells = <1>; +- valid-mask = <0xFFFFFFFF>; +- clear-mask = <0>; ++ valid-mask = <0xffffffff>; ++ clear-mask = <0xffffffff>; + }; + + timer0: timer@200 { +diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi +index 169e171407a6..acd205ef329f 100644 +--- a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi ++++ b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi +@@ -21,6 +21,8 @@ + }; + + &fman0 { ++ fsl,erratum-a050385; ++ + /* these aliases provide the FMan ports mapping */ + enet0: ethernet@e0000 { + }; +diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts +index 3dc0c8e9663d..3aead63e5475 100644 +--- a/arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts ++++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts +@@ -155,12 +155,12 @@ + + ethernet@e4000 { + phy-handle = <&rgmii_phy1>; +- phy-connection-type = "rgmii-txid"; ++ phy-connection-type = "rgmii-id"; + }; + + ethernet@e6000 { + phy-handle = <&rgmii_phy2>; +- phy-connection-type = "rgmii-txid"; ++ phy-connection-type = "rgmii-id"; + }; + + ethernet@e8000 { +diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts +index 5dc2782e2a58..e775e59d0370 100644 +--- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts ++++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts +@@ -162,12 +162,12 @@ + &fman0 { + ethernet@e4000 { + phy-handle = <&rgmii_phy1>; +- phy-connection-type = "rgmii"; ++ phy-connection-type = "rgmii-id"; + }; + + ethernet@e6000 { + phy-handle = <&rgmii_phy2>; +- phy-connection-type = "rgmii"; ++ phy-connection-type = "rgmii-id"; + }; + + ethernet@e8000 { +diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h +index 4cd4a793dc32..4ed869845a23 100644 +--- a/arch/arm64/include/asm/alternative.h ++++ b/arch/arm64/include/asm/alternative.h +@@ -216,7 +216,7 @@ alternative_endif + + .macro user_alt, label, oldinstr, newinstr, cond + 9999: alternative_insn "\oldinstr", "\newinstr", \cond +- _ASM_EXTABLE 9999b, \label ++ _asm_extable 9999b, \label + .endm + + /* +diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c +index e230b4dff960..e8574b95bda8 100644 +--- a/arch/arm64/kernel/ptrace.c ++++ b/arch/arm64/kernel/ptrace.c +@@ -833,6 +833,7 @@ static int compat_gpr_get(struct task_struct *target, + break; + case 16: + reg = task_pt_regs(target)->pstate; ++ reg = pstate_to_compat_psr(reg); + break; + case 17: + reg = task_pt_regs(target)->orig_x0; +@@ -900,6 +901,7 @@ static int compat_gpr_set(struct task_struct *target, + newregs.pc = reg; + break; + case 16: ++ reg = compat_psr_to_pstate(reg); + newregs.pstate = reg; + break; + case 17: +diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c +index e09bf5d15606..3832750cee8b 100644 +--- a/arch/arm64/kernel/signal32.c ++++ b/arch/arm64/kernel/signal32.c +@@ -321,6 +321,7 @@ static int compat_restore_sigframe(struct pt_regs *regs, + int err; + sigset_t set; + struct compat_aux_sigframe __user *aux; ++ unsigned long psr; + + err = get_sigset_t(&set, &sf->uc.uc_sigmask); + if (err == 0) { +@@ -344,7 +345,9 @@ static int compat_restore_sigframe(struct pt_regs *regs, + __get_user_error(regs->compat_sp, &sf->uc.uc_mcontext.arm_sp, err); + __get_user_error(regs->compat_lr, &sf->uc.uc_mcontext.arm_lr, err); + __get_user_error(regs->pc, &sf->uc.uc_mcontext.arm_pc, err); +- __get_user_error(regs->pstate, &sf->uc.uc_mcontext.arm_cpsr, err); ++ __get_user_error(psr, &sf->uc.uc_mcontext.arm_cpsr, err); ++ ++ regs->pstate = compat_psr_to_pstate(psr); + + /* + * Avoid compat_sys_sigreturn() restarting. +@@ -500,6 +503,7 @@ static int compat_setup_sigframe(struct compat_sigframe __user *sf, + struct pt_regs *regs, sigset_t *set) + { + struct compat_aux_sigframe __user *aux; ++ unsigned long psr = pstate_to_compat_psr(regs->pstate); + int err = 0; + + __put_user_error(regs->regs[0], &sf->uc.uc_mcontext.arm_r0, err); +@@ -518,7 +522,7 @@ static int compat_setup_sigframe(struct compat_sigframe __user *sf, + __put_user_error(regs->compat_sp, &sf->uc.uc_mcontext.arm_sp, err); + __put_user_error(regs->compat_lr, &sf->uc.uc_mcontext.arm_lr, err); + __put_user_error(regs->pc, &sf->uc.uc_mcontext.arm_pc, err); +- __put_user_error(regs->pstate, &sf->uc.uc_mcontext.arm_cpsr, err); ++ __put_user_error(psr, &sf->uc.uc_mcontext.arm_cpsr, err); + + __put_user_error((compat_ulong_t)0, &sf->uc.uc_mcontext.trap_no, err); + /* set the compat FSR WnR */ +diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c +index 909bf3926fd2..cfb5a6ad7865 100644 +--- a/arch/arm64/kernel/smp.c ++++ b/arch/arm64/kernel/smp.c +@@ -913,11 +913,22 @@ void tick_broadcast(const struct cpumask *mask) + } + #endif + ++/* ++ * The number of CPUs online, not counting this CPU (which may not be ++ * fully online and so not counted in num_online_cpus()). ++ */ ++static inline unsigned int num_other_online_cpus(void) ++{ ++ unsigned int this_cpu_online = cpu_online(smp_processor_id()); ++ ++ return num_online_cpus() - this_cpu_online; ++} ++ + void smp_send_stop(void) + { + unsigned long timeout; + +- if (num_online_cpus() > 1) { ++ if (num_other_online_cpus()) { + cpumask_t mask; + + cpumask_copy(&mask, cpu_online_mask); +@@ -930,10 +941,10 @@ void smp_send_stop(void) + + /* Wait up to one second for other CPUs to stop */ + timeout = USEC_PER_SEC; +- while (num_online_cpus() > 1 && timeout--) ++ while (num_other_online_cpus() && timeout--) + udelay(1); + +- if (num_online_cpus() > 1) ++ if (num_other_online_cpus()) + pr_warning("SMP: failed to stop secondary CPUs %*pbl\n", + cpumask_pr_args(cpu_online_mask)); + } +@@ -954,13 +965,17 @@ void crash_smp_send_stop(void) + + cpus_stopped = 1; + +- if (num_online_cpus() == 1) ++ /* ++ * If this cpu is the only one alive at this point in time, online or ++ * not, there are no stop messages to be sent around, so just back out. ++ */ ++ if (num_other_online_cpus() == 0) + return; + + cpumask_copy(&mask, cpu_online_mask); + cpumask_clear_cpu(smp_processor_id(), &mask); + +- atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); ++ atomic_set(&waiting_for_crash_ipi, num_other_online_cpus()); + + pr_crit("SMP: stopping secondary CPUs\n"); + smp_cross_call(&mask, IPI_CPU_CRASH_STOP); +diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S +index b0cf4af7ba84..e4da937d6cf9 100644 +--- a/arch/powerpc/kernel/vmlinux.lds.S ++++ b/arch/powerpc/kernel/vmlinux.lds.S +@@ -317,6 +317,12 @@ SECTIONS + *(.branch_lt) + } + ++#ifdef CONFIG_DEBUG_INFO_BTF ++ .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) { ++ *(.BTF) ++ } ++#endif ++ + .opd : AT(ADDR(.opd) - LOAD_OFFSET) { + *(.opd) + } +diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c +index ccc2b9d2956a..387340b1f6db 100644 +--- a/arch/x86/kernel/ftrace.c ++++ b/arch/x86/kernel/ftrace.c +@@ -36,6 +36,7 @@ + #ifdef CONFIG_DYNAMIC_FTRACE + + int ftrace_arch_code_modify_prepare(void) ++ __acquires(&text_mutex) + { + mutex_lock(&text_mutex); + set_kernel_text_rw(); +@@ -44,6 +45,7 @@ int ftrace_arch_code_modify_prepare(void) + } + + int ftrace_arch_code_modify_post_process(void) ++ __releases(&text_mutex) + { + set_all_modules_text_ro(); + set_kernel_text_ro(); +diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c +index 27cab342a0b2..1789626cf95e 100644 +--- a/arch/x86/mm/fault.c ++++ b/arch/x86/mm/fault.c +@@ -272,7 +272,7 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) + return pmd_k; + } + +-void vmalloc_sync_all(void) ++static void vmalloc_sync(void) + { + unsigned long address; + +@@ -299,6 +299,16 @@ void vmalloc_sync_all(void) + } + } + ++void vmalloc_sync_mappings(void) ++{ ++ vmalloc_sync(); ++} ++ ++void vmalloc_sync_unmappings(void) ++{ ++ vmalloc_sync(); ++} ++ + /* + * 32-bit: + * +@@ -401,11 +411,23 @@ out: + + #else /* CONFIG_X86_64: */ + +-void vmalloc_sync_all(void) ++void vmalloc_sync_mappings(void) + { ++ /* ++ * 64-bit mappings might allocate new p4d/pud pages ++ * that need to be propagated to all tasks' PGDs. ++ */ + sync_global_pgds(VMALLOC_START & PGDIR_MASK, VMALLOC_END); + } + ++void vmalloc_sync_unmappings(void) ++{ ++ /* ++ * Unmappings never allocate or free p4d/pud pages. ++ * No work is required here. ++ */ ++} ++ + /* + * 64-bit: + * +diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c +index afbbe5750a1f..7d7aee024ece 100644 +--- a/block/bfq-cgroup.c ++++ b/block/bfq-cgroup.c +@@ -499,12 +499,13 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd, + */ + entity = &bfqg->entity; + for_each_entity(entity) { +- bfqg = container_of(entity, struct bfq_group, entity); +- if (bfqg != bfqd->root_group) { +- parent = bfqg_parent(bfqg); ++ struct bfq_group *curr_bfqg = container_of(entity, ++ struct bfq_group, entity); ++ if (curr_bfqg != bfqd->root_group) { ++ parent = bfqg_parent(curr_bfqg); + if (!parent) + parent = bfqd->root_group; +- bfq_group_set_parent(bfqg, parent); ++ bfq_group_set_parent(curr_bfqg, parent); + } + } + +diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c +index cd6fae6ad4c2..3f9f286088fa 100644 +--- a/drivers/acpi/apei/ghes.c ++++ b/drivers/acpi/apei/ghes.c +@@ -201,7 +201,7 @@ static int ghes_estatus_pool_expand(unsigned long len) + * New allocation must be visible in all pgd before it can be found by + * an NMI allocating from the pool. + */ +- vmalloc_sync_all(); ++ vmalloc_sync_mappings(); + + return gen_pool_add(ghes_estatus_pool, addr, PAGE_ALIGN(len), -1); + } +diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c +index c7b9125c8ec2..7c06f4541c5d 100644 +--- a/drivers/gpio/gpiolib-acpi.c ++++ b/drivers/gpio/gpiolib-acpi.c +@@ -24,18 +24,21 @@ + + #include "gpiolib.h" + +-#define QUIRK_NO_EDGE_EVENTS_ON_BOOT 0x01l +-#define QUIRK_NO_WAKEUP 0x02l +- + static int run_edge_events_on_boot = -1; + module_param(run_edge_events_on_boot, int, 0444); + MODULE_PARM_DESC(run_edge_events_on_boot, + "Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto"); + +-static int honor_wakeup = -1; +-module_param(honor_wakeup, int, 0444); +-MODULE_PARM_DESC(honor_wakeup, +- "Honor the ACPI wake-capable flag: 0=no, 1=yes, -1=auto"); ++static char *ignore_wake; ++module_param(ignore_wake, charp, 0444); ++MODULE_PARM_DESC(ignore_wake, ++ "controller@pin combos on which to ignore the ACPI wake flag " ++ "ignore_wake=controller@pin[,controller@pin[,...]]"); ++ ++struct acpi_gpiolib_dmi_quirk { ++ bool no_edge_events_on_boot; ++ char *ignore_wake; ++}; + + /** + * struct acpi_gpio_event - ACPI GPIO event handler data +@@ -262,6 +265,57 @@ static void acpi_gpiochip_request_irqs(struct acpi_gpio_chip *acpi_gpio) + acpi_gpiochip_request_irq(acpi_gpio, event); + } + ++static bool acpi_gpio_in_ignore_list(const char *controller_in, int pin_in) ++{ ++ const char *controller, *pin_str; ++ int len, pin; ++ char *endp; ++ ++ controller = ignore_wake; ++ while (controller) { ++ pin_str = strchr(controller, '@'); ++ if (!pin_str) ++ goto err; ++ ++ len = pin_str - controller; ++ if (len == strlen(controller_in) && ++ strncmp(controller, controller_in, len) == 0) { ++ pin = simple_strtoul(pin_str + 1, &endp, 10); ++ if (*endp != 0 && *endp != ',') ++ goto err; ++ ++ if (pin == pin_in) ++ return true; ++ } ++ ++ controller = strchr(controller, ','); ++ if (controller) ++ controller++; ++ } ++ ++ return false; ++err: ++ pr_err_once("Error invalid value for gpiolib_acpi.ignore_wake: %s\n", ++ ignore_wake); ++ return false; ++} ++ ++static bool acpi_gpio_irq_is_wake(struct device *parent, ++ struct acpi_resource_gpio *agpio) ++{ ++ int pin = agpio->pin_table[0]; ++ ++ if (agpio->wake_capable != ACPI_WAKE_CAPABLE) ++ return false; ++ ++ if (acpi_gpio_in_ignore_list(dev_name(parent), pin)) { ++ dev_info(parent, "Ignoring wakeup on pin %d\n", pin); ++ return false; ++ } ++ ++ return true; ++} ++ + static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares, + void *context) + { +@@ -347,7 +401,7 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares, + event->handle = evt_handle; + event->handler = handler; + event->irq = irq; +- event->irq_is_wake = honor_wakeup && agpio->wake_capable == ACPI_WAKE_CAPABLE; ++ event->irq_is_wake = acpi_gpio_irq_is_wake(chip->parent, agpio); + event->pin = pin; + event->desc = desc; + +@@ -1331,7 +1385,9 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] = { + DMI_MATCH(DMI_SYS_VENDOR, "MINIX"), + DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"), + }, +- .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT, ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) { ++ .no_edge_events_on_boot = true, ++ }, + }, + { + /* +@@ -1344,16 +1400,20 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] = { + DMI_MATCH(DMI_SYS_VENDOR, "Wortmann_AG"), + DMI_MATCH(DMI_PRODUCT_NAME, "TERRA_PAD_1061"), + }, +- .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT, ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) { ++ .no_edge_events_on_boot = true, ++ }, + }, + { + /* +- * Various HP X2 10 Cherry Trail models use an external +- * embedded-controller connected via I2C + an ACPI GPIO +- * event handler. The embedded controller generates various +- * spurious wakeup events when suspended. So disable wakeup +- * for its handler (it uses the only ACPI GPIO event handler). +- * This breaks wakeup when opening the lid, the user needs ++ * HP X2 10 models with Cherry Trail SoC + TI PMIC use an ++ * external embedded-controller connected via I2C + an ACPI GPIO ++ * event handler on INT33FF:01 pin 0, causing spurious wakeups. ++ * When suspending by closing the LID, the power to the USB ++ * keyboard is turned off, causing INT0002 ACPI events to ++ * trigger once the XHCI controller notices the keyboard is ++ * gone. So INT0002 events cause spurious wakeups too. Ignoring ++ * EC wakes breaks wakeup when opening the lid, the user needs + * to press the power-button to wakeup the system. The + * alternative is suspend simply not working, which is worse. + */ +@@ -1361,33 +1421,61 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP x2 Detachable 10-p0XX"), + }, +- .driver_data = (void *)QUIRK_NO_WAKEUP, ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) { ++ .ignore_wake = "INT33FF:01@0,INT0002:00@2", ++ }, ++ }, ++ { ++ /* ++ * HP X2 10 models with Bay Trail SoC + AXP288 PMIC use an ++ * external embedded-controller connected via I2C + an ACPI GPIO ++ * event handler on INT33FC:02 pin 28, causing spurious wakeups. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"), ++ DMI_MATCH(DMI_BOARD_NAME, "815D"), ++ }, ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) { ++ .ignore_wake = "INT33FC:02@28", ++ }, ++ }, ++ { ++ /* ++ * HP X2 10 models with Cherry Trail SoC + AXP288 PMIC use an ++ * external embedded-controller connected via I2C + an ACPI GPIO ++ * event handler on INT33FF:01 pin 0, causing spurious wakeups. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "HP"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"), ++ DMI_MATCH(DMI_BOARD_NAME, "813E"), ++ }, ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) { ++ .ignore_wake = "INT33FF:01@0", ++ }, + }, + {} /* Terminating entry */ + }; + + static int acpi_gpio_setup_params(void) + { ++ const struct acpi_gpiolib_dmi_quirk *quirk = NULL; + const struct dmi_system_id *id; +- long quirks = 0; + + id = dmi_first_match(gpiolib_acpi_quirks); + if (id) +- quirks = (long)id->driver_data; ++ quirk = id->driver_data; + + if (run_edge_events_on_boot < 0) { +- if (quirks & QUIRK_NO_EDGE_EVENTS_ON_BOOT) ++ if (quirk && quirk->no_edge_events_on_boot) + run_edge_events_on_boot = 0; + else + run_edge_events_on_boot = 1; + } + +- if (honor_wakeup < 0) { +- if (quirks & QUIRK_NO_WAKEUP) +- honor_wakeup = 0; +- else +- honor_wakeup = 1; +- } ++ if (ignore_wake == NULL && quirk && quirk->ignore_wake) ++ ignore_wake = quirk->ignore_wake; + + return 0; + } +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +index cc1094f90125..96cf64d0ee82 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +@@ -1348,28 +1348,34 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) + frame.colorspace = HDMI_COLORSPACE_RGB; + + /* Set up colorimetry */ +- switch (hdmi->hdmi_data.enc_out_encoding) { +- case V4L2_YCBCR_ENC_601: +- if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV601) +- frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; +- else ++ if (!hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) { ++ switch (hdmi->hdmi_data.enc_out_encoding) { ++ case V4L2_YCBCR_ENC_601: ++ if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV601) ++ frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; ++ else ++ frame.colorimetry = HDMI_COLORIMETRY_ITU_601; ++ frame.extended_colorimetry = ++ HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; ++ break; ++ case V4L2_YCBCR_ENC_709: ++ if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV709) ++ frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; ++ else ++ frame.colorimetry = HDMI_COLORIMETRY_ITU_709; ++ frame.extended_colorimetry = ++ HDMI_EXTENDED_COLORIMETRY_XV_YCC_709; ++ break; ++ default: /* Carries no data */ + frame.colorimetry = HDMI_COLORIMETRY_ITU_601; ++ frame.extended_colorimetry = ++ HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; ++ break; ++ } ++ } else { ++ frame.colorimetry = HDMI_COLORIMETRY_NONE; + frame.extended_colorimetry = +- HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; +- break; +- case V4L2_YCBCR_ENC_709: +- if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV709) +- frame.colorimetry = HDMI_COLORIMETRY_EXTENDED; +- else +- frame.colorimetry = HDMI_COLORIMETRY_ITU_709; +- frame.extended_colorimetry = +- HDMI_EXTENDED_COLORIMETRY_XV_YCC_709; +- break; +- default: /* Carries no data */ +- frame.colorimetry = HDMI_COLORIMETRY_ITU_601; +- frame.extended_colorimetry = +- HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; +- break; ++ HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; + } + + frame.scan_mode = HDMI_SCAN_MODE_NONE; +diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c +index 9d94c306c8ca..c8c83f84aced 100644 +--- a/drivers/gpu/drm/drm_dp_mst_topology.c ++++ b/drivers/gpu/drm/drm_dp_mst_topology.c +@@ -982,20 +982,9 @@ static struct drm_dp_mst_port *drm_dp_mst_get_port_ref_locked(struct drm_dp_mst_ + static struct drm_dp_mst_port *drm_dp_get_validated_port_ref(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port) + { + struct drm_dp_mst_port *rport = NULL; +- + mutex_lock(&mgr->lock); +- /* +- * Port may or may not be 'valid' but we don't care about that when +- * destroying the port and we are guaranteed that the port pointer +- * will be valid until we've finished +- */ +- if (current_work() == &mgr->destroy_connector_work) { +- kref_get(&port->kref); +- rport = port; +- } else if (mgr->mst_primary) { +- rport = drm_dp_mst_get_port_ref_locked(mgr->mst_primary, +- port); +- } ++ if (mgr->mst_primary) ++ rport = drm_dp_mst_get_port_ref_locked(mgr->mst_primary, port); + mutex_unlock(&mgr->lock); + return rport; + } +diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c +index 7904ffa9abfb..366c975cde5b 100644 +--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c ++++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c +@@ -1739,8 +1739,9 @@ static int exynos_dsi_probe(struct platform_device *pdev) + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(dsi->supplies), + dsi->supplies); + if (ret) { +- dev_info(dev, "failed to get regulators: %d\n", ret); +- return -EPROBE_DEFER; ++ if (ret != -EPROBE_DEFER) ++ dev_info(dev, "failed to get regulators: %d\n", ret); ++ return ret; + } + + dsi->clks = devm_kzalloc(dev, +@@ -1753,9 +1754,10 @@ static int exynos_dsi_probe(struct platform_device *pdev) + dsi->clks[i] = devm_clk_get(dev, clk_names[i]); + if (IS_ERR(dsi->clks[i])) { + if (strcmp(clk_names[i], "sclk_mipi") == 0) { +- strcpy(clk_names[i], OLD_SCLK_MIPI_CLK_NAME); +- i--; +- continue; ++ dsi->clks[i] = devm_clk_get(dev, ++ OLD_SCLK_MIPI_CLK_NAME); ++ if (!IS_ERR(dsi->clks[i])) ++ continue; + } + + dev_info(dev, "failed to get the clock: %s\n", +diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c +index 6ebf6a2edb33..ca2717137ad2 100644 +--- a/drivers/hwtracing/intel_th/msu.c ++++ b/drivers/hwtracing/intel_th/msu.c +@@ -499,7 +499,7 @@ static int msc_configure(struct msc *msc) + lockdep_assert_held(&msc->buf_mutex); + + if (msc->mode > MSC_MODE_MULTI) +- return -ENOTSUPP; ++ return -EINVAL; + + if (msc->mode == MSC_MODE_MULTI) + msc_buffer_clear_hw_header(msc); +@@ -950,7 +950,7 @@ static int msc_buffer_alloc(struct msc *msc, unsigned long *nr_pages, + } else if (msc->mode == MSC_MODE_MULTI) { + ret = msc_buffer_multi_alloc(msc, nr_pages, nr_wins); + } else { +- ret = -ENOTSUPP; ++ ret = -EINVAL; + } + + if (!ret) { +@@ -1173,7 +1173,7 @@ static ssize_t intel_th_msc_read(struct file *file, char __user *buf, + if (ret >= 0) + *ppos = iter->offset; + } else { +- ret = -ENOTSUPP; ++ ret = -EINVAL; + } + + put_count: +diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c +index fc371444407d..b8cbd26b60e1 100644 +--- a/drivers/hwtracing/intel_th/pci.c ++++ b/drivers/hwtracing/intel_th/pci.c +@@ -218,6 +218,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4da6), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, ++ { ++ /* Elkhart Lake CPU */ ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4529), ++ .driver_data = (kernel_ulong_t)&intel_th_2x, ++ }, + { + /* Elkhart Lake */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4b26), +diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c +index bb68957d3da5..aa5c55bd8b11 100644 +--- a/drivers/i2c/busses/i2c-hix5hd2.c ++++ b/drivers/i2c/busses/i2c-hix5hd2.c +@@ -498,6 +498,7 @@ static int hix5hd2_i2c_remove(struct platform_device *pdev) + i2c_del_adapter(&priv->adap); + pm_runtime_disable(priv->dev); + pm_runtime_set_suspended(priv->dev); ++ clk_disable_unprepare(priv->clk); + + return 0; + } +diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c +index a70ef7fec95f..34639ee2d2ce 100644 +--- a/drivers/iio/adc/at91-sama5d2_adc.c ++++ b/drivers/iio/adc/at91-sama5d2_adc.c +@@ -300,6 +300,27 @@ static const struct iio_chan_spec at91_adc_channels[] = { + + AT91_SAMA5D2_DIFF_CHAN_CNT + 1), + }; + ++static int at91_adc_chan_xlate(struct iio_dev *indio_dev, int chan) ++{ ++ int i; ++ ++ for (i = 0; i < indio_dev->num_channels; i++) { ++ if (indio_dev->channels[i].scan_index == chan) ++ return i; ++ } ++ return -EINVAL; ++} ++ ++static inline struct iio_chan_spec const * ++at91_adc_chan_get(struct iio_dev *indio_dev, int chan) ++{ ++ int index = at91_adc_chan_xlate(indio_dev, chan); ++ ++ if (index < 0) ++ return NULL; ++ return indio_dev->channels + index; ++} ++ + static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) + { + struct iio_dev *indio = iio_trigger_get_drvdata(trig); +@@ -317,7 +338,24 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) + at91_adc_writel(st, AT91_SAMA5D2_TRGR, status); + + for_each_set_bit(bit, indio->active_scan_mask, indio->num_channels) { +- struct iio_chan_spec const *chan = indio->channels + bit; ++ struct iio_chan_spec const *chan = at91_adc_chan_get(indio, bit); ++ u32 cor; ++ ++ if (!chan) ++ continue; ++ if (state) { ++ cor = at91_adc_readl(st, AT91_SAMA5D2_COR); ++ ++ if (chan->differential) ++ cor |= (BIT(chan->channel) | ++ BIT(chan->channel2)) << ++ AT91_SAMA5D2_COR_DIFF_OFFSET; ++ else ++ cor &= ~(BIT(chan->channel) << ++ AT91_SAMA5D2_COR_DIFF_OFFSET); ++ ++ at91_adc_writel(st, AT91_SAMA5D2_COR, cor); ++ } + + if (state) { + at91_adc_writel(st, AT91_SAMA5D2_CHER, +@@ -398,8 +436,11 @@ static irqreturn_t at91_adc_trigger_handler(int irq, void *p) + u8 bit; + + for_each_set_bit(bit, indio->active_scan_mask, indio->num_channels) { +- struct iio_chan_spec const *chan = indio->channels + bit; ++ struct iio_chan_spec const *chan = ++ at91_adc_chan_get(indio, bit); + ++ if (!chan) ++ continue; + st->buffer[i] = at91_adc_readl(st, chan->address); + i++; + } +diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c +index 0bff76e96950..283ecd4ea800 100644 +--- a/drivers/iio/magnetometer/ak8974.c ++++ b/drivers/iio/magnetometer/ak8974.c +@@ -563,7 +563,7 @@ static int ak8974_read_raw(struct iio_dev *indio_dev, + * We read all axes and discard all but one, for optimized + * reading, use the triggered buffer. + */ +- *val = le16_to_cpu(hw_values[chan->address]); ++ *val = (s16)le16_to_cpu(hw_values[chan->address]); + + ret = IIO_VAL_INT; + } +diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c +index eb212f8c8879..0e4da570f22f 100644 +--- a/drivers/iio/trigger/stm32-timer-trigger.c ++++ b/drivers/iio/trigger/stm32-timer-trigger.c +@@ -161,7 +161,8 @@ static int stm32_timer_start(struct stm32_timer_trigger *priv, + return 0; + } + +-static void stm32_timer_stop(struct stm32_timer_trigger *priv) ++static void stm32_timer_stop(struct stm32_timer_trigger *priv, ++ struct iio_trigger *trig) + { + u32 ccer, cr1; + +@@ -179,6 +180,12 @@ static void stm32_timer_stop(struct stm32_timer_trigger *priv) + regmap_write(priv->regmap, TIM_PSC, 0); + regmap_write(priv->regmap, TIM_ARR, 0); + ++ /* Force disable master mode */ ++ if (stm32_timer_is_trgo2_name(trig->name)) ++ regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS2, 0); ++ else ++ regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS, 0); ++ + /* Make sure that registers are updated */ + regmap_update_bits(priv->regmap, TIM_EGR, TIM_EGR_UG, TIM_EGR_UG); + } +@@ -197,7 +204,7 @@ static ssize_t stm32_tt_store_frequency(struct device *dev, + return ret; + + if (freq == 0) { +- stm32_timer_stop(priv); ++ stm32_timer_stop(priv, trig); + } else { + ret = stm32_timer_start(priv, trig, freq); + if (ret) +diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c +index ce8e3009344a..f4770601e6bf 100644 +--- a/drivers/infiniband/core/security.c ++++ b/drivers/infiniband/core/security.c +@@ -348,16 +348,11 @@ static struct ib_ports_pkeys *get_new_pps(const struct ib_qp *qp, + else if (qp_pps) + new_pps->main.pkey_index = qp_pps->main.pkey_index; + +- if ((qp_attr_mask & IB_QP_PKEY_INDEX) && (qp_attr_mask & IB_QP_PORT)) ++ if (((qp_attr_mask & IB_QP_PKEY_INDEX) && ++ (qp_attr_mask & IB_QP_PORT)) || ++ (qp_pps && qp_pps->main.state != IB_PORT_PKEY_NOT_VALID)) + new_pps->main.state = IB_PORT_PKEY_VALID; + +- if (!(qp_attr_mask & (IB_QP_PKEY_INDEX | IB_QP_PORT)) && qp_pps) { +- new_pps->main.port_num = qp_pps->main.port_num; +- new_pps->main.pkey_index = qp_pps->main.pkey_index; +- if (qp_pps->main.state != IB_PORT_PKEY_NOT_VALID) +- new_pps->main.state = IB_PORT_PKEY_VALID; +- } +- + if (qp_attr_mask & IB_QP_ALT_PATH) { + new_pps->alt.port_num = qp_attr->alt_port_num; + new_pps->alt.pkey_index = qp_attr->alt_pkey_index; +diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c +index 84c962820aa2..0cb60072c82f 100644 +--- a/drivers/infiniband/hw/mlx5/qp.c ++++ b/drivers/infiniband/hw/mlx5/qp.c +@@ -4896,6 +4896,10 @@ struct ib_wq *mlx5_ib_create_wq(struct ib_pd *pd, + if (udata->outlen && udata->outlen < min_resp_len) + return ERR_PTR(-EINVAL); + ++ if (!capable(CAP_SYS_RAWIO) && ++ init_attr->create_flags & IB_WQ_FLAGS_DELAY_DROP) ++ return ERR_PTR(-EPERM); ++ + dev = to_mdev(pd->device); + switch (init_attr->wq_type) { + case IB_WQT_RQ: +diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c +index 5f764e0993a4..2bca84f4c2b2 100644 +--- a/drivers/input/mouse/synaptics.c ++++ b/drivers/input/mouse/synaptics.c +@@ -189,6 +189,7 @@ static const char * const smbus_pnp_ids[] = { + "SYN3052", /* HP EliteBook 840 G4 */ + "SYN3221", /* HP 15-ay000 */ + "SYN323d", /* HP Spectre X360 13-w013dx */ ++ "SYN3257", /* HP Envy 13-ad105ng */ + NULL + }; + +diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c +index 4f1d3fd5d412..7da44956555e 100644 +--- a/drivers/input/touchscreen/raydium_i2c_ts.c ++++ b/drivers/input/touchscreen/raydium_i2c_ts.c +@@ -441,7 +441,7 @@ static int raydium_i2c_write_object(struct i2c_client *client, + return 0; + } + +-static bool raydium_i2c_boot_trigger(struct i2c_client *client) ++static int raydium_i2c_boot_trigger(struct i2c_client *client) + { + static const u8 cmd[7][6] = { + { 0x08, 0x0C, 0x09, 0x00, 0x50, 0xD7 }, +@@ -469,7 +469,7 @@ static bool raydium_i2c_boot_trigger(struct i2c_client *client) + return 0; + } + +-static bool raydium_i2c_fw_trigger(struct i2c_client *client) ++static int raydium_i2c_fw_trigger(struct i2c_client *client) + { + static const u8 cmd[5][11] = { + { 0, 0x09, 0x71, 0x0C, 0x09, 0x00, 0x50, 0xD7, 0, 0, 0 }, +diff --git a/drivers/md/dm-bio-record.h b/drivers/md/dm-bio-record.h +index c82578af56a5..2ea0360108e1 100644 +--- a/drivers/md/dm-bio-record.h ++++ b/drivers/md/dm-bio-record.h +@@ -20,8 +20,13 @@ + struct dm_bio_details { + struct gendisk *bi_disk; + u8 bi_partno; ++ int __bi_remaining; + unsigned long bi_flags; + struct bvec_iter bi_iter; ++ bio_end_io_t *bi_end_io; ++#if defined(CONFIG_BLK_DEV_INTEGRITY) ++ struct bio_integrity_payload *bi_integrity; ++#endif + }; + + static inline void dm_bio_record(struct dm_bio_details *bd, struct bio *bio) +@@ -30,6 +35,11 @@ static inline void dm_bio_record(struct dm_bio_details *bd, struct bio *bio) + bd->bi_partno = bio->bi_partno; + bd->bi_flags = bio->bi_flags; + bd->bi_iter = bio->bi_iter; ++ bd->__bi_remaining = atomic_read(&bio->__bi_remaining); ++ bd->bi_end_io = bio->bi_end_io; ++#if defined(CONFIG_BLK_DEV_INTEGRITY) ++ bd->bi_integrity = bio_integrity(bio); ++#endif + } + + static inline void dm_bio_restore(struct dm_bio_details *bd, struct bio *bio) +@@ -38,6 +48,11 @@ static inline void dm_bio_restore(struct dm_bio_details *bd, struct bio *bio) + bio->bi_partno = bd->bi_partno; + bio->bi_flags = bd->bi_flags; + bio->bi_iter = bd->bi_iter; ++ atomic_set(&bio->__bi_remaining, bd->__bi_remaining); ++ bio->bi_end_io = bd->bi_end_io; ++#if defined(CONFIG_BLK_DEV_INTEGRITY) ++ bio->bi_integrity = bd->bi_integrity; ++#endif + } + + #endif +diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c +index 427cda457af6..5104678f29b7 100644 +--- a/drivers/media/usb/b2c2/flexcop-usb.c ++++ b/drivers/media/usb/b2c2/flexcop-usb.c +@@ -510,6 +510,9 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb) + return ret; + } + ++ if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1) ++ return -ENODEV; ++ + switch (fc_usb->udev->speed) { + case USB_SPEED_LOW: + err("cannot handle USB speed because it is too slow."); +@@ -543,9 +546,6 @@ static int flexcop_usb_probe(struct usb_interface *intf, + struct flexcop_device *fc = NULL; + int ret; + +- if (intf->cur_altsetting->desc.bNumEndpoints < 1) +- return -ENODEV; +- + if ((fc = flexcop_device_kmalloc(sizeof(struct flexcop_usb))) == NULL) { + err("out of memory\n"); + return -ENOMEM; +diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c +index 1ee7ec558293..33dd54c8fa04 100644 +--- a/drivers/media/usb/dvb-usb/dib0700_core.c ++++ b/drivers/media/usb/dvb-usb/dib0700_core.c +@@ -821,7 +821,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf) + + /* Starting in firmware 1.20, the RC info is provided on a bulk pipe */ + +- if (intf->altsetting[0].desc.bNumEndpoints < rc_ep + 1) ++ if (intf->cur_altsetting->desc.bNumEndpoints < rc_ep + 1) + return -ENODEV; + + purb = usb_alloc_urb(0, GFP_KERNEL); +@@ -841,7 +841,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf) + * Some devices like the Hauppauge NovaTD model 52009 use an interrupt + * endpoint, while others use a bulk one. + */ +- e = &intf->altsetting[0].endpoint[rc_ep].desc; ++ e = &intf->cur_altsetting->endpoint[rc_ep].desc; + if (usb_endpoint_dir_in(e)) { + if (usb_endpoint_xfer_bulk(e)) { + pipe = usb_rcvbulkpipe(d->udev, rc_ep); +diff --git a/drivers/media/usb/gspca/ov519.c b/drivers/media/usb/gspca/ov519.c +index 8106a47a0dd0..b51d2de1aca8 100644 +--- a/drivers/media/usb/gspca/ov519.c ++++ b/drivers/media/usb/gspca/ov519.c +@@ -3478,6 +3478,11 @@ static void ov511_mode_init_regs(struct sd *sd) + return; + } + ++ if (alt->desc.bNumEndpoints < 1) { ++ sd->gspca_dev.usb_err = -ENODEV; ++ return; ++ } ++ + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + reg_w(sd, R51x_FIFO_PSIZE, packet_size >> 5); + +@@ -3604,6 +3609,11 @@ static void ov518_mode_init_regs(struct sd *sd) + return; + } + ++ if (alt->desc.bNumEndpoints < 1) { ++ sd->gspca_dev.usb_err = -ENODEV; ++ return; ++ } ++ + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + ov518_reg_w32(sd, R51x_FIFO_PSIZE, packet_size & ~7, 2); + +diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx.c b/drivers/media/usb/gspca/stv06xx/stv06xx.c +index e72c3e1ab9ff..9caa5ef9d9e0 100644 +--- a/drivers/media/usb/gspca/stv06xx/stv06xx.c ++++ b/drivers/media/usb/gspca/stv06xx/stv06xx.c +@@ -289,6 +289,9 @@ static int stv06xx_start(struct gspca_dev *gspca_dev) + return -EIO; + } + ++ if (alt->desc.bNumEndpoints < 1) ++ return -ENODEV; ++ + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + err = stv06xx_write_bridge(sd, STV_ISO_SIZE_L, packet_size); + if (err < 0) +@@ -313,11 +316,21 @@ out: + + static int stv06xx_isoc_init(struct gspca_dev *gspca_dev) + { ++ struct usb_interface_cache *intfc; + struct usb_host_interface *alt; + struct sd *sd = (struct sd *) gspca_dev; + ++ intfc = gspca_dev->dev->actconfig->intf_cache[0]; ++ ++ if (intfc->num_altsetting < 2) ++ return -ENODEV; ++ ++ alt = &intfc->altsetting[1]; ++ ++ if (alt->desc.bNumEndpoints < 1) ++ return -ENODEV; ++ + /* Start isoc bandwidth "negotiation" at max isoc bandwidth */ +- alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1]; + alt->endpoint[0].desc.wMaxPacketSize = + cpu_to_le16(sd->sensor->max_packet_size[gspca_dev->curr_mode]); + +@@ -330,6 +343,10 @@ static int stv06xx_isoc_nego(struct gspca_dev *gspca_dev) + struct usb_host_interface *alt; + struct sd *sd = (struct sd *) gspca_dev; + ++ /* ++ * Existence of altsetting and endpoint was verified in ++ * stv06xx_isoc_init() ++ */ + alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1]; + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + min_packet_size = sd->sensor->min_packet_size[gspca_dev->curr_mode]; +diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c b/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c +index e1ce96e9405f..8d855b2756ba 100644 +--- a/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c ++++ b/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c +@@ -194,6 +194,10 @@ static int pb0100_start(struct sd *sd) + alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt); + if (!alt) + return -ENODEV; ++ ++ if (alt->desc.bNumEndpoints < 1) ++ return -ENODEV; ++ + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + + /* If we don't have enough bandwidth use a lower framerate */ +diff --git a/drivers/media/usb/gspca/xirlink_cit.c b/drivers/media/usb/gspca/xirlink_cit.c +index 68656e7986c7..765a5d03e7cc 100644 +--- a/drivers/media/usb/gspca/xirlink_cit.c ++++ b/drivers/media/usb/gspca/xirlink_cit.c +@@ -1451,6 +1451,9 @@ static int cit_get_packet_size(struct gspca_dev *gspca_dev) + return -EIO; + } + ++ if (alt->desc.bNumEndpoints < 1) ++ return -ENODEV; ++ + return le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + } + +@@ -2634,6 +2637,7 @@ static int sd_start(struct gspca_dev *gspca_dev) + + static int sd_isoc_init(struct gspca_dev *gspca_dev) + { ++ struct usb_interface_cache *intfc; + struct usb_host_interface *alt; + int max_packet_size; + +@@ -2649,8 +2653,17 @@ static int sd_isoc_init(struct gspca_dev *gspca_dev) + break; + } + ++ intfc = gspca_dev->dev->actconfig->intf_cache[0]; ++ ++ if (intfc->num_altsetting < 2) ++ return -ENODEV; ++ ++ alt = &intfc->altsetting[1]; ++ ++ if (alt->desc.bNumEndpoints < 1) ++ return -ENODEV; ++ + /* Start isoc bandwidth "negotiation" at max isoc bandwidth */ +- alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1]; + alt->endpoint[0].desc.wMaxPacketSize = cpu_to_le16(max_packet_size); + + return 0; +@@ -2673,6 +2686,9 @@ static int sd_isoc_nego(struct gspca_dev *gspca_dev) + break; + } + ++ /* ++ * Existence of altsetting and endpoint was verified in sd_isoc_init() ++ */ + alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1]; + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); + if (packet_size <= min_packet_size) +diff --git a/drivers/media/usb/usbtv/usbtv-core.c b/drivers/media/usb/usbtv/usbtv-core.c +index 68df16b3ce72..50a61143898b 100644 +--- a/drivers/media/usb/usbtv/usbtv-core.c ++++ b/drivers/media/usb/usbtv/usbtv-core.c +@@ -56,7 +56,7 @@ int usbtv_set_regs(struct usbtv *usbtv, const u16 regs[][2], int size) + + ret = usb_control_msg(usbtv->udev, pipe, USBTV_REQUEST_REG, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, +- value, index, NULL, 0, 0); ++ value, index, NULL, 0, USB_CTRL_GET_TIMEOUT); + if (ret < 0) + return ret; + } +diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c +index 3668a04359e8..7c23d82313a8 100644 +--- a/drivers/media/usb/usbtv/usbtv-video.c ++++ b/drivers/media/usb/usbtv/usbtv-video.c +@@ -720,7 +720,8 @@ static int usbtv_s_ctrl(struct v4l2_ctrl *ctrl) + ret = usb_control_msg(usbtv->udev, + usb_rcvctrlpipe(usbtv->udev, 0), USBTV_CONTROL_REG, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, +- 0, USBTV_BASE + 0x0244, (void *)data, 3, 0); ++ 0, USBTV_BASE + 0x0244, (void *)data, 3, ++ USB_CTRL_GET_TIMEOUT); + if (ret < 0) + goto error; + } +@@ -771,7 +772,7 @@ static int usbtv_s_ctrl(struct v4l2_ctrl *ctrl) + ret = usb_control_msg(usbtv->udev, usb_sndctrlpipe(usbtv->udev, 0), + USBTV_CONTROL_REG, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, +- 0, index, (void *)data, size, 0); ++ 0, index, (void *)data, size, USB_CTRL_SET_TIMEOUT); + + error: + if (ret < 0) +diff --git a/drivers/misc/altera-stapl/altera.c b/drivers/misc/altera-stapl/altera.c +index 494e263daa74..b7ee8043a133 100644 +--- a/drivers/misc/altera-stapl/altera.c ++++ b/drivers/misc/altera-stapl/altera.c +@@ -2126,8 +2126,8 @@ exit_done: + return status; + } + +-static int altera_get_note(u8 *p, s32 program_size, +- s32 *offset, char *key, char *value, int length) ++static int altera_get_note(u8 *p, s32 program_size, s32 *offset, ++ char *key, char *value, int keylen, int vallen) + /* + * Gets key and value of NOTE fields in the JBC file. + * Can be called in two modes: if offset pointer is NULL, +@@ -2184,7 +2184,7 @@ static int altera_get_note(u8 *p, s32 program_size, + &p[note_table + (8 * i) + 4])]; + + if (value != NULL) +- strlcpy(value, value_ptr, length); ++ strlcpy(value, value_ptr, vallen); + + } + } +@@ -2203,13 +2203,13 @@ static int altera_get_note(u8 *p, s32 program_size, + strlcpy(key, &p[note_strings + + get_unaligned_be32( + &p[note_table + (8 * i)])], +- length); ++ keylen); + + if (value != NULL) + strlcpy(value, &p[note_strings + + get_unaligned_be32( + &p[note_table + (8 * i) + 4])], +- length); ++ vallen); + + *offset = i + 1; + } +@@ -2463,7 +2463,7 @@ int altera_init(struct altera_config *config, const struct firmware *fw) + __func__, (format_version == 2) ? "Jam STAPL" : + "pre-standardized Jam 1.1"); + while (altera_get_note((u8 *)fw->data, fw->size, +- &offset, key, value, 256) == 0) ++ &offset, key, value, 32, 256) == 0) + printk(KERN_INFO "%s: NOTE \"%s\" = \"%s\"\n", + __func__, key, value); + } +diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c +index 1dadd460cc8f..78c9ac33b562 100644 +--- a/drivers/mmc/host/sdhci-of-at91.c ++++ b/drivers/mmc/host/sdhci-of-at91.c +@@ -125,7 +125,8 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask) + { + sdhci_reset(host, mask); + +- if (host->mmc->caps & MMC_CAP_NONREMOVABLE) ++ if ((host->mmc->caps & MMC_CAP_NONREMOVABLE) ++ || mmc_gpio_get_cd(host->mmc) >= 0) + sdhci_at91_set_force_card_detect(host); + } + +@@ -404,8 +405,11 @@ static int sdhci_at91_probe(struct platform_device *pdev) + * detection procedure using the SDMCC_CD signal is bypassed. + * This bit is reset when a software reset for all command is performed + * so we need to implement our own reset function to set back this bit. ++ * ++ * WA: SAMA5D2 doesn't drive CMD if using CD GPIO line. + */ +- if (host->mmc->caps & MMC_CAP_NONREMOVABLE) ++ if ((host->mmc->caps & MMC_CAP_NONREMOVABLE) ++ || mmc_gpio_get_cd(host->mmc) >= 0) + sdhci_at91_set_force_card_detect(host); + + pm_runtime_put_autosuspend(&pdev->dev); +diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c +index 35564a9561b7..7c37b96ff22a 100644 +--- a/drivers/net/can/slcan.c ++++ b/drivers/net/can/slcan.c +@@ -621,7 +621,10 @@ err_free_chan: + tty->disc_data = NULL; + clear_bit(SLF_INUSE, &sl->flags); + slc_free_netdev(sl->dev); ++ /* do not call free_netdev before rtnl_unlock */ ++ rtnl_unlock(); + free_netdev(sl->dev); ++ return err; + + err_exit: + rtnl_unlock(); +diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c +index 3b073e152237..58c16aa00a70 100644 +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -549,7 +549,7 @@ mt7530_mib_reset(struct dsa_switch *ds) + static void + mt7530_port_set_status(struct mt7530_priv *priv, int port, int enable) + { +- u32 mask = PMCR_TX_EN | PMCR_RX_EN; ++ u32 mask = PMCR_TX_EN | PMCR_RX_EN | PMCR_FORCE_LNK; + + if (enable) + mt7530_set(priv, MT7530_PMCR_P(port), mask); +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c +index fed37cd9ae1d..125e22ffe2ae 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c +@@ -387,24 +387,26 @@ static int bnxt_dcbnl_ieee_getets(struct net_device *dev, struct ieee_ets *ets) + { + struct bnxt *bp = netdev_priv(dev); + struct ieee_ets *my_ets = bp->ieee_ets; ++ int rc; + + ets->ets_cap = bp->max_tc; + + if (!my_ets) { +- int rc; +- + if (bp->dcbx_cap & DCB_CAP_DCBX_HOST) + return 0; + + my_ets = kzalloc(sizeof(*my_ets), GFP_KERNEL); + if (!my_ets) +- return 0; ++ return -ENOMEM; + rc = bnxt_hwrm_queue_cos2bw_qcfg(bp, my_ets); + if (rc) +- return 0; ++ goto error; + rc = bnxt_hwrm_queue_pri2cos_qcfg(bp, my_ets); + if (rc) +- return 0; ++ goto error; ++ ++ /* cache result */ ++ bp->ieee_ets = my_ets; + } + + ets->cbs = my_ets->cbs; +@@ -413,6 +415,9 @@ static int bnxt_dcbnl_ieee_getets(struct net_device *dev, struct ieee_ets *ets) + memcpy(ets->tc_tsa, my_ets->tc_tsa, sizeof(ets->tc_tsa)); + memcpy(ets->prio_tc, my_ets->prio_tc, sizeof(ets->prio_tc)); + return 0; ++error: ++ kfree(my_ets); ++ return rc; + } + + static int bnxt_dcbnl_ieee_setets(struct net_device *dev, struct ieee_ets *ets) +diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +index 39b8b6730e77..67246d42c3d9 100644 +--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c ++++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +@@ -2646,9 +2646,7 @@ static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl) + headroom = (u16)(bl->priv_data_size + DPAA_PARSE_RESULTS_SIZE + + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE); + +- return DPAA_FD_DATA_ALIGNMENT ? ALIGN(headroom, +- DPAA_FD_DATA_ALIGNMENT) : +- headroom; ++ return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT); + } + + static int dpaa_eth_probe(struct platform_device *pdev) +diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig +index 8870a9a798ca..91437b94bfcb 100644 +--- a/drivers/net/ethernet/freescale/fman/Kconfig ++++ b/drivers/net/ethernet/freescale/fman/Kconfig +@@ -8,3 +8,31 @@ config FSL_FMAN + help + Freescale Data-Path Acceleration Architecture Frame Manager + (FMan) support ++ ++config DPAA_ERRATUM_A050385 ++ bool ++ depends on ARM64 && FSL_DPAA ++ default y ++ help ++ DPAA FMan erratum A050385 software workaround implementation: ++ align buffers, data start, SG fragment length to avoid FMan DMA ++ splits. ++ FMAN DMA read or writes under heavy traffic load may cause FMAN ++ internal resource leak thus stopping further packet processing. ++ The FMAN internal queue can overflow when FMAN splits single ++ read or write transactions into multiple smaller transactions ++ such that more than 17 AXI transactions are in flight from FMAN ++ to interconnect. When the FMAN internal queue overflows, it can ++ stall further packet processing. The issue can occur with any ++ one of the following three conditions: ++ 1. FMAN AXI transaction crosses 4K address boundary (Errata ++ A010022) ++ 2. FMAN DMA address for an AXI transaction is not 16 byte ++ aligned, i.e. the last 4 bits of an address are non-zero ++ 3. Scatter Gather (SG) frames have more than one SG buffer in ++ the SG list and any one of the buffers, except the last ++ buffer in the SG list has data size that is not a multiple ++ of 16 bytes, i.e., other than 16, 32, 48, 64, etc. ++ With any one of the above three conditions present, there is ++ likelihood of stalled FMAN packet processing, especially under ++ stress with multiple ports injecting line-rate traffic. +diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c +index 97425d94e280..9080d2332d03 100644 +--- a/drivers/net/ethernet/freescale/fman/fman.c ++++ b/drivers/net/ethernet/freescale/fman/fman.c +@@ -1,5 +1,6 @@ + /* + * Copyright 2008-2015 Freescale Semiconductor Inc. ++ * Copyright 2020 NXP + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: +@@ -566,6 +567,10 @@ struct fman_cfg { + u32 qmi_def_tnums_thresh; + }; + ++#ifdef CONFIG_DPAA_ERRATUM_A050385 ++static bool fman_has_err_a050385; ++#endif ++ + static irqreturn_t fman_exceptions(struct fman *fman, + enum fman_exceptions exception) + { +@@ -2517,6 +2522,14 @@ struct fman *fman_bind(struct device *fm_dev) + } + EXPORT_SYMBOL(fman_bind); + ++#ifdef CONFIG_DPAA_ERRATUM_A050385 ++bool fman_has_errata_a050385(void) ++{ ++ return fman_has_err_a050385; ++} ++EXPORT_SYMBOL(fman_has_errata_a050385); ++#endif ++ + static irqreturn_t fman_err_irq(int irq, void *handle) + { + struct fman *fman = (struct fman *)handle; +@@ -2843,6 +2856,11 @@ static struct fman *read_dts_node(struct platform_device *of_dev) + goto fman_free; + } + ++#ifdef CONFIG_DPAA_ERRATUM_A050385 ++ fman_has_err_a050385 = ++ of_property_read_bool(fm_node, "fsl,erratum-a050385"); ++#endif ++ + return fman; + + fman_node_put: +diff --git a/drivers/net/ethernet/freescale/fman/fman.h b/drivers/net/ethernet/freescale/fman/fman.h +index bfa02e0014ae..693401994fa2 100644 +--- a/drivers/net/ethernet/freescale/fman/fman.h ++++ b/drivers/net/ethernet/freescale/fman/fman.h +@@ -1,5 +1,6 @@ + /* + * Copyright 2008-2015 Freescale Semiconductor Inc. ++ * Copyright 2020 NXP + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: +@@ -397,6 +398,10 @@ u16 fman_get_max_frm(void); + + int fman_get_rx_extra_headroom(void); + ++#ifdef CONFIG_DPAA_ERRATUM_A050385 ++bool fman_has_errata_a050385(void); ++#endif ++ + struct fman *fman_bind(struct device *dev); + + #endif /* __FM_H */ +diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c +index a0c64b30f81a..a115e51dc211 100644 +--- a/drivers/net/ethernet/marvell/mvneta.c ++++ b/drivers/net/ethernet/marvell/mvneta.c +@@ -2759,11 +2759,10 @@ static int mvneta_poll(struct napi_struct *napi, int budget) + /* For the case where the last mvneta_poll did not process all + * RX packets + */ +- rx_queue = fls(((cause_rx_tx >> 8) & 0xff)); +- + cause_rx_tx |= pp->neta_armada3700 ? pp->cause_rx_tx : + port->cause_rx_tx; + ++ rx_queue = fls(((cause_rx_tx >> 8) & 0xff)); + if (rx_queue) { + rx_queue = rx_queue - 1; + if (pp->bm_priv) +diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c +index c699a779757e..1b0e1fc7825f 100644 +--- a/drivers/net/ethernet/micrel/ks8851_mll.c ++++ b/drivers/net/ethernet/micrel/ks8851_mll.c +@@ -474,6 +474,50 @@ static int msg_enable; + * chip is busy transferring packet data (RX/TX FIFO accesses). + */ + ++/** ++ * ks_check_endian - Check whether endianness of the bus is correct ++ * @ks : The chip information ++ * ++ * The KS8851-16MLL EESK pin allows selecting the endianness of the 16bit ++ * bus. To maintain optimum performance, the bus endianness should be set ++ * such that it matches the endianness of the CPU. ++ */ ++ ++static int ks_check_endian(struct ks_net *ks) ++{ ++ u16 cider; ++ ++ /* ++ * Read CIDER register first, however read it the "wrong" way around. ++ * If the endian strap on the KS8851-16MLL in incorrect and the chip ++ * is operating in different endianness than the CPU, then the meaning ++ * of BE[3:0] byte-enable bits is also swapped such that: ++ * BE[3,2,1,0] becomes BE[1,0,3,2] ++ * ++ * Luckily for us, the byte-enable bits are the top four MSbits of ++ * the address register and the CIDER register is at offset 0xc0. ++ * Hence, by reading address 0xc0c0, which is not impacted by endian ++ * swapping, we assert either BE[3:2] or BE[1:0] while reading the ++ * CIDER register. ++ * ++ * If the bus configuration is correct, reading 0xc0c0 asserts ++ * BE[3:2] and this read returns 0x0000, because to read register ++ * with bottom two LSbits of address set to 0, BE[1:0] must be ++ * asserted. ++ * ++ * If the bus configuration is NOT correct, reading 0xc0c0 asserts ++ * BE[1:0] and this read returns non-zero 0x8872 value. ++ */ ++ iowrite16(BE3 | BE2 | KS_CIDER, ks->hw_addr_cmd); ++ cider = ioread16(ks->hw_addr); ++ if (!cider) ++ return 0; ++ ++ netdev_err(ks->netdev, "incorrect EESK endian strap setting\n"); ++ ++ return -EINVAL; ++} ++ + /** + * ks_rdreg16 - read 16 bit register from device + * @ks : The chip information +@@ -484,7 +528,7 @@ static int msg_enable; + + static u16 ks_rdreg16(struct ks_net *ks, int offset) + { +- ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02)); ++ ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02)); + iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); + return ioread16(ks->hw_addr); + } +@@ -499,7 +543,7 @@ static u16 ks_rdreg16(struct ks_net *ks, int offset) + + static void ks_wrreg16(struct ks_net *ks, int offset, u16 value) + { +- ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02)); ++ ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02)); + iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); + iowrite16(value, ks->hw_addr); + } +@@ -515,7 +559,7 @@ static inline void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len) + { + len >>= 1; + while (len--) +- *wptr++ = be16_to_cpu(ioread16(ks->hw_addr)); ++ *wptr++ = (u16)ioread16(ks->hw_addr); + } + + /** +@@ -529,7 +573,7 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len) + { + len >>= 1; + while (len--) +- iowrite16(cpu_to_be16(*wptr++), ks->hw_addr); ++ iowrite16(*wptr++, ks->hw_addr); + } + + static void ks_disable_int(struct ks_net *ks) +@@ -1539,6 +1583,10 @@ static int ks8851_probe(struct platform_device *pdev) + goto err_free; + } + ++ err = ks_check_endian(ks); ++ if (err) ++ goto err_free; ++ + netdev->irq = platform_get_irq(pdev, 0); + + if ((int)netdev->irq < 0) { +diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +index 89831adb8eb7..6d27eec85fce 100644 +--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c ++++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +@@ -2284,7 +2284,7 @@ static int __init sxgbe_cmdline_opt(char *str) + if (!str || !*str) + return -EINVAL; + while ((opt = strsep(&str, ",")) != NULL) { +- if (!strncmp(opt, "eee_timer:", 6)) { ++ if (!strncmp(opt, "eee_timer:", 10)) { + if (kstrtoint(opt + 10, 0, &eee_timer)) + goto err; + } +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +index 712b5eb3507a..4156cf007b53 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +@@ -1362,7 +1362,7 @@ static int rk_gmac_probe(struct platform_device *pdev) + + ret = rk_gmac_clk_init(plat_dat); + if (ret) +- return ret; ++ goto err_remove_config_dt; + + ret = rk_gmac_powerup(plat_dat->bsp_priv); + if (ret) +diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c +index c2c3ce5653db..5959e8817a1b 100644 +--- a/drivers/net/macsec.c ++++ b/drivers/net/macsec.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + #include + +@@ -3219,6 +3220,8 @@ static int macsec_newlink(struct net *net, struct net_device *dev, + real_dev = __dev_get_by_index(net, nla_get_u32(tb[IFLA_LINK])); + if (!real_dev) + return -ENODEV; ++ if (real_dev->type != ARPHRD_ETHER) ++ return -EINVAL; + + dev->priv_flags |= IFF_MACSEC; + +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index a8d5561afc7d..e028e03765a5 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -1139,6 +1139,7 @@ static const struct usb_device_id products[] = { + {QMI_FIXED_INTF(0x1435, 0xd181, 4)}, /* Wistron NeWeb D18Q1 */ + {QMI_FIXED_INTF(0x1435, 0xd181, 5)}, /* Wistron NeWeb D18Q1 */ + {QMI_QUIRK_SET_DTR(0x1508, 0x1001, 4)}, /* Fibocom NL668 series */ ++ {QMI_FIXED_INTF(0x1690, 0x7588, 4)}, /* ASKEY WWHC050 */ + {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */ + {QMI_FIXED_INTF(0x16d8, 0x6007, 0)}, /* CMOTech CHE-628S */ + {QMI_FIXED_INTF(0x16d8, 0x6008, 0)}, /* CMOTech CMU-301 */ +diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c +index e0cea5c05f0e..03e4fcdfeab7 100644 +--- a/drivers/net/vrf.c ++++ b/drivers/net/vrf.c +@@ -996,23 +996,24 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev, + struct sk_buff *skb) + { + int orig_iif = skb->skb_iif; +- bool need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr); +- bool is_ndisc = ipv6_ndisc_frame(skb); ++ bool need_strict; + +- /* loopback, multicast & non-ND link-local traffic; do not push through +- * packet taps again. Reset pkt_type for upper layers to process skb ++ /* loopback traffic; do not push through packet taps again. ++ * Reset pkt_type for upper layers to process skb + */ +- if (skb->pkt_type == PACKET_LOOPBACK || (need_strict && !is_ndisc)) { ++ if (skb->pkt_type == PACKET_LOOPBACK) { + skb->dev = vrf_dev; + skb->skb_iif = vrf_dev->ifindex; + IP6CB(skb)->flags |= IP6SKB_L3SLAVE; +- if (skb->pkt_type == PACKET_LOOPBACK) +- skb->pkt_type = PACKET_HOST; ++ skb->pkt_type = PACKET_HOST; + goto out; + } + +- /* if packet is NDISC then keep the ingress interface */ +- if (!is_ndisc) { ++ /* if packet is NDISC or addressed to multicast or link-local ++ * then keep the ingress interface ++ */ ++ need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr); ++ if (!ipv6_ndisc_frame(skb) && !need_strict) { + vrf_rx_stats(vrf_dev, skb->len); + skb->dev = vrf_dev; + skb->skb_iif = vrf_dev->ifindex; +diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c +index 4d97a7b5fe3c..927d62c76a60 100644 +--- a/drivers/net/vxlan.c ++++ b/drivers/net/vxlan.c +@@ -2454,10 +2454,19 @@ static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan, + /* Setup stats when device is created */ + static int vxlan_init(struct net_device *dev) + { ++ struct vxlan_dev *vxlan = netdev_priv(dev); ++ int err; ++ + dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); + if (!dev->tstats) + return -ENOMEM; + ++ err = gro_cells_init(&vxlan->gro_cells, dev); ++ if (err) { ++ free_percpu(dev->tstats); ++ return err; ++ } ++ + return 0; + } + +@@ -2717,8 +2726,6 @@ static void vxlan_setup(struct net_device *dev) + + vxlan->dev = dev; + +- gro_cells_init(&vxlan->gro_cells, dev); +- + for (h = 0; h < FDB_HASH_SIZE; ++h) + INIT_HLIST_HEAD(&vxlan->fdb_head[h]); + } +diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c +index ec50027b0d8b..3195bae1685f 100644 +--- a/drivers/nfc/fdp/fdp.c ++++ b/drivers/nfc/fdp/fdp.c +@@ -192,7 +192,7 @@ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type) + const struct firmware *fw; + struct sk_buff *skb; + unsigned long len; +- u8 max_size, payload_size; ++ int max_size, payload_size; + int rc = 0; + + if ((type == NCI_PATCH_TYPE_OTP && !info->otp_patch) || +@@ -215,8 +215,7 @@ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type) + + while (len) { + +- payload_size = min_t(unsigned long, (unsigned long) max_size, +- len); ++ payload_size = min_t(unsigned long, max_size, len); + + skb = nci_skb_alloc(ndev, (NCI_CTRL_HDR_SIZE + payload_size), + GFP_KERNEL); +diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c +index fe26697d3bd7..69da2f6896da 100644 +--- a/drivers/of/of_mdio.c ++++ b/drivers/of/of_mdio.c +@@ -259,6 +259,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) + rc = of_mdiobus_register_phy(mdio, child, addr); + if (rc && rc != -ENODEV) + goto unregister; ++ break; + } + } + } +diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c +index 3303dd8d8eb5..604e549a9a47 100644 +--- a/drivers/perf/arm_pmu_acpi.c ++++ b/drivers/perf/arm_pmu_acpi.c +@@ -25,8 +25,6 @@ static int arm_pmu_acpi_register_irq(int cpu) + int gsi, trigger; + + gicc = acpi_cpu_get_madt_gicc(cpu); +- if (WARN_ON(!gicc)) +- return -EINVAL; + + gsi = gicc->performance_interrupt; + +@@ -65,11 +63,10 @@ static void arm_pmu_acpi_unregister_irq(int cpu) + int gsi; + + gicc = acpi_cpu_get_madt_gicc(cpu); +- if (!gicc) +- return; + + gsi = gicc->performance_interrupt; +- acpi_unregister_gsi(gsi); ++ if (gsi) ++ acpi_unregister_gsi(gsi); + } + + static int arm_pmu_acpi_parse_irqs(void) +diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c +index 74997194fd88..92205b90c25c 100644 +--- a/drivers/platform/x86/pmc_atom.c ++++ b/drivers/platform/x86/pmc_atom.c +@@ -443,6 +443,14 @@ static const struct dmi_system_id critclk_systems[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "3I380D"), + }, + }, ++ { ++ /* pmc_plt_clk* - are used for ethernet controllers */ ++ .ident = "Lex 2I385SW", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Lex BayTrail"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "2I385SW"), ++ }, ++ }, + { + /* pmc_plt_clk* - are used for ethernet controllers */ + .ident = "Beckhoff CB3163", +diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig +index e0e58f3b1420..68b76e6ddc1e 100644 +--- a/drivers/rtc/Kconfig ++++ b/drivers/rtc/Kconfig +@@ -323,6 +323,7 @@ config RTC_DRV_MAX6900 + config RTC_DRV_MAX8907 + tristate "Maxim MAX8907" + depends on MFD_MAX8907 || COMPILE_TEST ++ select REGMAP_IRQ + help + If you say yes here you will get support for the + RTC of Maxim MAX8907 PMIC. +diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c +index 35d54ee1c5c7..b172f0a02083 100644 +--- a/drivers/scsi/ipr.c ++++ b/drivers/scsi/ipr.c +@@ -9962,6 +9962,7 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, + ioa_cfg->max_devs_supported = ipr_max_devs; + + if (ioa_cfg->sis64) { ++ host->max_channel = IPR_MAX_SIS64_BUSES; + host->max_id = IPR_MAX_SIS64_TARGETS_PER_BUS; + host->max_lun = IPR_MAX_SIS64_LUNS_PER_TARGET; + if (ipr_max_devs > IPR_MAX_SIS64_DEVS) +@@ -9970,6 +9971,7 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, + + ((sizeof(struct ipr_config_table_entry64) + * ioa_cfg->max_devs_supported))); + } else { ++ host->max_channel = IPR_VSET_BUS; + host->max_id = IPR_MAX_NUM_TARGETS_PER_BUS; + host->max_lun = IPR_MAX_NUM_LUNS_PER_TARGET; + if (ipr_max_devs > IPR_MAX_PHYSICAL_DEVS) +@@ -9979,7 +9981,6 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, + * ioa_cfg->max_devs_supported))); + } + +- host->max_channel = IPR_VSET_BUS; + host->unique_id = host->host_no; + host->max_cmd_len = IPR_MAX_CDB_LEN; + host->can_queue = ioa_cfg->max_cmds; +diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h +index 085e6c90f9e6..89b36987ff30 100644 +--- a/drivers/scsi/ipr.h ++++ b/drivers/scsi/ipr.h +@@ -1306,6 +1306,7 @@ struct ipr_resource_entry { + #define IPR_ARRAY_VIRTUAL_BUS 0x1 + #define IPR_VSET_VIRTUAL_BUS 0x2 + #define IPR_IOAFP_VIRTUAL_BUS 0x3 ++#define IPR_MAX_SIS64_BUSES 0x4 + + #define IPR_GET_RES_PHYS_LOC(res) \ + (((res)->bus << 24) | ((res)->target << 8) | (res)->lun) +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c +index e8c2afbb82e9..49d0720a0b7d 100644 +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -3212,9 +3212,11 @@ static int sd_revalidate_disk(struct gendisk *disk) + if (sd_validate_opt_xfer_size(sdkp, dev_max)) { + q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks); + rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks); +- } else ++ } else { ++ q->limits.io_opt = 0; + rw_max = min_not_zero(logical_to_sectors(sdp, dev_max), + (sector_t)BLK_DEF_MAX_SECTORS); ++ } + + /* Do not exceed controller limit */ + rw_max = min(rw_max, queue_max_hw_sectors(q)); +diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c +index b2245cdce230..5160e16d3a98 100644 +--- a/drivers/spi/spi-pxa2xx.c ++++ b/drivers/spi/spi-pxa2xx.c +@@ -76,6 +76,10 @@ MODULE_ALIAS("platform:pxa2xx-spi"); + #define LPSS_CAPS_CS_EN_SHIFT 9 + #define LPSS_CAPS_CS_EN_MASK (0xf << LPSS_CAPS_CS_EN_SHIFT) + ++#define LPSS_PRIV_CLOCK_GATE 0x38 ++#define LPSS_PRIV_CLOCK_GATE_CLK_CTL_MASK 0x3 ++#define LPSS_PRIV_CLOCK_GATE_CLK_CTL_FORCE_ON 0x3 ++ + struct lpss_config { + /* LPSS offset from drv_data->ioaddr */ + unsigned offset; +@@ -92,6 +96,8 @@ struct lpss_config { + unsigned cs_sel_shift; + unsigned cs_sel_mask; + unsigned cs_num; ++ /* Quirks */ ++ unsigned cs_clk_stays_gated : 1; + }; + + /* Keep these sorted with enum pxa_ssp_type */ +@@ -162,6 +168,7 @@ static const struct lpss_config lpss_platforms[] = { + .tx_threshold_hi = 56, + .cs_sel_shift = 8, + .cs_sel_mask = 3 << 8, ++ .cs_clk_stays_gated = true, + }, + }; + +@@ -385,6 +392,22 @@ static void lpss_ssp_cs_control(struct driver_data *drv_data, bool enable) + else + value |= LPSS_CS_CONTROL_CS_HIGH; + __lpss_ssp_write_priv(drv_data, config->reg_cs_ctrl, value); ++ if (config->cs_clk_stays_gated) { ++ u32 clkgate; ++ ++ /* ++ * Changing CS alone when dynamic clock gating is on won't ++ * actually flip CS at that time. This ruins SPI transfers ++ * that specify delays, or have no data. Toggle the clock mode ++ * to force on briefly to poke the CS pin to move. ++ */ ++ clkgate = __lpss_ssp_read_priv(drv_data, LPSS_PRIV_CLOCK_GATE); ++ value = (clkgate & ~LPSS_PRIV_CLOCK_GATE_CLK_CTL_MASK) | ++ LPSS_PRIV_CLOCK_GATE_CLK_CTL_FORCE_ON; ++ ++ __lpss_ssp_write_priv(drv_data, LPSS_PRIV_CLOCK_GATE, value); ++ __lpss_ssp_write_priv(drv_data, LPSS_PRIV_CLOCK_GATE, clkgate); ++ } + } + + static void cs_assert(struct driver_data *drv_data) +diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c +index 974a8ce58b68..cb74fd1af205 100644 +--- a/drivers/spi/spi-qup.c ++++ b/drivers/spi/spi-qup.c +@@ -1190,6 +1190,11 @@ static int spi_qup_suspend(struct device *device) + struct spi_qup *controller = spi_master_get_devdata(master); + int ret; + ++ if (pm_runtime_suspended(device)) { ++ ret = spi_qup_pm_resume_runtime(device); ++ if (ret) ++ return ret; ++ } + ret = spi_master_suspend(master); + if (ret) + return ret; +@@ -1198,10 +1203,8 @@ static int spi_qup_suspend(struct device *device) + if (ret) + return ret; + +- if (!pm_runtime_suspended(device)) { +- clk_disable_unprepare(controller->cclk); +- clk_disable_unprepare(controller->iclk); +- } ++ clk_disable_unprepare(controller->cclk); ++ clk_disable_unprepare(controller->iclk); + return 0; + } + +diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c +index 18aeaceee286..d26c0eda2d9e 100644 +--- a/drivers/spi/spi-zynqmp-gqspi.c ++++ b/drivers/spi/spi-zynqmp-gqspi.c +@@ -415,9 +415,6 @@ static void zynqmp_qspi_chipselect(struct spi_device *qspi, bool is_high) + + zynqmp_gqspi_write(xqspi, GQSPI_GEN_FIFO_OFST, genfifoentry); + +- /* Dummy generic FIFO entry */ +- zynqmp_gqspi_write(xqspi, GQSPI_GEN_FIFO_OFST, 0x0); +- + /* Manually start the generic FIFO command */ + zynqmp_gqspi_write(xqspi, GQSPI_CONFIG_OFST, + zynqmp_gqspi_read(xqspi, GQSPI_CONFIG_OFST) | +diff --git a/drivers/staging/greybus/tools/loopback_test.c b/drivers/staging/greybus/tools/loopback_test.c +index fbe589fca840..b6aa70b94f33 100644 +--- a/drivers/staging/greybus/tools/loopback_test.c ++++ b/drivers/staging/greybus/tools/loopback_test.c +@@ -20,6 +20,7 @@ + #include + + #define MAX_NUM_DEVICES 10 ++#define MAX_SYSFS_PREFIX 0x80 + #define MAX_SYSFS_PATH 0x200 + #define CSV_MAX_LINE 0x1000 + #define SYSFS_MAX_INT 0x20 +@@ -68,7 +69,7 @@ struct loopback_results { + }; + + struct loopback_device { +- char name[MAX_SYSFS_PATH]; ++ char name[MAX_STR_LEN]; + char sysfs_entry[MAX_SYSFS_PATH]; + char debugfs_entry[MAX_SYSFS_PATH]; + struct loopback_results results; +@@ -94,8 +95,8 @@ struct loopback_test { + int stop_all; + int poll_count; + char test_name[MAX_STR_LEN]; +- char sysfs_prefix[MAX_SYSFS_PATH]; +- char debugfs_prefix[MAX_SYSFS_PATH]; ++ char sysfs_prefix[MAX_SYSFS_PREFIX]; ++ char debugfs_prefix[MAX_SYSFS_PREFIX]; + struct timespec poll_timeout; + struct loopback_device devices[MAX_NUM_DEVICES]; + struct loopback_results aggregate_results; +@@ -644,7 +645,7 @@ baddir: + static int open_poll_files(struct loopback_test *t) + { + struct loopback_device *dev; +- char buf[MAX_STR_LEN]; ++ char buf[MAX_SYSFS_PATH + MAX_STR_LEN]; + char dummy; + int fds_idx = 0; + int i; +@@ -914,10 +915,10 @@ int main(int argc, char *argv[]) + t.iteration_max = atoi(optarg); + break; + case 'S': +- snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", optarg); ++ snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", optarg); + break; + case 'D': +- snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", optarg); ++ snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", optarg); + break; + case 'm': + t.mask = atol(optarg); +@@ -968,10 +969,10 @@ int main(int argc, char *argv[]) + } + + if (!strcmp(t.sysfs_prefix, "")) +- snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", sysfs_prefix); ++ snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", sysfs_prefix); + + if (!strcmp(t.debugfs_prefix, "")) +- snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", debugfs_prefix); ++ snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", debugfs_prefix); + + ret = find_loopback_devices(&t); + if (ret) +diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c +index 536453358568..30615b8fb657 100644 +--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c ++++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c +@@ -40,12 +40,14 @@ static const struct usb_device_id rtw_usb_id_tbl[] = { + /****** 8188EUS ********/ + {USB_DEVICE(0x056e, 0x4008)}, /* Elecom WDC-150SU2M */ + {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ ++ {USB_DEVICE(0x0B05, 0x18F0)}, /* ASUS USB-N10 Nano B1 */ + {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ + {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ + {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ + {USB_DEVICE(0x2001, 0x331B)}, /* D-Link DWA-121 rev B1 */ + {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ + {USB_DEVICE(0x2357, 0x0111)}, /* TP-Link TL-WN727N v5.21 */ ++ {USB_DEVICE(0x2C4E, 0x0102)}, /* MERCUSYS MW150US v2 */ + {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ + {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ + {} /* Terminating entry */ +diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c +index 56f7be6af1f6..a27f5e9a1ae1 100644 +--- a/drivers/staging/speakup/main.c ++++ b/drivers/staging/speakup/main.c +@@ -567,7 +567,7 @@ static u_long get_word(struct vc_data *vc) + return 0; + } else if (tmpx < vc->vc_cols - 2 && + (ch == SPACE || ch == 0 || (ch < 0x100 && IS_WDLM(ch))) && +- get_char(vc, (u_short *)&tmp_pos + 1, &temp) > SPACE) { ++ get_char(vc, (u_short *)tmp_pos + 1, &temp) > SPACE) { + tmp_pos += 2; + tmpx++; + } else +diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c +index 2a22e448a2b3..fb1a76c4c927 100644 +--- a/drivers/staging/wlan-ng/hfa384x_usb.c ++++ b/drivers/staging/wlan-ng/hfa384x_usb.c +@@ -3495,6 +3495,8 @@ static void hfa384x_int_rxmonitor(struct wlandevice *wlandev, + WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)) { + pr_debug("overlen frm: len=%zd\n", + skblen - sizeof(struct p80211_caphdr)); ++ ++ return; + } + + skb = dev_alloc_skb(skblen); +diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c +index b5ba176004c1..d8d86761b790 100644 +--- a/drivers/staging/wlan-ng/prism2usb.c ++++ b/drivers/staging/wlan-ng/prism2usb.c +@@ -180,6 +180,7 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface) + + cancel_work_sync(&hw->link_bh); + cancel_work_sync(&hw->commsqual_bh); ++ cancel_work_sync(&hw->usb_work); + + /* Now we complete any outstanding commands + * and tell everyone who is waiting for their +diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c +index 91ffe3f2b8a0..8687b17f6cf0 100644 +--- a/drivers/tty/vt/selection.c ++++ b/drivers/tty/vt/selection.c +@@ -83,6 +83,11 @@ void clear_selection(void) + } + } + ++bool vc_is_sel(struct vc_data *vc) ++{ ++ return vc == sel_cons; ++} ++ + /* + * User settable table: what characters are to be considered alphabetic? + * 128 bits. Locked by the console lock. +diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c +index 826433af4bdd..46defa3be9a4 100644 +--- a/drivers/tty/vt/vt.c ++++ b/drivers/tty/vt/vt.c +@@ -584,8 +584,9 @@ static void hide_softcursor(struct vc_data *vc) + + static void hide_cursor(struct vc_data *vc) + { +- if (vc == sel_cons) ++ if (vc_is_sel(vc)) + clear_selection(); ++ + vc->vc_sw->con_cursor(vc, CM_ERASE); + hide_softcursor(vc); + } +@@ -595,7 +596,7 @@ static void set_cursor(struct vc_data *vc) + if (!con_is_fg(vc) || console_blanked || vc->vc_mode == KD_GRAPHICS) + return; + if (vc->vc_deccm) { +- if (vc == sel_cons) ++ if (vc_is_sel(vc)) + clear_selection(); + add_softcursor(vc); + if ((vc->vc_cursor_type & 0x0f) != 1) +@@ -750,6 +751,17 @@ static void visual_init(struct vc_data *vc, int num, int init) + vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row; + } + ++static void vc_port_destruct(struct tty_port *port) ++{ ++ struct vc_data *vc = container_of(port, struct vc_data, port); ++ ++ kfree(vc); ++} ++ ++static const struct tty_port_operations vc_port_ops = { ++ .destruct = vc_port_destruct, ++}; ++ + int vc_allocate(unsigned int currcons) /* return 0 on success */ + { + struct vt_notifier_param param; +@@ -775,6 +787,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ + + vc_cons[currcons].d = vc; + tty_port_init(&vc->port); ++ vc->port.ops = &vc_port_ops; + INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); + + visual_init(vc, currcons, 1); +@@ -873,7 +886,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, + if (!newscreen) + return -ENOMEM; + +- if (vc == sel_cons) ++ if (vc_is_sel(vc)) + clear_selection(); + + old_rows = vc->vc_rows; +@@ -2894,6 +2907,7 @@ static int con_install(struct tty_driver *driver, struct tty_struct *tty) + + tty->driver_data = vc; + vc->port.tty = tty; ++ tty_port_get(&vc->port); + + if (!tty->winsize.ws_row && !tty->winsize.ws_col) { + tty->winsize.ws_row = vc_cons[currcons].d->vc_rows; +@@ -2929,6 +2943,13 @@ static void con_shutdown(struct tty_struct *tty) + console_unlock(); + } + ++static void con_cleanup(struct tty_struct *tty) ++{ ++ struct vc_data *vc = tty->driver_data; ++ ++ tty_port_put(&vc->port); ++} ++ + static int default_color = 7; /* white */ + static int default_italic_color = 2; // green (ASCII) + static int default_underline_color = 3; // cyan (ASCII) +@@ -3053,7 +3074,8 @@ static const struct tty_operations con_ops = { + .throttle = con_throttle, + .unthrottle = con_unthrottle, + .resize = vt_resize, +- .shutdown = con_shutdown ++ .shutdown = con_shutdown, ++ .cleanup = con_cleanup, + }; + + static struct cdev vc0_cdev; +diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c +index c320fefab360..699ad55e3ec6 100644 +--- a/drivers/tty/vt/vt_ioctl.c ++++ b/drivers/tty/vt/vt_ioctl.c +@@ -39,11 +39,32 @@ + #include + #include + +-char vt_dont_switch; +-extern struct tty_driver *console_driver; ++bool vt_dont_switch; + +-#define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count) +-#define VT_BUSY(i) (VT_IS_IN_USE(i) || i == fg_console || vc_cons[i].d == sel_cons) ++static inline bool vt_in_use(unsigned int i) ++{ ++ const struct vc_data *vc = vc_cons[i].d; ++ ++ /* ++ * console_lock must be held to prevent the vc from being deallocated ++ * while we're checking whether it's in-use. ++ */ ++ WARN_CONSOLE_UNLOCKED(); ++ ++ return vc && kref_read(&vc->port.kref) > 1; ++} ++ ++static inline bool vt_busy(int i) ++{ ++ if (vt_in_use(i)) ++ return true; ++ if (i == fg_console) ++ return true; ++ if (vc_is_sel(vc_cons[i].d)) ++ return true; ++ ++ return false; ++} + + /* + * Console (vt and kd) routines, as defined by USL SVR4 manual, and by +@@ -289,16 +310,14 @@ static int vt_disallocate(unsigned int vc_num) + int ret = 0; + + console_lock(); +- if (VT_BUSY(vc_num)) ++ if (vt_busy(vc_num)) + ret = -EBUSY; + else if (vc_num) + vc = vc_deallocate(vc_num); + console_unlock(); + +- if (vc && vc_num >= MIN_NR_CONSOLES) { +- tty_port_destroy(&vc->port); +- kfree(vc); +- } ++ if (vc && vc_num >= MIN_NR_CONSOLES) ++ tty_port_put(&vc->port); + + return ret; + } +@@ -311,17 +330,15 @@ static void vt_disallocate_all(void) + + console_lock(); + for (i = 1; i < MAX_NR_CONSOLES; i++) +- if (!VT_BUSY(i)) ++ if (!vt_busy(i)) + vc[i] = vc_deallocate(i); + else + vc[i] = NULL; + console_unlock(); + + for (i = 1; i < MAX_NR_CONSOLES; i++) { +- if (vc[i] && i >= MIN_NR_CONSOLES) { +- tty_port_destroy(&vc[i]->port); +- kfree(vc[i]); +- } ++ if (vc[i] && i >= MIN_NR_CONSOLES) ++ tty_port_put(&vc[i]->port); + } + } + +@@ -335,22 +352,13 @@ int vt_ioctl(struct tty_struct *tty, + { + struct vc_data *vc = tty->driver_data; + struct console_font_op op; /* used in multiple places here */ +- unsigned int console; ++ unsigned int console = vc->vc_num; + unsigned char ucval; + unsigned int uival; + void __user *up = (void __user *)arg; + int i, perm; + int ret = 0; + +- console = vc->vc_num; +- +- +- if (!vc_cons_allocated(console)) { /* impossible? */ +- ret = -ENOIOCTLCMD; +- goto out; +- } +- +- + /* + * To have permissions to do most of the vt ioctls, we either have + * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG. +@@ -641,15 +649,16 @@ int vt_ioctl(struct tty_struct *tty, + struct vt_stat __user *vtstat = up; + unsigned short state, mask; + +- /* Review: FIXME: Console lock ? */ + if (put_user(fg_console + 1, &vtstat->v_active)) + ret = -EFAULT; + else { + state = 1; /* /dev/tty0 is always open */ ++ console_lock(); /* required by vt_in_use() */ + for (i = 0, mask = 2; i < MAX_NR_CONSOLES && mask; + ++i, mask <<= 1) +- if (VT_IS_IN_USE(i)) ++ if (vt_in_use(i)) + state |= mask; ++ console_unlock(); + ret = put_user(state, &vtstat->v_state); + } + break; +@@ -659,10 +668,11 @@ int vt_ioctl(struct tty_struct *tty, + * Returns the first available (non-opened) console. + */ + case VT_OPENQRY: +- /* FIXME: locking ? - but then this is a stupid API */ ++ console_lock(); /* required by vt_in_use() */ + for (i = 0; i < MAX_NR_CONSOLES; ++i) +- if (! VT_IS_IN_USE(i)) ++ if (!vt_in_use(i)) + break; ++ console_unlock(); + uival = i < MAX_NR_CONSOLES ? (i+1) : -1; + goto setint; + +@@ -1011,12 +1021,12 @@ int vt_ioctl(struct tty_struct *tty, + case VT_LOCKSWITCH: + if (!capable(CAP_SYS_TTY_CONFIG)) + return -EPERM; +- vt_dont_switch = 1; ++ vt_dont_switch = true; + break; + case VT_UNLOCKSWITCH: + if (!capable(CAP_SYS_TTY_CONFIG)) + return -EPERM; +- vt_dont_switch = 0; ++ vt_dont_switch = false; + break; + case VT_GETHIFONTMASK: + ret = put_user(vc->vc_hi_font_mask, +@@ -1180,18 +1190,10 @@ long vt_compat_ioctl(struct tty_struct *tty, + { + struct vc_data *vc = tty->driver_data; + struct console_font_op op; /* used in multiple places here */ +- unsigned int console; + void __user *up = (void __user *)arg; + int perm; + int ret = 0; + +- console = vc->vc_num; +- +- if (!vc_cons_allocated(console)) { /* impossible? */ +- ret = -ENOIOCTLCMD; +- goto out; +- } +- + /* + * To have permissions to do most of the vt ioctls, we either have + * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG. +@@ -1251,7 +1253,7 @@ long vt_compat_ioctl(struct tty_struct *tty, + arg = (unsigned long)compat_ptr(arg); + goto fallback; + } +-out: ++ + return ret; + + fallback: +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c +index 0453f0eb1178..5e171e45c685 100644 +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -926,10 +926,10 @@ static int get_serial_info(struct acm *acm, struct serial_struct __user *info) + memset(&tmp, 0, sizeof(tmp)); + tmp.xmit_fifo_size = acm->writesize; + tmp.baud_base = le32_to_cpu(acm->line.dwDTERate); +- tmp.close_delay = acm->port.close_delay / 10; ++ tmp.close_delay = jiffies_to_msecs(acm->port.close_delay) / 10; + tmp.closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? + ASYNC_CLOSING_WAIT_NONE : +- acm->port.closing_wait / 10; ++ jiffies_to_msecs(acm->port.closing_wait) / 10; + + if (copy_to_user(info, &tmp, sizeof(tmp))) + return -EFAULT; +@@ -942,20 +942,28 @@ static int set_serial_info(struct acm *acm, + { + struct serial_struct new_serial; + unsigned int closing_wait, close_delay; ++ unsigned int old_closing_wait, old_close_delay; + int retval = 0; + + if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) + return -EFAULT; + +- close_delay = new_serial.close_delay * 10; ++ close_delay = msecs_to_jiffies(new_serial.close_delay * 10); + closing_wait = new_serial.closing_wait == ASYNC_CLOSING_WAIT_NONE ? +- ASYNC_CLOSING_WAIT_NONE : new_serial.closing_wait * 10; ++ ASYNC_CLOSING_WAIT_NONE : ++ msecs_to_jiffies(new_serial.closing_wait * 10); ++ ++ /* we must redo the rounding here, so that the values match */ ++ old_close_delay = jiffies_to_msecs(acm->port.close_delay) / 10; ++ old_closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? ++ ASYNC_CLOSING_WAIT_NONE : ++ jiffies_to_msecs(acm->port.closing_wait) / 10; + + mutex_lock(&acm->port.mutex); + + if (!capable(CAP_SYS_ADMIN)) { +- if ((close_delay != acm->port.close_delay) || +- (closing_wait != acm->port.closing_wait)) ++ if ((new_serial.close_delay != old_close_delay) || ++ (new_serial.closing_wait != old_closing_wait)) + retval = -EPERM; + else + retval = -EOPNOTSUPP; +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c +index 64c03e871f2d..6c4bb47922ac 100644 +--- a/drivers/usb/core/quirks.c ++++ b/drivers/usb/core/quirks.c +@@ -229,6 +229,12 @@ static const struct usb_device_id usb_quirk_list[] = { + { USB_DEVICE(0x0b05, 0x17e0), .driver_info = + USB_QUIRK_IGNORE_REMOTE_WAKEUP }, + ++ /* Realtek hub in Dell WD19 (Type-C) */ ++ { USB_DEVICE(0x0bda, 0x0487), .driver_info = USB_QUIRK_NO_LPM }, ++ ++ /* Generic RTL8153 based ethernet adapters */ ++ { USB_DEVICE(0x0bda, 0x8153), .driver_info = USB_QUIRK_NO_LPM }, ++ + /* Action Semiconductor flash disk */ + { USB_DEVICE(0x10d6, 0x2200), .driver_info = + USB_QUIRK_STRING_FETCH_255 }, +diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c +index 908496ed3254..c01a0d1e8b5c 100644 +--- a/drivers/usb/host/xhci-pci.c ++++ b/drivers/usb/host/xhci-pci.c +@@ -140,7 +140,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) + xhci->quirks |= XHCI_AMD_PLL_FIX; + + if (pdev->vendor == PCI_VENDOR_ID_AMD && +- (pdev->device == 0x15e0 || ++ (pdev->device == 0x145c || ++ pdev->device == 0x15e0 || + pdev->device == 0x15e1 || + pdev->device == 0x43bb)) + xhci->quirks |= XHCI_SUSPEND_DELAY; +diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c +index 108a212294bf..a7feb6338d97 100644 +--- a/drivers/usb/host/xhci-plat.c ++++ b/drivers/usb/host/xhci-plat.c +@@ -416,6 +416,7 @@ MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match); + static struct platform_driver usb_xhci_driver = { + .probe = xhci_plat_probe, + .remove = xhci_plat_remove, ++ .shutdown = usb_hcd_platform_shutdown, + .driver = { + .name = "xhci-hcd", + .pm = &xhci_plat_pm_ops, +diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h +index 02a1164ca599..a350c46d01e8 100644 +--- a/drivers/usb/host/xhci-trace.h ++++ b/drivers/usb/host/xhci-trace.h +@@ -276,23 +276,12 @@ DECLARE_EVENT_CLASS(xhci_log_urb, + ), + TP_printk("ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x", + __entry->epnum, __entry->dir_in ? "in" : "out", +- ({ char *s; +- switch (__entry->type) { +- case USB_ENDPOINT_XFER_INT: +- s = "intr"; +- break; +- case USB_ENDPOINT_XFER_CONTROL: +- s = "control"; +- break; +- case USB_ENDPOINT_XFER_BULK: +- s = "bulk"; +- break; +- case USB_ENDPOINT_XFER_ISOC: +- s = "isoc"; +- break; +- default: +- s = "UNKNOWN"; +- } s; }), __entry->urb, __entry->pipe, __entry->slot_id, ++ __print_symbolic(__entry->type, ++ { USB_ENDPOINT_XFER_INT, "intr" }, ++ { USB_ENDPOINT_XFER_CONTROL, "control" }, ++ { USB_ENDPOINT_XFER_BULK, "bulk" }, ++ { USB_ENDPOINT_XFER_ISOC, "isoc" }), ++ __entry->urb, __entry->pipe, __entry->slot_id, + __entry->actual, __entry->length, __entry->num_mapped_sgs, + __entry->num_sgs, __entry->stream, __entry->flags + ) +diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c +index 802388bb42ba..3ec0752e67ac 100644 +--- a/drivers/usb/musb/musb_host.c ++++ b/drivers/usb/musb/musb_host.c +@@ -1494,10 +1494,7 @@ done: + * We need to map sg if the transfer_buffer is + * NULL. + */ +- if (!urb->transfer_buffer) +- qh->use_sg = true; +- +- if (qh->use_sg) { ++ if (!urb->transfer_buffer) { + /* sg_miter_start is already done in musb_ep_program */ + if (!sg_miter_next(&qh->sg_miter)) { + dev_err(musb->controller, "error: sg list empty\n"); +@@ -1505,9 +1502,8 @@ done: + status = -EINVAL; + goto done; + } +- urb->transfer_buffer = qh->sg_miter.addr; + length = min_t(u32, length, qh->sg_miter.length); +- musb_write_fifo(hw_ep, length, urb->transfer_buffer); ++ musb_write_fifo(hw_ep, length, qh->sg_miter.addr); + qh->sg_miter.consumed = length; + sg_miter_stop(&qh->sg_miter); + } else { +@@ -1516,11 +1512,6 @@ done: + + qh->segsize = length; + +- if (qh->use_sg) { +- if (offset + length >= urb->transfer_buffer_length) +- qh->use_sg = false; +- } +- + musb_ep_select(mbase, epnum); + musb_writew(epio, MUSB_TXCSR, + MUSB_TXCSR_H_WZC_BITS | MUSB_TXCSR_TXPKTRDY); +@@ -2038,8 +2029,10 @@ finish: + urb->actual_length += xfer_len; + qh->offset += xfer_len; + if (done) { +- if (qh->use_sg) ++ if (qh->use_sg) { + qh->use_sg = false; ++ urb->transfer_buffer = NULL; ++ } + + if (urb->status == -EINPROGRESS) + urb->status = status; +diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c +index 3705b64ab948..45d5e5c899e1 100644 +--- a/drivers/usb/serial/io_edgeport.c ++++ b/drivers/usb/serial/io_edgeport.c +@@ -714,7 +714,7 @@ static void edge_interrupt_callback(struct urb *urb) + /* grab the txcredits for the ports if available */ + position = 2; + portNumber = 0; +- while ((position < length) && ++ while ((position < length - 1) && + (portNumber < edge_serial->serial->num_ports)) { + txCredits = data[position] | (data[position+1] << 8); + if (txCredits) { +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c +index eff353de47cd..3621bde2a0ed 100644 +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -1186,6 +1186,8 @@ static const struct usb_device_id option_ids[] = { + .driver_info = NCTRL(0) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x110a, 0xff), /* Telit ME910G1 */ + .driver_info = NCTRL(0) | RSVD(3) }, ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x110b, 0xff), /* Telit ME910G1 (ECM) */ ++ .driver_info = NCTRL(0) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), +@@ -1992,8 +1994,14 @@ static const struct usb_device_id option_ids[] = { + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */ ++ { USB_DEVICE_INTERFACE_CLASS(0x1435, 0xd191, 0xff), /* Wistron Neweb D19Q1 */ ++ .driver_info = RSVD(1) | RSVD(4) }, ++ { USB_DEVICE_INTERFACE_CLASS(0x1690, 0x7588, 0xff), /* ASKEY WWHC050 */ ++ .driver_info = RSVD(1) | RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2031, 0xff), /* Olicard 600 */ + .driver_info = RSVD(4) }, ++ { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2033, 0xff), /* BroadMobi BM806U */ ++ .driver_info = RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2060, 0xff), /* BroadMobi BM818 */ + .driver_info = RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ +diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c +index 1c4d3dbd4635..5051b1dad09e 100644 +--- a/drivers/usb/serial/pl2303.c ++++ b/drivers/usb/serial/pl2303.c +@@ -96,6 +96,7 @@ static const struct usb_device_id id_table[] = { + { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) }, + { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, + { USB_DEVICE(HP_VENDOR_ID, HP_LD220TA_PRODUCT_ID) }, ++ { USB_DEVICE(HP_VENDOR_ID, HP_LD381_PRODUCT_ID) }, + { USB_DEVICE(HP_VENDOR_ID, HP_LD960_PRODUCT_ID) }, + { USB_DEVICE(HP_VENDOR_ID, HP_LD960TA_PRODUCT_ID) }, + { USB_DEVICE(HP_VENDOR_ID, HP_LCM220_PRODUCT_ID) }, +diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h +index fcc2cfc1da28..f0a9eeb6272d 100644 +--- a/drivers/usb/serial/pl2303.h ++++ b/drivers/usb/serial/pl2303.h +@@ -129,6 +129,7 @@ + #define HP_LM920_PRODUCT_ID 0x026b + #define HP_TD620_PRODUCT_ID 0x0956 + #define HP_LD960_PRODUCT_ID 0x0b39 ++#define HP_LD381_PRODUCT_ID 0x0f7f + #define HP_LCM220_PRODUCT_ID 0x3139 + #define HP_LCM960_PRODUCT_ID 0x3239 + #define HP_LD220_PRODUCT_ID 0x3524 +diff --git a/drivers/xen/xenbus/xenbus_comms.c b/drivers/xen/xenbus/xenbus_comms.c +index d239fc3c5e3d..eb5151fc8efa 100644 +--- a/drivers/xen/xenbus/xenbus_comms.c ++++ b/drivers/xen/xenbus/xenbus_comms.c +@@ -313,6 +313,8 @@ static int process_msg(void) + req->msg.type = state.msg.type; + req->msg.len = state.msg.len; + req->body = state.body; ++ /* write body, then update state */ ++ virt_wmb(); + req->state = xb_req_state_got_reply; + req->cb(req); + } else +@@ -395,6 +397,8 @@ static int process_writes(void) + if (state.req->state == xb_req_state_aborted) + kfree(state.req); + else { ++ /* write err, then update state */ ++ virt_wmb(); + state.req->state = xb_req_state_got_reply; + wake_up(&state.req->wq); + } +diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c +index 3f3b29398ab8..b609c6e08796 100644 +--- a/drivers/xen/xenbus/xenbus_xs.c ++++ b/drivers/xen/xenbus/xenbus_xs.c +@@ -188,8 +188,11 @@ static bool xenbus_ok(void) + + static bool test_reply(struct xb_req_data *req) + { +- if (req->state == xb_req_state_got_reply || !xenbus_ok()) ++ if (req->state == xb_req_state_got_reply || !xenbus_ok()) { ++ /* read req->state before all other fields */ ++ virt_rmb(); + return true; ++ } + + /* Make sure to reread req->state each time. */ + barrier(); +@@ -199,7 +202,7 @@ static bool test_reply(struct xb_req_data *req) + + static void *read_reply(struct xb_req_data *req) + { +- while (req->state != xb_req_state_got_reply) { ++ do { + wait_event(req->wq, test_reply(req)); + + if (!xenbus_ok()) +@@ -213,7 +216,7 @@ static void *read_reply(struct xb_req_data *req) + if (req->err) + return ERR_PTR(req->err); + +- } ++ } while (req->state != xb_req_state_got_reply); + + return req->body; + } +diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c +index ccc9c708a860..7dc9c78a1c31 100644 +--- a/fs/afs/rxrpc.c ++++ b/fs/afs/rxrpc.c +@@ -173,7 +173,7 @@ void afs_put_call(struct afs_call *call) + int n = atomic_dec_return(&call->usage); + int o = atomic_read(&afs_outstanding_calls); + +- trace_afs_call(call, afs_call_trace_put, n + 1, o, ++ trace_afs_call(call, afs_call_trace_put, n, o, + __builtin_return_address(0)); + + ASSERTCMP(n, >=, 0); +@@ -619,7 +619,7 @@ static void afs_wake_up_async_call(struct sock *sk, struct rxrpc_call *rxcall, + + u = __atomic_add_unless(&call->usage, 1, 0); + if (u != 0) { +- trace_afs_call(call, afs_call_trace_wake, u, ++ trace_afs_call(call, afs_call_trace_wake, u + 1, + atomic_read(&afs_outstanding_calls), + __builtin_return_address(0)); + +diff --git a/fs/inode.c b/fs/inode.c +index d2a700c5efce..17172b616d22 100644 +--- a/fs/inode.c ++++ b/fs/inode.c +@@ -135,6 +135,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode) + inode->i_sb = sb; + inode->i_blkbits = sb->s_blocksize_bits; + inode->i_flags = 0; ++ atomic64_set(&inode->i_sequence, 0); + atomic_set(&inode->i_count, 1); + inode->i_op = &empty_iops; + inode->i_fop = &no_open_fops; +diff --git a/fs/libfs.c b/fs/libfs.c +index 49623301e5f0..cb9310b091f5 100644 +--- a/fs/libfs.c ++++ b/fs/libfs.c +@@ -802,7 +802,7 @@ int simple_attr_open(struct inode *inode, struct file *file, + { + struct simple_attr *attr; + +- attr = kmalloc(sizeof(*attr), GFP_KERNEL); ++ attr = kzalloc(sizeof(*attr), GFP_KERNEL); + if (!attr) + return -ENOMEM; + +@@ -842,9 +842,11 @@ ssize_t simple_attr_read(struct file *file, char __user *buf, + if (ret) + return ret; + +- if (*ppos) { /* continued read */ ++ if (*ppos && attr->get_buf[0]) { ++ /* continued read */ + size = strlen(attr->get_buf); +- } else { /* first read */ ++ } else { ++ /* first read */ + u64 val; + ret = attr->get(attr->data, &val); + if (ret) +diff --git a/include/linux/fs.h b/include/linux/fs.h +index f0fddf4ea828..a94642fcf93b 100644 +--- a/include/linux/fs.h ++++ b/include/linux/fs.h +@@ -645,6 +645,7 @@ struct inode { + struct rcu_head i_rcu; + }; + u64 i_version; ++ atomic64_t i_sequence; /* see futex */ + atomic_t i_count; + atomic_t i_dio_count; + atomic_t i_writecount; +diff --git a/include/linux/futex.h b/include/linux/futex.h +index a4b6cba699bf..6adb1ccac603 100644 +--- a/include/linux/futex.h ++++ b/include/linux/futex.h +@@ -34,23 +34,26 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, + + union futex_key { + struct { ++ u64 i_seq; + unsigned long pgoff; +- struct inode *inode; +- int offset; ++ unsigned int offset; + } shared; + struct { ++ union { ++ struct mm_struct *mm; ++ u64 __tmp; ++ }; + unsigned long address; +- struct mm_struct *mm; +- int offset; ++ unsigned int offset; + } private; + struct { ++ u64 ptr; + unsigned long word; +- void *ptr; +- int offset; ++ unsigned int offset; + } both; + }; + +-#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } } ++#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = 0ULL } } + + #ifdef CONFIG_FUTEX + enum { +diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h +index 5f966c94732b..7cbd8195ffb3 100644 +--- a/include/linux/page-flags.h ++++ b/include/linux/page-flags.h +@@ -264,7 +264,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; } + + __PAGEFLAG(Locked, locked, PF_NO_TAIL) + PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) __CLEARPAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) +-PAGEFLAG(Error, error, PF_NO_COMPOUND) TESTCLEARFLAG(Error, error, PF_NO_COMPOUND) ++PAGEFLAG(Error, error, PF_NO_TAIL) TESTCLEARFLAG(Error, error, PF_NO_TAIL) + PAGEFLAG(Referenced, referenced, PF_HEAD) + TESTCLEARFLAG(Referenced, referenced, PF_HEAD) + __SETPAGEFLAG(Referenced, referenced, PF_HEAD) +diff --git a/include/linux/selection.h b/include/linux/selection.h +index 5b278ce99d8d..35937a61da06 100644 +--- a/include/linux/selection.h ++++ b/include/linux/selection.h +@@ -13,8 +13,8 @@ + + struct tty_struct; + +-extern struct vc_data *sel_cons; + struct tty_struct; ++struct vc_data; + + extern void clear_selection(void); + extern int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty); +@@ -23,6 +23,8 @@ extern int sel_loadlut(char __user *p); + extern int mouse_reporting(void); + extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry); + ++bool vc_is_sel(struct vc_data *vc); ++ + extern int console_blanked; + + extern const unsigned char color_table[]; +diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h +index 1e5d8c392f15..29ef33498cb6 100644 +--- a/include/linux/vmalloc.h ++++ b/include/linux/vmalloc.h +@@ -106,8 +106,9 @@ extern int remap_vmalloc_range_partial(struct vm_area_struct *vma, + + extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, + unsigned long pgoff); +-void vmalloc_sync_all(void); +- ++void vmalloc_sync_mappings(void); ++void vmalloc_sync_unmappings(void); ++ + /* + * Lowlevel-APIs (not for driver use!) + */ +diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h +index 3fd07912909c..a3de234d3350 100644 +--- a/include/linux/vt_kern.h ++++ b/include/linux/vt_kern.h +@@ -142,7 +142,7 @@ static inline bool vt_force_oops_output(struct vc_data *vc) + return false; + } + +-extern char vt_dont_switch; ++extern bool vt_dont_switch; + extern int default_utf8; + extern int global_cursor_default; + +diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h +index 8b95c16b7045..0978bdae2243 100644 +--- a/include/trace/events/afs.h ++++ b/include/trace/events/afs.h +@@ -40,7 +40,7 @@ enum afs_call_trace { + EM(afs_call_trace_free, "FREE ") \ + EM(afs_call_trace_put, "PUT ") \ + EM(afs_call_trace_wake, "WAKE ") \ +- E_(afs_call_trace_work, "WORK ") ++ E_(afs_call_trace_work, "QUEUE") + + /* + * Export enum symbols via userspace. +diff --git a/include/uapi/linux/serio.h b/include/uapi/linux/serio.h +index a0cac1d8670d..1937915be413 100644 +--- a/include/uapi/linux/serio.h ++++ b/include/uapi/linux/serio.h +@@ -9,7 +9,7 @@ + #ifndef _UAPI_SERIO_H + #define _UAPI_SERIO_H + +- ++#include + #include + + #define SPIOCSTYPE _IOW('q', 0x01, unsigned long) +@@ -18,10 +18,10 @@ + /* + * bit masks for use in "interrupt" flags (3rd argument) + */ +-#define SERIO_TIMEOUT BIT(0) +-#define SERIO_PARITY BIT(1) +-#define SERIO_FRAME BIT(2) +-#define SERIO_OOB_DATA BIT(3) ++#define SERIO_TIMEOUT _BITUL(0) ++#define SERIO_PARITY _BITUL(1) ++#define SERIO_FRAME _BITUL(2) ++#define SERIO_OOB_DATA _BITUL(3) + + /* + * Serio types +diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c +index f5c1d5479ba3..21073682061d 100644 +--- a/kernel/bpf/syscall.c ++++ b/kernel/bpf/syscall.c +@@ -1364,7 +1364,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, + union bpf_attr __user *uattr) + { + struct bpf_prog_info __user *uinfo = u64_to_user_ptr(attr->info.info); +- struct bpf_prog_info info = {}; ++ struct bpf_prog_info info; + u32 info_len = attr->info.info_len; + char __user *uinsns; + u32 ulen; +@@ -1375,6 +1375,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, + return err; + info_len = min_t(u32, sizeof(info), info_len); + ++ memset(&info, 0, sizeof(info)); + if (copy_from_user(&info, uinfo, info_len)) + return -EFAULT; + +@@ -1420,7 +1421,7 @@ static int bpf_map_get_info_by_fd(struct bpf_map *map, + union bpf_attr __user *uattr) + { + struct bpf_map_info __user *uinfo = u64_to_user_ptr(attr->info.info); +- struct bpf_map_info info = {}; ++ struct bpf_map_info info; + u32 info_len = attr->info.info_len; + int err; + +@@ -1429,6 +1430,7 @@ static int bpf_map_get_info_by_fd(struct bpf_map *map, + return err; + info_len = min_t(u32, sizeof(info), info_len); + ++ memset(&info, 0, sizeof(info)); + info.type = map->map_type; + info.id = map->id; + info.key_size = map->key_size; +@@ -1474,7 +1476,7 @@ static int bpf_obj_get_info_by_fd(const union bpf_attr *attr, + + SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, uattr, unsigned int, size) + { +- union bpf_attr attr = {}; ++ union bpf_attr attr; + int err; + + if (sysctl_unprivileged_bpf_disabled && !capable(CAP_SYS_ADMIN)) +@@ -1486,6 +1488,7 @@ SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, uattr, unsigned int, siz + size = min_t(u32, size, sizeof(attr)); + + /* copy attributes from user space, may be less than sizeof(bpf_attr) */ ++ memset(&attr, 0, sizeof(attr)); + if (copy_from_user(&attr, uattr, size) != 0) + return -EFAULT; + +diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c +index a2c05d2476ac..545f29c5268d 100644 +--- a/kernel/cgroup/cgroup-v1.c ++++ b/kernel/cgroup/cgroup-v1.c +@@ -501,6 +501,7 @@ static void *cgroup_pidlist_next(struct seq_file *s, void *v, loff_t *pos) + */ + p++; + if (p >= end) { ++ (*pos)++; + return NULL; + } else { + *pos = *p; +@@ -823,7 +824,7 @@ void cgroup1_release_agent(struct work_struct *work) + + pathbuf = kmalloc(PATH_MAX, GFP_KERNEL); + agentbuf = kstrdup(cgrp->root->release_agent_path, GFP_KERNEL); +- if (!pathbuf || !agentbuf) ++ if (!pathbuf || !agentbuf || !strlen(agentbuf)) + goto out; + + spin_lock_irq(&css_set_lock); +diff --git a/kernel/futex.c b/kernel/futex.c +index f5aae14c247b..2921ebaa1467 100644 +--- a/kernel/futex.c ++++ b/kernel/futex.c +@@ -401,9 +401,9 @@ static inline int hb_waiters_pending(struct futex_hash_bucket *hb) + */ + static struct futex_hash_bucket *hash_futex(union futex_key *key) + { +- u32 hash = jhash2((u32*)&key->both.word, +- (sizeof(key->both.word)+sizeof(key->both.ptr))/4, ++ u32 hash = jhash2((u32 *)key, offsetof(typeof(*key), both.offset) / 4, + key->both.offset); ++ + return &futex_queues[hash & (futex_hashsize - 1)]; + } + +@@ -445,7 +445,7 @@ static void get_futex_key_refs(union futex_key *key) + + switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) { + case FUT_OFF_INODE: +- ihold(key->shared.inode); /* implies smp_mb(); (B) */ ++ smp_mb(); /* explicit smp_mb(); (B) */ + break; + case FUT_OFF_MMSHARED: + futex_get_mm(key); /* implies smp_mb(); (B) */ +@@ -479,7 +479,6 @@ static void drop_futex_key_refs(union futex_key *key) + + switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) { + case FUT_OFF_INODE: +- iput(key->shared.inode); + break; + case FUT_OFF_MMSHARED: + mmdrop(key->private.mm); +@@ -487,6 +486,46 @@ static void drop_futex_key_refs(union futex_key *key) + } + } + ++/* ++ * Generate a machine wide unique identifier for this inode. ++ * ++ * This relies on u64 not wrapping in the life-time of the machine; which with ++ * 1ns resolution means almost 585 years. ++ * ++ * This further relies on the fact that a well formed program will not unmap ++ * the file while it has a (shared) futex waiting on it. This mapping will have ++ * a file reference which pins the mount and inode. ++ * ++ * If for some reason an inode gets evicted and read back in again, it will get ++ * a new sequence number and will _NOT_ match, even though it is the exact same ++ * file. ++ * ++ * It is important that match_futex() will never have a false-positive, esp. ++ * for PI futexes that can mess up the state. The above argues that false-negatives ++ * are only possible for malformed programs. ++ */ ++static u64 get_inode_sequence_number(struct inode *inode) ++{ ++ static atomic64_t i_seq; ++ u64 old; ++ ++ /* Does the inode already have a sequence number? */ ++ old = atomic64_read(&inode->i_sequence); ++ if (likely(old)) ++ return old; ++ ++ for (;;) { ++ u64 new = atomic64_add_return(1, &i_seq); ++ if (WARN_ON_ONCE(!new)) ++ continue; ++ ++ old = atomic64_cmpxchg_relaxed(&inode->i_sequence, 0, new); ++ if (old) ++ return old; ++ return new; ++ } ++} ++ + /** + * get_futex_key() - Get parameters which are the keys for a futex + * @uaddr: virtual address of the futex +@@ -499,9 +538,15 @@ static void drop_futex_key_refs(union futex_key *key) + * + * The key words are stored in @key on success. + * +- * For shared mappings, it's (page->index, file_inode(vma->vm_file), +- * offset_within_page). For private mappings, it's (uaddr, current->mm). +- * We can usually work out the index without swapping in the page. ++ * For shared mappings (when @fshared), the key is: ++ * ( inode->i_sequence, page->index, offset_within_page ) ++ * [ also see get_inode_sequence_number() ] ++ * ++ * For private mappings (or when !@fshared), the key is: ++ * ( current->mm, address, 0 ) ++ * ++ * This allows (cross process, where applicable) identification of the futex ++ * without keeping the page pinned for the duration of the FUTEX_WAIT. + * + * lock_page() might sleep, the caller should not hold a spinlock. + */ +@@ -641,8 +686,6 @@ again: + key->private.mm = mm; + key->private.address = address; + +- get_futex_key_refs(key); /* implies smp_mb(); (B) */ +- + } else { + struct inode *inode; + +@@ -674,40 +717,14 @@ again: + goto again; + } + +- /* +- * Take a reference unless it is about to be freed. Previously +- * this reference was taken by ihold under the page lock +- * pinning the inode in place so i_lock was unnecessary. The +- * only way for this check to fail is if the inode was +- * truncated in parallel which is almost certainly an +- * application bug. In such a case, just retry. +- * +- * We are not calling into get_futex_key_refs() in file-backed +- * cases, therefore a successful atomic_inc return below will +- * guarantee that get_futex_key() will still imply smp_mb(); (B). +- */ +- if (!atomic_inc_not_zero(&inode->i_count)) { +- rcu_read_unlock(); +- put_page(page); +- +- goto again; +- } +- +- /* Should be impossible but lets be paranoid for now */ +- if (WARN_ON_ONCE(inode->i_mapping != mapping)) { +- err = -EFAULT; +- rcu_read_unlock(); +- iput(inode); +- +- goto out; +- } +- + key->both.offset |= FUT_OFF_INODE; /* inode-based key */ +- key->shared.inode = inode; ++ key->shared.i_seq = get_inode_sequence_number(inode); + key->shared.pgoff = basepage_index(tail); + rcu_read_unlock(); + } + ++ get_futex_key_refs(key); /* implies smp_mb(); (B) */ ++ + out: + put_page(page); + return err; +diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c +index 037e8fc1b008..5277949e82e0 100644 +--- a/kernel/irq/manage.c ++++ b/kernel/irq/manage.c +@@ -224,7 +224,11 @@ int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask, + + if (desc->affinity_notify) { + kref_get(&desc->affinity_notify->kref); +- schedule_work(&desc->affinity_notify->work); ++ if (!schedule_work(&desc->affinity_notify->work)) { ++ /* Work was already scheduled, drop our extra ref */ ++ kref_put(&desc->affinity_notify->kref, ++ desc->affinity_notify->release); ++ } + } + irqd_set(data, IRQD_AFFINITY_SET); + +@@ -324,7 +328,10 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify) + raw_spin_unlock_irqrestore(&desc->lock, flags); + + if (old_notify) { +- cancel_work_sync(&old_notify->work); ++ if (cancel_work_sync(&old_notify->work)) { ++ /* Pending work had a ref, put that one too */ ++ kref_put(&old_notify->kref, old_notify->release); ++ } + kref_put(&old_notify->kref, old_notify->release); + } + +diff --git a/kernel/notifier.c b/kernel/notifier.c +index 6196af8a8223..59a1e9b48a6a 100644 +--- a/kernel/notifier.c ++++ b/kernel/notifier.c +@@ -552,7 +552,7 @@ NOKPROBE_SYMBOL(notify_die); + + int register_die_notifier(struct notifier_block *nb) + { +- vmalloc_sync_all(); ++ vmalloc_sync_mappings(); + return atomic_notifier_chain_register(&die_chain, nb); + } + EXPORT_SYMBOL_GPL(register_die_notifier); +diff --git a/mm/memcontrol.c b/mm/memcontrol.c +index 5d6ebd1449f0..d8df500e0eea 100644 +--- a/mm/memcontrol.c ++++ b/mm/memcontrol.c +@@ -3518,7 +3518,7 @@ static void __mem_cgroup_usage_unregister_event(struct mem_cgroup *memcg, + struct mem_cgroup_thresholds *thresholds; + struct mem_cgroup_threshold_ary *new; + unsigned long usage; +- int i, j, size; ++ int i, j, size, entries; + + mutex_lock(&memcg->thresholds_lock); + +@@ -3538,14 +3538,20 @@ static void __mem_cgroup_usage_unregister_event(struct mem_cgroup *memcg, + __mem_cgroup_threshold(memcg, type == _MEMSWAP); + + /* Calculate new number of threshold */ +- size = 0; ++ size = entries = 0; + for (i = 0; i < thresholds->primary->size; i++) { + if (thresholds->primary->entries[i].eventfd != eventfd) + size++; ++ else ++ entries++; + } + + new = thresholds->spare; + ++ /* If no items related to eventfd have been cleared, nothing to do */ ++ if (!entries) ++ goto unlock; ++ + /* Set thresholds array to NULL if we don't have thresholds */ + if (!size) { + kfree(new); +diff --git a/mm/nommu.c b/mm/nommu.c +index 17c00d93de2e..13fc62d97544 100644 +--- a/mm/nommu.c ++++ b/mm/nommu.c +@@ -450,10 +450,14 @@ void vm_unmap_aliases(void) + EXPORT_SYMBOL_GPL(vm_unmap_aliases); + + /* +- * Implement a stub for vmalloc_sync_all() if the architecture chose not to +- * have one. ++ * Implement a stub for vmalloc_sync_[un]mapping() if the architecture ++ * chose not to have one. + */ +-void __weak vmalloc_sync_all(void) ++void __weak vmalloc_sync_mappings(void) ++{ ++} ++ ++void __weak vmalloc_sync_unmappings(void) + { + } + +diff --git a/mm/slub.c b/mm/slub.c +index 099c7a85ede0..958a8f7a3c25 100644 +--- a/mm/slub.c ++++ b/mm/slub.c +@@ -1923,8 +1923,6 @@ static void *get_partial(struct kmem_cache *s, gfp_t flags, int node, + + if (node == NUMA_NO_NODE) + searchnode = numa_mem_id(); +- else if (!node_present_pages(node)) +- searchnode = node_to_mem_node(node); + + object = get_partial_node(s, get_node(s, searchnode), c, flags); + if (object || node != NUMA_NO_NODE) +@@ -2521,17 +2519,27 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, + struct page *page; + + page = c->page; +- if (!page) ++ if (!page) { ++ /* ++ * if the node is not online or has no normal memory, just ++ * ignore the node constraint ++ */ ++ if (unlikely(node != NUMA_NO_NODE && ++ !node_state(node, N_NORMAL_MEMORY))) ++ node = NUMA_NO_NODE; + goto new_slab; ++ } + redo: + + if (unlikely(!node_match(page, node))) { +- int searchnode = node; +- +- if (node != NUMA_NO_NODE && !node_present_pages(node)) +- searchnode = node_to_mem_node(node); +- +- if (unlikely(!node_match(page, searchnode))) { ++ /* ++ * same as above but node_match() being false already ++ * implies node != NUMA_NO_NODE ++ */ ++ if (!node_state(node, N_NORMAL_MEMORY)) { ++ node = NUMA_NO_NODE; ++ goto redo; ++ } else { + stat(s, ALLOC_NODE_MISMATCH); + deactivate_slab(s, page, c->freelist, c); + goto new_slab; +@@ -2943,11 +2951,13 @@ redo: + barrier(); + + if (likely(page == c->page)) { +- set_freepointer(s, tail_obj, c->freelist); ++ void **freelist = READ_ONCE(c->freelist); ++ ++ set_freepointer(s, tail_obj, freelist); + + if (unlikely(!this_cpu_cmpxchg_double( + s->cpu_slab->freelist, s->cpu_slab->tid, +- c->freelist, tid, ++ freelist, tid, + head, next_tid(tid)))) { + + note_cmpxchg_failure("slab_free", s, tid); +diff --git a/mm/vmalloc.c b/mm/vmalloc.c +index 0b8852d80f44..d00961ba0c42 100644 +--- a/mm/vmalloc.c ++++ b/mm/vmalloc.c +@@ -1769,7 +1769,7 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, + * First make sure the mappings are removed from all page-tables + * before they are freed. + */ +- vmalloc_sync_all(); ++ vmalloc_sync_unmappings(); + + /* + * In this function, newly allocated vm_struct has VM_UNINITIALIZED +@@ -2318,16 +2318,19 @@ int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, + EXPORT_SYMBOL(remap_vmalloc_range); + + /* +- * Implement a stub for vmalloc_sync_all() if the architecture chose not to +- * have one. ++ * Implement stubs for vmalloc_sync_[un]mappings () if the architecture chose ++ * not to have one. + * + * The purpose of this function is to make sure the vmalloc area + * mappings are identical in all page-tables in the system. + */ +-void __weak vmalloc_sync_all(void) ++void __weak vmalloc_sync_mappings(void) + { + } + ++void __weak vmalloc_sync_unmappings(void) ++{ ++} + + static int f(pte_t *pte, pgtable_t table, unsigned long addr, void *data) + { +diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c +index de92fc1fc3be..b3b918afd212 100644 +--- a/net/dsa/tag_brcm.c ++++ b/net/dsa/tag_brcm.c +@@ -134,6 +134,8 @@ static struct sk_buff *brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev, + + skb->dev = ds->ports[source_port].netdev; + ++ skb->offload_fwd_mark = 1; ++ + return skb; + } + +diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c +index 6705420b3111..d7206581145d 100644 +--- a/net/hsr/hsr_framereg.c ++++ b/net/hsr/hsr_framereg.c +@@ -468,13 +468,9 @@ int hsr_get_node_data(struct hsr_priv *hsr, + struct hsr_port *port; + unsigned long tdiff; + +- +- rcu_read_lock(); + node = find_node_by_AddrA(&hsr->node_db, addr); +- if (!node) { +- rcu_read_unlock(); +- return -ENOENT; /* No such entry */ +- } ++ if (!node) ++ return -ENOENT; + + ether_addr_copy(addr_b, node->MacAddressB); + +@@ -509,7 +505,5 @@ int hsr_get_node_data(struct hsr_priv *hsr, + *addr_b_ifindex = -1; + } + +- rcu_read_unlock(); +- + return 0; + } +diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c +index b9cce0fd5696..37708dabebd1 100644 +--- a/net/hsr/hsr_netlink.c ++++ b/net/hsr/hsr_netlink.c +@@ -259,17 +259,16 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info) + if (!na) + goto invalid; + +- hsr_dev = __dev_get_by_index(genl_info_net(info), +- nla_get_u32(info->attrs[HSR_A_IFINDEX])); ++ rcu_read_lock(); ++ hsr_dev = dev_get_by_index_rcu(genl_info_net(info), ++ nla_get_u32(info->attrs[HSR_A_IFINDEX])); + if (!hsr_dev) +- goto invalid; ++ goto rcu_unlock; + if (!is_hsr_master(hsr_dev)) +- goto invalid; +- ++ goto rcu_unlock; + + /* Send reply */ +- +- skb_out = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); ++ skb_out = genlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC); + if (!skb_out) { + res = -ENOMEM; + goto fail; +@@ -321,12 +320,10 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info) + res = nla_put_u16(skb_out, HSR_A_IF1_SEQ, hsr_node_if1_seq); + if (res < 0) + goto nla_put_failure; +- rcu_read_lock(); + port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_A); + if (port) + res = nla_put_u32(skb_out, HSR_A_IF1_IFINDEX, + port->dev->ifindex); +- rcu_read_unlock(); + if (res < 0) + goto nla_put_failure; + +@@ -336,20 +333,22 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info) + res = nla_put_u16(skb_out, HSR_A_IF2_SEQ, hsr_node_if2_seq); + if (res < 0) + goto nla_put_failure; +- rcu_read_lock(); + port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_B); + if (port) + res = nla_put_u32(skb_out, HSR_A_IF2_IFINDEX, + port->dev->ifindex); +- rcu_read_unlock(); + if (res < 0) + goto nla_put_failure; + ++ rcu_read_unlock(); ++ + genlmsg_end(skb_out, msg_head); + genlmsg_unicast(genl_info_net(info), skb_out, info->snd_portid); + + return 0; + ++rcu_unlock: ++ rcu_read_unlock(); + invalid: + netlink_ack(skb_in, nlmsg_hdr(skb_in), -EINVAL, NULL); + return 0; +@@ -359,6 +358,7 @@ nla_put_failure: + /* Fall through */ + + fail: ++ rcu_read_unlock(); + return res; + } + +@@ -366,16 +366,14 @@ fail: + */ + static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info) + { +- /* For receiving */ +- struct nlattr *na; ++ unsigned char addr[ETH_ALEN]; + struct net_device *hsr_dev; +- +- /* For sending */ + struct sk_buff *skb_out; +- void *msg_head; + struct hsr_priv *hsr; +- void *pos; +- unsigned char addr[ETH_ALEN]; ++ bool restart = false; ++ struct nlattr *na; ++ void *pos = NULL; ++ void *msg_head; + int res; + + if (!info) +@@ -385,17 +383,17 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info) + if (!na) + goto invalid; + +- hsr_dev = __dev_get_by_index(genl_info_net(info), +- nla_get_u32(info->attrs[HSR_A_IFINDEX])); ++ rcu_read_lock(); ++ hsr_dev = dev_get_by_index_rcu(genl_info_net(info), ++ nla_get_u32(info->attrs[HSR_A_IFINDEX])); + if (!hsr_dev) +- goto invalid; ++ goto rcu_unlock; + if (!is_hsr_master(hsr_dev)) +- goto invalid; +- ++ goto rcu_unlock; + ++restart: + /* Send reply */ +- +- skb_out = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); ++ skb_out = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_ATOMIC); + if (!skb_out) { + res = -ENOMEM; + goto fail; +@@ -409,18 +407,26 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info) + goto nla_put_failure; + } + +- res = nla_put_u32(skb_out, HSR_A_IFINDEX, hsr_dev->ifindex); +- if (res < 0) +- goto nla_put_failure; ++ if (!restart) { ++ res = nla_put_u32(skb_out, HSR_A_IFINDEX, hsr_dev->ifindex); ++ if (res < 0) ++ goto nla_put_failure; ++ } + + hsr = netdev_priv(hsr_dev); + +- rcu_read_lock(); +- pos = hsr_get_next_node(hsr, NULL, addr); ++ if (!pos) ++ pos = hsr_get_next_node(hsr, NULL, addr); + while (pos) { + res = nla_put(skb_out, HSR_A_NODE_ADDR, ETH_ALEN, addr); + if (res < 0) { +- rcu_read_unlock(); ++ if (res == -EMSGSIZE) { ++ genlmsg_end(skb_out, msg_head); ++ genlmsg_unicast(genl_info_net(info), skb_out, ++ info->snd_portid); ++ restart = true; ++ goto restart; ++ } + goto nla_put_failure; + } + pos = hsr_get_next_node(hsr, pos, addr); +@@ -432,15 +438,18 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info) + + return 0; + ++rcu_unlock: ++ rcu_read_unlock(); + invalid: + netlink_ack(skb_in, nlmsg_hdr(skb_in), -EINVAL, NULL); + return 0; + + nla_put_failure: +- kfree_skb(skb_out); ++ nlmsg_free(skb_out); + /* Fall through */ + + fail: ++ rcu_read_unlock(); + return res; + } + +@@ -467,6 +476,7 @@ static struct genl_family hsr_genl_family __ro_after_init = { + .name = "HSR", + .version = 1, + .maxattr = HSR_A_MAX, ++ .netnsok = true, + .module = THIS_MODULE, + .ops = hsr_ops, + .n_ops = ARRAY_SIZE(hsr_ops), +diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c +index 5fee6ec7c93d..b215df0bce0e 100644 +--- a/net/hsr/hsr_slave.c ++++ b/net/hsr/hsr_slave.c +@@ -152,16 +152,16 @@ int hsr_add_port(struct hsr_priv *hsr, struct net_device *dev, + if (port == NULL) + return -ENOMEM; + ++ port->hsr = hsr; ++ port->dev = dev; ++ port->type = type; ++ + if (type != HSR_PT_MASTER) { + res = hsr_portdev_setup(dev, port); + if (res) + goto fail_dev_setup; + } + +- port->hsr = hsr; +- port->dev = dev; +- port->type = type; +- + list_add_tail_rcu(&port->port_list, &hsr->ports); + synchronize_rcu(); + +diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig +index f48fe6fc7e8c..4abc4ba733bf 100644 +--- a/net/ipv4/Kconfig ++++ b/net/ipv4/Kconfig +@@ -297,6 +297,7 @@ config SYN_COOKIES + + config NET_IPVTI + tristate "Virtual (secure) IP: tunneling" ++ depends on IPV6 || IPV6=n + select INET_TUNNEL + select NET_IP_TUNNEL + depends on INET_XFRM_MODE_TUNNEL +diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c +index 59384ffe89f7..b930ab5cf140 100644 +--- a/net/ipv4/ip_vti.c ++++ b/net/ipv4/ip_vti.c +@@ -208,17 +208,39 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev, + int mtu; + + if (!dst) { +- struct rtable *rt; +- +- fl->u.ip4.flowi4_oif = dev->ifindex; +- fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC; +- rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4); +- if (IS_ERR(rt)) { ++ switch (skb->protocol) { ++ case htons(ETH_P_IP): { ++ struct rtable *rt; ++ ++ fl->u.ip4.flowi4_oif = dev->ifindex; ++ fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC; ++ rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4); ++ if (IS_ERR(rt)) { ++ dev->stats.tx_carrier_errors++; ++ goto tx_error_icmp; ++ } ++ dst = &rt->dst; ++ skb_dst_set(skb, dst); ++ break; ++ } ++#if IS_ENABLED(CONFIG_IPV6) ++ case htons(ETH_P_IPV6): ++ fl->u.ip6.flowi6_oif = dev->ifindex; ++ fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC; ++ dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6); ++ if (dst->error) { ++ dst_release(dst); ++ dst = NULL; ++ dev->stats.tx_carrier_errors++; ++ goto tx_error_icmp; ++ } ++ skb_dst_set(skb, dst); ++ break; ++#endif ++ default: + dev->stats.tx_carrier_errors++; + goto tx_error_icmp; + } +- dst = &rt->dst; +- skb_dst_set(skb, dst); + } + + dst_hold(dst); +diff --git a/net/ipv4/route.c b/net/ipv4/route.c +index 8b855d3eec9e..05fe1d007544 100644 +--- a/net/ipv4/route.c ++++ b/net/ipv4/route.c +@@ -1014,21 +1014,22 @@ out: kfree_skb(skb); + static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) + { + struct dst_entry *dst = &rt->dst; ++ u32 old_mtu = ipv4_mtu(dst); + struct fib_result res; + bool lock = false; + + if (ip_mtu_locked(dst)) + return; + +- if (ipv4_mtu(dst) < mtu) ++ if (old_mtu < mtu) + return; + + if (mtu < ip_rt_min_pmtu) { + lock = true; +- mtu = ip_rt_min_pmtu; ++ mtu = min(old_mtu, ip_rt_min_pmtu); + } + +- if (rt->rt_pmtu == mtu && ++ if (rt->rt_pmtu == mtu && !lock && + time_before(jiffies, dst->expires - ip_rt_mtu_expires / 2)) + return; + +diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c +index 396a0f61f5f8..207bf342e995 100644 +--- a/net/ipv6/ip6_vti.c ++++ b/net/ipv6/ip6_vti.c +@@ -315,7 +315,7 @@ static int vti6_rcv(struct sk_buff *skb) + + if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { + rcu_read_unlock(); +- return 0; ++ goto discard; + } + + ipv6h = ipv6_hdr(skb); +@@ -454,15 +454,33 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) + int mtu; + + if (!dst) { +- fl->u.ip6.flowi6_oif = dev->ifindex; +- fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC; +- dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6); +- if (dst->error) { +- dst_release(dst); +- dst = NULL; ++ switch (skb->protocol) { ++ case htons(ETH_P_IP): { ++ struct rtable *rt; ++ ++ fl->u.ip4.flowi4_oif = dev->ifindex; ++ fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC; ++ rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4); ++ if (IS_ERR(rt)) ++ goto tx_err_link_failure; ++ dst = &rt->dst; ++ skb_dst_set(skb, dst); ++ break; ++ } ++ case htons(ETH_P_IPV6): ++ fl->u.ip6.flowi6_oif = dev->ifindex; ++ fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC; ++ dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6); ++ if (dst->error) { ++ dst_release(dst); ++ dst = NULL; ++ goto tx_err_link_failure; ++ } ++ skb_dst_set(skb, dst); ++ break; ++ default: + goto tx_err_link_failure; + } +- skb_dst_set(skb, dst); + } + + dst_hold(dst); +diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c +index 5ec73cf386df..7b4ce3f9e2f4 100644 +--- a/net/ipv6/tcp_ipv6.c ++++ b/net/ipv6/tcp_ipv6.c +@@ -718,7 +718,6 @@ static void tcp_v6_init_req(struct request_sock *req, + const struct sock *sk_listener, + struct sk_buff *skb) + { +- bool l3_slave = ipv6_l3mdev_skb(TCP_SKB_CB(skb)->header.h6.flags); + struct inet_request_sock *ireq = inet_rsk(req); + const struct ipv6_pinfo *np = inet6_sk(sk_listener); + +@@ -726,7 +725,7 @@ static void tcp_v6_init_req(struct request_sock *req, + ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr; + + /* So that link locals have meaning */ +- if ((!sk_listener->sk_bound_dev_if || l3_slave) && ++ if (!sk_listener->sk_bound_dev_if && + ipv6_addr_type(&ireq->ir_v6_rmt_addr) & IPV6_ADDR_LINKLOCAL) + ireq->ir_iif = tcp_v6_iif(skb); + +diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c +index 994dde6e5f9d..986e9b6b961d 100644 +--- a/net/mac80211/mesh_hwmp.c ++++ b/net/mac80211/mesh_hwmp.c +@@ -1137,7 +1137,8 @@ int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata, + } + } + +- if (!(mpath->flags & MESH_PATH_RESOLVING)) ++ if (!(mpath->flags & MESH_PATH_RESOLVING) && ++ mesh_path_sel_is_hwmp(sdata)) + mesh_queue_preq(mpath, PREQ_Q_F_START); + + if (skb_queue_len(&mpath->frame_queue) >= MESH_FRAME_QUEUE_LEN) +diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c +index 627dc642f894..77ab9cc1a230 100644 +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -3,6 +3,7 @@ + * Copyright 2006-2007 Jiri Benc + * Copyright 2013-2014 Intel Mobile Communications GmbH + * Copyright (C) 2015 - 2017 Intel Deutschland GmbH ++ * Copyright (C) 2018-2020 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as +@@ -951,6 +952,11 @@ static void __sta_info_destroy_part2(struct sta_info *sta) + might_sleep(); + lockdep_assert_held(&local->sta_mtx); + ++ while (sta->sta_state == IEEE80211_STA_AUTHORIZED) { ++ ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC); ++ WARN_ON_ONCE(ret); ++ } ++ + /* now keys can no longer be reached */ + ieee80211_free_sta_keys(local, sta); + +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index 09c7aa519ca8..513d071ccac7 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3451,8 +3451,26 @@ begin: + tx.skb = skb; + tx.sdata = vif_to_sdata(info->control.vif); + +- if (txq->sta) ++ if (txq->sta) { + tx.sta = container_of(txq->sta, struct sta_info, sta); ++ /* ++ * Drop unicast frames to unauthorised stations unless they are ++ * EAPOL frames from the local station. ++ */ ++ if (unlikely(ieee80211_is_data(hdr->frame_control) && ++ !ieee80211_vif_is_mesh(&tx.sdata->vif) && ++ tx.sdata->vif.type != NL80211_IFTYPE_OCB && ++ !is_multicast_ether_addr(hdr->addr1) && ++ !test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) && ++ (!(info->control.flags & ++ IEEE80211_TX_CTRL_PORT_CTRL_PROTO) || ++ !ether_addr_equal(tx.sdata->vif.addr, ++ hdr->addr2)))) { ++ I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); ++ ieee80211_free_txskb(&local->hw, skb); ++ goto begin; ++ } ++ } + + /* + * The key can be removed while the packet was queued, so need to call +diff --git a/net/netfilter/nft_fwd_netdev.c b/net/netfilter/nft_fwd_netdev.c +index ce13a50b9189..ee190fa4dc34 100644 +--- a/net/netfilter/nft_fwd_netdev.c ++++ b/net/netfilter/nft_fwd_netdev.c +@@ -62,6 +62,13 @@ nla_put_failure: + return -1; + } + ++static int nft_fwd_validate(const struct nft_ctx *ctx, ++ const struct nft_expr *expr, ++ const struct nft_data **data) ++{ ++ return nft_chain_validate_hooks(ctx->chain, (1 << NF_NETDEV_INGRESS)); ++} ++ + static struct nft_expr_type nft_fwd_netdev_type; + static const struct nft_expr_ops nft_fwd_netdev_ops = { + .type = &nft_fwd_netdev_type, +@@ -69,6 +76,7 @@ static const struct nft_expr_ops nft_fwd_netdev_ops = { + .eval = nft_fwd_netdev_eval, + .init = nft_fwd_netdev_init, + .dump = nft_fwd_netdev_dump, ++ .validate = nft_fwd_validate, + }; + + static struct nft_expr_type nft_fwd_netdev_type __read_mostly = { +diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c +index 387589a4a340..102750bd751c 100644 +--- a/net/packet/af_packet.c ++++ b/net/packet/af_packet.c +@@ -2204,6 +2204,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, + struct timespec ts; + __u32 ts_status; + bool is_drop_n_account = false; ++ unsigned int slot_id = 0; + bool do_vnet = false; + + /* struct tpacket{2,3}_hdr is aligned to a multiple of TPACKET_ALIGNMENT. +@@ -2300,6 +2301,13 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, + if (!h.raw) + goto drop_n_account; + ++ if (po->tp_version <= TPACKET_V2) { ++ slot_id = po->rx_ring.head; ++ if (test_bit(slot_id, po->rx_ring.rx_owner_map)) ++ goto drop_n_account; ++ __set_bit(slot_id, po->rx_ring.rx_owner_map); ++ } ++ + if (do_vnet && + virtio_net_hdr_from_skb(skb, h.raw + macoff - + sizeof(struct virtio_net_hdr), +@@ -2405,7 +2413,10 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, + #endif + + if (po->tp_version <= TPACKET_V2) { ++ spin_lock(&sk->sk_receive_queue.lock); + __packet_set_status(po, h.raw, status); ++ __clear_bit(slot_id, po->rx_ring.rx_owner_map); ++ spin_unlock(&sk->sk_receive_queue.lock); + sk->sk_data_ready(sk); + } else { + prb_clear_blk_fill_status(&po->rx_ring); +@@ -4298,6 +4309,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, + { + struct pgv *pg_vec = NULL; + struct packet_sock *po = pkt_sk(sk); ++ unsigned long *rx_owner_map = NULL; + int was_running, order = 0; + struct packet_ring_buffer *rb; + struct sk_buff_head *rb_queue; +@@ -4383,6 +4395,12 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, + } + break; + default: ++ if (!tx_ring) { ++ rx_owner_map = bitmap_alloc(req->tp_frame_nr, ++ GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO); ++ if (!rx_owner_map) ++ goto out_free_pg_vec; ++ } + break; + } + } +@@ -4412,6 +4430,8 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, + err = 0; + spin_lock_bh(&rb_queue->lock); + swap(rb->pg_vec, pg_vec); ++ if (po->tp_version <= TPACKET_V2) ++ swap(rb->rx_owner_map, rx_owner_map); + rb->frame_max = (req->tp_frame_nr - 1); + rb->head = 0; + rb->frame_size = req->tp_frame_size; +@@ -4443,6 +4463,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, + } + + out_free_pg_vec: ++ bitmap_free(rx_owner_map); + if (pg_vec) + free_pg_vec(pg_vec, order, req->tp_block_nr); + out: +diff --git a/net/packet/internal.h b/net/packet/internal.h +index c70a2794456f..f10294800aaf 100644 +--- a/net/packet/internal.h ++++ b/net/packet/internal.h +@@ -70,7 +70,10 @@ struct packet_ring_buffer { + + unsigned int __percpu *pending_refcnt; + +- struct tpacket_kbdq_core prb_bdqc; ++ union { ++ unsigned long *rx_owner_map; ++ struct tpacket_kbdq_core prb_bdqc; ++ }; + }; + + extern struct mutex fanout_mutex; +diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c +index ac9a5b8825b9..4f133faa9e60 100644 +--- a/net/sched/cls_route.c ++++ b/net/sched/cls_route.c +@@ -539,8 +539,8 @@ static int route4_change(struct net *net, struct sk_buff *in_skb, + fp = &b->ht[h]; + for (pfp = rtnl_dereference(*fp); pfp; + fp = &pfp->next, pfp = rtnl_dereference(*fp)) { +- if (pfp == f) { +- *fp = f->next; ++ if (pfp == fold) { ++ rcu_assign_pointer(*fp, fold->next); + break; + } + } +diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c +index 796b4e1beb12..c2d2c054a4e4 100644 +--- a/net/sched/cls_tcindex.c ++++ b/net/sched/cls_tcindex.c +@@ -375,6 +375,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, + + if (tcindex_alloc_perfect_hash(cp) < 0) + goto errout; ++ cp->alloc_hash = cp->hash; + for (i = 0; i < min(cp->hash, p->hash); i++) + cp->perfect[i].res = p->perfect[i].res; + balloc = 1; +diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c +index 4e458fd9236a..c58557193527 100644 +--- a/net/xfrm/xfrm_device.c ++++ b/net/xfrm/xfrm_device.c +@@ -187,6 +187,7 @@ static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void + return xfrm_dev_feat_change(dev); + + case NETDEV_DOWN: ++ case NETDEV_UNREGISTER: + return xfrm_dev_down(dev); + } + return NOTIFY_DONE; +diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c +index b5006a091fd6..f76bb5237df3 100644 +--- a/net/xfrm/xfrm_policy.c ++++ b/net/xfrm/xfrm_policy.c +@@ -301,7 +301,9 @@ EXPORT_SYMBOL(xfrm_policy_destroy); + + static void xfrm_policy_kill(struct xfrm_policy *policy) + { ++ write_lock_bh(&policy->lock); + policy->walk.dead = 1; ++ write_unlock_bh(&policy->lock); + + atomic_inc(&policy->genid); + +diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c +index 339a070da597..86084086a472 100644 +--- a/net/xfrm/xfrm_user.c ++++ b/net/xfrm/xfrm_user.c +@@ -109,7 +109,8 @@ static inline int verify_sec_ctx_len(struct nlattr **attrs) + return 0; + + uctx = nla_data(rt); +- if (uctx->len != (sizeof(struct xfrm_user_sec_ctx) + uctx->ctx_len)) ++ if (uctx->len > nla_len(rt) || ++ uctx->len != (sizeof(struct xfrm_user_sec_ctx) + uctx->ctx_len)) + return -EINVAL; + + return 0; +@@ -2211,6 +2212,9 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh, + xfrm_mark_get(attrs, &mark); + + err = verify_newpolicy_info(&ua->policy); ++ if (err) ++ goto free_state; ++ err = verify_sec_ctx_len(attrs); + if (err) + goto free_state; + +diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn +index 8d5357053f86..486e135d3e30 100644 +--- a/scripts/Makefile.extrawarn ++++ b/scripts/Makefile.extrawarn +@@ -72,5 +72,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format) + KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare) + KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) + KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) ++KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) + endif + endif +diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l +index fd825ebba69c..24af54997758 100644 +--- a/scripts/dtc/dtc-lexer.l ++++ b/scripts/dtc/dtc-lexer.l +@@ -38,7 +38,6 @@ LINECOMMENT "//".*\n + #include "srcpos.h" + #include "dtc-parser.tab.h" + +-YYLTYPE yylloc; + extern bool treesource_error; + + /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ +diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped +index 64c243772398..9db3a409c507 100644 +--- a/scripts/dtc/dtc-lexer.lex.c_shipped ++++ b/scripts/dtc/dtc-lexer.lex.c_shipped +@@ -631,7 +631,6 @@ char *yytext; + #include "srcpos.h" + #include "dtc-parser.tab.h" + +-YYLTYPE yylloc; + extern bool treesource_error; + + /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ +diff --git a/scripts/parse-maintainers.pl b/scripts/parse-maintainers.pl +old mode 100644 +new mode 100755 +diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c +index b8ab46b8298d..40d2d39151bf 100644 +--- a/sound/core/oss/pcm_plugin.c ++++ b/sound/core/oss/pcm_plugin.c +@@ -111,7 +111,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) + while (plugin->next) { + if (plugin->dst_frames) + frames = plugin->dst_frames(plugin, frames); +- if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) ++ if ((snd_pcm_sframes_t)frames <= 0) + return -ENXIO; + plugin = plugin->next; + err = snd_pcm_plugin_alloc(plugin, frames); +@@ -123,7 +123,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) + while (plugin->prev) { + if (plugin->src_frames) + frames = plugin->src_frames(plugin, frames); +- if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) ++ if ((snd_pcm_sframes_t)frames <= 0) + return -ENXIO; + plugin = plugin->prev; + err = snd_pcm_plugin_alloc(plugin, frames); +@@ -209,6 +209,8 @@ snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_p + if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + plugin = snd_pcm_plug_last(plug); + while (plugin && drv_frames > 0) { ++ if (drv_frames > plugin->buf_frames) ++ drv_frames = plugin->buf_frames; + plugin_prev = plugin->prev; + if (plugin->src_frames) + drv_frames = plugin->src_frames(plugin, drv_frames); +@@ -220,6 +222,8 @@ snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_p + plugin_next = plugin->next; + if (plugin->dst_frames) + drv_frames = plugin->dst_frames(plugin, drv_frames); ++ if (drv_frames > plugin->buf_frames) ++ drv_frames = plugin->buf_frames; + plugin = plugin_next; + } + } else +@@ -248,11 +252,15 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc + if (frames < 0) + return frames; + } ++ if (frames > plugin->buf_frames) ++ frames = plugin->buf_frames; + plugin = plugin_next; + } + } else if (stream == SNDRV_PCM_STREAM_CAPTURE) { + plugin = snd_pcm_plug_last(plug); + while (plugin) { ++ if (frames > plugin->buf_frames) ++ frames = plugin->buf_frames; + plugin_prev = plugin->prev; + if (plugin->src_frames) { + frames = plugin->src_frames(plugin, frames); +diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c +index 9debd1b8fd28..cdfb8f92d554 100644 +--- a/sound/core/seq/oss/seq_oss_midi.c ++++ b/sound/core/seq/oss/seq_oss_midi.c +@@ -615,6 +615,7 @@ send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, struct seq + len = snd_seq_oss_timer_start(dp->timer); + if (ev->type == SNDRV_SEQ_EVENT_SYSEX) { + snd_seq_oss_readq_sysex(dp->readq, mdev->seq_device, ev); ++ snd_midi_event_reset_decode(mdev->coder); + } else { + len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev); + if (len > 0) +diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c +index 8ebbca554e99..dd958d76ca5d 100644 +--- a/sound/core/seq/seq_virmidi.c ++++ b/sound/core/seq/seq_virmidi.c +@@ -95,6 +95,7 @@ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev, + if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) + continue; + snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream); ++ snd_midi_event_reset_decode(vmidi->parser); + } else { + len = snd_midi_event_decode(vmidi->parser, msg, sizeof(msg), ev); + if (len > 0) +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 5a7afbeb612d..b500dad33ea9 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -4687,6 +4687,8 @@ static void alc_determine_headset_type(struct hda_codec *codec) + is_ctia = (val & 0x1c02) == 0x1c02; + break; + case 0x10ec0225: ++ codec->power_save_node = 1; ++ /* fall through */ + case 0x10ec0295: + case 0x10ec0299: + alc_process_coef_fw(codec, alc225_pre_hsmode); +diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c +index b223de3defc4..bf4eacc53a7d 100644 +--- a/sound/usb/line6/driver.c ++++ b/sound/usb/line6/driver.c +@@ -313,7 +313,7 @@ static void line6_data_received(struct urb *urb) + line6_midibuf_read(mb, line6->buffer_message, + LINE6_MIDI_MESSAGE_MAXLEN); + +- if (done == 0) ++ if (done <= 0) + break; + + line6->message_length = done; +diff --git a/sound/usb/line6/midibuf.c b/sound/usb/line6/midibuf.c +index 36a610ba342e..c931d48801eb 100644 +--- a/sound/usb/line6/midibuf.c ++++ b/sound/usb/line6/midibuf.c +@@ -163,7 +163,7 @@ int line6_midibuf_read(struct midi_buffer *this, unsigned char *data, + int midi_length_prev = + midibuf_message_length(this->command_prev); + +- if (midi_length_prev > 0) { ++ if (midi_length_prev > 1) { + midi_length = midi_length_prev - 1; + repeat = 1; + } else +diff --git a/tools/perf/Makefile b/tools/perf/Makefile +index 7902a5681fc8..b8fc7d972be9 100644 +--- a/tools/perf/Makefile ++++ b/tools/perf/Makefile +@@ -35,7 +35,7 @@ endif + # Only pass canonical directory names as the output directory: + # + ifneq ($(O),) +- FULL_O := $(shell readlink -f $(O) || echo $(O)) ++ FULL_O := $(shell cd $(PWD); readlink -f $(O) || echo $(O)) + endif + + # +diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c +index 63db9872c880..a49f27aa0c95 100644 +--- a/tools/perf/util/map.c ++++ b/tools/perf/util/map.c +@@ -90,7 +90,7 @@ static inline bool replace_android_lib(const char *filename, char *newfilename) + return true; + } + +- if (!strncmp(filename, "/system/lib/", 11)) { ++ if (!strncmp(filename, "/system/lib/", 12)) { + char *ndk, *app; + const char *arch; + size_t ndk_length; +diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c +index 893193bd28c1..ae0feea4e8b5 100644 +--- a/tools/perf/util/probe-finder.c ++++ b/tools/perf/util/probe-finder.c +@@ -626,14 +626,19 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod, + return -EINVAL; + } + +- /* Try to get actual symbol name from symtab */ +- symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); ++ if (dwarf_entrypc(sp_die, &eaddr) == 0) { ++ /* If the DIE has entrypc, use it. */ ++ symbol = dwarf_diename(sp_die); ++ } else { ++ /* Try to get actual symbol name and address from symtab */ ++ symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); ++ eaddr = sym.st_value; ++ } + if (!symbol) { + pr_warning("Failed to find symbol at 0x%lx\n", + (unsigned long)paddr); + return -ENOENT; + } +- eaddr = sym.st_value; + + tp->offset = (unsigned long)(paddr - eaddr); + tp->address = (unsigned long)paddr; +diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c +index 2116df9ad832..c097a3748674 100644 +--- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c ++++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c +@@ -83,7 +83,7 @@ static struct pci_access *pci_acc; + static struct pci_dev *amd_fam14h_pci_dev; + static int nbp1_entered; + +-struct timespec start_time; ++static struct timespec start_time; + static unsigned long long timediff; + + #ifdef DEBUG +diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c +index 5b3205f16217..5277df27191f 100644 +--- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c ++++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c +@@ -21,7 +21,7 @@ struct cpuidle_monitor cpuidle_sysfs_monitor; + + static unsigned long long **previous_count; + static unsigned long long **current_count; +-struct timespec start_time; ++static struct timespec start_time; + static unsigned long long timediff; + + static int cpuidle_get_count_percent(unsigned int id, double *percent, +diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +index 05f953f0f0a0..80a21cb67d94 100644 +--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c ++++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +@@ -29,6 +29,8 @@ struct cpuidle_monitor *all_monitors[] = { + 0 + }; + ++int cpu_count; ++ + static struct cpuidle_monitor *monitors[MONITORS_MAX]; + static unsigned int avail_monitors; + +diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h +index 9e43f3371fbc..3558bbae2b5d 100644 +--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h ++++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h +@@ -18,7 +18,7 @@ + #define CSTATE_NAME_LEN 5 + #define CSTATE_DESC_LEN 60 + +-int cpu_count; ++extern int cpu_count; + + /* Hard to define the right names ...: */ + enum power_range_e { +diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include +index 71dc7efc7efa..df247f39d7c5 100644 +--- a/tools/scripts/Makefile.include ++++ b/tools/scripts/Makefile.include +@@ -1,8 +1,8 @@ + # SPDX-License-Identifier: GPL-2.0 + ifneq ($(O),) + ifeq ($(origin O), command line) +- dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),) +- ABSOLUTE_O := $(shell cd $(O) ; pwd) ++ dummy := $(if $(shell cd $(PWD); test -d $(O) || echo $(O)),$(error O=$(O) does not exist),) ++ ABSOLUTE_O := $(shell cd $(PWD); cd $(O) ; pwd) + OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) + COMMAND_O := O=$(ABSOLUTE_O) + ifeq ($(objtree),)