History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

No conflicts.

Jakub Kicinski committed 4 years ago

Commit 7cd28022 parents 0f473bb 6441998342 files · +3131 −1185Browse files

Unified · Split

342 files
  1. .mailmap +2 −0
  2. Documentation/devicetree/bindings/i2c/apple,i2c.yaml +4 −4
  3. Documentation/devicetree/bindings/iio/adc/samsung,exynos-adc.yaml +1 −1
  4. Documentation/devicetree/bindings/input/gpio-keys.yaml +1 −1
  5. Documentation/devicetree/bindings/media/nxp,imx7-mipi-csi2.yaml +2 −12
  6. Documentation/devicetree/bindings/net/ethernet-phy.yaml +8 −0
  7. Documentation/devicetree/bindings/phy/xlnx,zynqmp-psgtr.yaml +1 −1
  8. Documentation/devicetree/bindings/power/supply/bq25980.yaml +1 −1
  9. Documentation/devicetree/bindings/sound/wlf,wm8962.yaml +3 −0
  10. Documentation/networking/device_drivers/ethernet/intel/ixgbe.rst +16 −0
  11. MAINTAINERS +16 −8
  12. Makefile +6 −6
  13. arch/arm/boot/dts/imx6qp-prtwd3.dts +2 −0
  14. arch/arm/boot/dts/imx6ull-pinfunc.h +1 −1
  15. arch/arm/boot/dts/ls1021a-tsn.dts +2 −0
  16. arch/arm/boot/dts/socfpga_arria10_socdk_qspi.dts +1 −1
  17. arch/arm/boot/dts/socfpga_arria5_socdk.dts +1 −1
  18. arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +1 −1
  19. arch/arm/boot/dts/socfpga_cyclone5_sockit.dts +1 −1
  20. arch/arm/boot/dts/socfpga_cyclone5_socrates.dts +1 −1
  21. arch/arm/boot/dts/socfpga_cyclone5_sodia.dts +1 −1
  22. arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dts +2 −2
  23. arch/arm/mach-rockchip/platsmp.c +1 −1
  24. arch/arm64/Kconfig.platforms +0 −1
  25. arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j100.dts +15 −15
  26. arch/arm64/boot/dts/apple/t8103-j274.dts +1 −1
  27. arch/arm64/boot/dts/apple/t8103.dtsi +8 −3
  28. arch/arm64/boot/dts/freescale/fsl-ls1088a-ten64.dts +0 −2
  29. arch/arm64/boot/dts/freescale/fsl-lx2160a-bluebox3.dts +4 −0
  30. arch/arm64/boot/dts/freescale/imx8mq.dtsi +0 −2
  31. arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts +1 −1
  32. arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi +0 −1
  33. arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts +1 −0
  34. arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts +1 −1
  35. arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +1 −1
  36. arch/arm64/kernel/machine_kexec_file.c +1 −0
  37. arch/csky/kernel/traps.c +2 −2
  38. arch/s390/configs/debug_defconfig +2 −0
  39. arch/s390/configs/defconfig +2 −0
  40. arch/s390/kernel/ftrace.c +0 −2
  41. arch/s390/kernel/irq.c +5 −4
  42. arch/s390/kernel/machine_kexec_file.c +34 −4
  43. arch/x86/include/asm/kvm_host.h +1 −1
  44. arch/x86/kernel/smpboot.c +14 −0
  45. arch/x86/kvm/hyperv.c +5 −2
  46. arch/x86/kvm/vmx/vmx.c +13 −9
  47. arch/x86/kvm/x86.c +9 −3
  48. arch/x86/net/bpf_jit_comp.c +43 −8
  49. block/fops.c +1 −2
  50. block/ioprio.c +3 −0
  51. drivers/Makefile +1 −2
  52. drivers/android/binder.c +9 −12
  53. drivers/ata/ahci_ceva.c +2 −1
  54. drivers/ata/libata-core.c +2 −0
  55. drivers/bus/mhi/core/pm.c +18 −3
  56. drivers/bus/mhi/pci_generic.c +1 −1
  57. drivers/clk/clk.c +12 −3
  58. drivers/clk/imx/clk-imx8qxp-lpcg.c +1 −1
  59. drivers/clk/imx/clk-imx8qxp.c +1 −1
  60. drivers/clk/qcom/clk-alpha-pll.c +9 −0
  61. drivers/clk/qcom/clk-regmap-mux.c +1 −1
  62. drivers/clk/qcom/common.c +12 −0
  63. drivers/clk/qcom/common.h +2 −0
  64. drivers/clk/qcom/gcc-sm6125.c +2 −2
  65. drivers/clk/versatile/clk-icst.c +1 −1
  66. drivers/clocksource/arm_arch_timer.c +7 −2
  67. drivers/clocksource/dw_apb_timer_of.c +1 −1
  68. drivers/firmware/scpi_pm_domain.c +7 −3
  69. drivers/firmware/tegra/bpmp-debugfs.c +3 −2
  70. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 −1
  71. drivers/gpu/drm/amd/display/dc/dc_link.h +2 −0
  72. drivers/gpu/drm/drm_syncobj.c +10 −1
  73. drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +1 −0
  74. drivers/gpu/drm/i915/gt/intel_workarounds.c +9 −9
  75. drivers/gpu/drm/ttm/ttm_bo.c +2 −1
  76. drivers/hv/Kconfig +1 −0
  77. drivers/hwmon/corsair-psu.c +1 −1
  78. drivers/hwmon/dell-smm-hwmon.c +3 −4
  79. drivers/hwmon/nct6775.c +1 −1
  80. drivers/hwmon/pwm-fan.c +0 −2
  81. drivers/hwmon/sht4x.c +2 −2
  82. drivers/i2c/busses/i2c-mpc.c +1 −1
  83. drivers/i2c/busses/i2c-virtio.c +12 −20
  84. drivers/iio/accel/kxcjk-1013.c +2 −3
  85. drivers/iio/accel/kxsd9.c +3 −3
  86. drivers/iio/accel/mma8452.c +1 −1
  87. drivers/iio/adc/Kconfig +1 −1
  88. drivers/iio/adc/ad7768-1.c +1 −1
  89. drivers/iio/adc/at91-sama5d2_adc.c +2 −1
  90. drivers/iio/adc/axp20x_adc.c +3 −15
  91. drivers/iio/adc/dln2-adc.c +12 −9
  92. drivers/iio/adc/stm32-adc.c +2 −1
  93. drivers/iio/gyro/adxrs290.c +3 −2
  94. drivers/iio/gyro/itg3200_buffer.c +1 −1
  95. drivers/iio/industrialio-trigger.c +0 −1
  96. drivers/iio/light/ltr501.c +1 −1
  97. drivers/iio/light/stk3310.c +3 −3
  98. drivers/iio/trigger/stm32-timer-trigger.c +1 −1
  99. drivers/infiniband/hw/hfi1/chip.c +2 −0
  100. drivers/infiniband/hw/hfi1/driver.c +2 −0
  101. drivers/infiniband/hw/hfi1/init.c +17 −23
  102. drivers/infiniband/hw/hfi1/sdma.c +1 −1
  103. drivers/infiniband/hw/hns/hns_roce_hw_v2.c +11 −3
  104. drivers/infiniband/hw/irdma/hw.c +6 −1
  105. drivers/infiniband/hw/irdma/main.h +1 −0
  106. drivers/infiniband/hw/irdma/pble.c +3 −5
  107. drivers/infiniband/hw/irdma/pble.h +0 −1
  108. drivers/infiniband/hw/irdma/utils.c +17 −7
  109. drivers/infiniband/hw/irdma/verbs.c +18 −5
  110. drivers/infiniband/hw/irdma/verbs.h +2 −0
  111. drivers/infiniband/hw/mlx5/mlx5_ib.h +3 −3
  112. drivers/infiniband/hw/mlx5/mr.c +12 −14
  113. drivers/infiniband/sw/rxe/rxe_qp.c +1 −0
  114. drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c +6 −3
  115. drivers/irqchip/irq-apple-aic.c +1 −1
  116. drivers/irqchip/irq-armada-370-xp.c +6 −10
  117. drivers/irqchip/irq-aspeed-scu-ic.c +2 −2
  118. drivers/irqchip/irq-bcm7120-l2.c +1 −0
  119. drivers/irqchip/irq-gic-v3-its.c +1 −1
  120. drivers/irqchip/irq-mips-gic.c +2 −2
  121. drivers/irqchip/irq-nvic.c +1 −1
  122. drivers/md/dm-integrity.c +1 −1
  123. drivers/md/md.c +3 −1
  124. drivers/md/persistent-data/dm-btree-remove.c +1 −1
  125. drivers/misc/cardreader/rtsx_pcr.c +0 −4
  126. drivers/misc/eeprom/at25.c +18 −20
  127. drivers/misc/fastrpc.c +6 −4
  128. drivers/mmc/host/mtk-sd.c +3 −1
  129. drivers/mmc/host/renesas_sdhi_core.c +1 −1
  130. drivers/net/dsa/mv88e6xxx/chip.c +4 −0
  131. drivers/net/dsa/mv88e6xxx/port.c +2 −2
  132. drivers/net/ethernet/broadcom/bcmsysport.c +4 −1
  133. drivers/net/ethernet/broadcom/bcmsysport.h +1 −0
  134. drivers/net/ethernet/broadcom/genet/bcmmii.c +2 −2
  135. drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +2 −0
  136. drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +1 −1
  137. drivers/net/ethernet/hisilicon/hns3/hnae3.h +2 −0
  138. drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +14 −6
  139. drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c +2 −1
  140. drivers/net/ethernet/intel/iavf/iavf_main.c +2 −3
  141. drivers/net/ethernet/intel/ice/ice_ptp.c +5 −8
  142. drivers/net/ethernet/intel/ice/ice_ptp.h +6 −0
  143. drivers/net/ethernet/intel/igb/igb_main.c +14 −14
  144. drivers/net/ethernet/intel/igbvf/netdev.c +1 −0
  145. drivers/net/ethernet/intel/igc/igc_i225.c +1 −1
  146. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +4 −0
  147. drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +3 −0
  148. drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +2 −1
  149. drivers/net/ethernet/sfc/ef100_nic.c +3 −0
  150. drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +3 −1
  151. drivers/net/ethernet/stmicro/stmmac/stmmac.h +17 −0
  152. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +12 −4
  153. drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +73 −13
  154. drivers/net/ethernet/ti/am65-cpsw-nuss.c +20 −9
  155. drivers/net/netdevsim/bpf.c +1 −0
  156. drivers/net/netdevsim/ethtool.c +4 −1
  157. drivers/net/phy/mdio_bus.c +3 −0
  158. drivers/net/usb/lan78xx.c +6 −0
  159. drivers/net/usb/qmi_wwan.c +1 −0
  160. drivers/net/virtio_net.c +3 −6
  161. drivers/net/wireless/ath/ath11k/mhi.c +5 −1
  162. drivers/net/wireless/broadcom/brcm80211/Kconfig +9 −5
  163. drivers/net/wireless/broadcom/brcm80211/brcmsmac/Makefile +1 −1
  164. drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.h +1 −1
  165. drivers/net/wireless/intel/iwlegacy/Kconfig +2 −2
  166. drivers/net/wireless/intel/iwlwifi/Kconfig +1 −1
  167. drivers/net/wireless/intel/iwlwifi/mvm/tx.c +3 −2
  168. drivers/net/wireless/mediatek/mt76/Makefile +1 −1
  169. drivers/nvme/host/core.c +18 −5
  170. drivers/nvme/host/multipath.c +2 −1
  171. drivers/nvme/host/nvme.h +1 −1
  172. drivers/nvme/host/zns.c +4 −1
  173. drivers/nvme/target/tcp.c +8 −1
  174. drivers/of/irq.c +25 −2
  175. drivers/pci/controller/Kconfig +2 −2
  176. drivers/pci/controller/pci-aardvark.c +0 −9
  177. drivers/pci/controller/pcie-apple.c +12 −2
  178. drivers/phy/hisilicon/phy-hi3670-pcie.c +2 −2
  179. drivers/phy/marvell/phy-mvebu-cp110-utmi.c +2 −2
  180. drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c +14 −12
  181. drivers/phy/qualcomm/phy-qcom-qmp.c +3 −0
  182. drivers/phy/qualcomm/phy-qcom-usb-hsic.c +1 −1
  183. drivers/phy/st/phy-stm32-usbphyc.c +1 −1
  184. drivers/phy/ti/phy-am654-serdes.c +1 −1
  185. drivers/phy/ti/phy-j721e-wiz.c +1 −1
  186. drivers/phy/ti/phy-omap-usb2.c +3 −3
  187. drivers/phy/ti/phy-tusb1210.c +1 −1
  188. drivers/reset/tegra/reset-bpmp.c +1 −8
  189. drivers/scsi/pm8001/pm8001_init.c +2 −4
  190. drivers/scsi/qedi/qedi_fw.c +15 −22
  191. drivers/scsi/qedi/qedi_iscsi.c +1 −1
  192. drivers/scsi/qedi/qedi_iscsi.h +1 −1
  193. drivers/scsi/qla2xxx/qla_dbg.c +3 −0
  194. drivers/scsi/scsi_debug.c +1 −1
  195. drivers/soc/imx/imx8m-blk-ctrl.c +19 −0
  196. drivers/soc/imx/soc-imx.c +4 −0
  197. drivers/soc/tegra/fuse/fuse-tegra.c +1 −1
  198. drivers/soc/tegra/fuse/fuse.h +1 −1
  199. drivers/tee/amdtee/core.c +2 −3
  200. drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c +1 −1
  201. drivers/usb/core/config.c +3 −3
  202. drivers/usb/dwc3/dwc3-qcom.c +0 −15
  203. drivers/usb/gadget/composite.c +13 −1
  204. drivers/usb/gadget/legacy/dbgp.c +14 −1
  205. drivers/usb/gadget/legacy/inode.c +15 −1
  206. drivers/usb/host/xhci-hub.c +1 −0
  207. drivers/usb/host/xhci-ring.c +0 −1
  208. drivers/usb/host/xhci.c +15 −11
  209. drivers/vdpa/vdpa.c +2 −1
  210. drivers/vdpa/vdpa_user/vduse_dev.c +4 −2
  211. drivers/vhost/vdpa.c +1 −1
  212. drivers/virtio/virtio_ring.c +1 −1
  213. fs/afs/file.c +3 −2
  214. fs/afs/super.c +1 −0
  215. fs/aio.c +152 −34
  216. fs/btrfs/delalloc-space.c +9 −3
  217. fs/btrfs/extent-tree.c +3 −0
  218. fs/btrfs/extent_io.c +14 −0
  219. fs/btrfs/ioctl.c +2 −4
  220. fs/btrfs/root-tree.c +2 −1
  221. fs/btrfs/tree-log.c +3 −2
  222. fs/btrfs/zoned.c +2 −0
  223. fs/ceph/caps.c +8 −8
  224. fs/ceph/file.c +16 −4
  225. fs/ceph/mds_client.c +1 −2
  226. fs/cifs/sess.c +36 −18
  227. fs/file.c +56 −16
  228. fs/io-wq.c +23 −6
  229. fs/io_uring.c +4 −2
  230. fs/nfsd/nfs4recover.c +1 −0
  231. fs/nfsd/nfs4state.c +7 −2
  232. fs/nfsd/nfsctl.c +7 −7
  233. fs/signalfd.c +1 −11
  234. fs/smbfs_common/cifs_arc4.c +0 −13
  235. fs/tracefs/inode.c +76 −0
  236. fs/xfs/xfs_super.c +11 −3
  237. include/linux/delay.h +13 −1
  238. include/linux/mhi.h +13 −0
  239. include/linux/percpu-refcount.h +1 −1
  240. include/linux/pm_runtime.h +1 −1
  241. include/linux/wait.h +26 −0
  242. include/uapi/asm-generic/poll.h +1 −1
  243. include/uapi/linux/mptcp.h +10 −8
  244. include/uapi/linux/resource.h +10 −3
  245. kernel/audit.c +10 −11
  246. kernel/bpf/verifier.c +36 −17
  247. kernel/sched/wait.c +7 −0
  248. kernel/time/timer.c +9 −7
  249. kernel/trace/ftrace.c +7 −1
  250. kernel/trace/trace_events_synth.c +6 −5
  251. mm/Kconfig +1 −1
  252. mm/backing-dev.c +7 −0
  253. mm/damon/core.c +7 −13
  254. mm/damon/dbgfs.c +1 −3
  255. mm/damon/vaddr-test.h +37 −42
  256. mm/damon/vaddr.c +0 −1
  257. mm/filemap.c +0 −2
  258. mm/hugetlb.c +1 −1
  259. mm/memcontrol.c +53 −53
  260. mm/slub.c +9 −6
  261. net/core/skbuff.c +1 −1
  262. net/ipv4/inet_diag.c +1 −3
  263. net/ipv6/sit.c +0 −1
  264. net/mac80211/agg-rx.c +3 −2
  265. net/mac80211/agg-tx.c +11 −5
  266. net/mac80211/driver-ops.h +4 −1
  267. net/mac80211/mlme.c +10 −3
  268. net/mac80211/rx.c +1 −0
  269. net/mac80211/sta_info.c +12 −9
  270. net/mac80211/sta_info.h +2 −0
  271. net/mac80211/tx.c +5 −5
  272. net/mac80211/util.c +14 −9
  273. net/mptcp/pm_netlink.c +3 −0
  274. net/mptcp/protocol.c +4 −2
  275. net/mptcp/sockopt.c +0 −1
  276. net/packet/af_packet.c +3 −2
  277. net/phonet/pep.c +1 −0
  278. net/rds/connection.c +1 −0
  279. net/sched/cls_api.c +1 −0
  280. net/sched/sch_cake.c +1 −5
  281. net/sched/sch_ets.c +2 −2
  282. net/smc/af_smc.c +3 −1
  283. net/vmw_vsock/virtio_transport_common.c +2 −1
  284. net/wireless/reg.c +28 −2
  285. net/xdp/xsk.c +2 −2
  286. samples/ftrace/Makefile +1 −0
  287. samples/ftrace/ftrace-direct-multi-modify.c +152 −0
  288. scripts/recordmcount.pl +1 −1
  289. sound/core/control_compat.c +3 −0
  290. sound/core/oss/pcm_oss.c +25 −12
  291. sound/pci/hda/patch_realtek.c +62 −18
  292. sound/soc/amd/yc/pci-acp6x.c +2 −1
  293. sound/soc/codecs/rt5682.c +6 −4
  294. sound/soc/codecs/rt5682s.c +6 −4
  295. sound/soc/codecs/wcd934x.c +93 −33
  296. sound/soc/codecs/wsa881x.c +12 −4
  297. sound/soc/qcom/qdsp6/q6routing.c +5 −3
  298. sound/soc/rockchip/rockchip_i2s_tdm.c +31 −21
  299. sound/soc/sof/intel/hda-codec.c +9 −5
  300. sound/soc/tegra/tegra210_adx.c +2 −2
  301. sound/soc/tegra/tegra210_amx.c +2 −2
  302. sound/soc/tegra/tegra210_mixer.c +2 −2
  303. sound/soc/tegra/tegra210_mvc.c +4 −4
  304. sound/soc/tegra/tegra210_sfc.c +2 −2
  305. sound/usb/mixer_quirks.c +5 −5
  306. tools/perf/util/event.h +4 −1
  307. tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +55 −30
  308. tools/perf/util/intel-pt.c +1 −0
  309. tools/perf/util/perf_regs.c +3 −0
  310. tools/perf/util/python.c +1 −1
  311. tools/power/acpi/Makefile.config +1 −0
  312. tools/power/acpi/Makefile.rules +1 −0
  313. tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c +20 −0
  314. tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c +14 −2
  315. tools/testing/selftests/bpf/progs/test_module_attach.c +12 −0
  316. tools/testing/selftests/bpf/test_verifier.c +1 −1
  317. tools/testing/selftests/bpf/verifier/atomic_cmpxchg.c +86 −0
  318. tools/testing/selftests/bpf/verifier/atomic_fetch.c +94 −0
  319. tools/testing/selftests/bpf/verifier/search_pruning.c +71 −0
  320. tools/testing/selftests/bpf/verifier/spill_fill.c +32 −0
  321. tools/testing/selftests/bpf/verifier/value_ptr_arith.c +23 −0
  322. tools/testing/selftests/damon/.gitignore +2 −0
  323. tools/testing/selftests/damon/Makefile +5 −2
  324. tools/testing/selftests/damon/_debugfs_common.sh +52 −0
  325. tools/testing/selftests/damon/debugfs_attrs.sh +1 −72
  326. tools/testing/selftests/damon/debugfs_empty_targets.sh +13 −0
  327. tools/testing/selftests/damon/debugfs_huge_count_read_write.sh +22 −0
  328. tools/testing/selftests/damon/debugfs_schemes.sh +19 −0
  329. tools/testing/selftests/damon/debugfs_target_ids.sh +19 −0
  330. tools/testing/selftests/damon/huge_count_read_write.c +39 −0
  331. tools/testing/selftests/drivers/net/mlxsw/rif_mac_profiles_occ.sh +30 −0
  332. tools/testing/selftests/kvm/.gitignore +1 −0
  333. tools/testing/selftests/kvm/Makefile +1 −0
  334. tools/testing/selftests/kvm/include/kvm_util.h +9 −0
  335. tools/testing/selftests/kvm/lib/kvm_util.c +1 −1
  336. tools/testing/selftests/kvm/lib/x86_64/processor.c +68 −0
  337. tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c +1 −1
  338. tools/testing/selftests/kvm/x86_64/userspace_io_test.c +114 −0
  339. tools/testing/selftests/net/fcnal-test.sh +34 −11
  340. tools/testing/selftests/net/forwarding/forwarding.config.sample +2 −0
  341. tools/testing/selftests/net/icmp_redirect.sh +1 −1
  342. tools/testing/selftests/net/toeplitz.c +1 −1
.mailmap+2−0
@@ -126,6 +126,8 @@ Greg Kroah-Hartman <gregkh@suse.de> · 125 unmodified lines
126126 Greg Kroah-Hartman <greg@kroah.com>
127127 Greg Kurz <groug@kaod.org> <gkurz@linux.vnet.ibm.com>
128128 Gregory CLEMENT <gregory.clement@bootlin.com> <gregory.clement@free-electrons.com>
129+Guo Ren <guoren@kernel.org> <guoren@linux.alibaba.com>
130+Guo Ren <guoren@kernel.org> <ren_guo@c-sky.com>
129131 Gustavo Padovan <gustavo@las.ic.unicamp.br>
130132 Gustavo Padovan <padovan@profusion.mobi>
131133 Hanjun Guo <guohanjun@huawei.com> <hanjun.guo@linaro.org>
Documentation/devicetree/bindings/i2c/apple,i2c.yaml+4−4
@@ -20,9 +20,9 @@ allOf: · 19 unmodified lines
2020
2121 properties:
2222 compatible:
23− enum:
24− - apple,t8103-i2c
25− - apple,i2c
23+ items:
24+ - const: apple,t8103-i2c
25+ - const: apple,i2c
2626
2727 reg:
2828 maxItems: 1
@@ -51,7 +51,7 @@ unevaluatedProperties: false · 22 unmodified lines
5151 examples:
5252 - |
5353 i2c@35010000 {
54− compatible = "apple,t8103-i2c";
54+ compatible = "apple,t8103-i2c", "apple,i2c";
5555 reg = <0x35010000 0x4000>;
5656 interrupt-parent = <&aic>;
5757 interrupts = <0 627 4>;
Documentation/devicetree/bindings/iio/adc/samsung,exynos-adc.yaml+1−1
@@ -136,7 +136,7 @@ examples: · 135 unmodified lines
136136 samsung,syscon-phandle = <&pmu_system_controller>;
137137
138138 /* NTC thermistor is a hwmon device */
139− ncp15wb473 {
139+ thermistor {
140140 compatible = "murata,ncp15wb473";
141141 pullup-uv = <1800000>;
142142 pullup-ohm = <47000>;
Documentation/devicetree/bindings/input/gpio-keys.yaml+1−1
@@ -142,7 +142,7 @@ examples: · 141 unmodified lines
142142 down {
143143 label = "GPIO Key DOWN";
144144 linux,code = <108>;
145− interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
145+ interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
146146 };
147147 };
148148
Documentation/devicetree/bindings/media/nxp,imx7-mipi-csi2.yaml+2−12
@@ -79,6 +79,8 @@ properties: · 78 unmodified lines
7979
8080 properties:
8181 data-lanes:
82+ description:
83+ Note that 'fsl,imx7-mipi-csi2' only supports up to 2 data lines.
8284 items:
8385 minItems: 1
8486 maxItems: 4
@@ -91,18 +93,6 @@ properties: · 6 unmodified lines
9193 required:
9294 - data-lanes
9395
94− allOf:
95− - if:
96− properties:
97− compatible:
98− contains:
99− const: fsl,imx7-mipi-csi2
100− then:
101− properties:
102− data-lanes:
103− items:
104− maxItems: 2
105−
10696 port@1:
10797 $ref: /schemas/graph.yaml#/properties/port
10898 description:
Documentation/devicetree/bindings/net/ethernet-phy.yaml+8−0
@@ -91,6 +91,14 @@ properties: · 90 unmodified lines
9191 compensate for the board being designed with the lanes
9292 swapped.
9393
94+ enet-phy-lane-no-swap:
95+ $ref: /schemas/types.yaml#/definitions/flag
96+ description:
97+ If set, indicates that PHY will disable swap of the
98+ TX/RX lanes. This property allows the PHY to work correcly after
99+ e.g. wrong bootstrap configuration caused by issues in PCB
100+ layout design.
101+
94102 eee-broken-100tx:
95103 $ref: /schemas/types.yaml#/definitions/flag
96104 description:
Documentation/devicetree/bindings/phy/xlnx,zynqmp-psgtr.yaml+1−1
@@ -29,7 +29,7 @@ properties: · 28 unmodified lines
2929 - PHY_TYPE_PCIE
3030 - PHY_TYPE_SATA
3131 - PHY_TYPE_SGMII
32− - PHY_TYPE_USB
32+ - PHY_TYPE_USB3
3333 - description: The PHY instance
3434 minimum: 0
3535 maximum: 1 # for DP, SATA or USB
Documentation/devicetree/bindings/power/supply/bq25980.yaml+1−1
@@ -105,7 +105,7 @@ examples: · 104 unmodified lines
105105 reg = <0x65>;
106106 interrupt-parent = <&gpio1>;
107107 interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
108− ti,watchdog-timer = <0>;
108+ ti,watchdog-timeout-ms = <0>;
109109 ti,sc-ocp-limit-microamp = <2000000>;
110110 ti,sc-ovp-limit-microvolt = <17800000>;
111111 monitored-battery = <&bat>;
Documentation/devicetree/bindings/sound/wlf,wm8962.yaml+3−0
@@ -19,6 +19,9 @@ properties: · 18 unmodified lines
1919 clocks:
2020 maxItems: 1
2121
22+ interrupts:
23+ maxItems: 1
24+
2225 "#sound-dai-cells":
2326 const: 0
2427
Documentation/networking/device_drivers/ethernet/intel/ixgbe.rst+16−0
@@ -440,6 +440,22 @@ NOTE: For 82599-based network connections, if you are enabling jumbo frames in · 439 unmodified lines
440440 a virtual function (VF), jumbo frames must first be enabled in the physical
441441 function (PF). The VF MTU setting cannot be larger than the PF MTU.
442442
443+NBASE-T Support
444+---------------
445+The ixgbe driver supports NBASE-T on some devices. However, the advertisement
446+of NBASE-T speeds is suppressed by default, to accommodate broken network
447+switches which cannot cope with advertised NBASE-T speeds. Use the ethtool
448+command to enable advertising NBASE-T speeds on devices which support it::
449+
450+ ethtool -s eth? advertise 0x1800000001028
451+
452+On Linux systems with INTERFACES(5), this can be specified as a pre-up command
453+in /etc/network/interfaces so that the interface is always brought up with
454+NBASE-T support, e.g.::
455+
456+ iface eth? inet dhcp
457+ pre-up ethtool -s eth? advertise 0x1800000001028 || true
458+
443459 Generic Receive Offload, aka GRO
444460 --------------------------------
445461 The driver supports the in-kernel software implementation of GRO. GRO has
MAINTAINERS+16−8
@@ -3066,7 +3066,7 @@ F: Documentation/devicetree/bindings/phy/phy-ath79-usb.txt · 3065 unmodified lines
30663066 F: drivers/phy/qualcomm/phy-ath79-usb.c
30673067
30683068 ATHEROS ATH GENERIC UTILITIES
3069−M: Kalle Valo <kvalo@codeaurora.org>
3069+M: Kalle Valo <kvalo@kernel.org>
30703070 L: linux-wireless@vger.kernel.org
30713071 S: Supported
30723072 F: drivers/net/wireless/ath/*
@@ -3081,7 +3081,7 @@ W: https://wireless.wiki.kernel.org/en/users/Drivers/ath5k · 8 unmodified lines
30813081 F: drivers/net/wireless/ath/ath5k/
30823082
30833083 ATHEROS ATH6KL WIRELESS DRIVER
3084−M: Kalle Valo <kvalo@codeaurora.org>
3084+M: Kalle Valo <kvalo@kernel.org>
30853085 L: linux-wireless@vger.kernel.org
30863086 S: Supported
30873087 W: https://wireless.wiki.kernel.org/en/users/Drivers/ath6kl
@@ -9329,7 +9329,6 @@ S: Maintained · 6241 unmodified lines
93299329 F: drivers/iio/pressure/dps310.c
93309330
93319331 INFINIBAND SUBSYSTEM
9332−M: Doug Ledford <dledford@redhat.com>
93339332 M: Jason Gunthorpe <jgg@nvidia.com>
93349333 L: linux-rdma@vger.kernel.org
93359334 S: Supported
@@ -10280,9 +10279,9 @@ F: lib/Kconfig.kcsan · 944 unmodified lines
1028010279 F: scripts/Makefile.kcsan
1028110280
1028210281 KDUMP
10283−M: Dave Young <dyoung@redhat.com>
1028410282 M: Baoquan He <bhe@redhat.com>
1028510283 R: Vivek Goyal <vgoyal@redhat.com>
10284+R: Dave Young <dyoung@redhat.com>
1028610285 L: kexec@lists.infradead.org
1028710286 S: Maintained
1028810287 W: http://lse.sourceforge.net/kdump/
@@ -13256,7 +13255,7 @@ F: include/uapi/linux/if_* · 2967 unmodified lines
1325613255 F: include/uapi/linux/netdevice.h
1325713256
1325813257 NETWORKING DRIVERS (WIRELESS)
13259−M: Kalle Valo <kvalo@codeaurora.org>
13258+M: Kalle Valo <kvalo@kernel.org>
1326013259 L: linux-wireless@vger.kernel.org
1326113260 S: Maintained
1326213261 Q: http://patchwork.kernel.org/project/linux-wireless/list/
@@ -15712,7 +15711,7 @@ T: git git://linuxtv.org/anttip/media_tree.git · 2449 unmodified lines
1571215711 F: drivers/media/tuners/qt1010*
1571315712
1571415713 QUALCOMM ATHEROS ATH10K WIRELESS DRIVER
15715−M: Kalle Valo <kvalo@codeaurora.org>
15714+M: Kalle Valo <kvalo@kernel.org>
1571615715 L: ath10k@lists.infradead.org
1571715716 S: Supported
1571815717 W: https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
@@ -15720,7 +15719,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git · 1 unmodified line
1572015719 F: drivers/net/wireless/ath/ath10k/
1572115720
1572215721 QUALCOMM ATHEROS ATH11K WIRELESS DRIVER
15723−M: Kalle Valo <kvalo@codeaurora.org>
15722+M: Kalle Valo <kvalo@kernel.org>
1572415723 L: ath11k@lists.infradead.org
1572515724 S: Supported
1572615725 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
@@ -15786,6 +15785,15 @@ S: Maintained · 59 unmodified lines
1578615785 F: Documentation/devicetree/bindings/net/qcom,ethqos.txt
1578715786 F: drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
1578815787
15788+QUALCOMM FASTRPC DRIVER
15789+M: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
15790+M: Amol Maheshwari <amahesh@qti.qualcomm.com>
15791+L: linux-arm-msm@vger.kernel.org
15792+S: Maintained
15793+F: Documentation/devicetree/bindings/misc/qcom,fastrpc.txt
15794+F: drivers/misc/fastrpc.c
15795+F: include/uapi/misc/fastrpc.h
15796+
1578915797 QUALCOMM GENERIC INTERFACE I2C DRIVER
1579015798 M: Akash Asthana <akashast@codeaurora.org>
1579115799 M: Mukesh Savaliya <msavaliy@codeaurora.org>
@@ -15892,7 +15900,7 @@ F: Documentation/devicetree/bindings/media/*venus* · 100 unmodified lines
1589215900 F: drivers/media/platform/qcom/venus/
1589315901
1589415902 QUALCOMM WCN36XX WIRELESS DRIVER
15895−M: Kalle Valo <kvalo@codeaurora.org>
15903+M: Kalle Valo <kvalo@kernel.org>
1589615904 L: wcn36xx@lists.infradead.org
1589715905 S: Supported
1589815906 W: https://wireless.wiki.kernel.org/en/users/Drivers/wcn36xx
Makefile+6−6
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 16
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc4
5+EXTRAVERSION = -rc5
66 NAME = Gobble Gobble
77
88 # *DOCUMENTATION*
@@ -1374,17 +1374,17 @@ endif · 1365 unmodified lines
13741374
13751375 ifneq ($(dtstree),)
13761376
1377−%.dtb: dt_binding_check include/config/kernel.release scripts_dtc
1378− $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ $(dtstree)/$*.dt.yaml
1377+%.dtb: include/config/kernel.release scripts_dtc
1378+ $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
13791379
1380−%.dtbo: dt_binding_check include/config/kernel.release scripts_dtc
1381− $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ $(dtstree)/$*.dt.yaml
1380+%.dtbo: include/config/kernel.release scripts_dtc
1381+ $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
13821382
13831383 PHONY += dtbs dtbs_install dtbs_check
13841384 dtbs: include/config/kernel.release scripts_dtc
13851385 $(Q)$(MAKE) $(build)=$(dtstree)
13861386
1387−ifneq ($(filter dtbs_check %.dtb %.dtbo, $(MAKECMDGOALS)),)
1387+ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
13881388 export CHECK_DTBS=y
13891389 dtbs: dt_binding_check
13901390 endif
arch/arm/boot/dts/imx6qp-prtwd3.dts+2−0
@@ -178,6 +178,8 @@ · 177 unmodified lines
178178 label = "cpu";
179179 ethernet = <&fec>;
180180 phy-mode = "rgmii-id";
181+ rx-internal-delay-ps = <2000>;
182+ tx-internal-delay-ps = <2000>;
181183
182184 fixed-link {
183185 speed = <100>;
arch/arm/boot/dts/imx6ull-pinfunc.h+1−1
@@ -82,6 +82,6 @@ · 81 unmodified lines
8282 #define MX6ULL_PAD_CSI_DATA04__ESAI_TX_FS 0x01F4 0x0480 0x0000 0x9 0x0
8383 #define MX6ULL_PAD_CSI_DATA05__ESAI_TX_CLK 0x01F8 0x0484 0x0000 0x9 0x0
8484 #define MX6ULL_PAD_CSI_DATA06__ESAI_TX5_RX0 0x01FC 0x0488 0x0000 0x9 0x0
85−#define MX6ULL_PAD_CSI_DATA07__ESAI_T0 0x0200 0x048C 0x0000 0x9 0x0
85+#define MX6ULL_PAD_CSI_DATA07__ESAI_TX0 0x0200 0x048C 0x0000 0x9 0x0
8686
8787 #endif /* __DTS_IMX6ULL_PINFUNC_H */
arch/arm/boot/dts/ls1021a-tsn.dts+2−0
@@ -91,6 +91,8 @@ · 90 unmodified lines
9191 /* Internal port connected to eth2 */
9292 ethernet = <&enet2>;
9393 phy-mode = "rgmii";
94+ rx-internal-delay-ps = <0>;
95+ tx-internal-delay-ps = <0>;
9496 reg = <4>;
9597
9698 fixed-link {
arch/arm/boot/dts/socfpga_arria10_socdk_qspi.dts+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212 flash0: n25q00@0 {
1313 #address-cells = <1>;
1414 #size-cells = <1>;
15− compatible = "n25q00aa";
15+ compatible = "micron,mt25qu02g", "jedec,spi-nor";
1616 reg = <0>;
1717 spi-max-frequency = <100000000>;
1818
arch/arm/boot/dts/socfpga_arria5_socdk.dts+1−1
@@ -119,7 +119,7 @@ · 118 unmodified lines
119119 flash: flash@0 {
120120 #address-cells = <1>;
121121 #size-cells = <1>;
122− compatible = "n25q256a";
122+ compatible = "micron,n25q256a", "jedec,spi-nor";
123123 reg = <0>;
124124 spi-max-frequency = <100000000>;
125125
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts+1−1
@@ -124,7 +124,7 @@ · 123 unmodified lines
124124 flash0: n25q00@0 {
125125 #address-cells = <1>;
126126 #size-cells = <1>;
127− compatible = "n25q00";
127+ compatible = "micron,mt25qu02g", "jedec,spi-nor";
128128 reg = <0>; /* chip select */
129129 spi-max-frequency = <100000000>;
130130
arch/arm/boot/dts/socfpga_cyclone5_sockit.dts+1−1
@@ -169,7 +169,7 @@ · 168 unmodified lines
169169 flash: flash@0 {
170170 #address-cells = <1>;
171171 #size-cells = <1>;
172− compatible = "n25q00";
172+ compatible = "micron,mt25qu02g", "jedec,spi-nor";
173173 reg = <0>;
174174 spi-max-frequency = <100000000>;
175175
arch/arm/boot/dts/socfpga_cyclone5_socrates.dts+1−1
@@ -80,7 +80,7 @@ · 79 unmodified lines
8080 flash: flash@0 {
8181 #address-cells = <1>;
8282 #size-cells = <1>;
83− compatible = "n25q256a";
83+ compatible = "micron,n25q256a", "jedec,spi-nor";
8484 reg = <0>;
8585 spi-max-frequency = <100000000>;
8686 m25p,fast-read;
arch/arm/boot/dts/socfpga_cyclone5_sodia.dts+1−1
@@ -116,7 +116,7 @@ · 115 unmodified lines
116116 flash0: n25q512a@0 {
117117 #address-cells = <1>;
118118 #size-cells = <1>;
119− compatible = "n25q512a";
119+ compatible = "micron,n25q512a", "jedec,spi-nor";
120120 reg = <0>;
121121 spi-max-frequency = <100000000>;
122122
arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dts+2−2
@@ -224,7 +224,7 @@ · 223 unmodified lines
224224 n25q128@0 {
225225 #address-cells = <1>;
226226 #size-cells = <1>;
227− compatible = "n25q128";
227+ compatible = "micron,n25q128", "jedec,spi-nor";
228228 reg = <0>; /* chip select */
229229 spi-max-frequency = <100000000>;
230230 m25p,fast-read;
@@ -241,7 +241,7 @@ · 10 unmodified lines
241241 n25q00@1 {
242242 #address-cells = <1>;
243243 #size-cells = <1>;
244− compatible = "n25q00";
244+ compatible = "micron,mt25qu02g", "jedec,spi-nor";
245245 reg = <1>; /* chip select */
246246 spi-max-frequency = <100000000>;
247247 m25p,fast-read;
arch/arm/mach-rockchip/platsmp.c+1−1
@@ -189,7 +189,7 @@ static int __init rockchip_smp_prepare_sram(struct device_node *node) · 188 unmodified lines
189189 rockchip_boot_fn = __pa_symbol(secondary_startup);
190190
191191 /* copy the trampoline to sram, that runs during startup of the core */
192− memcpy(sram_base_addr, &rockchip_secondary_trampoline, trampoline_sz);
192+ memcpy_toio(sram_base_addr, &rockchip_secondary_trampoline, trampoline_sz);
193193 flush_cache_all();
194194 outer_clean_range(0, trampoline_sz);
195195
arch/arm64/Kconfig.platforms+0−1
@@ -161,7 +161,6 @@ config ARCH_MEDIATEK · 160 unmodified lines
161161
162162 config ARCH_MESON
163163 bool "Amlogic Platforms"
164− select COMMON_CLK
165164 help
166165 This enables support for the arm64 based Amlogic SoCs
167166 such as the s905, S905X/D, S912, A113X/D or S905X/D2
arch/arm64/boot/dts/amlogic/meson-axg-jethome-jethub-j100.dts+15−15
@@ -134,23 +134,23 @@ · 133 unmodified lines
134134 type = "critical";
135135 };
136136 };
137− };
138137
139− cpu_cooling_maps: cooling-maps {
140− map0 {
141− trip = <&cpu_passive>;
142− cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
143− <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
144− <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
145− <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
146− };
138+ cpu_cooling_maps: cooling-maps {
139+ map0 {
140+ trip = <&cpu_passive>;
141+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
142+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
143+ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
144+ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
145+ };
147146
148− map1 {
149− trip = <&cpu_hot>;
150− cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
151− <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
152− <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
153− <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
147+ map1 {
148+ trip = <&cpu_hot>;
149+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
150+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
151+ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
152+ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
153+ };
154154 };
155155 };
156156 };
arch/arm64/boot/dts/apple/t8103-j274.dts+1−1
@@ -60,7 +60,7 @@ · 59 unmodified lines
6060
6161 &port02 {
6262 bus-range = <3 3>;
63− ethernet0: pci@0,0 {
63+ ethernet0: ethernet@0,0 {
6464 reg = <0x30000 0x0 0x0 0x0 0x0>;
6565 /* To be filled by the loader */
6666 local-mac-address = [00 10 18 00 00 00];
arch/arm64/boot/dts/apple/t8103.dtsi+8−3
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 * Copyright The Asahi Linux Contributors
88 */
99
10+#include <dt-bindings/gpio/gpio.h>
1011 #include <dt-bindings/interrupt-controller/apple-aic.h>
1112 #include <dt-bindings/interrupt-controller/irq.h>
1213 #include <dt-bindings/pinctrl/apple.h>
@@ -143,6 +144,7 @@ · 130 unmodified lines
143144 apple,npins = <212>;
144145
145146 interrupt-controller;
147+ #interrupt-cells = <2>;
146148 interrupt-parent = <&aic>;
147149 interrupts = <AIC_IRQ 190 IRQ_TYPE_LEVEL_HIGH>,
148150 <AIC_IRQ 191 IRQ_TYPE_LEVEL_HIGH>,
@@ -169,6 +171,7 @@ · 20 unmodified lines
169171 apple,npins = <42>;
170172
171173 interrupt-controller;
174+ #interrupt-cells = <2>;
172175 interrupt-parent = <&aic>;
173176 interrupts = <AIC_IRQ 268 IRQ_TYPE_LEVEL_HIGH>,
174177 <AIC_IRQ 269 IRQ_TYPE_LEVEL_HIGH>,
@@ -189,6 +192,7 @@ · 14 unmodified lines
189192 apple,npins = <23>;
190193
191194 interrupt-controller;
195+ #interrupt-cells = <2>;
192196 interrupt-parent = <&aic>;
193197 interrupts = <AIC_IRQ 330 IRQ_TYPE_LEVEL_HIGH>,
194198 <AIC_IRQ 331 IRQ_TYPE_LEVEL_HIGH>,
@@ -209,6 +213,7 @@ · 14 unmodified lines
209213 apple,npins = <16>;
210214
211215 interrupt-controller;
216+ #interrupt-cells = <2>;
212217 interrupt-parent = <&aic>;
213218 interrupts = <AIC_IRQ 391 IRQ_TYPE_LEVEL_HIGH>,
214219 <AIC_IRQ 392 IRQ_TYPE_LEVEL_HIGH>,
@@ -281,7 +286,7 @@ · 66 unmodified lines
281286 port00: pci@0,0 {
282287 device_type = "pci";
283288 reg = <0x0 0x0 0x0 0x0 0x0>;
284− reset-gpios = <&pinctrl_ap 152 0>;
289+ reset-gpios = <&pinctrl_ap 152 GPIO_ACTIVE_LOW>;
285290 max-link-speed = <2>;
286291
287292 #address-cells = <3>;
@@ -301,7 +306,7 @@ · 13 unmodified lines
301306 port01: pci@1,0 {
302307 device_type = "pci";
303308 reg = <0x800 0x0 0x0 0x0 0x0>;
304− reset-gpios = <&pinctrl_ap 153 0>;
309+ reset-gpios = <&pinctrl_ap 153 GPIO_ACTIVE_LOW>;
305310 max-link-speed = <2>;
306311
307312 #address-cells = <3>;
@@ -321,7 +326,7 @@ · 13 unmodified lines
321326 port02: pci@2,0 {
322327 device_type = "pci";
323328 reg = <0x1000 0x0 0x0 0x0 0x0>;
324− reset-gpios = <&pinctrl_ap 33 0>;
329+ reset-gpios = <&pinctrl_ap 33 GPIO_ACTIVE_LOW>;
325330 max-link-speed = <1>;
326331
327332 #address-cells = <3>;
arch/arm64/boot/dts/freescale/fsl-ls1088a-ten64.dts+0−2
@@ -38,7 +38,6 @@ · 37 unmodified lines
3838 powerdn {
3939 label = "External Power Down";
4040 gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
41− interrupts = <&gpio1 17 IRQ_TYPE_EDGE_FALLING>;
4241 linux,code = <KEY_POWER>;
4342 };
4443
@@ -46,7 +45,6 @@ · 1 unmodified line
4645 admin {
4746 label = "ADMIN button";
4847 gpios = <&gpio3 8 GPIO_ACTIVE_HIGH>;
49− interrupts = <&gpio3 8 IRQ_TYPE_EDGE_RISING>;
5048 linux,code = <KEY_WPS_BUTTON>;
5149 };
5250 };
arch/arm64/boot/dts/freescale/fsl-lx2160a-bluebox3.dts+4−0
@@ -386,6 +386,8 @@ · 385 unmodified lines
386386 reg = <2>;
387387 ethernet = <&dpmac17>;
388388 phy-mode = "rgmii-id";
389+ rx-internal-delay-ps = <2000>;
390+ tx-internal-delay-ps = <2000>;
389391
390392 fixed-link {
391393 speed = <1000>;
@@ -529,6 +531,8 @@ · 137 unmodified lines
529531 reg = <2>;
530532 ethernet = <&dpmac18>;
531533 phy-mode = "rgmii-id";
534+ rx-internal-delay-ps = <2000>;
535+ tx-internal-delay-ps = <2000>;
532536
533537 fixed-link {
534538 speed = <1000>;
arch/arm64/boot/dts/freescale/imx8mq.dtsi+0−2
@@ -524,8 +524,6 @@ · 523 unmodified lines
524524 <&clk IMX8MQ_VIDEO_PLL1>,
525525 <&clk IMX8MQ_VIDEO_PLL1_OUT>;
526526 assigned-clock-rates = <0>, <0>, <0>, <594000000>;
527− interconnects = <&noc IMX8MQ_ICM_LCDIF &noc IMX8MQ_ICS_DRAM>;
528− interconnect-names = "dram";
529527 status = "disabled";
530528
531529 port@0 {
arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts+1−1
@@ -97,7 +97,7 @@ · 96 unmodified lines
9797 regulator-max-microvolt = <3300000>;
9898 regulator-always-on;
9999 regulator-boot-on;
100− vim-supply = <&vcc_io>;
100+ vin-supply = <&vcc_io>;
101101 };
102102
103103 vdd_core: vdd-core {
arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi+0−1
@@ -705,7 +705,6 @@ · 704 unmodified lines
705705 &sdhci {
706706 bus-width = <8>;
707707 mmc-hs400-1_8v;
708− mmc-hs400-enhanced-strobe;
709708 non-removable;
710709 status = "okay";
711710 };
arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts+1−0
@@ -276,6 +276,7 @@ · 275 unmodified lines
276276 clock-output-names = "xin32k", "rk808-clkout2";
277277 pinctrl-names = "default";
278278 pinctrl-0 = <&pmic_int_l>;
279+ rockchip,system-power-controller;
279280 vcc1-supply = <&vcc5v0_sys>;
280281 vcc2-supply = <&vcc5v0_sys>;
281282 vcc3-supply = <&vcc5v0_sys>;
arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts+1−1
@@ -55,7 +55,7 @@ · 54 unmodified lines
5555 regulator-boot-on;
5656 regulator-min-microvolt = <3300000>;
5757 regulator-max-microvolt = <3300000>;
58− vim-supply = <&vcc3v3_sys>;
58+ vin-supply = <&vcc3v3_sys>;
5959 };
6060
6161 vcc3v3_sys: vcc3v3-sys {
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi+1−1
@@ -502,7 +502,7 @@ · 501 unmodified lines
502502 status = "okay";
503503
504504 bt656-supply = <&vcc_3v0>;
505− audio-supply = <&vcc_3v0>;
505+ audio-supply = <&vcc1v8_codec>;
506506 sdmmc-supply = <&vcc_sdio>;
507507 gpio1830-supply = <&vcc_3v0>;
508508 };
arch/arm64/kernel/machine_kexec_file.c+1−0
@@ -149,6 +149,7 @@ int load_other_segments(struct kimage *image, · 148 unmodified lines
149149 initrd_len, cmdline, 0);
150150 if (!dtb) {
151151 pr_err("Preparing for new dtb failed\n");
152+ ret = -EINVAL;
152153 goto out_err;
153154 }
154155
arch/csky/kernel/traps.c+2−2
@@ -209,7 +209,7 @@ asmlinkage void do_trap_illinsn(struct pt_regs *regs) · 208 unmodified lines
209209
210210 asmlinkage void do_trap_fpe(struct pt_regs *regs)
211211 {
212−#ifdef CONFIG_CPU_HAS_FP
212+#ifdef CONFIG_CPU_HAS_FPU
213213 return fpu_fpe(regs);
214214 #else
215215 do_trap_error(regs, SIGILL, ILL_ILLOPC, regs->pc,
@@ -219,7 +219,7 @@ asmlinkage void do_trap_fpe(struct pt_regs *regs) · 3 unmodified lines
219219
220220 asmlinkage void do_trap_priv(struct pt_regs *regs)
221221 {
222−#ifdef CONFIG_CPU_HAS_FP
222+#ifdef CONFIG_CPU_HAS_FPU
223223 if (user_mode(regs) && fpu_libc_helper(regs))
224224 return;
225225 #endif
arch/s390/configs/debug_defconfig+2−0
@@ -117,6 +117,7 @@ CONFIG_UNIX=y · 116 unmodified lines
117117 CONFIG_UNIX_DIAG=m
118118 CONFIG_XFRM_USER=m
119119 CONFIG_NET_KEY=m
120+CONFIG_NET_SWITCHDEV=y
120121 CONFIG_SMC=m
121122 CONFIG_SMC_DIAG=m
122123 CONFIG_INET=y
@@ -511,6 +512,7 @@ CONFIG_NLMON=m · 388 unmodified lines
511512 CONFIG_MLX4_EN=m
512513 CONFIG_MLX5_CORE=m
513514 CONFIG_MLX5_CORE_EN=y
515+CONFIG_MLX5_ESWITCH=y
514516 # CONFIG_NET_VENDOR_MICREL is not set
515517 # CONFIG_NET_VENDOR_MICROCHIP is not set
516518 # CONFIG_NET_VENDOR_MICROSEMI is not set
arch/s390/configs/defconfig+2−0
@@ -109,6 +109,7 @@ CONFIG_UNIX=y · 108 unmodified lines
109109 CONFIG_UNIX_DIAG=m
110110 CONFIG_XFRM_USER=m
111111 CONFIG_NET_KEY=m
112+CONFIG_NET_SWITCHDEV=y
112113 CONFIG_SMC=m
113114 CONFIG_SMC_DIAG=m
114115 CONFIG_INET=y
@@ -502,6 +503,7 @@ CONFIG_NLMON=m · 387 unmodified lines
502503 CONFIG_MLX4_EN=m
503504 CONFIG_MLX5_CORE=m
504505 CONFIG_MLX5_CORE_EN=y
506+CONFIG_MLX5_ESWITCH=y
505507 # CONFIG_NET_VENDOR_MICREL is not set
506508 # CONFIG_NET_VENDOR_MICROCHIP is not set
507509 # CONFIG_NET_VENDOR_MICROSEMI is not set
arch/s390/kernel/ftrace.c+0−2
@@ -290,7 +290,6 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, · 289 unmodified lines
290290 return;
291291
292292 regs = ftrace_get_regs(fregs);
293− preempt_disable_notrace();
294293 p = get_kprobe((kprobe_opcode_t *)ip);
295294 if (unlikely(!p) || kprobe_disabled(p))
296295 goto out;
@@ -318,7 +317,6 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, · 21 unmodified lines
318317 }
319318 __this_cpu_write(current_kprobe, NULL);
320319 out:
321− preempt_enable_notrace();
322320 ftrace_test_recursion_unlock(bit);
323321 }
324322 NOKPROBE_SYMBOL(kprobe_ftrace_handler);
arch/s390/kernel/irq.c+5−4
@@ -138,7 +138,7 @@ void noinstr do_io_irq(struct pt_regs *regs) · 137 unmodified lines
138138 struct pt_regs *old_regs = set_irq_regs(regs);
139139 int from_idle;
140140
141− irq_enter();
141+ irq_enter_rcu();
142142
143143 if (user_mode(regs)) {
144144 update_timer_sys();
@@ -158,7 +158,8 @@ void noinstr do_io_irq(struct pt_regs *regs) · 13 unmodified lines
158158 do_irq_async(regs, IO_INTERRUPT);
159159 } while (MACHINE_IS_LPAR && irq_pending(regs));
160160
161− irq_exit();
161+ irq_exit_rcu();
162+
162163 set_irq_regs(old_regs);
163164 irqentry_exit(regs, state);
164165
@@ -172,7 +173,7 @@ void noinstr do_ext_irq(struct pt_regs *regs) · 7 unmodified lines
172173 struct pt_regs *old_regs = set_irq_regs(regs);
173174 int from_idle;
174175
175− irq_enter();
176+ irq_enter_rcu();
176177
177178 if (user_mode(regs)) {
178179 update_timer_sys();
@@ -190,7 +191,7 @@ void noinstr do_ext_irq(struct pt_regs *regs) · 11 unmodified lines
190191
191192 do_irq_async(regs, EXT_INTERRUPT);
192193
193− irq_exit();
194+ irq_exit_rcu();
194195 set_irq_regs(old_regs);
195196 irqentry_exit(regs, state);
196197
arch/s390/kernel/machine_kexec_file.c+34−4
@@ -7,6 +7,8 @@ · 6 unmodified lines
77 * Author(s): Philipp Rudo <prudo@linux.vnet.ibm.com>
88 */
99
10+#define pr_fmt(fmt) "kexec: " fmt
11+
1012 #include <linux/elf.h>
1113 #include <linux/errno.h>
1214 #include <linux/kexec.h>
@@ -290,8 +292,16 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, · 277 unmodified lines
290292 const Elf_Shdr *relsec,
291293 const Elf_Shdr *symtab)
292294 {
295+ const char *strtab, *name, *shstrtab;
296+ const Elf_Shdr *sechdrs;
293297 Elf_Rela *relas;
294298 int i, r_type;
299+ int ret;
300+
301+ /* String & section header string table */
302+ sechdrs = (void *)pi->ehdr + pi->ehdr->e_shoff;
303+ strtab = (char *)pi->ehdr + sechdrs[symtab->sh_link].sh_offset;
304+ shstrtab = (char *)pi->ehdr + sechdrs[pi->ehdr->e_shstrndx].sh_offset;
295305
296306 relas = (void *)pi->ehdr + relsec->sh_offset;
297307
@@ -304,15 +314,27 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, · 6 unmodified lines
304314 sym = (void *)pi->ehdr + symtab->sh_offset;
305315 sym += ELF64_R_SYM(relas[i].r_info);
306316
307− if (sym->st_shndx == SHN_UNDEF)
317+ if (sym->st_name)
318+ name = strtab + sym->st_name;
319+ else
320+ name = shstrtab + sechdrs[sym->st_shndx].sh_name;
321+
322+ if (sym->st_shndx == SHN_UNDEF) {
323+ pr_err("Undefined symbol: %s\n", name);
308324 return -ENOEXEC;
325+ }
309326
310− if (sym->st_shndx == SHN_COMMON)
327+ if (sym->st_shndx == SHN_COMMON) {
328+ pr_err("symbol '%s' in common section\n", name);
311329 return -ENOEXEC;
330+ }
312331
313332 if (sym->st_shndx >= pi->ehdr->e_shnum &&
314− sym->st_shndx != SHN_ABS)
333+ sym->st_shndx != SHN_ABS) {
334+ pr_err("Invalid section %d for symbol %s\n",
335+ sym->st_shndx, name);
315336 return -ENOEXEC;
337+ }
316338
317339 loc = pi->purgatory_buf;
318340 loc += section->sh_offset;
@@ -326,7 +348,15 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, · 7 unmodified lines
326348 addr = section->sh_addr + relas[i].r_offset;
327349
328350 r_type = ELF64_R_TYPE(relas[i].r_info);
329− arch_kexec_do_relocs(r_type, loc, val, addr);
351+
352+ if (r_type == R_390_PLT32DBL)
353+ r_type = R_390_PC32DBL;
354+
355+ ret = arch_kexec_do_relocs(r_type, loc, val, addr);
356+ if (ret) {
357+ pr_err("Unknown rela relocation: %d\n", r_type);
358+ return -ENOEXEC;
359+ }
330360 }
331361 return 0;
332362 }
arch/x86/include/asm/kvm_host.h+1−1
@@ -97,7 +97,7 @@ · 96 unmodified lines
9797 KVM_ARCH_REQ_FLAGS(25, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP)
9898 #define KVM_REQ_TLB_FLUSH_CURRENT KVM_ARCH_REQ(26)
9999 #define KVM_REQ_TLB_FLUSH_GUEST \
100− KVM_ARCH_REQ_FLAGS(27, KVM_REQUEST_NO_WAKEUP)
100+ KVM_ARCH_REQ_FLAGS(27, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP)
101101 #define KVM_REQ_APF_READY KVM_ARCH_REQ(28)
102102 #define KVM_REQ_MSR_FILTER_CHANGED KVM_ARCH_REQ(29)
103103 #define KVM_REQ_UPDATE_CPU_DIRTY_LOGGING \
arch/x86/kernel/smpboot.c+14−0
@@ -579,6 +579,17 @@ static struct sched_domain_topology_level x86_numa_in_package_topology[] = { · 578 unmodified lines
579579 { NULL, },
580580 };
581581
582+static struct sched_domain_topology_level x86_hybrid_topology[] = {
583+#ifdef CONFIG_SCHED_SMT
584+ { cpu_smt_mask, x86_smt_flags, SD_INIT_NAME(SMT) },
585+#endif
586+#ifdef CONFIG_SCHED_MC
587+ { cpu_coregroup_mask, x86_core_flags, SD_INIT_NAME(MC) },
588+#endif
589+ { cpu_cpu_mask, SD_INIT_NAME(DIE) },
590+ { NULL, },
591+};
592+
582593 static struct sched_domain_topology_level x86_topology[] = {
583594 #ifdef CONFIG_SCHED_SMT
584595 { cpu_smt_mask, x86_smt_flags, SD_INIT_NAME(SMT) },
@@ -1469,8 +1480,11 @@ void __init native_smp_cpus_done(unsigned int max_cpus) · 884 unmodified lines
14691480
14701481 calculate_max_logical_packages();
14711482
1483+ /* XXX for now assume numa-in-package and hybrid don't overlap */
14721484 if (x86_has_numa_in_package)
14731485 set_sched_topology(x86_numa_in_package_topology);
1486+ if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU))
1487+ set_sched_topology(x86_hybrid_topology);
14741488
14751489 nmi_selftest();
14761490 impress_friends();
arch/x86/kvm/hyperv.c+5−2
@@ -1922,11 +1922,13 @@ static u64 kvm_hv_send_ipi(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc, bool · 1921 unmodified lines
19221922
19231923 all_cpus = send_ipi_ex.vp_set.format == HV_GENERIC_SET_ALL;
19241924
1925+ if (all_cpus)
1926+ goto check_and_send_ipi;
1927+
19251928 if (!sparse_banks_len)
19261929 goto ret_success;
19271930
1928− if (!all_cpus &&
1929− kvm_read_guest(kvm,
1931+ if (kvm_read_guest(kvm,
19301932 hc->ingpa + offsetof(struct hv_send_ipi_ex,
19311933 vp_set.bank_contents),
19321934 sparse_banks,
@@ -1934,6 +1936,7 @@ static u64 kvm_hv_send_ipi(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc, bool · 1 unmodified line
19341936 return HV_STATUS_INVALID_HYPERCALL_INPUT;
19351937 }
19361938
1939+check_and_send_ipi:
19371940 if ((vector < HV_IPI_LOW_VECTOR) || (vector > HV_IPI_HIGH_VECTOR))
19381941 return HV_STATUS_INVALID_HYPERCALL_INPUT;
19391942
arch/x86/kvm/vmx/vmx.c+13−9
@@ -2646,15 +2646,6 @@ int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs) · 2645 unmodified lines
26462646 if (!loaded_vmcs->msr_bitmap)
26472647 goto out_vmcs;
26482648 memset(loaded_vmcs->msr_bitmap, 0xff, PAGE_SIZE);
2649−
2650− if (IS_ENABLED(CONFIG_HYPERV) &&
2651− static_branch_unlikely(&enable_evmcs) &&
2652− (ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) {
2653− struct hv_enlightened_vmcs *evmcs =
2654− (struct hv_enlightened_vmcs *)loaded_vmcs->vmcs;
2655−
2656− evmcs->hv_enlightenments_control.msr_bitmap = 1;
2657− }
26582649 }
26592650
26602651 memset(&loaded_vmcs->host_state, 0, sizeof(struct vmcs_host_state));
@@ -6842,6 +6833,19 @@ static int vmx_create_vcpu(struct kvm_vcpu *vcpu) · 4181 unmodified lines
68426833 if (err < 0)
68436834 goto free_pml;
68446835
6836+ /*
6837+ * Use Hyper-V 'Enlightened MSR Bitmap' feature when KVM runs as a
6838+ * nested (L1) hypervisor and Hyper-V in L0 supports it. Enable the
6839+ * feature only for vmcs01, KVM currently isn't equipped to realize any
6840+ * performance benefits from enabling it for vmcs02.
6841+ */
6842+ if (IS_ENABLED(CONFIG_HYPERV) && static_branch_unlikely(&enable_evmcs) &&
6843+ (ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) {
6844+ struct hv_enlightened_vmcs *evmcs = (void *)vmx->vmcs01.vmcs;
6845+
6846+ evmcs->hv_enlightenments_control.msr_bitmap = 1;
6847+ }
6848+
68456849 /* The MSR bitmap starts with all ones */
68466850 bitmap_fill(vmx->shadow_msr_intercept.read, MAX_POSSIBLE_PASSTHROUGH_MSRS);
68476851 bitmap_fill(vmx->shadow_msr_intercept.write, MAX_POSSIBLE_PASSTHROUGH_MSRS);
arch/x86/kvm/x86.c+9−3
@@ -890,7 +890,8 @@ int kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) · 889 unmodified lines
890890 !load_pdptrs(vcpu, vcpu->arch.walk_mmu, kvm_read_cr3(vcpu)))
891891 return 1;
892892
893− if (!(cr0 & X86_CR0_PG) && kvm_read_cr4_bits(vcpu, X86_CR4_PCIDE))
893+ if (!(cr0 & X86_CR0_PG) &&
894+ (is_64_bit_mode(vcpu) || kvm_read_cr4_bits(vcpu, X86_CR4_PCIDE)))
894895 return 1;
895896
896897 static_call(kvm_x86_set_cr0)(vcpu, cr0);
@@ -7121,7 +7122,13 @@ static int emulator_pio_in(struct kvm_vcpu *vcpu, int size, · 6224 unmodified lines
71217122 unsigned short port, void *val, unsigned int count)
71227123 {
71237124 if (vcpu->arch.pio.count) {
7124− /* Complete previous iteration. */
7125+ /*
7126+ * Complete a previous iteration that required userspace I/O.
7127+ * Note, @count isn't guaranteed to match pio.count as userspace
7128+ * can modify ECX before rerunning the vCPU. Ignore any such
7129+ * shenanigans as KVM doesn't support modifying the rep count,
7130+ * and the emulator ensures @count doesn't overflow the buffer.
7131+ */
71257132 } else {
71267133 int r = __emulator_pio_in(vcpu, size, port, count);
71277134 if (!r)
@@ -7130,7 +7137,6 @@ static int emulator_pio_in(struct kvm_vcpu *vcpu, int size, · 2 unmodified lines
71307137 /* Results already available, fall through. */
71317138 }
71327139
7133− WARN_ON(count != vcpu->arch.pio.count);
71347140 complete_emulator_pio_in(vcpu, val);
71357141 return 1;
71367142 }
arch/x86/net/bpf_jit_comp.c+43−8
@@ -1252,19 +1252,54 @@ st: if (is_imm8(insn->off)) · 1251 unmodified lines
12521252 case BPF_LDX | BPF_MEM | BPF_DW:
12531253 case BPF_LDX | BPF_PROBE_MEM | BPF_DW:
12541254 if (BPF_MODE(insn->code) == BPF_PROBE_MEM) {
1255− /* test src_reg, src_reg */
1256− maybe_emit_mod(&prog, src_reg, src_reg, true); /* always 1 byte */
1257− EMIT2(0x85, add_2reg(0xC0, src_reg, src_reg));
1258− /* jne start_of_ldx */
1259− EMIT2(X86_JNE, 0);
1255+ /* Though the verifier prevents negative insn->off in BPF_PROBE_MEM
1256+ * add abs(insn->off) to the limit to make sure that negative
1257+ * offset won't be an issue.
1258+ * insn->off is s16, so it won't affect valid pointers.
1259+ */
1260+ u64 limit = TASK_SIZE_MAX + PAGE_SIZE + abs(insn->off);
1261+ u8 *end_of_jmp1, *end_of_jmp2;
1262+
1263+ /* Conservatively check that src_reg + insn->off is a kernel address:
1264+ * 1. src_reg + insn->off >= limit
1265+ * 2. src_reg + insn->off doesn't become small positive.
1266+ * Cannot do src_reg + insn->off >= limit in one branch,
1267+ * since it needs two spare registers, but JIT has only one.
1268+ */
1269+
1270+ /* movabsq r11, limit */
1271+ EMIT2(add_1mod(0x48, AUX_REG), add_1reg(0xB8, AUX_REG));
1272+ EMIT((u32)limit, 4);
1273+ EMIT(limit >> 32, 4);
1274+ /* cmp src_reg, r11 */
1275+ maybe_emit_mod(&prog, src_reg, AUX_REG, true);
1276+ EMIT2(0x39, add_2reg(0xC0, src_reg, AUX_REG));
1277+ /* if unsigned '<' goto end_of_jmp2 */
1278+ EMIT2(X86_JB, 0);
1279+ end_of_jmp1 = prog;
1280+
1281+ /* mov r11, src_reg */
1282+ emit_mov_reg(&prog, true, AUX_REG, src_reg);
1283+ /* add r11, insn->off */
1284+ maybe_emit_1mod(&prog, AUX_REG, true);
1285+ EMIT2_off32(0x81, add_1reg(0xC0, AUX_REG), insn->off);
1286+ /* jmp if not carry to start_of_ldx
1287+ * Otherwise ERR_PTR(-EINVAL) + 128 will be the user addr
1288+ * that has to be rejected.
1289+ */
1290+ EMIT2(0x73 /* JNC */, 0);
1291+ end_of_jmp2 = prog;
1292+
12601293 /* xor dst_reg, dst_reg */
12611294 emit_mov_imm32(&prog, false, dst_reg, 0);
12621295 /* jmp byte_after_ldx */
12631296 EMIT2(0xEB, 0);
12641297
1265− /* populate jmp_offset for JNE above */
1266− temp[4] = prog - temp - 5 /* sizeof(test + jne) */;
1298+ /* populate jmp_offset for JB above to jump to xor dst_reg */
1299+ end_of_jmp1[-1] = end_of_jmp2 - end_of_jmp1;
1300+ /* populate jmp_offset for JNC above to jump to start_of_ldx */
12671301 start_of_ldx = prog;
1302+ end_of_jmp2[-1] = start_of_ldx - end_of_jmp2;
12681303 }
12691304 emit_ldx(&prog, BPF_SIZE(insn->code), dst_reg, src_reg, insn->off);
12701305 if (BPF_MODE(insn->code) == BPF_PROBE_MEM) {
@@ -1305,7 +1340,7 @@ st: if (is_imm8(insn->off)) · 34 unmodified lines
13051340 * End result: x86 insn "mov rbx, qword ptr [rax+0x14]"
13061341 * of 4 bytes will be ignored and rbx will be zero inited.
13071342 */
1308− ex->fixup = (prog - temp) | (reg2pt_regs[dst_reg] << 8);
1343+ ex->fixup = (prog - start_of_ldx) | (reg2pt_regs[dst_reg] << 8);
13091344 }
13101345 break;
13111346
block/fops.c+1−2
@@ -341,8 +341,7 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb, · 340 unmodified lines
341341 } else {
342342 ret = bio_iov_iter_get_pages(bio, iter);
343343 if (unlikely(ret)) {
344− bio->bi_status = BLK_STS_IOERR;
345− bio_endio(bio);
344+ bio_put(bio);
346345 return ret;
347346 }
348347 }
block/ioprio.c+3−0
@@ -220,6 +220,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who) · 219 unmodified lines
220220 pgrp = task_pgrp(current);
221221 else
222222 pgrp = find_vpid(who);
223+ read_lock(&tasklist_lock);
223224 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
224225 tmpio = get_task_ioprio(p);
225226 if (tmpio < 0)
@@ -229,6 +230,8 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who) · 3 unmodified lines
229230 else
230231 ret = ioprio_best(ret, tmpio);
231232 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
233+ read_unlock(&tasklist_lock);
234+
232235 break;
233236 case IOPRIO_WHO_USER:
234237 uid = make_kuid(current_user_ns(), who);
drivers/Makefile+1−2
@@ -41,8 +41,7 @@ obj-$(CONFIG_DMADEVICES) += dma/ · 40 unmodified lines
4141 # SOC specific infrastructure drivers.
4242 obj-y += soc/
4343
44−obj-$(CONFIG_VIRTIO) += virtio/
45−obj-$(CONFIG_VIRTIO_PCI_LIB) += virtio/
44+obj-y += virtio/
4645 obj-$(CONFIG_VDPA) += vdpa/
4746 obj-$(CONFIG_XEN) += xen/
4847
drivers/android/binder.c+9−12
@@ -4422,23 +4422,20 @@ static int binder_thread_release(struct binder_proc *proc, · 4421 unmodified lines
44224422 __release(&t->lock);
44234423
44244424 /*
4425− * If this thread used poll, make sure we remove the waitqueue
4426− * from any epoll data structures holding it with POLLFREE.
4427− * waitqueue_active() is safe to use here because we're holding
4428− * the inner lock.
4425+ * If this thread used poll, make sure we remove the waitqueue from any
4426+ * poll data structures holding it.
44294427 */
4430− if ((thread->looper & BINDER_LOOPER_STATE_POLL) &&
4431− waitqueue_active(&thread->wait)) {
4432− wake_up_poll(&thread->wait, EPOLLHUP | POLLFREE);
4433− }
4428+ if (thread->looper & BINDER_LOOPER_STATE_POLL)
4429+ wake_up_pollfree(&thread->wait);
44344430
44354431 binder_inner_proc_unlock(thread->proc);
44364432
44374433 /*
4438− * This is needed to avoid races between wake_up_poll() above and
4439− * and ep_remove_waitqueue() called for other reasons (eg the epoll file
4440− * descriptor being closed); ep_remove_waitqueue() holds an RCU read
4441− * lock, so we can be sure it's done after calling synchronize_rcu().
4434+ * This is needed to avoid races between wake_up_pollfree() above and
4435+ * someone else removing the last entry from the queue for other reasons
4436+ * (e.g. ep_remove_wait_queue() being called due to an epoll file
4437+ * descriptor being closed). Such other users hold an RCU read lock, so
4438+ * we can be sure they're done after we call synchronize_rcu().
44424439 */
44434440 if (thread->looper & BINDER_LOOPER_STATE_POLL)
44444441 synchronize_rcu();
drivers/ata/ahci_ceva.c+2−1
@@ -94,6 +94,7 @@ struct ceva_ahci_priv { · 93 unmodified lines
9494 static unsigned int ceva_ahci_read_id(struct ata_device *dev,
9595 struct ata_taskfile *tf, u16 *id)
9696 {
97+ __le16 *__id = (__le16 *)id;
9798 u32 err_mask;
9899
99100 err_mask = ata_do_dev_read_id(dev, tf, id);
@@ -103,7 +104,7 @@ static unsigned int ceva_ahci_read_id(struct ata_device *dev, · 3 unmodified lines
103104 * Since CEVA controller does not support device sleep feature, we
104105 * need to clear DEVSLP (bit 8) in word78 of the IDENTIFY DEVICE data.
105106 */
106− id[ATA_ID_FEATURE_SUPP] &= cpu_to_le16(~(1 << 8));
107+ __id[ATA_ID_FEATURE_SUPP] &= cpu_to_le16(~(1 << 8));
107108
108109 return 0;
109110 }
drivers/ata/libata-core.c+2−0
@@ -3920,6 +3920,8 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 3919 unmodified lines
39203920 { "VRFDFC22048UCHC-TE*", NULL, ATA_HORKAGE_NODMA },
39213921 /* Odd clown on sil3726/4726 PMPs */
39223922 { "Config Disk", NULL, ATA_HORKAGE_DISABLE },
3923+ /* Similar story with ASMedia 1092 */
3924+ { "ASMT109x- Config", NULL, ATA_HORKAGE_DISABLE },
39233925
39243926 /* Weird ATAPI devices */
39253927 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 },
drivers/bus/mhi/core/pm.c+18−3
@@ -881,7 +881,7 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl) · 880 unmodified lines
881881 }
882882 EXPORT_SYMBOL_GPL(mhi_pm_suspend);
883883
884−int mhi_pm_resume(struct mhi_controller *mhi_cntrl)
884+static int __mhi_pm_resume(struct mhi_controller *mhi_cntrl, bool force)
885885 {
886886 struct mhi_chan *itr, *tmp;
887887 struct device *dev = &mhi_cntrl->mhi_dev->dev;
@@ -898,8 +898,12 @@ int mhi_pm_resume(struct mhi_controller *mhi_cntrl) · 10 unmodified lines
898898 if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state))
899899 return -EIO;
900900
901− if (mhi_get_mhi_state(mhi_cntrl) != MHI_STATE_M3)
902− return -EINVAL;
901+ if (mhi_get_mhi_state(mhi_cntrl) != MHI_STATE_M3) {
902+ dev_warn(dev, "Resuming from non M3 state (%s)\n",
903+ TO_MHI_STATE_STR(mhi_get_mhi_state(mhi_cntrl)));
904+ if (!force)
905+ return -EINVAL;
906+ }
903907
904908 /* Notify clients about exiting LPM */
905909 list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans, node) {
@@ -940,8 +944,19 @@ int mhi_pm_resume(struct mhi_controller *mhi_cntrl) · 34 unmodified lines
940944
941945 return 0;
942946 }
947+
948+int mhi_pm_resume(struct mhi_controller *mhi_cntrl)
949+{
950+ return __mhi_pm_resume(mhi_cntrl, false);
951+}
943952 EXPORT_SYMBOL_GPL(mhi_pm_resume);
944953
954+int mhi_pm_resume_force(struct mhi_controller *mhi_cntrl)
955+{
956+ return __mhi_pm_resume(mhi_cntrl, true);
957+}
958+EXPORT_SYMBOL_GPL(mhi_pm_resume_force);
959+
945960 int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl)
946961 {
947962 int ret;
drivers/bus/mhi/pci_generic.c+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020
2121 #define MHI_PCI_DEFAULT_BAR_NUM 0
2222
23−#define MHI_POST_RESET_DELAY_MS 500
23+#define MHI_POST_RESET_DELAY_MS 2000
2424
2525 #define HEALTH_CHECK_PERIOD (HZ * 2)
2626
drivers/clk/clk.c+12−3
@@ -3418,6 +3418,14 @@ static int __clk_core_init(struct clk_core *core) · 3417 unmodified lines
34183418
34193419 clk_prepare_lock();
34203420
3421+ /*
3422+ * Set hw->core after grabbing the prepare_lock to synchronize with
3423+ * callers of clk_core_fill_parent_index() where we treat hw->core
3424+ * being NULL as the clk not being registered yet. This is crucial so
3425+ * that clks aren't parented until their parent is fully registered.
3426+ */
3427+ core->hw->core = core;
3428+
34213429 ret = clk_pm_runtime_get(core);
34223430 if (ret)
34233431 goto unlock;
@@ -3582,8 +3590,10 @@ static int __clk_core_init(struct clk_core *core) · 158 unmodified lines
35823590 out:
35833591 clk_pm_runtime_put(core);
35843592 unlock:
3585− if (ret)
3593+ if (ret) {
35863594 hlist_del_init(&core->child_node);
3595+ core->hw->core = NULL;
3596+ }
35873597
35883598 clk_prepare_unlock();
35893599
@@ -3847,7 +3857,6 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw) · 257 unmodified lines
38473857 core->num_parents = init->num_parents;
38483858 core->min_rate = 0;
38493859 core->max_rate = ULONG_MAX;
3850− hw->core = core;
38513860
38523861 ret = clk_core_populate_parent_map(core, init);
38533862 if (ret)
@@ -3865,7 +3874,7 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw) · 11 unmodified lines
38653874 goto fail_create_clk;
38663875 }
38673876
3868− clk_core_link_consumer(hw->core, hw->clk);
3877+ clk_core_link_consumer(core, hw->clk);
38693878
38703879 ret = __clk_core_init(core);
38713880 if (!ret)
drivers/clk/imx/clk-imx8qxp-lpcg.c+1−1
@@ -370,7 +370,7 @@ static struct platform_driver imx8qxp_lpcg_clk_driver = { · 369 unmodified lines
370370 .probe = imx8qxp_lpcg_clk_probe,
371371 };
372372
373−builtin_platform_driver(imx8qxp_lpcg_clk_driver);
373+module_platform_driver(imx8qxp_lpcg_clk_driver);
374374
375375 MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>");
376376 MODULE_DESCRIPTION("NXP i.MX8QXP LPCG clock driver");
drivers/clk/imx/clk-imx8qxp.c+1−1
@@ -308,7 +308,7 @@ static struct platform_driver imx8qxp_clk_driver = { · 307 unmodified lines
308308 },
309309 .probe = imx8qxp_clk_probe,
310310 };
311−builtin_platform_driver(imx8qxp_clk_driver);
311+module_platform_driver(imx8qxp_clk_driver);
312312
313313 MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>");
314314 MODULE_DESCRIPTION("NXP i.MX8QXP clock driver");
drivers/clk/qcom/clk-alpha-pll.c+9−0
@@ -1429,6 +1429,15 @@ EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_fabia_ops); · 1428 unmodified lines
14291429 void clk_trion_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
14301430 const struct alpha_pll_config *config)
14311431 {
1432+ /*
1433+ * If the bootloader left the PLL enabled it's likely that there are
1434+ * RCGs that will lock up if we disable the PLL below.
1435+ */
1436+ if (trion_pll_is_enabled(pll, regmap)) {
1437+ pr_debug("Trion PLL is already enabled, skipping configuration\n");
1438+ return;
1439+ }
1440+
14321441 clk_alpha_pll_write_config(regmap, PLL_L_VAL(pll), config->l);
14331442 regmap_write(regmap, PLL_CAL_L_VAL(pll), TRION_PLL_CAL_VAL);
14341443 clk_alpha_pll_write_config(regmap, PLL_ALPHA_VAL(pll), config->alpha);
drivers/clk/qcom/clk-regmap-mux.c+1−1
@@ -28,7 +28,7 @@ static u8 mux_get_parent(struct clk_hw *hw) · 27 unmodified lines
2828 val &= mask;
2929
3030 if (mux->parent_map)
31− return qcom_find_src_index(hw, mux->parent_map, val);
31+ return qcom_find_cfg_index(hw, mux->parent_map, val);
3232
3333 return val;
3434 }
drivers/clk/qcom/common.c+12−0
@@ -69,6 +69,18 @@ int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, u8 src) · 68 unmodified lines
6969 }
7070 EXPORT_SYMBOL_GPL(qcom_find_src_index);
7171
72+int qcom_find_cfg_index(struct clk_hw *hw, const struct parent_map *map, u8 cfg)
73+{
74+ int i, num_parents = clk_hw_get_num_parents(hw);
75+
76+ for (i = 0; i < num_parents; i++)
77+ if (cfg == map[i].cfg)
78+ return i;
79+
80+ return -ENOENT;
81+}
82+EXPORT_SYMBOL_GPL(qcom_find_cfg_index);
83+
7284 struct regmap *
7385 qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc)
7486 {
drivers/clk/qcom/common.h+2−0
@@ -49,6 +49,8 @@ extern void · 48 unmodified lines
4949 qcom_pll_set_fsm_mode(struct regmap *m, u32 reg, u8 bias_count, u8 lock_count);
5050 extern int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map,
5151 u8 src);
52+extern int qcom_find_cfg_index(struct clk_hw *hw, const struct parent_map *map,
53+ u8 cfg);
5254
5355 extern int qcom_cc_register_board_clk(struct device *dev, const char *path,
5456 const char *name, unsigned long rate);
drivers/clk/qcom/gcc-sm6125.c+2−2
@@ -1121,7 +1121,7 @@ static struct clk_rcg2 gcc_sdcc1_apps_clk_src = { · 1120 unmodified lines
11211121 .name = "gcc_sdcc1_apps_clk_src",
11221122 .parent_data = gcc_parent_data_1,
11231123 .num_parents = ARRAY_SIZE(gcc_parent_data_1),
1124− .ops = &clk_rcg2_ops,
1124+ .ops = &clk_rcg2_floor_ops,
11251125 },
11261126 };
11271127
@@ -1143,7 +1143,7 @@ static struct clk_rcg2 gcc_sdcc1_ice_core_clk_src = { · 15 unmodified lines
11431143 .name = "gcc_sdcc1_ice_core_clk_src",
11441144 .parent_data = gcc_parent_data_0,
11451145 .num_parents = ARRAY_SIZE(gcc_parent_data_0),
1146− .ops = &clk_rcg2_floor_ops,
1146+ .ops = &clk_rcg2_ops,
11471147 },
11481148 };
11491149
drivers/clk/versatile/clk-icst.c+1−1
@@ -543,8 +543,8 @@ static void __init of_syscon_icst_setup(struct device_node *np) · 542 unmodified lines
543543
544544 regclk = icst_clk_setup(NULL, &icst_desc, name, parent_name, map, ctype);
545545 if (IS_ERR(regclk)) {
546− kfree(name);
547546 pr_err("error setting up syscon ICST clock %s\n", name);
547+ kfree(name);
548548 return;
549549 }
550550 of_clk_add_provider(np, of_clk_src_simple_get, regclk);
drivers/clocksource/arm_arch_timer.c+7−2
@@ -394,8 +394,13 @@ EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround); · 393 unmodified lines
394394
395395 static atomic_t timer_unstable_counter_workaround_in_use = ATOMIC_INIT(0);
396396
397−static void erratum_set_next_event_generic(const int access, unsigned long evt,
398− struct clock_event_device *clk)
397+/*
398+ * Force the inlining of this function so that the register accesses
399+ * can be themselves correctly inlined.
400+ */
401+static __always_inline
402+void erratum_set_next_event_generic(const int access, unsigned long evt,
403+ struct clock_event_device *clk)
399404 {
400405 unsigned long ctrl;
401406 u64 cval;
drivers/clocksource/dw_apb_timer_of.c+1−1
@@ -47,7 +47,7 @@ static int __init timer_get_base_and_rate(struct device_node *np, · 46 unmodified lines
4747 pr_warn("pclk for %pOFn is present, but could not be activated\n",
4848 np);
4949
50− if (!of_property_read_u32(np, "clock-freq", rate) &&
50+ if (!of_property_read_u32(np, "clock-freq", rate) ||
5151 !of_property_read_u32(np, "clock-frequency", rate))
5252 return 0;
5353
drivers/firmware/scpi_pm_domain.c+7−3
@@ -16,7 +16,6 @@ struct scpi_pm_domain { · 15 unmodified lines
1616 struct generic_pm_domain genpd;
1717 struct scpi_ops *ops;
1818 u32 domain;
19− char name[30];
2019 };
2120
2221 /*
@@ -110,8 +109,13 @@ static int scpi_pm_domain_probe(struct platform_device *pdev) · 87 unmodified lines
110109
111110 scpi_pd->domain = i;
112111 scpi_pd->ops = scpi_ops;
113− sprintf(scpi_pd->name, "%pOFn.%d", np, i);
114− scpi_pd->genpd.name = scpi_pd->name;
112+ scpi_pd->genpd.name = devm_kasprintf(dev, GFP_KERNEL,
113+ "%pOFn.%d", np, i);
114+ if (!scpi_pd->genpd.name) {
115+ dev_err(dev, "Failed to allocate genpd name:%pOFn.%d\n",
116+ np, i);
117+ continue;
118+ }
115119 scpi_pd->genpd.power_off = scpi_pd_power_off;
116120 scpi_pd->genpd.power_on = scpi_pd_power_on;
117121
drivers/firmware/tegra/bpmp-debugfs.c+3−2
@@ -77,13 +77,14 @@ static const char *get_filename(struct tegra_bpmp *bpmp, · 76 unmodified lines
7777 const char *root_path, *filename = NULL;
7878 char *root_path_buf;
7979 size_t root_len;
80+ size_t root_path_buf_len = 512;
8081
81− root_path_buf = kzalloc(512, GFP_KERNEL);
82+ root_path_buf = kzalloc(root_path_buf_len, GFP_KERNEL);
8283 if (!root_path_buf)
8384 goto out;
8485
8586 root_path = dentry_path(bpmp->debugfs_mirror, root_path_buf,
86− sizeof(root_path_buf));
87+ root_path_buf_len);
8788 if (IS_ERR(root_path))
8889 goto out;
8990
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+6−1
@@ -2576,7 +2576,8 @@ static int dm_resume(void *handle) · 2575 unmodified lines
25762576 */
25772577 link_enc_cfg_init(dm->dc, dc_state);
25782578
2579− amdgpu_dm_outbox_init(adev);
2579+ if (dc_enable_dmub_notifications(adev->dm.dc))
2580+ amdgpu_dm_outbox_init(adev);
25802581
25812582 r = dm_dmub_hw_init(adev);
25822583 if (r)
@@ -2625,6 +2626,10 @@ static int dm_resume(void *handle) · 42 unmodified lines
26252626 /* TODO: Remove dc_state->dccg, use dc->dccg directly. */
26262627 dc_resource_state_construct(dm->dc, dm_state->context);
26272628
2629+ /* Re-enable outbox interrupts for DPIA. */
2630+ if (dc_enable_dmub_notifications(adev->dm.dc))
2631+ amdgpu_dm_outbox_init(adev);
2632+
26282633 /* Before powering on DC we need to re-initialize DMUB. */
26292634 r = dm_dmub_hw_init(adev);
26302635 if (r)
drivers/gpu/drm/amd/display/dc/dc_link.h+2−0
@@ -226,6 +226,8 @@ static inline void get_edp_links(const struct dc *dc, · 225 unmodified lines
226226 *edp_num = 0;
227227 for (i = 0; i < dc->link_count; i++) {
228228 // report any eDP links, even unconnected DDI's
229+ if (!dc->links[i])
230+ continue;
229231 if (dc->links[i]->connector_signal == SIGNAL_TYPE_EDP) {
230232 edp_links[*edp_num] = dc->links[i];
231233 if (++(*edp_num) == MAX_NUM_EDP)
drivers/gpu/drm/drm_syncobj.c+10−1
@@ -404,8 +404,17 @@ int drm_syncobj_find_fence(struct drm_file *file_private, · 403 unmodified lines
404404
405405 if (*fence) {
406406 ret = dma_fence_chain_find_seqno(fence, point);
407− if (!ret)
407+ if (!ret) {
408+ /* If the requested seqno is already signaled
409+ * drm_syncobj_find_fence may return a NULL
410+ * fence. To make sure the recipient gets
411+ * signalled, use a new fence instead.
412+ */
413+ if (!*fence)
414+ *fence = dma_fence_get_stub();
415+
408416 goto out;
417+ }
409418 dma_fence_put(*fence);
410419 } else {
411420 ret = -EINVAL;
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c+1−0
@@ -3277,6 +3277,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, · 3276 unmodified lines
32773277 out_fence = eb_requests_create(&eb, in_fence, out_fence_fd);
32783278 if (IS_ERR(out_fence)) {
32793279 err = PTR_ERR(out_fence);
3280+ out_fence = NULL;
32803281 if (eb.requests[0])
32813282 goto err_request;
32823283 else
drivers/gpu/drm/i915/gt/intel_workarounds.c+9−9
@@ -1127,6 +1127,15 @@ icl_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal) · 1126 unmodified lines
11271127 GAMT_CHKN_BIT_REG,
11281128 GAMT_CHKN_DISABLE_L3_COH_PIPE);
11291129
1130+ /* Wa_1407352427:icl,ehl */
1131+ wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE2,
1132+ PSDUNIT_CLKGATE_DIS);
1133+
1134+ /* Wa_1406680159:icl,ehl */
1135+ wa_write_or(wal,
1136+ SUBSLICE_UNIT_LEVEL_CLKGATE,
1137+ GWUNIT_CLKGATE_DIS);
1138+
11301139 /* Wa_1607087056:icl,ehl,jsl */
11311140 if (IS_ICELAKE(i915) ||
11321141 IS_JSL_EHL_GT_STEP(i915, STEP_A0, STEP_B0))
@@ -1852,15 +1861,6 @@ rcs_engine_wa_init(struct intel_engine_cs *engine, struct i915_wa_list *wal) · 719 unmodified lines
18521861 wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE,
18531862 VSUNIT_CLKGATE_DIS | HSUNIT_CLKGATE_DIS);
18541863
1855− /* Wa_1407352427:icl,ehl */
1856− wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE2,
1857− PSDUNIT_CLKGATE_DIS);
1858−
1859− /* Wa_1406680159:icl,ehl */
1860− wa_write_or(wal,
1861− SUBSLICE_UNIT_LEVEL_CLKGATE,
1862− GWUNIT_CLKGATE_DIS);
1863−
18641864 /*
18651865 * Wa_1408767742:icl[a2..forever],ehl[all]
18661866 * Wa_1605460711:icl[a0..c0]
drivers/gpu/drm/ttm/ttm_bo.c+2−1
@@ -1103,7 +1103,7 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx, · 1102 unmodified lines
11031103 * as an indication that we're about to swap out.
11041104 */
11051105 memset(&place, 0, sizeof(place));
1106− place.mem_type = TTM_PL_SYSTEM;
1106+ place.mem_type = bo->resource->mem_type;
11071107 if (!ttm_bo_evict_swapout_allowable(bo, ctx, &place, &locked, NULL))
11081108 return -EBUSY;
11091109
@@ -1135,6 +1135,7 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx, · 25 unmodified lines
11351135 struct ttm_place hop;
11361136
11371137 memset(&hop, 0, sizeof(hop));
1138+ place.mem_type = TTM_PL_SYSTEM;
11381139 ret = ttm_resource_alloc(bo, &place, &evict_mem);
11391140 if (unlikely(ret))
11401141 goto out;
drivers/hv/Kconfig+1−0
@@ -19,6 +19,7 @@ config HYPERV_TIMER · 18 unmodified lines
1919 config HYPERV_UTILS
2020 tristate "Microsoft Hyper-V Utilities driver"
2121 depends on HYPERV && CONNECTOR && NLS
22+ depends on PTP_1588_CLOCK_OPTIONAL
2223 help
2324 Select this option to enable the Hyper-V Utilities.
2425
drivers/hwmon/corsair-psu.c+1−1
@@ -729,7 +729,7 @@ static int corsairpsu_probe(struct hid_device *hdev, const struct hid_device_id · 728 unmodified lines
729729 corsairpsu_check_cmd_support(priv);
730730
731731 priv->hwmon_dev = hwmon_device_register_with_info(&hdev->dev, "corsairpsu", priv,
732− &corsairpsu_chip_info, 0);
732+ &corsairpsu_chip_info, NULL);
733733
734734 if (IS_ERR(priv->hwmon_dev)) {
735735 ret = PTR_ERR(priv->hwmon_dev);
drivers/hwmon/dell-smm-hwmon.c+3−4
@@ -627,10 +627,9 @@ static void __init i8k_init_procfs(struct device *dev) · 626 unmodified lines
627627 {
628628 struct dell_smm_data *data = dev_get_drvdata(dev);
629629
630− /* Register the proc entry */
631− proc_create_data("i8k", 0, NULL, &i8k_proc_ops, data);
632−
633− devm_add_action_or_reset(dev, i8k_exit_procfs, NULL);
630+ /* Only register exit function if creation was successful */
631+ if (proc_create_data("i8k", 0, NULL, &i8k_proc_ops, data))
632+ devm_add_action_or_reset(dev, i8k_exit_procfs, NULL);
634633 }
635634
636635 #else
drivers/hwmon/nct6775.c+1−1
@@ -1527,7 +1527,7 @@ static u16 nct6775_wmi_read_value(struct nct6775_data *data, u16 reg) · 1526 unmodified lines
15271527
15281528 nct6775_wmi_set_bank(data, reg);
15291529
1530− err = nct6775_asuswmi_read(data->bank, reg, &tmp);
1530+ err = nct6775_asuswmi_read(data->bank, reg & 0xff, &tmp);
15311531 if (err)
15321532 return 0;
15331533
drivers/hwmon/pwm-fan.c+0−2
@@ -336,8 +336,6 @@ static int pwm_fan_probe(struct platform_device *pdev) · 335 unmodified lines
336336 return ret;
337337 }
338338
339− ctx->pwm_value = MAX_PWM;
340−
341339 pwm_init_state(ctx->pwm, &ctx->pwm_state);
342340
343341 /*
drivers/hwmon/sht4x.c+2−2
@@ -23,7 +23,7 @@ · 22 unmodified lines
2323 /*
2424 * I2C command delays (in microseconds)
2525 */
26−#define SHT4X_MEAS_DELAY 1000
26+#define SHT4X_MEAS_DELAY_HPM 8200 /* see t_MEAS,h in datasheet */
2727 #define SHT4X_DELAY_EXTRA 10000
2828
2929 /*
@@ -90,7 +90,7 @@ static int sht4x_read_values(struct sht4x_data *data) · 60 unmodified lines
9090 if (ret < 0)
9191 goto unlock;
9292
93− usleep_range(SHT4X_MEAS_DELAY, SHT4X_MEAS_DELAY + SHT4X_DELAY_EXTRA);
93+ usleep_range(SHT4X_MEAS_DELAY_HPM, SHT4X_MEAS_DELAY_HPM + SHT4X_DELAY_EXTRA);
9494
9595 ret = i2c_master_recv(client, raw_data, SHT4X_RESPONSE_LENGTH);
9696 if (ret != SHT4X_RESPONSE_LENGTH) {
drivers/i2c/busses/i2c-mpc.c+1−1
@@ -636,7 +636,7 @@ static irqreturn_t mpc_i2c_isr(int irq, void *dev_id) · 635 unmodified lines
636636 status = readb(i2c->base + MPC_I2C_SR);
637637 if (status & CSR_MIF) {
638638 /* Wait up to 100us for transfer to properly complete */
639− readb_poll_timeout(i2c->base + MPC_I2C_SR, status, !(status & CSR_MCF), 0, 100);
639+ readb_poll_timeout_atomic(i2c->base + MPC_I2C_SR, status, status & CSR_MCF, 0, 100);
640640 writeb(0, i2c->base + MPC_I2C_SR);
641641 mpc_i2c_do_intr(i2c, status);
642642 return IRQ_HANDLED;
drivers/i2c/busses/i2c-virtio.c+12−20
@@ -22,24 +22,24 @@ · 21 unmodified lines
2222 /**
2323 * struct virtio_i2c - virtio I2C data
2424 * @vdev: virtio device for this controller
25− * @completion: completion of virtio I2C message
2625 * @adap: I2C adapter for this controller
2726 * @vq: the virtio virtqueue for communication
2827 */
2928 struct virtio_i2c {
3029 struct virtio_device *vdev;
31− struct completion completion;
3230 struct i2c_adapter adap;
3331 struct virtqueue *vq;
3432 };
3533
3634 /**
3735 * struct virtio_i2c_req - the virtio I2C request structure
36+ * @completion: completion of virtio I2C message
3837 * @out_hdr: the OUT header of the virtio I2C message
3938 * @buf: the buffer into which data is read, or from which it's written
4039 * @in_hdr: the IN header of the virtio I2C message
4140 */
4241 struct virtio_i2c_req {
42+ struct completion completion;
4343 struct virtio_i2c_out_hdr out_hdr ____cacheline_aligned;
4444 uint8_t *buf ____cacheline_aligned;
4545 struct virtio_i2c_in_hdr in_hdr ____cacheline_aligned;
@@ -47,9 +47,11 @@ struct virtio_i2c_req { · 1 unmodified line
4747
4848 static void virtio_i2c_msg_done(struct virtqueue *vq)
4949 {
50− struct virtio_i2c *vi = vq->vdev->priv;
50+ struct virtio_i2c_req *req;
51+ unsigned int len;
5152
52− complete(&vi->completion);
53+ while ((req = virtqueue_get_buf(vq, &len)))
54+ complete(&req->completion);
5355 }
5456
5557 static int virtio_i2c_prepare_reqs(struct virtqueue *vq,
@@ -62,6 +64,8 @@ static int virtio_i2c_prepare_reqs(struct virtqueue *vq, · 6 unmodified lines
6264 for (i = 0; i < num; i++) {
6365 int outcnt = 0, incnt = 0;
6466
67+ init_completion(&reqs[i].completion);
68+
6569 /*
6670 * Only 7-bit mode supported for this moment. For the address
6771 * format, Please check the Virtio I2C Specification.
@@ -106,21 +110,15 @@ static int virtio_i2c_complete_reqs(struct virtqueue *vq, · 38 unmodified lines
106110 struct virtio_i2c_req *reqs,
107111 struct i2c_msg *msgs, int num)
108112 {
109− struct virtio_i2c_req *req;
110113 bool failed = false;
111− unsigned int len;
112114 int i, j = 0;
113115
114116 for (i = 0; i < num; i++) {
115− /* Detach the ith request from the vq */
116− req = virtqueue_get_buf(vq, &len);
117+ struct virtio_i2c_req *req = &reqs[i];
117118
118− /*
119− * Condition req == &reqs[i] should always meet since we have
120− * total num requests in the vq. reqs[i] can never be NULL here.
121− */
122− if (!failed && (WARN_ON(req != &reqs[i]) ||
123− req->in_hdr.status != VIRTIO_I2C_MSG_OK))
119+ wait_for_completion(&req->completion);
120+
121+ if (!failed && req->in_hdr.status != VIRTIO_I2C_MSG_OK)
124122 failed = true;
125123
126124 i2c_put_dma_safe_msg_buf(reqs[i].buf, &msgs[i], !failed);
@@ -156,12 +154,8 @@ static int virtio_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, · 29 unmodified lines
156154 * remote here to clear the virtqueue, so we can try another set of
157155 * messages later on.
158156 */
159−
160− reinit_completion(&vi->completion);
161157 virtqueue_kick(vq);
162158
163− wait_for_completion(&vi->completion);
164−
165159 count = virtio_i2c_complete_reqs(vq, reqs, msgs, count);
166160
167161 err_free:
@@ -210,8 +204,6 @@ static int virtio_i2c_probe(struct virtio_device *vdev) · 42 unmodified lines
210204 vdev->priv = vi;
211205 vi->vdev = vdev;
212206
213− init_completion(&vi->completion);
214−
215207 ret = virtio_i2c_setup_vqs(vi);
216208 if (ret)
217209 return ret;
drivers/iio/accel/kxcjk-1013.c+2−3
@@ -1595,8 +1595,7 @@ static int kxcjk1013_probe(struct i2c_client *client, · 1594 unmodified lines
15951595 return 0;
15961596
15971597 err_buffer_cleanup:
1598− if (data->dready_trig)
1599− iio_triggered_buffer_cleanup(indio_dev);
1598+ iio_triggered_buffer_cleanup(indio_dev);
16001599 err_trigger_unregister:
16011600 if (data->dready_trig)
16021601 iio_trigger_unregister(data->dready_trig);
@@ -1618,8 +1617,8 @@ static int kxcjk1013_remove(struct i2c_client *client) · 15 unmodified lines
16181617 pm_runtime_disable(&client->dev);
16191618 pm_runtime_set_suspended(&client->dev);
16201619
1620+ iio_triggered_buffer_cleanup(indio_dev);
16211621 if (data->dready_trig) {
1622− iio_triggered_buffer_cleanup(indio_dev);
16231622 iio_trigger_unregister(data->dready_trig);
16241623 iio_trigger_unregister(data->motion_trig);
16251624 }
drivers/iio/accel/kxsd9.c+3−3
@@ -224,14 +224,14 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p) · 223 unmodified lines
224224 hw_values.chan,
225225 sizeof(hw_values.chan));
226226 if (ret) {
227− dev_err(st->dev,
228− "error reading data\n");
229− return ret;
227+ dev_err(st->dev, "error reading data: %d\n", ret);
228+ goto out;
230229 }
231230
232231 iio_push_to_buffers_with_timestamp(indio_dev,
233232 &hw_values,
234233 iio_get_time_ns(indio_dev));
234+out:
235235 iio_trigger_notify_done(indio_dev->trig);
236236
237237 return IRQ_HANDLED;
drivers/iio/accel/mma8452.c+1−1
@@ -1470,7 +1470,7 @@ static int mma8452_trigger_setup(struct iio_dev *indio_dev) · 1469 unmodified lines
14701470 if (ret)
14711471 return ret;
14721472
1473− indio_dev->trig = trig;
1473+ indio_dev->trig = iio_trigger_get(trig);
14741474
14751475 return 0;
14761476 }
drivers/iio/adc/Kconfig+1−1
@@ -532,7 +532,7 @@ config IMX7D_ADC · 531 unmodified lines
532532
533533 config IMX8QXP_ADC
534534 tristate "NXP IMX8QXP ADC driver"
535− depends on ARCH_MXC_ARM64 || COMPILE_TEST
535+ depends on ARCH_MXC || COMPILE_TEST
536536 depends on HAS_IOMEM
537537 help
538538 Say yes here to build support for IMX8QXP ADC.
drivers/iio/adc/ad7768-1.c+1−1
@@ -480,8 +480,8 @@ static irqreturn_t ad7768_trigger_handler(int irq, void *p) · 479 unmodified lines
480480 iio_push_to_buffers_with_timestamp(indio_dev, &st->data.scan,
481481 iio_get_time_ns(indio_dev));
482482
483− iio_trigger_notify_done(indio_dev->trig);
484483 err_unlock:
484+ iio_trigger_notify_done(indio_dev->trig);
485485 mutex_unlock(&st->lock);
486486
487487 return IRQ_HANDLED;
drivers/iio/adc/at91-sama5d2_adc.c+2−1
@@ -1586,7 +1586,8 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, · 1585 unmodified lines
15861586 *val = st->conversion_value;
15871587 ret = at91_adc_adjust_val_osr(st, val);
15881588 if (chan->scan_type.sign == 's')
1589− *val = sign_extend32(*val, 11);
1589+ *val = sign_extend32(*val,
1590+ chan->scan_type.realbits - 1);
15901591 st->conversion_done = false;
15911592 }
15921593
drivers/iio/adc/axp20x_adc.c+3−15
@@ -251,19 +251,8 @@ static int axp22x_adc_raw(struct iio_dev *indio_dev, · 250 unmodified lines
251251 struct iio_chan_spec const *chan, int *val)
252252 {
253253 struct axp20x_adc_iio *info = iio_priv(indio_dev);
254− int size;
255254
256− /*
257− * N.B.: Unlike the Chinese datasheets tell, the charging current is
258− * stored on 12 bits, not 13 bits. Only discharging current is on 13
259− * bits.
260− */
261− if (chan->type == IIO_CURRENT && chan->channel == AXP22X_BATT_DISCHRG_I)
262− size = 13;
263− else
264− size = 12;
265−
266− *val = axp20x_read_variable_width(info->regmap, chan->address, size);
255+ *val = axp20x_read_variable_width(info->regmap, chan->address, 12);
267256 if (*val < 0)
268257 return *val;
269258
@@ -386,9 +375,8 @@ static int axp22x_adc_scale(struct iio_chan_spec const *chan, int *val, · 116 unmodified lines
386375 return IIO_VAL_INT_PLUS_MICRO;
387376
388377 case IIO_CURRENT:
389− *val = 0;
390− *val2 = 500000;
391− return IIO_VAL_INT_PLUS_MICRO;
378+ *val = 1;
379+ return IIO_VAL_INT;
392380
393381 case IIO_TEMP:
394382 *val = 100;
drivers/iio/adc/dln2-adc.c+12−9
@@ -248,7 +248,6 @@ static int dln2_adc_set_chan_period(struct dln2_adc *dln2, · 247 unmodified lines
248248 static int dln2_adc_read(struct dln2_adc *dln2, unsigned int channel)
249249 {
250250 int ret, i;
251− struct iio_dev *indio_dev = platform_get_drvdata(dln2->pdev);
252251 u16 conflict;
253252 __le16 value;
254253 int olen = sizeof(value);
@@ -257,13 +256,9 @@ static int dln2_adc_read(struct dln2_adc *dln2, unsigned int channel) · 2 unmodified lines
257256 .chan = channel,
258257 };
259258
260− ret = iio_device_claim_direct_mode(indio_dev);
261− if (ret < 0)
262− return ret;
263−
264259 ret = dln2_adc_set_chan_enabled(dln2, channel, true);
265260 if (ret < 0)
266− goto release_direct;
261+ return ret;
267262
268263 ret = dln2_adc_set_port_enabled(dln2, true, &conflict);
269264 if (ret < 0) {
@@ -300,8 +295,6 @@ disable_port: · 30 unmodified lines
300295 dln2_adc_set_port_enabled(dln2, false, NULL);
301296 disable_chan:
302297 dln2_adc_set_chan_enabled(dln2, channel, false);
303−release_direct:
304− iio_device_release_direct_mode(indio_dev);
305298
306299 return ret;
307300 }
@@ -337,10 +330,16 @@ static int dln2_adc_read_raw(struct iio_dev *indio_dev, · 29 unmodified lines
337330
338331 switch (mask) {
339332 case IIO_CHAN_INFO_RAW:
333+ ret = iio_device_claim_direct_mode(indio_dev);
334+ if (ret < 0)
335+ return ret;
336+
340337 mutex_lock(&dln2->mutex);
341338 ret = dln2_adc_read(dln2, chan->channel);
342339 mutex_unlock(&dln2->mutex);
343340
341+ iio_device_release_direct_mode(indio_dev);
342+
344343 if (ret < 0)
345344 return ret;
346345
@@ -656,7 +655,11 @@ static int dln2_adc_probe(struct platform_device *pdev) · 309 unmodified lines
656655 return -ENOMEM;
657656 }
658657 iio_trigger_set_drvdata(dln2->trig, dln2);
659− devm_iio_trigger_register(dev, dln2->trig);
658+ ret = devm_iio_trigger_register(dev, dln2->trig);
659+ if (ret) {
660+ dev_err(dev, "failed to register trigger: %d\n", ret);
661+ return ret;
662+ }
660663 iio_trigger_set_immutable(indio_dev, dln2->trig);
661664
662665 ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL,
drivers/iio/adc/stm32-adc.c+2−1
@@ -1117,6 +1117,7 @@ static void stm32h7_adc_unprepare(struct iio_dev *indio_dev) · 1116 unmodified lines
11171117 {
11181118 struct stm32_adc *adc = iio_priv(indio_dev);
11191119
1120+ stm32_adc_writel(adc, STM32H7_ADC_PCSEL, 0);
11201121 stm32h7_adc_disable(indio_dev);
11211122 stm32_adc_int_ch_disable(adc);
11221123 stm32h7_adc_enter_pwr_down(adc);
@@ -1986,7 +1987,7 @@ static int stm32_adc_populate_int_ch(struct iio_dev *indio_dev, const char *ch_n · 863 unmodified lines
19861987 /* Get calibration data for vrefint channel */
19871988 ret = nvmem_cell_read_u16(&indio_dev->dev, "vrefint", &vrefint);
19881989 if (ret && ret != -ENOENT) {
1989− return dev_err_probe(&indio_dev->dev, ret,
1990+ return dev_err_probe(indio_dev->dev.parent, ret,
19901991 "nvmem access error\n");
19911992 }
19921993 if (ret == -ENOENT)
drivers/iio/gyro/adxrs290.c+3−2
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 */
88
99 #include <linux/bitfield.h>
10+#include <linux/bitops.h>
1011 #include <linux/delay.h>
1112 #include <linux/device.h>
1213 #include <linux/kernel.h>
@@ -124,7 +125,7 @@ static int adxrs290_get_rate_data(struct iio_dev *indio_dev, const u8 cmd, int * · 111 unmodified lines
124125 goto err_unlock;
125126 }
126127
127− *val = temp;
128+ *val = sign_extend32(temp, 15);
128129
129130 err_unlock:
130131 mutex_unlock(&st->lock);
@@ -146,7 +147,7 @@ static int adxrs290_get_temp_data(struct iio_dev *indio_dev, int *val) · 15 unmodified lines
146147 }
147148
148149 /* extract lower 12 bits temperature reading */
149− *val = temp & 0x0FFF;
150+ *val = sign_extend32(temp, 11);
150151
151152 err_unlock:
152153 mutex_unlock(&st->lock);
drivers/iio/gyro/itg3200_buffer.c+1−1
@@ -61,9 +61,9 @@ static irqreturn_t itg3200_trigger_handler(int irq, void *p) · 60 unmodified lines
6161
6262 iio_push_to_buffers_with_timestamp(indio_dev, &scan, pf->timestamp);
6363
64+error_ret:
6465 iio_trigger_notify_done(indio_dev->trig);
6566
66−error_ret:
6767 return IRQ_HANDLED;
6868 }
6969
drivers/iio/industrialio-trigger.c+0−1
@@ -556,7 +556,6 @@ struct iio_trigger *viio_trigger_alloc(struct device *parent, · 555 unmodified lines
556556 irq_modify_status(trig->subirq_base + i,
557557 IRQ_NOREQUEST | IRQ_NOAUTOEN, IRQ_NOPROBE);
558558 }
559− get_device(&trig->dev);
560559
561560 return trig;
562561
drivers/iio/light/ltr501.c+1−1
@@ -1275,7 +1275,7 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p) · 1274 unmodified lines
12751275 ret = regmap_bulk_read(data->regmap, LTR501_ALS_DATA1,
12761276 als_buf, sizeof(als_buf));
12771277 if (ret < 0)
1278− return ret;
1278+ goto done;
12791279 if (test_bit(0, indio_dev->active_scan_mask))
12801280 scan.channels[j++] = le16_to_cpu(als_buf[1]);
12811281 if (test_bit(1, indio_dev->active_scan_mask))
drivers/iio/light/stk3310.c+3−3
@@ -546,9 +546,8 @@ static irqreturn_t stk3310_irq_event_handler(int irq, void *private) · 545 unmodified lines
546546 mutex_lock(&data->lock);
547547 ret = regmap_field_read(data->reg_flag_nf, &dir);
548548 if (ret < 0) {
549− dev_err(&data->client->dev, "register read failed\n");
550− mutex_unlock(&data->lock);
551− return ret;
549+ dev_err(&data->client->dev, "register read failed: %d\n", ret);
550+ goto out;
552551 }
553552 event = IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY, 1,
554553 IIO_EV_TYPE_THRESH,
@@ -560,6 +559,7 @@ static irqreturn_t stk3310_irq_event_handler(int irq, void *private) · 5 unmodified lines
560559 ret = regmap_field_write(data->reg_flag_psint, 0);
561560 if (ret < 0)
562561 dev_err(&data->client->dev, "failed to reset interrupts\n");
562+out:
563563 mutex_unlock(&data->lock);
564564
565565 return IRQ_HANDLED;
drivers/iio/trigger/stm32-timer-trigger.c+1−1
@@ -912,6 +912,6 @@ static struct platform_driver stm32_timer_trigger_driver = { · 911 unmodified lines
912912 };
913913 module_platform_driver(stm32_timer_trigger_driver);
914914
915−MODULE_ALIAS("platform: stm32-timer-trigger");
915+MODULE_ALIAS("platform:stm32-timer-trigger");
916916 MODULE_DESCRIPTION("STMicroelectronics STM32 Timer Trigger driver");
917917 MODULE_LICENSE("GPL v2");
drivers/infiniband/hw/hfi1/chip.c+2−0
@@ -8415,6 +8415,8 @@ static void receive_interrupt_common(struct hfi1_ctxtdata *rcd) · 8414 unmodified lines
84158415 */
84168416 static void __hfi1_rcd_eoi_intr(struct hfi1_ctxtdata *rcd)
84178417 {
8418+ if (!rcd->rcvhdrq)
8419+ return;
84188420 clear_recv_intr(rcd);
84198421 if (check_packet_present(rcd))
84208422 force_recv_intr(rcd);
drivers/infiniband/hw/hfi1/driver.c+2−0
@@ -1012,6 +1012,8 @@ int handle_receive_interrupt(struct hfi1_ctxtdata *rcd, int thread) · 1011 unmodified lines
10121012 struct hfi1_packet packet;
10131013 int skip_pkt = 0;
10141014
1015+ if (!rcd->rcvhdrq)
1016+ return RCV_PKT_OK;
10151017 /* Control context will always use the slow path interrupt handler */
10161018 needset = (rcd->ctxt == HFI1_CTRL_CTXT) ? 0 : 1;
10171019
drivers/infiniband/hw/hfi1/init.c+17−23
@@ -113,7 +113,6 @@ static int hfi1_create_kctxt(struct hfi1_devdata *dd, · 112 unmodified lines
113113 rcd->fast_handler = get_dma_rtail_setting(rcd) ?
114114 handle_receive_interrupt_dma_rtail :
115115 handle_receive_interrupt_nodma_rtail;
116− rcd->slow_handler = handle_receive_interrupt;
117116
118117 hfi1_set_seq_cnt(rcd, 1);
119118
@@ -334,6 +333,8 @@ int hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, int numa, · 214 unmodified lines
334333 rcd->numa_id = numa;
335334 rcd->rcv_array_groups = dd->rcv_entries.ngroups;
336335 rcd->rhf_rcv_function_map = normal_rhf_rcv_functions;
336+ rcd->slow_handler = handle_receive_interrupt;
337+ rcd->do_interrupt = rcd->slow_handler;
337338 rcd->msix_intr = CCE_NUM_MSIX_VECTORS;
338339
339340 mutex_init(&rcd->exp_mutex);
@@ -874,18 +875,6 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit) · 534 unmodified lines
874875 if (ret)
875876 goto done;
876877
877− /* allocate dummy tail memory for all receive contexts */
878− dd->rcvhdrtail_dummy_kvaddr = dma_alloc_coherent(&dd->pcidev->dev,
879− sizeof(u64),
880− &dd->rcvhdrtail_dummy_dma,
881− GFP_KERNEL);
882−
883− if (!dd->rcvhdrtail_dummy_kvaddr) {
884− dd_dev_err(dd, "cannot allocate dummy tail memory\n");
885− ret = -ENOMEM;
886− goto done;
887− }
888−
889878 /* dd->rcd can be NULL if early initialization failed */
890879 for (i = 0; dd->rcd && i < dd->first_dyn_alloc_ctxt; ++i) {
891880 /*
@@ -898,8 +887,6 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit) · 6 unmodified lines
898887 if (!rcd)
899888 continue;
900889
901− rcd->do_interrupt = &handle_receive_interrupt;
902−
903890 lastfail = hfi1_create_rcvhdrq(dd, rcd);
904891 if (!lastfail)
905892 lastfail = hfi1_setup_eagerbufs(rcd);
@@ -1120,7 +1107,7 @@ void hfi1_free_ctxtdata(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) · 214 unmodified lines
11201107 rcd->egrbufs.rcvtids = NULL;
11211108
11221109 for (e = 0; e < rcd->egrbufs.alloced; e++) {
1123− if (rcd->egrbufs.buffers[e].dma)
1110+ if (rcd->egrbufs.buffers[e].addr)
11241111 dma_free_coherent(&dd->pcidev->dev,
11251112 rcd->egrbufs.buffers[e].len,
11261113 rcd->egrbufs.buffers[e].addr,
@@ -1201,6 +1188,11 @@ void hfi1_free_devdata(struct hfi1_devdata *dd) · 74 unmodified lines
12011188 dd->tx_opstats = NULL;
12021189 kfree(dd->comp_vect);
12031190 dd->comp_vect = NULL;
1191+ if (dd->rcvhdrtail_dummy_kvaddr)
1192+ dma_free_coherent(&dd->pcidev->dev, sizeof(u64),
1193+ (void *)dd->rcvhdrtail_dummy_kvaddr,
1194+ dd->rcvhdrtail_dummy_dma);
1195+ dd->rcvhdrtail_dummy_kvaddr = NULL;
12041196 sdma_clean(dd, dd->num_sdma);
12051197 rvt_dealloc_device(&dd->verbs_dev.rdi);
12061198 }
@@ -1298,6 +1290,15 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, · 91 unmodified lines
12981290 goto bail;
12991291 }
13001292
1293+ /* allocate dummy tail memory for all receive contexts */
1294+ dd->rcvhdrtail_dummy_kvaddr =
1295+ dma_alloc_coherent(&dd->pcidev->dev, sizeof(u64),
1296+ &dd->rcvhdrtail_dummy_dma, GFP_KERNEL);
1297+ if (!dd->rcvhdrtail_dummy_kvaddr) {
1298+ ret = -ENOMEM;
1299+ goto bail;
1300+ }
1301+
13011302 atomic_set(&dd->ipoib_rsm_usr_num, 0);
13021303 return dd;
13031304
@@ -1505,13 +1506,6 @@ static void cleanup_device_data(struct hfi1_devdata *dd) · 201 unmodified lines
15051506
15061507 free_credit_return(dd);
15071508
1508− if (dd->rcvhdrtail_dummy_kvaddr) {
1509− dma_free_coherent(&dd->pcidev->dev, sizeof(u64),
1510− (void *)dd->rcvhdrtail_dummy_kvaddr,
1511− dd->rcvhdrtail_dummy_dma);
1512− dd->rcvhdrtail_dummy_kvaddr = NULL;
1513− }
1514−
15151509 /*
15161510 * Free any resources still in use (usually just kernel contexts)
15171511 * at unload; we do for ctxtcnt, because that's what we allocate.
drivers/infiniband/hw/hfi1/sdma.c+1−1
@@ -838,8 +838,8 @@ struct sdma_engine *sdma_select_user_engine(struct hfi1_devdata *dd, · 837 unmodified lines
838838 if (current->nr_cpus_allowed != 1)
839839 goto out;
840840
841− cpu_id = smp_processor_id();
842841 rcu_read_lock();
842+ cpu_id = smp_processor_id();
843843 rht_node = rhashtable_lookup(dd->sdma_rht, &cpu_id,
844844 sdma_rht_params);
845845
drivers/infiniband/hw/hns/hns_roce_hw_v2.c+11−3
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include <linux/acpi.h>
3434 #include <linux/etherdevice.h>
3535 #include <linux/interrupt.h>
36+#include <linux/iopoll.h>
3637 #include <linux/kernel.h>
3738 #include <linux/types.h>
3839 #include <net/addrconf.h>
@@ -1050,9 +1051,14 @@ static u32 hns_roce_v2_cmd_hw_resetting(struct hns_roce_dev *hr_dev, · 1011 unmodified lines
10501051 unsigned long instance_stage,
10511052 unsigned long reset_stage)
10521053 {
1054+#define HW_RESET_TIMEOUT_US 1000000
1055+#define HW_RESET_SLEEP_US 1000
1056+
10531057 struct hns_roce_v2_priv *priv = hr_dev->priv;
10541058 struct hnae3_handle *handle = priv->handle;
10551059 const struct hnae3_ae_ops *ops = handle->ae_algo->ops;
1060+ unsigned long val;
1061+ int ret;
10561062
10571063 /* When hardware reset is detected, we should stop sending mailbox&cmq&
10581064 * doorbell to hardware. If now in .init_instance() function, we should
@@ -1064,7 +1070,11 @@ static u32 hns_roce_v2_cmd_hw_resetting(struct hns_roce_dev *hr_dev, · 5 unmodified lines
10641070 * again.
10651071 */
10661072 hr_dev->dis_db = true;
1067− if (!ops->get_hw_reset_stat(handle))
1073+
1074+ ret = read_poll_timeout(ops->ae_dev_reset_cnt, val,
1075+ val > hr_dev->reset_cnt, HW_RESET_SLEEP_US,
1076+ HW_RESET_TIMEOUT_US, false, handle);
1077+ if (!ret)
10681078 hr_dev->is_reset = true;
10691079
10701080 if (!hr_dev->is_reset || reset_stage == HNS_ROCE_STATE_RST_INIT ||
@@ -6387,10 +6397,8 @@ static int hns_roce_hw_v2_reset_notify_down(struct hnae3_handle *handle) · 5316 unmodified lines
63876397 if (!hr_dev)
63886398 return 0;
63896399
6390− hr_dev->is_reset = true;
63916400 hr_dev->active = false;
63926401 hr_dev->dis_db = true;
6393−
63946402 hr_dev->state = HNS_ROCE_DEVICE_STATE_RST_DOWN;
63956403
63966404 return 0;
drivers/infiniband/hw/irdma/hw.c+6−1
@@ -60,6 +60,8 @@ static void irdma_iwarp_ce_handler(struct irdma_sc_cq *iwcq) · 59 unmodified lines
6060 {
6161 struct irdma_cq *cq = iwcq->back_cq;
6262
63+ if (!cq->user_mode)
64+ cq->armed = false;
6365 if (cq->ibcq.comp_handler)
6466 cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context);
6567 }
@@ -146,6 +148,7 @@ static void irdma_set_flush_fields(struct irdma_sc_qp *qp, · 80 unmodified lines
146148 qp->flush_code = FLUSH_PROT_ERR;
147149 break;
148150 case IRDMA_AE_AMP_BAD_QP:
151+ case IRDMA_AE_WQE_UNEXPECTED_OPCODE:
149152 qp->flush_code = FLUSH_LOC_QP_OP_ERR;
150153 break;
151154 case IRDMA_AE_AMP_BAD_STAG_KEY:
@@ -156,7 +159,6 @@ static void irdma_set_flush_fields(struct irdma_sc_qp *qp, · 4 unmodified lines
156159 case IRDMA_AE_PRIV_OPERATION_DENIED:
157160 case IRDMA_AE_IB_INVALID_REQUEST:
158161 case IRDMA_AE_IB_REMOTE_ACCESS_ERROR:
159− case IRDMA_AE_IB_REMOTE_OP_ERROR:
160162 qp->flush_code = FLUSH_REM_ACCESS_ERR;
161163 qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR;
162164 break;
@@ -184,6 +186,9 @@ static void irdma_set_flush_fields(struct irdma_sc_qp *qp, · 21 unmodified lines
184186 case IRDMA_AE_AMP_MWBIND_INVALID_BOUNDS:
185187 qp->flush_code = FLUSH_MW_BIND_ERR;
186188 break;
189+ case IRDMA_AE_IB_REMOTE_OP_ERROR:
190+ qp->flush_code = FLUSH_REM_OP_ERR;
191+ break;
187192 default:
188193 qp->flush_code = FLUSH_FATAL_ERR;
189194 break;
drivers/infiniband/hw/irdma/main.h+1−0
@@ -542,6 +542,7 @@ int irdma_ah_cqp_op(struct irdma_pci_f *rf, struct irdma_sc_ah *sc_ah, u8 cmd, · 541 unmodified lines
542542 void (*callback_fcn)(struct irdma_cqp_request *cqp_request),
543543 void *cb_param);
544544 void irdma_gsi_ud_qp_ah_cb(struct irdma_cqp_request *cqp_request);
545+bool irdma_cq_empty(struct irdma_cq *iwcq);
545546 int irdma_inetaddr_event(struct notifier_block *notifier, unsigned long event,
546547 void *ptr);
547548 int irdma_inet6addr_event(struct notifier_block *notifier, unsigned long event,
drivers/infiniband/hw/irdma/pble.c+3−5
@@ -25,8 +25,7 @@ void irdma_destroy_pble_prm(struct irdma_hmc_pble_rsrc *pble_rsrc) · 24 unmodified lines
2525 list_del(&chunk->list);
2626 if (chunk->type == PBLE_SD_PAGED)
2727 irdma_pble_free_paged_mem(chunk);
28− if (chunk->bitmapbuf)
29− kfree(chunk->bitmapmem.va);
28+ bitmap_free(chunk->bitmapbuf);
3029 kfree(chunk->chunkmem.va);
3130 }
3231 }
@@ -283,7 +282,6 @@ add_pble_prm(struct irdma_hmc_pble_rsrc *pble_rsrc) · 250 unmodified lines
283282 "PBLE: next_fpm_addr = %llx chunk_size[%llu] = 0x%llx\n",
284283 pble_rsrc->next_fpm_addr, chunk->size, chunk->size);
285284 pble_rsrc->unallocated_pble -= (u32)(chunk->size >> 3);
286− list_add(&chunk->list, &pble_rsrc->pinfo.clist);
287285 sd_reg_val = (sd_entry_type == IRDMA_SD_TYPE_PAGED) ?
288286 sd_entry->u.pd_table.pd_page_addr.pa :
289287 sd_entry->u.bp.addr.pa;
@@ -295,12 +293,12 @@ add_pble_prm(struct irdma_hmc_pble_rsrc *pble_rsrc) · 5 unmodified lines
295293 goto error;
296294 }
297295
296+ list_add(&chunk->list, &pble_rsrc->pinfo.clist);
298297 sd_entry->valid = true;
299298 return 0;
300299
301300 error:
302− if (chunk->bitmapbuf)
303− kfree(chunk->bitmapmem.va);
301+ bitmap_free(chunk->bitmapbuf);
304302 kfree(chunk->chunkmem.va);
305303
306304 return ret_code;
drivers/infiniband/hw/irdma/pble.h+0−1
@@ -78,7 +78,6 @@ struct irdma_chunk { · 77 unmodified lines
7878 u32 pg_cnt;
7979 enum irdma_alloc_type type;
8080 struct irdma_sc_dev *dev;
81− struct irdma_virt_mem bitmapmem;
8281 struct irdma_virt_mem chunkmem;
8382 };
8483
drivers/infiniband/hw/irdma/utils.c+17−7
@@ -2239,15 +2239,10 @@ enum irdma_status_code irdma_prm_add_pble_mem(struct irdma_pble_prm *pprm, · 2238 unmodified lines
22392239
22402240 sizeofbitmap = (u64)pchunk->size >> pprm->pble_shift;
22412241
2242− pchunk->bitmapmem.size = sizeofbitmap >> 3;
2243− pchunk->bitmapmem.va = kzalloc(pchunk->bitmapmem.size, GFP_KERNEL);
2244−
2245− if (!pchunk->bitmapmem.va)
2242+ pchunk->bitmapbuf = bitmap_zalloc(sizeofbitmap, GFP_KERNEL);
2243+ if (!pchunk->bitmapbuf)
22462244 return IRDMA_ERR_NO_MEMORY;
22472245
2248− pchunk->bitmapbuf = pchunk->bitmapmem.va;
2249− bitmap_zero(pchunk->bitmapbuf, sizeofbitmap);
2250−
22512246 pchunk->sizeofbitmap = sizeofbitmap;
22522247 /* each pble is 8 bytes hence shift by 3 */
22532248 pprm->total_pble_alloc += pchunk->size >> 3;
@@ -2491,3 +2486,18 @@ void irdma_ib_qp_event(struct irdma_qp *iwqp, enum irdma_qp_event_type event) · 237 unmodified lines
24912486 ibevent.element.qp = &iwqp->ibqp;
24922487 iwqp->ibqp.event_handler(&ibevent, iwqp->ibqp.qp_context);
24932488 }
2489+
2490+bool irdma_cq_empty(struct irdma_cq *iwcq)
2491+{
2492+ struct irdma_cq_uk *ukcq;
2493+ u64 qword3;
2494+ __le64 *cqe;
2495+ u8 polarity;
2496+
2497+ ukcq = &iwcq->sc_cq.cq_uk;
2498+ cqe = IRDMA_GET_CURRENT_CQ_ELEM(ukcq);
2499+ get_64bit_val(cqe, 24, &qword3);
2500+ polarity = (u8)FIELD_GET(IRDMA_CQ_VALID, qword3);
2501+
2502+ return polarity != ukcq->polarity;
2503+}
drivers/infiniband/hw/irdma/verbs.c+18−5
@@ -3584,18 +3584,31 @@ static int irdma_req_notify_cq(struct ib_cq *ibcq, · 3583 unmodified lines
35843584 struct irdma_cq *iwcq;
35853585 struct irdma_cq_uk *ukcq;
35863586 unsigned long flags;
3587− enum irdma_cmpl_notify cq_notify = IRDMA_CQ_COMPL_EVENT;
3587+ enum irdma_cmpl_notify cq_notify;
3588+ bool promo_event = false;
3589+ int ret = 0;
35883590
3591+ cq_notify = notify_flags == IB_CQ_SOLICITED ?
3592+ IRDMA_CQ_COMPL_SOLICITED : IRDMA_CQ_COMPL_EVENT;
35893593 iwcq = to_iwcq(ibcq);
35903594 ukcq = &iwcq->sc_cq.cq_uk;
3591− if (notify_flags == IB_CQ_SOLICITED)
3592− cq_notify = IRDMA_CQ_COMPL_SOLICITED;
35933595
35943596 spin_lock_irqsave(&iwcq->lock, flags);
3595− irdma_uk_cq_request_notification(ukcq, cq_notify);
3597+ /* Only promote to arm the CQ for any event if the last arm event was solicited. */
3598+ if (iwcq->last_notify == IRDMA_CQ_COMPL_SOLICITED && notify_flags != IB_CQ_SOLICITED)
3599+ promo_event = true;
3600+
3601+ if (!iwcq->armed || promo_event) {
3602+ iwcq->armed = true;
3603+ iwcq->last_notify = cq_notify;
3604+ irdma_uk_cq_request_notification(ukcq, cq_notify);
3605+ }
3606+
3607+ if ((notify_flags & IB_CQ_REPORT_MISSED_EVENTS) && !irdma_cq_empty(iwcq))
3608+ ret = 1;
35963609 spin_unlock_irqrestore(&iwcq->lock, flags);
35973610
3598− return 0;
3611+ return ret;
35993612 }
36003613
36013614 static int irdma_roce_port_immutable(struct ib_device *ibdev, u32 port_num,
drivers/infiniband/hw/irdma/verbs.h+2−0
@@ -110,6 +110,8 @@ struct irdma_cq { · 109 unmodified lines
110110 u16 cq_size;
111111 u16 cq_num;
112112 bool user_mode;
113+ bool armed;
114+ enum irdma_cmpl_notify last_notify;
113115 u32 polled_cmpls;
114116 u32 cq_mem_size;
115117 struct irdma_dma_mem kmem;
drivers/infiniband/hw/mlx5/mlx5_ib.h+3−3
@@ -665,7 +665,6 @@ struct mlx5_ib_mr { · 664 unmodified lines
665665
666666 /* User MR data */
667667 struct mlx5_cache_ent *cache_ent;
668− struct ib_umem *umem;
669668
670669 /* This is zero'd when the MR is allocated */
671670 union {
@@ -677,7 +676,7 @@ struct mlx5_ib_mr { · 5 unmodified lines
677676 struct list_head list;
678677 };
679678
680− /* Used only by kernel MRs (umem == NULL) */
679+ /* Used only by kernel MRs */
681680 struct {
682681 void *descs;
683682 void *descs_alloc;
@@ -698,8 +697,9 @@ struct mlx5_ib_mr { · 14 unmodified lines
698697 int data_length;
699698 };
700699
701− /* Used only by User MRs (umem != NULL) */
700+ /* Used only by User MRs */
702701 struct {
702+ struct ib_umem *umem;
703703 unsigned int page_shift;
704704 /* Current access_flags */
705705 int access_flags;
drivers/infiniband/hw/mlx5/mr.c+12−14
@@ -1904,19 +1904,18 @@ err: · 1903 unmodified lines
19041904 return ret;
19051905 }
19061906
1907−static void
1908−mlx5_free_priv_descs(struct mlx5_ib_mr *mr)
1907+static void mlx5_free_priv_descs(struct mlx5_ib_mr *mr)
19091908 {
1910− if (!mr->umem && mr->descs) {
1911− struct ib_device *device = mr->ibmr.device;
1912− int size = mr->max_descs * mr->desc_size;
1913− struct mlx5_ib_dev *dev = to_mdev(device);
1909+ struct mlx5_ib_dev *dev = to_mdev(mr->ibmr.device);
1910+ int size = mr->max_descs * mr->desc_size;
19141911
1915− dma_unmap_single(&dev->mdev->pdev->dev, mr->desc_map, size,
1916− DMA_TO_DEVICE);
1917− kfree(mr->descs_alloc);
1918− mr->descs = NULL;
1919− }
1912+ if (!mr->descs)
1913+ return;
1914+
1915+ dma_unmap_single(&dev->mdev->pdev->dev, mr->desc_map, size,
1916+ DMA_TO_DEVICE);
1917+ kfree(mr->descs_alloc);
1918+ mr->descs = NULL;
19201919 }
19211920
19221921 int mlx5_ib_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)
@@ -1992,7 +1991,8 @@ int mlx5_ib_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) · 69 unmodified lines
19921991 if (mr->cache_ent) {
19931992 mlx5_mr_cache_free(dev, mr);
19941993 } else {
1995− mlx5_free_priv_descs(mr);
1994+ if (!udata)
1995+ mlx5_free_priv_descs(mr);
19961996 kfree(mr);
19971997 }
19981998 return 0;
@@ -2079,7 +2079,6 @@ static struct mlx5_ib_mr *mlx5_ib_alloc_pi_mr(struct ib_pd *pd, · 80 unmodified lines
20792079 if (err)
20802080 goto err_free_in;
20812081
2082− mr->umem = NULL;
20832082 kfree(in);
20842083
20852084 return mr;
@@ -2206,7 +2205,6 @@ static struct ib_mr *__mlx5_ib_alloc_mr(struct ib_pd *pd, · 120 unmodified lines
22062205 }
22072206
22082207 mr->ibmr.device = pd->device;
2209− mr->umem = NULL;
22102208
22112209 switch (mr_type) {
22122210 case IB_MR_TYPE_MEM_REG:
drivers/infiniband/sw/rxe/rxe_qp.c+1−0
@@ -359,6 +359,7 @@ int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd, · 358 unmodified lines
359359
360360 err2:
361361 rxe_queue_cleanup(qp->sq.queue);
362+ qp->sq.queue = NULL;
362363 err1:
363364 qp->pd = NULL;
364365 qp->rcq = NULL;
drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c+6−3
@@ -19,7 +19,7 @@ void rtrs_clt_update_wc_stats(struct rtrs_clt_con *con) · 18 unmodified lines
1919 int cpu;
2020
2121 cpu = raw_smp_processor_id();
22− s = this_cpu_ptr(stats->pcpu_stats);
22+ s = get_cpu_ptr(stats->pcpu_stats);
2323 if (con->cpu != cpu) {
2424 s->cpu_migr.to++;
2525
@@ -27,14 +27,16 @@ void rtrs_clt_update_wc_stats(struct rtrs_clt_con *con) · 1 unmodified line
2727 s = per_cpu_ptr(stats->pcpu_stats, con->cpu);
2828 atomic_inc(&s->cpu_migr.from);
2929 }
30+ put_cpu_ptr(stats->pcpu_stats);
3031 }
3132
3233 void rtrs_clt_inc_failover_cnt(struct rtrs_clt_stats *stats)
3334 {
3435 struct rtrs_clt_stats_pcpu *s;
3536
36− s = this_cpu_ptr(stats->pcpu_stats);
37+ s = get_cpu_ptr(stats->pcpu_stats);
3738 s->rdma.failover_cnt++;
39+ put_cpu_ptr(stats->pcpu_stats);
3840 }
3941
4042 int rtrs_clt_stats_migration_from_cnt_to_str(struct rtrs_clt_stats *stats, char *buf)
@@ -169,9 +171,10 @@ static inline void rtrs_clt_update_rdma_stats(struct rtrs_clt_stats *stats, · 128 unmodified lines
169171 {
170172 struct rtrs_clt_stats_pcpu *s;
171173
172− s = this_cpu_ptr(stats->pcpu_stats);
174+ s = get_cpu_ptr(stats->pcpu_stats);
173175 s->rdma.dir[d].cnt++;
174176 s->rdma.dir[d].size_total += size;
177+ put_cpu_ptr(stats->pcpu_stats);
175178 }
176179
177180 void rtrs_clt_update_all_stats(struct rtrs_clt_io_req *req, int dir)
drivers/irqchip/irq-apple-aic.c+1−1
@@ -707,7 +707,7 @@ static const struct irq_domain_ops aic_ipi_domain_ops = { · 706 unmodified lines
707707 .free = aic_ipi_free,
708708 };
709709
710−static int aic_init_smp(struct aic_irq_chip *irqc, struct device_node *node)
710+static int __init aic_init_smp(struct aic_irq_chip *irqc, struct device_node *node)
711711 {
712712 struct irq_domain *ipi_domain;
713713 int base_ipi;
drivers/irqchip/irq-armada-370-xp.c+6−10
@@ -232,16 +232,12 @@ static int armada_370_xp_msi_alloc(struct irq_domain *domain, unsigned int virq, · 231 unmodified lines
232232 int hwirq, i;
233233
234234 mutex_lock(&msi_used_lock);
235+ hwirq = bitmap_find_free_region(msi_used, PCI_MSI_DOORBELL_NR,
236+ order_base_2(nr_irqs));
237+ mutex_unlock(&msi_used_lock);
235238
236− hwirq = bitmap_find_next_zero_area(msi_used, PCI_MSI_DOORBELL_NR,
237− 0, nr_irqs, 0);
238− if (hwirq >= PCI_MSI_DOORBELL_NR) {
239− mutex_unlock(&msi_used_lock);
239+ if (hwirq < 0)
240240 return -ENOSPC;
241− }
242−
243− bitmap_set(msi_used, hwirq, nr_irqs);
244− mutex_unlock(&msi_used_lock);
245241
246242 for (i = 0; i < nr_irqs; i++) {
247243 irq_domain_set_info(domain, virq + i, hwirq + i,
@@ -250,7 +246,7 @@ static int armada_370_xp_msi_alloc(struct irq_domain *domain, unsigned int virq, · 2 unmodified lines
250246 NULL, NULL);
251247 }
252248
253− return hwirq;
249+ return 0;
254250 }
255251
256252 static void armada_370_xp_msi_free(struct irq_domain *domain,
@@ -259,7 +255,7 @@ static void armada_370_xp_msi_free(struct irq_domain *domain, · 2 unmodified lines
259255 struct irq_data *d = irq_domain_get_irq_data(domain, virq);
260256
261257 mutex_lock(&msi_used_lock);
262− bitmap_clear(msi_used, d->hwirq, nr_irqs);
258+ bitmap_release_region(msi_used, d->hwirq, order_base_2(nr_irqs));
263259 mutex_unlock(&msi_used_lock);
264260 }
265261
drivers/irqchip/irq-aspeed-scu-ic.c+2−2
@@ -76,8 +76,8 @@ static void aspeed_scu_ic_irq_handler(struct irq_desc *desc) · 75 unmodified lines
7676 generic_handle_domain_irq(scu_ic->irq_domain,
7777 bit - scu_ic->irq_shift);
7878
79− regmap_update_bits(scu_ic->scu, scu_ic->reg, mask,
80− BIT(bit + ASPEED_SCU_IC_STATUS_SHIFT));
79+ regmap_write_bits(scu_ic->scu, scu_ic->reg, mask,
80+ BIT(bit + ASPEED_SCU_IC_STATUS_SHIFT));
8181 }
8282
8383 chained_irq_exit(chip, desc);
drivers/irqchip/irq-bcm7120-l2.c+1−0
@@ -238,6 +238,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn, · 237 unmodified lines
238238 }
239239
240240 data->num_parent_irqs = platform_irq_count(pdev);
241+ put_device(&pdev->dev);
241242 if (data->num_parent_irqs <= 0) {
242243 pr_err("invalid number of parent interrupts\n");
243244 ret = -ENOMEM;
drivers/irqchip/irq-gic-v3-its.c+1−1
@@ -742,7 +742,7 @@ static struct its_collection *its_build_invall_cmd(struct its_node *its, · 741 unmodified lines
742742
743743 its_fixup_cmd(cmd);
744744
745− return NULL;
745+ return desc->its_invall_cmd.col;
746746 }
747747
748748 static struct its_vpe *its_build_vinvall_cmd(struct its_node *its,
drivers/irqchip/irq-mips-gic.c+2−2
@@ -9,6 +9,7 @@ · 8 unmodified lines
99
1010 #define pr_fmt(fmt) "irq-mips-gic: " fmt
1111
12+#include <linux/bitfield.h>
1213 #include <linux/bitmap.h>
1314 #include <linux/clocksource.h>
1415 #include <linux/cpuhotplug.h>
@@ -735,8 +736,7 @@ static int __init gic_of_init(struct device_node *node, · 720 unmodified lines
735736 mips_gic_base = ioremap(gic_base, gic_len);
736737
737738 gicconfig = read_gic_config();
738− gic_shared_intrs = gicconfig & GIC_CONFIG_NUMINTERRUPTS;
739− gic_shared_intrs >>= __ffs(GIC_CONFIG_NUMINTERRUPTS);
739+ gic_shared_intrs = FIELD_GET(GIC_CONFIG_NUMINTERRUPTS, gicconfig);
740740 gic_shared_intrs = (gic_shared_intrs + 1) * 8;
741741
742742 if (cpu_has_veic) {
drivers/irqchip/irq-nvic.c+1−1
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626
2727 #define NVIC_ISER 0x000
2828 #define NVIC_ICER 0x080
29−#define NVIC_IPR 0x300
29+#define NVIC_IPR 0x400
3030
3131 #define NVIC_MAX_BANKS 16
3232 /*
drivers/md/dm-integrity.c+1−1
@@ -1963,7 +1963,7 @@ static bool __journal_read_write(struct dm_integrity_io *dio, struct bio *bio, · 1962 unmodified lines
19631963 n_sectors -= bv.bv_len >> SECTOR_SHIFT;
19641964 bio_advance_iter(bio, &bio->bi_iter, bv.bv_len);
19651965 retry_kmap:
1966− mem = bvec_kmap_local(&bv);
1966+ mem = kmap_local_page(bv.bv_page);
19671967 if (likely(dio->op == REQ_OP_WRITE))
19681968 flush_dcache_page(bv.bv_page);
19691969
drivers/md/md.c+3−1
@@ -2189,6 +2189,7 @@ super_1_rdev_size_change(struct md_rdev *rdev, sector_t num_sectors) · 2188 unmodified lines
21892189
21902190 if (!num_sectors || num_sectors > max_sectors)
21912191 num_sectors = max_sectors;
2192+ rdev->sb_start = sb_start;
21922193 }
21932194 sb = page_address(rdev->sb_page);
21942195 sb->data_size = cpu_to_le64(num_sectors);
@@ -6270,7 +6271,8 @@ static void __md_stop(struct mddev *mddev) · 4075 unmodified lines
62706271 spin_lock(&mddev->lock);
62716272 mddev->pers = NULL;
62726273 spin_unlock(&mddev->lock);
6273− pers->free(mddev, mddev->private);
6274+ if (mddev->private)
6275+ pers->free(mddev, mddev->private);
62746276 mddev->private = NULL;
62756277 if (pers->sync_request && mddev->to_remove == NULL)
62766278 mddev->to_remove = &md_redundancy_group;
drivers/md/persistent-data/dm-btree-remove.c+1−1
@@ -423,9 +423,9 @@ static int rebalance_children(struct shadow_spine *s, · 422 unmodified lines
423423
424424 memcpy(n, dm_block_data(child),
425425 dm_bm_block_size(dm_tm_get_bm(info->tm)));
426− dm_tm_unlock(info->tm, child);
427426
428427 dm_tm_dec(info->tm, dm_block_location(child));
428+ dm_tm_unlock(info->tm, child);
429429 return 0;
430430 }
431431
drivers/misc/cardreader/rtsx_pcr.c+0−4
@@ -1803,8 +1803,6 @@ static int rtsx_pci_runtime_suspend(struct device *device) · 1802 unmodified lines
18031803 mutex_lock(&pcr->pcr_mutex);
18041804 rtsx_pci_power_off(pcr, HOST_ENTER_S3);
18051805
1806− free_irq(pcr->irq, (void *)pcr);
1807−
18081806 mutex_unlock(&pcr->pcr_mutex);
18091807
18101808 pcr->is_runtime_suspended = true;
@@ -1825,8 +1823,6 @@ static int rtsx_pci_runtime_resume(struct device *device) · 14 unmodified lines
18251823 mutex_lock(&pcr->pcr_mutex);
18261824
18271825 rtsx_pci_write_register(pcr, HOST_SLEEP_STATE, 0x03, 0x00);
1828− rtsx_pci_acquire_irq(pcr);
1829− synchronize_irq(pcr->irq);
18301826
18311827 if (pcr->ops->fetch_vendor_settings)
18321828 pcr->ops->fetch_vendor_settings(pcr);
drivers/misc/eeprom/at25.c+18−20
@@ -376,7 +376,6 @@ MODULE_DEVICE_TABLE(spi, at25_spi_ids); · 375 unmodified lines
376376 static int at25_probe(struct spi_device *spi)
377377 {
378378 struct at25_data *at25 = NULL;
379− struct spi_eeprom chip;
380379 int err;
381380 int sr;
382381 u8 id[FM25_ID_LEN];
@@ -389,15 +388,18 @@ static int at25_probe(struct spi_device *spi) · 6 unmodified lines
389388 if (match && !strcmp(match->compatible, "cypress,fm25"))
390389 is_fram = 1;
391390
391+ at25 = devm_kzalloc(&spi->dev, sizeof(struct at25_data), GFP_KERNEL);
392+ if (!at25)
393+ return -ENOMEM;
394+
392395 /* Chip description */
393− if (!spi->dev.platform_data) {
394− if (!is_fram) {
395− err = at25_fw_to_chip(&spi->dev, &chip);
396− if (err)
397− return err;
398− }
399− } else
400− chip = *(struct spi_eeprom *)spi->dev.platform_data;
396+ if (spi->dev.platform_data) {
397+ memcpy(&at25->chip, spi->dev.platform_data, sizeof(at25->chip));
398+ } else if (!is_fram) {
399+ err = at25_fw_to_chip(&spi->dev, &at25->chip);
400+ if (err)
401+ return err;
402+ }
401403
402404 /* Ping the chip ... the status register is pretty portable,
403405 * unlike probing manufacturer IDs. We do expect that system
@@ -409,12 +411,7 @@ static int at25_probe(struct spi_device *spi) · 5 unmodified lines
409411 return -ENXIO;
410412 }
411413
412− at25 = devm_kzalloc(&spi->dev, sizeof(struct at25_data), GFP_KERNEL);
413− if (!at25)
414− return -ENOMEM;
415−
416414 mutex_init(&at25->lock);
417− at25->chip = chip;
418415 at25->spi = spi;
419416 spi_set_drvdata(spi, at25);
420417
@@ -431,7 +428,7 @@ static int at25_probe(struct spi_device *spi) · 10 unmodified lines
431428 dev_err(&spi->dev, "Error: unsupported size (id %02x)\n", id[7]);
432429 return -ENODEV;
433430 }
434− chip.byte_len = int_pow(2, id[7] - 0x21 + 4) * 1024;
431+ at25->chip.byte_len = int_pow(2, id[7] - 0x21 + 4) * 1024;
435432
436433 if (at25->chip.byte_len > 64 * 1024)
437434 at25->chip.flags |= EE_ADDR3;
@@ -464,7 +461,7 @@ static int at25_probe(struct spi_device *spi) · 26 unmodified lines
464461 at25->nvmem_config.type = is_fram ? NVMEM_TYPE_FRAM : NVMEM_TYPE_EEPROM;
465462 at25->nvmem_config.name = dev_name(&spi->dev);
466463 at25->nvmem_config.dev = &spi->dev;
467− at25->nvmem_config.read_only = chip.flags & EE_READONLY;
464+ at25->nvmem_config.read_only = at25->chip.flags & EE_READONLY;
468465 at25->nvmem_config.root_only = true;
469466 at25->nvmem_config.owner = THIS_MODULE;
470467 at25->nvmem_config.compat = true;
@@ -474,17 +471,18 @@ static int at25_probe(struct spi_device *spi) · 3 unmodified lines
474471 at25->nvmem_config.priv = at25;
475472 at25->nvmem_config.stride = 1;
476473 at25->nvmem_config.word_size = 1;
477− at25->nvmem_config.size = chip.byte_len;
474+ at25->nvmem_config.size = at25->chip.byte_len;
478475
479476 at25->nvmem = devm_nvmem_register(&spi->dev, &at25->nvmem_config);
480477 if (IS_ERR(at25->nvmem))
481478 return PTR_ERR(at25->nvmem);
482479
483480 dev_info(&spi->dev, "%d %s %s %s%s, pagesize %u\n",
484− (chip.byte_len < 1024) ? chip.byte_len : (chip.byte_len / 1024),
485− (chip.byte_len < 1024) ? "Byte" : "KByte",
481+ (at25->chip.byte_len < 1024) ?
482+ at25->chip.byte_len : (at25->chip.byte_len / 1024),
483+ (at25->chip.byte_len < 1024) ? "Byte" : "KByte",
486484 at25->chip.name, is_fram ? "fram" : "eeprom",
487− (chip.flags & EE_READONLY) ? " (readonly)" : "",
485+ (at25->chip.flags & EE_READONLY) ? " (readonly)" : "",
488486 at25->chip.page_size);
489487 return 0;
490488 }
drivers/misc/fastrpc.c+6−4
@@ -719,16 +719,18 @@ static int fastrpc_get_meta_size(struct fastrpc_invoke_ctx *ctx) · 718 unmodified lines
719719 static u64 fastrpc_get_payload_size(struct fastrpc_invoke_ctx *ctx, int metalen)
720720 {
721721 u64 size = 0;
722− int i;
722+ int oix;
723723
724724 size = ALIGN(metalen, FASTRPC_ALIGN);
725− for (i = 0; i < ctx->nscalars; i++) {
725+ for (oix = 0; oix < ctx->nbufs; oix++) {
726+ int i = ctx->olaps[oix].raix;
727+
726728 if (ctx->args[i].fd == 0 || ctx->args[i].fd == -1) {
727729
728− if (ctx->olaps[i].offset == 0)
730+ if (ctx->olaps[oix].offset == 0)
729731 size = ALIGN(size, FASTRPC_ALIGN);
730732
731− size += (ctx->olaps[i].mend - ctx->olaps[i].mstart);
733+ size += (ctx->olaps[oix].mend - ctx->olaps[oix].mstart);
732734 }
733735 }
734736
drivers/mmc/host/mtk-sd.c+3−1
@@ -2291,8 +2291,10 @@ static int msdc_execute_hs400_tuning(struct mmc_host *mmc, struct mmc_card *card · 2290 unmodified lines
22912291 sdr_set_field(host->base + PAD_DS_TUNE,
22922292 PAD_DS_TUNE_DLY1, i);
22932293 ret = mmc_get_ext_csd(card, &ext_csd);
2294− if (!ret)
2294+ if (!ret) {
22952295 result_dly1 |= (1 << i);
2296+ kfree(ext_csd);
2297+ }
22962298 }
22972299 host->hs400_tuning = false;
22982300
drivers/mmc/host/renesas_sdhi_core.c+1−1
@@ -673,7 +673,7 @@ static int renesas_sdhi_execute_tuning(struct mmc_host *mmc, u32 opcode) · 672 unmodified lines
673673
674674 /* Issue CMD19 twice for each tap */
675675 for (i = 0; i < 2 * priv->tap_num; i++) {
676− int cmd_error;
676+ int cmd_error = 0;
677677
678678 /* Set sampling clock position */
679679 sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TAPSET, i % priv->tap_num);
drivers/net/dsa/mv88e6xxx/chip.c+4−0
@@ -768,6 +768,10 @@ static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port, · 767 unmodified lines
768768 if ((!mv88e6xxx_port_ppu_updates(chip, port) ||
769769 mode == MLO_AN_FIXED) && ops->port_sync_link)
770770 err = ops->port_sync_link(chip, port, mode, false);
771+
772+ if (!err && ops->port_set_speed_duplex)
773+ err = ops->port_set_speed_duplex(chip, port, SPEED_UNFORCED,
774+ DUPLEX_UNFORCED);
771775 mv88e6xxx_reg_unlock(chip);
772776
773777 if (err)
drivers/net/dsa/mv88e6xxx/port.c+2−2
@@ -283,7 +283,7 @@ static int mv88e6xxx_port_set_speed_duplex(struct mv88e6xxx_chip *chip, · 282 unmodified lines
283283 if (err)
284284 return err;
285285
286− if (speed)
286+ if (speed != SPEED_UNFORCED)
287287 dev_dbg(chip->dev, "p%d: Speed set to %d Mbps\n", port, speed);
288288 else
289289 dev_dbg(chip->dev, "p%d: Speed unforced\n", port);
@@ -516,7 +516,7 @@ int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, · 226 unmodified lines
516516 if (err)
517517 return err;
518518
519− if (speed)
519+ if (speed != SPEED_UNFORCED)
520520 dev_dbg(chip->dev, "p%d: Speed set to %d Mbps\n", port, speed);
521521 else
522522 dev_dbg(chip->dev, "p%d: Speed unforced\n", port);
drivers/net/ethernet/broadcom/bcmsysport.c+4−1
@@ -1309,11 +1309,11 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb, · 1308 unmodified lines
13091309 struct bcm_sysport_priv *priv = netdev_priv(dev);
13101310 struct device *kdev = &priv->pdev->dev;
13111311 struct bcm_sysport_tx_ring *ring;
1312+ unsigned long flags, desc_flags;
13121313 struct bcm_sysport_cb *cb;
13131314 struct netdev_queue *txq;
13141315 u32 len_status, addr_lo;
13151316 unsigned int skb_len;
1316− unsigned long flags;
13171317 dma_addr_t mapping;
13181318 u16 queue;
13191319 int ret;
@@ -1373,8 +1373,10 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb, · 53 unmodified lines
13731373 ring->desc_count--;
13741374
13751375 /* Ports are latched, so write upper address first */
1376+ spin_lock_irqsave(&priv->desc_lock, desc_flags);
13761377 tdma_writel(priv, len_status, TDMA_WRITE_PORT_HI(ring->index));
13771378 tdma_writel(priv, addr_lo, TDMA_WRITE_PORT_LO(ring->index));
1379+ spin_unlock_irqrestore(&priv->desc_lock, desc_flags);
13781380
13791381 /* Check ring space and update SW control flow */
13801382 if (ring->desc_count == 0)
@@ -2013,6 +2015,7 @@ static int bcm_sysport_open(struct net_device *dev) · 632 unmodified lines
20132015 }
20142016
20152017 /* Initialize both hardware and software ring */
2018+ spin_lock_init(&priv->desc_lock);
20162019 for (i = 0; i < dev->num_tx_queues; i++) {
20172020 ret = bcm_sysport_init_tx_ring(priv, i);
20182021 if (ret) {
drivers/net/ethernet/broadcom/bcmsysport.h+1−0
@@ -711,6 +711,7 @@ struct bcm_sysport_priv { · 710 unmodified lines
711711 int wol_irq;
712712
713713 /* Transmit rings */
714+ spinlock_t desc_lock;
714715 struct bcm_sysport_tx_ring *tx_rings;
715716
716717 /* Receive queue */
drivers/net/ethernet/broadcom/genet/bcmmii.c+2−2
@@ -589,9 +589,9 @@ static int bcmgenet_mii_pd_init(struct bcmgenet_priv *priv) · 588 unmodified lines
589589 * Internal or external PHY with MDIO access
590590 */
591591 phydev = phy_attach(priv->dev, phy_name, pd->phy_interface);
592− if (!phydev) {
592+ if (IS_ERR(phydev)) {
593593 dev_err(kdev, "failed to register PHY device\n");
594− return -ENODEV;
594+ return PTR_ERR(phydev);
595595 }
596596 } else {
597597 /*
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h+2−0
@@ -388,6 +388,8 @@ struct dpaa2_eth_ch_stats { · 387 unmodified lines
388388 __u64 bytes_per_cdan;
389389 };
390390
391+#define DPAA2_ETH_CH_STATS 7
392+
391393 /* Maximum number of queues associated with a DPNI */
392394 #define DPAA2_ETH_MAX_TCS 8
393395 #define DPAA2_ETH_MAX_RX_QUEUES_PER_TC 16
drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c+1−1
@@ -278,7 +278,7 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev, · 277 unmodified lines
278278 /* Per-channel stats */
279279 for (k = 0; k < priv->num_channels; k++) {
280280 ch_stats = &priv->channel[k]->stats;
281− for (j = 0; j < sizeof(*ch_stats) / sizeof(__u64) - 1; j++)
281+ for (j = 0; j < DPAA2_ETH_CH_STATS; j++)
282282 *((__u64 *)data + i + j) += *((__u64 *)ch_stats + j);
283283 }
284284 i += j;
drivers/net/ethernet/hisilicon/hns3/hnae3.h+2−0
@@ -839,6 +839,8 @@ struct hnae3_handle { · 838 unmodified lines
839839
840840 u8 netdev_flags;
841841 struct dentry *hnae3_dbgfs;
842+ /* protects concurrent contention between debugfs commands */
843+ struct mutex dbgfs_lock;
842844
843845 /* Network interface message level enabled bits */
844846 u32 msg_enable;
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c+14−6
@@ -1226,6 +1226,7 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer, · 1225 unmodified lines
12261226 if (ret)
12271227 return ret;
12281228
1229+ mutex_lock(&handle->dbgfs_lock);
12291230 save_buf = &hns3_dbg_cmd[index].buf;
12301231
12311232 if (!test_bit(HNS3_NIC_STATE_INITED, &priv->state) ||
@@ -1238,15 +1239,15 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer, · 6 unmodified lines
12381239 read_buf = *save_buf;
12391240 } else {
12401241 read_buf = kvzalloc(hns3_dbg_cmd[index].buf_len, GFP_KERNEL);
1241− if (!read_buf)
1242− return -ENOMEM;
1242+ if (!read_buf) {
1243+ ret = -ENOMEM;
1244+ goto out;
1245+ }
12431246
12441247 /* save the buffer addr until the last read operation */
12451248 *save_buf = read_buf;
1246− }
12471249
1248− /* get data ready for the first time to read */
1249− if (!*ppos) {
1250+ /* get data ready for the first time to read */
12501251 ret = hns3_dbg_read_cmd(dbg_data, hns3_dbg_cmd[index].cmd,
12511252 read_buf, hns3_dbg_cmd[index].buf_len);
12521253 if (ret)
@@ -1255,8 +1256,10 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer, · 2 unmodified lines
12551256
12561257 size = simple_read_from_buffer(buffer, count, ppos, read_buf,
12571258 strlen(read_buf));
1258− if (size > 0)
1259+ if (size > 0) {
1260+ mutex_unlock(&handle->dbgfs_lock);
12591261 return size;
1262+ }
12601263
12611264 out:
12621265 /* free the buffer for the last read operation */
@@ -1265,6 +1268,7 @@ out: · 2 unmodified lines
12651268 *save_buf = NULL;
12661269 }
12671270
1271+ mutex_unlock(&handle->dbgfs_lock);
12681272 return ret;
12691273 }
12701274
@@ -1337,6 +1341,8 @@ int hns3_dbg_init(struct hnae3_handle *handle) · 66 unmodified lines
13371341 debugfs_create_dir(hns3_dbg_dentry[i].name,
13381342 handle->hnae3_dbgfs);
13391343
1344+ mutex_init(&handle->dbgfs_lock);
1345+
13401346 for (i = 0; i < ARRAY_SIZE(hns3_dbg_cmd); i++) {
13411347 if ((hns3_dbg_cmd[i].cmd == HNAE3_DBG_CMD_TM_NODES &&
13421348 ae_dev->dev_version <= HNAE3_DEVICE_VERSION_V2) ||
@@ -1363,6 +1369,7 @@ int hns3_dbg_init(struct hnae3_handle *handle) · 20 unmodified lines
13631369 return 0;
13641370
13651371 out:
1372+ mutex_destroy(&handle->dbgfs_lock);
13661373 debugfs_remove_recursive(handle->hnae3_dbgfs);
13671374 handle->hnae3_dbgfs = NULL;
13681375 return ret;
@@ -1378,6 +1385,7 @@ void hns3_dbg_uninit(struct hnae3_handle *handle) · 9 unmodified lines
13781385 hns3_dbg_cmd[i].buf = NULL;
13791386 }
13801387
1388+ mutex_destroy(&handle->dbgfs_lock);
13811389 debugfs_remove_recursive(handle->hnae3_dbgfs);
13821390 handle->hnae3_dbgfs = NULL;
13831391 }
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c+2−1
@@ -114,7 +114,8 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev, · 113 unmodified lines
114114
115115 memcpy(&req->msg, send_msg, sizeof(struct hclge_vf_to_pf_msg));
116116
117− trace_hclge_vf_mbx_send(hdev, req);
117+ if (test_bit(HCLGEVF_STATE_NIC_REGISTERED, &hdev->state))
118+ trace_hclge_vf_mbx_send(hdev, req);
118119
119120 /* synchronous send */
120121 if (need_resp) {
drivers/net/ethernet/intel/iavf/iavf_main.c+2−3
@@ -2046,6 +2046,7 @@ static void iavf_watchdog_task(struct work_struct *work) · 2045 unmodified lines
20462046 }
20472047 adapter->aq_required = 0;
20482048 adapter->current_op = VIRTCHNL_OP_UNKNOWN;
2049+ mutex_unlock(&adapter->crit_lock);
20492050 queue_delayed_work(iavf_wq,
20502051 &adapter->watchdog_task,
20512052 msecs_to_jiffies(10));
@@ -2076,16 +2077,14 @@ static void iavf_watchdog_task(struct work_struct *work) · 24 unmodified lines
20762077 iavf_detect_recover_hung(&adapter->vsi);
20772078 break;
20782079 case __IAVF_REMOVE:
2079− mutex_unlock(&adapter->crit_lock);
2080− return;
20812080 default:
2081+ mutex_unlock(&adapter->crit_lock);
20822082 return;
20832083 }
20842084
20852085 /* check for hw reset */
20862086 reg_val = rd32(hw, IAVF_VF_ARQLEN1) & IAVF_VF_ARQLEN1_ARQENABLE_MASK;
20872087 if (!reg_val) {
2088− iavf_change_state(adapter, __IAVF_RESETTING);
20892088 adapter->flags |= IAVF_FLAG_RESET_PENDING;
20902089 adapter->aq_required = 0;
20912090 adapter->current_op = VIRTCHNL_OP_UNKNOWN;
drivers/net/ethernet/intel/ice/ice_ptp.c+5−8
@@ -705,7 +705,7 @@ static int ice_ptp_adjfine(struct ptp_clock_info *info, long scaled_ppm) · 704 unmodified lines
705705 scaled_ppm = -scaled_ppm;
706706 }
707707
708− while ((u64)scaled_ppm > div_u64(U64_MAX, incval)) {
708+ while ((u64)scaled_ppm > div64_u64(U64_MAX, incval)) {
709709 /* handle overflow by scaling down the scaled_ppm and
710710 * the divisor, losing some precision
711711 */
@@ -1536,19 +1536,16 @@ static void ice_ptp_tx_tstamp_work(struct kthread_work *work) · 824 unmodified lines
15361536 if (err)
15371537 continue;
15381538
1539− /* Check if the timestamp is valid */
1540− if (!(raw_tstamp & ICE_PTP_TS_VALID))
1539+ /* Check if the timestamp is invalid or stale */
1540+ if (!(raw_tstamp & ICE_PTP_TS_VALID) ||
1541+ raw_tstamp == tx->tstamps[idx].cached_tstamp)
15411542 continue;
15421543
1543− /* clear the timestamp register, so that it won't show valid
1544− * again when re-used.
1545− */
1546− ice_clear_phy_tstamp(hw, tx->quad, phy_idx);
1547−
15481544 /* The timestamp is valid, so we'll go ahead and clear this
15491545 * index and then send the timestamp up to the stack.
15501546 */
15511547 spin_lock(&tx->lock);
1548+ tx->tstamps[idx].cached_tstamp = raw_tstamp;
15521549 clear_bit(idx, tx->in_use);
15531550 skb = tx->tstamps[idx].skb;
15541551 tx->tstamps[idx].skb = NULL;
drivers/net/ethernet/intel/ice/ice_ptp.h+6−0
@@ -55,15 +55,21 @@ struct ice_perout_channel { · 54 unmodified lines
5555 * struct ice_tx_tstamp - Tracking for a single Tx timestamp
5656 * @skb: pointer to the SKB for this timestamp request
5757 * @start: jiffies when the timestamp was first requested
58+ * @cached_tstamp: last read timestamp
5859 *
5960 * This structure tracks a single timestamp request. The SKB pointer is
6061 * provided when initiating a request. The start time is used to ensure that
6162 * we discard old requests that were not fulfilled within a 2 second time
6263 * window.
64+ * Timestamp values in the PHY are read only and do not get cleared except at
65+ * hardware reset or when a new timestamp value is captured. The cached_tstamp
66+ * field is used to detect the case where a new timestamp has not yet been
67+ * captured, ensuring that we avoid sending stale timestamp data to the stack.
6368 */
6469 struct ice_tx_tstamp {
6570 struct sk_buff *skb;
6671 unsigned long start;
72+ u64 cached_tstamp;
6773 };
6874
6975 /**
drivers/net/ethernet/intel/igb/igb_main.c+14−14
@@ -7648,6 +7648,20 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf, · 7647 unmodified lines
76487648 struct vf_mac_filter *entry = NULL;
76497649 int ret = 0;
76507650
7651+ if ((vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) &&
7652+ !vf_data->trusted) {
7653+ dev_warn(&pdev->dev,
7654+ "VF %d requested MAC filter but is administratively denied\n",
7655+ vf);
7656+ return -EINVAL;
7657+ }
7658+ if (!is_valid_ether_addr(addr)) {
7659+ dev_warn(&pdev->dev,
7660+ "VF %d attempted to set invalid MAC filter\n",
7661+ vf);
7662+ return -EINVAL;
7663+ }
7664+
76517665 switch (info) {
76527666 case E1000_VF_MAC_FILTER_CLR:
76537667 /* remove all unicast MAC filters related to the current VF */
@@ -7661,20 +7675,6 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf, · 7 unmodified lines
76617675 }
76627676 break;
76637677 case E1000_VF_MAC_FILTER_ADD:
7664− if ((vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) &&
7665− !vf_data->trusted) {
7666− dev_warn(&pdev->dev,
7667− "VF %d requested MAC filter but is administratively denied\n",
7668− vf);
7669− return -EINVAL;
7670− }
7671− if (!is_valid_ether_addr(addr)) {
7672− dev_warn(&pdev->dev,
7673− "VF %d attempted to set invalid MAC filter\n",
7674− vf);
7675− return -EINVAL;
7676− }
7677−
76787678 /* try to find empty slot in the list */
76797679 list_for_each(pos, &adapter->vf_macs.l) {
76807680 entry = list_entry(pos, struct vf_mac_filter, l);
drivers/net/ethernet/intel/igbvf/netdev.c+1−0
@@ -2859,6 +2859,7 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 2858 unmodified lines
28592859 return 0;
28602860
28612861 err_hw_init:
2862+ netif_napi_del(&adapter->rx_ring->napi);
28622863 kfree(adapter->tx_ring);
28632864 kfree(adapter->rx_ring);
28642865 err_sw_init:
drivers/net/ethernet/intel/igc/igc_i225.c+1−1
@@ -636,7 +636,7 @@ s32 igc_set_ltr_i225(struct igc_hw *hw, bool link) · 635 unmodified lines
636636 ltrv = rd32(IGC_LTRMAXV);
637637 if (ltr_max != (ltrv & IGC_LTRMAXV_LTRV_MASK)) {
638638 ltrv = IGC_LTRMAXV_LSNP_REQ | ltr_max |
639− (scale_min << IGC_LTRMAXV_SCALE_SHIFT);
639+ (scale_max << IGC_LTRMAXV_SCALE_SHIFT);
640640 wr32(IGC_LTRMAXV, ltrv);
641641 }
642642 }
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+4−0
@@ -5531,6 +5531,10 @@ static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw) · 5530 unmodified lines
55315531 if (!speed && hw->mac.ops.get_link_capabilities) {
55325532 ret = hw->mac.ops.get_link_capabilities(hw, &speed,
55335533 &autoneg);
5534+ /* remove NBASE-T speeds from default autonegotiation
5535+ * to accommodate broken network switches in the field
5536+ * which cannot cope with advertised NBASE-T speeds
5537+ */
55345538 speed &= ~(IXGBE_LINK_SPEED_5GB_FULL |
55355539 IXGBE_LINK_SPEED_2_5GB_FULL);
55365540 }
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c+3−0
@@ -3405,6 +3405,9 @@ static s32 ixgbe_reset_hw_X550em(struct ixgbe_hw *hw) · 3404 unmodified lines
34053405 /* flush pending Tx transactions */
34063406 ixgbe_clear_tx_pending(hw);
34073407
3408+ /* set MDIO speed before talking to the PHY in case it's the 1st time */
3409+ ixgbe_set_mdio_speed(hw);
3410+
34083411 /* PHY ops must be identified and initialized prior to reset */
34093412 status = hw->phy.ops.init(hw);
34103413 if (status == IXGBE_ERR_SFP_NOT_SUPPORTED ||
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+2−1
@@ -8505,7 +8505,8 @@ mlxsw_sp_rif_mac_profile_replace(struct mlxsw_sp *mlxsw_sp, · 8504 unmodified lines
85058505 u8 mac_profile;
85068506 int err;
85078507
8508− if (!mlxsw_sp_rif_mac_profile_is_shared(rif))
8508+ if (!mlxsw_sp_rif_mac_profile_is_shared(rif) &&
8509+ !mlxsw_sp_rif_mac_profile_find(mlxsw_sp, new_mac))
85098510 return mlxsw_sp_rif_mac_profile_edit(rif, new_mac);
85108511
85118512 err = mlxsw_sp_rif_mac_profile_get(mlxsw_sp, new_mac,
drivers/net/ethernet/sfc/ef100_nic.c+3−0
@@ -609,6 +609,9 @@ static size_t ef100_update_stats(struct efx_nic *efx, · 608 unmodified lines
609609 ef100_common_stat_mask(mask);
610610 ef100_ethtool_stat_mask(mask);
611611
612+ if (!mc_stats)
613+ return 0;
614+
612615 efx_nic_copy_stats(efx, mc_stats);
613616 efx_nic_update_stats(ef100_stat_desc, EF100_STAT_COUNT, mask,
614617 stats, mc_stats, false);
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c+3−1
@@ -33,6 +33,7 @@ struct rk_gmac_ops { · 32 unmodified lines
3333 void (*set_rgmii_speed)(struct rk_priv_data *bsp_priv, int speed);
3434 void (*set_rmii_speed)(struct rk_priv_data *bsp_priv, int speed);
3535 void (*integrated_phy_powerup)(struct rk_priv_data *bsp_priv);
36+ bool regs_valid;
3637 u32 regs[];
3738 };
3839
@@ -1092,6 +1093,7 @@ static const struct rk_gmac_ops rk3568_ops = { · 1053 unmodified lines
10921093 .set_to_rmii = rk3568_set_to_rmii,
10931094 .set_rgmii_speed = rk3568_set_gmac_speed,
10941095 .set_rmii_speed = rk3568_set_gmac_speed,
1096+ .regs_valid = true,
10951097 .regs = {
10961098 0xfe2a0000, /* gmac0 */
10971099 0xfe010000, /* gmac1 */
@@ -1383,7 +1385,7 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, · 285 unmodified lines
13831385 * to be distinguished.
13841386 */
13851387 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1386− if (res) {
1388+ if (res && ops->regs_valid) {
13871389 int i = 0;
13881390
13891391 while (ops->regs[i]) {
drivers/net/ethernet/stmicro/stmmac/stmmac.h+17−0
@@ -171,6 +171,19 @@ struct stmmac_flow_entry { · 170 unmodified lines
171171 int is_l4;
172172 };
173173
174+/* Rx Frame Steering */
175+enum stmmac_rfs_type {
176+ STMMAC_RFS_T_VLAN,
177+ STMMAC_RFS_T_MAX,
178+};
179+
180+struct stmmac_rfs_entry {
181+ unsigned long cookie;
182+ int in_use;
183+ int type;
184+ int tc;
185+};
186+
174187 struct stmmac_priv {
175188 /* Frequently used values are kept adjacent for cache effect */
176189 u32 tx_coal_frames[MTL_MAX_TX_QUEUES];
@@ -288,6 +301,10 @@ struct stmmac_priv { · 111 unmodified lines
288301 struct stmmac_tc_entry *tc_entries;
289302 unsigned int flow_entries_max;
290303 struct stmmac_flow_entry *flow_entries;
304+ unsigned int rfs_entries_max[STMMAC_RFS_T_MAX];
305+ unsigned int rfs_entries_cnt[STMMAC_RFS_T_MAX];
306+ unsigned int rfs_entries_total;
307+ struct stmmac_rfs_entry *rfs_entries;
291308
292309 /* Pulse Per Second output */
293310 struct stmmac_pps_cfg pps[STMMAC_PPS_MAX];
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+12−4
@@ -1451,16 +1451,20 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, · 1450 unmodified lines
14511451 {
14521452 struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
14531453 struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i];
1454+ gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN);
1455+
1456+ if (priv->dma_cap.addr64 <= 32)
1457+ gfp |= GFP_DMA32;
14541458
14551459 if (!buf->page) {
1456− buf->page = page_pool_dev_alloc_pages(rx_q->page_pool);
1460+ buf->page = page_pool_alloc_pages(rx_q->page_pool, gfp);
14571461 if (!buf->page)
14581462 return -ENOMEM;
14591463 buf->page_offset = stmmac_rx_offset(priv);
14601464 }
14611465
14621466 if (priv->sph && !buf->sec_page) {
1463− buf->sec_page = page_pool_dev_alloc_pages(rx_q->page_pool);
1467+ buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp);
14641468 if (!buf->sec_page)
14651469 return -ENOMEM;
14661470
@@ -4475,6 +4479,10 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) · 3008 unmodified lines
44754479 struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
44764480 int dirty = stmmac_rx_dirty(priv, queue);
44774481 unsigned int entry = rx_q->dirty_rx;
4482+ gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN);
4483+
4484+ if (priv->dma_cap.addr64 <= 32)
4485+ gfp |= GFP_DMA32;
44784486
44794487 while (dirty-- > 0) {
44804488 struct stmmac_rx_buffer *buf = &rx_q->buf_pool[entry];
@@ -4487,13 +4495,13 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) · 6 unmodified lines
44874495 p = rx_q->dma_rx + entry;
44884496
44894497 if (!buf->page) {
4490− buf->page = page_pool_dev_alloc_pages(rx_q->page_pool);
4498+ buf->page = page_pool_alloc_pages(rx_q->page_pool, gfp);
44914499 if (!buf->page)
44924500 break;
44934501 }
44944502
44954503 if (priv->sph && !buf->sec_page) {
4496− buf->sec_page = page_pool_dev_alloc_pages(rx_q->page_pool);
4504+ buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp);
44974505 if (!buf->sec_page)
44984506 break;
44994507
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c+73−13
@@ -232,11 +232,33 @@ static int tc_setup_cls_u32(struct stmmac_priv *priv, · 231 unmodified lines
232232 }
233233 }
234234
235+static int tc_rfs_init(struct stmmac_priv *priv)
236+{
237+ int i;
238+
239+ priv->rfs_entries_max[STMMAC_RFS_T_VLAN] = 8;
240+
241+ for (i = 0; i < STMMAC_RFS_T_MAX; i++)
242+ priv->rfs_entries_total += priv->rfs_entries_max[i];
243+
244+ priv->rfs_entries = devm_kcalloc(priv->device,
245+ priv->rfs_entries_total,
246+ sizeof(*priv->rfs_entries),
247+ GFP_KERNEL);
248+ if (!priv->rfs_entries)
249+ return -ENOMEM;
250+
251+ dev_info(priv->device, "Enabled RFS Flow TC (entries=%d)\n",
252+ priv->rfs_entries_total);
253+
254+ return 0;
255+}
256+
235257 static int tc_init(struct stmmac_priv *priv)
236258 {
237259 struct dma_features *dma_cap = &priv->dma_cap;
238260 unsigned int count;
239− int i;
261+ int ret, i;
240262
241263 if (dma_cap->l3l4fnum) {
242264 priv->flow_entries_max = dma_cap->l3l4fnum;
@@ -250,10 +272,14 @@ static int tc_init(struct stmmac_priv *priv) · 7 unmodified lines
250272 for (i = 0; i < priv->flow_entries_max; i++)
251273 priv->flow_entries[i].idx = i;
252274
253− dev_info(priv->device, "Enabled Flow TC (entries=%d)\n",
275+ dev_info(priv->device, "Enabled L3L4 Flow TC (entries=%d)\n",
254276 priv->flow_entries_max);
255277 }
256278
279+ ret = tc_rfs_init(priv);
280+ if (ret)
281+ return -ENOMEM;
282+
257283 if (!priv->plat->fpe_cfg) {
258284 priv->plat->fpe_cfg = devm_kzalloc(priv->device,
259285 sizeof(*priv->plat->fpe_cfg),
@@ -607,16 +633,45 @@ static int tc_del_flow(struct stmmac_priv *priv, · 347 unmodified lines
607633 return ret;
608634 }
609635
636+static struct stmmac_rfs_entry *tc_find_rfs(struct stmmac_priv *priv,
637+ struct flow_cls_offload *cls,
638+ bool get_free)
639+{
640+ int i;
641+
642+ for (i = 0; i < priv->rfs_entries_total; i++) {
643+ struct stmmac_rfs_entry *entry = &priv->rfs_entries[i];
644+
645+ if (entry->cookie == cls->cookie)
646+ return entry;
647+ if (get_free && entry->in_use == false)
648+ return entry;
649+ }
650+
651+ return NULL;
652+}
653+
610654 #define VLAN_PRIO_FULL_MASK (0x07)
611655
612656 static int tc_add_vlan_flow(struct stmmac_priv *priv,
613657 struct flow_cls_offload *cls)
614658 {
659+ struct stmmac_rfs_entry *entry = tc_find_rfs(priv, cls, false);
615660 struct flow_rule *rule = flow_cls_offload_flow_rule(cls);
616661 struct flow_dissector *dissector = rule->match.dissector;
617662 int tc = tc_classid_to_hwtc(priv->dev, cls->classid);
618663 struct flow_match_vlan match;
619664
665+ if (!entry) {
666+ entry = tc_find_rfs(priv, cls, true);
667+ if (!entry)
668+ return -ENOENT;
669+ }
670+
671+ if (priv->rfs_entries_cnt[STMMAC_RFS_T_VLAN] >=
672+ priv->rfs_entries_max[STMMAC_RFS_T_VLAN])
673+ return -ENOENT;
674+
620675 /* Nothing to do here */
621676 if (!dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_VLAN))
622677 return -EINVAL;
@@ -638,6 +693,12 @@ static int tc_add_vlan_flow(struct stmmac_priv *priv, · 15 unmodified lines
638693
639694 prio = BIT(match.key->vlan_priority);
640695 stmmac_rx_queue_prio(priv, priv->hw, prio, tc);
696+
697+ entry->in_use = true;
698+ entry->cookie = cls->cookie;
699+ entry->tc = tc;
700+ entry->type = STMMAC_RFS_T_VLAN;
701+ priv->rfs_entries_cnt[STMMAC_RFS_T_VLAN]++;
641702 }
642703
643704 return 0;
@@ -646,20 +707,19 @@ static int tc_add_vlan_flow(struct stmmac_priv *priv, · 2 unmodified lines
646707 static int tc_del_vlan_flow(struct stmmac_priv *priv,
647708 struct flow_cls_offload *cls)
648709 {
649− struct flow_rule *rule = flow_cls_offload_flow_rule(cls);
650− struct flow_dissector *dissector = rule->match.dissector;
651− int tc = tc_classid_to_hwtc(priv->dev, cls->classid);
710+ struct stmmac_rfs_entry *entry = tc_find_rfs(priv, cls, false);
652711
653− /* Nothing to do here */
654− if (!dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_VLAN))
655− return -EINVAL;
712+ if (!entry || !entry->in_use || entry->type != STMMAC_RFS_T_VLAN)
713+ return -ENOENT;
656714
657− if (tc < 0) {
658− netdev_err(priv->dev, "Invalid traffic class\n");
659− return -EINVAL;
660− }
715+ stmmac_rx_queue_prio(priv, priv->hw, 0, entry->tc);
716+
717+ entry->in_use = false;
718+ entry->cookie = 0;
719+ entry->tc = 0;
720+ entry->type = 0;
661721
662− stmmac_rx_queue_prio(priv, priv->hw, 0, tc);
722+ priv->rfs_entries_cnt[STMMAC_RFS_T_VLAN]--;
663723
664724 return 0;
665725 }
drivers/net/ethernet/ti/am65-cpsw-nuss.c+20−9
@@ -1844,13 +1844,14 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common) · 1843 unmodified lines
18441844 if (ret < 0) {
18451845 dev_err(dev, "%pOF error reading port_id %d\n",
18461846 port_np, ret);
1847− return ret;
1847+ goto of_node_put;
18481848 }
18491849
18501850 if (!port_id || port_id > common->port_num) {
18511851 dev_err(dev, "%pOF has invalid port_id %u %s\n",
18521852 port_np, port_id, port_np->name);
1853− return -EINVAL;
1853+ ret = -EINVAL;
1854+ goto of_node_put;
18541855 }
18551856
18561857 port = am65_common_get_port(common, port_id);
@@ -1866,8 +1867,10 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common) · 9 unmodified lines
18661867 (AM65_CPSW_NU_FRAM_PORT_OFFSET * (port_id - 1));
18671868
18681869 port->slave.mac_sl = cpsw_sl_get("am65", dev, port->port_base);
1869− if (IS_ERR(port->slave.mac_sl))
1870− return PTR_ERR(port->slave.mac_sl);
1870+ if (IS_ERR(port->slave.mac_sl)) {
1871+ ret = PTR_ERR(port->slave.mac_sl);
1872+ goto of_node_put;
1873+ }
18711874
18721875 port->disabled = !of_device_is_available(port_np);
18731876 if (port->disabled) {
@@ -1880,7 +1883,7 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common) · 6 unmodified lines
18801883 ret = PTR_ERR(port->slave.ifphy);
18811884 dev_err(dev, "%pOF error retrieving port phy: %d\n",
18821885 port_np, ret);
1883− return ret;
1886+ goto of_node_put;
18841887 }
18851888
18861889 port->slave.mac_only =
@@ -1889,10 +1892,12 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common) · 2 unmodified lines
18891892 /* get phy/link info */
18901893 if (of_phy_is_fixed_link(port_np)) {
18911894 ret = of_phy_register_fixed_link(port_np);
1892− if (ret)
1893− return dev_err_probe(dev, ret,
1895+ if (ret) {
1896+ ret = dev_err_probe(dev, ret,
18941897 "failed to register fixed-link phy %pOF\n",
18951898 port_np);
1899+ goto of_node_put;
1900+ }
18961901 port->slave.phy_node = of_node_get(port_np);
18971902 } else {
18981903 port->slave.phy_node =
@@ -1902,14 +1907,15 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common) · 3 unmodified lines
19021907 if (!port->slave.phy_node) {
19031908 dev_err(dev,
19041909 "slave[%d] no phy found\n", port_id);
1905− return -ENODEV;
1910+ ret = -ENODEV;
1911+ goto of_node_put;
19061912 }
19071913
19081914 ret = of_get_phy_mode(port_np, &port->slave.phy_if);
19091915 if (ret) {
19101916 dev_err(dev, "%pOF read phy-mode err %d\n",
19111917 port_np, ret);
1912− return ret;
1918+ goto of_node_put;
19131919 }
19141920
19151921 ret = of_get_mac_address(port_np, port->slave.mac_addr);
@@ -1932,6 +1938,11 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common) · 16 unmodified lines
19321938 }
19331939
19341940 return 0;
1941+
1942+of_node_put:
1943+ of_node_put(port_np);
1944+ of_node_put(node);
1945+ return ret;
19351946 }
19361947
19371948 static void am65_cpsw_pcpu_stats_free(void *data)
drivers/net/netdevsim/bpf.c+1−0
@@ -514,6 +514,7 @@ nsim_bpf_map_alloc(struct netdevsim *ns, struct bpf_offloaded_map *offmap) · 513 unmodified lines
514514 goto err_free;
515515 key = nmap->entry[i].key;
516516 *key = i;
517+ memset(nmap->entry[i].value, 0, offmap->map.value_size);
517518 }
518519 }
519520
drivers/net/netdevsim/ethtool.c+4−1
@@ -81,7 +81,10 @@ static int nsim_set_ringparam(struct net_device *dev, · 80 unmodified lines
8181 {
8282 struct netdevsim *ns = netdev_priv(dev);
8383
84− memcpy(&ns->ethtool.ring, ring, sizeof(ns->ethtool.ring));
84+ ns->ethtool.ring.rx_pending = ring->rx_pending;
85+ ns->ethtool.ring.rx_jumbo_pending = ring->rx_jumbo_pending;
86+ ns->ethtool.ring.rx_mini_pending = ring->rx_mini_pending;
87+ ns->ethtool.ring.tx_pending = ring->tx_pending;
8588 return 0;
8689 }
8790
drivers/net/phy/mdio_bus.c+3−0
@@ -462,6 +462,9 @@ static void of_mdiobus_link_mdiodev(struct mii_bus *bus, · 461 unmodified lines
462462
463463 if (addr == mdiodev->addr) {
464464 device_set_node(dev, of_fwnode_handle(child));
465+ /* The refcount on "child" is passed to the mdio
466+ * device. Do _not_ use of_node_put(child) here.
467+ */
465468 return;
466469 }
467470 }
drivers/net/usb/lan78xx.c+6−0
@@ -76,6 +76,8 @@ · 75 unmodified lines
7676 #define LAN7801_USB_PRODUCT_ID (0x7801)
7777 #define LAN78XX_EEPROM_MAGIC (0x78A5)
7878 #define LAN78XX_OTP_MAGIC (0x78F3)
79+#define AT29M2AF_USB_VENDOR_ID (0x07C9)
80+#define AT29M2AF_USB_PRODUCT_ID (0x0012)
7981
8082 #define MII_READ 1
8183 #define MII_WRITE 0
@@ -5060,6 +5062,10 @@ static const struct usb_device_id products[] = { · 4978 unmodified lines
50605062 /* LAN7801 USB Gigabit Ethernet Device */
50615063 USB_DEVICE(LAN78XX_USB_VENDOR_ID, LAN7801_USB_PRODUCT_ID),
50625064 },
5065+ {
5066+ /* ATM2-AF USB Gigabit Ethernet Device */
5067+ USB_DEVICE(AT29M2AF_USB_VENDOR_ID, AT29M2AF_USB_PRODUCT_ID),
5068+ },
50635069 {},
50645070 };
50655071 MODULE_DEVICE_TABLE(usb, products);
drivers/net/usb/qmi_wwan.c+1−0
@@ -1358,6 +1358,7 @@ static const struct usb_device_id products[] = { · 1357 unmodified lines
13581358 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */
13591359 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */
13601360 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1060, 2)}, /* Telit LN920 */
1361+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1070, 2)}, /* Telit FN990 */
13611362 {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */
13621363 {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */
13631364 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
drivers/net/virtio_net.c+3−6
@@ -733,7 +733,7 @@ static struct sk_buff *receive_small(struct net_device *dev, · 732 unmodified lines
733733 pr_debug("%s: rx error: len %u exceeds max size %d\n",
734734 dev->name, len, GOOD_PACKET_LEN);
735735 dev->stats.rx_length_errors++;
736− goto err_len;
736+ goto err;
737737 }
738738
739739 if (likely(!vi->xdp_enabled)) {
@@ -825,10 +825,8 @@ static struct sk_buff *receive_small(struct net_device *dev, · 85 unmodified lines
825825
826826 skip_xdp:
827827 skb = build_skb(buf, buflen);
828− if (!skb) {
829− put_page(page);
828+ if (!skb)
830829 goto err;
831− }
832830 skb_reserve(skb, headroom - delta);
833831 skb_put(skb, len);
834832 if (!xdp_prog) {
@@ -839,13 +837,12 @@ skip_xdp: · 4 unmodified lines
839837 if (metasize)
840838 skb_metadata_set(skb, metasize);
841839
842−err:
843840 return skb;
844841
845842 err_xdp:
846843 rcu_read_unlock();
847844 stats->xdp_drops++;
848−err_len:
845+err:
849846 stats->drops++;
850847 put_page(page);
851848 xdp_xmit:
drivers/net/wireless/ath/ath11k/mhi.c+5−1
@@ -533,7 +533,11 @@ static int ath11k_mhi_set_state(struct ath11k_pci *ab_pci, · 532 unmodified lines
533533 ret = mhi_pm_suspend(ab_pci->mhi_ctrl);
534534 break;
535535 case ATH11K_MHI_RESUME:
536− ret = mhi_pm_resume(ab_pci->mhi_ctrl);
536+ /* Do force MHI resume as some devices like QCA6390, WCN6855
537+ * are not in M3 state but they are functional. So just ignore
538+ * the MHI state while resuming.
539+ */
540+ ret = mhi_pm_resume_force(ab_pci->mhi_ctrl);
537541 break;
538542 case ATH11K_MHI_TRIGGER_RDDM:
539543 ret = mhi_force_rddm_mode(ab_pci->mhi_ctrl);
drivers/net/wireless/broadcom/brcm80211/Kconfig+9−5
@@ -7,16 +7,20 @@ config BRCMSMAC · 6 unmodified lines
77 depends on MAC80211
88 depends on BCMA_POSSIBLE
99 select BCMA
10− select NEW_LEDS if BCMA_DRIVER_GPIO
11− select LEDS_CLASS if BCMA_DRIVER_GPIO
1210 select BRCMUTIL
1311 select FW_LOADER
1412 select CORDIC
1513 help
1614 This module adds support for PCIe wireless adapters based on Broadcom
17− IEEE802.11n SoftMAC chipsets. It also has WLAN led support, which will
18− be available if you select BCMA_DRIVER_GPIO. If you choose to build a
19− module, the driver will be called brcmsmac.ko.
15+ IEEE802.11n SoftMAC chipsets. If you choose to build a module, the
16+ driver will be called brcmsmac.ko.
17+
18+config BRCMSMAC_LEDS
19+ def_bool BRCMSMAC && BCMA_DRIVER_GPIO && MAC80211_LEDS
20+ help
21+ The brcmsmac LED support depends on the presence of the
22+ BCMA_DRIVER_GPIO driver, and it only works if LED support
23+ is enabled and reachable from the driver module.
2024
2125 source "drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig"
2226
drivers/net/wireless/broadcom/brcm80211/brcmsmac/Makefile+1−1
@@ -42,6 +42,6 @@ brcmsmac-y := \ · 41 unmodified lines
4242 brcms_trace_events.o \
4343 debug.o
4444
45−brcmsmac-$(CONFIG_BCMA_DRIVER_GPIO) += led.o
45+brcmsmac-$(CONFIG_BRCMSMAC_LEDS) += led.o
4646
4747 obj-$(CONFIG_BRCMSMAC) += brcmsmac.o
drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.h+1−1
@@ -24,7 +24,7 @@ struct brcms_led { · 23 unmodified lines
2424 struct gpio_desc *gpiod;
2525 };
2626
27−#ifdef CONFIG_BCMA_DRIVER_GPIO
27+#ifdef CONFIG_BRCMSMAC_LEDS
2828 void brcms_led_unregister(struct brcms_info *wl);
2929 int brcms_led_register(struct brcms_info *wl);
3030 #else
drivers/net/wireless/intel/iwlegacy/Kconfig+2−2
@@ -2,14 +2,13 @@ · 1 unmodified line
22 config IWLEGACY
33 tristate
44 select FW_LOADER
5− select NEW_LEDS
6− select LEDS_CLASS
75 select LEDS_TRIGGERS
86 select MAC80211_LEDS
97
108 config IWL4965
119 tristate "Intel Wireless WiFi 4965AGN (iwl4965)"
1210 depends on PCI && MAC80211
11+ depends on LEDS_CLASS=y || LEDS_CLASS=MAC80211
1312 select IWLEGACY
1413 help
1514 This option enables support for
@@ -38,6 +37,7 @@ config IWL4965 · 22 unmodified lines
3837 config IWL3945
3938 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection (iwl3945)"
4039 depends on PCI && MAC80211
40+ depends on LEDS_CLASS=y || LEDS_CLASS=MAC80211
4141 select IWLEGACY
4242 help
4343 Select to build the driver supporting the:
drivers/net/wireless/intel/iwlwifi/Kconfig+1−1
@@ -47,7 +47,7 @@ if IWLWIFI · 46 unmodified lines
4747
4848 config IWLWIFI_LEDS
4949 bool
50− depends on LEDS_CLASS=y || LEDS_CLASS=IWLWIFI
50+ depends on LEDS_CLASS=y || LEDS_CLASS=MAC80211
5151 depends on IWLMVM || IWLDVM
5252 select LEDS_TRIGGERS
5353 select MAC80211_LEDS
drivers/net/wireless/intel/iwlwifi/mvm/tx.c+3−2
@@ -269,17 +269,18 @@ static u32 iwl_mvm_get_tx_rate(struct iwl_mvm *mvm, · 268 unmodified lines
269269 u8 rate_plcp;
270270 u32 rate_flags = 0;
271271 bool is_cck;
272− struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
273272
274273 /* info->control is only relevant for non HW rate control */
275274 if (!ieee80211_hw_check(mvm->hw, HAS_RATE_CONTROL)) {
275+ struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
276+
276277 /* HT rate doesn't make sense for a non data frame */
277278 WARN_ONCE(info->control.rates[0].flags & IEEE80211_TX_RC_MCS &&
278279 !ieee80211_is_data(fc),
279280 "Got a HT rate (flags:0x%x/mcs:%d/fc:0x%x/state:%d) for a non data frame\n",
280281 info->control.rates[0].flags,
281282 info->control.rates[0].idx,
282− le16_to_cpu(fc), mvmsta->sta_state);
283+ le16_to_cpu(fc), sta ? mvmsta->sta_state : -1);
283284
284285 rate_idx = info->control.rates[0].idx;
285286 }
drivers/net/wireless/mediatek/mt76/Makefile+1−1
@@ -34,4 +34,4 @@ obj-$(CONFIG_MT76x2_COMMON) += mt76x2/ · 33 unmodified lines
3434 obj-$(CONFIG_MT7603E) += mt7603/
3535 obj-$(CONFIG_MT7615_COMMON) += mt7615/
3636 obj-$(CONFIG_MT7915E) += mt7915/
37−obj-$(CONFIG_MT7921E) += mt7921/
37+obj-$(CONFIG_MT7921_COMMON) += mt7921/
drivers/nvme/host/core.c+18−5
@@ -666,6 +666,7 @@ blk_status_t nvme_fail_nonready_command(struct nvme_ctrl *ctrl, · 665 unmodified lines
666666 struct request *rq)
667667 {
668668 if (ctrl->state != NVME_CTRL_DELETING_NOIO &&
669+ ctrl->state != NVME_CTRL_DELETING &&
669670 ctrl->state != NVME_CTRL_DEAD &&
670671 !test_bit(NVME_CTRL_FAILFAST_EXPIRED, &ctrl->flags) &&
671672 !blk_noretry_request(rq) && !(rq->cmd_flags & REQ_NVME_MPATH))
@@ -1749,9 +1750,20 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) · 1077 unmodified lines
17491750 */
17501751 if (WARN_ON_ONCE(!(id->flbas & NVME_NS_FLBAS_META_EXT)))
17511752 return -EINVAL;
1752− if (ctrl->max_integrity_segments)
1753− ns->features |=
1754− (NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS);
1753+
1754+ ns->features |= NVME_NS_EXT_LBAS;
1755+
1756+ /*
1757+ * The current fabrics transport drivers support namespace
1758+ * metadata formats only if nvme_ns_has_pi() returns true.
1759+ * Suppress support for all other formats so the namespace will
1760+ * have a 0 capacity and not be usable through the block stack.
1761+ *
1762+ * Note, this check will need to be modified if any drivers
1763+ * gain the ability to use other metadata formats.
1764+ */
1765+ if (ctrl->max_integrity_segments && nvme_ns_has_pi(ns))
1766+ ns->features |= NVME_NS_METADATA_SUPPORTED;
17551767 } else {
17561768 /*
17571769 * For PCIe controllers, we can't easily remap the separate
@@ -2696,8 +2708,9 @@ static bool nvme_validate_cntlid(struct nvme_subsystem *subsys, · 938 unmodified lines
26962708
26972709 if (tmp->cntlid == ctrl->cntlid) {
26982710 dev_err(ctrl->device,
2699− "Duplicate cntlid %u with %s, rejecting\n",
2700− ctrl->cntlid, dev_name(tmp->device));
2711+ "Duplicate cntlid %u with %s, subsys %s, rejecting\n",
2712+ ctrl->cntlid, dev_name(tmp->device),
2713+ subsys->subnqn);
27012714 return false;
27022715 }
27032716
drivers/nvme/host/multipath.c+2−1
@@ -866,7 +866,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) · 865 unmodified lines
866866 }
867867 if (ana_log_size > ctrl->ana_log_size) {
868868 nvme_mpath_stop(ctrl);
869− kfree(ctrl->ana_log_buf);
869+ nvme_mpath_uninit(ctrl);
870870 ctrl->ana_log_buf = kmalloc(ana_log_size, GFP_KERNEL);
871871 if (!ctrl->ana_log_buf)
872872 return -ENOMEM;
@@ -886,4 +886,5 @@ void nvme_mpath_uninit(struct nvme_ctrl *ctrl) · 13 unmodified lines
886886 {
887887 kfree(ctrl->ana_log_buf);
888888 ctrl->ana_log_buf = NULL;
889+ ctrl->ana_log_size = 0;
889890 }
drivers/nvme/host/nvme.h+1−1
@@ -709,7 +709,7 @@ static inline bool nvme_check_ready(struct nvme_ctrl *ctrl, struct request *rq, · 708 unmodified lines
709709 return true;
710710 if (ctrl->ops->flags & NVME_F_FABRICS &&
711711 ctrl->state == NVME_CTRL_DELETING)
712− return true;
712+ return queue_live;
713713 return __nvme_check_ready(ctrl, rq, queue_live);
714714 }
715715 int nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
drivers/nvme/host/zns.c+4−1
@@ -166,7 +166,10 @@ static int nvme_zone_parse_entry(struct nvme_ns *ns, · 165 unmodified lines
166166 zone.len = ns->zsze;
167167 zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap));
168168 zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba));
169− zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp));
169+ if (zone.cond == BLK_ZONE_COND_FULL)
170+ zone.wp = zone.start + zone.len;
171+ else
172+ zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp));
170173
171174 return cb(&zone, idx, data);
172175 }
drivers/nvme/target/tcp.c+8−1
@@ -922,7 +922,14 @@ static void nvmet_tcp_handle_req_failure(struct nvmet_tcp_queue *queue, · 921 unmodified lines
922922 size_t data_len = le32_to_cpu(req->cmd->common.dptr.sgl.length);
923923 int ret;
924924
925− if (!nvme_is_write(cmd->req.cmd) ||
925+ /*
926+ * This command has not been processed yet, hence we are trying to
927+ * figure out if there is still pending data left to receive. If
928+ * we don't, we can simply prepare for the next pdu and bail out,
929+ * otherwise we will need to prepare a buffer and receive the
930+ * stale data before continuing forward.
931+ */
932+ if (!nvme_is_write(cmd->req.cmd) || !data_len ||
926933 data_len > cmd->req.port->inline_data_size) {
927934 nvmet_prepare_receive_pdu(queue);
928935 return;
drivers/of/irq.c+25−2
@@ -76,6 +76,26 @@ struct device_node *of_irq_find_parent(struct device_node *child) · 75 unmodified lines
7676 }
7777 EXPORT_SYMBOL_GPL(of_irq_find_parent);
7878
79+/*
80+ * These interrupt controllers abuse interrupt-map for unspeakable
81+ * reasons and rely on the core code to *ignore* it (the drivers do
82+ * their own parsing of the property).
83+ *
84+ * If you think of adding to the list for something *new*, think
85+ * again. There is a high chance that you will be sent back to the
86+ * drawing board.
87+ */
88+static const char * const of_irq_imap_abusers[] = {
89+ "CBEA,platform-spider-pic",
90+ "sti,platform-spider-pic",
91+ "realtek,rtl-intc",
92+ "fsl,ls1021a-extirq",
93+ "fsl,ls1043a-extirq",
94+ "fsl,ls1088a-extirq",
95+ "renesas,rza1-irqc",
96+ NULL,
97+};
98+
7999 /**
80100 * of_irq_parse_raw - Low level interrupt tree parsing
81101 * @addr: address specifier (start of "reg" property of the device) in be32 format
@@ -159,12 +179,15 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) · 77 unmodified lines
159179 /*
160180 * Now check if cursor is an interrupt-controller and
161181 * if it is then we are done, unless there is an
162− * interrupt-map which takes precedence.
182+ * interrupt-map which takes precedence except on one
183+ * of these broken platforms that want to parse
184+ * interrupt-map themselves for $reason.
163185 */
164186 bool intc = of_property_read_bool(ipar, "interrupt-controller");
165187
166188 imap = of_get_property(ipar, "interrupt-map", &imaplen);
167− if (imap == NULL && intc) {
189+ if (intc &&
190+ (!imap || of_device_compatible_match(ipar, of_irq_imap_abusers))) {
168191 pr_debug(" -> got it !\n");
169192 return 0;
170193 }
drivers/pci/controller/Kconfig+2−2
@@ -332,8 +332,8 @@ config PCIE_APPLE · 331 unmodified lines
332332 If unsure, say Y if you have an Apple Silicon system.
333333
334334 config PCIE_MT7621
335− tristate "MediaTek MT7621 PCIe Controller"
336− depends on (RALINK && SOC_MT7621) || (MIPS && COMPILE_TEST)
335+ bool "MediaTek MT7621 PCIe Controller"
336+ depends on SOC_MT7621 || (MIPS && COMPILE_TEST)
337337 select PHY_MT7621_PCI
338338 default SOC_MT7621
339339 help
drivers/pci/controller/pci-aardvark.c+0−9
@@ -32,7 +32,6 @@ · 31 unmodified lines
3232 #define PCIE_CORE_DEV_ID_REG 0x0
3333 #define PCIE_CORE_CMD_STATUS_REG 0x4
3434 #define PCIE_CORE_DEV_REV_REG 0x8
35−#define PCIE_CORE_EXP_ROM_BAR_REG 0x30
3635 #define PCIE_CORE_PCIEXP_CAP 0xc0
3736 #define PCIE_CORE_ERR_CAPCTL_REG 0x118
3837 #define PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX BIT(5)
@@ -774,10 +773,6 @@ advk_pci_bridge_emul_base_conf_read(struct pci_bridge_emul *bridge, · 735 unmodified lines
774773 *value = advk_readl(pcie, PCIE_CORE_CMD_STATUS_REG);
775774 return PCI_BRIDGE_EMUL_HANDLED;
776775
777− case PCI_ROM_ADDRESS1:
778− *value = advk_readl(pcie, PCIE_CORE_EXP_ROM_BAR_REG);
779− return PCI_BRIDGE_EMUL_HANDLED;
780−
781776 case PCI_INTERRUPT_LINE: {
782777 /*
783778 * From the whole 32bit register we support reading from HW only
@@ -810,10 +805,6 @@ advk_pci_bridge_emul_base_conf_write(struct pci_bridge_emul *bridge, · 26 unmodified lines
810805 advk_writel(pcie, new, PCIE_CORE_CMD_STATUS_REG);
811806 break;
812807
813− case PCI_ROM_ADDRESS1:
814− advk_writel(pcie, new, PCIE_CORE_EXP_ROM_BAR_REG);
815− break;
816−
817808 case PCI_INTERRUPT_LINE:
818809 if (mask & (PCI_BRIDGE_CTL_BUS_RESET << 16)) {
819810 u32 val = advk_readl(pcie, PCIE_CORE_CTRL1_REG);
drivers/pci/controller/pcie-apple.c+12−2
@@ -516,7 +516,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie, · 515 unmodified lines
516516 int ret, i;
517517
518518 reset = gpiod_get_from_of_node(np, "reset-gpios", 0,
519− GPIOD_OUT_LOW, "#PERST");
519+ GPIOD_OUT_LOW, "PERST#");
520520 if (IS_ERR(reset))
521521 return PTR_ERR(reset);
522522
@@ -539,12 +539,22 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie, · 16 unmodified lines
539539
540540 rmw_set(PORT_APPCLK_EN, port->base + PORT_APPCLK);
541541
542+ /* Assert PERST# before setting up the clock */
543+ gpiod_set_value(reset, 1);
544+
542545 ret = apple_pcie_setup_refclk(pcie, port);
543546 if (ret < 0)
544547 return ret;
545548
549+ /* The minimal Tperst-clk value is 100us (PCIe CEM r5.0, 2.9.2) */
550+ usleep_range(100, 200);
551+
552+ /* Deassert PERST# */
546553 rmw_set(PORT_PERST_OFF, port->base + PORT_PERST);
547− gpiod_set_value(reset, 1);
554+ gpiod_set_value(reset, 0);
555+
556+ /* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */
557+ msleep(100);
548558
549559 ret = readl_relaxed_poll_timeout(port->base + PORT_STATUS, stat,
550560 stat & PORT_STATUS_READY, 100, 250000);
drivers/phy/hisilicon/phy-hi3670-pcie.c+2−2
@@ -757,8 +757,8 @@ static int hi3670_pcie_phy_get_resources(struct hi3670_pcie_phy *phy, · 756 unmodified lines
757757 return PTR_ERR(phy->sysctrl);
758758
759759 phy->pmctrl = syscon_regmap_lookup_by_compatible("hisilicon,hi3670-pmctrl");
760− if (IS_ERR(phy->sysctrl))
761− return PTR_ERR(phy->sysctrl);
760+ if (IS_ERR(phy->pmctrl))
761+ return PTR_ERR(phy->pmctrl);
762762
763763 /* clocks */
764764 phy->phy_ref_clk = devm_clk_get(dev, "phy_ref");
drivers/phy/marvell/phy-mvebu-cp110-utmi.c+2−2
@@ -82,9 +82,9 @@ · 81 unmodified lines
8282 * struct mvebu_cp110_utmi - PHY driver data
8383 *
8484 * @regs: PHY registers
85− * @syscom: Regmap with system controller registers
85+ * @syscon: Regmap with system controller registers
8686 * @dev: device driver handle
87− * @caps: PHY capabilities
87+ * @ops: phy ops
8888 */
8989 struct mvebu_cp110_utmi {
9090 void __iomem *regs;
drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c+14−12
@@ -127,12 +127,13 @@ struct phy_drvdata { · 126 unmodified lines
127127 };
128128
129129 /**
130− * Write register and read back masked value to confirm it is written
130+ * usb_phy_write_readback() - Write register and read back masked value to
131+ * confirm it is written
131132 *
132− * @base - QCOM DWC3 PHY base virtual address.
133− * @offset - register offset.
134− * @mask - register bitmask specifying what should be updated
135− * @val - value to write.
133+ * @phy_dwc3: QCOM DWC3 phy context
134+ * @offset: register offset.
135+ * @mask: register bitmask specifying what should be updated
136+ * @val: value to write.
136137 */
137138 static inline void usb_phy_write_readback(struct usb_phy *phy_dwc3,
138139 u32 offset,
@@ -171,11 +172,11 @@ static int wait_for_latch(void __iomem *addr) · 32 unmodified lines
171172 }
172173
173174 /**
174− * Write SSPHY register
175+ * usb_ss_write_phycreg() - Write SSPHY register
175176 *
176− * @base - QCOM DWC3 PHY base virtual address.
177− * @addr - SSPHY address to write.
178− * @val - value to write.
177+ * @phy_dwc3: QCOM DWC3 phy context
178+ * @addr: SSPHY address to write.
179+ * @val: value to write.
179180 */
180181 static int usb_ss_write_phycreg(struct usb_phy *phy_dwc3,
181182 u32 addr, u32 val)
@@ -209,10 +210,11 @@ err_wait: · 27 unmodified lines
209210 }
210211
211212 /**
212− * Read SSPHY register.
213+ * usb_ss_read_phycreg() - Read SSPHY register.
213214 *
214− * @base - QCOM DWC3 PHY base virtual address.
215− * @addr - SSPHY address to read.
215+ * @phy_dwc3: QCOM DWC3 phy context
216+ * @addr: SSPHY address to read.
217+ * @val: pointer in which read is store.
216218 */
217219 static int usb_ss_read_phycreg(struct usb_phy *phy_dwc3,
218220 u32 addr, u32 *val)
drivers/phy/qualcomm/phy-qcom-qmp.c+3−0
@@ -2973,6 +2973,9 @@ struct qmp_phy_combo_cfg { · 2972 unmodified lines
29732973 * @qmp: QMP phy to which this lane belongs
29742974 * @lane_rst: lane's reset controller
29752975 * @mode: current PHY mode
2976+ * @dp_aux_cfg: Display port aux config
2977+ * @dp_opts: Display port optional config
2978+ * @dp_clks: Display port clocks
29762979 */
29772980 struct qmp_phy {
29782981 struct phy *phy;
drivers/phy/qualcomm/phy-qcom-usb-hsic.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0-only
2−/**
2+/*
33 * Copyright (C) 2016 Linaro Ltd
44 */
55 #include <linux/module.h>
drivers/phy/st/phy-stm32-usbphyc.c+1−1
@@ -478,7 +478,7 @@ static void stm32_usbphyc_phy_tuning(struct stm32_usbphyc *usbphyc, · 477 unmodified lines
478478 if (!of_property_read_bool(np, "st,no-lsfs-fb-cap"))
479479 usbphyc_phy->tune |= LFSCAPEN;
480480
481− if (of_property_read_bool(np, "st,slow-hs-slew-rate"))
481+ if (of_property_read_bool(np, "st,decrease-hs-slew-rate"))
482482 usbphyc_phy->tune |= HSDRVSLEW;
483483
484484 ret = of_property_read_u32(np, "st,tune-hs-dc-level", &val);
drivers/phy/ti/phy-am654-serdes.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/**
2+/*
33 * PCIe SERDES driver for AM654x SoC
44 *
55 * Copyright (C) 2018 - 2019 Texas Instruments Incorporated - http://www.ti.com/
drivers/phy/ti/phy-j721e-wiz.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/**
2+/*
33 * Wrapper driver for SERDES used in J721E
44 *
55 * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
drivers/phy/ti/phy-omap-usb2.c+3−3
@@ -89,9 +89,9 @@ static inline void omap_usb_writel(void __iomem *addr, unsigned int offset, · 88 unmodified lines
8989 }
9090
9191 /**
92− * omap_usb2_set_comparator - links the comparator present in the system with
93− * this phy
94− * @comparator - the companion phy(comparator) for this phy
92+ * omap_usb2_set_comparator() - links the comparator present in the system with this phy
93+ *
94+ * @comparator: the companion phy(comparator) for this phy
9595 *
9696 * The phy companion driver should call this API passing the phy_companion
9797 * filled with set_vbus and start_srp to be used by usb phy.
drivers/phy/ti/phy-tusb1210.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0-only
2−/**
2+/*
33 * tusb1210.c - TUSB1210 USB ULPI PHY driver
44 *
55 * Copyright (C) 2015 Intel Corporation
drivers/reset/tegra/reset-bpmp.c+1−8
@@ -20,7 +20,6 @@ static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc, · 19 unmodified lines
2020 struct tegra_bpmp *bpmp = to_tegra_bpmp(rstc);
2121 struct mrq_reset_request request;
2222 struct tegra_bpmp_message msg;
23− int err;
2423
2524 memset(&request, 0, sizeof(request));
2625 request.cmd = command;
@@ -31,13 +30,7 @@ static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc, · 4 unmodified lines
3130 msg.tx.data = &request;
3231 msg.tx.size = sizeof(request);
3332
34− err = tegra_bpmp_transfer(bpmp, &msg);
35− if (err)
36− return err;
37− if (msg.rx.ret)
38− return -EINVAL;
39−
40− return 0;
33+ return tegra_bpmp_transfer(bpmp, &msg);
4134 }
4235
4336 static int tegra_bpmp_reset_module(struct reset_controller_dev *rstc,
drivers/scsi/pm8001/pm8001_init.c+2−4
@@ -282,12 +282,12 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, · 281 unmodified lines
282282 if (rc) {
283283 pm8001_dbg(pm8001_ha, FAIL,
284284 "pm8001_setup_irq failed [ret: %d]\n", rc);
285− goto err_out_shost;
285+ goto err_out;
286286 }
287287 /* Request Interrupt */
288288 rc = pm8001_request_irq(pm8001_ha);
289289 if (rc)
290− goto err_out_shost;
290+ goto err_out;
291291
292292 count = pm8001_ha->max_q_num;
293293 /* Queues are chosen based on the number of cores/msix availability */
@@ -423,8 +423,6 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, · 129 unmodified lines
423423 pm8001_tag_init(pm8001_ha);
424424 return 0;
425425
426−err_out_shost:
427− scsi_remove_host(pm8001_ha->shost);
428426 err_out_nodev:
429427 for (i = 0; i < pm8001_ha->max_memcnt; i++) {
430428 if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) {
drivers/scsi/qedi/qedi_fw.c+15−22
@@ -732,7 +732,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, · 731 unmodified lines
732732 {
733733 struct qedi_work_map *work, *work_tmp;
734734 u32 proto_itt = cqe->itid;
735− itt_t protoitt = 0;
736735 int found = 0;
737736 struct qedi_cmd *qedi_cmd = NULL;
738737 u32 iscsi_cid;
@@ -812,16 +811,12 @@ unlock: · 73 unmodified lines
812811 return;
813812
814813 check_cleanup_reqs:
815− if (qedi_conn->cmd_cleanup_req > 0) {
816− QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID,
814+ if (atomic_inc_return(&qedi_conn->cmd_cleanup_cmpl) ==
815+ qedi_conn->cmd_cleanup_req) {
816+ QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
817817 "Freeing tid=0x%x for cid=0x%x\n",
818818 cqe->itid, qedi_conn->iscsi_conn_id);
819− qedi_conn->cmd_cleanup_cmpl++;
820819 wake_up(&qedi_conn->wait_queue);
821− } else {
822− QEDI_ERR(&qedi->dbg_ctx,
823− "Delayed or untracked cleanup response, itt=0x%x, tid=0x%x, cid=0x%x\n",
824− protoitt, cqe->itid, qedi_conn->iscsi_conn_id);
825820 }
826821 }
827822
@@ -1163,7 +1158,7 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn, · 335 unmodified lines
11631158 }
11641159
11651160 qedi_conn->cmd_cleanup_req = 0;
1166− qedi_conn->cmd_cleanup_cmpl = 0;
1161+ atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0);
11671162
11681163 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
11691164 "active_cmd_count=%d, cid=0x%x, in_recovery=%d, lun_reset=%d\n",
@@ -1215,16 +1210,15 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn, · 45 unmodified lines
12151210 qedi_conn->iscsi_conn_id);
12161211
12171212 rval = wait_event_interruptible_timeout(qedi_conn->wait_queue,
1218− ((qedi_conn->cmd_cleanup_req ==
1219− qedi_conn->cmd_cleanup_cmpl) ||
1220− test_bit(QEDI_IN_RECOVERY,
1221− &qedi->flags)),
1222− 5 * HZ);
1213+ (qedi_conn->cmd_cleanup_req ==
1214+ atomic_read(&qedi_conn->cmd_cleanup_cmpl)) ||
1215+ test_bit(QEDI_IN_RECOVERY, &qedi->flags),
1216+ 5 * HZ);
12231217 if (rval) {
12241218 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
12251219 "i/o cmd_cleanup_req=%d, equal to cmd_cleanup_cmpl=%d, cid=0x%x\n",
12261220 qedi_conn->cmd_cleanup_req,
1227− qedi_conn->cmd_cleanup_cmpl,
1221+ atomic_read(&qedi_conn->cmd_cleanup_cmpl),
12281222 qedi_conn->iscsi_conn_id);
12291223
12301224 return 0;
@@ -1233,7 +1227,7 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn, · 2 unmodified lines
12331227 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
12341228 "i/o cmd_cleanup_req=%d, not equal to cmd_cleanup_cmpl=%d, cid=0x%x\n",
12351229 qedi_conn->cmd_cleanup_req,
1236− qedi_conn->cmd_cleanup_cmpl,
1230+ atomic_read(&qedi_conn->cmd_cleanup_cmpl),
12371231 qedi_conn->iscsi_conn_id);
12381232
12391233 iscsi_host_for_each_session(qedi->shost,
@@ -1242,11 +1236,10 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn, · 2 unmodified lines
12421236
12431237 /* Enable IOs for all other sessions except current.*/
12441238 if (!wait_event_interruptible_timeout(qedi_conn->wait_queue,
1245− (qedi_conn->cmd_cleanup_req ==
1246− qedi_conn->cmd_cleanup_cmpl) ||
1247− test_bit(QEDI_IN_RECOVERY,
1248− &qedi->flags),
1249− 5 * HZ)) {
1239+ (qedi_conn->cmd_cleanup_req ==
1240+ atomic_read(&qedi_conn->cmd_cleanup_cmpl)) ||
1241+ test_bit(QEDI_IN_RECOVERY, &qedi->flags),
1242+ 5 * HZ)) {
12501243 iscsi_host_for_each_session(qedi->shost,
12511244 qedi_mark_device_available);
12521245 return -1;
@@ -1266,7 +1259,7 @@ void qedi_clearsq(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn, · 13 unmodified lines
12661259
12671260 qedi_ep = qedi_conn->ep;
12681261 qedi_conn->cmd_cleanup_req = 0;
1269− qedi_conn->cmd_cleanup_cmpl = 0;
1262+ atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0);
12701263
12711264 if (!qedi_ep) {
12721265 QEDI_WARN(&qedi->dbg_ctx,
drivers/scsi/qedi/qedi_iscsi.c+1−1
@@ -412,7 +412,7 @@ static int qedi_conn_bind(struct iscsi_cls_session *cls_session, · 411 unmodified lines
412412 qedi_conn->iscsi_conn_id = qedi_ep->iscsi_cid;
413413 qedi_conn->fw_cid = qedi_ep->fw_cid;
414414 qedi_conn->cmd_cleanup_req = 0;
415− qedi_conn->cmd_cleanup_cmpl = 0;
415+ atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0);
416416
417417 if (qedi_bind_conn_to_iscsi_cid(qedi, qedi_conn)) {
418418 rc = -EINVAL;
drivers/scsi/qedi/qedi_iscsi.h+1−1
@@ -155,7 +155,7 @@ struct qedi_conn { · 154 unmodified lines
155155 spinlock_t list_lock; /* internal conn lock */
156156 u32 active_cmd_count;
157157 u32 cmd_cleanup_req;
158− u32 cmd_cleanup_cmpl;
158+ atomic_t cmd_cleanup_cmpl;
159159
160160 u32 iscsi_conn_id;
161161 int itt;
drivers/scsi/qla2xxx/qla_dbg.c+3−0
@@ -2491,6 +2491,9 @@ ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...) · 2490 unmodified lines
24912491 struct va_format vaf;
24922492 char pbuf[64];
24932493
2494+ if (!ql_mask_match(level) && !trace_ql_dbg_log_enabled())
2495+ return;
2496+
24942497 va_start(va, fmt);
24952498
24962499 vaf.fmt = fmt;
drivers/scsi/scsi_debug.c+1−1
@@ -4342,7 +4342,7 @@ static int resp_report_zones(struct scsi_cmnd *scp, · 4341 unmodified lines
43424342 rep_max_zones = min((alloc_len - 64) >> ilog2(RZONES_DESC_HD),
43434343 max_zones);
43444344
4345− arr = kcalloc(RZONES_DESC_HD, alloc_len, GFP_ATOMIC);
4345+ arr = kzalloc(alloc_len, GFP_ATOMIC);
43464346 if (!arr) {
43474347 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC,
43484348 INSUFF_RES_ASCQ);
drivers/soc/imx/imx8m-blk-ctrl.c+19−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717
1818 #define BLK_SFT_RSTN 0x0
1919 #define BLK_CLK_EN 0x4
20+#define BLK_MIPI_RESET_DIV 0x8 /* Mini/Nano DISPLAY_BLK_CTRL only */
2021
2122 struct imx8m_blk_ctrl_domain;
2223
@@ -36,6 +37,15 @@ struct imx8m_blk_ctrl_domain_data { · 13 unmodified lines
3637 const char *gpc_name;
3738 u32 rst_mask;
3839 u32 clk_mask;
40+
41+ /*
42+ * i.MX8M Mini and Nano have a third DISPLAY_BLK_CTRL register
43+ * which is used to control the reset for the MIPI Phy.
44+ * Since it's only present in certain circumstances,
45+ * an if-statement should be used before setting and clearing this
46+ * register.
47+ */
48+ u32 mipi_phy_rst_mask;
3949 };
4050
4151 #define DOMAIN_MAX_CLKS 3
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd) · 36 unmodified lines
7888
7989 /* put devices into reset */
8090 regmap_clear_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask);
91+ if (data->mipi_phy_rst_mask)
92+ regmap_clear_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask);
8193
8294 /* enable upstream and blk-ctrl clocks to allow reset to propagate */
8395 ret = clk_bulk_prepare_enable(data->num_clks, domain->clks);
@@ -99,6 +111,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd) · 15 unmodified lines
99111
100112 /* release reset */
101113 regmap_set_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask);
114+ if (data->mipi_phy_rst_mask)
115+ regmap_set_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask);
102116
103117 /* disable upstream clocks */
104118 clk_bulk_disable_unprepare(data->num_clks, domain->clks);
@@ -120,6 +134,9 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd) · 15 unmodified lines
120134 struct imx8m_blk_ctrl *bc = domain->bc;
121135
122136 /* put devices into reset and disable clocks */
137+ if (data->mipi_phy_rst_mask)
138+ regmap_clear_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask);
139+
123140 regmap_clear_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask);
124141 regmap_clear_bits(bc->regmap, BLK_CLK_EN, data->clk_mask);
125142
@@ -480,6 +497,7 @@ static const struct imx8m_blk_ctrl_domain_data imx8mm_disp_blk_ctl_domain_data[] · 354 unmodified lines
480497 .gpc_name = "mipi-dsi",
481498 .rst_mask = BIT(5),
482499 .clk_mask = BIT(8) | BIT(9),
500+ .mipi_phy_rst_mask = BIT(17),
483501 },
484502 [IMX8MM_DISPBLK_PD_MIPI_CSI] = {
485503 .name = "dispblk-mipi-csi",
@@ -488,6 +506,7 @@ static const struct imx8m_blk_ctrl_domain_data imx8mm_disp_blk_ctl_domain_data[] · 2 unmodified lines
488506 .gpc_name = "mipi-csi",
489507 .rst_mask = BIT(3) | BIT(4),
490508 .clk_mask = BIT(10) | BIT(11),
509+ .mipi_phy_rst_mask = BIT(16),
491510 },
492511 };
493512
drivers/soc/imx/soc-imx.c+4−0
@@ -36,6 +36,10 @@ static int __init imx_soc_device_init(void) · 35 unmodified lines
3636 int ret;
3737 int i;
3838
39+ /* Return early if this is running on devices with different SoCs */
40+ if (!__mxc_cpu_type)
41+ return 0;
42+
3943 if (of_machine_is_compatible("fsl,ls1021a"))
4044 return 0;
4145
drivers/soc/tegra/fuse/fuse-tegra.c+1−1
@@ -320,7 +320,7 @@ static struct platform_driver tegra_fuse_driver = { · 319 unmodified lines
320320 };
321321 builtin_platform_driver(tegra_fuse_driver);
322322
323−bool __init tegra_fuse_read_spare(unsigned int spare)
323+u32 __init tegra_fuse_read_spare(unsigned int spare)
324324 {
325325 unsigned int offset = fuse->soc->info->spare + spare * 4;
326326
drivers/soc/tegra/fuse/fuse.h+1−1
@@ -65,7 +65,7 @@ struct tegra_fuse { · 64 unmodified lines
6565 void tegra_init_revision(void);
6666 void tegra_init_apbmisc(void);
6767
68−bool __init tegra_fuse_read_spare(unsigned int spare);
68+u32 __init tegra_fuse_read_spare(unsigned int spare);
6969 u32 __init tegra_fuse_read_early(unsigned int offset);
7070
7171 u8 tegra_get_major_rev(void);
drivers/tee/amdtee/core.c+2−3
@@ -203,9 +203,8 @@ static int copy_ta_binary(struct tee_context *ctx, void *ptr, void **ta, · 202 unmodified lines
203203
204204 *ta_size = roundup(fw->size, PAGE_SIZE);
205205 *ta = (void *)__get_free_pages(GFP_KERNEL, get_order(*ta_size));
206− if (IS_ERR(*ta)) {
207− pr_err("%s: get_free_pages failed 0x%llx\n", __func__,
208− (u64)*ta);
206+ if (!*ta) {
207+ pr_err("%s: get_free_pages failed\n", __func__);
209208 rc = -ENOMEM;
210209 goto rel_fw;
211210 }
drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c+1−1
@@ -29,7 +29,7 @@ static const char * const fivr_strings[] = { · 28 unmodified lines
2929 };
3030
3131 static const struct mmio_reg tgl_fivr_mmio_regs[] = {
32− { 0, 0x5A18, 3, 0x7, 12}, /* vco_ref_code_lo */
32+ { 0, 0x5A18, 3, 0x7, 11}, /* vco_ref_code_lo */
3333 { 0, 0x5A18, 8, 0xFF, 16}, /* vco_ref_code_hi */
3434 { 0, 0x5A08, 8, 0xFF, 0}, /* spread_spectrum_pct */
3535 { 0, 0x5A08, 1, 0x1, 8}, /* spread_spectrum_clk_enable */
drivers/usb/core/config.c+3−3
@@ -406,7 +406,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, · 405 unmodified lines
406406 * the USB-2 spec requires such endpoints to have wMaxPacketSize = 0
407407 * (see the end of section 5.6.3), so don't warn about them.
408408 */
409− maxp = usb_endpoint_maxp(&endpoint->desc);
409+ maxp = le16_to_cpu(endpoint->desc.wMaxPacketSize);
410410 if (maxp == 0 && !(usb_endpoint_xfer_isoc(d) && asnum == 0)) {
411411 dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n",
412412 cfgno, inum, asnum, d->bEndpointAddress);
@@ -422,9 +422,9 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, · 9 unmodified lines
422422 maxpacket_maxes = full_speed_maxpacket_maxes;
423423 break;
424424 case USB_SPEED_HIGH:
425− /* Bits 12..11 are allowed only for HS periodic endpoints */
425+ /* Multiple-transactions bits are allowed only for HS periodic endpoints */
426426 if (usb_endpoint_xfer_int(d) || usb_endpoint_xfer_isoc(d)) {
427− i = maxp & (BIT(12) | BIT(11));
427+ i = maxp & USB_EP_MAXP_MULT_MASK;
428428 maxp &= ~i;
429429 }
430430 fallthrough;
drivers/usb/dwc3/dwc3-qcom.c+0−15
@@ -649,7 +649,6 @@ static int dwc3_qcom_of_register_core(struct platform_device *pdev) · 648 unmodified lines
649649 struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
650650 struct device_node *np = pdev->dev.of_node, *dwc3_np;
651651 struct device *dev = &pdev->dev;
652− struct property *prop;
653652 int ret;
654653
655654 dwc3_np = of_get_compatible_child(np, "snps,dwc3");
@@ -658,20 +657,6 @@ static int dwc3_qcom_of_register_core(struct platform_device *pdev) · 2 unmodified lines
658657 return -ENODEV;
659658 }
660659
661− prop = devm_kzalloc(dev, sizeof(*prop), GFP_KERNEL);
662− if (!prop) {
663− ret = -ENOMEM;
664− dev_err(dev, "unable to allocate memory for property\n");
665− goto node_put;
666− }
667−
668− prop->name = "tx-fifo-resize";
669− ret = of_add_property(dwc3_np, prop);
670− if (ret) {
671− dev_err(dev, "unable to add property\n");
672− goto node_put;
673− }
674−
675660 ret = of_platform_populate(np, NULL, NULL, dev);
676661 if (ret) {
677662 dev_err(dev, "failed to register dwc3 core - %d\n", ret);
drivers/usb/gadget/composite.c+13−1
@@ -1679,6 +1679,18 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) · 1678 unmodified lines
16791679 struct usb_function *f = NULL;
16801680 u8 endp;
16811681
1682+ if (w_length > USB_COMP_EP0_BUFSIZ) {
1683+ if (ctrl->bRequestType == USB_DIR_OUT) {
1684+ goto done;
1685+ } else {
1686+ /* Cast away the const, we are going to overwrite on purpose. */
1687+ __le16 *temp = (__le16 *)&ctrl->wLength;
1688+
1689+ *temp = cpu_to_le16(USB_COMP_EP0_BUFSIZ);
1690+ w_length = USB_COMP_EP0_BUFSIZ;
1691+ }
1692+ }
1693+
16821694 /* partial re-init of the response message; the function or the
16831695 * gadget might need to intercept e.g. a control-OUT completion
16841696 * when we delegate to it.
@@ -2209,7 +2221,7 @@ int composite_dev_prepare(struct usb_composite_driver *composite, · 524 unmodified lines
22092221 if (!cdev->req)
22102222 return -ENOMEM;
22112223
2212− cdev->req->buf = kmalloc(USB_COMP_EP0_BUFSIZ, GFP_KERNEL);
2224+ cdev->req->buf = kzalloc(USB_COMP_EP0_BUFSIZ, GFP_KERNEL);
22132225 if (!cdev->req->buf)
22142226 goto fail;
22152227
drivers/usb/gadget/legacy/dbgp.c+14−1
@@ -137,7 +137,7 @@ static int dbgp_enable_ep_req(struct usb_ep *ep) · 136 unmodified lines
137137 goto fail_1;
138138 }
139139
140− req->buf = kmalloc(DBGP_REQ_LEN, GFP_KERNEL);
140+ req->buf = kzalloc(DBGP_REQ_LEN, GFP_KERNEL);
141141 if (!req->buf) {
142142 err = -ENOMEM;
143143 stp = 2;
@@ -345,6 +345,19 @@ static int dbgp_setup(struct usb_gadget *gadget, · 201 unmodified lines
345345 void *data = NULL;
346346 u16 len = 0;
347347
348+ if (length > DBGP_REQ_LEN) {
349+ if (ctrl->bRequestType == USB_DIR_OUT) {
350+ return err;
351+ } else {
352+ /* Cast away the const, we are going to overwrite on purpose. */
353+ __le16 *temp = (__le16 *)&ctrl->wLength;
354+
355+ *temp = cpu_to_le16(DBGP_REQ_LEN);
356+ length = DBGP_REQ_LEN;
357+ }
358+ }
359+
360+
348361 if (request == USB_REQ_GET_DESCRIPTOR) {
349362 switch (value>>8) {
350363 case USB_DT_DEVICE:
drivers/usb/gadget/legacy/inode.c+15−1
@@ -110,6 +110,8 @@ enum ep0_state { · 109 unmodified lines
110110 /* enough for the whole queue: most events invalidate others */
111111 #define N_EVENT 5
112112
113+#define RBUF_SIZE 256
114+
113115 struct dev_data {
114116 spinlock_t lock;
115117 refcount_t count;
@@ -144,7 +146,7 @@ struct dev_data { · 28 unmodified lines
144146 struct dentry *dentry;
145147
146148 /* except this scratch i/o buffer for ep0 */
147− u8 rbuf [256];
149+ u8 rbuf[RBUF_SIZE];
148150 };
149151
150152 static inline void get_dev (struct dev_data *data)
@@ -1331,6 +1333,18 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) · 1180 unmodified lines
13311333 u16 w_value = le16_to_cpu(ctrl->wValue);
13321334 u16 w_length = le16_to_cpu(ctrl->wLength);
13331335
1336+ if (w_length > RBUF_SIZE) {
1337+ if (ctrl->bRequestType == USB_DIR_OUT) {
1338+ return value;
1339+ } else {
1340+ /* Cast away the const, we are going to overwrite on purpose. */
1341+ __le16 *temp = (__le16 *)&ctrl->wLength;
1342+
1343+ *temp = cpu_to_le16(RBUF_SIZE);
1344+ w_length = RBUF_SIZE;
1345+ }
1346+ }
1347+
13341348 spin_lock (&dev->lock);
13351349 dev->setup_abort = 0;
13361350 if (dev->state == STATE_DEV_UNCONNECTED) {
drivers/usb/host/xhci-hub.c+1−0
@@ -717,6 +717,7 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci, · 716 unmodified lines
717717 continue;
718718
719719 retval = xhci_disable_slot(xhci, i);
720+ xhci_free_virt_device(xhci, i);
720721 if (retval)
721722 xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n",
722723 i, retval);
drivers/usb/host/xhci-ring.c+0−1
@@ -1525,7 +1525,6 @@ static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id) · 1524 unmodified lines
15251525 if (xhci->quirks & XHCI_EP_LIMIT_QUIRK)
15261526 /* Delete default control endpoint resources */
15271527 xhci_free_device_endpoint_resources(xhci, virt_dev, true);
1528− xhci_free_virt_device(xhci, slot_id);
15291528 }
15301529
15311530 static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id,
drivers/usb/host/xhci.c+15−11
@@ -3934,7 +3934,6 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) · 3933 unmodified lines
39343934 struct xhci_slot_ctx *slot_ctx;
39353935 int i, ret;
39363936
3937−#ifndef CONFIG_USB_DEFAULT_PERSIST
39383937 /*
39393938 * We called pm_runtime_get_noresume when the device was attached.
39403939 * Decrement the counter here to allow controller to runtime suspend
@@ -3942,7 +3941,6 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) · 1 unmodified line
39423941 */
39433942 if (xhci->quirks & XHCI_RESET_ON_RESUME)
39443943 pm_runtime_put_noidle(hcd->self.controller);
3945−#endif
39463944
39473945 ret = xhci_check_args(hcd, udev, NULL, 0, true, __func__);
39483946 /* If the host is halted due to driver unload, we still need to free the
@@ -3961,9 +3959,8 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) · 12 unmodified lines
39613959 del_timer_sync(&virt_dev->eps[i].stop_cmd_timer);
39623960 }
39633961 virt_dev->udev = NULL;
3964− ret = xhci_disable_slot(xhci, udev->slot_id);
3965− if (ret)
3966− xhci_free_virt_device(xhci, udev->slot_id);
3962+ xhci_disable_slot(xhci, udev->slot_id);
3963+ xhci_free_virt_device(xhci, udev->slot_id);
39673964 }
39683965
39693966 int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id)
@@ -3973,7 +3970,7 @@ int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id) · 3 unmodified lines
39733970 u32 state;
39743971 int ret = 0;
39753972
3976− command = xhci_alloc_command(xhci, false, GFP_KERNEL);
3973+ command = xhci_alloc_command(xhci, true, GFP_KERNEL);
39773974 if (!command)
39783975 return -ENOMEM;
39793976
@@ -3998,6 +3995,15 @@ int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id) · 18 unmodified lines
39983995 }
39993996 xhci_ring_cmd_db(xhci);
40003997 spin_unlock_irqrestore(&xhci->lock, flags);
3998+
3999+ wait_for_completion(command->completion);
4000+
4001+ if (command->status != COMP_SUCCESS)
4002+ xhci_warn(xhci, "Unsuccessful disable slot %u command, status %d\n",
4003+ slot_id, command->status);
4004+
4005+ xhci_free_command(xhci, command);
4006+
40014007 return ret;
40024008 }
40034009
@@ -4094,23 +4100,20 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) · 90 unmodified lines
40944100
40954101 xhci_debugfs_create_slot(xhci, slot_id);
40964102
4097−#ifndef CONFIG_USB_DEFAULT_PERSIST
40984103 /*
40994104 * If resetting upon resume, we can't put the controller into runtime
41004105 * suspend if there is a device attached.
41014106 */
41024107 if (xhci->quirks & XHCI_RESET_ON_RESUME)
41034108 pm_runtime_get_noresume(hcd->self.controller);
4104−#endif
41054109
41064110 /* Is this a LS or FS device under a HS hub? */
41074111 /* Hub or peripherial? */
41084112 return 1;
41094113
41104114 disable_slot:
4111− ret = xhci_disable_slot(xhci, udev->slot_id);
4112− if (ret)
4113− xhci_free_virt_device(xhci, udev->slot_id);
4115+ xhci_disable_slot(xhci, udev->slot_id);
4116+ xhci_free_virt_device(xhci, udev->slot_id);
41144117
41154118 return 0;
41164119 }
@@ -4240,6 +4243,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, · 123 unmodified lines
42404243
42414244 mutex_unlock(&xhci->mutex);
42424245 ret = xhci_disable_slot(xhci, udev->slot_id);
4246+ xhci_free_virt_device(xhci, udev->slot_id);
42434247 if (!ret)
42444248 xhci_alloc_dev(hcd, udev);
42454249 kfree(command->completion);
drivers/vdpa/vdpa.c+2−1
@@ -404,7 +404,8 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m · 403 unmodified lines
404404 goto msg_err;
405405
406406 while (mdev->id_table[i].device) {
407− supported_classes |= BIT(mdev->id_table[i].device);
407+ if (mdev->id_table[i].device <= 63)
408+ supported_classes |= BIT_ULL(mdev->id_table[i].device);
408409 i++;
409410 }
410411
drivers/vdpa/vdpa_user/vduse_dev.c+4−2
@@ -655,7 +655,8 @@ static void vduse_vdpa_get_config(struct vdpa_device *vdpa, unsigned int offset, · 654 unmodified lines
655655 {
656656 struct vduse_dev *dev = vdpa_to_vduse(vdpa);
657657
658− if (len > dev->config_size - offset)
658+ if (offset > dev->config_size ||
659+ len > dev->config_size - offset)
659660 return;
660661
661662 memcpy(buf, dev->config + offset, len);
@@ -975,7 +976,8 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd, · 313 unmodified lines
975976 break;
976977
977978 ret = -EINVAL;
978− if (config.length == 0 ||
979+ if (config.offset > dev->config_size ||
980+ config.length == 0 ||
979981 config.length > dev->config_size - config.offset)
980982 break;
981983
drivers/vhost/vdpa.c+1−1
@@ -197,7 +197,7 @@ static int vhost_vdpa_config_validate(struct vhost_vdpa *v, · 196 unmodified lines
197197 struct vdpa_device *vdpa = v->vdpa;
198198 long size = vdpa->config->get_config_size(vdpa);
199199
200− if (c->len == 0)
200+ if (c->len == 0 || c->off > size)
201201 return -EINVAL;
202202
203203 if (c->len > size - c->off)
drivers/virtio/virtio_ring.c+1−1
@@ -268,7 +268,7 @@ size_t virtio_max_dma_size(struct virtio_device *vdev) · 267 unmodified lines
268268 size_t max_segment_size = SIZE_MAX;
269269
270270 if (vring_use_dma_api(vdev))
271− max_segment_size = dma_max_mapping_size(&vdev->dev);
271+ max_segment_size = dma_max_mapping_size(vdev->dev.parent);
272272
273273 return max_segment_size;
274274 }
fs/afs/file.c+3−2
@@ -514,8 +514,9 @@ static void afs_add_open_mmap(struct afs_vnode *vnode) · 513 unmodified lines
514514 if (atomic_inc_return(&vnode->cb_nr_mmap) == 1) {
515515 down_write(&vnode->volume->cell->fs_open_mmaps_lock);
516516
517− list_add_tail(&vnode->cb_mmap_link,
518− &vnode->volume->cell->fs_open_mmaps);
517+ if (list_empty(&vnode->cb_mmap_link))
518+ list_add_tail(&vnode->cb_mmap_link,
519+ &vnode->volume->cell->fs_open_mmaps);
519520
520521 up_write(&vnode->volume->cell->fs_open_mmaps_lock);
521522 }
fs/afs/super.c+1−0
@@ -667,6 +667,7 @@ static void afs_i_init_once(void *_vnode) · 666 unmodified lines
667667 INIT_LIST_HEAD(&vnode->pending_locks);
668668 INIT_LIST_HEAD(&vnode->granted_locks);
669669 INIT_DELAYED_WORK(&vnode->lock_work, afs_lock_work);
670+ INIT_LIST_HEAD(&vnode->cb_mmap_link);
670671 seqlock_init(&vnode->cb_lock);
671672 }
672673
fs/aio.c+152−34
@@ -181,8 +181,9 @@ struct poll_iocb { · 180 unmodified lines
181181 struct file *file;
182182 struct wait_queue_head *head;
183183 __poll_t events;
184− bool done;
185184 bool cancelled;
185+ bool work_scheduled;
186+ bool work_need_resched;
186187 struct wait_queue_entry wait;
187188 struct work_struct work;
188189 };
@@ -1619,6 +1620,51 @@ static void aio_poll_put_work(struct work_struct *work) · 1430 unmodified lines
16191620 iocb_put(iocb);
16201621 }
16211622
1623+/*
1624+ * Safely lock the waitqueue which the request is on, synchronizing with the
1625+ * case where the ->poll() provider decides to free its waitqueue early.
1626+ *
1627+ * Returns true on success, meaning that req->head->lock was locked, req->wait
1628+ * is on req->head, and an RCU read lock was taken. Returns false if the
1629+ * request was already removed from its waitqueue (which might no longer exist).
1630+ */
1631+static bool poll_iocb_lock_wq(struct poll_iocb *req)
1632+{
1633+ wait_queue_head_t *head;
1634+
1635+ /*
1636+ * While we hold the waitqueue lock and the waitqueue is nonempty,
1637+ * wake_up_pollfree() will wait for us. However, taking the waitqueue
1638+ * lock in the first place can race with the waitqueue being freed.
1639+ *
1640+ * We solve this as eventpoll does: by taking advantage of the fact that
1641+ * all users of wake_up_pollfree() will RCU-delay the actual free. If
1642+ * we enter rcu_read_lock() and see that the pointer to the queue is
1643+ * non-NULL, we can then lock it without the memory being freed out from
1644+ * under us, then check whether the request is still on the queue.
1645+ *
1646+ * Keep holding rcu_read_lock() as long as we hold the queue lock, in
1647+ * case the caller deletes the entry from the queue, leaving it empty.
1648+ * In that case, only RCU prevents the queue memory from being freed.
1649+ */
1650+ rcu_read_lock();
1651+ head = smp_load_acquire(&req->head);
1652+ if (head) {
1653+ spin_lock(&head->lock);
1654+ if (!list_empty(&req->wait.entry))
1655+ return true;
1656+ spin_unlock(&head->lock);
1657+ }
1658+ rcu_read_unlock();
1659+ return false;
1660+}
1661+
1662+static void poll_iocb_unlock_wq(struct poll_iocb *req)
1663+{
1664+ spin_unlock(&req->head->lock);
1665+ rcu_read_unlock();
1666+}
1667+
16221668 static void aio_poll_complete_work(struct work_struct *work)
16231669 {
16241670 struct poll_iocb *req = container_of(work, struct poll_iocb, work);
@@ -1638,14 +1684,27 @@ static void aio_poll_complete_work(struct work_struct *work) · 13 unmodified lines
16381684 * avoid further branches in the fast path.
16391685 */
16401686 spin_lock_irq(&ctx->ctx_lock);
1641− if (!mask && !READ_ONCE(req->cancelled)) {
1642− add_wait_queue(req->head, &req->wait);
1643− spin_unlock_irq(&ctx->ctx_lock);
1644− return;
1645− }
1687+ if (poll_iocb_lock_wq(req)) {
1688+ if (!mask && !READ_ONCE(req->cancelled)) {
1689+ /*
1690+ * The request isn't actually ready to be completed yet.
1691+ * Reschedule completion if another wakeup came in.
1692+ */
1693+ if (req->work_need_resched) {
1694+ schedule_work(&req->work);
1695+ req->work_need_resched = false;
1696+ } else {
1697+ req->work_scheduled = false;
1698+ }
1699+ poll_iocb_unlock_wq(req);
1700+ spin_unlock_irq(&ctx->ctx_lock);
1701+ return;
1702+ }
1703+ list_del_init(&req->wait.entry);
1704+ poll_iocb_unlock_wq(req);
1705+ } /* else, POLLFREE has freed the waitqueue, so we must complete */
16461706 list_del_init(&iocb->ki_list);
16471707 iocb->ki_res.res = mangle_poll(mask);
1648− req->done = true;
16491708 spin_unlock_irq(&ctx->ctx_lock);
16501709
16511710 iocb_put(iocb);
@@ -1657,13 +1716,14 @@ static int aio_poll_cancel(struct kiocb *iocb) · 5 unmodified lines
16571716 struct aio_kiocb *aiocb = container_of(iocb, struct aio_kiocb, rw);
16581717 struct poll_iocb *req = &aiocb->poll;
16591718
1660− spin_lock(&req->head->lock);
1661− WRITE_ONCE(req->cancelled, true);
1662− if (!list_empty(&req->wait.entry)) {
1663− list_del_init(&req->wait.entry);
1664− schedule_work(&aiocb->poll.work);
1665− }
1666− spin_unlock(&req->head->lock);
1719+ if (poll_iocb_lock_wq(req)) {
1720+ WRITE_ONCE(req->cancelled, true);
1721+ if (!req->work_scheduled) {
1722+ schedule_work(&aiocb->poll.work);
1723+ req->work_scheduled = true;
1724+ }
1725+ poll_iocb_unlock_wq(req);
1726+ } /* else, the request was force-cancelled by POLLFREE already */
16671727
16681728 return 0;
16691729 }
@@ -1680,21 +1740,27 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync, · 10 unmodified lines
16801740 if (mask && !(mask & req->events))
16811741 return 0;
16821742
1683− list_del_init(&req->wait.entry);
1684−
1685− if (mask && spin_trylock_irqsave(&iocb->ki_ctx->ctx_lock, flags)) {
1743+ /*
1744+ * Complete the request inline if possible. This requires that three
1745+ * conditions be met:
1746+ * 1. An event mask must have been passed. If a plain wakeup was done
1747+ * instead, then mask == 0 and we have to call vfs_poll() to get
1748+ * the events, so inline completion isn't possible.
1749+ * 2. The completion work must not have already been scheduled.
1750+ * 3. ctx_lock must not be busy. We have to use trylock because we
1751+ * already hold the waitqueue lock, so this inverts the normal
1752+ * locking order. Use irqsave/irqrestore because not all
1753+ * filesystems (e.g. fuse) call this function with IRQs disabled,
1754+ * yet IRQs have to be disabled before ctx_lock is obtained.
1755+ */
1756+ if (mask && !req->work_scheduled &&
1757+ spin_trylock_irqsave(&iocb->ki_ctx->ctx_lock, flags)) {
16861758 struct kioctx *ctx = iocb->ki_ctx;
16871759
1688− /*
1689− * Try to complete the iocb inline if we can. Use
1690− * irqsave/irqrestore because not all filesystems (e.g. fuse)
1691− * call this function with IRQs disabled and because IRQs
1692− * have to be disabled before ctx_lock is obtained.
1693− */
1760+ list_del_init(&req->wait.entry);
16941761 list_del(&iocb->ki_list);
16951762 iocb->ki_res.res = mangle_poll(mask);
1696− req->done = true;
1697− if (iocb->ki_eventfd && eventfd_signal_allowed()) {
1763+ if (iocb->ki_eventfd && !eventfd_signal_allowed()) {
16981764 iocb = NULL;
16991765 INIT_WORK(&req->work, aio_poll_put_work);
17001766 schedule_work(&req->work);
@@ -1703,7 +1769,43 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync, · 2 unmodified lines
17031769 if (iocb)
17041770 iocb_put(iocb);
17051771 } else {
1706− schedule_work(&req->work);
1772+ /*
1773+ * Schedule the completion work if needed. If it was already
1774+ * scheduled, record that another wakeup came in.
1775+ *
1776+ * Don't remove the request from the waitqueue here, as it might
1777+ * not actually be complete yet (we won't know until vfs_poll()
1778+ * is called), and we must not miss any wakeups. POLLFREE is an
1779+ * exception to this; see below.
1780+ */
1781+ if (req->work_scheduled) {
1782+ req->work_need_resched = true;
1783+ } else {
1784+ schedule_work(&req->work);
1785+ req->work_scheduled = true;
1786+ }
1787+
1788+ /*
1789+ * If the waitqueue is being freed early but we can't complete
1790+ * the request inline, we have to tear down the request as best
1791+ * we can. That means immediately removing the request from its
1792+ * waitqueue and preventing all further accesses to the
1793+ * waitqueue via the request. We also need to schedule the
1794+ * completion work (done above). Also mark the request as
1795+ * cancelled, to potentially skip an unneeded call to ->poll().
1796+ */
1797+ if (mask & POLLFREE) {
1798+ WRITE_ONCE(req->cancelled, true);
1799+ list_del_init(&req->wait.entry);
1800+
1801+ /*
1802+ * Careful: this *must* be the last step, since as soon
1803+ * as req->head is NULL'ed out, the request can be
1804+ * completed and freed, since aio_poll_complete_work()
1805+ * will no longer need to take the waitqueue lock.
1806+ */
1807+ smp_store_release(&req->head, NULL);
1808+ }
17071809 }
17081810 return 1;
17091811 }
@@ -1711,6 +1813,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync, · 1 unmodified line
17111813 struct aio_poll_table {
17121814 struct poll_table_struct pt;
17131815 struct aio_kiocb *iocb;
1816+ bool queued;
17141817 int error;
17151818 };
17161819
@@ -1721,11 +1824,12 @@ aio_poll_queue_proc(struct file *file, struct wait_queue_head *head, · 4 unmodified lines
17211824 struct aio_poll_table *pt = container_of(p, struct aio_poll_table, pt);
17221825
17231826 /* multiple wait queues per file are not supported */
1724− if (unlikely(pt->iocb->poll.head)) {
1827+ if (unlikely(pt->queued)) {
17251828 pt->error = -EINVAL;
17261829 return;
17271830 }
17281831
1832+ pt->queued = true;
17291833 pt->error = 0;
17301834 pt->iocb->poll.head = head;
17311835 add_wait_queue(head, &pt->iocb->poll.wait);
@@ -1750,12 +1854,14 @@ static int aio_poll(struct aio_kiocb *aiocb, const struct iocb *iocb) · 18 unmodified lines
17501854 req->events = demangle_poll(iocb->aio_buf) | EPOLLERR | EPOLLHUP;
17511855
17521856 req->head = NULL;
1753− req->done = false;
17541857 req->cancelled = false;
1858+ req->work_scheduled = false;
1859+ req->work_need_resched = false;
17551860
17561861 apt.pt._qproc = aio_poll_queue_proc;
17571862 apt.pt._key = req->events;
17581863 apt.iocb = aiocb;
1864+ apt.queued = false;
17591865 apt.error = -EINVAL; /* same as no support for IOCB_CMD_POLL */
17601866
17611867 /* initialized the list so that we can do list_empty checks */
@@ -1764,23 +1870,35 @@ static int aio_poll(struct aio_kiocb *aiocb, const struct iocb *iocb) · 2 unmodified lines
17641870
17651871 mask = vfs_poll(req->file, &apt.pt) & req->events;
17661872 spin_lock_irq(&ctx->ctx_lock);
1767− if (likely(req->head)) {
1768− spin_lock(&req->head->lock);
1769− if (unlikely(list_empty(&req->wait.entry))) {
1770− if (apt.error)
1873+ if (likely(apt.queued)) {
1874+ bool on_queue = poll_iocb_lock_wq(req);
1875+
1876+ if (!on_queue || req->work_scheduled) {
1877+ /*
1878+ * aio_poll_wake() already either scheduled the async
1879+ * completion work, or completed the request inline.
1880+ */
1881+ if (apt.error) /* unsupported case: multiple queues */
17711882 cancel = true;
17721883 apt.error = 0;
17731884 mask = 0;
17741885 }
17751886 if (mask || apt.error) {
1887+ /* Steal to complete synchronously. */
17761888 list_del_init(&req->wait.entry);
17771889 } else if (cancel) {
1890+ /* Cancel if possible (may be too late though). */
17781891 WRITE_ONCE(req->cancelled, true);
1779− } else if (!req->done) { /* actually waiting for an event */
1892+ } else if (on_queue) {
1893+ /*
1894+ * Actually waiting for an event, so add the request to
1895+ * active_reqs so that it can be cancelled if needed.
1896+ */
17801897 list_add_tail(&aiocb->ki_list, &ctx->active_reqs);
17811898 aiocb->ki_cancel = aio_poll_cancel;
17821899 }
1783− spin_unlock(&req->head->lock);
1900+ if (on_queue)
1901+ poll_iocb_unlock_wq(req);
17841902 }
17851903 if (mask) { /* no async, we'd stolen it */
17861904 aiocb->ki_res.res = mangle_poll(mask);
fs/btrfs/delalloc-space.c+9−3
@@ -143,10 +143,13 @@ int btrfs_check_data_free_space(struct btrfs_inode *inode, · 142 unmodified lines
143143
144144 /* Use new btrfs_qgroup_reserve_data to reserve precious data space. */
145145 ret = btrfs_qgroup_reserve_data(inode, reserved, start, len);
146− if (ret < 0)
146+ if (ret < 0) {
147147 btrfs_free_reserved_data_space_noquota(fs_info, len);
148− else
148+ extent_changeset_free(*reserved);
149+ *reserved = NULL;
150+ } else {
149151 ret = 0;
152+ }
150153 return ret;
151154 }
152155
@@ -452,8 +455,11 @@ int btrfs_delalloc_reserve_space(struct btrfs_inode *inode, · 299 unmodified lines
452455 if (ret < 0)
453456 return ret;
454457 ret = btrfs_delalloc_reserve_metadata(inode, len);
455− if (ret < 0)
458+ if (ret < 0) {
456459 btrfs_free_reserved_data_space(inode, *reserved, start, len);
460+ extent_changeset_free(*reserved);
461+ *reserved = NULL;
462+ }
457463 return ret;
458464 }
459465
fs/btrfs/extent-tree.c+3−0
@@ -6051,6 +6051,9 @@ int btrfs_trim_fs(struct btrfs_fs_info *fs_info, struct fstrim_range *range) · 6050 unmodified lines
60516051 int dev_ret = 0;
60526052 int ret = 0;
60536053
6054+ if (range->start == U64_MAX)
6055+ return -EINVAL;
6056+
60546057 /*
60556058 * Check range overflow if range->len is set.
60566059 * The default range->len is U64_MAX.
fs/btrfs/extent_io.c+14−0
@@ -4313,6 +4313,20 @@ static void set_btree_ioerr(struct page *page, struct extent_buffer *eb) · 4312 unmodified lines
43134313 if (test_and_set_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags))
43144314 return;
43154315
4316+ /*
4317+ * A read may stumble upon this buffer later, make sure that it gets an
4318+ * error and knows there was an error.
4319+ */
4320+ clear_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
4321+
4322+ /*
4323+ * We need to set the mapping with the io error as well because a write
4324+ * error will flip the file system readonly, and then syncfs() will
4325+ * return a 0 because we are readonly if we don't modify the err seq for
4326+ * the superblock.
4327+ */
4328+ mapping_set_error(page->mapping, -EIO);
4329+
43164330 /*
43174331 * If we error out, we should add back the dirty_metadata_bytes
43184332 * to make it consistent.
fs/btrfs/ioctl.c+2−4
@@ -3187,10 +3187,8 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg) · 3186 unmodified lines
31873187 return -EPERM;
31883188
31893189 vol_args = memdup_user(arg, sizeof(*vol_args));
3190− if (IS_ERR(vol_args)) {
3191− ret = PTR_ERR(vol_args);
3192− goto out;
3193− }
3190+ if (IS_ERR(vol_args))
3191+ return PTR_ERR(vol_args);
31943192
31953193 if (vol_args->flags & ~BTRFS_DEVICE_REMOVE_ARGS_MASK) {
31963194 ret = -EOPNOTSUPP;
fs/btrfs/root-tree.c+2−1
@@ -334,7 +334,8 @@ int btrfs_del_root_ref(struct btrfs_trans_handle *trans, u64 root_id, · 333 unmodified lines
334334 key.offset = ref_id;
335335 again:
336336 ret = btrfs_search_slot(trans, tree_root, &key, path, -1, 1);
337− BUG_ON(ret < 0);
337+ if (ret < 0)
338+ goto out;
338339 if (ret == 0) {
339340 leaf = path->nodes[0];
340341 ref = btrfs_item_ptr(leaf, path->slots[0],
fs/btrfs/tree-log.c+3−2
@@ -2908,6 +2908,8 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans, · 2907 unmodified lines
29082908 path->nodes[*level]->len);
29092909 if (ret)
29102910 return ret;
2911+ btrfs_redirty_list_add(trans->transaction,
2912+ next);
29112913 } else {
29122914 if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &next->bflags))
29132915 clear_extent_buffer_dirty(next);
@@ -2988,6 +2990,7 @@ static int walk_log_tree(struct btrfs_trans_handle *trans, · 74 unmodified lines
29882990 next->start, next->len);
29892991 if (ret)
29902992 goto out;
2993+ btrfs_redirty_list_add(trans->transaction, next);
29912994 } else {
29922995 if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &next->bflags))
29932996 clear_extent_buffer_dirty(next);
@@ -3438,8 +3441,6 @@ static void free_log_tree(struct btrfs_trans_handle *trans, · 444 unmodified lines
34383441 EXTENT_DIRTY | EXTENT_NEW | EXTENT_NEED_WAIT);
34393442 extent_io_tree_release(&log->log_csum_range);
34403443
3441− if (trans && log->node)
3442− btrfs_redirty_list_add(trans->transaction, log->node);
34433444 btrfs_put_root(log);
34443445 }
34453446
fs/btrfs/zoned.c+2−0
@@ -1860,6 +1860,7 @@ int btrfs_zone_finish(struct btrfs_block_group *block_group) · 1859 unmodified lines
18601860 block_group->alloc_offset = block_group->zone_capacity;
18611861 block_group->free_space_ctl->free_space = 0;
18621862 btrfs_clear_treelog_bg(block_group);
1863+ btrfs_clear_data_reloc_bg(block_group);
18631864 spin_unlock(&block_group->lock);
18641865
18651866 ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH,
@@ -1942,6 +1943,7 @@ void btrfs_zone_finish_endio(struct btrfs_fs_info *fs_info, u64 logical, u64 len · 76 unmodified lines
19421943 ASSERT(block_group->alloc_offset == block_group->zone_capacity);
19431944 ASSERT(block_group->free_space_ctl->free_space == 0);
19441945 btrfs_clear_treelog_bg(block_group);
1946+ btrfs_clear_data_reloc_bg(block_group);
19451947 spin_unlock(&block_group->lock);
19461948
19471949 map = block_group->physical_map;
fs/ceph/caps.c+8−8
@@ -4350,7 +4350,7 @@ void ceph_get_fmode(struct ceph_inode_info *ci, int fmode, int count) · 4349 unmodified lines
43504350 {
43514351 struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(ci->vfs_inode.i_sb);
43524352 int bits = (fmode << 1) | 1;
4353− bool is_opened = false;
4353+ bool already_opened = false;
43544354 int i;
43554355
43564356 if (count == 1)
@@ -4358,19 +4358,19 @@ void ceph_get_fmode(struct ceph_inode_info *ci, int fmode, int count) · 1 unmodified line
43584358
43594359 spin_lock(&ci->i_ceph_lock);
43604360 for (i = 0; i < CEPH_FILE_MODE_BITS; i++) {
4361− if (bits & (1 << i))
4362− ci->i_nr_by_mode[i] += count;
4363−
43644361 /*
4365− * If any of the mode ref is larger than 1,
4362+ * If any of the mode ref is larger than 0,
43664363 * that means it has been already opened by
43674364 * others. Just skip checking the PIN ref.
43684365 */
4369− if (i && ci->i_nr_by_mode[i] > 1)
4370− is_opened = true;
4366+ if (i && ci->i_nr_by_mode[i])
4367+ already_opened = true;
4368+
4369+ if (bits & (1 << i))
4370+ ci->i_nr_by_mode[i] += count;
43714371 }
43724372
4373− if (!is_opened)
4373+ if (!already_opened)
43744374 percpu_counter_inc(&mdsc->metric.opened_inodes);
43754375 spin_unlock(&ci->i_ceph_lock);
43764376 }
fs/ceph/file.c+16−4
@@ -605,13 +605,25 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, · 604 unmodified lines
605605 in.cap.realm = cpu_to_le64(ci->i_snap_realm->ino);
606606 in.cap.flags = CEPH_CAP_FLAG_AUTH;
607607 in.ctime = in.mtime = in.atime = iinfo.btime;
608− in.mode = cpu_to_le32((u32)mode);
609608 in.truncate_seq = cpu_to_le32(1);
610609 in.truncate_size = cpu_to_le64(-1ULL);
611610 in.xattr_version = cpu_to_le64(1);
612611 in.uid = cpu_to_le32(from_kuid(&init_user_ns, current_fsuid()));
613− in.gid = cpu_to_le32(from_kgid(&init_user_ns, dir->i_mode & S_ISGID ?
614− dir->i_gid : current_fsgid()));
612+ if (dir->i_mode & S_ISGID) {
613+ in.gid = cpu_to_le32(from_kgid(&init_user_ns, dir->i_gid));
614+
615+ /* Directories always inherit the setgid bit. */
616+ if (S_ISDIR(mode))
617+ mode |= S_ISGID;
618+ else if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP) &&
619+ !in_group_p(dir->i_gid) &&
620+ !capable_wrt_inode_uidgid(&init_user_ns, dir, CAP_FSETID))
621+ mode &= ~S_ISGID;
622+ } else {
623+ in.gid = cpu_to_le32(from_kgid(&init_user_ns, current_fsgid()));
624+ }
625+ in.mode = cpu_to_le32((u32)mode);
626+
615627 in.nlink = cpu_to_le32(1);
616628 in.max_size = cpu_to_le64(lo->stripe_unit);
617629
@@ -847,7 +859,7 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *to, · 229 unmodified lines
847859 ssize_t ret;
848860 u64 off = iocb->ki_pos;
849861 u64 len = iov_iter_count(to);
850− u64 i_size;
862+ u64 i_size = i_size_read(inode);
851863
852864 dout("sync_read on file %p %llu~%u %s\n", file, off, (unsigned)len,
853865 (file->f_flags & O_DIRECT) ? "O_DIRECT" : "");
fs/ceph/mds_client.c+1−2
@@ -3683,7 +3683,7 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap, · 3682 unmodified lines
36833683 struct ceph_pagelist *pagelist = recon_state->pagelist;
36843684 struct dentry *dentry;
36853685 char *path;
3686− int pathlen, err;
3686+ int pathlen = 0, err;
36873687 u64 pathbase;
36883688 u64 snap_follows;
36893689
@@ -3703,7 +3703,6 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap, · 13 unmodified lines
37033703 }
37043704 } else {
37053705 path = NULL;
3706− pathlen = 0;
37073706 pathbase = 0;
37083707 }
37093708
fs/cifs/sess.c+36−18
@@ -590,8 +590,8 @@ int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len, · 589 unmodified lines
590590 {
591591 unsigned int tioffset; /* challenge message target info area */
592592 unsigned int tilen; /* challenge message target info area length */
593−
594593 CHALLENGE_MESSAGE *pblob = (CHALLENGE_MESSAGE *)bcc_ptr;
594+ __u32 server_flags;
595595
596596 if (blob_len < sizeof(CHALLENGE_MESSAGE)) {
597597 cifs_dbg(VFS, "challenge blob len %d too small\n", blob_len);
@@ -609,12 +609,37 @@ int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len, · 11 unmodified lines
609609 return -EINVAL;
610610 }
611611
612+ server_flags = le32_to_cpu(pblob->NegotiateFlags);
613+ cifs_dbg(FYI, "%s: negotiate=0x%08x challenge=0x%08x\n", __func__,
614+ ses->ntlmssp->client_flags, server_flags);
615+
616+ if ((ses->ntlmssp->client_flags & (NTLMSSP_NEGOTIATE_SEAL | NTLMSSP_NEGOTIATE_SIGN)) &&
617+ (!(server_flags & NTLMSSP_NEGOTIATE_56) && !(server_flags & NTLMSSP_NEGOTIATE_128))) {
618+ cifs_dbg(VFS, "%s: requested signing/encryption but server did not return either 56-bit or 128-bit session key size\n",
619+ __func__);
620+ return -EINVAL;
621+ }
622+ if (!(server_flags & NTLMSSP_NEGOTIATE_NTLM) && !(server_flags & NTLMSSP_NEGOTIATE_EXTENDED_SEC)) {
623+ cifs_dbg(VFS, "%s: server does not seem to support either NTLMv1 or NTLMv2\n", __func__);
624+ return -EINVAL;
625+ }
626+ if (ses->server->sign && !(server_flags & NTLMSSP_NEGOTIATE_SIGN)) {
627+ cifs_dbg(VFS, "%s: forced packet signing but server does not seem to support it\n",
628+ __func__);
629+ return -EOPNOTSUPP;
630+ }
631+ if ((ses->ntlmssp->client_flags & NTLMSSP_NEGOTIATE_KEY_XCH) &&
632+ !(server_flags & NTLMSSP_NEGOTIATE_KEY_XCH))
633+ pr_warn_once("%s: authentication has been weakened as server does not support key exchange\n",
634+ __func__);
635+
636+ ses->ntlmssp->server_flags = server_flags;
637+
612638 memcpy(ses->ntlmssp->cryptkey, pblob->Challenge, CIFS_CRYPTO_KEY_SIZE);
613− /* BB we could decode pblob->NegotiateFlags; some may be useful */
614639 /* In particular we can examine sign flags */
615640 /* BB spec says that if AvId field of MsvAvTimestamp is populated then
616641 we must set the MIC field of the AUTHENTICATE_MESSAGE */
617− ses->ntlmssp->server_flags = le32_to_cpu(pblob->NegotiateFlags);
642+
618643 tioffset = le32_to_cpu(pblob->TargetInfoArray.BufferOffset);
619644 tilen = le16_to_cpu(pblob->TargetInfoArray.Length);
620645 if (tioffset > blob_len || tioffset + tilen > blob_len) {
@@ -721,13 +746,13 @@ int build_ntlmssp_negotiate_blob(unsigned char **pbuffer, · 100 unmodified lines
721746 flags = NTLMSSP_NEGOTIATE_56 | NTLMSSP_REQUEST_TARGET |
722747 NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE |
723748 NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC |
724− NTLMSSP_NEGOTIATE_SEAL;
725− if (server->sign)
726− flags |= NTLMSSP_NEGOTIATE_SIGN;
749+ NTLMSSP_NEGOTIATE_ALWAYS_SIGN | NTLMSSP_NEGOTIATE_SEAL |
750+ NTLMSSP_NEGOTIATE_SIGN;
727751 if (!server->session_estab || ses->ntlmssp->sesskey_per_smbsess)
728752 flags |= NTLMSSP_NEGOTIATE_KEY_XCH;
729753
730754 tmp = *pbuffer + sizeof(NEGOTIATE_MESSAGE);
755+ ses->ntlmssp->client_flags = flags;
731756 sec_blob->NegotiateFlags = cpu_to_le32(flags);
732757
733758 /* these fields should be null in negotiate phase MS-NLMP 3.1.5.1.1 */
@@ -779,15 +804,8 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer, · 45 unmodified lines
779804 memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8);
780805 sec_blob->MessageType = NtLmAuthenticate;
781806
782− flags = NTLMSSP_NEGOTIATE_56 |
783− NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_TARGET_INFO |
784− NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE |
785− NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC |
786− NTLMSSP_NEGOTIATE_SEAL | NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED;
787− if (ses->server->sign)
788− flags |= NTLMSSP_NEGOTIATE_SIGN;
789− if (!ses->server->session_estab || ses->ntlmssp->sesskey_per_smbsess)
790− flags |= NTLMSSP_NEGOTIATE_KEY_XCH;
807+ flags = ses->ntlmssp->server_flags | NTLMSSP_REQUEST_TARGET |
808+ NTLMSSP_NEGOTIATE_TARGET_INFO | NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED;
791809
792810 tmp = *pbuffer + sizeof(AUTHENTICATE_MESSAGE);
793811 sec_blob->NegotiateFlags = cpu_to_le32(flags);
@@ -834,9 +852,9 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer, · 40 unmodified lines
834852 *pbuffer, &tmp,
835853 nls_cp);
836854
837− if (((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) ||
838− (ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_EXTENDED_SEC))
839− && !calc_seckey(ses)) {
855+ if ((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) &&
856+ (!ses->server->session_estab || ses->ntlmssp->sesskey_per_smbsess) &&
857+ !calc_seckey(ses)) {
840858 memcpy(tmp, ses->ntlmssp->ciphertext, CIFS_CPHTXT_SIZE);
841859 sec_blob->SessionKey.BufferOffset = cpu_to_le32(tmp - *pbuffer);
842860 sec_blob->SessionKey.Length = cpu_to_le16(CIFS_CPHTXT_SIZE);
fs/file.c+56−16
@@ -841,28 +841,68 @@ void do_close_on_exec(struct files_struct *files) · 840 unmodified lines
841841 spin_unlock(&files->file_lock);
842842 }
843843
844−static struct file *__fget_files(struct files_struct *files, unsigned int fd,
845− fmode_t mask, unsigned int refs)
844+static inline struct file *__fget_files_rcu(struct files_struct *files,
845+ unsigned int fd, fmode_t mask, unsigned int refs)
846846 {
847− struct file *file;
847+ for (;;) {
848+ struct file *file;
849+ struct fdtable *fdt = rcu_dereference_raw(files->fdt);
850+ struct file __rcu **fdentry;
848851
849− rcu_read_lock();
850−loop:
851− file = files_lookup_fd_rcu(files, fd);
852− if (file) {
853− /* File object ref couldn't be taken.
854− * dup2() atomicity guarantee is the reason
855− * we loop to catch the new file (or NULL pointer)
852+ if (unlikely(fd >= fdt->max_fds))
853+ return NULL;
854+
855+ fdentry = fdt->fd + array_index_nospec(fd, fdt->max_fds);
856+ file = rcu_dereference_raw(*fdentry);
857+ if (unlikely(!file))
858+ return NULL;
859+
860+ if (unlikely(file->f_mode & mask))
861+ return NULL;
862+
863+ /*
864+ * Ok, we have a file pointer. However, because we do
865+ * this all locklessly under RCU, we may be racing with
866+ * that file being closed.
867+ *
868+ * Such a race can take two forms:
869+ *
870+ * (a) the file ref already went down to zero,
871+ * and get_file_rcu_many() fails. Just try
872+ * again:
856873 */
857− if (file->f_mode & mask)
858− file = NULL;
859− else if (!get_file_rcu_many(file, refs))
860− goto loop;
861− else if (files_lookup_fd_raw(files, fd) != file) {
874+ if (unlikely(!get_file_rcu_many(file, refs)))
875+ continue;
876+
877+ /*
878+ * (b) the file table entry has changed under us.
879+ * Note that we don't need to re-check the 'fdt->fd'
880+ * pointer having changed, because it always goes
881+ * hand-in-hand with 'fdt'.
882+ *
883+ * If so, we need to put our refs and try again.
884+ */
885+ if (unlikely(rcu_dereference_raw(files->fdt) != fdt) ||
886+ unlikely(rcu_dereference_raw(*fdentry) != file)) {
862887 fput_many(file, refs);
863− goto loop;
888+ continue;
864889 }
890+
891+ /*
892+ * Ok, we have a ref to the file, and checked that it
893+ * still exists.
894+ */
895+ return file;
865896 }
897+}
898+
899+static struct file *__fget_files(struct files_struct *files, unsigned int fd,
900+ fmode_t mask, unsigned int refs)
901+{
902+ struct file *file;
903+
904+ rcu_read_lock();
905+ file = __fget_files_rcu(files, fd, mask, refs);
866906 rcu_read_unlock();
867907
868908 return file;
fs/io-wq.c+23−6
@@ -142,6 +142,7 @@ static bool io_acct_cancel_pending_work(struct io_wqe *wqe, · 141 unmodified lines
142142 struct io_wqe_acct *acct,
143143 struct io_cb_cancel_data *match);
144144 static void create_worker_cb(struct callback_head *cb);
145+static void io_wq_cancel_tw_create(struct io_wq *wq);
145146
146147 static bool io_worker_get(struct io_worker *worker)
147148 {
@@ -357,12 +358,22 @@ static bool io_queue_worker_create(struct io_worker *worker, · 209 unmodified lines
357358 test_and_set_bit_lock(0, &worker->create_state))
358359 goto fail_release;
359360
361+ atomic_inc(&wq->worker_refs);
360362 init_task_work(&worker->create_work, func);
361363 worker->create_index = acct->index;
362364 if (!task_work_add(wq->task, &worker->create_work, TWA_SIGNAL)) {
363− clear_bit_unlock(0, &worker->create_state);
365+ /*
366+ * EXIT may have been set after checking it above, check after
367+ * adding the task_work and remove any creation item if it is
368+ * now set. wq exit does that too, but we can have added this
369+ * work item after we canceled in io_wq_exit_workers().
370+ */
371+ if (test_bit(IO_WQ_BIT_EXIT, &wq->state))
372+ io_wq_cancel_tw_create(wq);
373+ io_worker_ref_put(wq);
364374 return true;
365375 }
376+ io_worker_ref_put(wq);
366377 clear_bit_unlock(0, &worker->create_state);
367378 fail_release:
368379 io_worker_release(worker);
@@ -1198,13 +1209,9 @@ void io_wq_exit_start(struct io_wq *wq) · 829 unmodified lines
11981209 set_bit(IO_WQ_BIT_EXIT, &wq->state);
11991210 }
12001211
1201−static void io_wq_exit_workers(struct io_wq *wq)
1212+static void io_wq_cancel_tw_create(struct io_wq *wq)
12021213 {
12031214 struct callback_head *cb;
1204− int node;
1205−
1206− if (!wq->task)
1207− return;
12081215
12091216 while ((cb = task_work_cancel_match(wq->task, io_task_work_match, wq)) != NULL) {
12101217 struct io_worker *worker;
@@ -1212,6 +1219,16 @@ static void io_wq_exit_workers(struct io_wq *wq) · 1 unmodified line
12121219 worker = container_of(cb, struct io_worker, create_work);
12131220 io_worker_cancel_cb(worker);
12141221 }
1222+}
1223+
1224+static void io_wq_exit_workers(struct io_wq *wq)
1225+{
1226+ int node;
1227+
1228+ if (!wq->task)
1229+ return;
1230+
1231+ io_wq_cancel_tw_create(wq);
12151232
12161233 rcu_read_lock();
12171234 for_each_node(node) {
fs/io_uring.c+4−2
@@ -9824,7 +9824,7 @@ static __cold void io_uring_drop_tctx_refs(struct task_struct *task) · 9823 unmodified lines
98249824
98259825 /*
98269826 * Find any io_uring ctx that this task has registered or done IO on, and cancel
9827− * requests. @sqd should be not-null IIF it's an SQPOLL thread cancellation.
9827+ * requests. @sqd should be not-null IFF it's an SQPOLL thread cancellation.
98289828 */
98299829 static __cold void io_uring_cancel_generic(bool cancel_all,
98309830 struct io_sq_data *sqd)
@@ -9866,8 +9866,10 @@ static __cold void io_uring_cancel_generic(bool cancel_all, · 35 unmodified lines
98669866 cancel_all);
98679867 }
98689868
9869− prepare_to_wait(&tctx->wait, &wait, TASK_UNINTERRUPTIBLE);
9869+ prepare_to_wait(&tctx->wait, &wait, TASK_INTERRUPTIBLE);
9870+ io_run_task_work();
98709871 io_uring_drop_tctx_refs(current);
9872+
98719873 /*
98729874 * If we've seen completions, retry without waiting. This
98739875 * avoids a race where a completion comes in before we did
fs/nfsd/nfs4recover.c+1−0
@@ -2156,6 +2156,7 @@ static struct notifier_block nfsd4_cld_block = { · 2155 unmodified lines
21562156 int
21572157 register_cld_notifier(void)
21582158 {
2159+ WARN_ON(!nfsd_net_id);
21592160 return rpc_pipefs_notifier_register(&nfsd4_cld_block);
21602161 }
21612162
fs/nfsd/nfs4state.c+7−2
@@ -1207,6 +1207,11 @@ hash_delegation_locked(struct nfs4_delegation *dp, struct nfs4_file *fp) · 1206 unmodified lines
12071207 return 0;
12081208 }
12091209
1210+static bool delegation_hashed(struct nfs4_delegation *dp)
1211+{
1212+ return !(list_empty(&dp->dl_perfile));
1213+}
1214+
12101215 static bool
12111216 unhash_delegation_locked(struct nfs4_delegation *dp)
12121217 {
@@ -1214,7 +1219,7 @@ unhash_delegation_locked(struct nfs4_delegation *dp) · 1 unmodified line
12141219
12151220 lockdep_assert_held(&state_lock);
12161221
1217− if (list_empty(&dp->dl_perfile))
1222+ if (!delegation_hashed(dp))
12181223 return false;
12191224
12201225 dp->dl_stid.sc_type = NFS4_CLOSED_DELEG_STID;
@@ -4598,7 +4603,7 @@ static void nfsd4_cb_recall_prepare(struct nfsd4_callback *cb) · 3377 unmodified lines
45984603 * queued for a lease break. Don't queue it again.
45994604 */
46004605 spin_lock(&state_lock);
4601− if (dp->dl_time == 0) {
4606+ if (delegation_hashed(dp) && dp->dl_time == 0) {
46024607 dp->dl_time = ktime_get_boottime_seconds();
46034608 list_add_tail(&dp->dl_recall_lru, &nn->del_recall_lru);
46044609 }
fs/nfsd/nfsctl.c+7−7
@@ -1521,12 +1521,9 @@ static int __init init_nfsd(void) · 1520 unmodified lines
15211521 int retval;
15221522 printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n");
15231523
1524− retval = register_cld_notifier();
1525− if (retval)
1526− return retval;
15271524 retval = nfsd4_init_slabs();
15281525 if (retval)
1529− goto out_unregister_notifier;
1526+ return retval;
15301527 retval = nfsd4_init_pnfs();
15311528 if (retval)
15321529 goto out_free_slabs;
@@ -1545,9 +1542,14 @@ static int __init init_nfsd(void) · 12 unmodified lines
15451542 goto out_free_exports;
15461543 retval = register_pernet_subsys(&nfsd_net_ops);
15471544 if (retval < 0)
1545+ goto out_free_filesystem;
1546+ retval = register_cld_notifier();
1547+ if (retval)
15481548 goto out_free_all;
15491549 return 0;
15501550 out_free_all:
1551+ unregister_pernet_subsys(&nfsd_net_ops);
1552+out_free_filesystem:
15511553 unregister_filesystem(&nfsd_fs_type);
15521554 out_free_exports:
15531555 remove_proc_entry("fs/nfs/exports", NULL);
@@ -1561,13 +1563,12 @@ out_free_pnfs: · 7 unmodified lines
15611563 nfsd4_exit_pnfs();
15621564 out_free_slabs:
15631565 nfsd4_free_slabs();
1564−out_unregister_notifier:
1565− unregister_cld_notifier();
15661566 return retval;
15671567 }
15681568
15691569 static void __exit exit_nfsd(void)
15701570 {
1571+ unregister_cld_notifier();
15711572 unregister_pernet_subsys(&nfsd_net_ops);
15721573 nfsd_drc_slab_free();
15731574 remove_proc_entry("fs/nfs/exports", NULL);
@@ -1577,7 +1578,6 @@ static void __exit exit_nfsd(void) · 3 unmodified lines
15771578 nfsd4_free_slabs();
15781579 nfsd4_exit_pnfs();
15791580 unregister_filesystem(&nfsd_fs_type);
1580− unregister_cld_notifier();
15811581 }
15821582
15831583 MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
fs/signalfd.c+1−11
@@ -35,17 +35,7 @@ · 34 unmodified lines
3535
3636 void signalfd_cleanup(struct sighand_struct *sighand)
3737 {
38− wait_queue_head_t *wqh = &sighand->signalfd_wqh;
39− /*
40− * The lockless check can race with remove_wait_queue() in progress,
41− * but in this case its caller should run under rcu_read_lock() and
42− * sighand_cachep is SLAB_TYPESAFE_BY_RCU, we can safely return.
43− */
44− if (likely(!waitqueue_active(wqh)))
45− return;
46−
47− /* wait_queue_entry_t->func(POLLFREE) should do remove_wait_queue() */
48− wake_up_poll(wqh, EPOLLHUP | POLLFREE);
38+ wake_up_pollfree(&sighand->signalfd_wqh);
4939 }
5040
5141 struct signalfd_ctx {
fs/smbfs_common/cifs_arc4.c+0−13
@@ -72,16 +72,3 @@ void cifs_arc4_crypt(struct arc4_ctx *ctx, u8 *out, const u8 *in, unsigned int l · 71 unmodified lines
7272 ctx->y = y;
7373 }
7474 EXPORT_SYMBOL_GPL(cifs_arc4_crypt);
75−
76−static int __init
77−init_smbfs_common(void)
78−{
79− return 0;
80−}
81−static void __init
82−exit_smbfs_common(void)
83−{
84−}
85−
86−module_init(init_smbfs_common)
87−module_exit(exit_smbfs_common)
fs/tracefs/inode.c+76−0
@@ -161,6 +161,77 @@ struct tracefs_fs_info { · 160 unmodified lines
161161 struct tracefs_mount_opts mount_opts;
162162 };
163163
164+static void change_gid(struct dentry *dentry, kgid_t gid)
165+{
166+ if (!dentry->d_inode)
167+ return;
168+ dentry->d_inode->i_gid = gid;
169+}
170+
171+/*
172+ * Taken from d_walk, but without he need for handling renames.
173+ * Nothing can be renamed while walking the list, as tracefs
174+ * does not support renames. This is only called when mounting
175+ * or remounting the file system, to set all the files to
176+ * the given gid.
177+ */
178+static void set_gid(struct dentry *parent, kgid_t gid)
179+{
180+ struct dentry *this_parent;
181+ struct list_head *next;
182+
183+ this_parent = parent;
184+ spin_lock(&this_parent->d_lock);
185+
186+ change_gid(this_parent, gid);
187+repeat:
188+ next = this_parent->d_subdirs.next;
189+resume:
190+ while (next != &this_parent->d_subdirs) {
191+ struct list_head *tmp = next;
192+ struct dentry *dentry = list_entry(tmp, struct dentry, d_child);
193+ next = tmp->next;
194+
195+ spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
196+
197+ change_gid(dentry, gid);
198+
199+ if (!list_empty(&dentry->d_subdirs)) {
200+ spin_unlock(&this_parent->d_lock);
201+ spin_release(&dentry->d_lock.dep_map, _RET_IP_);
202+ this_parent = dentry;
203+ spin_acquire(&this_parent->d_lock.dep_map, 0, 1, _RET_IP_);
204+ goto repeat;
205+ }
206+ spin_unlock(&dentry->d_lock);
207+ }
208+ /*
209+ * All done at this level ... ascend and resume the search.
210+ */
211+ rcu_read_lock();
212+ascend:
213+ if (this_parent != parent) {
214+ struct dentry *child = this_parent;
215+ this_parent = child->d_parent;
216+
217+ spin_unlock(&child->d_lock);
218+ spin_lock(&this_parent->d_lock);
219+
220+ /* go into the first sibling still alive */
221+ do {
222+ next = child->d_child.next;
223+ if (next == &this_parent->d_subdirs)
224+ goto ascend;
225+ child = list_entry(next, struct dentry, d_child);
226+ } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED));
227+ rcu_read_unlock();
228+ goto resume;
229+ }
230+ rcu_read_unlock();
231+ spin_unlock(&this_parent->d_lock);
232+ return;
233+}
234+
164235 static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts)
165236 {
166237 substring_t args[MAX_OPT_ARGS];
@@ -193,6 +264,7 @@ static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts) · 26 unmodified lines
193264 if (!gid_valid(gid))
194265 return -EINVAL;
195266 opts->gid = gid;
267+ set_gid(tracefs_mount->mnt_root, gid);
196268 break;
197269 case Opt_mode:
198270 if (match_octal(&args[0], &option))
@@ -414,6 +486,8 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode, · 215 unmodified lines
414486 inode->i_mode = mode;
415487 inode->i_fop = fops ? fops : &tracefs_file_operations;
416488 inode->i_private = data;
489+ inode->i_uid = d_inode(dentry->d_parent)->i_uid;
490+ inode->i_gid = d_inode(dentry->d_parent)->i_gid;
417491 d_instantiate(dentry, inode);
418492 fsnotify_create(dentry->d_parent->d_inode, dentry);
419493 return end_creating(dentry);
@@ -436,6 +510,8 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent, · 16 unmodified lines
436510 inode->i_mode = S_IFDIR | S_IRWXU | S_IRUSR| S_IRGRP | S_IXUSR | S_IXGRP;
437511 inode->i_op = ops;
438512 inode->i_fop = &simple_dir_operations;
513+ inode->i_uid = d_inode(dentry->d_parent)->i_uid;
514+ inode->i_gid = d_inode(dentry->d_parent)->i_gid;
439515
440516 /* directory inodes start off with i_nlink == 2 (for "." entry) */
441517 inc_nlink(inode);
fs/xfs/xfs_super.c+11−3
@@ -1765,7 +1765,10 @@ static int · 1764 unmodified lines
17651765 xfs_remount_ro(
17661766 struct xfs_mount *mp)
17671767 {
1768− int error;
1768+ struct xfs_icwalk icw = {
1769+ .icw_flags = XFS_ICWALK_FLAG_SYNC,
1770+ };
1771+ int error;
17691772
17701773 /*
17711774 * Cancel background eofb scanning so it cannot race with the final
@@ -1773,8 +1776,13 @@ xfs_remount_ro( · 1 unmodified line
17731776 */
17741777 xfs_blockgc_stop(mp);
17751778
1776− /* Get rid of any leftover CoW reservations... */
1777− error = xfs_blockgc_free_space(mp, NULL);
1779+ /*
1780+ * Clear out all remaining COW staging extents and speculative post-EOF
1781+ * preallocations so that we don't leave inodes requiring inactivation
1782+ * cleanups during reclaim on a read-only mount. We must process every
1783+ * cached inode, so this requires a synchronous cache scan.
1784+ */
1785+ error = xfs_blockgc_free_space(mp, &icw);
17781786 if (error) {
17791787 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
17801788 return error;
include/linux/delay.h+13−1
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 */
2121
2222 #include <linux/math.h>
23+#include <linux/sched.h>
2324
2425 extern unsigned long loops_per_jiffy;
2526
@@ -58,7 +59,18 @@ void calibrate_delay(void); · 32 unmodified lines
5859 void __attribute__((weak)) calibration_delay_done(void);
5960 void msleep(unsigned int msecs);
6061 unsigned long msleep_interruptible(unsigned int msecs);
61−void usleep_range(unsigned long min, unsigned long max);
62+void usleep_range_state(unsigned long min, unsigned long max,
63+ unsigned int state);
64+
65+static inline void usleep_range(unsigned long min, unsigned long max)
66+{
67+ usleep_range_state(min, max, TASK_UNINTERRUPTIBLE);
68+}
69+
70+static inline void usleep_idle_range(unsigned long min, unsigned long max)
71+{
72+ usleep_range_state(min, max, TASK_IDLE);
73+}
6274
6375 static inline void ssleep(unsigned int seconds)
6476 {
include/linux/mhi.h+13−0
@@ -663,6 +663,19 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl); · 662 unmodified lines
663663 */
664664 int mhi_pm_resume(struct mhi_controller *mhi_cntrl);
665665
666+/**
667+ * mhi_pm_resume_force - Force resume MHI from suspended state
668+ * @mhi_cntrl: MHI controller
669+ *
670+ * Resume the device irrespective of its MHI state. As per the MHI spec, devices
671+ * has to be in M3 state during resume. But some devices seem to be in a
672+ * different MHI state other than M3 but they continue working fine if allowed.
673+ * This API is intented to be used for such devices.
674+ *
675+ * Return: 0 if the resume succeeds, a negative error code otherwise
676+ */
677+int mhi_pm_resume_force(struct mhi_controller *mhi_cntrl);
678+
666679 /**
667680 * mhi_download_rddm_image - Download ramdump image from device for
668681 * debugging purpose.
include/linux/percpu-refcount.h+1−1
@@ -51,9 +51,9 @@ · 50 unmodified lines
5151 #define _LINUX_PERCPU_REFCOUNT_H
5252
5353 #include <linux/atomic.h>
54−#include <linux/kernel.h>
5554 #include <linux/percpu.h>
5655 #include <linux/rcupdate.h>
56+#include <linux/types.h>
5757 #include <linux/gfp.h>
5858
5959 struct percpu_ref;
include/linux/pm_runtime.h+1−1
@@ -129,7 +129,7 @@ static inline bool pm_runtime_suspended(struct device *dev) · 128 unmodified lines
129129 * pm_runtime_active - Check whether or not a device is runtime-active.
130130 * @dev: Target device.
131131 *
132− * Return %true if runtime PM is enabled for @dev and its runtime PM status is
132+ * Return %true if runtime PM is disabled for @dev or its runtime PM status is
133133 * %RPM_ACTIVE, or %false otherwise.
134134 *
135135 * Note that the return value of this function can only be trusted if it is
include/linux/wait.h+26−0
@@ -217,6 +217,7 @@ void __wake_up_sync_key(struct wait_queue_head *wq_head, unsigned int mode, void · 216 unmodified lines
217217 void __wake_up_locked_sync_key(struct wait_queue_head *wq_head, unsigned int mode, void *key);
218218 void __wake_up_locked(struct wait_queue_head *wq_head, unsigned int mode, int nr);
219219 void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode);
220+void __wake_up_pollfree(struct wait_queue_head *wq_head);
220221
221222 #define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL)
222223 #define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL)
@@ -245,6 +246,31 @@ void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode); · 22 unmodified lines
245246 #define wake_up_interruptible_sync_poll_locked(x, m) \
246247 __wake_up_locked_sync_key((x), TASK_INTERRUPTIBLE, poll_to_key(m))
247248
249+/**
250+ * wake_up_pollfree - signal that a polled waitqueue is going away
251+ * @wq_head: the wait queue head
252+ *
253+ * In the very rare cases where a ->poll() implementation uses a waitqueue whose
254+ * lifetime is tied to a task rather than to the 'struct file' being polled,
255+ * this function must be called before the waitqueue is freed so that
256+ * non-blocking polls (e.g. epoll) are notified that the queue is going away.
257+ *
258+ * The caller must also RCU-delay the freeing of the wait_queue_head, e.g. via
259+ * an explicit synchronize_rcu() or call_rcu(), or via SLAB_TYPESAFE_BY_RCU.
260+ */
261+static inline void wake_up_pollfree(struct wait_queue_head *wq_head)
262+{
263+ /*
264+ * For performance reasons, we don't always take the queue lock here.
265+ * Therefore, we might race with someone removing the last entry from
266+ * the queue, and proceed while they still hold the queue lock.
267+ * However, rcu_read_lock() is required to be held in such cases, so we
268+ * can safely proceed with an RCU-delayed free.
269+ */
270+ if (waitqueue_active(wq_head))
271+ __wake_up_pollfree(wq_head);
272+}
273+
248274 #define ___wait_cond_timeout(condition) \
249275 ({ \
250276 bool __cond = (condition); \
include/uapi/asm-generic/poll.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 #define POLLRDHUP 0x2000
3030 #endif
3131
32−#define POLLFREE (__force __poll_t)0x4000 /* currently only for epoll */
32+#define POLLFREE (__force __poll_t)0x4000
3333
3434 #define POLL_BUSY_LOOP (__force __poll_t)0x8000
3535
include/uapi/linux/mptcp.h+10−8
@@ -136,19 +136,21 @@ struct mptcp_info { · 135 unmodified lines
136136 * MPTCP_EVENT_REMOVED: token, rem_id
137137 * An address has been lost by the peer.
138138 *
139− * MPTCP_EVENT_SUB_ESTABLISHED: token, family, saddr4 | saddr6,
140− * daddr4 | daddr6, sport, dport, backup,
141− * if_idx [, error]
139+ * MPTCP_EVENT_SUB_ESTABLISHED: token, family, loc_id, rem_id,
140+ * saddr4 | saddr6, daddr4 | daddr6, sport,
141+ * dport, backup, if_idx [, error]
142142 * A new subflow has been established. 'error' should not be set.
143143 *
144− * MPTCP_EVENT_SUB_CLOSED: token, family, saddr4 | saddr6, daddr4 | daddr6,
145− * sport, dport, backup, if_idx [, error]
144+ * MPTCP_EVENT_SUB_CLOSED: token, family, loc_id, rem_id, saddr4 | saddr6,
145+ * daddr4 | daddr6, sport, dport, backup, if_idx
146+ * [, error]
146147 * A subflow has been closed. An error (copy of sk_err) could be set if an
147148 * error has been detected for this subflow.
148149 *
149− * MPTCP_EVENT_SUB_PRIORITY: token, family, saddr4 | saddr6, daddr4 | daddr6,
150− * sport, dport, backup, if_idx [, error]
151− * The priority of a subflow has changed. 'error' should not be set.
150+ * MPTCP_EVENT_SUB_PRIORITY: token, family, loc_id, rem_id, saddr4 | saddr6,
151+ * daddr4 | daddr6, sport, dport, backup, if_idx
152+ * [, error]
153+ * The priority of a subflow has changed. 'error' should not be set.
152154 */
153155 enum mptcp_event_type {
154156 MPTCP_EVENT_UNSPEC = 0,
include/uapi/linux/resource.h+10−3
@@ -66,10 +66,17 @@ struct rlimit64 { · 65 unmodified lines
6666 #define _STK_LIM (8*1024*1024)
6767
6868 /*
69− * GPG2 wants 64kB of mlocked memory, to make sure pass phrases
70− * and other sensitive information are never written to disk.
69+ * Limit the amount of locked memory by some sane default:
70+ * root can always increase this limit if needed.
71+ *
72+ * The main use-cases are (1) preventing sensitive memory
73+ * from being swapped; (2) real-time operations; (3) via
74+ * IOURING_REGISTER_BUFFERS.
75+ *
76+ * The first two don't need much. The latter will take as
77+ * much as it can get. 8MB is a reasonably sane default.
7178 */
72−#define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024)
79+#define MLOCK_LIMIT (8*1024*1024)
7380
7481 /*
7582 * Due to binary compatibility, the actual resource numbers
kernel/audit.c+10−11
@@ -718,7 +718,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 717 unmodified lines
718718 {
719719 int rc = 0;
720720 struct sk_buff *skb;
721− static unsigned int failed = 0;
721+ unsigned int failed = 0;
722722
723723 /* NOTE: kauditd_thread takes care of all our locking, we just use
724724 * the netlink info passed to us (e.g. sk and portid) */
@@ -735,32 +735,30 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 10 unmodified lines
735735 continue;
736736 }
737737
738+retry:
738739 /* grab an extra skb reference in case of error */
739740 skb_get(skb);
740741 rc = netlink_unicast(sk, skb, portid, 0);
741742 if (rc < 0) {
742− /* fatal failure for our queue flush attempt? */
743+ /* send failed - try a few times unless fatal error */
743744 if (++failed >= retry_limit ||
744745 rc == -ECONNREFUSED || rc == -EPERM) {
745− /* yes - error processing for the queue */
746746 sk = NULL;
747747 if (err_hook)
748748 (*err_hook)(skb);
749− if (!skb_hook)
750− goto out;
751− /* keep processing with the skb_hook */
749+ if (rc == -EAGAIN)
750+ rc = 0;
751+ /* continue to drain the queue */
752752 continue;
753753 } else
754− /* no - requeue to preserve ordering */
755− skb_queue_head(queue, skb);
754+ goto retry;
756755 } else {
757− /* it worked - drop the extra reference and continue */
756+ /* skb sent - drop the extra reference and continue */
758757 consume_skb(skb);
759758 failed = 0;
760759 }
761760 }
762761
763−out:
764762 return (rc >= 0 ? 0 : rc);
765763 }
766764
@@ -1609,7 +1607,8 @@ static int __net_init audit_net_init(struct net *net) · 842 unmodified lines
16091607 audit_panic("cannot initialize netlink socket in namespace");
16101608 return -ENOMEM;
16111609 }
1612− aunet->sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
1610+ /* limit the timeout in case auditd is blocked/stopped */
1611+ aunet->sk->sk_sndtimeo = HZ / 10;
16131612
16141613 return 0;
16151614 }
kernel/bpf/verifier.c+36−17
@@ -1368,22 +1368,28 @@ static void __reg_bound_offset(struct bpf_reg_state *reg) · 1367 unmodified lines
13681368 reg->var_off = tnum_or(tnum_clear_subreg(var64_off), var32_off);
13691369 }
13701370
1371+static bool __reg32_bound_s64(s32 a)
1372+{
1373+ return a >= 0 && a <= S32_MAX;
1374+}
1375+
13711376 static void __reg_assign_32_into_64(struct bpf_reg_state *reg)
13721377 {
13731378 reg->umin_value = reg->u32_min_value;
13741379 reg->umax_value = reg->u32_max_value;
1375− /* Attempt to pull 32-bit signed bounds into 64-bit bounds
1376− * but must be positive otherwise set to worse case bounds
1377− * and refine later from tnum.
1380+
1381+ /* Attempt to pull 32-bit signed bounds into 64-bit bounds but must
1382+ * be positive otherwise set to worse case bounds and refine later
1383+ * from tnum.
13781384 */
1379− if (reg->s32_min_value >= 0 && reg->s32_max_value >= 0)
1380− reg->smax_value = reg->s32_max_value;
1381− else
1382− reg->smax_value = U32_MAX;
1383− if (reg->s32_min_value >= 0)
1385+ if (__reg32_bound_s64(reg->s32_min_value) &&
1386+ __reg32_bound_s64(reg->s32_max_value)) {
13841387 reg->smin_value = reg->s32_min_value;
1385− else
1388+ reg->smax_value = reg->s32_max_value;
1389+ } else {
13861390 reg->smin_value = 0;
1391+ reg->smax_value = U32_MAX;
1392+ }
13871393 }
13881394
13891395 static void __reg_combine_32_into_64(struct bpf_reg_state *reg)
@@ -2381,8 +2387,6 @@ static int backtrack_insn(struct bpf_verifier_env *env, int idx, · 991 unmodified lines
23812387 */
23822388 if (insn->src_reg != BPF_REG_FP)
23832389 return 0;
2384− if (BPF_SIZE(insn->code) != BPF_DW)
2385− return 0;
23862390
23872391 /* dreg = *(u64 *)[fp - off] was a fill from the stack.
23882392 * that [fp - off] slot contains scalar that needs to be
@@ -2405,8 +2409,6 @@ static int backtrack_insn(struct bpf_verifier_env *env, int idx, · 16 unmodified lines
24052409 /* scalars can only be spilled into stack */
24062410 if (insn->dst_reg != BPF_REG_FP)
24072411 return 0;
2408− if (BPF_SIZE(insn->code) != BPF_DW)
2409− return 0;
24102412 spi = (-insn->off - 1) / BPF_REG_SIZE;
24112413 if (spi >= 64) {
24122414 verbose(env, "BUG spi %d\n", spi);
@@ -4553,9 +4555,16 @@ static int check_atomic(struct bpf_verifier_env *env, int insn_idx, struct bpf_i · 2140 unmodified lines
45534555
45544556 if (insn->imm == BPF_CMPXCHG) {
45554557 /* Check comparison of R0 with memory location */
4556− err = check_reg_arg(env, BPF_REG_0, SRC_OP);
4558+ const u32 aux_reg = BPF_REG_0;
4559+
4560+ err = check_reg_arg(env, aux_reg, SRC_OP);
45574561 if (err)
45584562 return err;
4563+
4564+ if (is_pointer_value(env, aux_reg)) {
4565+ verbose(env, "R%d leaks addr into mem\n", aux_reg);
4566+ return -EACCES;
4567+ }
45594568 }
45604569
45614570 if (is_pointer_value(env, insn->src_reg)) {
@@ -4590,13 +4599,19 @@ static int check_atomic(struct bpf_verifier_env *env, int insn_idx, struct bpf_i · 28 unmodified lines
45904599 load_reg = -1;
45914600 }
45924601
4593− /* check whether we can read the memory */
4602+ /* Check whether we can read the memory, with second call for fetch
4603+ * case to simulate the register fill.
4604+ */
45944605 err = check_mem_access(env, insn_idx, insn->dst_reg, insn->off,
4595− BPF_SIZE(insn->code), BPF_READ, load_reg, true);
4606+ BPF_SIZE(insn->code), BPF_READ, -1, true);
4607+ if (!err && load_reg >= 0)
4608+ err = check_mem_access(env, insn_idx, insn->dst_reg, insn->off,
4609+ BPF_SIZE(insn->code), BPF_READ, load_reg,
4610+ true);
45964611 if (err)
45974612 return err;
45984613
4599− /* check whether we can write into the same memory */
4614+ /* Check whether we can write into the same memory. */
46004615 err = check_mem_access(env, insn_idx, insn->dst_reg, insn->off,
46014616 BPF_SIZE(insn->code), BPF_WRITE, -1, true);
46024617 if (err)
@@ -8364,6 +8379,10 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn) · 3761 unmodified lines
83648379 insn->dst_reg);
83658380 }
83668381 zext_32_to_64(dst_reg);
8382+
8383+ __update_reg_bounds(dst_reg);
8384+ __reg_deduce_bounds(dst_reg);
8385+ __reg_bound_offset(dst_reg);
83678386 }
83688387 } else {
83698388 /* case: R = imm
kernel/sched/wait.c+7−0
@@ -238,6 +238,13 @@ void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode) · 237 unmodified lines
238238 }
239239 EXPORT_SYMBOL_GPL(__wake_up_sync); /* For internal use only */
240240
241+void __wake_up_pollfree(struct wait_queue_head *wq_head)
242+{
243+ __wake_up(wq_head, TASK_NORMAL, 0, poll_to_key(EPOLLHUP | POLLFREE));
244+ /* POLLFREE must have cleared the queue. */
245+ WARN_ON_ONCE(waitqueue_active(wq_head));
246+}
247+
241248 /*
242249 * Note: we use "set_current_state()" _after_ the wait-queue add,
243250 * because we need a memory barrier there on SMP, so that any
kernel/time/timer.c+9−7
@@ -2054,26 +2054,28 @@ unsigned long msleep_interruptible(unsigned int msecs) · 2053 unmodified lines
20542054 EXPORT_SYMBOL(msleep_interruptible);
20552055
20562056 /**
2057− * usleep_range - Sleep for an approximate time
2058− * @min: Minimum time in usecs to sleep
2059− * @max: Maximum time in usecs to sleep
2057+ * usleep_range_state - Sleep for an approximate time in a given state
2058+ * @min: Minimum time in usecs to sleep
2059+ * @max: Maximum time in usecs to sleep
2060+ * @state: State of the current task that will be while sleeping
20602061 *
20612062 * In non-atomic context where the exact wakeup time is flexible, use
2062− * usleep_range() instead of udelay(). The sleep improves responsiveness
2063+ * usleep_range_state() instead of udelay(). The sleep improves responsiveness
20632064 * by avoiding the CPU-hogging busy-wait of udelay(), and the range reduces
20642065 * power usage by allowing hrtimers to take advantage of an already-
20652066 * scheduled interrupt instead of scheduling a new one just for this sleep.
20662067 */
2067−void __sched usleep_range(unsigned long min, unsigned long max)
2068+void __sched usleep_range_state(unsigned long min, unsigned long max,
2069+ unsigned int state)
20682070 {
20692071 ktime_t exp = ktime_add_us(ktime_get(), min);
20702072 u64 delta = (u64)(max - min) * NSEC_PER_USEC;
20712073
20722074 for (;;) {
2073− __set_current_state(TASK_UNINTERRUPTIBLE);
2075+ __set_current_state(state);
20742076 /* Do not return before the requested sleep time has elapsed */
20752077 if (!schedule_hrtimeout_range(&exp, delta, HRTIMER_MODE_ABS))
20762078 break;
20772079 }
20782080 }
2079−EXPORT_SYMBOL(usleep_range);
2081+EXPORT_SYMBOL(usleep_range_state);
kernel/trace/ftrace.c+7−1
@@ -5217,6 +5217,7 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr) · 5216 unmodified lines
52175217 {
52185218 struct ftrace_direct_func *direct;
52195219 struct ftrace_func_entry *entry;
5220+ struct ftrace_hash *hash;
52205221 int ret = -ENODEV;
52215222
52225223 mutex_lock(&direct_mutex);
@@ -5225,7 +5226,8 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr) · 2 unmodified lines
52255226 if (!entry)
52265227 goto out_unlock;
52275228
5228− if (direct_functions->count == 1)
5229+ hash = direct_ops.func_hash->filter_hash;
5230+ if (hash->count == 1)
52295231 unregister_ftrace_function(&direct_ops);
52305232
52315233 ret = ftrace_set_filter_ip(&direct_ops, ip, 1, 0);
@@ -5540,6 +5542,10 @@ int unregister_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr) · 308 unmodified lines
55405542 err = unregister_ftrace_function(ops);
55415543 remove_direct_functions_hash(hash, addr);
55425544 mutex_unlock(&direct_mutex);
5545+
5546+ /* cleanup for possible another register call */
5547+ ops->func = NULL;
5548+ ops->trampoline = 0;
55435549 return err;
55445550 }
55455551 EXPORT_SYMBOL_GPL(unregister_ftrace_direct_multi);
kernel/trace/trace_events_synth.c+6−5
@@ -1237,9 +1237,8 @@ static int __create_synth_event(const char *name, const char *raw_fields) · 1236 unmodified lines
12371237 argv + consumed, &consumed,
12381238 &field_version);
12391239 if (IS_ERR(field)) {
1240− argv_free(argv);
12411240 ret = PTR_ERR(field);
1242− goto err;
1241+ goto err_free_arg;
12431242 }
12441243
12451244 /*
@@ -1262,18 +1261,19 @@ static int __create_synth_event(const char *name, const char *raw_fields) · 16 unmodified lines
12621261 if (cmd_version > 1 && n_fields_this_loop >= 1) {
12631262 synth_err(SYNTH_ERR_INVALID_CMD, errpos(field_str));
12641263 ret = -EINVAL;
1265− goto err;
1264+ goto err_free_arg;
12661265 }
12671266
12681267 fields[n_fields++] = field;
12691268 if (n_fields == SYNTH_FIELDS_MAX) {
12701269 synth_err(SYNTH_ERR_TOO_MANY_FIELDS, 0);
12711270 ret = -EINVAL;
1272− goto err;
1271+ goto err_free_arg;
12731272 }
12741273
12751274 n_fields_this_loop++;
12761275 }
1276+ argv_free(argv);
12771277
12781278 if (consumed < argc) {
12791279 synth_err(SYNTH_ERR_INVALID_CMD, 0);
@@ -1281,7 +1281,6 @@ static int __create_synth_event(const char *name, const char *raw_fields) · 1 unmodified line
12811281 goto err;
12821282 }
12831283
1284− argv_free(argv);
12851284 }
12861285
12871286 if (n_fields == 0) {
@@ -1307,6 +1306,8 @@ static int __create_synth_event(const char *name, const char *raw_fields) · 19 unmodified lines
13071306 kfree(saved_fields);
13081307
13091308 return ret;
1309+ err_free_arg:
1310+ argv_free(argv);
13101311 err:
13111312 for (i = 0; i < n_fields; i++)
13121313 free_synth_field(fields[i]);
mm/Kconfig+1−1
@@ -428,7 +428,7 @@ config THP_SWAP · 427 unmodified lines
428428 # UP and nommu archs use km based percpu allocator
429429 #
430430 config NEED_PER_CPU_KM
431− depends on !SMP
431+ depends on !SMP || !MMU
432432 bool
433433 default y
434434
mm/backing-dev.c+7−0
@@ -945,6 +945,13 @@ void bdi_unregister(struct backing_dev_info *bdi) · 944 unmodified lines
945945 wb_shutdown(&bdi->wb);
946946 cgwb_bdi_unregister(bdi);
947947
948+ /*
949+ * If this BDI's min ratio has been set, use bdi_set_min_ratio() to
950+ * update the global bdi_min_ratio.
951+ */
952+ if (bdi->min_ratio)
953+ bdi_set_min_ratio(bdi, 0);
954+
948955 if (bdi->dev) {
949956 bdi_debug_unregister(bdi);
950957 device_unregister(bdi->dev);
mm/damon/core.c+7−13
@@ -282,7 +282,6 @@ int damon_set_targets(struct damon_ctx *ctx, · 281 unmodified lines
282282 for (i = 0; i < nr_ids; i++) {
283283 t = damon_new_target(ids[i]);
284284 if (!t) {
285− pr_err("Failed to alloc damon_target\n");
286285 /* The caller should do cleanup of the ids itself */
287286 damon_for_each_target_safe(t, next, ctx)
288287 damon_destroy_target(t);
@@ -312,16 +311,10 @@ int damon_set_attrs(struct damon_ctx *ctx, unsigned long sample_int, · 23 unmodified lines
312311 unsigned long aggr_int, unsigned long primitive_upd_int,
313312 unsigned long min_nr_reg, unsigned long max_nr_reg)
314313 {
315− if (min_nr_reg < 3) {
316− pr_err("min_nr_regions (%lu) must be at least 3\n",
317− min_nr_reg);
314+ if (min_nr_reg < 3)
318315 return -EINVAL;
319− }
320− if (min_nr_reg > max_nr_reg) {
321− pr_err("invalid nr_regions. min (%lu) > max (%lu)\n",
322− min_nr_reg, max_nr_reg);
316+ if (min_nr_reg > max_nr_reg)
323317 return -EINVAL;
324− }
325318
326319 ctx->sample_interval = sample_int;
327320 ctx->aggr_interval = aggr_int;
@@ -980,10 +973,11 @@ static unsigned long damos_wmark_wait_us(struct damos *scheme) · 652 unmodified lines
980973
981974 static void kdamond_usleep(unsigned long usecs)
982975 {
983− if (usecs > 100 * 1000)
984− schedule_timeout_interruptible(usecs_to_jiffies(usecs));
976+ /* See Documentation/timers/timers-howto.rst for the thresholds */
977+ if (usecs > 20 * USEC_PER_MSEC)
978+ schedule_timeout_idle(usecs_to_jiffies(usecs));
985979 else
986− usleep_range(usecs, usecs + 1);
980+ usleep_idle_range(usecs, usecs + 1);
987981 }
988982
989983 /* Returns negative error code if it's not activated but should return */
@@ -1038,7 +1032,7 @@ static int kdamond_fn(void *data) · 48 unmodified lines
10381032 ctx->callback.after_sampling(ctx))
10391033 done = true;
10401034
1041− usleep_range(ctx->sample_interval, ctx->sample_interval + 1);
1035+ kdamond_usleep(ctx->sample_interval);
10421036
10431037 if (ctx->primitive.check_accesses)
10441038 max_nr_accesses = ctx->primitive.check_accesses(ctx);
mm/damon/dbgfs.c+1−3
@@ -210,10 +210,8 @@ static struct damos **str_to_schemes(const char *str, ssize_t len, · 209 unmodified lines
210210 &wmarks.low, &parsed);
211211 if (ret != 18)
212212 break;
213− if (!damos_action_valid(action)) {
214− pr_err("wrong action %d\n", action);
213+ if (!damos_action_valid(action))
215214 goto fail;
216− }
217215
218216 pos += parsed;
219217 scheme = damon_new_scheme(min_sz, max_sz, min_nr_a, max_nr_a,
mm/damon/vaddr-test.h+37−42
@@ -135,7 +135,6 @@ static void damon_do_test_apply_three_regions(struct kunit *test, · 134 unmodified lines
135135 struct damon_addr_range *three_regions,
136136 unsigned long *expected, int nr_expected)
137137 {
138− struct damon_ctx *ctx = damon_new_ctx();
139138 struct damon_target *t;
140139 struct damon_region *r;
141140 int i;
@@ -145,7 +144,6 @@ static void damon_do_test_apply_three_regions(struct kunit *test, · 3 unmodified lines
145144 r = damon_new_region(regions[i * 2], regions[i * 2 + 1]);
146145 damon_add_region(r, t);
147146 }
148− damon_add_target(ctx, t);
149147
150148 damon_va_apply_three_regions(t, three_regions);
151149
@@ -154,8 +152,6 @@ static void damon_do_test_apply_three_regions(struct kunit *test, · 2 unmodified lines
154152 KUNIT_EXPECT_EQ(test, r->ar.start, expected[i * 2]);
155153 KUNIT_EXPECT_EQ(test, r->ar.end, expected[i * 2 + 1]);
156154 }
157−
158− damon_destroy_ctx(ctx);
159155 }
160156
161157 /*
@@ -252,60 +248,59 @@ static void damon_test_apply_three_regions4(struct kunit *test) · 90 unmodified lines
252248 new_three_regions, expected, ARRAY_SIZE(expected));
253249 }
254250
255−static void damon_test_split_evenly(struct kunit *test)
251+static void damon_test_split_evenly_fail(struct kunit *test,
252+ unsigned long start, unsigned long end, unsigned int nr_pieces)
256253 {
257− struct damon_ctx *c = damon_new_ctx();
258− struct damon_target *t;
259− struct damon_region *r;
260− unsigned long i;
261−
262− KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(NULL, NULL, 5),
263− -EINVAL);
264−
265− t = damon_new_target(42);
266− r = damon_new_region(0, 100);
267− KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(t, r, 0), -EINVAL);
254+ struct damon_target *t = damon_new_target(42);
255+ struct damon_region *r = damon_new_region(start, end);
268256
269257 damon_add_region(r, t);
270− KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(t, r, 10), 0);
271− KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 10u);
258+ KUNIT_EXPECT_EQ(test,
259+ damon_va_evenly_split_region(t, r, nr_pieces), -EINVAL);
260+ KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 1u);
272261
273− i = 0;
274262 damon_for_each_region(r, t) {
275− KUNIT_EXPECT_EQ(test, r->ar.start, i++ * 10);
276− KUNIT_EXPECT_EQ(test, r->ar.end, i * 10);
263+ KUNIT_EXPECT_EQ(test, r->ar.start, start);
264+ KUNIT_EXPECT_EQ(test, r->ar.end, end);
277265 }
266+
278267 damon_free_target(t);
268+}
269+
270+static void damon_test_split_evenly_succ(struct kunit *test,
271+ unsigned long start, unsigned long end, unsigned int nr_pieces)
272+{
273+ struct damon_target *t = damon_new_target(42);
274+ struct damon_region *r = damon_new_region(start, end);
275+ unsigned long expected_width = (end - start) / nr_pieces;
276+ unsigned long i = 0;
279277
280− t = damon_new_target(42);
281− r = damon_new_region(5, 59);
282278 damon_add_region(r, t);
283− KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(t, r, 5), 0);
284− KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 5u);
279+ KUNIT_EXPECT_EQ(test,
280+ damon_va_evenly_split_region(t, r, nr_pieces), 0);
281+ KUNIT_EXPECT_EQ(test, damon_nr_regions(t), nr_pieces);
285282
286− i = 0;
287283 damon_for_each_region(r, t) {
288− if (i == 4)
284+ if (i == nr_pieces - 1)
289285 break;
290− KUNIT_EXPECT_EQ(test, r->ar.start, 5 + 10 * i++);
291− KUNIT_EXPECT_EQ(test, r->ar.end, 5 + 10 * i);
286+ KUNIT_EXPECT_EQ(test,
287+ r->ar.start, start + i++ * expected_width);
288+ KUNIT_EXPECT_EQ(test, r->ar.end, start + i * expected_width);
292289 }
293− KUNIT_EXPECT_EQ(test, r->ar.start, 5 + 10 * i);
294− KUNIT_EXPECT_EQ(test, r->ar.end, 59ul);
290+ KUNIT_EXPECT_EQ(test, r->ar.start, start + i * expected_width);
291+ KUNIT_EXPECT_EQ(test, r->ar.end, end);
295292 damon_free_target(t);
293+}
296294
297− t = damon_new_target(42);
298− r = damon_new_region(5, 6);
299− damon_add_region(r, t);
300− KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(t, r, 2), -EINVAL);
301− KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 1u);
295+static void damon_test_split_evenly(struct kunit *test)
296+{
297+ KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(NULL, NULL, 5),
298+ -EINVAL);
302299
303− damon_for_each_region(r, t) {
304− KUNIT_EXPECT_EQ(test, r->ar.start, 5ul);
305− KUNIT_EXPECT_EQ(test, r->ar.end, 6ul);
306− }
307− damon_free_target(t);
308− damon_destroy_ctx(c);
300+ damon_test_split_evenly_fail(test, 0, 100, 0);
301+ damon_test_split_evenly_succ(test, 0, 100, 10);
302+ damon_test_split_evenly_succ(test, 5, 59, 5);
303+ damon_test_split_evenly_fail(test, 5, 6, 2);
309304 }
310305
311306 static struct kunit_case damon_test_cases[] = {
mm/damon/vaddr.c+0−1
@@ -627,7 +627,6 @@ int damon_va_apply_scheme(struct damon_ctx *ctx, struct damon_target *t, · 626 unmodified lines
627627 case DAMOS_STAT:
628628 return 0;
629629 default:
630− pr_warn("Wrong action %d\n", scheme->action);
631630 return -EINVAL;
632631 }
633632
mm/filemap.c+0−2
@@ -3253,8 +3253,6 @@ static struct page *next_uptodate_page(struct page *page, · 3252 unmodified lines
32533253 goto skip;
32543254 if (!PageUptodate(page) || PageReadahead(page))
32553255 goto skip;
3256− if (PageHWPoison(page))
3257− goto skip;
32583256 if (!trylock_page(page))
32593257 goto skip;
32603258 if (page->mapping != mapping)
mm/hugetlb.c+1−1
@@ -2973,7 +2973,7 @@ int __alloc_bootmem_huge_page(struct hstate *h, int nid) · 2972 unmodified lines
29732973 struct huge_bootmem_page *m = NULL; /* initialize for clang */
29742974 int nr_nodes, node;
29752975
2976− if (nid >= nr_online_nodes)
2976+ if (nid != NUMA_NO_NODE && nid >= nr_online_nodes)
29772977 return 0;
29782978 /* do node specific alloc */
29792979 if (nid != NUMA_NO_NODE) {
mm/memcontrol.c+53−53
@@ -776,24 +776,6 @@ void __mod_lruvec_kmem_state(void *p, enum node_stat_item idx, int val) · 775 unmodified lines
776776 rcu_read_unlock();
777777 }
778778
779−/*
780− * mod_objcg_mlstate() may be called with irq enabled, so
781− * mod_memcg_lruvec_state() should be used.
782− */
783−static inline void mod_objcg_mlstate(struct obj_cgroup *objcg,
784− struct pglist_data *pgdat,
785− enum node_stat_item idx, int nr)
786−{
787− struct mem_cgroup *memcg;
788− struct lruvec *lruvec;
789−
790− rcu_read_lock();
791− memcg = obj_cgroup_memcg(objcg);
792− lruvec = mem_cgroup_lruvec(memcg, pgdat);
793− mod_memcg_lruvec_state(lruvec, idx, nr);
794− rcu_read_unlock();
795−}
796−
797779 /**
798780 * __count_memcg_events - account VM events in a cgroup
799781 * @memcg: the memory cgroup
@@ -2137,41 +2119,6 @@ static bool obj_stock_flush_required(struct memcg_stock_pcp *stock, · 1337 unmodified lines
21372119 }
21382120 #endif
21392121
2140−/*
2141− * Most kmem_cache_alloc() calls are from user context. The irq disable/enable
2142− * sequence used in this case to access content from object stock is slow.
2143− * To optimize for user context access, there are now two object stocks for
2144− * task context and interrupt context access respectively.
2145− *
2146− * The task context object stock can be accessed by disabling preemption only
2147− * which is cheap in non-preempt kernel. The interrupt context object stock
2148− * can only be accessed after disabling interrupt. User context code can
2149− * access interrupt object stock, but not vice versa.
2150− */
2151−static inline struct obj_stock *get_obj_stock(unsigned long *pflags)
2152−{
2153− struct memcg_stock_pcp *stock;
2154−
2155− if (likely(in_task())) {
2156− *pflags = 0UL;
2157− preempt_disable();
2158− stock = this_cpu_ptr(&memcg_stock);
2159− return &stock->task_obj;
2160− }
2161−
2162− local_irq_save(*pflags);
2163− stock = this_cpu_ptr(&memcg_stock);
2164− return &stock->irq_obj;
2165−}
2166−
2167−static inline void put_obj_stock(unsigned long flags)
2168−{
2169− if (likely(in_task()))
2170− preempt_enable();
2171− else
2172− local_irq_restore(flags);
2173−}
2174−
21752122 /**
21762123 * consume_stock: Try to consume stocked charge on this cpu.
21772124 * @memcg: memcg to consume from.
@@ -2816,6 +2763,59 @@ retry: · 638 unmodified lines
28162763 */
28172764 #define OBJCGS_CLEAR_MASK (__GFP_DMA | __GFP_RECLAIMABLE | __GFP_ACCOUNT)
28182765
2766+/*
2767+ * Most kmem_cache_alloc() calls are from user context. The irq disable/enable
2768+ * sequence used in this case to access content from object stock is slow.
2769+ * To optimize for user context access, there are now two object stocks for
2770+ * task context and interrupt context access respectively.
2771+ *
2772+ * The task context object stock can be accessed by disabling preemption only
2773+ * which is cheap in non-preempt kernel. The interrupt context object stock
2774+ * can only be accessed after disabling interrupt. User context code can
2775+ * access interrupt object stock, but not vice versa.
2776+ */
2777+static inline struct obj_stock *get_obj_stock(unsigned long *pflags)
2778+{
2779+ struct memcg_stock_pcp *stock;
2780+
2781+ if (likely(in_task())) {
2782+ *pflags = 0UL;
2783+ preempt_disable();
2784+ stock = this_cpu_ptr(&memcg_stock);
2785+ return &stock->task_obj;
2786+ }
2787+
2788+ local_irq_save(*pflags);
2789+ stock = this_cpu_ptr(&memcg_stock);
2790+ return &stock->irq_obj;
2791+}
2792+
2793+static inline void put_obj_stock(unsigned long flags)
2794+{
2795+ if (likely(in_task()))
2796+ preempt_enable();
2797+ else
2798+ local_irq_restore(flags);
2799+}
2800+
2801+/*
2802+ * mod_objcg_mlstate() may be called with irq enabled, so
2803+ * mod_memcg_lruvec_state() should be used.
2804+ */
2805+static inline void mod_objcg_mlstate(struct obj_cgroup *objcg,
2806+ struct pglist_data *pgdat,
2807+ enum node_stat_item idx, int nr)
2808+{
2809+ struct mem_cgroup *memcg;
2810+ struct lruvec *lruvec;
2811+
2812+ rcu_read_lock();
2813+ memcg = obj_cgroup_memcg(objcg);
2814+ lruvec = mem_cgroup_lruvec(memcg, pgdat);
2815+ mod_memcg_lruvec_state(lruvec, idx, nr);
2816+ rcu_read_unlock();
2817+}
2818+
28192819 int memcg_alloc_page_obj_cgroups(struct page *page, struct kmem_cache *s,
28202820 gfp_t gfp, bool new_page)
28212821 {
mm/slub.c+9−6
@@ -5081,6 +5081,7 @@ struct loc_track { · 5080 unmodified lines
50815081 unsigned long max;
50825082 unsigned long count;
50835083 struct location *loc;
5084+ loff_t idx;
50845085 };
50855086
50865087 static struct dentry *slab_debugfs_root;
@@ -6052,11 +6053,11 @@ __initcall(slab_sysfs_init); · 965 unmodified lines
60526053 #if defined(CONFIG_SLUB_DEBUG) && defined(CONFIG_DEBUG_FS)
60536054 static int slab_debugfs_show(struct seq_file *seq, void *v)
60546055 {
6055−
6056− struct location *l;
6057− unsigned int idx = *(unsigned int *)v;
60586056 struct loc_track *t = seq->private;
6057+ struct location *l;
6058+ unsigned long idx;
60596059
6060+ idx = (unsigned long) t->idx;
60606061 if (idx < t->count) {
60616062 l = &t->loc[idx];
60626063
@@ -6105,16 +6106,18 @@ static void *slab_debugfs_next(struct seq_file *seq, void *v, loff_t *ppos) · 42 unmodified lines
61056106 {
61066107 struct loc_track *t = seq->private;
61076108
6108− v = ppos;
6109− ++*ppos;
6109+ t->idx = ++(*ppos);
61106110 if (*ppos <= t->count)
6111− return v;
6111+ return ppos;
61126112
61136113 return NULL;
61146114 }
61156115
61166116 static void *slab_debugfs_start(struct seq_file *seq, loff_t *ppos)
61176117 {
6118+ struct loc_track *t = seq->private;
6119+
6120+ t->idx = *ppos;
61186121 return ppos;
61196122 }
61206123
net/core/skbuff.c+1−1
@@ -832,7 +832,7 @@ void skb_dump(const char *level, const struct sk_buff *skb, bool full_pkt) · 831 unmodified lines
832832 ntohs(skb->protocol), skb->pkt_type, skb->skb_iif);
833833
834834 if (dev)
835− printk("%sdev name=%s feat=0x%pNF\n",
835+ printk("%sdev name=%s feat=%pNF\n",
836836 level, dev->name, &dev->features);
837837 if (sk)
838838 printk("%ssk family=%hu type=%u proto=%u\n",
net/ipv4/inet_diag.c+1−3
@@ -261,6 +261,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, · 260 unmodified lines
261261 r->idiag_state = sk->sk_state;
262262 r->idiag_timer = 0;
263263 r->idiag_retrans = 0;
264+ r->idiag_expires = 0;
264265
265266 if (inet_diag_msg_attrs_fill(sk, skb, r, ext,
266267 sk_user_ns(NETLINK_CB(cb->skb).sk),
@@ -314,9 +315,6 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, · 47 unmodified lines
314315 r->idiag_retrans = icsk->icsk_probes_out;
315316 r->idiag_expires =
316317 jiffies_delta_to_msecs(sk->sk_timer.expires - jiffies);
317− } else {
318− r->idiag_timer = 0;
319− r->idiag_expires = 0;
320318 }
321319
322320 if ((ext & (1 << (INET_DIAG_INFO - 1))) && handler->idiag_info_size) {
net/ipv6/sit.c+0−1
@@ -1933,7 +1933,6 @@ static int __net_init sit_init_net(struct net *net) · 1932 unmodified lines
19331933 return 0;
19341934
19351935 err_reg_dev:
1936− ipip6_dev_free(sitn->fb_tunnel_dev);
19371936 free_netdev(sitn->fb_tunnel_dev);
19381937 err_alloc_dev:
19391938 return err;
net/mac80211/agg-rx.c+3−2
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
1010 * Copyright 2007-2010, Intel Corporation
1111 * Copyright(c) 2015-2017 Intel Deutschland GmbH
12− * Copyright (C) 2018-2020 Intel Corporation
12+ * Copyright (C) 2018-2021 Intel Corporation
1313 */
1414
1515 /**
@@ -191,7 +191,8 @@ static void ieee80211_add_addbaext(struct ieee80211_sub_if_data *sdata, · 175 unmodified lines
191191 sband = ieee80211_get_sband(sdata);
192192 if (!sband)
193193 return;
194− he_cap = ieee80211_get_he_iftype_cap(sband, sdata->vif.type);
194+ he_cap = ieee80211_get_he_iftype_cap(sband,
195+ ieee80211_vif_type_p2p(&sdata->vif));
195196 if (!he_cap)
196197 return;
197198
net/mac80211/agg-tx.c+11−5
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
1010 * Copyright 2007-2010, Intel Corporation
1111 * Copyright(c) 2015-2017 Intel Deutschland GmbH
12− * Copyright (C) 2018 - 2020 Intel Corporation
12+ * Copyright (C) 2018 - 2021 Intel Corporation
1313 */
1414
1515 #include <linux/ieee80211.h>
@@ -106,7 +106,7 @@ static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, · 90 unmodified lines
106106 mgmt->u.action.u.addba_req.start_seq_num =
107107 cpu_to_le16(start_seq_num << 4);
108108
109− ieee80211_tx_skb(sdata, skb);
109+ ieee80211_tx_skb_tid(sdata, skb, tid);
110110 }
111111
112112 void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn)
@@ -213,6 +213,8 @@ ieee80211_agg_start_txq(struct sta_info *sta, int tid, bool enable) · 100 unmodified lines
213213 struct ieee80211_txq *txq = sta->sta.txq[tid];
214214 struct txq_info *txqi;
215215
216+ lockdep_assert_held(&sta->ampdu_mlme.mtx);
217+
216218 if (!txq)
217219 return;
218220
@@ -290,7 +292,6 @@ static void ieee80211_remove_tid_tx(struct sta_info *sta, int tid) · 71 unmodified lines
290292 ieee80211_assign_tid_tx(sta, tid, NULL);
291293
292294 ieee80211_agg_splice_finish(sta->sdata, tid);
293− ieee80211_agg_start_txq(sta, tid, false);
294295
295296 kfree_rcu(tid_tx, rcu_head);
296297 }
@@ -480,8 +481,7 @@ static void ieee80211_send_addba_with_timeout(struct sta_info *sta, · 183 unmodified lines
480481
481482 /* send AddBA request */
482483 ieee80211_send_addba_request(sdata, sta->sta.addr, tid,
483− tid_tx->dialog_token,
484− sta->tid_seq[tid] >> 4,
484+ tid_tx->dialog_token, tid_tx->ssn,
485485 buf_size, tid_tx->timeout);
486486
487487 WARN_ON(test_and_set_bit(HT_AGG_STATE_SENT_ADDBA, &tid_tx->state));
@@ -523,6 +523,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) · 35 unmodified lines
523523
524524 params.ssn = sta->tid_seq[tid] >> 4;
525525 ret = drv_ampdu_action(local, sdata, &params);
526+ tid_tx->ssn = params.ssn;
526527 if (ret == IEEE80211_AMPDU_TX_START_DELAY_ADDBA) {
527528 return;
528529 } else if (ret == IEEE80211_AMPDU_TX_START_IMMEDIATE) {
@@ -889,6 +890,7 @@ void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid, · 360 unmodified lines
889890 {
890891 struct ieee80211_sub_if_data *sdata = sta->sdata;
891892 bool send_delba = false;
893+ bool start_txq = false;
892894
893895 ht_dbg(sdata, "Stopping Tx BA session for %pM tid %d\n",
894896 sta->sta.addr, tid);
@@ -906,10 +908,14 @@ void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid, · 11 unmodified lines
906908 send_delba = true;
907909
908910 ieee80211_remove_tid_tx(sta, tid);
911+ start_txq = true;
909912
910913 unlock_sta:
911914 spin_unlock_bh(&sta->lock);
912915
916+ if (start_txq)
917+ ieee80211_agg_start_txq(sta, tid, false);
918+
913919 if (send_delba)
914920 ieee80211_send_delba(sdata, sta->sta.addr, tid,
915921 WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE);
net/mac80211/driver-ops.h+4−1
@@ -1219,8 +1219,11 @@ static inline void drv_wake_tx_queue(struct ieee80211_local *local, · 1218 unmodified lines
12191219 {
12201220 struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
12211221
1222− if (local->in_reconfig)
1222+ /* In reconfig don't transmit now, but mark for waking later */
1223+ if (local->in_reconfig) {
1224+ set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txq->flags);
12231225 return;
1226+ }
12241227
12251228 if (!check_sdata_in_driver(sdata))
12261229 return;
net/mac80211/mlme.c+10−3
@@ -2452,11 +2452,18 @@ static void ieee80211_sta_tx_wmm_ac_notify(struct ieee80211_sub_if_data *sdata, · 2451 unmodified lines
24522452 u16 tx_time)
24532453 {
24542454 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2455− u16 tid = ieee80211_get_tid(hdr);
2456− int ac = ieee80211_ac_from_tid(tid);
2457− struct ieee80211_sta_tx_tspec *tx_tspec = &ifmgd->tx_tspec[ac];
2455+ u16 tid;
2456+ int ac;
2457+ struct ieee80211_sta_tx_tspec *tx_tspec;
24582458 unsigned long now = jiffies;
24592459
2460+ if (!ieee80211_is_data_qos(hdr->frame_control))
2461+ return;
2462+
2463+ tid = ieee80211_get_tid(hdr);
2464+ ac = ieee80211_ac_from_tid(tid);
2465+ tx_tspec = &ifmgd->tx_tspec[ac];
2466+
24602467 if (likely(!tx_tspec->admitted_time))
24612468 return;
24622469
net/mac80211/rx.c+1−0
@@ -2944,6 +2944,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) · 2943 unmodified lines
29442944 if (!fwd_skb)
29452945 goto out;
29462946
2947+ fwd_skb->dev = sdata->dev;
29472948 fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data;
29482949 fwd_hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_RETRY);
29492950 info = IEEE80211_SKB_CB(fwd_skb);
net/mac80211/sta_info.c+12−9
@@ -644,13 +644,13 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) · 643 unmodified lines
644644 /* check if STA exists already */
645645 if (sta_info_get_bss(sdata, sta->sta.addr)) {
646646 err = -EEXIST;
647− goto out_err;
647+ goto out_cleanup;
648648 }
649649
650650 sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL);
651651 if (!sinfo) {
652652 err = -ENOMEM;
653− goto out_err;
653+ goto out_cleanup;
654654 }
655655
656656 local->num_sta++;
@@ -667,6 +667,15 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) · 10 unmodified lines
667667
668668 list_add_tail_rcu(&sta->list, &local->sta_list);
669669
670+ /* update channel context before notifying the driver about state
671+ * change, this enables driver using the updated channel context right away.
672+ */
673+ if (sta->sta_state >= IEEE80211_STA_ASSOC) {
674+ ieee80211_recalc_min_chandef(sta->sdata);
675+ if (!sta->sta.support_p2p_ps)
676+ ieee80211_recalc_p2p_go_ps_allowed(sta->sdata);
677+ }
678+
670679 /* notify driver */
671680 err = sta_info_insert_drv_state(local, sdata, sta);
672681 if (err)
@@ -674,12 +683,6 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) · 1 unmodified line
674683
675684 set_sta_flag(sta, WLAN_STA_INSERTED);
676685
677− if (sta->sta_state >= IEEE80211_STA_ASSOC) {
678− ieee80211_recalc_min_chandef(sta->sdata);
679− if (!sta->sta.support_p2p_ps)
680− ieee80211_recalc_p2p_go_ps_allowed(sta->sdata);
681− }
682−
683686 /* accept BA sessions now */
684687 clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
685688
@@ -706,8 +709,8 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) · 20 unmodified lines
706709 out_drop_sta:
707710 local->num_sta--;
708711 synchronize_net();
712+ out_cleanup:
709713 cleanup_single_sta(sta);
710− out_err:
711714 mutex_unlock(&local->sta_mtx);
712715 kfree(sinfo);
713716 rcu_read_lock();
net/mac80211/sta_info.h+2−0
@@ -176,6 +176,7 @@ struct sta_info; · 175 unmodified lines
176176 * @failed_bar_ssn: ssn of the last failed BAR tx attempt
177177 * @bar_pending: BAR needs to be re-sent
178178 * @amsdu: support A-MSDU withing A-MDPU
179+ * @ssn: starting sequence number of the session
179180 *
180181 * This structure's lifetime is managed by RCU, assignments to
181182 * the array holding it must hold the aggregation mutex.
@@ -199,6 +200,7 @@ struct tid_ampdu_tx { · 17 unmodified lines
199200 u8 stop_initiator;
200201 bool tx_stop;
201202 u16 buf_size;
203+ u16 ssn;
202204
203205 u16 failed_bar_ssn;
204206 bool bar_pending;
net/mac80211/tx.c+5−5
@@ -1822,15 +1822,15 @@ static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx) · 1821 unmodified lines
18221822 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
18231823 ieee80211_tx_result res = TX_CONTINUE;
18241824
1825+ if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
1826+ CALL_TXH(ieee80211_tx_h_rate_ctrl);
1827+
18251828 if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) {
18261829 __skb_queue_tail(&tx->skbs, tx->skb);
18271830 tx->skb = NULL;
18281831 goto txh_done;
18291832 }
18301833
1831− if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
1832− CALL_TXH(ieee80211_tx_h_rate_ctrl);
1833−
18341834 CALL_TXH(ieee80211_tx_h_michael_mic_add);
18351835 CALL_TXH(ieee80211_tx_h_sequence);
18361836 CALL_TXH(ieee80211_tx_h_fragment);
@@ -4191,11 +4191,11 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb, · 2354 unmodified lines
41914191
41924192 ieee80211_aggr_check(sdata, sta, skb);
41934193
4194+ sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift);
4195+
41944196 if (sta) {
41954197 struct ieee80211_fast_tx *fast_tx;
41964198
4197− sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift);
4198−
41994199 fast_tx = rcu_dereference(sta->fast_tx);
42004200
42014201 if (fast_tx &&
net/mac80211/util.c+14−9
@@ -943,7 +943,12 @@ static void ieee80211_parse_extension_element(u32 *crc, · 942 unmodified lines
943943 struct ieee802_11_elems *elems)
944944 {
945945 const void *data = elem->data + 1;
946− u8 len = elem->datalen - 1;
946+ u8 len;
947+
948+ if (!elem->datalen)
949+ return;
950+
951+ len = elem->datalen - 1;
947952
948953 switch (elem->data[0]) {
949954 case WLAN_EID_EXT_HE_MU_EDCA:
@@ -2063,7 +2068,7 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, · 1113 unmodified lines
20632068 chandef.chan = chan;
20642069
20652070 skb = ieee80211_probereq_get(&local->hw, src, ssid, ssid_len,
2066− 100 + ie_len);
2071+ local->scan_ies_len + ie_len);
20672072 if (!skb)
20682073 return NULL;
20692074
@@ -2646,6 +2651,13 @@ int ieee80211_reconfig(struct ieee80211_local *local) · 576 unmodified lines
26462651 mutex_unlock(&local->sta_mtx);
26472652 }
26482653
2654+ /*
2655+ * If this is for hw restart things are still running.
2656+ * We may want to change that later, however.
2657+ */
2658+ if (local->open_count && (!suspended || reconfig_due_to_wowlan))
2659+ drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_RESTART);
2660+
26492661 if (local->in_reconfig) {
26502662 local->in_reconfig = false;
26512663 barrier();
@@ -2664,13 +2676,6 @@ int ieee80211_reconfig(struct ieee80211_local *local) · 12 unmodified lines
26642676 IEEE80211_QUEUE_STOP_REASON_SUSPEND,
26652677 false);
26662678
2667− /*
2668− * If this is for hw restart things are still running.
2669− * We may want to change that later, however.
2670− */
2671− if (local->open_count && (!suspended || reconfig_due_to_wowlan))
2672− drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_RESTART);
2673−
26742679 if (!suspended)
26752680 return 0;
26762681
net/mptcp/pm_netlink.c+3−0
@@ -700,6 +700,9 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk, · 699 unmodified lines
700700
701701 msk_owned_by_me(msk);
702702
703+ if (sk->sk_state == TCP_LISTEN)
704+ return;
705+
703706 if (!rm_list->nr)
704707 return;
705708
net/mptcp/protocol.c+4−2
@@ -1527,7 +1527,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags) · 1526 unmodified lines
15271527 int ret = 0;
15281528
15291529 prev_ssk = ssk;
1530− mptcp_flush_join_list(msk);
1530+ __mptcp_flush_join_list(msk);
15311531 ssk = mptcp_subflow_get_send(msk);
15321532
15331533 /* First check. If the ssk has changed since
@@ -2914,7 +2914,7 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err, · 1380 unmodified lines
29142914 */
29152915 if (WARN_ON_ONCE(!new_mptcp_sock)) {
29162916 tcp_sk(newsk)->is_mptcp = 0;
2917− return newsk;
2917+ goto out;
29182918 }
29192919
29202920 /* acquire the 2nd reference for the owning socket */
@@ -2926,6 +2926,8 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err, · 5 unmodified lines
29262926 MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK);
29272927 }
29282928
2929+out:
2930+ newsk->sk_kern_sock = kern;
29292931 return newsk;
29302932 }
29312933
net/mptcp/sockopt.c+0−1
@@ -543,7 +543,6 @@ static bool mptcp_supported_sockopt(int level, int optname) · 542 unmodified lines
543543 case TCP_NODELAY:
544544 case TCP_THIN_LINEAR_TIMEOUTS:
545545 case TCP_CONGESTION:
546− case TCP_ULP:
547546 case TCP_CORK:
548547 case TCP_KEEPIDLE:
549548 case TCP_KEEPINTVL:
net/packet/af_packet.c+3−2
@@ -4496,9 +4496,10 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, · 4495 unmodified lines
44964496 }
44974497
44984498 out_free_pg_vec:
4499− bitmap_free(rx_owner_map);
4500− if (pg_vec)
4499+ if (pg_vec) {
4500+ bitmap_free(rx_owner_map);
45014501 free_pg_vec(pg_vec, order, req->tp_block_nr);
4502+ }
45024503 out:
45034504 return err;
45044505 }
net/phonet/pep.c+1−0
@@ -868,6 +868,7 @@ static struct sock *pep_sock_accept(struct sock *sk, int flags, int *errp, · 867 unmodified lines
868868
869869 err = pep_accept_conn(newsk, skb);
870870 if (err) {
871+ __sock_put(sk);
871872 sock_put(newsk);
872873 newsk = NULL;
873874 goto drop;
net/rds/connection.c+1−0
@@ -253,6 +253,7 @@ static struct rds_connection *__rds_conn_create(struct net *net, · 252 unmodified lines
253253 * should end up here, but if it
254254 * does, reset/destroy the connection.
255255 */
256+ kfree(conn->c_path);
256257 kmem_cache_free(rds_conn_slab, conn);
257258 conn = ERR_PTR(-EOPNOTSUPP);
258259 goto out;
net/sched/cls_api.c+1−0
@@ -3687,6 +3687,7 @@ int tc_setup_flow_action(struct flow_action *flow_action, · 3686 unmodified lines
36873687 entry->mpls_mangle.ttl = tcf_mpls_ttl(act);
36883688 break;
36893689 default:
3690+ err = -EOPNOTSUPP;
36903691 goto err_out_locked;
36913692 }
36923693 } else if (is_tcf_skbedit_ptype(act)) {
net/sched/sch_cake.c+1−5
@@ -2736,7 +2736,7 @@ static int cake_init(struct Qdisc *sch, struct nlattr *opt, · 2735 unmodified lines
27362736 q->tins = kvcalloc(CAKE_MAX_TINS, sizeof(struct cake_tin_data),
27372737 GFP_KERNEL);
27382738 if (!q->tins)
2739− goto nomem;
2739+ return -ENOMEM;
27402740
27412741 for (i = 0; i < CAKE_MAX_TINS; i++) {
27422742 struct cake_tin_data *b = q->tins + i;
@@ -2766,10 +2766,6 @@ static int cake_init(struct Qdisc *sch, struct nlattr *opt, · 23 unmodified lines
27662766 q->min_netlen = ~0;
27672767 q->min_adjlen = ~0;
27682768 return 0;
2769−
2770−nomem:
2771− cake_destroy(sch);
2772− return -ENOMEM;
27732769 }
27742770
27752771 static int cake_dump(struct Qdisc *sch, struct sk_buff *skb)
net/sched/sch_ets.c+2−2
@@ -666,9 +666,9 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt, · 665 unmodified lines
666666 }
667667 }
668668 for (i = q->nbands; i < oldbands; i++) {
669− qdisc_tree_flush_backlog(q->classes[i].qdisc);
670− if (i >= q->nstrict)
669+ if (i >= q->nstrict && q->classes[i].qdisc->q.qlen)
671670 list_del(&q->classes[i].alist);
671+ qdisc_tree_flush_backlog(q->classes[i].qdisc);
672672 }
673673 q->nstrict = nstrict;
674674 memcpy(q->prio2band, priomap, sizeof(priomap));
net/smc/af_smc.c+3−1
@@ -194,7 +194,9 @@ static int smc_release(struct socket *sock) · 193 unmodified lines
194194 /* cleanup for a dangling non-blocking connect */
195195 if (smc->connect_nonblock && sk->sk_state == SMC_INIT)
196196 tcp_abort(smc->clcsock->sk, ECONNABORTED);
197− flush_work(&smc->connect_work);
197+
198+ if (cancel_work_sync(&smc->connect_work))
199+ sock_put(&smc->sk); /* sock_hold in smc_connect for passive closing */
198200
199201 if (sk->sk_state == SMC_LISTEN)
200202 /* smc_close_non_accepted() is called and acquires
net/vmw_vsock/virtio_transport_common.c+2−1
@@ -1299,7 +1299,8 @@ void virtio_transport_recv_pkt(struct virtio_transport *t, · 1298 unmodified lines
12991299 space_available = virtio_transport_space_update(sk, pkt);
13001300
13011301 /* Update CID in case it has changed after a transport reset event */
1302− vsk->local_addr.svm_cid = dst.svm_cid;
1302+ if (vsk->local_addr.svm_cid != VMADDR_CID_ANY)
1303+ vsk->local_addr.svm_cid = dst.svm_cid;
13031304
13041305 if (space_available)
13051306 sk->sk_write_space(sk);
net/wireless/reg.c+28−2
@@ -133,6 +133,7 @@ static u32 reg_is_indoor_portid; · 132 unmodified lines
133133
134134 static void restore_regulatory_settings(bool reset_user, bool cached);
135135 static void print_regdomain(const struct ieee80211_regdomain *rd);
136+static void reg_process_hint(struct regulatory_request *reg_request);
136137
137138 static const struct ieee80211_regdomain *get_cfg80211_regdom(void)
138139 {
@@ -1098,6 +1099,8 @@ int reg_reload_regdb(void) · 959 unmodified lines
10981099 const struct firmware *fw;
10991100 void *db;
11001101 int err;
1102+ const struct ieee80211_regdomain *current_regdomain;
1103+ struct regulatory_request *request;
11011104
11021105 err = request_firmware(&fw, "regulatory.db", &reg_pdev->dev);
11031106 if (err)
@@ -1118,8 +1121,26 @@ int reg_reload_regdb(void) · 14 unmodified lines
11181121 if (!IS_ERR_OR_NULL(regdb))
11191122 kfree(regdb);
11201123 regdb = db;
1121− rtnl_unlock();
11221124
1125+ /* reset regulatory domain */
1126+ current_regdomain = get_cfg80211_regdom();
1127+
1128+ request = kzalloc(sizeof(*request), GFP_KERNEL);
1129+ if (!request) {
1130+ err = -ENOMEM;
1131+ goto out_unlock;
1132+ }
1133+
1134+ request->wiphy_idx = WIPHY_IDX_INVALID;
1135+ request->alpha2[0] = current_regdomain->alpha2[0];
1136+ request->alpha2[1] = current_regdomain->alpha2[1];
1137+ request->initiator = NL80211_REGDOM_SET_BY_CORE;
1138+ request->user_reg_hint_type = NL80211_USER_REG_HINT_USER;
1139+
1140+ reg_process_hint(request);
1141+
1142+out_unlock:
1143+ rtnl_unlock();
11231144 out:
11241145 release_firmware(fw);
11251146 return err;
@@ -2338,6 +2359,7 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) · 1212 unmodified lines
23382359 struct cfg80211_chan_def chandef = {};
23392360 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
23402361 enum nl80211_iftype iftype;
2362+ bool ret;
23412363
23422364 wdev_lock(wdev);
23432365 iftype = wdev->iftype;
@@ -2387,7 +2409,11 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) · 43 unmodified lines
23872409 case NL80211_IFTYPE_AP:
23882410 case NL80211_IFTYPE_P2P_GO:
23892411 case NL80211_IFTYPE_ADHOC:
2390− return cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype);
2412+ wiphy_lock(wiphy);
2413+ ret = cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype);
2414+ wiphy_unlock(wiphy);
2415+
2416+ return ret;
23912417 case NL80211_IFTYPE_STATION:
23922418 case NL80211_IFTYPE_P2P_CLIENT:
23932419 return cfg80211_chandef_usable(wiphy, &chandef,
net/xdp/xsk.c+2−2
@@ -677,8 +677,6 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock, · 676 unmodified lines
677677 struct xdp_sock *xs = xdp_sk(sk);
678678 struct xsk_buff_pool *pool;
679679
680− sock_poll_wait(file, sock, wait);
681−
682680 if (unlikely(!xsk_is_bound(xs)))
683681 return mask;
684682
@@ -690,6 +688,8 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock, · 5 unmodified lines
690688 else
691689 /* Poll needs to drive Tx also in copy mode */
692690 __xsk_sendmsg(sk);
691+ } else {
692+ sock_poll_wait(file, sock, wait);
693693 }
694694
695695 if (xs->rx && !xskq_prod_is_empty(xs->rx))
samples/ftrace/Makefile+1−0
@@ -4,6 +4,7 @@ obj-$(CONFIG_SAMPLE_FTRACE_DIRECT) += ftrace-direct.o · 3 unmodified lines
44 obj-$(CONFIG_SAMPLE_FTRACE_DIRECT) += ftrace-direct-too.o
55 obj-$(CONFIG_SAMPLE_FTRACE_DIRECT) += ftrace-direct-modify.o
66 obj-$(CONFIG_SAMPLE_FTRACE_DIRECT_MULTI) += ftrace-direct-multi.o
7+obj-$(CONFIG_SAMPLE_FTRACE_DIRECT_MULTI) += ftrace-direct-multi-modify.o
78
89 CFLAGS_sample-trace-array.o := -I$(src)
910 obj-$(CONFIG_SAMPLE_TRACE_ARRAY) += sample-trace-array.o
samples/ftrace/ftrace-direct-multi-modify.c+152−0
@@ -0,0 +1,152 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+#include <linux/module.h>
3+#include <linux/kthread.h>
4+#include <linux/ftrace.h>
5+#include <asm/asm-offsets.h>
6+
7+void my_direct_func1(unsigned long ip)
8+{
9+ trace_printk("my direct func1 ip %lx\n", ip);
10+}
11+
12+void my_direct_func2(unsigned long ip)
13+{
14+ trace_printk("my direct func2 ip %lx\n", ip);
15+}
16+
17+extern void my_tramp1(void *);
18+extern void my_tramp2(void *);
19+
20+#ifdef CONFIG_X86_64
21+
22+asm (
23+" .pushsection .text, \"ax\", @progbits\n"
24+" .type my_tramp1, @function\n"
25+" .globl my_tramp1\n"
26+" my_tramp1:"
27+" pushq %rbp\n"
28+" movq %rsp, %rbp\n"
29+" pushq %rdi\n"
30+" movq 8(%rbp), %rdi\n"
31+" call my_direct_func1\n"
32+" popq %rdi\n"
33+" leave\n"
34+" ret\n"
35+" .size my_tramp1, .-my_tramp1\n"
36+" .type my_tramp2, @function\n"
37+"\n"
38+" .globl my_tramp2\n"
39+" my_tramp2:"
40+" pushq %rbp\n"
41+" movq %rsp, %rbp\n"
42+" pushq %rdi\n"
43+" movq 8(%rbp), %rdi\n"
44+" call my_direct_func2\n"
45+" popq %rdi\n"
46+" leave\n"
47+" ret\n"
48+" .size my_tramp2, .-my_tramp2\n"
49+" .popsection\n"
50+);
51+
52+#endif /* CONFIG_X86_64 */
53+
54+#ifdef CONFIG_S390
55+
56+asm (
57+" .pushsection .text, \"ax\", @progbits\n"
58+" .type my_tramp1, @function\n"
59+" .globl my_tramp1\n"
60+" my_tramp1:"
61+" lgr %r1,%r15\n"
62+" stmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n"
63+" stg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n"
64+" aghi %r15,"__stringify(-STACK_FRAME_OVERHEAD)"\n"
65+" stg %r1,"__stringify(__SF_BACKCHAIN)"(%r15)\n"
66+" lgr %r2,%r0\n"
67+" brasl %r14,my_direct_func1\n"
68+" aghi %r15,"__stringify(STACK_FRAME_OVERHEAD)"\n"
69+" lmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n"
70+" lg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n"
71+" lgr %r1,%r0\n"
72+" br %r1\n"
73+" .size my_tramp1, .-my_tramp1\n"
74+"\n"
75+" .type my_tramp2, @function\n"
76+" .globl my_tramp2\n"
77+" my_tramp2:"
78+" lgr %r1,%r15\n"
79+" stmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n"
80+" stg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n"
81+" aghi %r15,"__stringify(-STACK_FRAME_OVERHEAD)"\n"
82+" stg %r1,"__stringify(__SF_BACKCHAIN)"(%r15)\n"
83+" lgr %r2,%r0\n"
84+" brasl %r14,my_direct_func2\n"
85+" aghi %r15,"__stringify(STACK_FRAME_OVERHEAD)"\n"
86+" lmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n"
87+" lg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n"
88+" lgr %r1,%r0\n"
89+" br %r1\n"
90+" .size my_tramp2, .-my_tramp2\n"
91+" .popsection\n"
92+);
93+
94+#endif /* CONFIG_S390 */
95+
96+static unsigned long my_tramp = (unsigned long)my_tramp1;
97+static unsigned long tramps[2] = {
98+ (unsigned long)my_tramp1,
99+ (unsigned long)my_tramp2,
100+};
101+
102+static struct ftrace_ops direct;
103+
104+static int simple_thread(void *arg)
105+{
106+ static int t;
107+ int ret = 0;
108+
109+ while (!kthread_should_stop()) {
110+ set_current_state(TASK_INTERRUPTIBLE);
111+ schedule_timeout(2 * HZ);
112+
113+ if (ret)
114+ continue;
115+ t ^= 1;
116+ ret = modify_ftrace_direct_multi(&direct, tramps[t]);
117+ if (!ret)
118+ my_tramp = tramps[t];
119+ WARN_ON_ONCE(ret);
120+ }
121+
122+ return 0;
123+}
124+
125+static struct task_struct *simple_tsk;
126+
127+static int __init ftrace_direct_multi_init(void)
128+{
129+ int ret;
130+
131+ ftrace_set_filter_ip(&direct, (unsigned long) wake_up_process, 0, 0);
132+ ftrace_set_filter_ip(&direct, (unsigned long) schedule, 0, 0);
133+
134+ ret = register_ftrace_direct_multi(&direct, my_tramp);
135+
136+ if (!ret)
137+ simple_tsk = kthread_run(simple_thread, NULL, "event-sample-fn");
138+ return ret;
139+}
140+
141+static void __exit ftrace_direct_multi_exit(void)
142+{
143+ kthread_stop(simple_tsk);
144+ unregister_ftrace_direct_multi(&direct, my_tramp);
145+}
146+
147+module_init(ftrace_direct_multi_init);
148+module_exit(ftrace_direct_multi_exit);
149+
150+MODULE_AUTHOR("Jiri Olsa");
151+MODULE_DESCRIPTION("Example use case of using modify_ftrace_direct_multi()");
152+MODULE_LICENSE("GPL");
scripts/recordmcount.pl+1−1
@@ -219,7 +219,7 @@ if ($arch eq "x86_64") { · 218 unmodified lines
219219
220220 } elsif ($arch eq "s390" && $bits == 64) {
221221 if ($cc =~ /-DCC_USING_HOTPATCH/) {
222− $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*brcl\\s*0,[0-9a-f]+ <([^\+]*)>\$";
222+ $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*(bcrl\\s*0,|jgnop\\s*)[0-9a-f]+ <([^\+]*)>\$";
223223 $mcount_adjust = 0;
224224 }
225225 $alignment = 8;
sound/core/control_compat.c+3−0
@@ -264,6 +264,7 @@ static int copy_ctl_value_to_user(void __user *userdata, · 263 unmodified lines
264264 struct snd_ctl_elem_value *data,
265265 int type, int count)
266266 {
267+ struct snd_ctl_elem_value32 __user *data32 = userdata;
267268 int i, size;
268269
269270 if (type == SNDRV_CTL_ELEM_TYPE_BOOLEAN ||
@@ -280,6 +281,8 @@ static int copy_ctl_value_to_user(void __user *userdata, · 10 unmodified lines
280281 if (copy_to_user(valuep, data->value.bytes.data, size))
281282 return -EFAULT;
282283 }
284+ if (copy_to_user(&data32->id, &data->id, sizeof(data32->id)))
285+ return -EFAULT;
283286 return 0;
284287 }
285288
sound/core/oss/pcm_oss.c+25−12
@@ -147,7 +147,7 @@ snd_pcm_hw_param_value_min(const struct snd_pcm_hw_params *params, · 146 unmodified lines
147147 *
148148 * Return the maximum value for field PAR.
149149 */
150−static unsigned int
150+static int
151151 snd_pcm_hw_param_value_max(const struct snd_pcm_hw_params *params,
152152 snd_pcm_hw_param_t var, int *dir)
153153 {
@@ -682,18 +682,24 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, · 528 unmodified lines
682682 struct snd_pcm_hw_params *oss_params,
683683 struct snd_pcm_hw_params *slave_params)
684684 {
685− size_t s;
686− size_t oss_buffer_size, oss_period_size, oss_periods;
687− size_t min_period_size, max_period_size;
685+ ssize_t s;
686+ ssize_t oss_buffer_size;
687+ ssize_t oss_period_size, oss_periods;
688+ ssize_t min_period_size, max_period_size;
688689 struct snd_pcm_runtime *runtime = substream->runtime;
689690 size_t oss_frame_size;
690691
691692 oss_frame_size = snd_pcm_format_physical_width(params_format(oss_params)) *
692693 params_channels(oss_params) / 8;
693694
695+ oss_buffer_size = snd_pcm_hw_param_value_max(slave_params,
696+ SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
697+ NULL);
698+ if (oss_buffer_size <= 0)
699+ return -EINVAL;
694700 oss_buffer_size = snd_pcm_plug_client_size(substream,
695− snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, NULL)) * oss_frame_size;
696− if (!oss_buffer_size)
701+ oss_buffer_size * oss_frame_size);
702+ if (oss_buffer_size <= 0)
697703 return -EINVAL;
698704 oss_buffer_size = rounddown_pow_of_two(oss_buffer_size);
699705 if (atomic_read(&substream->mmap_count)) {
@@ -730,7 +736,7 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, · 30 unmodified lines
730736
731737 min_period_size = snd_pcm_plug_client_size(substream,
732738 snd_pcm_hw_param_value_min(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL));
733− if (min_period_size) {
739+ if (min_period_size > 0) {
734740 min_period_size *= oss_frame_size;
735741 min_period_size = roundup_pow_of_two(min_period_size);
736742 if (oss_period_size < min_period_size)
@@ -739,7 +745,7 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, · 2 unmodified lines
739745
740746 max_period_size = snd_pcm_plug_client_size(substream,
741747 snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL));
742− if (max_period_size) {
748+ if (max_period_size > 0) {
743749 max_period_size *= oss_frame_size;
744750 max_period_size = rounddown_pow_of_two(max_period_size);
745751 if (oss_period_size > max_period_size)
@@ -752,7 +758,7 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, · 6 unmodified lines
752758 oss_periods = substream->oss.setup.periods;
753759
754760 s = snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIODS, NULL);
755− if (runtime->oss.maxfrags && s > runtime->oss.maxfrags)
761+ if (s > 0 && runtime->oss.maxfrags && s > runtime->oss.maxfrags)
756762 s = runtime->oss.maxfrags;
757763 if (oss_periods > s)
758764 oss_periods = s;
@@ -878,8 +884,15 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream) · 119 unmodified lines
878884 err = -EINVAL;
879885 goto failure;
880886 }
881− choose_rate(substream, sparams, runtime->oss.rate);
882− snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_CHANNELS, runtime->oss.channels, NULL);
887+
888+ err = choose_rate(substream, sparams, runtime->oss.rate);
889+ if (err < 0)
890+ goto failure;
891+ err = snd_pcm_hw_param_near(substream, sparams,
892+ SNDRV_PCM_HW_PARAM_CHANNELS,
893+ runtime->oss.channels, NULL);
894+ if (err < 0)
895+ goto failure;
883896
884897 format = snd_pcm_oss_format_from(runtime->oss.format);
885898
@@ -1956,7 +1969,7 @@ static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsign · 1070 unmodified lines
19561969 if (runtime->oss.subdivision || runtime->oss.fragshift)
19571970 return -EINVAL;
19581971 fragshift = val & 0xffff;
1959− if (fragshift >= 31)
1972+ if (fragshift >= 25) /* should be large enough */
19601973 return -EINVAL;
19611974 runtime->oss.fragshift = fragshift;
19621975 runtime->oss.maxfrags = (val >> 16) & 0xffff;
sound/pci/hda/patch_realtek.c+62−18
@@ -6503,22 +6503,26 @@ static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, · 6502 unmodified lines
65036503 /* for alc285_fixup_ideapad_s740_coef() */
65046504 #include "ideapad_s740_helper.c"
65056505
6506−static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *codec,
6507− const struct hda_fixup *fix,
6508− int action)
6506+static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6507+ WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6508+ WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6509+ WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6510+ {}
6511+};
6512+
6513+static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6514+ const struct hda_fixup *fix,
6515+ int action)
65096516 {
65106517 /*
6511− * A certain other OS sets these coeffs to different values. On at least one TongFang
6512− * barebone these settings might survive even a cold reboot. So to restore a clean slate the
6513− * values are explicitly reset to default here. Without this, the external microphone is
6514− * always in a plugged-in state, while the internal microphone is always in an unplugged
6515− * state, breaking the ability to use the internal microphone.
6516− */
6517− alc_write_coef_idx(codec, 0x24, 0x0000);
6518− alc_write_coef_idx(codec, 0x26, 0x0000);
6519− alc_write_coef_idx(codec, 0x29, 0x3000);
6520− alc_write_coef_idx(codec, 0x37, 0xfe05);
6521− alc_write_coef_idx(codec, 0x45, 0x5089);
6518+ * A certain other OS sets these coeffs to different values. On at least
6519+ * one TongFang barebone these settings might survive even a cold
6520+ * reboot. So to restore a clean slate the values are explicitly reset
6521+ * to default here. Without this, the external microphone is always in a
6522+ * plugged-in state, while the internal microphone is always in an
6523+ * unplugged state, breaking the ability to use the internal microphone.
6524+ */
6525+ alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
65226526 }
65236527
65246528 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
@@ -6759,7 +6763,7 @@ enum { · 234 unmodified lines
67596763 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
67606764 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
67616765 ALC287_FIXUP_13S_GEN2_SPEAKERS,
6762− ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS,
6766+ ALC256_FIXUP_SET_COEF_DEFAULTS,
67636767 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
67646768 ALC233_FIXUP_NO_AUDIO_JACK,
67656769 };
@@ -8465,9 +8469,9 @@ static const struct hda_fixup alc269_fixups[] = { · 1699 unmodified lines
84658469 .chained = true,
84668470 .chain_id = ALC269_FIXUP_HEADSET_MODE,
84678471 },
8468− [ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS] = {
8472+ [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
84698473 .type = HDA_FIXUP_FUNC,
8470− .v.func = alc256_fixup_tongfang_reset_persistent_settings,
8474+ .v.func = alc256_fixup_set_coef_defaults,
84718475 },
84728476 [ALC245_FIXUP_HP_GPIO_LED] = {
84738477 .type = HDA_FIXUP_FUNC,
@@ -8929,7 +8933,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 455 unmodified lines
89298933 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
89308934 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
89318935 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
8932− SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS),
8936+ SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
89338937 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
89348938 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
89358939 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
@@ -10231,6 +10235,27 @@ static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, · 1295 unmodified lines
1023110235 }
1023210236 }
1023310237
10238+static void alc897_hp_automute_hook(struct hda_codec *codec,
10239+ struct hda_jack_callback *jack)
10240+{
10241+ struct alc_spec *spec = codec->spec;
10242+ int vref;
10243+
10244+ snd_hda_gen_hp_automute(codec, jack);
10245+ vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10246+ snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10247+ vref);
10248+}
10249+
10250+static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10251+ const struct hda_fixup *fix, int action)
10252+{
10253+ struct alc_spec *spec = codec->spec;
10254+ if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10255+ spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10256+ }
10257+}
10258+
1023410259 static const struct coef_fw alc668_coefs[] = {
1023510260 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
1023610261 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
@@ -10311,6 +10336,8 @@ enum { · 74 unmodified lines
1031110336 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
1031210337 ALC668_FIXUP_HEADSET_MIC,
1031310338 ALC668_FIXUP_MIC_DET_COEF,
10339+ ALC897_FIXUP_LENOVO_HEADSET_MIC,
10340+ ALC897_FIXUP_HEADSET_MIC_PIN,
1031410341 };
1031510342
1031610343 static const struct hda_fixup alc662_fixups[] = {
@@ -10717,6 +10744,19 @@ static const struct hda_fixup alc662_fixups[] = { · 400 unmodified lines
1071710744 {}
1071810745 },
1071910746 },
10747+ [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
10748+ .type = HDA_FIXUP_FUNC,
10749+ .v.func = alc897_fixup_lenovo_headset_mic,
10750+ },
10751+ [ALC897_FIXUP_HEADSET_MIC_PIN] = {
10752+ .type = HDA_FIXUP_PINS,
10753+ .v.pins = (const struct hda_pintbl[]) {
10754+ { 0x1a, 0x03a11050 },
10755+ { }
10756+ },
10757+ .chained = true,
10758+ .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
10759+ },
1072010760 };
1072110761
1072210762 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -10761,6 +10801,10 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { · 38 unmodified lines
1076110801 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
1076210802 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
1076310803 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
10804+ SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
10805+ SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
10806+ SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
10807+ SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
1076410808 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
1076510809 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1076610810 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
sound/soc/amd/yc/pci-acp6x.c+2−1
@@ -146,10 +146,11 @@ static int snd_acp6x_probe(struct pci_dev *pci, · 145 unmodified lines
146146 {
147147 struct acp6x_dev_data *adata;
148148 struct platform_device_info pdevinfo[ACP6x_DEVS];
149− int ret, index;
149+ int index = 0;
150150 int val = 0x00;
151151 u32 addr;
152152 unsigned int irqflags;
153+ int ret;
153154
154155 irqflags = IRQF_SHARED;
155156 /* Yellow Carp device check */
sound/soc/codecs/rt5682.c+6−4
@@ -2858,6 +2858,8 @@ int rt5682_register_dai_clks(struct rt5682_priv *rt5682) · 2857 unmodified lines
28582858
28592859 for (i = 0; i < RT5682_DAI_NUM_CLKS; ++i) {
28602860 struct clk_init_data init = { };
2861+ struct clk_parent_data parent_data;
2862+ const struct clk_hw *parent;
28612863
28622864 dai_clk_hw = &rt5682->dai_clks_hw[i];
28632865
@@ -2865,17 +2867,17 @@ int rt5682_register_dai_clks(struct rt5682_priv *rt5682) · 1 unmodified line
28652867 case RT5682_DAI_WCLK_IDX:
28662868 /* Make MCLK the parent of WCLK */
28672869 if (rt5682->mclk) {
2868− init.parent_data = &(struct clk_parent_data){
2870+ parent_data = (struct clk_parent_data){
28692871 .fw_name = "mclk",
28702872 };
2873+ init.parent_data = &parent_data;
28712874 init.num_parents = 1;
28722875 }
28732876 break;
28742877 case RT5682_DAI_BCLK_IDX:
28752878 /* Make WCLK the parent of BCLK */
2876− init.parent_hws = &(const struct clk_hw *){
2877− &rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX]
2878− };
2879+ parent = &rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX];
2880+ init.parent_hws = &parent;
28792881 init.num_parents = 1;
28802882 break;
28812883 default:
sound/soc/codecs/rt5682s.c+6−4
@@ -2693,6 +2693,8 @@ static int rt5682s_register_dai_clks(struct snd_soc_component *component) · 2692 unmodified lines
26932693
26942694 for (i = 0; i < RT5682S_DAI_NUM_CLKS; ++i) {
26952695 struct clk_init_data init = { };
2696+ struct clk_parent_data parent_data;
2697+ const struct clk_hw *parent;
26962698
26972699 dai_clk_hw = &rt5682s->dai_clks_hw[i];
26982700
@@ -2700,17 +2702,17 @@ static int rt5682s_register_dai_clks(struct snd_soc_component *component) · 1 unmodified line
27002702 case RT5682S_DAI_WCLK_IDX:
27012703 /* Make MCLK the parent of WCLK */
27022704 if (rt5682s->mclk) {
2703− init.parent_data = &(struct clk_parent_data){
2705+ parent_data = (struct clk_parent_data){
27042706 .fw_name = "mclk",
27052707 };
2708+ init.parent_data = &parent_data;
27062709 init.num_parents = 1;
27072710 }
27082711 break;
27092712 case RT5682S_DAI_BCLK_IDX:
27102713 /* Make WCLK the parent of BCLK */
2711− init.parent_hws = &(const struct clk_hw *){
2712− &rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX]
2713− };
2714+ parent = &rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX];
2715+ init.parent_hws = &parent;
27142716 init.num_parents = 1;
27152717 break;
27162718 default:
sound/soc/codecs/wcd934x.c+93−33
@@ -3256,6 +3256,9 @@ static int wcd934x_compander_set(struct snd_kcontrol *kc, · 3255 unmodified lines
32563256 int value = ucontrol->value.integer.value[0];
32573257 int sel;
32583258
3259+ if (wcd->comp_enabled[comp] == value)
3260+ return 0;
3261+
32593262 wcd->comp_enabled[comp] = value;
32603263 sel = value ? WCD934X_HPH_GAIN_SRC_SEL_COMPANDER :
32613264 WCD934X_HPH_GAIN_SRC_SEL_REGISTER;
@@ -3279,10 +3282,10 @@ static int wcd934x_compander_set(struct snd_kcontrol *kc, · 17 unmodified lines
32793282 case COMPANDER_8:
32803283 break;
32813284 default:
3282− break;
3285+ return 0;
32833286 }
32843287
3285− return 0;
3288+ return 1;
32863289 }
32873290
32883291 static int wcd934x_rx_hph_mode_get(struct snd_kcontrol *kc,
@@ -3326,6 +3329,31 @@ static int slim_rx_mux_get(struct snd_kcontrol *kc, · 37 unmodified lines
33263329 return 0;
33273330 }
33283331
3332+static int slim_rx_mux_to_dai_id(int mux)
3333+{
3334+ int aif_id;
3335+
3336+ switch (mux) {
3337+ case 1:
3338+ aif_id = AIF1_PB;
3339+ break;
3340+ case 2:
3341+ aif_id = AIF2_PB;
3342+ break;
3343+ case 3:
3344+ aif_id = AIF3_PB;
3345+ break;
3346+ case 4:
3347+ aif_id = AIF4_PB;
3348+ break;
3349+ default:
3350+ aif_id = -1;
3351+ break;
3352+ }
3353+
3354+ return aif_id;
3355+}
3356+
33293357 static int slim_rx_mux_put(struct snd_kcontrol *kc,
33303358 struct snd_ctl_elem_value *ucontrol)
33313359 {
@@ -3333,43 +3361,59 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc, · 1 unmodified line
33333361 struct wcd934x_codec *wcd = dev_get_drvdata(w->dapm->dev);
33343362 struct soc_enum *e = (struct soc_enum *)kc->private_value;
33353363 struct snd_soc_dapm_update *update = NULL;
3364+ struct wcd934x_slim_ch *ch, *c;
33363365 u32 port_id = w->shift;
3366+ bool found = false;
3367+ int mux_idx;
3368+ int prev_mux_idx = wcd->rx_port_value[port_id];
3369+ int aif_id;
33373370
3338− if (wcd->rx_port_value[port_id] == ucontrol->value.enumerated.item[0])
3339− return 0;
3371+ mux_idx = ucontrol->value.enumerated.item[0];
33403372
3341− wcd->rx_port_value[port_id] = ucontrol->value.enumerated.item[0];
3373+ if (mux_idx == prev_mux_idx)
3374+ return 0;
33423375
3343− switch (wcd->rx_port_value[port_id]) {
3376+ switch(mux_idx) {
33443377 case 0:
3345− list_del_init(&wcd->rx_chs[port_id].list);
3346− break;
3347− case 1:
3348− list_add_tail(&wcd->rx_chs[port_id].list,
3349− &wcd->dai[AIF1_PB].slim_ch_list);
3350− break;
3351− case 2:
3352− list_add_tail(&wcd->rx_chs[port_id].list,
3353− &wcd->dai[AIF2_PB].slim_ch_list);
3354− break;
3355− case 3:
3356− list_add_tail(&wcd->rx_chs[port_id].list,
3357− &wcd->dai[AIF3_PB].slim_ch_list);
3378+ aif_id = slim_rx_mux_to_dai_id(prev_mux_idx);
3379+ if (aif_id < 0)
3380+ return 0;
3381+
3382+ list_for_each_entry_safe(ch, c, &wcd->dai[aif_id].slim_ch_list, list) {
3383+ if (ch->port == port_id + WCD934X_RX_START) {
3384+ found = true;
3385+ list_del_init(&ch->list);
3386+ break;
3387+ }
3388+ }
3389+ if (!found)
3390+ return 0;
3391+
33583392 break;
3359− case 4:
3360− list_add_tail(&wcd->rx_chs[port_id].list,
3361− &wcd->dai[AIF4_PB].slim_ch_list);
3393+ case 1 ... 4:
3394+ aif_id = slim_rx_mux_to_dai_id(mux_idx);
3395+ if (aif_id < 0)
3396+ return 0;
3397+
3398+ if (list_empty(&wcd->rx_chs[port_id].list)) {
3399+ list_add_tail(&wcd->rx_chs[port_id].list,
3400+ &wcd->dai[aif_id].slim_ch_list);
3401+ } else {
3402+ dev_err(wcd->dev ,"SLIM_RX%d PORT is busy\n", port_id);
3403+ return 0;
3404+ }
33623405 break;
3406+
33633407 default:
3364− dev_err(wcd->dev, "Unknown AIF %d\n",
3365− wcd->rx_port_value[port_id]);
3408+ dev_err(wcd->dev, "Unknown AIF %d\n", mux_idx);
33663409 goto err;
33673410 }
33683411
3412+ wcd->rx_port_value[port_id] = mux_idx;
33693413 snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value[port_id],
33703414 e, update);
33713415
3372− return 0;
3416+ return 1;
33733417 err:
33743418 return -EINVAL;
33753419 }
@@ -3815,6 +3859,7 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kc, · 439 unmodified lines
38153859 struct soc_mixer_control *mixer =
38163860 (struct soc_mixer_control *)kc->private_value;
38173861 int enable = ucontrol->value.integer.value[0];
3862+ struct wcd934x_slim_ch *ch, *c;
38183863 int dai_id = widget->shift;
38193864 int port_id = mixer->shift;
38203865
@@ -3822,17 +3867,32 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kc, · 1 unmodified line
38223867 if (enable == wcd->tx_port_value[port_id])
38233868 return 0;
38243869
3825− wcd->tx_port_value[port_id] = enable;
3826−
3827− if (enable)
3828− list_add_tail(&wcd->tx_chs[port_id].list,
3829− &wcd->dai[dai_id].slim_ch_list);
3830− else
3831− list_del_init(&wcd->tx_chs[port_id].list);
3870+ if (enable) {
3871+ if (list_empty(&wcd->tx_chs[port_id].list)) {
3872+ list_add_tail(&wcd->tx_chs[port_id].list,
3873+ &wcd->dai[dai_id].slim_ch_list);
3874+ } else {
3875+ dev_err(wcd->dev ,"SLIM_TX%d PORT is busy\n", port_id);
3876+ return 0;
3877+ }
3878+ } else {
3879+ bool found = false;
3880+
3881+ list_for_each_entry_safe(ch, c, &wcd->dai[dai_id].slim_ch_list, list) {
3882+ if (ch->port == port_id) {
3883+ found = true;
3884+ list_del_init(&wcd->tx_chs[port_id].list);
3885+ break;
3886+ }
3887+ }
3888+ if (!found)
3889+ return 0;
3890+ }
38323891
3892+ wcd->tx_port_value[port_id] = enable;
38333893 snd_soc_dapm_mixer_update_power(widget->dapm, kc, enable, update);
38343894
3835− return 0;
3895+ return 1;
38363896 }
38373897
38383898 static const struct snd_kcontrol_new aif1_slim_cap_mixer[] = {
sound/soc/codecs/wsa881x.c+12−4
@@ -772,7 +772,8 @@ static int wsa881x_put_pa_gain(struct snd_kcontrol *kc, · 771 unmodified lines
772772
773773 usleep_range(1000, 1010);
774774 }
775− return 0;
775+
776+ return 1;
776777 }
777778
778779 static int wsa881x_get_port(struct snd_kcontrol *kcontrol,
@@ -816,15 +817,22 @@ static int wsa881x_set_port(struct snd_kcontrol *kcontrol, · 37 unmodified lines
816817 (struct soc_mixer_control *)kcontrol->private_value;
817818 int portidx = mixer->reg;
818819
819− if (ucontrol->value.integer.value[0])
820+ if (ucontrol->value.integer.value[0]) {
821+ if (data->port_enable[portidx])
822+ return 0;
823+
820824 data->port_enable[portidx] = true;
821− else
825+ } else {
826+ if (!data->port_enable[portidx])
827+ return 0;
828+
822829 data->port_enable[portidx] = false;
830+ }
823831
824832 if (portidx == WSA881X_PORT_BOOST) /* Boost Switch */
825833 wsa881x_boost_ctrl(comp, data->port_enable[portidx]);
826834
827− return 0;
835+ return 1;
828836 }
829837
830838 static const char * const smart_boost_lvl_text[] = {
sound/soc/qcom/qdsp6/q6routing.c+5−3
@@ -498,14 +498,16 @@ static int msm_routing_put_audio_mixer(struct snd_kcontrol *kcontrol, · 497 unmodified lines
498498 struct session_data *session = &data->sessions[session_id];
499499
500500 if (ucontrol->value.integer.value[0]) {
501+ if (session->port_id == be_id)
502+ return 0;
503+
501504 session->port_id = be_id;
502505 snd_soc_dapm_mixer_update_power(dapm, kcontrol, 1, update);
503506 } else {
504− if (session->port_id == be_id) {
505− session->port_id = -1;
507+ if (session->port_id == -1 || session->port_id != be_id)
506508 return 0;
507− }
508509
510+ session->port_id = -1;
509511 snd_soc_dapm_mixer_update_power(dapm, kcontrol, 0, update);
510512 }
511513
sound/soc/rockchip/rockchip_i2s_tdm.c+31−21
@@ -95,6 +95,7 @@ struct rk_i2s_tdm_dev { · 94 unmodified lines
9595 spinlock_t lock; /* xfer lock */
9696 bool has_playback;
9797 bool has_capture;
98+ struct snd_soc_dai_driver *dai;
9899 };
99100
100101 static int to_ch_num(unsigned int val)
@@ -1310,19 +1311,14 @@ static const struct of_device_id rockchip_i2s_tdm_match[] = { · 1209 unmodified lines
13101311 {},
13111312 };
13121313
1313−static struct snd_soc_dai_driver i2s_tdm_dai = {
1314+static const struct snd_soc_dai_driver i2s_tdm_dai = {
13141315 .probe = rockchip_i2s_tdm_dai_probe,
1315− .playback = {
1316− .stream_name = "Playback",
1317− },
1318− .capture = {
1319− .stream_name = "Capture",
1320− },
13211316 .ops = &rockchip_i2s_tdm_dai_ops,
13221317 };
13231318
1324−static void rockchip_i2s_tdm_init_dai(struct rk_i2s_tdm_dev *i2s_tdm)
1319+static int rockchip_i2s_tdm_init_dai(struct rk_i2s_tdm_dev *i2s_tdm)
13251320 {
1321+ struct snd_soc_dai_driver *dai;
13261322 struct property *dma_names;
13271323 const char *dma_name;
13281324 u64 formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |
@@ -1337,19 +1333,33 @@ static void rockchip_i2s_tdm_init_dai(struct rk_i2s_tdm_dev *i2s_tdm) · 8 unmodified lines
13371333 i2s_tdm->has_capture = true;
13381334 }
13391335
1336+ dai = devm_kmemdup(i2s_tdm->dev, &i2s_tdm_dai,
1337+ sizeof(*dai), GFP_KERNEL);
1338+ if (!dai)
1339+ return -ENOMEM;
1340+
13401341 if (i2s_tdm->has_playback) {
1341− i2s_tdm_dai.playback.channels_min = 2;
1342− i2s_tdm_dai.playback.channels_max = 8;
1343− i2s_tdm_dai.playback.rates = SNDRV_PCM_RATE_8000_192000;
1344− i2s_tdm_dai.playback.formats = formats;
1342+ dai->playback.stream_name = "Playback";
1343+ dai->playback.channels_min = 2;
1344+ dai->playback.channels_max = 8;
1345+ dai->playback.rates = SNDRV_PCM_RATE_8000_192000;
1346+ dai->playback.formats = formats;
13451347 }
13461348
13471349 if (i2s_tdm->has_capture) {
1348− i2s_tdm_dai.capture.channels_min = 2;
1349− i2s_tdm_dai.capture.channels_max = 8;
1350− i2s_tdm_dai.capture.rates = SNDRV_PCM_RATE_8000_192000;
1351− i2s_tdm_dai.capture.formats = formats;
1350+ dai->capture.stream_name = "Capture";
1351+ dai->capture.channels_min = 2;
1352+ dai->capture.channels_max = 8;
1353+ dai->capture.rates = SNDRV_PCM_RATE_8000_192000;
1354+ dai->capture.formats = formats;
13521355 }
1356+
1357+ if (i2s_tdm->clk_trcm != TRCM_TXRX)
1358+ dai->symmetric_rate = 1;
1359+
1360+ i2s_tdm->dai = dai;
1361+
1362+ return 0;
13531363 }
13541364
13551365 static int rockchip_i2s_tdm_path_check(struct rk_i2s_tdm_dev *i2s_tdm,
@@ -1541,8 +1551,6 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) · 185 unmodified lines
15411551 spin_lock_init(&i2s_tdm->lock);
15421552 i2s_tdm->soc_data = (struct rk_i2s_soc_data *)of_id->data;
15431553
1544− rockchip_i2s_tdm_init_dai(i2s_tdm);
1545−
15461554 i2s_tdm->frame_width = 64;
15471555
15481556 i2s_tdm->clk_trcm = TRCM_TXRX;
@@ -1555,8 +1563,10 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) · 6 unmodified lines
15551563 }
15561564 i2s_tdm->clk_trcm = TRCM_RX;
15571565 }
1558− if (i2s_tdm->clk_trcm != TRCM_TXRX)
1559− i2s_tdm_dai.symmetric_rate = 1;
1566+
1567+ ret = rockchip_i2s_tdm_init_dai(i2s_tdm);
1568+ if (ret)
1569+ return ret;
15601570
15611571 i2s_tdm->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf");
15621572 if (IS_ERR(i2s_tdm->grf))
@@ -1678,7 +1688,7 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) · 115 unmodified lines
16781688
16791689 ret = devm_snd_soc_register_component(&pdev->dev,
16801690 &rockchip_i2s_tdm_component,
1681− &i2s_tdm_dai, 1);
1691+ i2s_tdm->dai, 1);
16821692
16831693 if (ret) {
16841694 dev_err(&pdev->dev, "Could not register DAI\n");
sound/soc/sof/intel/hda-codec.c+9−5
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222
2323 #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC)
2424 #define IDISP_VID_INTEL 0x80860000
25+#define CODEC_PROBE_RETRIES 3
2526
2627 /* load the legacy HDA codec driver */
2728 static int request_codec_module(struct hda_codec *codec)
@@ -121,12 +122,15 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, · 93 unmodified lines
121122 u32 hda_cmd = (address << 28) | (AC_NODE_ROOT << 20) |
122123 (AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID;
123124 u32 resp = -1;
124− int ret;
125+ int ret, retry = 0;
126+
127+ do {
128+ mutex_lock(&hbus->core.cmd_mutex);
129+ snd_hdac_bus_send_cmd(&hbus->core, hda_cmd);
130+ snd_hdac_bus_get_response(&hbus->core, address, &resp);
131+ mutex_unlock(&hbus->core.cmd_mutex);
132+ } while (resp == -1 && retry++ < CODEC_PROBE_RETRIES);
125133
126− mutex_lock(&hbus->core.cmd_mutex);
127− snd_hdac_bus_send_cmd(&hbus->core, hda_cmd);
128− snd_hdac_bus_get_response(&hbus->core, address, &resp);
129− mutex_unlock(&hbus->core.cmd_mutex);
130134 if (resp == -1)
131135 return -EIO;
132136 dev_dbg(sdev->dev, "HDA codec #%d probed OK: response: %x\n",
sound/soc/tegra/tegra210_adx.c+2−2
@@ -514,8 +514,8 @@ static int tegra210_adx_platform_remove(struct platform_device *pdev) · 513 unmodified lines
514514 static const struct dev_pm_ops tegra210_adx_pm_ops = {
515515 SET_RUNTIME_PM_OPS(tegra210_adx_runtime_suspend,
516516 tegra210_adx_runtime_resume, NULL)
517− SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
518− pm_runtime_force_resume)
517+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
518+ pm_runtime_force_resume)
519519 };
520520
521521 static struct platform_driver tegra210_adx_driver = {
sound/soc/tegra/tegra210_amx.c+2−2
@@ -583,8 +583,8 @@ static int tegra210_amx_platform_remove(struct platform_device *pdev) · 582 unmodified lines
583583 static const struct dev_pm_ops tegra210_amx_pm_ops = {
584584 SET_RUNTIME_PM_OPS(tegra210_amx_runtime_suspend,
585585 tegra210_amx_runtime_resume, NULL)
586− SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
587− pm_runtime_force_resume)
586+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
587+ pm_runtime_force_resume)
588588 };
589589
590590 static struct platform_driver tegra210_amx_driver = {
sound/soc/tegra/tegra210_mixer.c+2−2
@@ -666,8 +666,8 @@ static int tegra210_mixer_platform_remove(struct platform_device *pdev) · 665 unmodified lines
666666 static const struct dev_pm_ops tegra210_mixer_pm_ops = {
667667 SET_RUNTIME_PM_OPS(tegra210_mixer_runtime_suspend,
668668 tegra210_mixer_runtime_resume, NULL)
669− SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
670− pm_runtime_force_resume)
669+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
670+ pm_runtime_force_resume)
671671 };
672672
673673 static struct platform_driver tegra210_mixer_driver = {
sound/soc/tegra/tegra210_mvc.c+4−4
@@ -164,7 +164,7 @@ static int tegra210_mvc_put_mute(struct snd_kcontrol *kcontrol, · 163 unmodified lines
164164 if (err < 0)
165165 goto end;
166166
167− return 1;
167+ err = 1;
168168
169169 end:
170170 pm_runtime_put(cmpnt->dev);
@@ -236,7 +236,7 @@ static int tegra210_mvc_put_vol(struct snd_kcontrol *kcontrol, · 65 unmodified lines
236236 TEGRA210_MVC_VOLUME_SWITCH_MASK,
237237 TEGRA210_MVC_VOLUME_SWITCH_TRIGGER);
238238
239− return 1;
239+ err = 1;
240240
241241 end:
242242 pm_runtime_put(cmpnt->dev);
@@ -639,8 +639,8 @@ static int tegra210_mvc_platform_remove(struct platform_device *pdev) · 396 unmodified lines
639639 static const struct dev_pm_ops tegra210_mvc_pm_ops = {
640640 SET_RUNTIME_PM_OPS(tegra210_mvc_runtime_suspend,
641641 tegra210_mvc_runtime_resume, NULL)
642− SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
643− pm_runtime_force_resume)
642+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
643+ pm_runtime_force_resume)
644644 };
645645
646646 static struct platform_driver tegra210_mvc_driver = {
sound/soc/tegra/tegra210_sfc.c+2−2
@@ -3594,8 +3594,8 @@ static int tegra210_sfc_platform_remove(struct platform_device *pdev) · 3593 unmodified lines
35943594 static const struct dev_pm_ops tegra210_sfc_pm_ops = {
35953595 SET_RUNTIME_PM_OPS(tegra210_sfc_runtime_suspend,
35963596 tegra210_sfc_runtime_resume, NULL)
3597− SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
3598− pm_runtime_force_resume)
3597+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
3598+ pm_runtime_force_resume)
35993599 };
36003600
36013601 static struct platform_driver tegra210_sfc_driver = {
sound/usb/mixer_quirks.c+5−5
@@ -3016,11 +3016,11 @@ static const struct snd_djm_ctl snd_djm_ctls_750mk2[] = { · 3015 unmodified lines
30163016
30173017
30183018 static const struct snd_djm_device snd_djm_devices[] = {
3019− SND_DJM_DEVICE(250mk2),
3020− SND_DJM_DEVICE(750),
3021− SND_DJM_DEVICE(750mk2),
3022− SND_DJM_DEVICE(850),
3023− SND_DJM_DEVICE(900nxs2)
3019+ [SND_DJM_250MK2_IDX] = SND_DJM_DEVICE(250mk2),
3020+ [SND_DJM_750_IDX] = SND_DJM_DEVICE(750),
3021+ [SND_DJM_850_IDX] = SND_DJM_DEVICE(850),
3022+ [SND_DJM_900NXS2_IDX] = SND_DJM_DEVICE(900nxs2),
3023+ [SND_DJM_750MK2_IDX] = SND_DJM_DEVICE(750mk2),
30243024 };
30253025
30263026
tools/perf/util/event.h+4−1
@@ -44,13 +44,16 @@ struct perf_event_attr; · 43 unmodified lines
4444 /* perf sample has 16 bits size limit */
4545 #define PERF_SAMPLE_MAX_SIZE (1 << 16)
4646
47+/* number of register is bound by the number of bits in regs_dump::mask (64) */
48+#define PERF_SAMPLE_REGS_CACHE_SIZE (8 * sizeof(u64))
49+
4750 struct regs_dump {
4851 u64 abi;
4952 u64 mask;
5053 u64 *regs;
5154
5255 /* Cached values/mask filled by first register access. */
53− u64 cache_regs[PERF_REGS_MAX];
56+ u64 cache_regs[PERF_SAMPLE_REGS_CACHE_SIZE];
5457 u64 cache_mask;
5558 };
5659
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c+55−30
@@ -1205,61 +1205,69 @@ out_no_progress: · 1204 unmodified lines
12051205
12061206 static bool intel_pt_fup_event(struct intel_pt_decoder *decoder)
12071207 {
1208+ enum intel_pt_sample_type type = decoder->state.type;
12081209 bool ret = false;
12091210
1211+ decoder->state.type &= ~INTEL_PT_BRANCH;
1212+
12101213 if (decoder->set_fup_tx_flags) {
12111214 decoder->set_fup_tx_flags = false;
12121215 decoder->tx_flags = decoder->fup_tx_flags;
1213− decoder->state.type = INTEL_PT_TRANSACTION;
1216+ decoder->state.type |= INTEL_PT_TRANSACTION;
12141217 if (decoder->fup_tx_flags & INTEL_PT_ABORT_TX)
12151218 decoder->state.type |= INTEL_PT_BRANCH;
1216− decoder->state.from_ip = decoder->ip;
1217− decoder->state.to_ip = 0;
12181219 decoder->state.flags = decoder->fup_tx_flags;
1219− return true;
1220+ ret = true;
12201221 }
12211222 if (decoder->set_fup_ptw) {
12221223 decoder->set_fup_ptw = false;
1223− decoder->state.type = INTEL_PT_PTW;
1224+ decoder->state.type |= INTEL_PT_PTW;
12241225 decoder->state.flags |= INTEL_PT_FUP_IP;
1225− decoder->state.from_ip = decoder->ip;
1226− decoder->state.to_ip = 0;
12271226 decoder->state.ptw_payload = decoder->fup_ptw_payload;
1228− return true;
1227+ ret = true;
12291228 }
12301229 if (decoder->set_fup_mwait) {
12311230 decoder->set_fup_mwait = false;
1232− decoder->state.type = INTEL_PT_MWAIT_OP;
1233− decoder->state.from_ip = decoder->ip;
1234− decoder->state.to_ip = 0;
1231+ decoder->state.type |= INTEL_PT_MWAIT_OP;
12351232 decoder->state.mwait_payload = decoder->fup_mwait_payload;
12361233 ret = true;
12371234 }
12381235 if (decoder->set_fup_pwre) {
12391236 decoder->set_fup_pwre = false;
12401237 decoder->state.type |= INTEL_PT_PWR_ENTRY;
1241− decoder->state.type &= ~INTEL_PT_BRANCH;
1242− decoder->state.from_ip = decoder->ip;
1243− decoder->state.to_ip = 0;
12441238 decoder->state.pwre_payload = decoder->fup_pwre_payload;
12451239 ret = true;
12461240 }
12471241 if (decoder->set_fup_exstop) {
12481242 decoder->set_fup_exstop = false;
12491243 decoder->state.type |= INTEL_PT_EX_STOP;
1250− decoder->state.type &= ~INTEL_PT_BRANCH;
12511244 decoder->state.flags |= INTEL_PT_FUP_IP;
1252− decoder->state.from_ip = decoder->ip;
1253− decoder->state.to_ip = 0;
12541245 ret = true;
12551246 }
12561247 if (decoder->set_fup_bep) {
12571248 decoder->set_fup_bep = false;
12581249 decoder->state.type |= INTEL_PT_BLK_ITEMS;
1259− decoder->state.type &= ~INTEL_PT_BRANCH;
1250+ ret = true;
1251+ }
1252+ if (decoder->overflow) {
1253+ decoder->overflow = false;
1254+ if (!ret && !decoder->pge) {
1255+ if (decoder->hop) {
1256+ decoder->state.type = 0;
1257+ decoder->pkt_state = INTEL_PT_STATE_RESAMPLE;
1258+ }
1259+ decoder->pge = true;
1260+ decoder->state.type |= INTEL_PT_BRANCH | INTEL_PT_TRACE_BEGIN;
1261+ decoder->state.from_ip = 0;
1262+ decoder->state.to_ip = decoder->ip;
1263+ return true;
1264+ }
1265+ }
1266+ if (ret) {
12601267 decoder->state.from_ip = decoder->ip;
12611268 decoder->state.to_ip = 0;
1262− ret = true;
1269+ } else {
1270+ decoder->state.type = type;
12631271 }
12641272 return ret;
12651273 }
@@ -1608,7 +1616,16 @@ static int intel_pt_overflow(struct intel_pt_decoder *decoder) · 342 unmodified lines
16081616 intel_pt_clear_tx_flags(decoder);
16091617 intel_pt_set_nr(decoder);
16101618 decoder->timestamp_insn_cnt = 0;
1611− decoder->pkt_state = INTEL_PT_STATE_ERR_RESYNC;
1619+ decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
1620+ decoder->state.from_ip = decoder->ip;
1621+ decoder->ip = 0;
1622+ decoder->pge = false;
1623+ decoder->set_fup_tx_flags = false;
1624+ decoder->set_fup_ptw = false;
1625+ decoder->set_fup_mwait = false;
1626+ decoder->set_fup_pwre = false;
1627+ decoder->set_fup_exstop = false;
1628+ decoder->set_fup_bep = false;
16121629 decoder->overflow = true;
16131630 return -EOVERFLOW;
16141631 }
@@ -2666,6 +2683,8 @@ static int intel_pt_scan_for_psb(struct intel_pt_decoder *decoder); · 1051 unmodified lines
26662683 /* Hop mode: Ignore TNT, do not walk code, but get ip from FUPs and TIPs */
26672684 static int intel_pt_hop_trace(struct intel_pt_decoder *decoder, bool *no_tip, int *err)
26682685 {
2686+ *err = 0;
2687+
26692688 /* Leap from PSB to PSB, getting ip from FUP within PSB+ */
26702689 if (decoder->leap && !decoder->in_psb && decoder->packet.type != INTEL_PT_PSB) {
26712690 *err = intel_pt_scan_for_psb(decoder);
@@ -2678,6 +2697,7 @@ static int intel_pt_hop_trace(struct intel_pt_decoder *decoder, bool *no_tip, in · 6 unmodified lines
26782697 return HOP_IGNORE;
26792698
26802699 case INTEL_PT_TIP_PGD:
2700+ decoder->pge = false;
26812701 if (!decoder->packet.count) {
26822702 intel_pt_set_nr(decoder);
26832703 return HOP_IGNORE;
@@ -2705,18 +2725,21 @@ static int intel_pt_hop_trace(struct intel_pt_decoder *decoder, bool *no_tip, in · 21 unmodified lines
27052725 if (!decoder->packet.count)
27062726 return HOP_IGNORE;
27072727 intel_pt_set_ip(decoder);
2708− if (intel_pt_fup_event(decoder))
2709− return HOP_RETURN;
2710− if (!decoder->branch_enable)
2728+ if (decoder->set_fup_mwait || decoder->set_fup_pwre)
2729+ *no_tip = true;
2730+ if (!decoder->branch_enable || !decoder->pge)
27112731 *no_tip = true;
27122732 if (*no_tip) {
27132733 decoder->state.type = INTEL_PT_INSTRUCTION;
27142734 decoder->state.from_ip = decoder->ip;
27152735 decoder->state.to_ip = 0;
2736+ intel_pt_fup_event(decoder);
27162737 return HOP_RETURN;
27172738 }
2739+ intel_pt_fup_event(decoder);
2740+ decoder->state.type |= INTEL_PT_INSTRUCTION | INTEL_PT_BRANCH;
27182741 *err = intel_pt_walk_fup_tip(decoder);
2719− if (!*err)
2742+ if (!*err && decoder->state.to_ip)
27202743 decoder->pkt_state = INTEL_PT_STATE_RESAMPLE;
27212744 return HOP_RETURN;
27222745
@@ -2897,7 +2920,7 @@ static bool intel_pt_psb_with_fup(struct intel_pt_decoder *decoder, int *err) · 174 unmodified lines
28972920 {
28982921 struct intel_pt_psb_info data = { .fup = false };
28992922
2900− if (!decoder->branch_enable || !decoder->pge)
2923+ if (!decoder->branch_enable)
29012924 return false;
29022925
29032926 intel_pt_pkt_lookahead(decoder, intel_pt_psb_lookahead_cb, &data);
@@ -2924,6 +2947,7 @@ static int intel_pt_walk_trace(struct intel_pt_decoder *decoder) · 20 unmodified lines
29242947 if (err)
29252948 return err;
29262949 next:
2950+ err = 0;
29272951 if (decoder->cyc_threshold) {
29282952 if (decoder->sample_cyc && last_packet_type != INTEL_PT_CYC)
29292953 decoder->sample_cyc = false;
@@ -2962,6 +2986,7 @@ next: · 32 unmodified lines
29622986
29632987 case INTEL_PT_TIP_PGE: {
29642988 decoder->pge = true;
2989+ decoder->overflow = false;
29652990 intel_pt_mtc_cyc_cnt_pge(decoder);
29662991 intel_pt_set_nr(decoder);
29672992 if (decoder->packet.count == 0) {
@@ -2999,7 +3024,7 @@ next: · 31 unmodified lines
29993024 break;
30003025 }
30013026 intel_pt_set_last_ip(decoder);
3002− if (!decoder->branch_enable) {
3027+ if (!decoder->branch_enable || !decoder->pge) {
30033028 decoder->ip = decoder->last_ip;
30043029 if (intel_pt_fup_event(decoder))
30053030 return 0;
@@ -3467,10 +3492,10 @@ static int intel_pt_sync_ip(struct intel_pt_decoder *decoder) · 461 unmodified lines
34673492 decoder->set_fup_pwre = false;
34683493 decoder->set_fup_exstop = false;
34693494 decoder->set_fup_bep = false;
3495+ decoder->overflow = false;
34703496
34713497 if (!decoder->branch_enable) {
34723498 decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
3473− decoder->overflow = false;
34743499 decoder->state.type = 0; /* Do not have a sample */
34753500 return 0;
34763501 }
@@ -3485,7 +3510,6 @@ static int intel_pt_sync_ip(struct intel_pt_decoder *decoder) · 8 unmodified lines
34853510 decoder->pkt_state = INTEL_PT_STATE_RESAMPLE;
34863511 else
34873512 decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
3488− decoder->overflow = false;
34893513
34903514 decoder->state.from_ip = 0;
34913515 decoder->state.to_ip = decoder->ip;
@@ -3607,7 +3631,7 @@ static int intel_pt_sync(struct intel_pt_decoder *decoder) · 115 unmodified lines
36073631 }
36083632
36093633 decoder->have_last_ip = true;
3610− decoder->pkt_state = INTEL_PT_STATE_NO_IP;
3634+ decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
36113635
36123636 err = intel_pt_walk_psb(decoder);
36133637 if (err)
@@ -3704,7 +3728,8 @@ const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder) · 90 unmodified lines
37043728
37053729 if (err) {
37063730 decoder->state.err = intel_pt_ext_err(err);
3707− decoder->state.from_ip = decoder->ip;
3731+ if (err != -EOVERFLOW)
3732+ decoder->state.from_ip = decoder->ip;
37083733 intel_pt_update_sample_time(decoder);
37093734 decoder->sample_tot_cyc_cnt = decoder->tot_cyc_cnt;
37103735 intel_pt_set_nr(decoder);
tools/perf/util/intel-pt.c+1−0
@@ -2565,6 +2565,7 @@ static int intel_pt_run_decoder(struct intel_pt_queue *ptq, u64 *timestamp) · 2564 unmodified lines
25652565 ptq->sync_switch = false;
25662566 intel_pt_next_tid(pt, ptq);
25672567 }
2568+ ptq->timestamp = state->est_timestamp;
25682569 if (pt->synth_opts.errors) {
25692570 err = intel_ptq_synth_error(ptq, state);
25702571 if (err)
tools/perf/util/perf_regs.c+3−0
@@ -25,6 +25,9 @@ int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) · 24 unmodified lines
2525 int i, idx = 0;
2626 u64 mask = regs->mask;
2727
28+ if ((u64)id >= PERF_SAMPLE_REGS_CACHE_SIZE)
29+ return -EINVAL;
30+
2831 if (regs->cache_mask & (1ULL << id))
2932 goto out;
3033
tools/perf/util/python.c+1−1
@@ -461,7 +461,7 @@ get_tracepoint_field(struct pyrf_event *pevent, PyObject *attr_name) · 460 unmodified lines
461461 struct tep_event *tp_format;
462462
463463 tp_format = trace_event__tp_format_id(evsel->core.attr.config);
464− if (!tp_format)
464+ if (IS_ERR_OR_NULL(tp_format))
465465 return NULL;
466466
467467 evsel->tp_format = tp_format;
tools/power/acpi/Makefile.config+1−0
@@ -69,6 +69,7 @@ KERNEL_INCLUDE := $(OUTPUT)include · 68 unmodified lines
6969 ACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica
7070 CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
7171 CFLAGS += $(WARNINGS)
72+MKDIR = mkdir
7273
7374 ifeq ($(strip $(V)),false)
7475 QUIET=@
tools/power/acpi/Makefile.rules+1−0
@@ -21,6 +21,7 @@ $(KERNEL_INCLUDE): · 20 unmodified lines
2121
2222 $(objdir)%.o: %.c $(KERNEL_INCLUDE)
2323 $(ECHO) " CC " $(subst $(OUTPUT),,$@)
24+ $(QUIET) $(MKDIR) -p $(objdir) 2>/dev/null
2425 $(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
2526
2627 all: $(OUTPUT)$(TOOL)
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c+20−0
@@ -33,6 +33,22 @@ noinline int bpf_testmod_loop_test(int n) · 32 unmodified lines
3333 return sum;
3434 }
3535
36+__weak noinline struct file *bpf_testmod_return_ptr(int arg)
37+{
38+ static struct file f = {};
39+
40+ switch (arg) {
41+ case 1: return (void *)EINVAL; /* user addr */
42+ case 2: return (void *)0xcafe4a11; /* user addr */
43+ case 3: return (void *)-EINVAL; /* canonical, but invalid */
44+ case 4: return (void *)(1ull << 60); /* non-canonical and invalid */
45+ case 5: return (void *)~(1ull << 30); /* trigger extable */
46+ case 6: return &f; /* valid addr */
47+ case 7: return (void *)((long)&f | 1); /* kernel tricks */
48+ default: return NULL;
49+ }
50+}
51+
3652 noinline ssize_t
3753 bpf_testmod_test_read(struct file *file, struct kobject *kobj,
3854 struct bin_attribute *bin_attr,
@@ -43,6 +59,10 @@ bpf_testmod_test_read(struct file *file, struct kobject *kobj, · 4 unmodified lines
4359 .off = off,
4460 .len = len,
4561 };
62+ int i = 1;
63+
64+ while (bpf_testmod_return_ptr(i))
65+ i++;
4666
4767 /* This is always true. Use the check to make sure the compiler
4868 * doesn't remove bpf_testmod_loop_test.
tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c+14−2
@@ -90,7 +90,7 @@ static void print_err_line(void) · 89 unmodified lines
9090
9191 static void test_conn(void)
9292 {
93− int listen_fd = -1, cli_fd = -1, err;
93+ int listen_fd = -1, cli_fd = -1, srv_fd = -1, err;
9494 socklen_t addrlen = sizeof(srv_sa6);
9595 int srv_port;
9696
@@ -112,6 +112,10 @@ static void test_conn(void) · 15 unmodified lines
112112 if (CHECK_FAIL(cli_fd == -1))
113113 goto done;
114114
115+ srv_fd = accept(listen_fd, NULL, NULL);
116+ if (CHECK_FAIL(srv_fd == -1))
117+ goto done;
118+
115119 if (CHECK(skel->bss->listen_tp_sport != srv_port ||
116120 skel->bss->req_sk_sport != srv_port,
117121 "Unexpected sk src port",
@@ -134,11 +138,13 @@ done: · 16 unmodified lines
134138 close(listen_fd);
135139 if (cli_fd != -1)
136140 close(cli_fd);
141+ if (srv_fd != -1)
142+ close(srv_fd);
137143 }
138144
139145 static void test_syncookie(void)
140146 {
141− int listen_fd = -1, cli_fd = -1, err;
147+ int listen_fd = -1, cli_fd = -1, srv_fd = -1, err;
142148 socklen_t addrlen = sizeof(srv_sa6);
143149 int srv_port;
144150
@@ -161,6 +167,10 @@ static void test_syncookie(void) · 16 unmodified lines
161167 if (CHECK_FAIL(cli_fd == -1))
162168 goto done;
163169
170+ srv_fd = accept(listen_fd, NULL, NULL);
171+ if (CHECK_FAIL(srv_fd == -1))
172+ goto done;
173+
164174 if (CHECK(skel->bss->listen_tp_sport != srv_port,
165175 "Unexpected tp src port",
166176 "listen_tp_sport:%u expected:%u\n",
@@ -188,6 +198,8 @@ done: · 21 unmodified lines
188198 close(listen_fd);
189199 if (cli_fd != -1)
190200 close(cli_fd);
201+ if (srv_fd != -1)
202+ close(srv_fd);
191203 }
192204
193205 struct test {
tools/testing/selftests/bpf/progs/test_module_attach.c+12−0
@@ -87,6 +87,18 @@ int BPF_PROG(handle_fexit, · 86 unmodified lines
8787 return 0;
8888 }
8989
90+SEC("fexit/bpf_testmod_return_ptr")
91+int BPF_PROG(handle_fexit_ret, int arg, struct file *ret)
92+{
93+ long buf = 0;
94+
95+ bpf_probe_read_kernel(&buf, 8, ret);
96+ bpf_probe_read_kernel(&buf, 8, (char *)ret + 256);
97+ *(volatile long long *)ret;
98+ *(volatile int *)&ret->f_mode;
99+ return 0;
100+}
101+
90102 __u32 fmod_ret_read_sz = 0;
91103
92104 SEC("fmod_ret/bpf_testmod_test_read")
tools/testing/selftests/bpf/test_verifier.c+1−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
5454 #define MAX_INSNS BPF_MAXINSNS
5555 #define MAX_TEST_INSNS 1000000
5656 #define MAX_FIXUPS 8
57−#define MAX_NR_MAPS 21
57+#define MAX_NR_MAPS 22
5858 #define MAX_TEST_RUNS 8
5959 #define POINTER_VALUE 0xcafe4all
6060 #define TEST_DATA_LEN 64
tools/testing/selftests/bpf/verifier/atomic_cmpxchg.c+86−0
@@ -138,6 +138,8 @@ · 137 unmodified lines
138138 BPF_EXIT_INSN(),
139139 },
140140 .result = ACCEPT,
141+ .result_unpriv = REJECT,
142+ .errstr_unpriv = "R0 leaks addr into mem",
141143 },
142144 {
143145 "Dest pointer in r0 - succeed",
@@ -156,4 +158,88 @@ · 12 unmodified lines
156158 BPF_EXIT_INSN(),
157159 },
158160 .result = ACCEPT,
161+ .result_unpriv = REJECT,
162+ .errstr_unpriv = "R0 leaks addr into mem",
163+},
164+{
165+ "Dest pointer in r0 - succeed, check 2",
166+ .insns = {
167+ /* r0 = &val */
168+ BPF_MOV64_REG(BPF_REG_0, BPF_REG_10),
169+ /* val = r0; */
170+ BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_0, -8),
171+ /* r5 = &val */
172+ BPF_MOV64_REG(BPF_REG_5, BPF_REG_10),
173+ /* r0 = atomic_cmpxchg(&val, r0, r5); */
174+ BPF_ATOMIC_OP(BPF_DW, BPF_CMPXCHG, BPF_REG_10, BPF_REG_5, -8),
175+ /* r1 = *r0 */
176+ BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_0, -8),
177+ /* exit(0); */
178+ BPF_MOV64_IMM(BPF_REG_0, 0),
179+ BPF_EXIT_INSN(),
180+ },
181+ .result = ACCEPT,
182+ .result_unpriv = REJECT,
183+ .errstr_unpriv = "R0 leaks addr into mem",
184+},
185+{
186+ "Dest pointer in r0 - succeed, check 3",
187+ .insns = {
188+ /* r0 = &val */
189+ BPF_MOV64_REG(BPF_REG_0, BPF_REG_10),
190+ /* val = r0; */
191+ BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_0, -8),
192+ /* r5 = &val */
193+ BPF_MOV64_REG(BPF_REG_5, BPF_REG_10),
194+ /* r0 = atomic_cmpxchg(&val, r0, r5); */
195+ BPF_ATOMIC_OP(BPF_W, BPF_CMPXCHG, BPF_REG_10, BPF_REG_5, -8),
196+ /* exit(0); */
197+ BPF_MOV64_IMM(BPF_REG_0, 0),
198+ BPF_EXIT_INSN(),
199+ },
200+ .result = REJECT,
201+ .errstr = "invalid size of register fill",
202+ .errstr_unpriv = "R0 leaks addr into mem",
203+},
204+{
205+ "Dest pointer in r0 - succeed, check 4",
206+ .insns = {
207+ /* r0 = &val */
208+ BPF_MOV32_REG(BPF_REG_0, BPF_REG_10),
209+ /* val = r0; */
210+ BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_0, -8),
211+ /* r5 = &val */
212+ BPF_MOV32_REG(BPF_REG_5, BPF_REG_10),
213+ /* r0 = atomic_cmpxchg(&val, r0, r5); */
214+ BPF_ATOMIC_OP(BPF_W, BPF_CMPXCHG, BPF_REG_10, BPF_REG_5, -8),
215+ /* r1 = *r10 */
216+ BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_10, -8),
217+ /* exit(0); */
218+ BPF_MOV64_IMM(BPF_REG_0, 0),
219+ BPF_EXIT_INSN(),
220+ },
221+ .result = ACCEPT,
222+ .result_unpriv = REJECT,
223+ .errstr_unpriv = "R10 partial copy of pointer",
224+},
225+{
226+ "Dest pointer in r0 - succeed, check 5",
227+ .insns = {
228+ /* r0 = &val */
229+ BPF_MOV32_REG(BPF_REG_0, BPF_REG_10),
230+ /* val = r0; */
231+ BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_0, -8),
232+ /* r5 = &val */
233+ BPF_MOV32_REG(BPF_REG_5, BPF_REG_10),
234+ /* r0 = atomic_cmpxchg(&val, r0, r5); */
235+ BPF_ATOMIC_OP(BPF_W, BPF_CMPXCHG, BPF_REG_10, BPF_REG_5, -8),
236+ /* r1 = *r0 */
237+ BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_0, -8),
238+ /* exit(0); */
239+ BPF_MOV64_IMM(BPF_REG_0, 0),
240+ BPF_EXIT_INSN(),
241+ },
242+ .result = REJECT,
243+ .errstr = "R0 invalid mem access",
244+ .errstr_unpriv = "R10 partial copy of pointer",
159245 },
tools/testing/selftests/bpf/verifier/atomic_fetch.c+94−0
@@ -1,3 +1,97 @@
1+{
2+ "atomic dw/fetch and address leakage of (map ptr & -1) via stack slot",
3+ .insns = {
4+ BPF_LD_IMM64(BPF_REG_1, -1),
5+ BPF_LD_MAP_FD(BPF_REG_8, 0),
6+ BPF_LD_MAP_FD(BPF_REG_9, 0),
7+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
8+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
9+ BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_9, 0),
10+ BPF_ATOMIC_OP(BPF_DW, BPF_AND | BPF_FETCH, BPF_REG_2, BPF_REG_1, 0),
11+ BPF_LDX_MEM(BPF_DW, BPF_REG_9, BPF_REG_2, 0),
12+ BPF_ST_MEM(BPF_DW, BPF_REG_2, 0, 0),
13+ BPF_MOV64_REG(BPF_REG_1, BPF_REG_8),
14+ BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
15+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1),
16+ BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_9, 0),
17+ BPF_MOV64_IMM(BPF_REG_0, 0),
18+ BPF_EXIT_INSN(),
19+ },
20+ .fixup_map_array_48b = { 2, 4 },
21+ .result = ACCEPT,
22+ .result_unpriv = REJECT,
23+ .errstr_unpriv = "leaking pointer from stack off -8",
24+},
25+{
26+ "atomic dw/fetch and address leakage of (map ptr & -1) via returned value",
27+ .insns = {
28+ BPF_LD_IMM64(BPF_REG_1, -1),
29+ BPF_LD_MAP_FD(BPF_REG_8, 0),
30+ BPF_LD_MAP_FD(BPF_REG_9, 0),
31+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
32+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
33+ BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_9, 0),
34+ BPF_ATOMIC_OP(BPF_DW, BPF_AND | BPF_FETCH, BPF_REG_2, BPF_REG_1, 0),
35+ BPF_MOV64_REG(BPF_REG_9, BPF_REG_1),
36+ BPF_ST_MEM(BPF_DW, BPF_REG_2, 0, 0),
37+ BPF_MOV64_REG(BPF_REG_1, BPF_REG_8),
38+ BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
39+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1),
40+ BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_9, 0),
41+ BPF_MOV64_IMM(BPF_REG_0, 0),
42+ BPF_EXIT_INSN(),
43+ },
44+ .fixup_map_array_48b = { 2, 4 },
45+ .result = ACCEPT,
46+ .result_unpriv = REJECT,
47+ .errstr_unpriv = "leaking pointer from stack off -8",
48+},
49+{
50+ "atomic w/fetch and address leakage of (map ptr & -1) via stack slot",
51+ .insns = {
52+ BPF_LD_IMM64(BPF_REG_1, -1),
53+ BPF_LD_MAP_FD(BPF_REG_8, 0),
54+ BPF_LD_MAP_FD(BPF_REG_9, 0),
55+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
56+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
57+ BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_9, 0),
58+ BPF_ATOMIC_OP(BPF_W, BPF_AND | BPF_FETCH, BPF_REG_2, BPF_REG_1, 0),
59+ BPF_LDX_MEM(BPF_DW, BPF_REG_9, BPF_REG_2, 0),
60+ BPF_ST_MEM(BPF_DW, BPF_REG_2, 0, 0),
61+ BPF_MOV64_REG(BPF_REG_1, BPF_REG_8),
62+ BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
63+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1),
64+ BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_9, 0),
65+ BPF_MOV64_IMM(BPF_REG_0, 0),
66+ BPF_EXIT_INSN(),
67+ },
68+ .fixup_map_array_48b = { 2, 4 },
69+ .result = REJECT,
70+ .errstr = "invalid size of register fill",
71+},
72+{
73+ "atomic w/fetch and address leakage of (map ptr & -1) via returned value",
74+ .insns = {
75+ BPF_LD_IMM64(BPF_REG_1, -1),
76+ BPF_LD_MAP_FD(BPF_REG_8, 0),
77+ BPF_LD_MAP_FD(BPF_REG_9, 0),
78+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
79+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
80+ BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_9, 0),
81+ BPF_ATOMIC_OP(BPF_W, BPF_AND | BPF_FETCH, BPF_REG_2, BPF_REG_1, 0),
82+ BPF_MOV64_REG(BPF_REG_9, BPF_REG_1),
83+ BPF_ST_MEM(BPF_DW, BPF_REG_2, 0, 0),
84+ BPF_MOV64_REG(BPF_REG_1, BPF_REG_8),
85+ BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
86+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1),
87+ BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_9, 0),
88+ BPF_MOV64_IMM(BPF_REG_0, 0),
89+ BPF_EXIT_INSN(),
90+ },
91+ .fixup_map_array_48b = { 2, 4 },
92+ .result = REJECT,
93+ .errstr = "invalid size of register fill",
94+},
195 #define __ATOMIC_FETCH_OP_TEST(src_reg, dst_reg, operand1, op, operand2, expect) \
296 { \
397 "atomic fetch " #op ", src=" #dst_reg " dst=" #dst_reg, \
tools/testing/selftests/bpf/verifier/search_pruning.c+71−0
@@ -132,6 +132,77 @@ · 131 unmodified lines
132132 .result = REJECT,
133133 .prog_type = BPF_PROG_TYPE_TRACEPOINT,
134134 },
135+{
136+ "precision tracking for u32 spill/fill",
137+ .insns = {
138+ BPF_MOV64_REG(BPF_REG_7, BPF_REG_1),
139+ BPF_EMIT_CALL(BPF_FUNC_get_prandom_u32),
140+ BPF_MOV32_IMM(BPF_REG_6, 32),
141+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1),
142+ BPF_MOV32_IMM(BPF_REG_6, 4),
143+ /* Additional insns to introduce a pruning point. */
144+ BPF_EMIT_CALL(BPF_FUNC_get_prandom_u32),
145+ BPF_MOV64_IMM(BPF_REG_3, 0),
146+ BPF_MOV64_IMM(BPF_REG_3, 0),
147+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1),
148+ BPF_MOV64_IMM(BPF_REG_3, 0),
149+ /* u32 spill/fill */
150+ BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_6, -8),
151+ BPF_LDX_MEM(BPF_W, BPF_REG_8, BPF_REG_10, -8),
152+ /* out-of-bound map value access for r6=32 */
153+ BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, 0),
154+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
155+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -16),
156+ BPF_LD_MAP_FD(BPF_REG_1, 0),
157+ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
158+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 2),
159+ BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_8),
160+ BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_0, 0),
161+ BPF_MOV64_IMM(BPF_REG_0, 0),
162+ BPF_EXIT_INSN(),
163+ },
164+ .fixup_map_hash_8b = { 15 },
165+ .result = REJECT,
166+ .errstr = "R0 min value is outside of the allowed memory range",
167+ .prog_type = BPF_PROG_TYPE_TRACEPOINT,
168+},
169+{
170+ "precision tracking for u32 spills, u64 fill",
171+ .insns = {
172+ BPF_EMIT_CALL(BPF_FUNC_get_prandom_u32),
173+ BPF_MOV64_REG(BPF_REG_6, BPF_REG_0),
174+ BPF_MOV32_IMM(BPF_REG_7, 0xffffffff),
175+ /* Additional insns to introduce a pruning point. */
176+ BPF_MOV64_IMM(BPF_REG_3, 1),
177+ BPF_MOV64_IMM(BPF_REG_3, 1),
178+ BPF_MOV64_IMM(BPF_REG_3, 1),
179+ BPF_MOV64_IMM(BPF_REG_3, 1),
180+ BPF_EMIT_CALL(BPF_FUNC_get_prandom_u32),
181+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1),
182+ BPF_MOV64_IMM(BPF_REG_3, 1),
183+ BPF_ALU32_IMM(BPF_DIV, BPF_REG_3, 0),
184+ /* u32 spills, u64 fill */
185+ BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_6, -4),
186+ BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_7, -8),
187+ BPF_LDX_MEM(BPF_DW, BPF_REG_8, BPF_REG_10, -8),
188+ /* if r8 != X goto pc+1 r8 known in fallthrough branch */
189+ BPF_JMP_IMM(BPF_JNE, BPF_REG_8, 0xffffffff, 1),
190+ BPF_MOV64_IMM(BPF_REG_3, 1),
191+ /* if r8 == X goto pc+1 condition always true on first
192+ * traversal, so starts backtracking to mark r8 as requiring
193+ * precision. r7 marked as needing precision. r6 not marked
194+ * since it's not tracked.
195+ */
196+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_8, 0xffffffff, 1),
197+ /* fails if r8 correctly marked unknown after fill. */
198+ BPF_ALU32_IMM(BPF_DIV, BPF_REG_3, 0),
199+ BPF_MOV64_IMM(BPF_REG_0, 0),
200+ BPF_EXIT_INSN(),
201+ },
202+ .result = REJECT,
203+ .errstr = "div by zero",
204+ .prog_type = BPF_PROG_TYPE_TRACEPOINT,
205+},
135206 {
136207 "allocated_stack",
137208 .insns = {
tools/testing/selftests/bpf/verifier/spill_fill.c+32−0
@@ -175,6 +175,38 @@ · 174 unmodified lines
175175 .errstr = "invalid access to packet",
176176 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
177177 },
178+{
179+ "Spill u32 const scalars. Refill as u64. Offset to skb->data",
180+ .insns = {
181+ BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
182+ offsetof(struct __sk_buff, data)),
183+ BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1,
184+ offsetof(struct __sk_buff, data_end)),
185+ /* r6 = 0 */
186+ BPF_MOV32_IMM(BPF_REG_6, 0),
187+ /* r7 = 20 */
188+ BPF_MOV32_IMM(BPF_REG_7, 20),
189+ /* *(u32 *)(r10 -4) = r6 */
190+ BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_6, -4),
191+ /* *(u32 *)(r10 -8) = r7 */
192+ BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_7, -8),
193+ /* r4 = *(u64 *)(r10 -8) */
194+ BPF_LDX_MEM(BPF_H, BPF_REG_4, BPF_REG_10, -8),
195+ /* r0 = r2 */
196+ BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
197+ /* r0 += r4 R0=pkt R2=pkt R3=pkt_end R4=inv,umax=65535 */
198+ BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_4),
199+ /* if (r0 > r3) R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=inv,umax=65535 */
200+ BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1),
201+ /* r0 = *(u32 *)r2 R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=inv20 */
202+ BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_2, 0),
203+ BPF_MOV64_IMM(BPF_REG_0, 0),
204+ BPF_EXIT_INSN(),
205+ },
206+ .result = REJECT,
207+ .errstr = "invalid access to packet",
208+ .prog_type = BPF_PROG_TYPE_SCHED_CLS,
209+},
178210 {
179211 "Spill a u32 const scalar. Refill as u16 from fp-6. Offset to skb->data",
180212 .insns = {
tools/testing/selftests/bpf/verifier/value_ptr_arith.c+23−0
@@ -1077,6 +1077,29 @@ · 1076 unmodified lines
10771077 .errstr = "R0 invalid mem access 'inv'",
10781078 .errstr_unpriv = "R0 pointer -= pointer prohibited",
10791079 },
1080+{
1081+ "map access: trying to leak tained dst reg",
1082+ .insns = {
1083+ BPF_MOV64_IMM(BPF_REG_0, 0),
1084+ BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
1085+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
1086+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
1087+ BPF_LD_MAP_FD(BPF_REG_1, 0),
1088+ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
1089+ BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1),
1090+ BPF_EXIT_INSN(),
1091+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_0),
1092+ BPF_MOV32_IMM(BPF_REG_1, 0xFFFFFFFF),
1093+ BPF_MOV32_REG(BPF_REG_1, BPF_REG_1),
1094+ BPF_ALU64_REG(BPF_SUB, BPF_REG_2, BPF_REG_1),
1095+ BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_2, 0),
1096+ BPF_MOV64_IMM(BPF_REG_0, 0),
1097+ BPF_EXIT_INSN(),
1098+ },
1099+ .fixup_map_array_48b = { 4 },
1100+ .result = REJECT,
1101+ .errstr = "math between map_value pointer and 4294967295 is not allowed",
1102+},
10801103 {
10811104 "32bit pkt_ptr -= scalar",
10821105 .insns = {
tools/testing/selftests/damon/.gitignore+2−0
@@ -0,0 +1,2 @@
1+# SPDX-License-Identifier: GPL-2.0-only
2+huge_count_read_write
tools/testing/selftests/damon/Makefile+5−2
@@ -1,7 +1,10 @@
11 # SPDX-License-Identifier: GPL-2.0
22 # Makefile for damon selftests
33
4−TEST_FILES = _chk_dependency.sh
5−TEST_PROGS = debugfs_attrs.sh
4+TEST_GEN_FILES += huge_count_read_write
5+
6+TEST_FILES = _chk_dependency.sh _debugfs_common.sh
7+TEST_PROGS = debugfs_attrs.sh debugfs_schemes.sh debugfs_target_ids.sh
8+TEST_PROGS += debugfs_empty_targets.sh debugfs_huge_count_read_write.sh
69
710 include ../lib.mk
tools/testing/selftests/damon/_debugfs_common.sh+52−0
@@ -0,0 +1,52 @@
1+#!/bin/bash
2+# SPDX-License-Identifier: GPL-2.0
3+
4+test_write_result() {
5+ file=$1
6+ content=$2
7+ orig_content=$3
8+ expect_reason=$4
9+ expected=$5
10+
11+ echo "$content" > "$file"
12+ if [ $? -ne "$expected" ]
13+ then
14+ echo "writing $content to $file doesn't return $expected"
15+ echo "expected because: $expect_reason"
16+ echo "$orig_content" > "$file"
17+ exit 1
18+ fi
19+}
20+
21+test_write_succ() {
22+ test_write_result "$1" "$2" "$3" "$4" 0
23+}
24+
25+test_write_fail() {
26+ test_write_result "$1" "$2" "$3" "$4" 1
27+}
28+
29+test_content() {
30+ file=$1
31+ orig_content=$2
32+ expected=$3
33+ expect_reason=$4
34+
35+ content=$(cat "$file")
36+ if [ "$content" != "$expected" ]
37+ then
38+ echo "reading $file expected $expected but $content"
39+ echo "expected because: $expect_reason"
40+ echo "$orig_content" > "$file"
41+ exit 1
42+ fi
43+}
44+
45+source ./_chk_dependency.sh
46+
47+damon_onoff="$DBGFS/monitor_on"
48+if [ $(cat "$damon_onoff") = "on" ]
49+then
50+ echo "monitoring is on"
51+ exit $ksft_skip
52+fi
tools/testing/selftests/damon/debugfs_attrs.sh+1−72
@@ -1,48 +1,7 @@
11 #!/bin/bash
22 # SPDX-License-Identifier: GPL-2.0
33
4−test_write_result() {
5− file=$1
6− content=$2
7− orig_content=$3
8− expect_reason=$4
9− expected=$5
10−
11− echo "$content" > "$file"
12− if [ $? -ne "$expected" ]
13− then
14− echo "writing $content to $file doesn't return $expected"
15− echo "expected because: $expect_reason"
16− echo "$orig_content" > "$file"
17− exit 1
18− fi
19−}
20−
21−test_write_succ() {
22− test_write_result "$1" "$2" "$3" "$4" 0
23−}
24−
25−test_write_fail() {
26− test_write_result "$1" "$2" "$3" "$4" 1
27−}
28−
29−test_content() {
30− file=$1
31− orig_content=$2
32− expected=$3
33− expect_reason=$4
34−
35− content=$(cat "$file")
36− if [ "$content" != "$expected" ]
37− then
38− echo "reading $file expected $expected but $content"
39− echo "expected because: $expect_reason"
40− echo "$orig_content" > "$file"
41− exit 1
42− fi
43−}
44−
45−source ./_chk_dependency.sh
4+source _debugfs_common.sh
465
476 # Test attrs file
487 # ===============
@@ -56,33 +15,3 @@ test_write_fail "$file" "1 2 3 5 4" "$orig_content" \ · 7 unmodified lines
5615 "min_nr_regions > max_nr_regions"
5716 test_content "$file" "$orig_content" "1 2 3 4 5" "successfully written"
5817 echo "$orig_content" > "$file"
59−
60−# Test schemes file
61−# =================
62−
63−file="$DBGFS/schemes"
64−orig_content=$(cat "$file")
65−
66−test_write_succ "$file" "1 2 3 4 5 6 4 0 0 0 1 2 3 1 100 3 2 1" \
67− "$orig_content" "valid input"
68−test_write_fail "$file" "1 2
69−3 4 5 6 3 0 0 0 1 2 3 1 100 3 2 1" "$orig_content" "multi lines"
70−test_write_succ "$file" "" "$orig_content" "disabling"
71−echo "$orig_content" > "$file"
72−
73−# Test target_ids file
74−# ====================
75−
76−file="$DBGFS/target_ids"
77−orig_content=$(cat "$file")
78−
79−test_write_succ "$file" "1 2 3 4" "$orig_content" "valid input"
80−test_write_succ "$file" "1 2 abc 4" "$orig_content" "still valid input"
81−test_content "$file" "$orig_content" "1 2" "non-integer was there"
82−test_write_succ "$file" "abc 2 3" "$orig_content" "the file allows wrong input"
83−test_content "$file" "$orig_content" "" "wrong input written"
84−test_write_succ "$file" "" "$orig_content" "empty input"
85−test_content "$file" "$orig_content" "" "empty input written"
86−echo "$orig_content" > "$file"
87−
88−echo "PASS"
tools/testing/selftests/damon/debugfs_empty_targets.sh+13−0
@@ -0,0 +1,13 @@
1+#!/bin/bash
2+# SPDX-License-Identifier: GPL-2.0
3+
4+source _debugfs_common.sh
5+
6+# Test empty targets case
7+# =======================
8+
9+orig_target_ids=$(cat "$DBGFS/target_ids")
10+echo "" > "$DBGFS/target_ids"
11+orig_monitor_on=$(cat "$DBGFS/monitor_on")
12+test_write_fail "$DBGFS/monitor_on" "on" "orig_monitor_on" "empty target ids"
13+echo "$orig_target_ids" > "$DBGFS/target_ids"
tools/testing/selftests/damon/debugfs_huge_count_read_write.sh+22−0
@@ -0,0 +1,22 @@
1+#!/bin/bash
2+# SPDX-License-Identifier: GPL-2.0
3+
4+source _debugfs_common.sh
5+
6+# Test huge count read write
7+# ==========================
8+
9+dmesg -C
10+
11+for file in "$DBGFS/"*
12+do
13+ ./huge_count_read_write "$file"
14+done
15+
16+if dmesg | grep -q WARNING
17+then
18+ dmesg
19+ exit 1
20+else
21+ exit 0
22+fi
tools/testing/selftests/damon/debugfs_schemes.sh+19−0
@@ -0,0 +1,19 @@
1+#!/bin/bash
2+# SPDX-License-Identifier: GPL-2.0
3+
4+source _debugfs_common.sh
5+
6+# Test schemes file
7+# =================
8+
9+file="$DBGFS/schemes"
10+orig_content=$(cat "$file")
11+
12+test_write_succ "$file" "1 2 3 4 5 6 4 0 0 0 1 2 3 1 100 3 2 1" \
13+ "$orig_content" "valid input"
14+test_write_fail "$file" "1 2
15+3 4 5 6 3 0 0 0 1 2 3 1 100 3 2 1" "$orig_content" "multi lines"
16+test_write_succ "$file" "" "$orig_content" "disabling"
17+test_write_fail "$file" "2 1 2 1 10 1 3 10 1 1 1 1 1 1 1 1 2 3" \
18+ "$orig_content" "wrong condition ranges"
19+echo "$orig_content" > "$file"
tools/testing/selftests/damon/debugfs_target_ids.sh+19−0
@@ -0,0 +1,19 @@
1+#!/bin/bash
2+# SPDX-License-Identifier: GPL-2.0
3+
4+source _debugfs_common.sh
5+
6+# Test target_ids file
7+# ====================
8+
9+file="$DBGFS/target_ids"
10+orig_content=$(cat "$file")
11+
12+test_write_succ "$file" "1 2 3 4" "$orig_content" "valid input"
13+test_write_succ "$file" "1 2 abc 4" "$orig_content" "still valid input"
14+test_content "$file" "$orig_content" "1 2" "non-integer was there"
15+test_write_succ "$file" "abc 2 3" "$orig_content" "the file allows wrong input"
16+test_content "$file" "$orig_content" "" "wrong input written"
17+test_write_succ "$file" "" "$orig_content" "empty input"
18+test_content "$file" "$orig_content" "" "empty input written"
19+echo "$orig_content" > "$file"
tools/testing/selftests/damon/huge_count_read_write.c+39−0
@@ -0,0 +1,39 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/*
3+ * Author: SeongJae Park <sj@kernel.org>
4+ */
5+
6+#include <fcntl.h>
7+#include <stdlib.h>
8+#include <unistd.h>
9+#include <stdio.h>
10+
11+void write_read_with_huge_count(char *file)
12+{
13+ int filedesc = open(file, O_RDWR);
14+ char buf[25];
15+ int ret;
16+
17+ printf("%s %s\n", __func__, file);
18+ if (filedesc < 0) {
19+ fprintf(stderr, "failed opening %s\n", file);
20+ exit(1);
21+ }
22+
23+ write(filedesc, "", 0xfffffffful);
24+ perror("after write: ");
25+ ret = read(filedesc, buf, 0xfffffffful);
26+ perror("after read: ");
27+ close(filedesc);
28+}
29+
30+int main(int argc, char *argv[])
31+{
32+ if (argc != 2) {
33+ fprintf(stderr, "Usage: %s <file>\n", argv[0]);
34+ exit(1);
35+ }
36+ write_read_with_huge_count(argv[1]);
37+
38+ return 0;
39+}
tools/testing/selftests/drivers/net/mlxsw/rif_mac_profiles_occ.sh+30−0
@@ -72,6 +72,35 @@ rif_mac_profile_replacement_test() · 71 unmodified lines
7272 ip link set $h1.10 address $h1_10_mac
7373 }
7474
75+rif_mac_profile_consolidation_test()
76+{
77+ local count=$1; shift
78+ local h1_20_mac
79+
80+ RET=0
81+
82+ if [[ $count -eq 1 ]]; then
83+ return
84+ fi
85+
86+ h1_20_mac=$(mac_get $h1.20)
87+
88+ # Set the MAC of $h1.20 to that of $h1.10 and confirm that they are
89+ # using the same MAC profile.
90+ ip link set $h1.20 address 00:11:11:11:11:11
91+ check_err $?
92+
93+ occ=$(devlink -j resource show $DEVLINK_DEV \
94+ | jq '.[][][] | select(.name=="rif_mac_profiles") |.["occ"]')
95+
96+ [[ $occ -eq $((count - 1)) ]]
97+ check_err $? "MAC profile occupancy did not decrease"
98+
99+ log_test "RIF MAC profile consolidation"
100+
101+ ip link set $h1.20 address $h1_20_mac
102+}
103+
75104 rif_mac_profile_shared_replacement_test()
76105 {
77106 local count=$1; shift
@@ -104,6 +133,7 @@ rif_mac_profile_edit_test() · 26 unmodified lines
104133 create_max_rif_mac_profiles $count
105134
106135 rif_mac_profile_replacement_test
136+ rif_mac_profile_consolidation_test $count
107137 rif_mac_profile_shared_replacement_test $count
108138 }
109139
tools/testing/selftests/kvm/.gitignore+1−0
@@ -30,6 +30,7 @@ · 29 unmodified lines
3030 /x86_64/svm_int_ctl_test
3131 /x86_64/sync_regs_test
3232 /x86_64/tsc_msrs_test
33+/x86_64/userspace_io_test
3334 /x86_64/userspace_msr_exit_test
3435 /x86_64/vmx_apic_access_test
3536 /x86_64/vmx_close_while_nested_test
tools/testing/selftests/kvm/Makefile+1−0
@@ -59,6 +59,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/vmx_preemption_timer_test · 58 unmodified lines
5959 TEST_GEN_PROGS_x86_64 += x86_64/svm_vmcall_test
6060 TEST_GEN_PROGS_x86_64 += x86_64/svm_int_ctl_test
6161 TEST_GEN_PROGS_x86_64 += x86_64/sync_regs_test
62+TEST_GEN_PROGS_x86_64 += x86_64/userspace_io_test
6263 TEST_GEN_PROGS_x86_64 += x86_64/userspace_msr_exit_test
6364 TEST_GEN_PROGS_x86_64 += x86_64/vmx_apic_access_test
6465 TEST_GEN_PROGS_x86_64 += x86_64/vmx_close_while_nested_test
tools/testing/selftests/kvm/include/kvm_util.h+9−0
@@ -71,6 +71,15 @@ enum vm_guest_mode { · 70 unmodified lines
7171
7272 #endif
7373
74+#if defined(__x86_64__)
75+unsigned long vm_compute_max_gfn(struct kvm_vm *vm);
76+#else
77+static inline unsigned long vm_compute_max_gfn(struct kvm_vm *vm)
78+{
79+ return ((1ULL << vm->pa_bits) >> vm->page_shift) - 1;
80+}
81+#endif
82+
7483 #define MIN_PAGE_SIZE (1U << MIN_PAGE_SHIFT)
7584 #define PTES_PER_MIN_PAGE ptes_per_page(MIN_PAGE_SIZE)
7685
tools/testing/selftests/kvm/lib/kvm_util.c+1−1
@@ -302,7 +302,7 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) · 301 unmodified lines
302302 (1ULL << (vm->va_bits - 1)) >> vm->page_shift);
303303
304304 /* Limit physical addresses to PA-bits. */
305− vm->max_gfn = ((1ULL << vm->pa_bits) >> vm->page_shift) - 1;
305+ vm->max_gfn = vm_compute_max_gfn(vm);
306306
307307 /* Allocate and setup memory for guest. */
308308 vm->vpages_mapped = sparsebit_alloc();
tools/testing/selftests/kvm/lib/x86_64/processor.c+68−0
@@ -1431,3 +1431,71 @@ struct kvm_cpuid2 *vcpu_get_supported_hv_cpuid(struct kvm_vm *vm, uint32_t vcpui · 1430 unmodified lines
14311431
14321432 return cpuid;
14331433 }
1434+
1435+#define X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx 0x68747541
1436+#define X86EMUL_CPUID_VENDOR_AuthenticAMD_ecx 0x444d4163
1437+#define X86EMUL_CPUID_VENDOR_AuthenticAMD_edx 0x69746e65
1438+
1439+static inline unsigned x86_family(unsigned int eax)
1440+{
1441+ unsigned int x86;
1442+
1443+ x86 = (eax >> 8) & 0xf;
1444+
1445+ if (x86 == 0xf)
1446+ x86 += (eax >> 20) & 0xff;
1447+
1448+ return x86;
1449+}
1450+
1451+unsigned long vm_compute_max_gfn(struct kvm_vm *vm)
1452+{
1453+ const unsigned long num_ht_pages = 12 << (30 - vm->page_shift); /* 12 GiB */
1454+ unsigned long ht_gfn, max_gfn, max_pfn;
1455+ uint32_t eax, ebx, ecx, edx, max_ext_leaf;
1456+
1457+ max_gfn = (1ULL << (vm->pa_bits - vm->page_shift)) - 1;
1458+
1459+ /* Avoid reserved HyperTransport region on AMD processors. */
1460+ eax = ecx = 0;
1461+ cpuid(&eax, &ebx, &ecx, &edx);
1462+ if (ebx != X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx ||
1463+ ecx != X86EMUL_CPUID_VENDOR_AuthenticAMD_ecx ||
1464+ edx != X86EMUL_CPUID_VENDOR_AuthenticAMD_edx)
1465+ return max_gfn;
1466+
1467+ /* On parts with <40 physical address bits, the area is fully hidden */
1468+ if (vm->pa_bits < 40)
1469+ return max_gfn;
1470+
1471+ /* Before family 17h, the HyperTransport area is just below 1T. */
1472+ ht_gfn = (1 << 28) - num_ht_pages;
1473+ eax = 1;
1474+ cpuid(&eax, &ebx, &ecx, &edx);
1475+ if (x86_family(eax) < 0x17)
1476+ goto done;
1477+
1478+ /*
1479+ * Otherwise it's at the top of the physical address space, possibly
1480+ * reduced due to SME by bits 11:6 of CPUID[0x8000001f].EBX. Use
1481+ * the old conservative value if MAXPHYADDR is not enumerated.
1482+ */
1483+ eax = 0x80000000;
1484+ cpuid(&eax, &ebx, &ecx, &edx);
1485+ max_ext_leaf = eax;
1486+ if (max_ext_leaf < 0x80000008)
1487+ goto done;
1488+
1489+ eax = 0x80000008;
1490+ cpuid(&eax, &ebx, &ecx, &edx);
1491+ max_pfn = (1ULL << ((eax & 0xff) - vm->page_shift)) - 1;
1492+ if (max_ext_leaf >= 0x8000001f) {
1493+ eax = 0x8000001f;
1494+ cpuid(&eax, &ebx, &ecx, &edx);
1495+ max_pfn >>= (ebx >> 6) & 0x3f;
1496+ }
1497+
1498+ ht_gfn = max_pfn - num_ht_pages;
1499+done:
1500+ return min(max_gfn, ht_gfn - 1);
1501+}
tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c+1−1
@@ -75,7 +75,7 @@ static void l1_guest_code(struct svm_test_data *svm) · 74 unmodified lines
7575 vmcb->control.int_ctl &= ~V_INTR_MASKING_MASK;
7676
7777 /* No intercepts for real and virtual interrupts */
78− vmcb->control.intercept &= ~(1ULL << INTERCEPT_INTR | INTERCEPT_VINTR);
78+ vmcb->control.intercept &= ~(BIT(INTERCEPT_INTR) | BIT(INTERCEPT_VINTR));
7979
8080 /* Make a virtual interrupt VINTR_IRQ_NUMBER pending */
8181 vmcb->control.int_ctl |= V_IRQ_MASK | (0x1 << V_INTR_PRIO_SHIFT);
tools/testing/selftests/kvm/x86_64/userspace_io_test.c+114−0
@@ -0,0 +1,114 @@
1+// SPDX-License-Identifier: GPL-2.0
2+#include <fcntl.h>
3+#include <stdio.h>
4+#include <stdlib.h>
5+#include <string.h>
6+#include <sys/ioctl.h>
7+
8+#include "test_util.h"
9+
10+#include "kvm_util.h"
11+#include "processor.h"
12+
13+#define VCPU_ID 1
14+
15+static void guest_ins_port80(uint8_t *buffer, unsigned int count)
16+{
17+ unsigned long end;
18+
19+ if (count == 2)
20+ end = (unsigned long)buffer + 1;
21+ else
22+ end = (unsigned long)buffer + 8192;
23+
24+ asm volatile("cld; rep; insb" : "+D"(buffer), "+c"(count) : "d"(0x80) : "memory");
25+ GUEST_ASSERT_1(count == 0, count);
26+ GUEST_ASSERT_2((unsigned long)buffer == end, buffer, end);
27+}
28+
29+static void guest_code(void)
30+{
31+ uint8_t buffer[8192];
32+ int i;
33+
34+ /*
35+ * Special case tests. main() will adjust RCX 2 => 1 and 3 => 8192 to
36+ * test that KVM doesn't explode when userspace modifies the "count" on
37+ * a userspace I/O exit. KVM isn't required to play nice with the I/O
38+ * itself as KVM doesn't support manipulating the count, it just needs
39+ * to not explode or overflow a buffer.
40+ */
41+ guest_ins_port80(buffer, 2);
42+ guest_ins_port80(buffer, 3);
43+
44+ /* Verify KVM fills the buffer correctly when not stuffing RCX. */
45+ memset(buffer, 0, sizeof(buffer));
46+ guest_ins_port80(buffer, 8192);
47+ for (i = 0; i < 8192; i++)
48+ GUEST_ASSERT_2(buffer[i] == 0xaa, i, buffer[i]);
49+
50+ GUEST_DONE();
51+}
52+
53+int main(int argc, char *argv[])
54+{
55+ struct kvm_regs regs;
56+ struct kvm_run *run;
57+ struct kvm_vm *vm;
58+ struct ucall uc;
59+ int rc;
60+
61+ /* Tell stdout not to buffer its content */
62+ setbuf(stdout, NULL);
63+
64+ /* Create VM */
65+ vm = vm_create_default(VCPU_ID, 0, guest_code);
66+ run = vcpu_state(vm, VCPU_ID);
67+
68+ memset(&regs, 0, sizeof(regs));
69+
70+ while (1) {
71+ rc = _vcpu_run(vm, VCPU_ID);
72+
73+ TEST_ASSERT(rc == 0, "vcpu_run failed: %d\n", rc);
74+ TEST_ASSERT(run->exit_reason == KVM_EXIT_IO,
75+ "Unexpected exit reason: %u (%s),\n",
76+ run->exit_reason,
77+ exit_reason_str(run->exit_reason));
78+
79+ if (get_ucall(vm, VCPU_ID, &uc))
80+ break;
81+
82+ TEST_ASSERT(run->io.port == 0x80,
83+ "Expected I/O at port 0x80, got port 0x%x\n", run->io.port);
84+
85+ /*
86+ * Modify the rep string count in RCX: 2 => 1 and 3 => 8192.
87+ * Note, this abuses KVM's batching of rep string I/O to avoid
88+ * getting stuck in an infinite loop. That behavior isn't in
89+ * scope from a testing perspective as it's not ABI in any way,
90+ * i.e. it really is abusing internal KVM knowledge.
91+ */
92+ vcpu_regs_get(vm, VCPU_ID, &regs);
93+ if (regs.rcx == 2)
94+ regs.rcx = 1;
95+ if (regs.rcx == 3)
96+ regs.rcx = 8192;
97+ memset((void *)run + run->io.data_offset, 0xaa, 4096);
98+ vcpu_regs_set(vm, VCPU_ID, &regs);
99+ }
100+
101+ switch (uc.cmd) {
102+ case UCALL_DONE:
103+ break;
104+ case UCALL_ABORT:
105+ TEST_FAIL("%s at %s:%ld : argN+1 = 0x%lx, argN+2 = 0x%lx",
106+ (const char *)uc.args[0], __FILE__, uc.args[1],
107+ uc.args[2], uc.args[3]);
108+ default:
109+ TEST_FAIL("Unknown ucall %lu", uc.cmd);
110+ }
111+
112+ kvm_vm_free(vm);
113+ return 0;
114+}
tools/testing/selftests/net/fcnal-test.sh+34−11
@@ -462,6 +462,22 @@ cleanup() · 461 unmodified lines
462462 ip netns del ${NSC} >/dev/null 2>&1
463463 }
464464
465+cleanup_vrf_dup()
466+{
467+ ip link del ${NSA_DEV2} >/dev/null 2>&1
468+ ip netns pids ${NSC} | xargs kill 2>/dev/null
469+ ip netns del ${NSC} >/dev/null 2>&1
470+}
471+
472+setup_vrf_dup()
473+{
474+ # some VRF tests use ns-C which has the same config as
475+ # ns-B but for a device NOT in the VRF
476+ create_ns ${NSC} "-" "-"
477+ connect_ns ${NSA} ${NSA_DEV2} ${NSA_IP}/24 ${NSA_IP6}/64 \
478+ ${NSC} ${NSC_DEV} ${NSB_IP}/24 ${NSB_IP6}/64
479+}
480+
465481 setup()
466482 {
467483 local with_vrf=${1}
@@ -491,12 +507,6 @@ setup() · 23 unmodified lines
491507
492508 ip -netns ${NSB} ro add ${VRF_IP}/32 via ${NSA_IP} dev ${NSB_DEV}
493509 ip -netns ${NSB} -6 ro add ${VRF_IP6}/128 via ${NSA_IP6} dev ${NSB_DEV}
494−
495− # some VRF tests use ns-C which has the same config as
496− # ns-B but for a device NOT in the VRF
497− create_ns ${NSC} "-" "-"
498− connect_ns ${NSA} ${NSA_DEV2} ${NSA_IP}/24 ${NSA_IP6}/64 \
499− ${NSC} ${NSC_DEV} ${NSB_IP}/24 ${NSB_IP6}/64
500510 else
501511 ip -netns ${NSA} ro add ${NSB_LO_IP}/32 via ${NSB_IP} dev ${NSA_DEV}
502512 ip -netns ${NSA} ro add ${NSB_LO_IP6}/128 via ${NSB_IP6} dev ${NSA_DEV}
@@ -1247,7 +1257,9 @@ ipv4_tcp_vrf() · 744 unmodified lines
12471257 log_test_addr ${a} $? 1 "Global server, local connection"
12481258
12491259 # run MD5 tests
1260+ setup_vrf_dup
12501261 ipv4_tcp_md5
1262+ cleanup_vrf_dup
12511263
12521264 #
12531265 # enable VRF global server
@@ -1813,8 +1825,9 @@ ipv4_addr_bind_vrf() · 559 unmodified lines
18131825 for a in ${NSA_IP} ${VRF_IP}
18141826 do
18151827 log_start
1828+ show_hint "Socket not bound to VRF, but address is in VRF"
18161829 run_cmd nettest -s -R -P icmp -l ${a} -b
1817− log_test_addr ${a} $? 0 "Raw socket bind to local address"
1830+ log_test_addr ${a} $? 1 "Raw socket bind to local address"
18181831
18191832 log_start
18201833 run_cmd nettest -s -R -P icmp -l ${a} -I ${NSA_DEV} -b
@@ -2215,7 +2228,7 @@ ipv6_ping_vrf() · 394 unmodified lines
22152228 log_start
22162229 show_hint "Fails since VRF device does not support linklocal or multicast"
22172230 run_cmd ${ping6} -c1 -w1 ${a}
2218− log_test_addr ${a} $? 2 "ping out, VRF bind"
2231+ log_test_addr ${a} $? 1 "ping out, VRF bind"
22192232 done
22202233
22212234 for a in ${NSB_IP6} ${NSB_LO_IP6} ${NSB_LINKIP6}%${NSA_DEV} ${MCAST}%${NSA_DEV}
@@ -2743,7 +2756,9 @@ ipv6_tcp_vrf() · 521 unmodified lines
27432756 log_test_addr ${a} $? 1 "Global server, local connection"
27442757
27452758 # run MD5 tests
2759+ setup_vrf_dup
27462760 ipv6_tcp_md5
2761+ cleanup_vrf_dup
27472762
27482763 #
27492764 # enable VRF global server
@@ -3446,11 +3461,14 @@ ipv6_addr_bind_novrf() · 696 unmodified lines
34463461 run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b
34473462 log_test_addr ${a} $? 0 "TCP socket bind to local address after device bind"
34483463
3464+ # Sadly, the kernel allows binding a socket to a device and then
3465+ # binding to an address not on the device. So this test passes
3466+ # when it really should not
34493467 a=${NSA_LO_IP6}
34503468 log_start
3451− show_hint "Should fail with 'Cannot assign requested address'"
3469+ show_hint "Tecnically should fail since address is not on device but kernel allows"
34523470 run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b
3453− log_test_addr ${a} $? 1 "TCP socket bind to out of scope local address"
3471+ log_test_addr ${a} $? 0 "TCP socket bind to out of scope local address"
34543472 }
34553473
34563474 ipv6_addr_bind_vrf()
@@ -3499,10 +3517,15 @@ ipv6_addr_bind_vrf() · 42 unmodified lines
34993517 run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b
35003518 log_test_addr ${a} $? 0 "TCP socket bind to local address with device bind"
35013519
3520+ # Sadly, the kernel allows binding a socket to a device and then
3521+ # binding to an address not on the device. The only restriction
3522+ # is that the address is valid in the L3 domain. So this test
3523+ # passes when it really should not
35023524 a=${VRF_IP6}
35033525 log_start
3526+ show_hint "Tecnically should fail since address is not on device but kernel allows"
35043527 run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b
3505− log_test_addr ${a} $? 1 "TCP socket bind to VRF address with device bind"
3528+ log_test_addr ${a} $? 0 "TCP socket bind to VRF address with device bind"
35063529
35073530 a=${NSA_LO_IP6}
35083531 log_start
tools/testing/selftests/net/forwarding/forwarding.config.sample+2−0
@@ -13,6 +13,8 @@ NETIFS[p5]=veth4 · 12 unmodified lines
1313 NETIFS[p6]=veth5
1414 NETIFS[p7]=veth6
1515 NETIFS[p8]=veth7
16+NETIFS[p9]=veth8
17+NETIFS[p10]=veth9
1618
1719 # Port that does not have a cable connected.
1820 NETIF_NO_CABLE=eth8
tools/testing/selftests/net/icmp_redirect.sh+1−1
@@ -311,7 +311,7 @@ check_exception() · 310 unmodified lines
311311 ip -netns h1 ro get ${H1_VRF_ARG} ${H2_N2_IP} | \
312312 grep -E -v 'mtu|redirected' | grep -q "cache"
313313 fi
314− log_test $? 0 "IPv4: ${desc}"
314+ log_test $? 0 "IPv4: ${desc}" 0
315315
316316 # No PMTU info for test "redirect" and "mtu exception plus redirect"
317317 if [ "$with_redirect" = "yes" ] && [ "$desc" != "redirect exception plus mtu" ]; then
tools/testing/selftests/net/toeplitz.c+1−1
@@ -498,7 +498,7 @@ static void parse_opts(int argc, char **argv) · 497 unmodified lines
498498 bool have_toeplitz = false;
499499 int index, c;
500500
501− while ((c = getopt_long(argc, argv, "46C:d:i:k:r:stT:u:v", long_options, &index)) != -1) {
501+ while ((c = getopt_long(argc, argv, "46C:d:i:k:r:stT:uv", long_options, &index)) != -1) {
502502 switch (c) {
503503 case '4':
504504 cfg_family = AF_INET;