History

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

Cross-merge networking fixes after downstream PR. Conflicts: net/sched/sch_taprio.c d636fc5dd692 ("net: sched: add rcu annotations around qdisc->qdisc_sleeping") dced11ef84fb ("net/sched: taprio: don't overwrite "sch" variable in taprio_dump_class_stats()") net/ipv4/sysctl_net_ipv4.c e209fee4118f ("net/ipv4: ping_group_range: allow GID from 2147483648 to 4294967294") ccce324dabfe ("tcp: make the first N SYN RTO backoffs linear") https://lore.kernel.org/all/20230605100816.08d41a7b@canb.auug.org.au/ No adjacent changes.

Jakub Kicinski committed 3 years ago

Commit 449f6bc2 parents bfd019d 25041a4319 files · +2815 −1351Browse files

Unified · Split

319 files
  1. Documentation/devicetree/bindings/fpga/lattice,sysconfig.yaml +1 −1
  2. Documentation/devicetree/bindings/fpga/microchip,mpf-spi-fpga-mgr.yaml +1 −1
  3. Documentation/devicetree/bindings/iio/adc/nxp,imx8qxp-adc.yaml +7 −0
  4. Documentation/devicetree/bindings/iio/adc/renesas,rcar-gyroadc.yaml +1 −1
  5. Documentation/devicetree/bindings/serial/8250_omap.yaml +1 −0
  6. Documentation/devicetree/bindings/usb/snps,dwc3.yaml +1 −1
  7. Documentation/mm/page_table_check.rst +19 −0
  8. Documentation/netlink/specs/ethtool.yaml +16 −16
  9. Documentation/networking/ip-sysctl.rst +2 −2
  10. MAINTAINERS +13 −5
  11. Makefile +1 −1
  12. arch/arm64/include/asm/kvm_pgtable.h +3 −3
  13. arch/arm64/include/asm/sysreg.h +6 −0
  14. arch/arm64/kvm/hyp/include/hyp/switch.h +6 −2
  15. arch/arm64/kvm/hyp/nvhe/mem_protect.c +7 −7
  16. arch/arm64/kvm/hyp/nvhe/switch.c +2 −0
  17. arch/arm64/kvm/hyp/pgtable.c +16 −1
  18. arch/arm64/kvm/hyp/vhe/switch.c +1 −0
  19. arch/arm64/kvm/pmu-emul.c +23 −35
  20. arch/arm64/kvm/sys_regs.c +19 −0
  21. arch/arm64/kvm/vgic/vgic-init.c +21 −6
  22. arch/arm64/kvm/vgic/vgic-its.c +10 −4
  23. arch/arm64/kvm/vgic/vgic-kvm-device.c +8 −2
  24. arch/arm64/kvm/vgic/vgic-mmio-v3.c +21 −10
  25. arch/arm64/kvm/vgic/vgic-mmio.c +2 −7
  26. arch/arm64/kvm/vgic/vgic-v2.c +0 −6
  27. arch/arm64/kvm/vgic/vgic-v3.c +0 −7
  28. arch/arm64/kvm/vgic/vgic-v4.c +2 −1
  29. arch/powerpc/crypto/Makefile +5 −5
  30. arch/powerpc/crypto/aes-gcm-p10-glue.c +9 −9
  31. arch/powerpc/crypto/aesp10-ppc.pl +1 −1
  32. arch/powerpc/crypto/ghashp10-ppc.pl +6 −6
  33. arch/powerpc/platforms/pseries/iommu.c +11 −2
  34. arch/powerpc/xmon/xmon.c +1 −1
  35. arch/riscv/Kconfig +4 −1
  36. arch/riscv/errata/Makefile +4 −0
  37. arch/riscv/include/asm/hugetlb.h +3 −0
  38. arch/riscv/include/asm/perf_event.h +7 −0
  39. arch/riscv/kernel/Makefile +4 −0
  40. arch/riscv/mm/hugetlbpage.c +29 −1
  41. arch/riscv/mm/init.c +1 −1
  42. arch/x86/kvm/lapic.c +18 −2
  43. arch/x86/kvm/mmu/mmu.c +4 −1
  44. arch/x86/kvm/svm/svm.c +1 −1
  45. arch/x86/kvm/x86.c +3 −0
  46. block/blk-settings.c +2 −1
  47. crypto/asymmetric_keys/public_key.c +21 −17
  48. drivers/acpi/apei/apei-internal.h +0 −6
  49. drivers/acpi/apei/bert.c +1 −0
  50. drivers/base/cacheinfo.c +26 −0
  51. drivers/base/firmware_loader/main.c +1 −1
  52. drivers/bluetooth/hci_qca.c +5 −1
  53. drivers/char/tpm/tpm_tis_core.h +4 −4
  54. drivers/firmware/efi/libstub/Makefile.zboot +2 −1
  55. drivers/firmware/efi/libstub/efistub.h +3 −0
  56. drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +2 −1
  57. drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +26 −1
  58. drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.h +3 −0
  59. drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +26 −1
  60. drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +3 −0
  61. drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c +22 −6
  62. drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c +21 −7
  63. drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +21 −4
  64. drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +30 −6
  65. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +0 −9
  66. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +1 −24
  67. drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +0 −29
  68. drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +6 −4
  69. drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +3 −2
  70. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c +3 −2
  71. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c +3 −2
  72. drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +3 −2
  73. drivers/gpu/drm/i915/i915_perf.c +11 −6
  74. drivers/hid/hid-logitech-hidpp.c +6 −7
  75. drivers/iio/accel/kionix-kx022a.c +1 −1
  76. drivers/iio/accel/st_accel_core.c +2 −2
  77. drivers/iio/adc/ad4130.c +11 −1
  78. drivers/iio/adc/ad7192.c +2 −6
  79. drivers/iio/adc/ad_sigma_delta.c +4 −0
  80. drivers/iio/adc/imx93_adc.c +3 −4
  81. drivers/iio/adc/mt6370-adc.c +51 −2
  82. drivers/iio/adc/mxs-lradc-adc.c +5 −5
  83. drivers/iio/adc/palmas_gpadc.c +5 −5
  84. drivers/iio/adc/stm32-adc.c +32 −29
  85. drivers/iio/addac/ad74413r.c +1 −1
  86. drivers/iio/dac/Makefile +1 −1
  87. drivers/iio/dac/mcp4725.c +14 −2
  88. drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c +5 −5
  89. drivers/iio/industrialio-gts-helper.c +32 −10
  90. drivers/iio/light/rohm-bu27034.c +20 −6
  91. drivers/iio/light/vcnl4035.c +3 −0
  92. drivers/iio/magnetometer/tmag5273.c +3 −2
  93. drivers/input/input.c +1 −1
  94. drivers/input/joystick/xpad.c +0 −1
  95. drivers/input/misc/soc_button_array.c +30 −0
  96. drivers/input/mouse/elantech.c +5 −4
  97. drivers/input/touchscreen/cyttsp5.c +1 −1
  98. drivers/iommu/Kconfig +1 −0
  99. drivers/iommu/amd/amd_iommu.h +1 −3
  100. drivers/iommu/amd/init.c +24 −0
  101. drivers/iommu/amd/iommu.c +25 −6
  102. drivers/iommu/mtk_iommu.c +2 −1
  103. drivers/iommu/rockchip-iommu.c +8 −6
  104. drivers/irqchip/irq-gic-common.c +2 −0
  105. drivers/leds/rgb/leds-qcom-lpg.c +4 −4
  106. drivers/md/raid5.c +1 −1
  107. drivers/media/cec/core/cec-adap.c +6 −2
  108. drivers/media/cec/core/cec-core.c +2 −0
  109. drivers/media/cec/core/cec-priv.h +1 −0
  110. drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c +3 −0
  111. drivers/media/platform/qcom/camss/camss-video.c +0 −1
  112. drivers/media/platform/verisilicon/hantro_v4l2.c +4 −2
  113. drivers/media/usb/uvc/uvc_driver.c +11 −5
  114. drivers/media/v4l2-core/v4l2-mc.c +1 −2
  115. drivers/misc/fastrpc.c +23 −8
  116. drivers/mmc/core/pwrseq_sd8787.c +26 −8
  117. drivers/mmc/host/vub300.c +3 −0
  118. drivers/mtd/mtdchar.c +4 −4
  119. drivers/mtd/nand/raw/ingenic/ingenic_ecc.h +4 −4
  120. drivers/mtd/nand/raw/marvell_nand.c +6 −4
  121. drivers/mtd/spi-nor/core.c +4 −1
  122. drivers/mtd/spi-nor/spansion.c +2 −2
  123. drivers/net/dsa/lan9303-core.c +0 −4
  124. drivers/net/dsa/qca/Kconfig +1 −0
  125. drivers/net/ethernet/amd/pds_core/dev.c +8 −2
  126. drivers/net/ethernet/broadcom/bcmsysport.c +2 −2
  127. drivers/net/ethernet/broadcom/bnxt/bnxt.c +32 −10
  128. drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +1 −1
  129. drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +1 −0
  130. drivers/net/ethernet/broadcom/genet/bcmgenet.c +8 −14
  131. drivers/net/ethernet/broadcom/genet/bcmgenet.h +3 −0
  132. drivers/net/ethernet/broadcom/genet/bcmmii.c +5 −0
  133. drivers/net/ethernet/freescale/enetc/enetc.c +15 −1
  134. drivers/net/ethernet/intel/ice/ice_common.c +1 −1
  135. drivers/net/ethernet/intel/ice/ice_common.h +1 −1
  136. drivers/net/ethernet/intel/ice/ice_gnss.c +4 −60
  137. drivers/net/ethernet/intel/ice/ice_gnss.h +0 −10
  138. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +1 −1
  139. drivers/net/ethernet/qlogic/qed/qed_l2.c +1 −1
  140. drivers/net/ethernet/qlogic/qede/qede.h +4 −0
  141. drivers/net/ethernet/qlogic/qede/qede_ethtool.c +22 −2
  142. drivers/net/ethernet/qlogic/qede/qede_main.c +33 −1
  143. drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +2 −1
  144. drivers/net/phy/phylink.c +10 −5
  145. drivers/net/virtio_net.c +8 −8
  146. drivers/net/wireless/intel/iwlwifi/mvm/d3.c +2 −6
  147. drivers/net/wireless/mediatek/mt76/mt7615/mac.c +3 −0
  148. drivers/net/wireless/mediatek/mt76/mt7996/mac.c +12 −7
  149. drivers/net/wireless/realtek/rtw88/mac80211.c +5 −9
  150. drivers/net/wireless/realtek/rtw88/main.c +2 −2
  151. drivers/net/wireless/realtek/rtw88/ps.c +43 −0
  152. drivers/net/wireless/realtek/rtw88/ps.h +2 −0
  153. drivers/net/wireless/realtek/rtw89/core.c +0 −3
  154. drivers/net/wireless/realtek/rtw89/mac80211.c +6 −9
  155. drivers/net/wireless/realtek/rtw89/ps.c +26 −0
  156. drivers/net/wireless/realtek/rtw89/ps.h +1 −0
  157. drivers/nvme/host/constants.c +1 −1
  158. drivers/nvme/host/core.c +48 −4
  159. drivers/nvme/host/ioctl.c +1 −1
  160. drivers/nvme/host/nvme.h +2 −1
  161. drivers/nvme/target/passthru.c +1 −1
  162. drivers/platform/surface/aggregator/controller.c +1 −1
  163. drivers/platform/surface/surface_aggregator_tabletsw.c +10 −0
  164. drivers/platform/x86/intel/int3472/clk_and_regulator.c +8 −5
  165. drivers/scsi/qla2xxx/qla_def.h +1 −0
  166. drivers/scsi/qla2xxx/qla_init.c +3 −0
  167. drivers/scsi/qla2xxx/qla_inline.h +3 −0
  168. drivers/scsi/qla2xxx/qla_isr.c +3 −0
  169. drivers/scsi/stex.c +4 −0
  170. drivers/soc/fsl/qe/Kconfig +2 −2
  171. drivers/spi/spi-fsl-lpspi.c +6 −1
  172. drivers/spi/spi-mt65xx.c +3 −0
  173. drivers/spi/spi-qup.c +18 −19
  174. drivers/staging/media/atomisp/i2c/atomisp-ov2680.c +2 −2
  175. drivers/staging/media/imx/imx8mq-mipi-csi2.c +1 −1
  176. drivers/target/iscsi/iscsi_target.c +0 −2
  177. drivers/target/iscsi/iscsi_target_login.c +5 −58
  178. drivers/target/iscsi/iscsi_target_nego.c +42 −32
  179. drivers/target/iscsi/iscsi_target_util.c +51 −0
  180. drivers/target/iscsi/iscsi_target_util.h +4 −0
  181. drivers/tty/serial/8250/8250_tegra.c +3 −1
  182. drivers/tty/serial/Kconfig +1 −1
  183. drivers/tty/serial/cpm_uart/cpm_uart.h +0 −2
  184. drivers/tty/serial/fsl_lpuart.c +23 −21
  185. drivers/usb/cdns3/cdns3-gadget.c +13 −0
  186. drivers/usb/core/buffer.c +41 −0
  187. drivers/usb/core/devio.c +14 −6
  188. drivers/usb/gadget/function/f_fs.c +1 −1
  189. drivers/usb/gadget/udc/amd5536udc_pci.c +3 −0
  190. drivers/usb/typec/tipd/core.c +1 −1
  191. drivers/video/fbdev/arcfb.c +2 −3
  192. drivers/video/fbdev/au1100fb.c +3 −8
  193. drivers/video/fbdev/au1200fb.c +2 −4
  194. drivers/video/fbdev/broadsheetfb.c +2 −3
  195. drivers/video/fbdev/bw2.c +2 −4
  196. drivers/video/fbdev/core/bitblit.c +3 −0
  197. drivers/video/fbdev/imsttfb.c +9 −3
  198. drivers/video/fbdev/matrox/matroxfb_maven.c +1 −1
  199. drivers/video/fbdev/ssd1307fb.c +1 −1
  200. fs/afs/dir.c +3 −0
  201. fs/btrfs/bio.c +0 −4
  202. fs/btrfs/scrub.c +32 −16
  203. fs/ext4/mballoc.c +15 −1
  204. fs/gfs2/file.c +14 −3
  205. fs/nfsd/nfsctl.c +1 −6
  206. fs/nfsd/vfs.c +9 −1
  207. fs/xfs/libxfs/xfs_ag.c +4 −1
  208. fs/xfs/libxfs/xfs_alloc.c +65 −26
  209. fs/xfs/libxfs/xfs_alloc.h +3 −3
  210. fs/xfs/libxfs/xfs_bmap.c +8 −2
  211. fs/xfs/libxfs/xfs_bmap_btree.c +5 −2
  212. fs/xfs/libxfs/xfs_ialloc.c +16 −8
  213. fs/xfs/libxfs/xfs_log_format.h +8 −1
  214. fs/xfs/libxfs/xfs_refcount.c +10 −3
  215. fs/xfs/libxfs/xfs_trans_inode.c +8 −105
  216. fs/xfs/scrub/bmap.c +13 −12
  217. fs/xfs/scrub/scrub.h +4 −4
  218. fs/xfs/xfs_buf_item.c +65 −23
  219. fs/xfs/xfs_filestream.c +0 −1
  220. fs/xfs/xfs_icache.c +37 −9
  221. fs/xfs/xfs_icache.h +2 −2
  222. fs/xfs/xfs_inode.c +6 −14
  223. fs/xfs/xfs_inode.h +1 −1
  224. fs/xfs/xfs_inode_item.c +149 −0
  225. fs/xfs/xfs_inode_item.h +1 −0
  226. fs/xfs/xfs_log_recover.c +9 −10
  227. fs/xfs/xfs_mount.h +1 −0
  228. fs/xfs/xfs_reflink.c +3 −1
  229. fs/xfs/xfs_super.c +1 −0
  230. fs/xfs/xfs_trans.c +8 −1
  231. include/linux/cper.h +6 −0
  232. include/linux/efi.h +2 −0
  233. include/linux/iio/iio-gts-helper.h +1 −1
  234. include/linux/netdevice.h +6 −3
  235. include/linux/page-flags.h +6 −0
  236. include/linux/pe.h +13 −12
  237. include/linux/sunrpc/svcsock.h +3 −4
  238. include/linux/surface_aggregator/device.h +1 −5
  239. include/linux/usb/hcd.h +5 −0
  240. include/media/v4l2-subdev.h +1 −0
  241. include/net/bluetooth/hci.h +1 −0
  242. include/net/bluetooth/hci_core.h +3 −1
  243. include/net/neighbour.h +1 −1
  244. include/net/netns/ipv6.h +1 −1
  245. include/net/ping.h +1 −5
  246. include/net/pkt_sched.h +2 −0
  247. include/net/rpl.h +0 −3
  248. include/net/sch_generic.h +4 −2
  249. include/net/sock.h +13 −5
  250. include/target/iscsi/iscsi_target_core.h +4 −3
  251. include/uapi/linux/bpf.h +1 −0
  252. io_uring/epoll.c +0 −4
  253. kernel/bpf/map_in_map.c +6 −2
  254. kernel/bpf/syscall.c +9 −0
  255. kernel/fork.c +1 −1
  256. kernel/module/decompress.c +1 −1
  257. kernel/trace/bpf_trace.c +11 −1
  258. kernel/trace/trace_probe.h +1 −1
  259. lib/cpu_rmap.c +1 −1
  260. lib/test_firmware.c +63 −18
  261. mm/Kconfig.debug +1 −0
  262. mm/page_table_check.c +6 −0
  263. net/batman-adv/distributed-arp-table.c +1 −1
  264. net/bluetooth/hci_conn.c +13 −9
  265. net/bluetooth/hci_core.c +6 −4
  266. net/bluetooth/hci_event.c +26 −18
  267. net/bluetooth/hci_sync.c +17 −6
  268. net/bluetooth/l2cap_core.c +13 −0
  269. net/can/j1939/main.c +13 −11
  270. net/can/j1939/socket.c +5 −0
  271. net/core/dev.c +5 −3
  272. net/core/skmsg.c +2 −1
  273. net/ipv4/sysctl_net_ipv4.c +4 −4
  274. net/ipv4/tcp_offload.c +9 −10
  275. net/ipv6/exthdrs.c +11 −18
  276. net/ipv6/route.c +2 −2
  277. net/mac80211/he.c +10 −5
  278. net/mac80211/mlme.c +7 −1
  279. net/mac80211/rx.c +3 −1
  280. net/mac80211/tx.c +1 −1
  281. net/mptcp/pm.c +19 −4
  282. net/mptcp/pm_netlink.c +18 −0
  283. net/mptcp/pm_userspace.c +47 −1
  284. net/mptcp/protocol.h +1 −0
  285. net/netfilter/ipset/ip_set_core.c +8 −0
  286. net/netfilter/nf_conntrack_core.c +3 −0
  287. net/netfilter/nf_tables_api.c +3 −1
  288. net/netfilter/nft_bitwise.c +1 −1
  289. net/openvswitch/datapath.c +0 −19
  290. net/openvswitch/vport.c +16 −2
  291. net/sched/act_police.c +5 −5
  292. net/sched/cls_api.c +1 −2
  293. net/sched/sch_api.c +18 −10
  294. net/sched/sch_fq_pie.c +9 −1
  295. net/sched/sch_generic.c +15 −15
  296. net/sched/sch_mq.c +4 −4
  297. net/sched/sch_mqprio.c +4 −4
  298. net/sched/sch_pie.c +4 −1
  299. net/sched/sch_red.c +4 −1
  300. net/sched/sch_sfq.c +4 −1
  301. net/sched/sch_taprio.c +4 −3
  302. net/sched/sch_teql.c +1 −1
  303. net/smc/smc_llc.c +2 −2
  304. net/sunrpc/svcsock.c +6 −18
  305. net/wireless/core.c +2 −2
  306. net/wireless/nl80211.c +2 −0
  307. net/wireless/reg.c +2 −2
  308. security/selinux/Makefile +5 −1
  309. tools/include/uapi/linux/bpf.h +1 −0
  310. tools/lib/bpf/libbpf.c +2 −1
  311. tools/lib/bpf/libbpf_probes.c +2 −0
  312. tools/testing/selftests/bpf/prog_tests/inner_array_lookup.c +31 −0
  313. tools/testing/selftests/bpf/prog_tests/sockopt_sk.c +1 −1
  314. tools/testing/selftests/bpf/progs/inner_array_lookup.c +45 −0
  315. tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc +27 −18
  316. tools/testing/selftests/kvm/Makefile +1 −0
  317. tools/testing/selftests/kvm/x86_64/recalc_apic_map_test.c +74 −0
  318. tools/testing/selftests/net/.gitignore +3 −0
  319. tools/testing/selftests/net/mptcp/mptcp_join.sh +10 −1
Documentation/devicetree/bindings/fpga/lattice,sysconfig.yaml+1−1
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 6 unmodified lines
77 title: Lattice Slave SPI sysCONFIG FPGA manager
88
99 maintainers:
10− - Ivan Bornyakov <i.bornyakov@metrotek.ru>
10+ - Vladimir Georgiev <v.georgiev@metrotek.ru>
1111
1212 description: |
1313 Lattice sysCONFIG port, which is used for FPGA configuration, among others,
Documentation/devicetree/bindings/fpga/microchip,mpf-spi-fpga-mgr.yaml+1−1
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 6 unmodified lines
77 title: Microchip Polarfire FPGA manager.
88
99 maintainers:
10− - Ivan Bornyakov <i.bornyakov@metrotek.ru>
10+ - Vladimir Georgiev <v.georgiev@metrotek.ru>
1111
1212 description:
1313 Device Tree Bindings for Microchip Polarfire FPGA Manager using slave SPI to
Documentation/devicetree/bindings/iio/adc/nxp,imx8qxp-adc.yaml+7−0
@@ -39,6 +39,12 @@ properties: · 38 unmodified lines
3939 power-domains:
4040 maxItems: 1
4141
42+ vref-supply:
43+ description: |
44+ External ADC reference voltage supply on VREFH pad. If VERID[MVI] is
45+ set, there are additional, internal reference voltages selectable.
46+ VREFH1 is always from VREFH pad.
47+
4248 "#io-channel-cells":
4349 const: 1
4450
@@ -72,6 +78,7 @@ examples: · 27 unmodified lines
7278 assigned-clocks = <&clk IMX_SC_R_ADC_0>;
7379 assigned-clock-rates = <24000000>;
7480 power-domains = <&pd IMX_SC_R_ADC_0>;
81+ vref-supply = <&reg_1v8>;
7582 #io-channel-cells = <1>;
7683 };
7784 };
Documentation/devicetree/bindings/iio/adc/renesas,rcar-gyroadc.yaml+1−1
@@ -90,7 +90,7 @@ patternProperties: · 89 unmodified lines
9090 of the MAX chips to the GyroADC, while MISO line of each Maxim
9191 ADC connects to a shared input pin of the GyroADC.
9292 enum:
93− - adi,7476
93+ - adi,ad7476
9494 - fujitsu,mb88101a
9595 - maxim,max1162
9696 - maxim,max11100
Documentation/devicetree/bindings/serial/8250_omap.yaml+1−0
@@ -70,6 +70,7 @@ properties: · 69 unmodified lines
7070 dsr-gpios: true
7171 rng-gpios: true
7272 dcd-gpios: true
73+ rs485-rts-active-high: true
7374 rts-gpio: true
7475 power-domains: true
7576 clock-frequency: true
Documentation/devicetree/bindings/usb/snps,dwc3.yaml+1−1
@@ -287,7 +287,7 @@ properties: · 286 unmodified lines
287287 description:
288288 High-Speed PHY interface selection between UTMI+ and ULPI when the
289289 DWC_USB3_HSPHY_INTERFACE has value 3.
290− $ref: /schemas/types.yaml#/definitions/uint8
290+ $ref: /schemas/types.yaml#/definitions/string
291291 enum: [utmi, ulpi]
292292
293293 snps,quirk-frame-length-adjustment:
Documentation/mm/page_table_check.rst+19−0
@@ -52,3 +52,22 @@ Build kernel with: · 51 unmodified lines
5252
5353 Optionally, build kernel with PAGE_TABLE_CHECK_ENFORCED in order to have page
5454 table support without extra kernel parameter.
55+
56+Implementation notes
57+====================
58+
59+We specifically decided not to use VMA information in order to avoid relying on
60+MM states (except for limited "struct page" info). The page table check is a
61+separate from Linux-MM state machine that verifies that the user accessible
62+pages are not falsely shared.
63+
64+PAGE_TABLE_CHECK depends on EXCLUSIVE_SYSTEM_RAM. The reason is that without
65+EXCLUSIVE_SYSTEM_RAM, users are allowed to map arbitrary physical memory
66+regions into the userspace via /dev/mem. At the same time, pages may change
67+their properties (e.g., from anonymous pages to named pages) while they are
68+still being mapped in the userspace, leading to "corruption" detected by the
69+page table check.
70+
71+Even with EXCLUSIVE_SYSTEM_RAM, I/O pages may be still allowed to be mapped via
72+/dev/mem. However, these pages are always considered as named pages, so they
73+won't break the logic used in the page table check.
Documentation/netlink/specs/ethtool.yaml+16−16
@@ -223,7 +223,7 @@ attribute-sets: · 222 unmodified lines
223223 name: tx-min-frag-size
224224 type: u32
225225 -
226− name: tx-min-frag-size
226+ name: rx-min-frag-size
227227 type: u32
228228 -
229229 name: verify-enabled
@@ -294,7 +294,7 @@ attribute-sets: · 64 unmodified lines
294294 name: master-slave-state
295295 type: u8
296296 -
297− name: master-slave-lanes
297+ name: lanes
298298 type: u32
299299 -
300300 name: rate-matching
@@ -322,7 +322,7 @@ attribute-sets: · 21 unmodified lines
322322 name: ext-substate
323323 type: u8
324324 -
325− name: down-cnt
325+ name: ext-down-cnt
326326 type: u32
327327 -
328328 name: debug
@@ -577,7 +577,7 @@ attribute-sets: · 248 unmodified lines
577577 name: phc-index
578578 type: u32
579579 -
580− name: cable-test-nft-nest-result
580+ name: cable-test-ntf-nest-result
581581 attributes:
582582 -
583583 name: pair
@@ -586,7 +586,7 @@ attribute-sets: · 2 unmodified lines
586586 name: code
587587 type: u8
588588 -
589− name: cable-test-nft-nest-fault-length
589+ name: cable-test-ntf-nest-fault-length
590590 attributes:
591591 -
592592 name: pair
@@ -595,16 +595,16 @@ attribute-sets: · 2 unmodified lines
595595 name: cm
596596 type: u32
597597 -
598− name: cable-test-nft-nest
598+ name: cable-test-ntf-nest
599599 attributes:
600600 -
601601 name: result
602602 type: nest
603− nested-attributes: cable-test-nft-nest-result
603+ nested-attributes: cable-test-ntf-nest-result
604604 -
605605 name: fault-length
606606 type: nest
607− nested-attributes: cable-test-nft-nest-fault-length
607+ nested-attributes: cable-test-ntf-nest-fault-length
608608 -
609609 name: cable-test
610610 attributes:
@@ -618,7 +618,7 @@ attribute-sets: · 7 unmodified lines
618618 -
619619 name: nest
620620 type: nest
621− nested-attributes: cable-test-nft-nest
621+ nested-attributes: cable-test-ntf-nest
622622 -
623623 name: cable-test-tdr-cfg
624624 attributes:
@@ -776,7 +776,7 @@ attribute-sets: · 151 unmodified lines
776776 name: hist-bkt-hi
777777 type: u32
778778 -
779− name: hist-bkt-val
779+ name: hist-val
780780 type: u64
781781 -
782782 name: stats
@@ -965,7 +965,7 @@ operations: · 182 unmodified lines
965965 - duplex
966966 - master-slave-cfg
967967 - master-slave-state
968− - master-slave-lanes
968+ - lanes
969969 - rate-matching
970970 dump: *linkmodes-get-op
971971 -
@@ -999,7 +999,7 @@ operations: · 27 unmodified lines
999999 - sqi-max
10001000 - ext-state
10011001 - ext-substate
1002− - down-cnt
1002+ - ext-down-cnt
10031003 dump: *linkstate-get-op
10041004 -
10051005 name: debug-get
@@ -1351,7 +1351,7 @@ operations: · 345 unmodified lines
13511351 reply:
13521352 attributes:
13531353 - header
1354− - cable-test-nft-nest
1354+ - cable-test-ntf-nest
13551355 -
13561356 name: cable-test-tdr-act
13571357 doc: Cable test TDR.
@@ -1539,7 +1539,7 @@ operations: · 181 unmodified lines
15391539 - hkey
15401540 dump: *rss-get-op
15411541 -
1542− name: plca-get
1542+ name: plca-get-cfg
15431543 doc: Get PLCA params.
15441544
15451545 attribute-set: plca
@@ -1561,7 +1561,7 @@ operations: · 15 unmodified lines
15611561 - burst-tmr
15621562 dump: *plca-get-op
15631563 -
1564− name: plca-set
1564+ name: plca-set-cfg
15651565 doc: Set PLCA params.
15661566
15671567 attribute-set: plca
@@ -1585,7 +1585,7 @@ operations: · 17 unmodified lines
15851585 -
15861586 name: plca-ntf
15871587 doc: Notification for change in PLCA params.
1588− notify: plca-get
1588+ notify: plca-get-cfg
15891589 -
15901590 name: mm-get
15911591 doc: Get MAC Merge configuration and state
Documentation/networking/ip-sysctl.rst+2−2
@@ -1363,8 +1363,8 @@ ping_group_range - 2 INTEGERS · 1362 unmodified lines
13631363 Restrict ICMP_PROTO datagram sockets to users in the group range.
13641364 The default is "1 0", meaning, that nobody (not even root) may
13651365 create ping sockets. Setting it to "100 100" would grant permissions
1366− to the single group. "0 4294967295" would enable it for the world, "100
1367− 4294967295" would enable it for the users, but not daemons.
1366+ to the single group. "0 4294967294" would enable it for the world, "100
1367+ 4294967294" would enable it for the users, but not daemons.
13681368
13691369 tcp_early_demux - BOOLEAN
13701370 Enable early demux for established TCP sockets.
MAINTAINERS+13−5
@@ -1594,7 +1594,7 @@ F: drivers/media/i2c/ar0521.c · 1593 unmodified lines
15941594
15951595 ARASAN NAND CONTROLLER DRIVER
15961596 M: Miquel Raynal <miquel.raynal@bootlin.com>
1597−M: Naga Sureshkumar Relli <nagasure@xilinx.com>
1597+R: Michal Simek <michal.simek@amd.com>
15981598 L: linux-mtd@lists.infradead.org
15991599 S: Maintained
16001600 F: Documentation/devicetree/bindings/mtd/arasan,nand-controller.yaml
@@ -1757,7 +1757,7 @@ F: include/linux/amba/mmci.h · 156 unmodified lines
17571757
17581758 ARM PRIMECELL PL35X NAND CONTROLLER DRIVER
17591759 M: Miquel Raynal <miquel.raynal@bootlin.com>
1760−M: Naga Sureshkumar Relli <nagasure@xilinx.com>
1760+R: Michal Simek <michal.simek@amd.com>
17611761 L: linux-mtd@lists.infradead.org
17621762 S: Maintained
17631763 F: Documentation/devicetree/bindings/mtd/arm,pl353-nand-r2p1.yaml
@@ -1765,7 +1765,7 @@ F: drivers/mtd/nand/raw/pl35x-nand-controller.c · 1 unmodified line
17651765
17661766 ARM PRIMECELL PL35X SMC DRIVER
17671767 M: Miquel Raynal <miquel.raynal@bootlin.com>
1768−M: Naga Sureshkumar Relli <nagasure@xilinx.com>
1768+R: Michal Simek <michal.simek@amd.com>
17691769 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
17701770 S: Maintained
17711771 F: Documentation/devicetree/bindings/memory-controllers/arm,pl35x-smc.yaml
@@ -5721,6 +5721,14 @@ F: include/linux/tfrc.h · 3949 unmodified lines
57215721 F: include/uapi/linux/dccp.h
57225722 F: net/dccp/
57235723
5724+DEBUGOBJECTS:
5725+M: Thomas Gleixner <tglx@linutronix.de>
5726+L: linux-kernel@vger.kernel.org
5727+S: Maintained
5728+T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/debugobjects
5729+F: lib/debugobjects.c
5730+F: include/linux/debugobjects.h
5731+
57245732 DECSTATION PLATFORM SUPPORT
57255733 M: "Maciej W. Rozycki" <macro@orcam.me.uk>
57265734 L: linux-mips@vger.kernel.org
@@ -10114,7 +10122,7 @@ S: Maintained · 4387 unmodified lines
1011410122 F: Documentation/process/kernel-docs.rst
1011510123
1011610124 INDUSTRY PACK SUBSYSTEM (IPACK)
10117−M: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
10125+M: Vaibhav Gupta <vaibhavgupta40@gmail.com>
1011810126 M: Jens Taprogge <jens.taprogge@taprogge.org>
1011910127 M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1012010128 L: industrypack-devel@lists.sourceforge.net
@@ -13842,7 +13850,7 @@ F: drivers/tty/serial/8250/8250_pci1xxxx.c · 3721 unmodified lines
1384213850
1384313851 MICROCHIP POLARFIRE FPGA DRIVERS
1384413852 M: Conor Dooley <conor.dooley@microchip.com>
13845−R: Ivan Bornyakov <i.bornyakov@metrotek.ru>
13853+R: Vladimir Georgiev <v.georgiev@metrotek.ru>
1384613854 L: linux-fpga@vger.kernel.org
1384713855 S: Supported
1384813856 F: Documentation/devicetree/bindings/fpga/microchip,mpf-spi-fpga-mgr.yaml
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 6
33 PATCHLEVEL = 4
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc4
5+EXTRAVERSION = -rc5
66 NAME = Hurr durr I'ma ninja sloth
77
88 # *DOCUMENTATION*
arch/arm64/include/asm/kvm_pgtable.h+3−3
@@ -632,9 +632,9 @@ int kvm_pgtable_stage2_flush(struct kvm_pgtable *pgt, u64 addr, u64 size); · 631 unmodified lines
632632 *
633633 * The walker will walk the page-table entries corresponding to the input
634634 * address range specified, visiting entries according to the walker flags.
635− * Invalid entries are treated as leaf entries. Leaf entries are reloaded
636− * after invoking the walker callback, allowing the walker to descend into
637− * a newly installed table.
635+ * Invalid entries are treated as leaf entries. The visited page table entry is
636+ * reloaded after invoking the walker callback, allowing the walker to descend
637+ * into a newly installed table.
638638 *
639639 * Returning a negative error code from the walker callback function will
640640 * terminate the walk immediately with the same error code.
arch/arm64/include/asm/sysreg.h+6−0
@@ -115,8 +115,14 @@ · 114 unmodified lines
115115 #define SB_BARRIER_INSN __SYS_BARRIER_INSN(0, 7, 31)
116116
117117 #define SYS_DC_ISW sys_insn(1, 0, 7, 6, 2)
118+#define SYS_DC_IGSW sys_insn(1, 0, 7, 6, 4)
119+#define SYS_DC_IGDSW sys_insn(1, 0, 7, 6, 6)
118120 #define SYS_DC_CSW sys_insn(1, 0, 7, 10, 2)
121+#define SYS_DC_CGSW sys_insn(1, 0, 7, 10, 4)
122+#define SYS_DC_CGDSW sys_insn(1, 0, 7, 10, 6)
119123 #define SYS_DC_CISW sys_insn(1, 0, 7, 14, 2)
124+#define SYS_DC_CIGSW sys_insn(1, 0, 7, 14, 4)
125+#define SYS_DC_CIGDSW sys_insn(1, 0, 7, 14, 6)
120126
121127 /*
122128 * Automatically generated definitions for system registers, the
arch/arm64/kvm/hyp/include/hyp/switch.h+6−2
@@ -412,17 +412,21 @@ static bool kvm_hyp_handle_cp15_32(struct kvm_vcpu *vcpu, u64 *exit_code) · 411 unmodified lines
412412 return false;
413413 }
414414
415−static bool kvm_hyp_handle_iabt_low(struct kvm_vcpu *vcpu, u64 *exit_code)
415+static bool kvm_hyp_handle_memory_fault(struct kvm_vcpu *vcpu, u64 *exit_code)
416416 {
417417 if (!__populate_fault_info(vcpu))
418418 return true;
419419
420420 return false;
421421 }
422+static bool kvm_hyp_handle_iabt_low(struct kvm_vcpu *vcpu, u64 *exit_code)
423+ __alias(kvm_hyp_handle_memory_fault);
424+static bool kvm_hyp_handle_watchpt_low(struct kvm_vcpu *vcpu, u64 *exit_code)
425+ __alias(kvm_hyp_handle_memory_fault);
422426
423427 static bool kvm_hyp_handle_dabt_low(struct kvm_vcpu *vcpu, u64 *exit_code)
424428 {
425− if (!__populate_fault_info(vcpu))
429+ if (kvm_hyp_handle_memory_fault(vcpu, exit_code))
426430 return true;
427431
428432 if (static_branch_unlikely(&vgic_v2_cpuif_trap)) {
arch/arm64/kvm/hyp/nvhe/mem_protect.c+7−7
@@ -575,7 +575,7 @@ struct pkvm_mem_donation { · 574 unmodified lines
575575
576576 struct check_walk_data {
577577 enum pkvm_page_state desired;
578− enum pkvm_page_state (*get_page_state)(kvm_pte_t pte);
578+ enum pkvm_page_state (*get_page_state)(kvm_pte_t pte, u64 addr);
579579 };
580580
581581 static int __check_page_state_visitor(const struct kvm_pgtable_visit_ctx *ctx,
@@ -583,10 +583,7 @@ static int __check_page_state_visitor(const struct kvm_pgtable_visit_ctx *ctx, · 1 unmodified line
583583 {
584584 struct check_walk_data *d = ctx->arg;
585585
586− if (kvm_pte_valid(ctx->old) && !addr_is_allowed_memory(kvm_pte_to_phys(ctx->old)))
587− return -EINVAL;
588−
589− return d->get_page_state(ctx->old) == d->desired ? 0 : -EPERM;
586+ return d->get_page_state(ctx->old, ctx->addr) == d->desired ? 0 : -EPERM;
590587 }
591588
592589 static int check_page_state_range(struct kvm_pgtable *pgt, u64 addr, u64 size,
@@ -601,8 +598,11 @@ static int check_page_state_range(struct kvm_pgtable *pgt, u64 addr, u64 size, · 8 unmodified lines
601598 return kvm_pgtable_walk(pgt, addr, size, &walker);
602599 }
603600
604−static enum pkvm_page_state host_get_page_state(kvm_pte_t pte)
601+static enum pkvm_page_state host_get_page_state(kvm_pte_t pte, u64 addr)
605602 {
603+ if (!addr_is_allowed_memory(addr))
604+ return PKVM_NOPAGE;
605+
606606 if (!kvm_pte_valid(pte) && pte)
607607 return PKVM_NOPAGE;
608608
@@ -709,7 +709,7 @@ static int host_complete_donation(u64 addr, const struct pkvm_mem_transition *tx · 100 unmodified lines
709709 return host_stage2_set_owner_locked(addr, size, host_id);
710710 }
711711
712−static enum pkvm_page_state hyp_get_page_state(kvm_pte_t pte)
712+static enum pkvm_page_state hyp_get_page_state(kvm_pte_t pte, u64 addr)
713713 {
714714 if (!kvm_pte_valid(pte))
715715 return PKVM_NOPAGE;
arch/arm64/kvm/hyp/nvhe/switch.c+2−0
@@ -186,6 +186,7 @@ static const exit_handler_fn hyp_exit_handlers[] = { · 185 unmodified lines
186186 [ESR_ELx_EC_FP_ASIMD] = kvm_hyp_handle_fpsimd,
187187 [ESR_ELx_EC_IABT_LOW] = kvm_hyp_handle_iabt_low,
188188 [ESR_ELx_EC_DABT_LOW] = kvm_hyp_handle_dabt_low,
189+ [ESR_ELx_EC_WATCHPT_LOW] = kvm_hyp_handle_watchpt_low,
189190 [ESR_ELx_EC_PAC] = kvm_hyp_handle_ptrauth,
190191 };
191192
@@ -196,6 +197,7 @@ static const exit_handler_fn pvm_exit_handlers[] = { · 4 unmodified lines
196197 [ESR_ELx_EC_FP_ASIMD] = kvm_hyp_handle_fpsimd,
197198 [ESR_ELx_EC_IABT_LOW] = kvm_hyp_handle_iabt_low,
198199 [ESR_ELx_EC_DABT_LOW] = kvm_hyp_handle_dabt_low,
200+ [ESR_ELx_EC_WATCHPT_LOW] = kvm_hyp_handle_watchpt_low,
199201 [ESR_ELx_EC_PAC] = kvm_hyp_handle_ptrauth,
200202 };
201203
arch/arm64/kvm/hyp/pgtable.c+16−1
@@ -209,14 +209,26 @@ static inline int __kvm_pgtable_visit(struct kvm_pgtable_walk_data *data, · 208 unmodified lines
209209 .flags = flags,
210210 };
211211 int ret = 0;
212+ bool reload = false;
212213 kvm_pteref_t childp;
213214 bool table = kvm_pte_table(ctx.old, level);
214215
215− if (table && (ctx.flags & KVM_PGTABLE_WALK_TABLE_PRE))
216+ if (table && (ctx.flags & KVM_PGTABLE_WALK_TABLE_PRE)) {
216217 ret = kvm_pgtable_visitor_cb(data, &ctx, KVM_PGTABLE_WALK_TABLE_PRE);
218+ reload = true;
219+ }
217220
218221 if (!table && (ctx.flags & KVM_PGTABLE_WALK_LEAF)) {
219222 ret = kvm_pgtable_visitor_cb(data, &ctx, KVM_PGTABLE_WALK_LEAF);
223+ reload = true;
224+ }
225+
226+ /*
227+ * Reload the page table after invoking the walker callback for leaf
228+ * entries or after pre-order traversal, to allow the walker to descend
229+ * into a newly installed or replaced table.
230+ */
231+ if (reload) {
220232 ctx.old = READ_ONCE(*ptep);
221233 table = kvm_pte_table(ctx.old, level);
222234 }
@@ -1320,4 +1332,7 @@ void kvm_pgtable_stage2_free_removed(struct kvm_pgtable_mm_ops *mm_ops, void *pg · 1097 unmodified lines
13201332 };
13211333
13221334 WARN_ON(__kvm_pgtable_walk(&data, mm_ops, ptep, level + 1));
1335+
1336+ WARN_ON(mm_ops->page_count(pgtable) != 1);
1337+ mm_ops->put_page(pgtable);
13231338 }
arch/arm64/kvm/hyp/vhe/switch.c+1−0
@@ -110,6 +110,7 @@ static const exit_handler_fn hyp_exit_handlers[] = { · 109 unmodified lines
110110 [ESR_ELx_EC_FP_ASIMD] = kvm_hyp_handle_fpsimd,
111111 [ESR_ELx_EC_IABT_LOW] = kvm_hyp_handle_iabt_low,
112112 [ESR_ELx_EC_DABT_LOW] = kvm_hyp_handle_dabt_low,
113+ [ESR_ELx_EC_WATCHPT_LOW] = kvm_hyp_handle_watchpt_low,
113114 [ESR_ELx_EC_PAC] = kvm_hyp_handle_ptrauth,
114115 };
115116
arch/arm64/kvm/pmu-emul.c+23−35
@@ -694,45 +694,23 @@ out_unlock: · 693 unmodified lines
694694
695695 static struct arm_pmu *kvm_pmu_probe_armpmu(void)
696696 {
697− struct perf_event_attr attr = { };
698− struct perf_event *event;
699− struct arm_pmu *pmu = NULL;
700−
701− /*
702− * Create a dummy event that only counts user cycles. As we'll never
703− * leave this function with the event being live, it will never
704− * count anything. But it allows us to probe some of the PMU
705− * details. Yes, this is terrible.
706− */
707− attr.type = PERF_TYPE_RAW;
708− attr.size = sizeof(attr);
709− attr.pinned = 1;
710− attr.disabled = 0;
711− attr.exclude_user = 0;
712− attr.exclude_kernel = 1;
713− attr.exclude_hv = 1;
714− attr.exclude_host = 1;
715− attr.config = ARMV8_PMUV3_PERFCTR_CPU_CYCLES;
716− attr.sample_period = GENMASK(63, 0);
697+ struct arm_pmu *tmp, *pmu = NULL;
698+ struct arm_pmu_entry *entry;
699+ int cpu;
717700
718− event = perf_event_create_kernel_counter(&attr, -1, current,
719− kvm_pmu_perf_overflow, &attr);
701+ mutex_lock(&arm_pmus_lock);
720702
721− if (IS_ERR(event)) {
722− pr_err_once("kvm: pmu event creation failed %ld\n",
723− PTR_ERR(event));
724− return NULL;
725− }
703+ cpu = smp_processor_id();
704+ list_for_each_entry(entry, &arm_pmus, entry) {
705+ tmp = entry->arm_pmu;
726706
727− if (event->pmu) {
728− pmu = to_arm_pmu(event->pmu);
729− if (pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_NI ||
730− pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF)
731− pmu = NULL;
707+ if (cpumask_test_cpu(cpu, &tmp->supported_cpus)) {
708+ pmu = tmp;
709+ break;
710+ }
732711 }
733712
734− perf_event_disable(event);
735− perf_event_release_kernel(event);
713+ mutex_unlock(&arm_pmus_lock);
736714
737715 return pmu;
738716 }
@@ -912,7 +890,17 @@ int kvm_arm_pmu_v3_set_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr) · 173 unmodified lines
912890 return -EBUSY;
913891
914892 if (!kvm->arch.arm_pmu) {
915− /* No PMU set, get the default one */
893+ /*
894+ * No PMU set, get the default one.
895+ *
896+ * The observant among you will notice that the supported_cpus
897+ * mask does not get updated for the default PMU even though it
898+ * is quite possible the selected instance supports only a
899+ * subset of cores in the system. This is intentional, and
900+ * upholds the preexisting behavior on heterogeneous systems
901+ * where vCPUs can be scheduled on any core but the guest
902+ * counters could stop working.
903+ */
916904 kvm->arch.arm_pmu = kvm_pmu_probe_armpmu();
917905 if (!kvm->arch.arm_pmu)
918906 return -ENODEV;
arch/arm64/kvm/sys_regs.c+19−0
@@ -211,6 +211,19 @@ static bool access_dcsw(struct kvm_vcpu *vcpu, · 210 unmodified lines
211211 return true;
212212 }
213213
214+static bool access_dcgsw(struct kvm_vcpu *vcpu,
215+ struct sys_reg_params *p,
216+ const struct sys_reg_desc *r)
217+{
218+ if (!kvm_has_mte(vcpu->kvm)) {
219+ kvm_inject_undefined(vcpu);
220+ return false;
221+ }
222+
223+ /* Treat MTE S/W ops as we treat the classic ones: with contempt */
224+ return access_dcsw(vcpu, p, r);
225+}
226+
214227 static void get_access_mask(const struct sys_reg_desc *r, u64 *mask, u64 *shift)
215228 {
216229 switch (r->aarch32_map) {
@@ -1756,8 +1769,14 @@ static bool access_spsr(struct kvm_vcpu *vcpu, · 1539 unmodified lines
17561769 */
17571770 static const struct sys_reg_desc sys_reg_descs[] = {
17581771 { SYS_DESC(SYS_DC_ISW), access_dcsw },
1772+ { SYS_DESC(SYS_DC_IGSW), access_dcgsw },
1773+ { SYS_DESC(SYS_DC_IGDSW), access_dcgsw },
17591774 { SYS_DESC(SYS_DC_CSW), access_dcsw },
1775+ { SYS_DESC(SYS_DC_CGSW), access_dcgsw },
1776+ { SYS_DESC(SYS_DC_CGDSW), access_dcgsw },
17601777 { SYS_DESC(SYS_DC_CISW), access_dcsw },
1778+ { SYS_DESC(SYS_DC_CIGSW), access_dcgsw },
1779+ { SYS_DESC(SYS_DC_CIGDSW), access_dcgsw },
17611780
17621781 DBG_BCR_BVR_WCR_WVR_EL1(0),
17631782 DBG_BCR_BVR_WCR_WVR_EL1(1),
arch/arm64/kvm/vgic/vgic-init.c+21−6
@@ -235,9 +235,9 @@ int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu) · 234 unmodified lines
235235 * KVM io device for the redistributor that belongs to this VCPU.
236236 */
237237 if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) {
238− mutex_lock(&vcpu->kvm->arch.config_lock);
238+ mutex_lock(&vcpu->kvm->slots_lock);
239239 ret = vgic_register_redist_iodev(vcpu);
240− mutex_unlock(&vcpu->kvm->arch.config_lock);
240+ mutex_unlock(&vcpu->kvm->slots_lock);
241241 }
242242 return ret;
243243 }
@@ -406,7 +406,7 @@ void kvm_vgic_destroy(struct kvm *kvm) · 162 unmodified lines
406406
407407 /**
408408 * vgic_lazy_init: Lazy init is only allowed if the GIC exposed to the guest
409− * is a GICv2. A GICv3 must be explicitly initialized by the guest using the
409+ * is a GICv2. A GICv3 must be explicitly initialized by userspace using the
410410 * KVM_DEV_ARM_VGIC_GRP_CTRL KVM_DEVICE group.
411411 * @kvm: kvm struct pointer
412412 */
@@ -446,11 +446,13 @@ int vgic_lazy_init(struct kvm *kvm) · 33 unmodified lines
446446 int kvm_vgic_map_resources(struct kvm *kvm)
447447 {
448448 struct vgic_dist *dist = &kvm->arch.vgic;
449+ gpa_t dist_base;
449450 int ret = 0;
450451
451452 if (likely(vgic_ready(kvm)))
452453 return 0;
453454
455+ mutex_lock(&kvm->slots_lock);
454456 mutex_lock(&kvm->arch.config_lock);
455457 if (vgic_ready(kvm))
456458 goto out;
@@ -463,13 +465,26 @@ int kvm_vgic_map_resources(struct kvm *kvm) · 6 unmodified lines
463465 else
464466 ret = vgic_v3_map_resources(kvm);
465467
466− if (ret)
468+ if (ret) {
467469 __kvm_vgic_destroy(kvm);
468− else
469− dist->ready = true;
470+ goto out;
471+ }
472+ dist->ready = true;
473+ dist_base = dist->vgic_dist_base;
474+ mutex_unlock(&kvm->arch.config_lock);
475+
476+ ret = vgic_register_dist_iodev(kvm, dist_base,
477+ kvm_vgic_global_state.type);
478+ if (ret) {
479+ kvm_err("Unable to register VGIC dist MMIO regions\n");
480+ kvm_vgic_destroy(kvm);
481+ }
482+ mutex_unlock(&kvm->slots_lock);
483+ return ret;
470484
471485 out:
472486 mutex_unlock(&kvm->arch.config_lock);
487+ mutex_unlock(&kvm->slots_lock);
473488 return ret;
474489 }
475490
arch/arm64/kvm/vgic/vgic-its.c+10−4
@@ -1936,6 +1936,7 @@ void vgic_lpi_translation_cache_destroy(struct kvm *kvm) · 1935 unmodified lines
19361936
19371937 static int vgic_its_create(struct kvm_device *dev, u32 type)
19381938 {
1939+ int ret;
19391940 struct vgic_its *its;
19401941
19411942 if (type != KVM_DEV_TYPE_ARM_VGIC_ITS)
@@ -1945,9 +1946,12 @@ static int vgic_its_create(struct kvm_device *dev, u32 type) · 3 unmodified lines
19451946 if (!its)
19461947 return -ENOMEM;
19471948
1949+ mutex_lock(&dev->kvm->arch.config_lock);
1950+
19481951 if (vgic_initialized(dev->kvm)) {
1949− int ret = vgic_v4_init(dev->kvm);
1952+ ret = vgic_v4_init(dev->kvm);
19501953 if (ret < 0) {
1954+ mutex_unlock(&dev->kvm->arch.config_lock);
19511955 kfree(its);
19521956 return ret;
19531957 }
@@ -1960,12 +1964,10 @@ static int vgic_its_create(struct kvm_device *dev, u32 type) · 6 unmodified lines
19601964
19611965 /* Yep, even more trickery for lock ordering... */
19621966 #ifdef CONFIG_LOCKDEP
1963− mutex_lock(&dev->kvm->arch.config_lock);
19641967 mutex_lock(&its->cmd_lock);
19651968 mutex_lock(&its->its_lock);
19661969 mutex_unlock(&its->its_lock);
19671970 mutex_unlock(&its->cmd_lock);
1968− mutex_unlock(&dev->kvm->arch.config_lock);
19691971 #endif
19701972
19711973 its->vgic_its_base = VGIC_ADDR_UNDEF;
@@ -1986,7 +1988,11 @@ static int vgic_its_create(struct kvm_device *dev, u32 type) · 14 unmodified lines
19861988
19871989 dev->private = its;
19881990
1989− return vgic_its_set_abi(its, NR_ITS_ABIS - 1);
1991+ ret = vgic_its_set_abi(its, NR_ITS_ABIS - 1);
1992+
1993+ mutex_unlock(&dev->kvm->arch.config_lock);
1994+
1995+ return ret;
19901996 }
19911997
19921998 static void vgic_its_destroy(struct kvm_device *kvm_dev)
arch/arm64/kvm/vgic/vgic-kvm-device.c+8−2
@@ -102,7 +102,11 @@ static int kvm_vgic_addr(struct kvm *kvm, struct kvm_device_attr *attr, bool wri · 101 unmodified lines
102102 if (get_user(addr, uaddr))
103103 return -EFAULT;
104104
105− mutex_lock(&kvm->arch.config_lock);
105+ /*
106+ * Since we can't hold config_lock while registering the redistributor
107+ * iodevs, take the slots_lock immediately.
108+ */
109+ mutex_lock(&kvm->slots_lock);
106110 switch (attr->attr) {
107111 case KVM_VGIC_V2_ADDR_TYPE_DIST:
108112 r = vgic_check_type(kvm, KVM_DEV_TYPE_ARM_VGIC_V2);
@@ -182,6 +186,7 @@ static int kvm_vgic_addr(struct kvm *kvm, struct kvm_device_attr *attr, bool wri · 73 unmodified lines
182186 if (r)
183187 goto out;
184188
189+ mutex_lock(&kvm->arch.config_lock);
185190 if (write) {
186191 r = vgic_check_iorange(kvm, *addr_ptr, addr, alignment, size);
187192 if (!r)
@@ -189,9 +194,10 @@ static int kvm_vgic_addr(struct kvm *kvm, struct kvm_device_attr *attr, bool wri · 1 unmodified line
189194 } else {
190195 addr = *addr_ptr;
191196 }
197+ mutex_unlock(&kvm->arch.config_lock);
192198
193199 out:
194− mutex_unlock(&kvm->arch.config_lock);
200+ mutex_unlock(&kvm->slots_lock);
195201
196202 if (!r && !write)
197203 r = put_user(addr, uaddr);
arch/arm64/kvm/vgic/vgic-mmio-v3.c+21−10
@@ -769,10 +769,13 @@ int vgic_register_redist_iodev(struct kvm_vcpu *vcpu) · 768 unmodified lines
769769 struct vgic_io_device *rd_dev = &vcpu->arch.vgic_cpu.rd_iodev;
770770 struct vgic_redist_region *rdreg;
771771 gpa_t rd_base;
772− int ret;
772+ int ret = 0;
773+
774+ lockdep_assert_held(&kvm->slots_lock);
775+ mutex_lock(&kvm->arch.config_lock);
773776
774777 if (!IS_VGIC_ADDR_UNDEF(vgic_cpu->rd_iodev.base_addr))
775− return 0;
778+ goto out_unlock;
776779
777780 /*
778781 * We may be creating VCPUs before having set the base address for the
@@ -782,10 +785,12 @@ int vgic_register_redist_iodev(struct kvm_vcpu *vcpu) · 3 unmodified lines
782785 */
783786 rdreg = vgic_v3_rdist_free_slot(&vgic->rd_regions);
784787 if (!rdreg)
785− return 0;
788+ goto out_unlock;
786789
787− if (!vgic_v3_check_base(kvm))
788− return -EINVAL;
790+ if (!vgic_v3_check_base(kvm)) {
791+ ret = -EINVAL;
792+ goto out_unlock;
793+ }
789794
790795 vgic_cpu->rdreg = rdreg;
791796 vgic_cpu->rdreg_index = rdreg->free_index;
@@ -799,16 +804,20 @@ int vgic_register_redist_iodev(struct kvm_vcpu *vcpu) · 7 unmodified lines
799804 rd_dev->nr_regions = ARRAY_SIZE(vgic_v3_rd_registers);
800805 rd_dev->redist_vcpu = vcpu;
801806
802− mutex_lock(&kvm->slots_lock);
807+ mutex_unlock(&kvm->arch.config_lock);
808+
803809 ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, rd_base,
804810 2 * SZ_64K, &rd_dev->dev);
805− mutex_unlock(&kvm->slots_lock);
806−
807811 if (ret)
808812 return ret;
809813
814+ /* Protected by slots_lock */
810815 rdreg->free_index++;
811816 return 0;
817+
818+out_unlock:
819+ mutex_unlock(&kvm->arch.config_lock);
820+ return ret;
812821 }
813822
814823 static void vgic_unregister_redist_iodev(struct kvm_vcpu *vcpu)
@@ -834,12 +843,10 @@ static int vgic_register_all_redist_iodevs(struct kvm *kvm) · 19 unmodified lines
834843 /* The current c failed, so iterate over the previous ones. */
835844 int i;
836845
837− mutex_lock(&kvm->slots_lock);
838846 for (i = 0; i < c; i++) {
839847 vcpu = kvm_get_vcpu(kvm, i);
840848 vgic_unregister_redist_iodev(vcpu);
841849 }
842− mutex_unlock(&kvm->slots_lock);
843850 }
844851
845852 return ret;
@@ -938,7 +945,9 @@ int vgic_v3_set_redist_base(struct kvm *kvm, u32 index, u64 addr, u32 count) · 92 unmodified lines
938945 {
939946 int ret;
940947
948+ mutex_lock(&kvm->arch.config_lock);
941949 ret = vgic_v3_alloc_redist_region(kvm, index, addr, count);
950+ mutex_unlock(&kvm->arch.config_lock);
942951 if (ret)
943952 return ret;
944953
@@ -950,8 +959,10 @@ int vgic_v3_set_redist_base(struct kvm *kvm, u32 index, u64 addr, u32 count) · 5 unmodified lines
950959 if (ret) {
951960 struct vgic_redist_region *rdreg;
952961
962+ mutex_lock(&kvm->arch.config_lock);
953963 rdreg = vgic_v3_rdist_region_from_index(kvm, index);
954964 vgic_v3_free_redist_region(rdreg);
965+ mutex_unlock(&kvm->arch.config_lock);
955966 return ret;
956967 }
957968
arch/arm64/kvm/vgic/vgic-mmio.c+2−7
@@ -1096,7 +1096,6 @@ int vgic_register_dist_iodev(struct kvm *kvm, gpa_t dist_base_address, · 1095 unmodified lines
10961096 enum vgic_type type)
10971097 {
10981098 struct vgic_io_device *io_device = &kvm->arch.vgic.dist_iodev;
1099− int ret = 0;
11001099 unsigned int len;
11011100
11021101 switch (type) {
@@ -1114,10 +1113,6 @@ int vgic_register_dist_iodev(struct kvm *kvm, gpa_t dist_base_address, · 11 unmodified lines
11141113 io_device->iodev_type = IODEV_DIST;
11151114 io_device->redist_vcpu = NULL;
11161115
1117− mutex_lock(&kvm->slots_lock);
1118− ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, dist_base_address,
1119− len, &io_device->dev);
1120− mutex_unlock(&kvm->slots_lock);
1121−
1122− return ret;
1116+ return kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, dist_base_address,
1117+ len, &io_device->dev);
11231118 }
arch/arm64/kvm/vgic/vgic-v2.c+0−6
@@ -312,12 +312,6 @@ int vgic_v2_map_resources(struct kvm *kvm) · 311 unmodified lines
312312 return ret;
313313 }
314314
315− ret = vgic_register_dist_iodev(kvm, dist->vgic_dist_base, VGIC_V2);
316− if (ret) {
317− kvm_err("Unable to register VGIC MMIO regions\n");
318− return ret;
319− }
320−
321315 if (!static_branch_unlikely(&vgic_v2_cpuif_trap)) {
322316 ret = kvm_phys_addr_ioremap(kvm, dist->vgic_cpu_base,
323317 kvm_vgic_global_state.vcpu_base,
arch/arm64/kvm/vgic/vgic-v3.c+0−7
@@ -539,7 +539,6 @@ int vgic_v3_map_resources(struct kvm *kvm) · 538 unmodified lines
539539 {
540540 struct vgic_dist *dist = &kvm->arch.vgic;
541541 struct kvm_vcpu *vcpu;
542− int ret = 0;
543542 unsigned long c;
544543
545544 kvm_for_each_vcpu(c, vcpu, kvm) {
@@ -569,12 +568,6 @@ int vgic_v3_map_resources(struct kvm *kvm) · 23 unmodified lines
569568 return -EBUSY;
570569 }
571570
572− ret = vgic_register_dist_iodev(kvm, dist->vgic_dist_base, VGIC_V3);
573− if (ret) {
574− kvm_err("Unable to register VGICv3 dist MMIO regions\n");
575− return ret;
576− }
577−
578571 if (kvm_vgic_global_state.has_gicv4_1)
579572 vgic_v4_configure_vsgis(kvm);
580573
arch/arm64/kvm/vgic/vgic-v4.c+2−1
@@ -184,13 +184,14 @@ static void vgic_v4_disable_vsgis(struct kvm_vcpu *vcpu) · 183 unmodified lines
184184 }
185185 }
186186
187−/* Must be called with the kvm lock held */
188187 void vgic_v4_configure_vsgis(struct kvm *kvm)
189188 {
190189 struct vgic_dist *dist = &kvm->arch.vgic;
191190 struct kvm_vcpu *vcpu;
192191 unsigned long i;
193192
193+ lockdep_assert_held(&kvm->arch.config_lock);
194+
194195 kvm_arm_halt_guest(kvm);
195196
196197 kvm_for_each_vcpu(i, vcpu, kvm) {
arch/powerpc/crypto/Makefile+5−5
@@ -22,15 +22,15 @@ sha1-ppc-spe-y := sha1-spe-asm.o sha1-spe-glue.o · 21 unmodified lines
2222 sha256-ppc-spe-y := sha256-spe-asm.o sha256-spe-glue.o
2323 crc32c-vpmsum-y := crc32c-vpmsum_asm.o crc32c-vpmsum_glue.o
2424 crct10dif-vpmsum-y := crct10dif-vpmsum_asm.o crct10dif-vpmsum_glue.o
25−aes-gcm-p10-crypto-y := aes-gcm-p10-glue.o aes-gcm-p10.o ghashp8-ppc.o aesp8-ppc.o
25+aes-gcm-p10-crypto-y := aes-gcm-p10-glue.o aes-gcm-p10.o ghashp10-ppc.o aesp10-ppc.o
2626
2727 quiet_cmd_perl = PERL $@
2828 cmd_perl = $(PERL) $< $(if $(CONFIG_CPU_LITTLE_ENDIAN), linux-ppc64le, linux-ppc64) > $@
2929
30−targets += aesp8-ppc.S ghashp8-ppc.S
30+targets += aesp10-ppc.S ghashp10-ppc.S
3131
32−$(obj)/aesp8-ppc.S $(obj)/ghashp8-ppc.S: $(obj)/%.S: $(src)/%.pl FORCE
32+$(obj)/aesp10-ppc.S $(obj)/ghashp10-ppc.S: $(obj)/%.S: $(src)/%.pl FORCE
3333 $(call if_changed,perl)
3434
35−OBJECT_FILES_NON_STANDARD_aesp8-ppc.o := y
36−OBJECT_FILES_NON_STANDARD_ghashp8-ppc.o := y
35+OBJECT_FILES_NON_STANDARD_aesp10-ppc.o := y
36+OBJECT_FILES_NON_STANDARD_ghashp10-ppc.o := y
arch/powerpc/crypto/aes-gcm-p10-glue.c+9−9
@@ -30,15 +30,15 @@ MODULE_AUTHOR("Danny Tsen <dtsen@linux.ibm.com"); · 29 unmodified lines
3030 MODULE_LICENSE("GPL v2");
3131 MODULE_ALIAS_CRYPTO("aes");
3232
33−asmlinkage int aes_p8_set_encrypt_key(const u8 *userKey, const int bits,
33+asmlinkage int aes_p10_set_encrypt_key(const u8 *userKey, const int bits,
3434 void *key);
35−asmlinkage void aes_p8_encrypt(const u8 *in, u8 *out, const void *key);
35+asmlinkage void aes_p10_encrypt(const u8 *in, u8 *out, const void *key);
3636 asmlinkage void aes_p10_gcm_encrypt(u8 *in, u8 *out, size_t len,
3737 void *rkey, u8 *iv, void *Xi);
3838 asmlinkage void aes_p10_gcm_decrypt(u8 *in, u8 *out, size_t len,
3939 void *rkey, u8 *iv, void *Xi);
4040 asmlinkage void gcm_init_htable(unsigned char htable[256], unsigned char Xi[16]);
41−asmlinkage void gcm_ghash_p8(unsigned char *Xi, unsigned char *Htable,
41+asmlinkage void gcm_ghash_p10(unsigned char *Xi, unsigned char *Htable,
4242 unsigned char *aad, unsigned int alen);
4343
4444 struct aes_key {
@@ -93,7 +93,7 @@ static void set_aad(struct gcm_ctx *gctx, struct Hash_ctx *hash, · 48 unmodified lines
9393 gctx->aadLen = alen;
9494 i = alen & ~0xf;
9595 if (i) {
96− gcm_ghash_p8(nXi, hash->Htable+32, aad, i);
96+ gcm_ghash_p10(nXi, hash->Htable+32, aad, i);
9797 aad += i;
9898 alen -= i;
9999 }
@@ -102,7 +102,7 @@ static void set_aad(struct gcm_ctx *gctx, struct Hash_ctx *hash, · 2 unmodified lines
102102 nXi[i] ^= aad[i];
103103
104104 memset(gctx->aad_hash, 0, 16);
105− gcm_ghash_p8(gctx->aad_hash, hash->Htable+32, nXi, 16);
105+ gcm_ghash_p10(gctx->aad_hash, hash->Htable+32, nXi, 16);
106106 } else {
107107 memcpy(gctx->aad_hash, nXi, 16);
108108 }
@@ -115,7 +115,7 @@ static void gcmp10_init(struct gcm_ctx *gctx, u8 *iv, unsigned char *rdkey, · 6 unmodified lines
115115 {
116116 __be32 counter = cpu_to_be32(1);
117117
118− aes_p8_encrypt(hash->H, hash->H, rdkey);
118+ aes_p10_encrypt(hash->H, hash->H, rdkey);
119119 set_subkey(hash->H);
120120 gcm_init_htable(hash->Htable+32, hash->H);
121121
@@ -126,7 +126,7 @@ static void gcmp10_init(struct gcm_ctx *gctx, u8 *iv, unsigned char *rdkey, · 4 unmodified lines
126126 /*
127127 * Encrypt counter vector as iv tag and increment counter.
128128 */
129− aes_p8_encrypt(iv, gctx->ivtag, rdkey);
129+ aes_p10_encrypt(iv, gctx->ivtag, rdkey);
130130
131131 counter = cpu_to_be32(2);
132132 *((__be32 *)(iv+12)) = counter;
@@ -160,7 +160,7 @@ static void finish_tag(struct gcm_ctx *gctx, struct Hash_ctx *hash, int len) · 27 unmodified lines
160160 /*
161161 * hash (AAD len and len)
162162 */
163− gcm_ghash_p8(hash->Htable, hash->Htable+32, aclen, 16);
163+ gcm_ghash_p10(hash->Htable, hash->Htable+32, aclen, 16);
164164
165165 for (i = 0; i < 16; i++)
166166 hash->Htable[i] ^= gctx->ivtag[i];
@@ -192,7 +192,7 @@ static int p10_aes_gcm_setkey(struct crypto_aead *aead, const u8 *key, · 25 unmodified lines
192192 int ret;
193193
194194 vsx_begin();
195− ret = aes_p8_set_encrypt_key(key, keylen * 8, &ctx->enc_key);
195+ ret = aes_p10_set_encrypt_key(key, keylen * 8, &ctx->enc_key);
196196 vsx_end();
197197
198198 return ret ? -EINVAL : 0;
arch/powerpc/crypto/aesp10-ppc.plrenamed from arch/powerpc/crypto/aesp8-ppc.pl+1−1
@@ -110,7 +110,7 @@ die "can't locate ppc-xlate.pl"; · 109 unmodified lines
110110 open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
111111
112112 $FRAME=8*$SIZE_T;
113−$prefix="aes_p8";
113+$prefix="aes_p10";
114114
115115 $sp="r1";
116116 $vrsave="r12";
arch/powerpc/crypto/ghashp10-ppc.plrenamed from arch/powerpc/crypto/ghashp8-ppc.pl+6−6
@@ -64,7 +64,7 @@ $code=<<___; · 63 unmodified lines
6464
6565 .text
6666
67−.globl .gcm_init_p8
67+.globl .gcm_init_p10
6868 lis r0,0xfff0
6969 li r8,0x10
7070 mfspr $vrsave,256
@@ -110,7 +110,7 @@ $code=<<___; · 39 unmodified lines
110110 .long 0
111111 .byte 0,12,0x14,0,0,0,2,0
112112 .long 0
113−.size .gcm_init_p8,.-.gcm_init_p8
113+.size .gcm_init_p10,.-.gcm_init_p10
114114
115115 .globl .gcm_init_htable
116116 lis r0,0xfff0
@@ -237,7 +237,7 @@ $code=<<___; · 120 unmodified lines
237237 .long 0
238238 .size .gcm_init_htable,.-.gcm_init_htable
239239
240−.globl .gcm_gmult_p8
240+.globl .gcm_gmult_p10
241241 lis r0,0xfff8
242242 li r8,0x10
243243 mfspr $vrsave,256
@@ -283,9 +283,9 @@ $code=<<___; · 39 unmodified lines
283283 .long 0
284284 .byte 0,12,0x14,0,0,0,2,0
285285 .long 0
286−.size .gcm_gmult_p8,.-.gcm_gmult_p8
286+.size .gcm_gmult_p10,.-.gcm_gmult_p10
287287
288−.globl .gcm_ghash_p8
288+.globl .gcm_ghash_p10
289289 lis r0,0xfff8
290290 li r8,0x10
291291 mfspr $vrsave,256
@@ -350,7 +350,7 @@ Loop: · 58 unmodified lines
350350 .long 0
351351 .byte 0,12,0x14,0,0,0,4,0
352352 .long 0
353−.size .gcm_ghash_p8,.-.gcm_ghash_p8
353+.size .gcm_ghash_p10,.-.gcm_ghash_p10
354354
355355 .asciz "GHASH for PowerISA 2.07, CRYPTOGAMS by <appro\@openssl.org>"
356356 .align 2
arch/powerpc/platforms/pseries/iommu.c+11−2
@@ -317,13 +317,22 @@ static void tce_free_pSeriesLP(unsigned long liobn, long tcenum, long tceshift, · 316 unmodified lines
317317 static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages)
318318 {
319319 u64 rc;
320+ long rpages = npages;
321+ unsigned long limit;
320322
321323 if (!firmware_has_feature(FW_FEATURE_STUFF_TCE))
322324 return tce_free_pSeriesLP(tbl->it_index, tcenum,
323325 tbl->it_page_shift, npages);
324326
325− rc = plpar_tce_stuff((u64)tbl->it_index,
326− (u64)tcenum << tbl->it_page_shift, 0, npages);
327+ do {
328+ limit = min_t(unsigned long, rpages, 512);
329+
330+ rc = plpar_tce_stuff((u64)tbl->it_index,
331+ (u64)tcenum << tbl->it_page_shift, 0, limit);
332+
333+ rpages -= limit;
334+ tcenum += limit;
335+ } while (rpages > 0 && !rc);
327336
328337 if (rc && printk_ratelimit()) {
329338 printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n");
arch/powerpc/xmon/xmon.c+1−1
@@ -88,7 +88,7 @@ static unsigned long ndump = 64; · 87 unmodified lines
8888 static unsigned long nidump = 16;
8989 static unsigned long ncsum = 4096;
9090 static int termch;
91−static char tmpstr[128];
91+static char tmpstr[KSYM_NAME_LEN];
9292 static int tracing_enabled;
9393
9494 static long bus_error_jmp[JMP_BUF_LEN];
arch/riscv/Kconfig+4−1
@@ -799,8 +799,11 @@ menu "Power management options" · 798 unmodified lines
799799
800800 source "kernel/power/Kconfig"
801801
802+# Hibernation is only possible on systems where the SBI implementation has
803+# marked its reserved memory as not accessible from, or does not run
804+# from the same memory as, Linux
802805 config ARCH_HIBERNATION_POSSIBLE
803− def_bool y
806+ def_bool NONPORTABLE
804807
805808 config ARCH_HIBERNATION_HEADER
806809 def_bool HIBERNATION
arch/riscv/errata/Makefile+4−0
@@ -1,2 +1,6 @@
1+ifdef CONFIG_RELOCATABLE
2+KBUILD_CFLAGS += -fno-pie
3+endif
4+
15 obj-$(CONFIG_ERRATA_SIFIVE) += sifive/
26 obj-$(CONFIG_ERRATA_THEAD) += thead/
arch/riscv/include/asm/hugetlb.h+3−0
@@ -36,6 +36,9 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma, · 35 unmodified lines
3636 unsigned long addr, pte_t *ptep,
3737 pte_t pte, int dirty);
3838
39+#define __HAVE_ARCH_HUGE_PTEP_GET
40+pte_t huge_ptep_get(pte_t *ptep);
41+
3942 pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags);
4043 #define arch_make_huge_pte arch_make_huge_pte
4144
arch/riscv/include/asm/perf_event.h+7−0
@@ -10,4 +10,11 @@ · 9 unmodified lines
1010
1111 #include <linux/perf_event.h>
1212 #define perf_arch_bpf_user_pt_regs(regs) (struct user_regs_struct *)regs
13+
14+#define perf_arch_fetch_caller_regs(regs, __ip) { \
15+ (regs)->epc = (__ip); \
16+ (regs)->s0 = (unsigned long) __builtin_frame_address(0); \
17+ (regs)->sp = current_stack_pointer; \
18+ (regs)->status = SR_PP; \
19+}
1320 #endif /* _ASM_RISCV_PERF_EVENT_H */
arch/riscv/kernel/Makefile+4−0
@@ -23,6 +23,10 @@ ifdef CONFIG_FTRACE · 22 unmodified lines
2323 CFLAGS_REMOVE_alternative.o = $(CC_FLAGS_FTRACE)
2424 CFLAGS_REMOVE_cpufeature.o = $(CC_FLAGS_FTRACE)
2525 endif
26+ifdef CONFIG_RELOCATABLE
27+CFLAGS_alternative.o += -fno-pie
28+CFLAGS_cpufeature.o += -fno-pie
29+endif
2630 ifdef CONFIG_KASAN
2731 KASAN_SANITIZE_alternative.o := n
2832 KASAN_SANITIZE_cpufeature.o := n
arch/riscv/mm/hugetlbpage.c+29−1
@@ -3,6 +3,30 @@ · 2 unmodified lines
33 #include <linux/err.h>
44
55 #ifdef CONFIG_RISCV_ISA_SVNAPOT
6+pte_t huge_ptep_get(pte_t *ptep)
7+{
8+ unsigned long pte_num;
9+ int i;
10+ pte_t orig_pte = ptep_get(ptep);
11+
12+ if (!pte_present(orig_pte) || !pte_napot(orig_pte))
13+ return orig_pte;
14+
15+ pte_num = napot_pte_num(napot_cont_order(orig_pte));
16+
17+ for (i = 0; i < pte_num; i++, ptep++) {
18+ pte_t pte = ptep_get(ptep);
19+
20+ if (pte_dirty(pte))
21+ orig_pte = pte_mkdirty(orig_pte);
22+
23+ if (pte_young(pte))
24+ orig_pte = pte_mkyoung(orig_pte);
25+ }
26+
27+ return orig_pte;
28+}
29+
630 pte_t *huge_pte_alloc(struct mm_struct *mm,
731 struct vm_area_struct *vma,
832 unsigned long addr,
@@ -218,6 +242,7 @@ void huge_ptep_set_wrprotect(struct mm_struct *mm, · 209 unmodified lines
218242 {
219243 pte_t pte = ptep_get(ptep);
220244 unsigned long order;
245+ pte_t orig_pte;
221246 int i, pte_num;
222247
223248 if (!pte_napot(pte)) {
@@ -228,9 +253,12 @@ void huge_ptep_set_wrprotect(struct mm_struct *mm, · 4 unmodified lines
228253 order = napot_cont_order(pte);
229254 pte_num = napot_pte_num(order);
230255 ptep = huge_pte_offset(mm, addr, napot_cont_size(order));
256+ orig_pte = get_clear_contig_flush(mm, addr, ptep, pte_num);
257+
258+ orig_pte = pte_wrprotect(orig_pte);
231259
232260 for (i = 0; i < pte_num; i++, addr += PAGE_SIZE, ptep++)
233− ptep_set_wrprotect(mm, addr, ptep);
261+ set_pte_at(mm, addr, ptep, orig_pte);
234262 }
235263
236264 pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
arch/riscv/mm/init.c+1−1
@@ -922,9 +922,9 @@ static void __init create_kernel_page_table(pgd_t *pgdir, bool early) · 921 unmodified lines
922922 static void __init create_fdt_early_page_table(uintptr_t fix_fdt_va,
923923 uintptr_t dtb_pa)
924924 {
925+#ifndef CONFIG_BUILTIN_DTB
925926 uintptr_t pa = dtb_pa & ~(PMD_SIZE - 1);
926927
927−#ifndef CONFIG_BUILTIN_DTB
928928 /* Make sure the fdt fixmap address is always aligned on PMD size */
929929 BUILD_BUG_ON(FIX_FDT % (PMD_SIZE / PAGE_SIZE));
930930
arch/x86/kvm/lapic.c+18−2
@@ -228,6 +228,23 @@ static int kvm_recalculate_phys_map(struct kvm_apic_map *new, · 227 unmodified lines
228228 u32 xapic_id = kvm_xapic_id(apic);
229229 u32 physical_id;
230230
231+ /*
232+ * For simplicity, KVM always allocates enough space for all possible
233+ * xAPIC IDs. Yell, but don't kill the VM, as KVM can continue on
234+ * without the optimized map.
235+ */
236+ if (WARN_ON_ONCE(xapic_id > new->max_apic_id))
237+ return -EINVAL;
238+
239+ /*
240+ * Bail if a vCPU was added and/or enabled its APIC between allocating
241+ * the map and doing the actual calculations for the map. Note, KVM
242+ * hardcodes the x2APIC ID to vcpu_id, i.e. there's no TOCTOU bug if
243+ * the compiler decides to reload x2apic_id after this check.
244+ */
245+ if (x2apic_id > new->max_apic_id)
246+ return -E2BIG;
247+
231248 /*
232249 * Deliberately truncate the vCPU ID when detecting a mismatched APIC
233250 * ID to avoid false positives if the vCPU ID, i.e. x2APIC ID, is a
@@ -253,8 +270,7 @@ static int kvm_recalculate_phys_map(struct kvm_apic_map *new, · 19 unmodified lines
253270 */
254271 if (vcpu->kvm->arch.x2apic_format) {
255272 /* See also kvm_apic_match_physical_addr(). */
256− if ((apic_x2apic_mode(apic) || x2apic_id > 0xff) &&
257− x2apic_id <= new->max_apic_id)
273+ if (apic_x2apic_mode(apic) || x2apic_id > 0xff)
258274 new->phys_map[x2apic_id] = apic;
259275
260276 if (!apic_x2apic_mode(apic) && !new->phys_map[xapic_id])
arch/x86/kvm/mmu/mmu.c+4−1
@@ -7091,7 +7091,10 @@ static void kvm_recover_nx_huge_pages(struct kvm *kvm) · 7090 unmodified lines
70917091 */
70927092 slot = NULL;
70937093 if (atomic_read(&kvm->nr_memslots_dirty_logging)) {
7094− slot = gfn_to_memslot(kvm, sp->gfn);
7094+ struct kvm_memslots *slots;
7095+
7096+ slots = kvm_memslots_for_spte_role(kvm, sp->role);
7097+ slot = __gfn_to_memslot(slots, sp->gfn);
70957098 WARN_ON_ONCE(!slot);
70967099 }
70977100
arch/x86/kvm/svm/svm.c+1−1
@@ -3510,7 +3510,7 @@ static bool svm_is_vnmi_pending(struct kvm_vcpu *vcpu) · 3509 unmodified lines
35103510 if (!is_vnmi_enabled(svm))
35113511 return false;
35123512
3513− return !!(svm->vmcb->control.int_ctl & V_NMI_BLOCKING_MASK);
3513+ return !!(svm->vmcb->control.int_ctl & V_NMI_PENDING_MASK);
35143514 }
35153515
35163516 static bool svm_set_vnmi_pending(struct kvm_vcpu *vcpu)
arch/x86/kvm/x86.c+3−0
@@ -10758,6 +10758,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 10757 unmodified lines
1075810758 exit_fastpath = EXIT_FASTPATH_EXIT_HANDLED;
1075910759 break;
1076010760 }
10761+
10762+ /* Note, VM-Exits that go down the "slow" path are accounted below. */
10763+ ++vcpu->stat.exits;
1076110764 }
1076210765
1076310766 /*
block/blk-settings.c+2−1
@@ -915,6 +915,7 @@ static bool disk_has_partitions(struct gendisk *disk) · 914 unmodified lines
915915 void disk_set_zoned(struct gendisk *disk, enum blk_zoned_model model)
916916 {
917917 struct request_queue *q = disk->queue;
918+ unsigned int old_model = q->limits.zoned;
918919
919920 switch (model) {
920921 case BLK_ZONED_HM:
@@ -952,7 +953,7 @@ void disk_set_zoned(struct gendisk *disk, enum blk_zoned_model model) · 31 unmodified lines
952953 */
953954 blk_queue_zone_write_granularity(q,
954955 queue_logical_block_size(q));
955− } else {
956+ } else if (old_model != BLK_ZONED_NONE) {
956957 disk_clear_zone_settings(disk);
957958 }
958959 }
crypto/asymmetric_keys/public_key.c+21−17
@@ -380,9 +380,10 @@ int public_key_verify_signature(const struct public_key *pkey, · 379 unmodified lines
380380 struct crypto_wait cwait;
381381 struct crypto_akcipher *tfm;
382382 struct akcipher_request *req;
383− struct scatterlist src_sg[2];
383+ struct scatterlist src_sg;
384384 char alg_name[CRYPTO_MAX_ALG_NAME];
385− char *key, *ptr;
385+ char *buf, *ptr;
386+ size_t buf_len;
386387 int ret;
387388
388389 pr_devel("==>%s()\n", __func__);
@@ -420,34 +421,37 @@ int public_key_verify_signature(const struct public_key *pkey, · 31 unmodified lines
420421 if (!req)
421422 goto error_free_tfm;
422423
423− key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen,
424− GFP_KERNEL);
425− if (!key)
424+ buf_len = max_t(size_t, pkey->keylen + sizeof(u32) * 2 + pkey->paramlen,
425+ sig->s_size + sig->digest_size);
426+
427+ buf = kmalloc(buf_len, GFP_KERNEL);
428+ if (!buf)
426429 goto error_free_req;
427430
428− memcpy(key, pkey->key, pkey->keylen);
429− ptr = key + pkey->keylen;
431+ memcpy(buf, pkey->key, pkey->keylen);
432+ ptr = buf + pkey->keylen;
430433 ptr = pkey_pack_u32(ptr, pkey->algo);
431434 ptr = pkey_pack_u32(ptr, pkey->paramlen);
432435 memcpy(ptr, pkey->params, pkey->paramlen);
433436
434437 if (pkey->key_is_private)
435− ret = crypto_akcipher_set_priv_key(tfm, key, pkey->keylen);
438+ ret = crypto_akcipher_set_priv_key(tfm, buf, pkey->keylen);
436439 else
437− ret = crypto_akcipher_set_pub_key(tfm, key, pkey->keylen);
440+ ret = crypto_akcipher_set_pub_key(tfm, buf, pkey->keylen);
438441 if (ret)
439− goto error_free_key;
442+ goto error_free_buf;
440443
441444 if (strcmp(pkey->pkey_algo, "sm2") == 0 && sig->data_size) {
442445 ret = cert_sig_digest_update(sig, tfm);
443446 if (ret)
444− goto error_free_key;
447+ goto error_free_buf;
445448 }
446449
447− sg_init_table(src_sg, 2);
448− sg_set_buf(&src_sg[0], sig->s, sig->s_size);
449− sg_set_buf(&src_sg[1], sig->digest, sig->digest_size);
450− akcipher_request_set_crypt(req, src_sg, NULL, sig->s_size,
450+ memcpy(buf, sig->s, sig->s_size);
451+ memcpy(buf + sig->s_size, sig->digest, sig->digest_size);
452+
453+ sg_init_one(&src_sg, buf, sig->s_size + sig->digest_size);
454+ akcipher_request_set_crypt(req, &src_sg, NULL, sig->s_size,
451455 sig->digest_size);
452456 crypto_init_wait(&cwait);
453457 akcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG |
@@ -455,8 +459,8 @@ int public_key_verify_signature(const struct public_key *pkey, · 1 unmodified line
455459 crypto_req_done, &cwait);
456460 ret = crypto_wait_req(crypto_akcipher_verify(req), &cwait);
457461
458−error_free_key:
459− kfree(key);
462+error_free_buf:
463+ kfree(buf);
460464 error_free_req:
461465 akcipher_request_free(req);
462466 error_free_tfm:
drivers/acpi/apei/apei-internal.h+0−6
@@ -7,7 +7,6 @@ · 6 unmodified lines
77 #ifndef APEI_INTERNAL_H
88 #define APEI_INTERNAL_H
99
10−#include <linux/cper.h>
1110 #include <linux/acpi.h>
1211
1312 struct apei_exec_context;
@@ -130,10 +129,5 @@ static inline u32 cper_estatus_len(struct acpi_hest_generic_status *estatus) · 116 unmodified lines
130129 return sizeof(*estatus) + estatus->data_length;
131130 }
132131
133−void cper_estatus_print(const char *pfx,
134− const struct acpi_hest_generic_status *estatus);
135−int cper_estatus_check_header(const struct acpi_hest_generic_status *estatus);
136−int cper_estatus_check(const struct acpi_hest_generic_status *estatus);
137−
138132 int apei_osc_setup(void);
139133 #endif
drivers/acpi/apei/bert.c+1−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #include <linux/module.h>
2424 #include <linux/init.h>
2525 #include <linux/acpi.h>
26+#include <linux/cper.h>
2627 #include <linux/io.h>
2728
2829 #include "apei-internal.h"
drivers/base/cacheinfo.c+26−0
@@ -388,6 +388,16 @@ static int cache_shared_cpu_map_setup(unsigned int cpu) · 387 unmodified lines
388388 continue;/* skip if itself or no cacheinfo */
389389 for (sib_index = 0; sib_index < cache_leaves(i); sib_index++) {
390390 sib_leaf = per_cpu_cacheinfo_idx(i, sib_index);
391+
392+ /*
393+ * Comparing cache IDs only makes sense if the leaves
394+ * belong to the same cache level of same type. Skip
395+ * the check if level and type do not match.
396+ */
397+ if (sib_leaf->level != this_leaf->level ||
398+ sib_leaf->type != this_leaf->type)
399+ continue;
400+
391401 if (cache_leaves_are_shared(this_leaf, sib_leaf)) {
392402 cpumask_set_cpu(cpu, &sib_leaf->shared_cpu_map);
393403 cpumask_set_cpu(i, &this_leaf->shared_cpu_map);
@@ -400,11 +410,14 @@ static int cache_shared_cpu_map_setup(unsigned int cpu) · 6 unmodified lines
400410 coherency_max_size = this_leaf->coherency_line_size;
401411 }
402412
413+ /* shared_cpu_map is now populated for the cpu */
414+ this_cpu_ci->cpu_map_populated = true;
403415 return 0;
404416 }
405417
406418 static void cache_shared_cpu_map_remove(unsigned int cpu)
407419 {
420+ struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
408421 struct cacheinfo *this_leaf, *sib_leaf;
409422 unsigned int sibling, index, sib_index;
410423
@@ -419,6 +432,16 @@ static void cache_shared_cpu_map_remove(unsigned int cpu) · 8 unmodified lines
419432
420433 for (sib_index = 0; sib_index < cache_leaves(sibling); sib_index++) {
421434 sib_leaf = per_cpu_cacheinfo_idx(sibling, sib_index);
435+
436+ /*
437+ * Comparing cache IDs only makes sense if the leaves
438+ * belong to the same cache level of same type. Skip
439+ * the check if level and type do not match.
440+ */
441+ if (sib_leaf->level != this_leaf->level ||
442+ sib_leaf->type != this_leaf->type)
443+ continue;
444+
422445 if (cache_leaves_are_shared(this_leaf, sib_leaf)) {
423446 cpumask_clear_cpu(cpu, &sib_leaf->shared_cpu_map);
424447 cpumask_clear_cpu(sibling, &this_leaf->shared_cpu_map);
@@ -427,6 +450,9 @@ static void cache_shared_cpu_map_remove(unsigned int cpu) · 2 unmodified lines
427450 }
428451 }
429452 }
453+
454+ /* cpu is no longer populated in the shared map */
455+ this_cpu_ci->cpu_map_populated = false;
430456 }
431457
432458 static void free_cache_attributes(unsigned int cpu)
drivers/base/firmware_loader/main.c+1−1
@@ -812,7 +812,7 @@ static void fw_log_firmware_info(const struct firmware *fw, const char *name, st · 811 unmodified lines
812812 char *outbuf;
813813
814814 alg = crypto_alloc_shash("sha256", 0, 0);
815− if (!alg)
815+ if (IS_ERR(alg))
816816 return;
817817
818818 sha256buf = kmalloc(SHA256_DIGEST_SIZE, GFP_KERNEL);
drivers/bluetooth/hci_qca.c+5−1
@@ -78,7 +78,8 @@ enum qca_flags { · 77 unmodified lines
7878 QCA_HW_ERROR_EVENT,
7979 QCA_SSR_TRIGGERED,
8080 QCA_BT_OFF,
81− QCA_ROM_FW
81+ QCA_ROM_FW,
82+ QCA_DEBUGFS_CREATED,
8283 };
8384
8485 enum qca_capabilities {
@@ -635,6 +636,9 @@ static void qca_debugfs_init(struct hci_dev *hdev) · 550 unmodified lines
635636 if (!hdev->debugfs)
636637 return;
637638
639+ if (test_and_set_bit(QCA_DEBUGFS_CREATED, &qca->flags))
640+ return;
641+
638642 ibs_dir = debugfs_create_dir("ibs", hdev->debugfs);
639643
640644 /* read only */
drivers/char/tpm/tpm_tis_core.h+4−4
@@ -84,10 +84,10 @@ enum tis_defaults { · 83 unmodified lines
8484 #define ILB_REMAP_SIZE 0x100
8585
8686 enum tpm_tis_flags {
87− TPM_TIS_ITPM_WORKAROUND = BIT(0),
88− TPM_TIS_INVALID_STATUS = BIT(1),
89− TPM_TIS_DEFAULT_CANCELLATION = BIT(2),
90− TPM_TIS_IRQ_TESTED = BIT(3),
87+ TPM_TIS_ITPM_WORKAROUND = 0,
88+ TPM_TIS_INVALID_STATUS = 1,
89+ TPM_TIS_DEFAULT_CANCELLATION = 2,
90+ TPM_TIS_IRQ_TESTED = 3,
9191 };
9292
9393 struct tpm_tis_data {
drivers/firmware/efi/libstub/Makefile.zboot+2−1
@@ -32,7 +32,8 @@ zboot-size-len-$(CONFIG_KERNEL_GZIP) := 0 · 31 unmodified lines
3232 $(obj)/vmlinuz: $(obj)/vmlinux.bin FORCE
3333 $(call if_changed,$(zboot-method-y))
3434
35−OBJCOPYFLAGS_vmlinuz.o := -I binary -O $(EFI_ZBOOT_BFD_TARGET) $(EFI_ZBOOT_OBJCOPY_FLAGS) \
35+# avoid eager evaluation to prevent references to non-existent build artifacts
36+OBJCOPYFLAGS_vmlinuz.o = -I binary -O $(EFI_ZBOOT_BFD_TARGET) $(EFI_ZBOOT_OBJCOPY_FLAGS) \
3637 --rename-section .data=.gzdata,load,alloc,readonly,contents
3738 $(obj)/vmlinuz.o: $(obj)/vmlinuz FORCE
3839 $(call if_changed,objcopy)
drivers/firmware/efi/libstub/efistub.h+3−0
@@ -1133,4 +1133,7 @@ const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record, · 1132 unmodified lines
11331133 void efi_remap_image(unsigned long image_base, unsigned alloc_size,
11341134 unsigned long code_size);
11351135
1136+asmlinkage efi_status_t __efiapi
1137+efi_zboot_entry(efi_handle_t handle, efi_system_table_t *systab);
1138+
11361139 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c+2−1
@@ -593,6 +593,8 @@ void amdgpu_gmc_tmz_set(struct amdgpu_device *adev) · 592 unmodified lines
593593 case IP_VERSION(9, 3, 0):
594594 /* GC 10.3.7 */
595595 case IP_VERSION(10, 3, 7):
596+ /* GC 11.0.1 */
597+ case IP_VERSION(11, 0, 1):
596598 if (amdgpu_tmz == 0) {
597599 adev->gmc.tmz_enabled = false;
598600 dev_info(adev->dev,
@@ -616,7 +618,6 @@ void amdgpu_gmc_tmz_set(struct amdgpu_device *adev) · 17 unmodified lines
616618 case IP_VERSION(10, 3, 1):
617619 /* YELLOW_CARP*/
618620 case IP_VERSION(10, 3, 3):
619− case IP_VERSION(11, 0, 1):
620621 case IP_VERSION(11, 0, 4):
621622 /* Don't enable it by default yet.
622623 */
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c+26−1
@@ -241,6 +241,31 @@ int amdgpu_jpeg_process_poison_irq(struct amdgpu_device *adev, · 240 unmodified lines
241241 return 0;
242242 }
243243
244+int amdgpu_jpeg_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block)
245+{
246+ int r, i;
247+
248+ r = amdgpu_ras_block_late_init(adev, ras_block);
249+ if (r)
250+ return r;
251+
252+ if (amdgpu_ras_is_supported(adev, ras_block->block)) {
253+ for (i = 0; i < adev->jpeg.num_jpeg_inst; ++i) {
254+ if (adev->jpeg.harvest_config & (1 << i))
255+ continue;
256+
257+ r = amdgpu_irq_get(adev, &adev->jpeg.inst[i].ras_poison_irq, 0);
258+ if (r)
259+ goto late_fini;
260+ }
261+ }
262+ return 0;
263+
264+late_fini:
265+ amdgpu_ras_block_late_fini(adev, ras_block);
266+ return r;
267+}
268+
244269 int amdgpu_jpeg_ras_sw_init(struct amdgpu_device *adev)
245270 {
246271 int err;
@@ -262,7 +287,7 @@ int amdgpu_jpeg_ras_sw_init(struct amdgpu_device *adev) · 15 unmodified lines
262287 adev->jpeg.ras_if = &ras->ras_block.ras_comm;
263288
264289 if (!ras->ras_block.ras_late_init)
265− ras->ras_block.ras_late_init = amdgpu_ras_block_late_init;
290+ ras->ras_block.ras_late_init = amdgpu_jpeg_ras_late_init;
266291
267292 return 0;
268293 }
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.h+3−0
@@ -38,6 +38,7 @@ struct amdgpu_jpeg_reg{ · 37 unmodified lines
3838 struct amdgpu_jpeg_inst {
3939 struct amdgpu_ring ring_dec;
4040 struct amdgpu_irq_src irq;
41+ struct amdgpu_irq_src ras_poison_irq;
4142 struct amdgpu_jpeg_reg external;
4243 };
4344
@@ -72,6 +73,8 @@ int amdgpu_jpeg_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout); · 28 unmodified lines
7273 int amdgpu_jpeg_process_poison_irq(struct amdgpu_device *adev,
7374 struct amdgpu_irq_src *source,
7475 struct amdgpu_iv_entry *entry);
76+int amdgpu_jpeg_ras_late_init(struct amdgpu_device *adev,
77+ struct ras_common_if *ras_block);
7578 int amdgpu_jpeg_ras_sw_init(struct amdgpu_device *adev);
7679
7780 #endif /*__AMDGPU_JPEG_H__*/
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c+26−1
@@ -1181,6 +1181,31 @@ int amdgpu_vcn_process_poison_irq(struct amdgpu_device *adev, · 1180 unmodified lines
11811181 return 0;
11821182 }
11831183
1184+int amdgpu_vcn_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block)
1185+{
1186+ int r, i;
1187+
1188+ r = amdgpu_ras_block_late_init(adev, ras_block);
1189+ if (r)
1190+ return r;
1191+
1192+ if (amdgpu_ras_is_supported(adev, ras_block->block)) {
1193+ for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
1194+ if (adev->vcn.harvest_config & (1 << i))
1195+ continue;
1196+
1197+ r = amdgpu_irq_get(adev, &adev->vcn.inst[i].ras_poison_irq, 0);
1198+ if (r)
1199+ goto late_fini;
1200+ }
1201+ }
1202+ return 0;
1203+
1204+late_fini:
1205+ amdgpu_ras_block_late_fini(adev, ras_block);
1206+ return r;
1207+}
1208+
11841209 int amdgpu_vcn_ras_sw_init(struct amdgpu_device *adev)
11851210 {
11861211 int err;
@@ -1202,7 +1227,7 @@ int amdgpu_vcn_ras_sw_init(struct amdgpu_device *adev) · 15 unmodified lines
12021227 adev->vcn.ras_if = &ras->ras_block.ras_comm;
12031228
12041229 if (!ras->ras_block.ras_late_init)
1205− ras->ras_block.ras_late_init = amdgpu_ras_block_late_init;
1230+ ras->ras_block.ras_late_init = amdgpu_vcn_ras_late_init;
12061231
12071232 return 0;
12081233 }
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h+3−0
@@ -234,6 +234,7 @@ struct amdgpu_vcn_inst { · 233 unmodified lines
234234 struct amdgpu_ring ring_enc[AMDGPU_VCN_MAX_ENC_RINGS];
235235 atomic_t sched_score;
236236 struct amdgpu_irq_src irq;
237+ struct amdgpu_irq_src ras_poison_irq;
237238 struct amdgpu_vcn_reg external;
238239 struct amdgpu_bo *dpg_sram_bo;
239240 struct dpg_pause_state pause_state;
@@ -400,6 +401,8 @@ void amdgpu_debugfs_vcn_fwlog_init(struct amdgpu_device *adev, · 160 unmodified lines
400401 int amdgpu_vcn_process_poison_irq(struct amdgpu_device *adev,
401402 struct amdgpu_irq_src *source,
402403 struct amdgpu_iv_entry *entry);
404+int amdgpu_vcn_ras_late_init(struct amdgpu_device *adev,
405+ struct ras_common_if *ras_block);
403406 int amdgpu_vcn_ras_sw_init(struct amdgpu_device *adev);
404407
405408 #endif
drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c+22−6
@@ -102,13 +102,13 @@ static int jpeg_v2_5_sw_init(void *handle) · 101 unmodified lines
102102
103103 /* JPEG DJPEG POISON EVENT */
104104 r = amdgpu_irq_add_id(adev, amdgpu_ih_clientid_jpeg[i],
105− VCN_2_6__SRCID_DJPEG0_POISON, &adev->jpeg.inst[i].irq);
105+ VCN_2_6__SRCID_DJPEG0_POISON, &adev->jpeg.inst[i].ras_poison_irq);
106106 if (r)
107107 return r;
108108
109109 /* JPEG EJPEG POISON EVENT */
110110 r = amdgpu_irq_add_id(adev, amdgpu_ih_clientid_jpeg[i],
111− VCN_2_6__SRCID_EJPEG0_POISON, &adev->jpeg.inst[i].irq);
111+ VCN_2_6__SRCID_EJPEG0_POISON, &adev->jpeg.inst[i].ras_poison_irq);
112112 if (r)
113113 return r;
114114 }
@@ -221,6 +221,9 @@ static int jpeg_v2_5_hw_fini(void *handle) · 106 unmodified lines
221221 if (adev->jpeg.cur_state != AMD_PG_STATE_GATE &&
222222 RREG32_SOC15(JPEG, i, mmUVD_JRBC_STATUS))
223223 jpeg_v2_5_set_powergating_state(adev, AMD_PG_STATE_GATE);
224+
225+ if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__JPEG))
226+ amdgpu_irq_put(adev, &adev->jpeg.inst[i].ras_poison_irq, 0);
224227 }
225228
226229 return 0;
@@ -569,6 +572,14 @@ static int jpeg_v2_5_set_interrupt_state(struct amdgpu_device *adev, · 342 unmodified lines
569572 return 0;
570573 }
571574
575+static int jpeg_v2_6_set_ras_interrupt_state(struct amdgpu_device *adev,
576+ struct amdgpu_irq_src *source,
577+ unsigned int type,
578+ enum amdgpu_interrupt_state state)
579+{
580+ return 0;
581+}
582+
572583 static int jpeg_v2_5_process_interrupt(struct amdgpu_device *adev,
573584 struct amdgpu_irq_src *source,
574585 struct amdgpu_iv_entry *entry)
@@ -593,10 +604,6 @@ static int jpeg_v2_5_process_interrupt(struct amdgpu_device *adev, · 18 unmodified lines
593604 case VCN_2_0__SRCID__JPEG_DECODE:
594605 amdgpu_fence_process(&adev->jpeg.inst[ip_instance].ring_dec);
595606 break;
596− case VCN_2_6__SRCID_DJPEG0_POISON:
597− case VCN_2_6__SRCID_EJPEG0_POISON:
598− amdgpu_jpeg_process_poison_irq(adev, source, entry);
599− break;
600607 default:
601608 DRM_ERROR("Unhandled interrupt: %d %d\n",
602609 entry->src_id, entry->src_data[0]);
@@ -725,6 +732,11 @@ static const struct amdgpu_irq_src_funcs jpeg_v2_5_irq_funcs = { · 122 unmodified lines
725732 .process = jpeg_v2_5_process_interrupt,
726733 };
727734
735+static const struct amdgpu_irq_src_funcs jpeg_v2_6_ras_irq_funcs = {
736+ .set = jpeg_v2_6_set_ras_interrupt_state,
737+ .process = amdgpu_jpeg_process_poison_irq,
738+};
739+
728740 static void jpeg_v2_5_set_irq_funcs(struct amdgpu_device *adev)
729741 {
730742 int i;
@@ -735,6 +747,9 @@ static void jpeg_v2_5_set_irq_funcs(struct amdgpu_device *adev) · 4 unmodified lines
735747
736748 adev->jpeg.inst[i].irq.num_types = 1;
737749 adev->jpeg.inst[i].irq.funcs = &jpeg_v2_5_irq_funcs;
750+
751+ adev->jpeg.inst[i].ras_poison_irq.num_types = 1;
752+ adev->jpeg.inst[i].ras_poison_irq.funcs = &jpeg_v2_6_ras_irq_funcs;
738753 }
739754 }
740755
@@ -800,6 +815,7 @@ const struct amdgpu_ras_block_hw_ops jpeg_v2_6_ras_hw_ops = { · 59 unmodified lines
800815 static struct amdgpu_jpeg_ras jpeg_v2_6_ras = {
801816 .ras_block = {
802817 .hw_ops = &jpeg_v2_6_ras_hw_ops,
818+ .ras_late_init = amdgpu_jpeg_ras_late_init,
803819 },
804820 };
805821
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c+21−7
@@ -87,13 +87,13 @@ static int jpeg_v4_0_sw_init(void *handle) · 86 unmodified lines
8787
8888 /* JPEG DJPEG POISON EVENT */
8989 r = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_VCN,
90− VCN_4_0__SRCID_DJPEG0_POISON, &adev->jpeg.inst->irq);
90+ VCN_4_0__SRCID_DJPEG0_POISON, &adev->jpeg.inst->ras_poison_irq);
9191 if (r)
9292 return r;
9393
9494 /* JPEG EJPEG POISON EVENT */
9595 r = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_VCN,
96− VCN_4_0__SRCID_EJPEG0_POISON, &adev->jpeg.inst->irq);
96+ VCN_4_0__SRCID_EJPEG0_POISON, &adev->jpeg.inst->ras_poison_irq);
9797 if (r)
9898 return r;
9999
@@ -202,7 +202,8 @@ static int jpeg_v4_0_hw_fini(void *handle) · 102 unmodified lines
202202 RREG32_SOC15(JPEG, 0, regUVD_JRBC_STATUS))
203203 jpeg_v4_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
204204 }
205− amdgpu_irq_put(adev, &adev->jpeg.inst->irq, 0);
205+ if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__JPEG))
206+ amdgpu_irq_put(adev, &adev->jpeg.inst->ras_poison_irq, 0);
206207
207208 return 0;
208209 }
@@ -670,6 +671,14 @@ static int jpeg_v4_0_set_interrupt_state(struct amdgpu_device *adev, · 461 unmodified lines
670671 return 0;
671672 }
672673
674+static int jpeg_v4_0_set_ras_interrupt_state(struct amdgpu_device *adev,
675+ struct amdgpu_irq_src *source,
676+ unsigned int type,
677+ enum amdgpu_interrupt_state state)
678+{
679+ return 0;
680+}
681+
673682 static int jpeg_v4_0_process_interrupt(struct amdgpu_device *adev,
674683 struct amdgpu_irq_src *source,
675684 struct amdgpu_iv_entry *entry)
@@ -680,10 +689,6 @@ static int jpeg_v4_0_process_interrupt(struct amdgpu_device *adev, · 4 unmodified lines
680689 case VCN_4_0__SRCID__JPEG_DECODE:
681690 amdgpu_fence_process(&adev->jpeg.inst->ring_dec);
682691 break;
683− case VCN_4_0__SRCID_DJPEG0_POISON:
684− case VCN_4_0__SRCID_EJPEG0_POISON:
685− amdgpu_jpeg_process_poison_irq(adev, source, entry);
686− break;
687692 default:
688693 DRM_DEV_ERROR(adev->dev, "Unhandled interrupt: %d %d\n",
689694 entry->src_id, entry->src_data[0]);
@@ -753,10 +758,18 @@ static const struct amdgpu_irq_src_funcs jpeg_v4_0_irq_funcs = { · 63 unmodified lines
753758 .process = jpeg_v4_0_process_interrupt,
754759 };
755760
761+static const struct amdgpu_irq_src_funcs jpeg_v4_0_ras_irq_funcs = {
762+ .set = jpeg_v4_0_set_ras_interrupt_state,
763+ .process = amdgpu_jpeg_process_poison_irq,
764+};
765+
756766 static void jpeg_v4_0_set_irq_funcs(struct amdgpu_device *adev)
757767 {
758768 adev->jpeg.inst->irq.num_types = 1;
759769 adev->jpeg.inst->irq.funcs = &jpeg_v4_0_irq_funcs;
770+
771+ adev->jpeg.inst->ras_poison_irq.num_types = 1;
772+ adev->jpeg.inst->ras_poison_irq.funcs = &jpeg_v4_0_ras_irq_funcs;
760773 }
761774
762775 const struct amdgpu_ip_block_version jpeg_v4_0_ip_block = {
@@ -811,6 +824,7 @@ const struct amdgpu_ras_block_hw_ops jpeg_v4_0_ras_hw_ops = { · 48 unmodified lines
811824 static struct amdgpu_jpeg_ras jpeg_v4_0_ras = {
812825 .ras_block = {
813826 .hw_ops = &jpeg_v4_0_ras_hw_ops,
827+ .ras_late_init = amdgpu_jpeg_ras_late_init,
814828 },
815829 };
816830
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c+21−4
@@ -143,7 +143,7 @@ static int vcn_v2_5_sw_init(void *handle) · 142 unmodified lines
143143
144144 /* VCN POISON TRAP */
145145 r = amdgpu_irq_add_id(adev, amdgpu_ih_clientid_vcns[j],
146− VCN_2_6__SRCID_UVD_POISON, &adev->vcn.inst[j].irq);
146+ VCN_2_6__SRCID_UVD_POISON, &adev->vcn.inst[j].ras_poison_irq);
147147 if (r)
148148 return r;
149149 }
@@ -354,6 +354,9 @@ static int vcn_v2_5_hw_fini(void *handle) · 204 unmodified lines
354354 (adev->vcn.cur_state != AMD_PG_STATE_GATE &&
355355 RREG32_SOC15(VCN, i, mmUVD_STATUS)))
356356 vcn_v2_5_set_powergating_state(adev, AMD_PG_STATE_GATE);
357+
358+ if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__VCN))
359+ amdgpu_irq_put(adev, &adev->vcn.inst[i].ras_poison_irq, 0);
357360 }
358361
359362 return 0;
@@ -1807,6 +1810,14 @@ static int vcn_v2_5_set_interrupt_state(struct amdgpu_device *adev, · 1447 unmodified lines
18071810 return 0;
18081811 }
18091812
1813+static int vcn_v2_6_set_ras_interrupt_state(struct amdgpu_device *adev,
1814+ struct amdgpu_irq_src *source,
1815+ unsigned int type,
1816+ enum amdgpu_interrupt_state state)
1817+{
1818+ return 0;
1819+}
1820+
18101821 static int vcn_v2_5_process_interrupt(struct amdgpu_device *adev,
18111822 struct amdgpu_irq_src *source,
18121823 struct amdgpu_iv_entry *entry)
@@ -1837,9 +1848,6 @@ static int vcn_v2_5_process_interrupt(struct amdgpu_device *adev, · 24 unmodified lines
18371848 case VCN_2_0__SRCID__UVD_ENC_LOW_LATENCY:
18381849 amdgpu_fence_process(&adev->vcn.inst[ip_instance].ring_enc[1]);
18391850 break;
1840− case VCN_2_6__SRCID_UVD_POISON:
1841− amdgpu_vcn_process_poison_irq(adev, source, entry);
1842− break;
18431851 default:
18441852 DRM_ERROR("Unhandled interrupt: %d %d\n",
18451853 entry->src_id, entry->src_data[0]);
@@ -1854,6 +1862,11 @@ static const struct amdgpu_irq_src_funcs vcn_v2_5_irq_funcs = { · 8 unmodified lines
18541862 .process = vcn_v2_5_process_interrupt,
18551863 };
18561864
1865+static const struct amdgpu_irq_src_funcs vcn_v2_6_ras_irq_funcs = {
1866+ .set = vcn_v2_6_set_ras_interrupt_state,
1867+ .process = amdgpu_vcn_process_poison_irq,
1868+};
1869+
18571870 static void vcn_v2_5_set_irq_funcs(struct amdgpu_device *adev)
18581871 {
18591872 int i;
@@ -1863,6 +1876,9 @@ static void vcn_v2_5_set_irq_funcs(struct amdgpu_device *adev) · 3 unmodified lines
18631876 continue;
18641877 adev->vcn.inst[i].irq.num_types = adev->vcn.num_enc_rings + 1;
18651878 adev->vcn.inst[i].irq.funcs = &vcn_v2_5_irq_funcs;
1879+
1880+ adev->vcn.inst[i].ras_poison_irq.num_types = adev->vcn.num_enc_rings + 1;
1881+ adev->vcn.inst[i].ras_poison_irq.funcs = &vcn_v2_6_ras_irq_funcs;
18661882 }
18671883 }
18681884
@@ -1965,6 +1981,7 @@ const struct amdgpu_ras_block_hw_ops vcn_v2_6_ras_hw_ops = { · 96 unmodified lines
19651981 static struct amdgpu_vcn_ras vcn_v2_6_ras = {
19661982 .ras_block = {
19671983 .hw_ops = &vcn_v2_6_ras_hw_ops,
1984+ .ras_late_init = amdgpu_vcn_ras_late_init,
19681985 },
19691986 };
19701987
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c+30−6
@@ -139,7 +139,7 @@ static int vcn_v4_0_sw_init(void *handle) · 138 unmodified lines
139139
140140 /* VCN POISON TRAP */
141141 r = amdgpu_irq_add_id(adev, amdgpu_ih_clientid_vcns[i],
142− VCN_4_0__SRCID_UVD_POISON, &adev->vcn.inst[i].irq);
142+ VCN_4_0__SRCID_UVD_POISON, &adev->vcn.inst[i].ras_poison_irq);
143143 if (r)
144144 return r;
145145
@@ -305,8 +305,8 @@ static int vcn_v4_0_hw_fini(void *handle) · 159 unmodified lines
305305 vcn_v4_0_set_powergating_state(adev, AMD_PG_STATE_GATE);
306306 }
307307 }
308−
309− amdgpu_irq_put(adev, &adev->vcn.inst[i].irq, 0);
308+ if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__VCN))
309+ amdgpu_irq_put(adev, &adev->vcn.inst[i].ras_poison_irq, 0);
310310 }
311311
312312 return 0;
@@ -1975,6 +1975,24 @@ static int vcn_v4_0_set_interrupt_state(struct amdgpu_device *adev, struct amdgp · 1662 unmodified lines
19751975 return 0;
19761976 }
19771977
1978+/**
1979+ * vcn_v4_0_set_ras_interrupt_state - set VCN block RAS interrupt state
1980+ *
1981+ * @adev: amdgpu_device pointer
1982+ * @source: interrupt sources
1983+ * @type: interrupt types
1984+ * @state: interrupt states
1985+ *
1986+ * Set VCN block RAS interrupt state
1987+ */
1988+static int vcn_v4_0_set_ras_interrupt_state(struct amdgpu_device *adev,
1989+ struct amdgpu_irq_src *source,
1990+ unsigned int type,
1991+ enum amdgpu_interrupt_state state)
1992+{
1993+ return 0;
1994+}
1995+
19781996 /**
19791997 * vcn_v4_0_process_interrupt - process VCN block interrupt
19801998 *
@@ -2007,9 +2025,6 @@ static int vcn_v4_0_process_interrupt(struct amdgpu_device *adev, struct amdgpu_ · 26 unmodified lines
20072025 case VCN_4_0__SRCID__UVD_ENC_GENERAL_PURPOSE:
20082026 amdgpu_fence_process(&adev->vcn.inst[ip_instance].ring_enc[0]);
20092027 break;
2010− case VCN_4_0__SRCID_UVD_POISON:
2011− amdgpu_vcn_process_poison_irq(adev, source, entry);
2012− break;
20132028 default:
20142029 DRM_ERROR("Unhandled interrupt: %d %d\n",
20152030 entry->src_id, entry->src_data[0]);
@@ -2024,6 +2039,11 @@ static const struct amdgpu_irq_src_funcs vcn_v4_0_irq_funcs = { · 8 unmodified lines
20242039 .process = vcn_v4_0_process_interrupt,
20252040 };
20262041
2042+static const struct amdgpu_irq_src_funcs vcn_v4_0_ras_irq_funcs = {
2043+ .set = vcn_v4_0_set_ras_interrupt_state,
2044+ .process = amdgpu_vcn_process_poison_irq,
2045+};
2046+
20272047 /**
20282048 * vcn_v4_0_set_irq_funcs - set VCN block interrupt irq functions
20292049 *
@@ -2041,6 +2061,9 @@ static void vcn_v4_0_set_irq_funcs(struct amdgpu_device *adev) · 11 unmodified lines
20412061
20422062 adev->vcn.inst[i].irq.num_types = adev->vcn.num_enc_rings + 1;
20432063 adev->vcn.inst[i].irq.funcs = &vcn_v4_0_irq_funcs;
2064+
2065+ adev->vcn.inst[i].ras_poison_irq.num_types = adev->vcn.num_enc_rings + 1;
2066+ adev->vcn.inst[i].ras_poison_irq.funcs = &vcn_v4_0_ras_irq_funcs;
20442067 }
20452068 }
20462069
@@ -2114,6 +2137,7 @@ const struct amdgpu_ras_block_hw_ops vcn_v4_0_ras_hw_ops = { · 67 unmodified lines
21142137 static struct amdgpu_vcn_ras vcn_v4_0_ras = {
21152138 .ras_block = {
21162139 .hw_ops = &vcn_v4_0_ras_hw_ops,
2140+ .ras_late_init = amdgpu_vcn_ras_late_init,
21172141 },
21182142 };
21192143
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c+0−9
@@ -2113,15 +2113,6 @@ void dcn20_optimize_bandwidth( · 2112 unmodified lines
21132113 if (hubbub->funcs->program_compbuf_size)
21142114 hubbub->funcs->program_compbuf_size(hubbub, context->bw_ctx.bw.dcn.compbuf_size_kb, true);
21152115
2116− if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) {
2117− dc_dmub_srv_p_state_delegate(dc,
2118− true, context);
2119− context->bw_ctx.bw.dcn.clk.p_state_change_support = true;
2120− dc->clk_mgr->clks.fw_based_mclk_switching = true;
2121− } else {
2122− dc->clk_mgr->clks.fw_based_mclk_switching = false;
2123− }
2124−
21252116 dc->clk_mgr->funcs->update_clocks(
21262117 dc->clk_mgr,
21272118 context,
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c+1−24
@@ -983,36 +983,13 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc, · 982 unmodified lines
983983 }
984984
985985 void dcn30_prepare_bandwidth(struct dc *dc,
986− struct dc_state *context)
986+ struct dc_state *context)
987987 {
988− bool p_state_change_support = context->bw_ctx.bw.dcn.clk.p_state_change_support;
989− /* Any transition into an FPO config should disable MCLK switching first to avoid
990− * driver and FW P-State synchronization issues.
991− */
992− if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching || dc->clk_mgr->clks.fw_based_mclk_switching) {
993− dc->optimized_required = true;
994− context->bw_ctx.bw.dcn.clk.p_state_change_support = false;
995− }
996−
997988 if (dc->clk_mgr->dc_mode_softmax_enabled)
998989 if (dc->clk_mgr->clks.dramclk_khz <= dc->clk_mgr->bw_params->dc_mode_softmax_memclk * 1000 &&
999990 context->bw_ctx.bw.dcn.clk.dramclk_khz > dc->clk_mgr->bw_params->dc_mode_softmax_memclk * 1000)
1000991 dc->clk_mgr->funcs->set_max_memclk(dc->clk_mgr, dc->clk_mgr->bw_params->clk_table.entries[dc->clk_mgr->bw_params->clk_table.num_entries - 1].memclk_mhz);
1001992
1002993 dcn20_prepare_bandwidth(dc, context);
1003− /*
1004− * enabled -> enabled: do not disable
1005− * enabled -> disabled: disable
1006− * disabled -> enabled: don't care
1007− * disabled -> disabled: don't care
1008− */
1009− if (!context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching)
1010− dc_dmub_srv_p_state_delegate(dc, false, context);
1011−
1012− if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching || dc->clk_mgr->clks.fw_based_mclk_switching) {
1013− /* After disabling P-State, restore the original value to ensure we get the correct P-State
1014− * on the next optimize. */
1015− context->bw_ctx.bw.dcn.clk.p_state_change_support = p_state_change_support;
1016− }
1017994 }
1018995
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c+0−29
@@ -6925,23 +6925,6 @@ static int si_dpm_enable(struct amdgpu_device *adev) · 6924 unmodified lines
69256925 return 0;
69266926 }
69276927
6928−static int si_set_temperature_range(struct amdgpu_device *adev)
6929−{
6930− int ret;
6931−
6932− ret = si_thermal_enable_alert(adev, false);
6933− if (ret)
6934− return ret;
6935− ret = si_thermal_set_temperature_range(adev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
6936− if (ret)
6937− return ret;
6938− ret = si_thermal_enable_alert(adev, true);
6939− if (ret)
6940− return ret;
6941−
6942− return ret;
6943−}
6944−
69456928 static void si_dpm_disable(struct amdgpu_device *adev)
69466929 {
69476930 struct rv7xx_power_info *pi = rv770_get_pi(adev);
@@ -7626,18 +7609,6 @@ static int si_dpm_process_interrupt(struct amdgpu_device *adev, · 678 unmodified lines
76267609
76277610 static int si_dpm_late_init(void *handle)
76287611 {
7629− int ret;
7630− struct amdgpu_device *adev = (struct amdgpu_device *)handle;
7631−
7632− if (!adev->pm.dpm_enabled)
7633− return 0;
7634−
7635− ret = si_set_temperature_range(adev);
7636− if (ret)
7637− return ret;
7638−#if 0 //TODO ?
7639− si_dpm_powergate_uvd(adev, true);
7640−#endif
76417612 return 0;
76427613 }
76437614
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c+6−4
@@ -582,7 +582,7 @@ static int vangogh_print_legacy_clk_levels(struct smu_context *smu, · 581 unmodified lines
582582 DpmClocks_t *clk_table = smu->smu_table.clocks_table;
583583 SmuMetrics_legacy_t metrics;
584584 struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
585− int i, size = 0, ret = 0;
585+ int i, idx, size = 0, ret = 0;
586586 uint32_t cur_value = 0, value = 0, count = 0;
587587 bool cur_value_match_level = false;
588588
@@ -656,7 +656,8 @@ static int vangogh_print_legacy_clk_levels(struct smu_context *smu, · 67 unmodified lines
656656 case SMU_MCLK:
657657 case SMU_FCLK:
658658 for (i = 0; i < count; i++) {
659− ret = vangogh_get_dpm_clk_limited(smu, clk_type, i, &value);
659+ idx = (clk_type == SMU_FCLK || clk_type == SMU_MCLK) ? (count - i - 1) : i;
660+ ret = vangogh_get_dpm_clk_limited(smu, clk_type, idx, &value);
660661 if (ret)
661662 return ret;
662663 if (!value)
@@ -683,7 +684,7 @@ static int vangogh_print_clk_levels(struct smu_context *smu, · 20 unmodified lines
683684 DpmClocks_t *clk_table = smu->smu_table.clocks_table;
684685 SmuMetrics_t metrics;
685686 struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
686− int i, size = 0, ret = 0;
687+ int i, idx, size = 0, ret = 0;
687688 uint32_t cur_value = 0, value = 0, count = 0;
688689 bool cur_value_match_level = false;
689690 uint32_t min, max;
@@ -765,7 +766,8 @@ static int vangogh_print_clk_levels(struct smu_context *smu, · 75 unmodified lines
765766 case SMU_MCLK:
766767 case SMU_FCLK:
767768 for (i = 0; i < count; i++) {
768− ret = vangogh_get_dpm_clk_limited(smu, clk_type, i, &value);
769+ idx = (clk_type == SMU_FCLK || clk_type == SMU_MCLK) ? (count - i - 1) : i;
770+ ret = vangogh_get_dpm_clk_limited(smu, clk_type, idx, &value);
769771 if (ret)
770772 return ret;
771773 if (!value)
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c+3−2
@@ -494,7 +494,7 @@ static int renoir_set_fine_grain_gfx_freq_parameters(struct smu_context *smu) · 493 unmodified lines
494494 static int renoir_print_clk_levels(struct smu_context *smu,
495495 enum smu_clk_type clk_type, char *buf)
496496 {
497− int i, size = 0, ret = 0;
497+ int i, idx, size = 0, ret = 0;
498498 uint32_t cur_value = 0, value = 0, count = 0, min = 0, max = 0;
499499 SmuMetrics_t metrics;
500500 struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
@@ -594,7 +594,8 @@ static int renoir_print_clk_levels(struct smu_context *smu, · 93 unmodified lines
594594 case SMU_VCLK:
595595 case SMU_DCLK:
596596 for (i = 0; i < count; i++) {
597− ret = renoir_get_dpm_clk_limited(smu, clk_type, i, &value);
597+ idx = (clk_type == SMU_FCLK || clk_type == SMU_MCLK) ? (count - i - 1) : i;
598+ ret = renoir_get_dpm_clk_limited(smu, clk_type, idx, &value);
598599 if (ret)
599600 return ret;
600601 if (!value)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c+3−2
@@ -478,7 +478,7 @@ static int smu_v13_0_4_get_dpm_level_count(struct smu_context *smu, · 477 unmodified lines
478478 static int smu_v13_0_4_print_clk_levels(struct smu_context *smu,
479479 enum smu_clk_type clk_type, char *buf)
480480 {
481− int i, size = 0, ret = 0;
481+ int i, idx, size = 0, ret = 0;
482482 uint32_t cur_value = 0, value = 0, count = 0;
483483 uint32_t min, max;
484484
@@ -512,7 +512,8 @@ static int smu_v13_0_4_print_clk_levels(struct smu_context *smu, · 27 unmodified lines
512512 break;
513513
514514 for (i = 0; i < count; i++) {
515− ret = smu_v13_0_4_get_dpm_freq_by_index(smu, clk_type, i, &value);
515+ idx = (clk_type == SMU_FCLK || clk_type == SMU_MCLK) ? (count - i - 1) : i;
516+ ret = smu_v13_0_4_get_dpm_freq_by_index(smu, clk_type, idx, &value);
516517 if (ret)
517518 break;
518519
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c+3−2
@@ -866,7 +866,7 @@ out: · 865 unmodified lines
866866 static int smu_v13_0_5_print_clk_levels(struct smu_context *smu,
867867 enum smu_clk_type clk_type, char *buf)
868868 {
869− int i, size = 0, ret = 0;
869+ int i, idx, size = 0, ret = 0;
870870 uint32_t cur_value = 0, value = 0, count = 0;
871871 uint32_t min = 0, max = 0;
872872
@@ -898,7 +898,8 @@ static int smu_v13_0_5_print_clk_levels(struct smu_context *smu, · 25 unmodified lines
898898 goto print_clk_out;
899899
900900 for (i = 0; i < count; i++) {
901− ret = smu_v13_0_5_get_dpm_freq_by_index(smu, clk_type, i, &value);
901+ idx = (clk_type == SMU_MCLK) ? (count - i - 1) : i;
902+ ret = smu_v13_0_5_get_dpm_freq_by_index(smu, clk_type, idx, &value);
902903 if (ret)
903904 goto print_clk_out;
904905
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c+3−2
@@ -1000,7 +1000,7 @@ out: · 999 unmodified lines
10001000 static int yellow_carp_print_clk_levels(struct smu_context *smu,
10011001 enum smu_clk_type clk_type, char *buf)
10021002 {
1003− int i, size = 0, ret = 0;
1003+ int i, idx, size = 0, ret = 0;
10041004 uint32_t cur_value = 0, value = 0, count = 0;
10051005 uint32_t min, max;
10061006
@@ -1033,7 +1033,8 @@ static int yellow_carp_print_clk_levels(struct smu_context *smu, · 26 unmodified lines
10331033 goto print_clk_out;
10341034
10351035 for (i = 0; i < count; i++) {
1036− ret = yellow_carp_get_dpm_freq_by_index(smu, clk_type, i, &value);
1036+ idx = (clk_type == SMU_FCLK || clk_type == SMU_MCLK) ? (count - i - 1) : i;
1037+ ret = yellow_carp_get_dpm_freq_by_index(smu, clk_type, idx, &value);
10371038 if (ret)
10381039 goto print_clk_out;
10391040
drivers/gpu/drm/i915/i915_perf.c+11−6
@@ -877,12 +877,17 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream, · 876 unmodified lines
877877 stream->oa_buffer.last_ctx_id = ctx_id;
878878 }
879879
880− /*
881− * Clear out the report id and timestamp as a means to detect unlanded
882− * reports.
883− */
884− oa_report_id_clear(stream, report32);
885− oa_timestamp_clear(stream, report32);
880+ if (is_power_of_2(report_size)) {
881+ /*
882+ * Clear out the report id and timestamp as a means
883+ * to detect unlanded reports.
884+ */
885+ oa_report_id_clear(stream, report32);
886+ oa_timestamp_clear(stream, report32);
887+ } else {
888+ /* Zero out the entire report */
889+ memset(report32, 0, report_size);
890+ }
886891 }
887892
888893 if (start_offset != *offset) {
drivers/hid/hid-logitech-hidpp.c+6−7
@@ -286,7 +286,7 @@ static int hidpp_send_message_sync(struct hidpp_device *hidpp, · 285 unmodified lines
286286 struct hidpp_report *message,
287287 struct hidpp_report *response)
288288 {
289− int ret;
289+ int ret = -1;
290290 int max_retries = 3;
291291
292292 mutex_lock(&hidpp->send_mutex);
@@ -300,13 +300,13 @@ static int hidpp_send_message_sync(struct hidpp_device *hidpp, · 7 unmodified lines
300300 */
301301 *response = *message;
302302
303− for (; max_retries != 0; max_retries--) {
303+ for (; max_retries != 0 && ret; max_retries--) {
304304 ret = __hidpp_send_report(hidpp->hid_dev, message);
305305
306306 if (ret) {
307307 dbg_hid("__hidpp_send_report returned err: %d\n", ret);
308308 memset(response, 0, sizeof(struct hidpp_report));
309− goto exit;
309+ break;
310310 }
311311
312312 if (!wait_event_timeout(hidpp->wait, hidpp->answer_available,
@@ -314,14 +314,14 @@ static int hidpp_send_message_sync(struct hidpp_device *hidpp, · 1 unmodified line
314314 dbg_hid("%s:timeout waiting for response\n", __func__);
315315 memset(response, 0, sizeof(struct hidpp_report));
316316 ret = -ETIMEDOUT;
317− goto exit;
317+ break;
318318 }
319319
320320 if (response->report_id == REPORT_ID_HIDPP_SHORT &&
321321 response->rap.sub_id == HIDPP_ERROR) {
322322 ret = response->rap.params[1];
323323 dbg_hid("%s:got hidpp error %02X\n", __func__, ret);
324− goto exit;
324+ break;
325325 }
326326
327327 if ((response->report_id == REPORT_ID_HIDPP_LONG ||
@@ -330,13 +330,12 @@ static int hidpp_send_message_sync(struct hidpp_device *hidpp, · 2 unmodified lines
330330 ret = response->fap.params[1];
331331 if (ret != HIDPP20_ERROR_BUSY) {
332332 dbg_hid("%s:got hidpp 2.0 error %02X\n", __func__, ret);
333− goto exit;
333+ break;
334334 }
335335 dbg_hid("%s:got busy hidpp 2.0 error %02X, retrying\n", __func__, ret);
336336 }
337337 }
338338
339−exit:
340339 mutex_unlock(&hidpp->send_mutex);
341340 return ret;
342341
drivers/iio/accel/kionix-kx022a.c+1−1
@@ -1048,7 +1048,7 @@ int kx022a_probe_internal(struct device *dev) · 1047 unmodified lines
10481048 data->ien_reg = KX022A_REG_INC4;
10491049 } else {
10501050 irq = fwnode_irq_get_byname(fwnode, "INT2");
1051− if (irq <= 0)
1051+ if (irq < 0)
10521052 return dev_err_probe(dev, irq, "No suitable IRQ\n");
10531053
10541054 data->inc_reg = KX022A_REG_INC5;
drivers/iio/accel/st_accel_core.c+2−2
@@ -1291,12 +1291,12 @@ static int apply_acpi_orientation(struct iio_dev *indio_dev) · 1290 unmodified lines
12911291
12921292 adev = ACPI_COMPANION(indio_dev->dev.parent);
12931293 if (!adev)
1294− return 0;
1294+ return -ENXIO;
12951295
12961296 /* Read _ONT data, which should be a package of 6 integers. */
12971297 status = acpi_evaluate_object(adev->handle, "_ONT", NULL, &buffer);
12981298 if (status == AE_NOT_FOUND) {
1299− return 0;
1299+ return -ENXIO;
13001300 } else if (ACPI_FAILURE(status)) {
13011301 dev_warn(&indio_dev->dev, "failed to execute _ONT: %d\n",
13021302 status);
drivers/iio/adc/ad4130.c+11−1
@@ -1817,6 +1817,11 @@ static const struct clk_ops ad4130_int_clk_ops = { · 1816 unmodified lines
18171817 .unprepare = ad4130_int_clk_unprepare,
18181818 };
18191819
1820+static void ad4130_clk_del_provider(void *of_node)
1821+{
1822+ of_clk_del_provider(of_node);
1823+}
1824+
18201825 static int ad4130_setup_int_clk(struct ad4130_state *st)
18211826 {
18221827 struct device *dev = &st->spi->dev;
@@ -1824,6 +1829,7 @@ static int ad4130_setup_int_clk(struct ad4130_state *st) · 1 unmodified line
18241829 struct clk_init_data init;
18251830 const char *clk_name;
18261831 struct clk *clk;
1832+ int ret;
18271833
18281834 if (st->int_pin_sel == AD4130_INT_PIN_CLK ||
18291835 st->mclk_sel != AD4130_MCLK_76_8KHZ)
@@ -1843,7 +1849,11 @@ static int ad4130_setup_int_clk(struct ad4130_state *st) · 13 unmodified lines
18431849 if (IS_ERR(clk))
18441850 return PTR_ERR(clk);
18451851
1846− return of_clk_add_provider(of_node, of_clk_src_simple_get, clk);
1852+ ret = of_clk_add_provider(of_node, of_clk_src_simple_get, clk);
1853+ if (ret)
1854+ return ret;
1855+
1856+ return devm_add_action_or_reset(dev, ad4130_clk_del_provider, of_node);
18471857 }
18481858
18491859 static int ad4130_setup(struct iio_dev *indio_dev)
drivers/iio/adc/ad7192.c+2−6
@@ -897,10 +897,6 @@ static const struct iio_info ad7195_info = { · 896 unmodified lines
897897 __AD719x_CHANNEL(_si, _channel1, -1, _address, NULL, IIO_VOLTAGE, \
898898 BIT(IIO_CHAN_INFO_SCALE), ad7192_calibsys_ext_info)
899899
900−#define AD719x_SHORTED_CHANNEL(_si, _channel1, _address) \
901− __AD719x_CHANNEL(_si, _channel1, -1, _address, "shorted", IIO_VOLTAGE, \
902− BIT(IIO_CHAN_INFO_SCALE), ad7192_calibsys_ext_info)
903−
904900 #define AD719x_TEMP_CHANNEL(_si, _address) \
905901 __AD719x_CHANNEL(_si, 0, -1, _address, NULL, IIO_TEMP, 0, NULL)
906902
@@ -908,7 +904,7 @@ static const struct iio_chan_spec ad7192_channels[] = { · 1 unmodified line
908904 AD719x_DIFF_CHANNEL(0, 1, 2, AD7192_CH_AIN1P_AIN2M),
909905 AD719x_DIFF_CHANNEL(1, 3, 4, AD7192_CH_AIN3P_AIN4M),
910906 AD719x_TEMP_CHANNEL(2, AD7192_CH_TEMP),
911− AD719x_SHORTED_CHANNEL(3, 2, AD7192_CH_AIN2P_AIN2M),
907+ AD719x_DIFF_CHANNEL(3, 2, 2, AD7192_CH_AIN2P_AIN2M),
912908 AD719x_CHANNEL(4, 1, AD7192_CH_AIN1),
913909 AD719x_CHANNEL(5, 2, AD7192_CH_AIN2),
914910 AD719x_CHANNEL(6, 3, AD7192_CH_AIN3),
@@ -922,7 +918,7 @@ static const struct iio_chan_spec ad7193_channels[] = { · 7 unmodified lines
922918 AD719x_DIFF_CHANNEL(2, 5, 6, AD7193_CH_AIN5P_AIN6M),
923919 AD719x_DIFF_CHANNEL(3, 7, 8, AD7193_CH_AIN7P_AIN8M),
924920 AD719x_TEMP_CHANNEL(4, AD7193_CH_TEMP),
925− AD719x_SHORTED_CHANNEL(5, 2, AD7193_CH_AIN2P_AIN2M),
921+ AD719x_DIFF_CHANNEL(5, 2, 2, AD7193_CH_AIN2P_AIN2M),
926922 AD719x_CHANNEL(6, 1, AD7193_CH_AIN1),
927923 AD719x_CHANNEL(7, 2, AD7193_CH_AIN2),
928924 AD719x_CHANNEL(8, 3, AD7193_CH_AIN3),
drivers/iio/adc/ad_sigma_delta.c+4−0
@@ -584,6 +584,10 @@ static int devm_ad_sd_probe_trigger(struct device *dev, struct iio_dev *indio_de · 583 unmodified lines
584584 init_completion(&sigma_delta->completion);
585585
586586 sigma_delta->irq_dis = true;
587+
588+ /* the IRQ core clears IRQ_DISABLE_UNLAZY flag when freeing an IRQ */
589+ irq_set_status_flags(sigma_delta->spi->irq, IRQ_DISABLE_UNLAZY);
590+
587591 ret = devm_request_irq(dev, sigma_delta->spi->irq,
588592 ad_sd_data_rdy_trig_poll,
589593 sigma_delta->info->irq_flags | IRQF_NO_AUTOEN,
drivers/iio/adc/imx93_adc.c+3−4
@@ -236,8 +236,7 @@ static int imx93_adc_read_raw(struct iio_dev *indio_dev, · 235 unmodified lines
236236 {
237237 struct imx93_adc *adc = iio_priv(indio_dev);
238238 struct device *dev = adc->dev;
239− long ret;
240− u32 vref_uv;
239+ int ret;
241240
242241 switch (mask) {
243242 case IIO_CHAN_INFO_RAW:
@@ -253,10 +252,10 @@ static int imx93_adc_read_raw(struct iio_dev *indio_dev, · 9 unmodified lines
253252 return IIO_VAL_INT;
254253
255254 case IIO_CHAN_INFO_SCALE:
256− ret = vref_uv = regulator_get_voltage(adc->vref);
255+ ret = regulator_get_voltage(adc->vref);
257256 if (ret < 0)
258257 return ret;
259− *val = vref_uv / 1000;
258+ *val = ret / 1000;
260259 *val2 = 12;
261260 return IIO_VAL_FRACTIONAL_LOG2;
262261
drivers/iio/adc/mt6370-adc.c+51−2
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919
2020 #include <dt-bindings/iio/adc/mediatek,mt6370_adc.h>
2121
22+#define MT6370_REG_DEV_INFO 0x100
2223 #define MT6370_REG_CHG_CTRL3 0x113
2324 #define MT6370_REG_CHG_CTRL7 0x117
2425 #define MT6370_REG_CHG_ADC 0x121
@@ -27,6 +28,7 @@ · 2 unmodified lines
2728 #define MT6370_ADC_START_MASK BIT(0)
2829 #define MT6370_ADC_IN_SEL_MASK GENMASK(7, 4)
2930 #define MT6370_AICR_ICHG_MASK GENMASK(7, 2)
31+#define MT6370_VENID_MASK GENMASK(7, 4)
3032
3133 #define MT6370_AICR_100_mA 0x0
3234 #define MT6370_AICR_150_mA 0x1
@@ -47,6 +49,10 @@ · 14 unmodified lines
4749 #define ADC_CONV_TIME_MS 35
4850 #define ADC_CONV_POLLING_TIME_US 1000
4951
52+#define MT6370_VID_RT5081 0x8
53+#define MT6370_VID_RT5081A 0xA
54+#define MT6370_VID_MT6370 0xE
55+
5056 struct mt6370_adc_data {
5157 struct device *dev;
5258 struct regmap *regmap;
@@ -55,6 +61,7 @@ struct mt6370_adc_data { · 2 unmodified lines
5561 * from being read at the same time.
5662 */
5763 struct mutex adc_lock;
64+ unsigned int vid;
5865 };
5966
6067 static int mt6370_adc_read_channel(struct mt6370_adc_data *priv, int chan,
@@ -98,6 +105,30 @@ adc_unlock: · 37 unmodified lines
98105 return ret;
99106 }
100107
108+static int mt6370_adc_get_ibus_scale(struct mt6370_adc_data *priv)
109+{
110+ switch (priv->vid) {
111+ case MT6370_VID_RT5081:
112+ case MT6370_VID_RT5081A:
113+ case MT6370_VID_MT6370:
114+ return 3350;
115+ default:
116+ return 3875;
117+ }
118+}
119+
120+static int mt6370_adc_get_ibat_scale(struct mt6370_adc_data *priv)
121+{
122+ switch (priv->vid) {
123+ case MT6370_VID_RT5081:
124+ case MT6370_VID_RT5081A:
125+ case MT6370_VID_MT6370:
126+ return 2680;
127+ default:
128+ return 3870;
129+ }
130+}
131+
101132 static int mt6370_adc_read_scale(struct mt6370_adc_data *priv,
102133 int chan, int *val1, int *val2)
103134 {
@@ -123,7 +154,7 @@ static int mt6370_adc_read_scale(struct mt6370_adc_data *priv, · 19 unmodified lines
123154 case MT6370_AICR_250_mA:
124155 case MT6370_AICR_300_mA:
125156 case MT6370_AICR_350_mA:
126− *val1 = 3350;
157+ *val1 = mt6370_adc_get_ibus_scale(priv);
127158 break;
128159 default:
129160 *val1 = 5000;
@@ -150,7 +181,7 @@ static int mt6370_adc_read_scale(struct mt6370_adc_data *priv, · 20 unmodified lines
150181 case MT6370_ICHG_600_mA:
151182 case MT6370_ICHG_700_mA:
152183 case MT6370_ICHG_800_mA:
153− *val1 = 2680;
184+ *val1 = mt6370_adc_get_ibat_scale(priv);
154185 break;
155186 default:
156187 *val1 = 5000;
@@ -251,6 +282,20 @@ static const struct iio_chan_spec mt6370_adc_channels[] = { · 94 unmodified lines
251282 MT6370_ADC_CHAN(TEMP_JC, IIO_TEMP, 12, BIT(IIO_CHAN_INFO_OFFSET)),
252283 };
253284
285+static int mt6370_get_vendor_info(struct mt6370_adc_data *priv)
286+{
287+ unsigned int dev_info;
288+ int ret;
289+
290+ ret = regmap_read(priv->regmap, MT6370_REG_DEV_INFO, &dev_info);
291+ if (ret)
292+ return ret;
293+
294+ priv->vid = FIELD_GET(MT6370_VENID_MASK, dev_info);
295+
296+ return 0;
297+}
298+
254299 static int mt6370_adc_probe(struct platform_device *pdev)
255300 {
256301 struct device *dev = &pdev->dev;
@@ -272,6 +317,10 @@ static int mt6370_adc_probe(struct platform_device *pdev) · 15 unmodified lines
272317 priv->regmap = regmap;
273318 mutex_init(&priv->adc_lock);
274319
320+ ret = mt6370_get_vendor_info(priv);
321+ if (ret)
322+ return dev_err_probe(dev, ret, "Failed to get vid\n");
323+
275324 ret = regmap_write(priv->regmap, MT6370_REG_CHG_ADC, 0);
276325 if (ret)
277326 return dev_err_probe(dev, ret, "Failed to reset ADC\n");
drivers/iio/adc/mxs-lradc-adc.c+5−5
@@ -757,13 +757,13 @@ static int mxs_lradc_adc_probe(struct platform_device *pdev) · 756 unmodified lines
757757
758758 ret = mxs_lradc_adc_trigger_init(iio);
759759 if (ret)
760− goto err_trig;
760+ return ret;
761761
762762 ret = iio_triggered_buffer_setup(iio, &iio_pollfunc_store_time,
763763 &mxs_lradc_adc_trigger_handler,
764764 &mxs_lradc_adc_buffer_ops);
765765 if (ret)
766− return ret;
766+ goto err_trig;
767767
768768 adc->vref_mv = mxs_lradc_adc_vref_mv[lradc->soc];
769769
@@ -801,9 +801,9 @@ static int mxs_lradc_adc_probe(struct platform_device *pdev) · 31 unmodified lines
801801
802802 err_dev:
803803 mxs_lradc_adc_hw_stop(adc);
804− mxs_lradc_adc_trigger_remove(iio);
805−err_trig:
806804 iio_triggered_buffer_cleanup(iio);
805+err_trig:
806+ mxs_lradc_adc_trigger_remove(iio);
807807 return ret;
808808 }
809809
@@ -814,8 +814,8 @@ static int mxs_lradc_adc_remove(struct platform_device *pdev) · 4 unmodified lines
814814
815815 iio_device_unregister(iio);
816816 mxs_lradc_adc_hw_stop(adc);
817− mxs_lradc_adc_trigger_remove(iio);
818817 iio_triggered_buffer_cleanup(iio);
818+ mxs_lradc_adc_trigger_remove(iio);
819819
820820 return 0;
821821 }
drivers/iio/adc/palmas_gpadc.c+5−5
@@ -547,7 +547,7 @@ static int palmas_gpadc_read_raw(struct iio_dev *indio_dev, · 546 unmodified lines
547547 int adc_chan = chan->channel;
548548 int ret = 0;
549549
550− if (adc_chan > PALMAS_ADC_CH_MAX)
550+ if (adc_chan >= PALMAS_ADC_CH_MAX)
551551 return -EINVAL;
552552
553553 mutex_lock(&adc->lock);
@@ -595,7 +595,7 @@ static int palmas_gpadc_read_event_config(struct iio_dev *indio_dev, · 41 unmodified lines
595595 int adc_chan = chan->channel;
596596 int ret = 0;
597597
598− if (adc_chan > PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH)
598+ if (adc_chan >= PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH)
599599 return -EINVAL;
600600
601601 mutex_lock(&adc->lock);
@@ -684,7 +684,7 @@ static int palmas_gpadc_write_event_config(struct iio_dev *indio_dev, · 82 unmodified lines
684684 int adc_chan = chan->channel;
685685 int ret;
686686
687− if (adc_chan > PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH)
687+ if (adc_chan >= PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH)
688688 return -EINVAL;
689689
690690 mutex_lock(&adc->lock);
@@ -710,7 +710,7 @@ static int palmas_gpadc_read_event_value(struct iio_dev *indio_dev, · 19 unmodified lines
710710 int adc_chan = chan->channel;
711711 int ret;
712712
713− if (adc_chan > PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH)
713+ if (adc_chan >= PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH)
714714 return -EINVAL;
715715
716716 mutex_lock(&adc->lock);
@@ -744,7 +744,7 @@ static int palmas_gpadc_write_event_value(struct iio_dev *indio_dev, · 27 unmodified lines
744744 int old;
745745 int ret;
746746
747− if (adc_chan > PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH)
747+ if (adc_chan >= PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH)
748748 return -EINVAL;
749749
750750 mutex_lock(&adc->lock);
drivers/iio/adc/stm32-adc.c+32−29
@@ -2006,16 +2006,15 @@ static int stm32_adc_get_legacy_chan_count(struct iio_dev *indio_dev, struct stm · 2005 unmodified lines
20062006 * to get the *real* number of channels.
20072007 */
20082008 ret = device_property_count_u32(dev, "st,adc-diff-channels");
2009− if (ret < 0)
2010− return ret;
2011−
2012− ret /= (int)(sizeof(struct stm32_adc_diff_channel) / sizeof(u32));
2013− if (ret > adc_info->max_channels) {
2014− dev_err(&indio_dev->dev, "Bad st,adc-diff-channels?\n");
2015− return -EINVAL;
2016− } else if (ret > 0) {
2017− adc->num_diff = ret;
2018− num_channels += ret;
2009+ if (ret > 0) {
2010+ ret /= (int)(sizeof(struct stm32_adc_diff_channel) / sizeof(u32));
2011+ if (ret > adc_info->max_channels) {
2012+ dev_err(&indio_dev->dev, "Bad st,adc-diff-channels?\n");
2013+ return -EINVAL;
2014+ } else if (ret > 0) {
2015+ adc->num_diff = ret;
2016+ num_channels += ret;
2017+ }
20192018 }
20202019
20212020 /* Optional sample time is provided either for each, or all channels */
@@ -2037,6 +2036,7 @@ static int stm32_adc_legacy_chan_init(struct iio_dev *indio_dev, · 15 unmodified lines
20372036 struct stm32_adc_diff_channel diff[STM32_ADC_CH_MAX];
20382037 struct device *dev = &indio_dev->dev;
20392038 u32 num_diff = adc->num_diff;
2039+ int num_se = nchans - num_diff;
20402040 int size = num_diff * sizeof(*diff) / sizeof(u32);
20412041 int scan_index = 0, ret, i, c;
20422042 u32 smp = 0, smps[STM32_ADC_CH_MAX], chans[STM32_ADC_CH_MAX];
@@ -2063,29 +2063,32 @@ static int stm32_adc_legacy_chan_init(struct iio_dev *indio_dev, · 20 unmodified lines
20632063 scan_index++;
20642064 }
20652065 }
2066−
2067− ret = device_property_read_u32_array(dev, "st,adc-channels", chans,
2068− nchans);
2069− if (ret)
2070− return ret;
2071−
2072− for (c = 0; c < nchans; c++) {
2073− if (chans[c] >= adc_info->max_channels) {
2074− dev_err(&indio_dev->dev, "Invalid channel %d\n",
2075− chans[c]);
2076− return -EINVAL;
2066+ if (num_se > 0) {
2067+ ret = device_property_read_u32_array(dev, "st,adc-channels", chans, num_se);
2068+ if (ret) {
2069+ dev_err(&indio_dev->dev, "Failed to get st,adc-channels %d\n", ret);
2070+ return ret;
20772071 }
20782072
2079− /* Channel can't be configured both as single-ended & diff */
2080− for (i = 0; i < num_diff; i++) {
2081− if (chans[c] == diff[i].vinp) {
2082− dev_err(&indio_dev->dev, "channel %d misconfigured\n", chans[c]);
2073+ for (c = 0; c < num_se; c++) {
2074+ if (chans[c] >= adc_info->max_channels) {
2075+ dev_err(&indio_dev->dev, "Invalid channel %d\n",
2076+ chans[c]);
20832077 return -EINVAL;
20842078 }
2079+
2080+ /* Channel can't be configured both as single-ended & diff */
2081+ for (i = 0; i < num_diff; i++) {
2082+ if (chans[c] == diff[i].vinp) {
2083+ dev_err(&indio_dev->dev, "channel %d misconfigured\n",
2084+ chans[c]);
2085+ return -EINVAL;
2086+ }
2087+ }
2088+ stm32_adc_chan_init_one(indio_dev, &channels[scan_index],
2089+ chans[c], 0, scan_index, false);
2090+ scan_index++;
20852091 }
2086− stm32_adc_chan_init_one(indio_dev, &channels[scan_index],
2087− chans[c], 0, scan_index, false);
2088− scan_index++;
20892092 }
20902093
20912094 if (adc->nsmps > 0) {
@@ -2306,7 +2309,7 @@ static int stm32_adc_chan_fw_init(struct iio_dev *indio_dev, bool timestamping) · 214 unmodified lines
23062309
23072310 if (legacy)
23082311 ret = stm32_adc_legacy_chan_init(indio_dev, adc, channels,
2309− num_channels);
2312+ timestamping ? num_channels - 1 : num_channels);
23102313 else
23112314 ret = stm32_adc_generic_chan_init(indio_dev, adc, channels);
23122315 if (ret < 0)
drivers/iio/addac/ad74413r.c+1−1
@@ -1007,7 +1007,7 @@ static int ad74413r_read_raw(struct iio_dev *indio_dev, · 1006 unmodified lines
10071007
10081008 ret = ad74413r_get_single_adc_result(indio_dev, chan->channel,
10091009 val);
1010− if (ret)
1010+ if (ret < 0)
10111011 return ret;
10121012
10131013 ad74413r_adc_to_resistance_result(*val, val);
drivers/iio/dac/Makefile+1−1
@@ -17,7 +17,7 @@ obj-$(CONFIG_AD5592R_BASE) += ad5592r-base.o · 16 unmodified lines
1717 obj-$(CONFIG_AD5592R) += ad5592r.o
1818 obj-$(CONFIG_AD5593R) += ad5593r.o
1919 obj-$(CONFIG_AD5755) += ad5755.o
20−obj-$(CONFIG_AD5755) += ad5758.o
20+obj-$(CONFIG_AD5758) += ad5758.o
2121 obj-$(CONFIG_AD5761) += ad5761.o
2222 obj-$(CONFIG_AD5764) += ad5764.o
2323 obj-$(CONFIG_AD5766) += ad5766.o
drivers/iio/dac/mcp4725.c+14−2
@@ -47,12 +47,18 @@ static int mcp4725_suspend(struct device *dev) · 46 unmodified lines
4747 struct mcp4725_data *data = iio_priv(i2c_get_clientdata(
4848 to_i2c_client(dev)));
4949 u8 outbuf[2];
50+ int ret;
5051
5152 outbuf[0] = (data->powerdown_mode + 1) << 4;
5253 outbuf[1] = 0;
5354 data->powerdown = true;
5455
55− return i2c_master_send(data->client, outbuf, 2);
56+ ret = i2c_master_send(data->client, outbuf, 2);
57+ if (ret < 0)
58+ return ret;
59+ else if (ret != 2)
60+ return -EIO;
61+ return 0;
5662 }
5763
5864 static int mcp4725_resume(struct device *dev)
@@ -60,13 +66,19 @@ static int mcp4725_resume(struct device *dev) · 1 unmodified line
6066 struct mcp4725_data *data = iio_priv(i2c_get_clientdata(
6167 to_i2c_client(dev)));
6268 u8 outbuf[2];
69+ int ret;
6370
6471 /* restore previous DAC value */
6572 outbuf[0] = (data->dac_value >> 8) & 0xf;
6673 outbuf[1] = data->dac_value & 0xff;
6774 data->powerdown = false;
6875
69− return i2c_master_send(data->client, outbuf, 2);
76+ ret = i2c_master_send(data->client, outbuf, 2);
77+ if (ret < 0)
78+ return ret;
79+ else if (ret != 2)
80+ return -EIO;
81+ return 0;
7082 }
7183 static DEFINE_SIMPLE_DEV_PM_OPS(mcp4725_pm_ops, mcp4725_suspend,
7284 mcp4725_resume);
drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c+5−5
@@ -275,9 +275,14 @@ static int inv_icm42600_buffer_preenable(struct iio_dev *indio_dev) · 274 unmodified lines
275275 {
276276 struct inv_icm42600_state *st = iio_device_get_drvdata(indio_dev);
277277 struct device *dev = regmap_get_device(st->map);
278+ struct inv_icm42600_timestamp *ts = iio_priv(indio_dev);
278279
279280 pm_runtime_get_sync(dev);
280281
282+ mutex_lock(&st->lock);
283+ inv_icm42600_timestamp_reset(ts);
284+ mutex_unlock(&st->lock);
285+
281286 return 0;
282287 }
283288
@@ -375,7 +380,6 @@ static int inv_icm42600_buffer_postdisable(struct iio_dev *indio_dev) · 91 unmodified lines
375380 struct device *dev = regmap_get_device(st->map);
376381 unsigned int sensor;
377382 unsigned int *watermark;
378− struct inv_icm42600_timestamp *ts;
379383 struct inv_icm42600_sensor_conf conf = INV_ICM42600_SENSOR_CONF_INIT;
380384 unsigned int sleep_temp = 0;
381385 unsigned int sleep_sensor = 0;
@@ -385,11 +389,9 @@ static int inv_icm42600_buffer_postdisable(struct iio_dev *indio_dev) · 3 unmodified lines
385389 if (indio_dev == st->indio_gyro) {
386390 sensor = INV_ICM42600_SENSOR_GYRO;
387391 watermark = &st->fifo.watermark.gyro;
388− ts = iio_priv(st->indio_gyro);
389392 } else if (indio_dev == st->indio_accel) {
390393 sensor = INV_ICM42600_SENSOR_ACCEL;
391394 watermark = &st->fifo.watermark.accel;
392− ts = iio_priv(st->indio_accel);
393395 } else {
394396 return -EINVAL;
395397 }
@@ -417,8 +419,6 @@ static int inv_icm42600_buffer_postdisable(struct iio_dev *indio_dev) · 21 unmodified lines
417419 if (!st->fifo.on)
418420 ret = inv_icm42600_set_temp_conf(st, false, &sleep_temp);
419421
420− inv_icm42600_timestamp_reset(ts);
421−
422422 out_unlock:
423423 mutex_unlock(&st->lock);
424424
drivers/iio/industrialio-gts-helper.c+32−10
@@ -337,6 +337,17 @@ free_gains: · 336 unmodified lines
337337 return ret;
338338 }
339339
340+static void iio_gts_us_to_int_micro(int *time_us, int *int_micro_times,
341+ int num_times)
342+{
343+ int i;
344+
345+ for (i = 0; i < num_times; i++) {
346+ int_micro_times[i * 2] = time_us[i] / 1000000;
347+ int_micro_times[i * 2 + 1] = time_us[i] % 1000000;
348+ }
349+}
350+
340351 /**
341352 * iio_gts_build_avail_time_table - build table of available integration times
342353 * @gts: Gain time scale descriptor
@@ -351,7 +362,7 @@ free_gains: · 8 unmodified lines
351362 */
352363 static int iio_gts_build_avail_time_table(struct iio_gts *gts)
353364 {
354− int *times, i, j, idx = 0;
365+ int *times, i, j, idx = 0, *int_micro_times;
355366
356367 if (!gts->num_itime)
357368 return 0;
@@ -378,13 +389,24 @@ static int iio_gts_build_avail_time_table(struct iio_gts *gts) · 20 unmodified lines
378389 }
379390 }
380391 }
381− gts->avail_time_tables = times;
382− /*
383− * This is just to survive a unlikely corner-case where times in the
384− * given time table were not unique. Else we could just trust the
385− * gts->num_itime.
386− */
387− gts->num_avail_time_tables = idx;
392+
393+ /* create a list of times formatted as list of IIO_VAL_INT_PLUS_MICRO */
394+ int_micro_times = kcalloc(idx, sizeof(int) * 2, GFP_KERNEL);
395+ if (int_micro_times) {
396+ /*
397+ * This is just to survive a unlikely corner-case where times in
398+ * the given time table were not unique. Else we could just
399+ * trust the gts->num_itime.
400+ */
401+ gts->num_avail_time_tables = idx;
402+ iio_gts_us_to_int_micro(times, int_micro_times, idx);
403+ }
404+
405+ gts->avail_time_tables = int_micro_times;
406+ kfree(times);
407+
408+ if (!int_micro_times)
409+ return -ENOMEM;
388410
389411 return 0;
390412 }
@@ -683,8 +705,8 @@ int iio_gts_avail_times(struct iio_gts *gts, const int **vals, int *type, · 292 unmodified lines
683705 return -EINVAL;
684706
685707 *vals = gts->avail_time_tables;
686− *type = IIO_VAL_INT;
687− *length = gts->num_avail_time_tables;
708+ *type = IIO_VAL_INT_PLUS_MICRO;
709+ *length = gts->num_avail_time_tables * 2;
688710
689711 return IIO_AVAIL_LIST;
690712 }
drivers/iio/light/rohm-bu27034.c+20−6
@@ -231,6 +231,9 @@ struct bu27034_result { · 230 unmodified lines
231231
232232 static const struct regmap_range bu27034_volatile_ranges[] = {
233233 {
234+ .range_min = BU27034_REG_SYSTEM_CONTROL,
235+ .range_max = BU27034_REG_SYSTEM_CONTROL,
236+ }, {
234237 .range_min = BU27034_REG_MODE_CONTROL4,
235238 .range_max = BU27034_REG_MODE_CONTROL4,
236239 }, {
@@ -1167,11 +1170,12 @@ static int bu27034_read_raw(struct iio_dev *idev, · 930 unmodified lines
11671170
11681171 switch (mask) {
11691172 case IIO_CHAN_INFO_INT_TIME:
1170− *val = bu27034_get_int_time(data);
1171− if (*val < 0)
1172− return *val;
1173+ *val = 0;
1174+ *val2 = bu27034_get_int_time(data);
1175+ if (*val2 < 0)
1176+ return *val2;
11731177
1174− return IIO_VAL_INT;
1178+ return IIO_VAL_INT_PLUS_MICRO;
11751179
11761180 case IIO_CHAN_INFO_SCALE:
11771181 return bu27034_get_scale(data, chan->channel, val, val2);
@@ -1229,7 +1233,10 @@ static int bu27034_write_raw(struct iio_dev *idev, · 51 unmodified lines
12291233 ret = bu27034_set_scale(data, chan->channel, val, val2);
12301234 break;
12311235 case IIO_CHAN_INFO_INT_TIME:
1232− ret = bu27034_try_set_int_time(data, val);
1236+ if (!val)
1237+ ret = bu27034_try_set_int_time(data, val2);
1238+ else
1239+ ret = -EINVAL;
12331240 break;
12341241 default:
12351242 ret = -EINVAL;
@@ -1268,12 +1275,19 @@ static int bu27034_chip_init(struct bu27034_data *data) · 32 unmodified lines
12681275 int ret, sel;
12691276
12701277 /* Reset */
1271− ret = regmap_update_bits(data->regmap, BU27034_REG_SYSTEM_CONTROL,
1278+ ret = regmap_write_bits(data->regmap, BU27034_REG_SYSTEM_CONTROL,
12721279 BU27034_MASK_SW_RESET, BU27034_MASK_SW_RESET);
12731280 if (ret)
12741281 return dev_err_probe(data->dev, ret, "Sensor reset failed\n");
12751282
12761283 msleep(1);
1284+
1285+ ret = regmap_reinit_cache(data->regmap, &bu27034_regmap);
1286+ if (ret) {
1287+ dev_err(data->dev, "Failed to reinit reg cache\n");
1288+ return ret;
1289+ }
1290+
12771291 /*
12781292 * Read integration time here to ensure it is in regmap cache. We do
12791293 * this to speed-up the int-time acquisition in the start of the buffer
drivers/iio/light/vcnl4035.c+3−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 * TODO: Proximity
99 */
1010 #include <linux/bitops.h>
11+#include <linux/bitfield.h>
1112 #include <linux/i2c.h>
1213 #include <linux/module.h>
1314 #include <linux/pm_runtime.h>
@@ -42,6 +43,7 @@ · 28 unmodified lines
4243 #define VCNL4035_ALS_PERS_MASK GENMASK(3, 2)
4344 #define VCNL4035_INT_ALS_IF_H_MASK BIT(12)
4445 #define VCNL4035_INT_ALS_IF_L_MASK BIT(13)
46+#define VCNL4035_DEV_ID_MASK GENMASK(7, 0)
4547
4648 /* Default values */
4749 #define VCNL4035_MODE_ALS_ENABLE BIT(0)
@@ -413,6 +415,7 @@ static int vcnl4035_init(struct vcnl4035_data *data) · 365 unmodified lines
413415 return ret;
414416 }
415417
418+ id = FIELD_GET(VCNL4035_DEV_ID_MASK, id);
416419 if (id != VCNL4035_DEV_ID_VAL) {
417420 dev_err(&data->client->dev, "Wrong id, got %x, expected %x\n",
418421 id, VCNL4035_DEV_ID_VAL);
drivers/iio/magnetometer/tmag5273.c+3−2
@@ -296,12 +296,13 @@ static int tmag5273_read_raw(struct iio_dev *indio_dev, · 295 unmodified lines
296296 return ret;
297297
298298 ret = tmag5273_get_measure(data, &t, &x, &y, &z, &angle, &magnitude);
299− if (ret)
300− return ret;
301299
302300 pm_runtime_mark_last_busy(data->dev);
303301 pm_runtime_put_autosuspend(data->dev);
304302
303+ if (ret)
304+ return ret;
305+
305306 switch (chan->address) {
306307 case TEMPERATURE:
307308 *val = t;
drivers/input/input.c+1−1
@@ -703,7 +703,7 @@ void input_close_device(struct input_handle *handle) · 702 unmodified lines
703703
704704 __input_release_device(handle);
705705
706− if (!dev->inhibited && !--dev->users) {
706+ if (!--dev->users && !dev->inhibited) {
707707 if (dev->poller)
708708 input_dev_poller_stop(dev->poller);
709709 if (dev->close)
drivers/input/joystick/xpad.c+0−1
@@ -281,7 +281,6 @@ static const struct xpad_device { · 280 unmodified lines
281281 { 0x1430, 0xf801, "RedOctane Controller", 0, XTYPE_XBOX360 },
282282 { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 },
283283 { 0x146b, 0x0604, "Bigben Interactive DAIJA Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
284− { 0x1532, 0x0037, "Razer Sabertooth", 0, XTYPE_XBOX360 },
285284 { 0x1532, 0x0a00, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
286285 { 0x1532, 0x0a03, "Razer Wildcat", 0, XTYPE_XBOXONE },
287286 { 0x15e4, 0x3f00, "Power A Mini Pro Elite", 0, XTYPE_XBOX360 },
drivers/input/misc/soc_button_array.c+30−0
@@ -108,6 +108,27 @@ static const struct dmi_system_id dmi_use_low_level_irq[] = { · 107 unmodified lines
108108 {} /* Terminating entry */
109109 };
110110
111+/*
112+ * Some devices have a wrong entry which points to a GPIO which is
113+ * required in another driver, so this driver must not claim it.
114+ */
115+static const struct dmi_system_id dmi_invalid_acpi_index[] = {
116+ {
117+ /*
118+ * Lenovo Yoga Book X90F / X90L, the PNP0C40 home button entry
119+ * points to a GPIO which is not a home button and which is
120+ * required by the lenovo-yogabook driver.
121+ */
122+ .matches = {
123+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
124+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
125+ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
126+ },
127+ .driver_data = (void *)1l,
128+ },
129+ {} /* Terminating entry */
130+};
131+
111132 /*
112133 * Get the Nth GPIO number from the ACPI object.
113134 */
@@ -137,6 +158,8 @@ soc_button_device_create(struct platform_device *pdev, · 23 unmodified lines
137158 struct platform_device *pd;
138159 struct gpio_keys_button *gpio_keys;
139160 struct gpio_keys_platform_data *gpio_keys_pdata;
161+ const struct dmi_system_id *dmi_id;
162+ int invalid_acpi_index = -1;
140163 int error, gpio, irq;
141164 int n_buttons = 0;
142165
@@ -154,10 +177,17 @@ soc_button_device_create(struct platform_device *pdev, · 11 unmodified lines
154177 gpio_keys = (void *)(gpio_keys_pdata + 1);
155178 n_buttons = 0;
156179
180+ dmi_id = dmi_first_match(dmi_invalid_acpi_index);
181+ if (dmi_id)
182+ invalid_acpi_index = (long)dmi_id->driver_data;
183+
157184 for (info = button_info; info->name; info++) {
158185 if (info->autorepeat != autorepeat)
159186 continue;
160187
188+ if (info->acpi_index == invalid_acpi_index)
189+ continue;
190+
161191 error = soc_button_lookup_gpio(&pdev->dev, info->acpi_index, &gpio, &irq);
162192 if (error || irq < 0) {
163193 /*
drivers/input/mouse/elantech.c+5−4
@@ -674,10 +674,11 @@ static void process_packet_head_v4(struct psmouse *psmouse) · 673 unmodified lines
674674 struct input_dev *dev = psmouse->dev;
675675 struct elantech_data *etd = psmouse->private;
676676 unsigned char *packet = psmouse->packet;
677− int id = ((packet[3] & 0xe0) >> 5) - 1;
677+ int id;
678678 int pres, traces;
679679
680− if (id < 0)
680+ id = ((packet[3] & 0xe0) >> 5) - 1;
681+ if (id < 0 || id >= ETP_MAX_FINGERS)
681682 return;
682683
683684 etd->mt[id].x = ((packet[1] & 0x0f) << 8) | packet[2];
@@ -707,7 +708,7 @@ static void process_packet_motion_v4(struct psmouse *psmouse) · 23 unmodified lines
707708 int id, sid;
708709
709710 id = ((packet[0] & 0xe0) >> 5) - 1;
710− if (id < 0)
711+ if (id < 0 || id >= ETP_MAX_FINGERS)
711712 return;
712713
713714 sid = ((packet[3] & 0xe0) >> 5) - 1;
@@ -728,7 +729,7 @@ static void process_packet_motion_v4(struct psmouse *psmouse) · 14 unmodified lines
728729 input_report_abs(dev, ABS_MT_POSITION_X, etd->mt[id].x);
729730 input_report_abs(dev, ABS_MT_POSITION_Y, etd->mt[id].y);
730731
731− if (sid >= 0) {
732+ if (sid >= 0 && sid < ETP_MAX_FINGERS) {
732733 etd->mt[sid].x += delta_x2 * weight;
733734 etd->mt[sid].y -= delta_y2 * weight;
734735 input_mt_slot(dev, sid);
drivers/input/touchscreen/cyttsp5.c+1−1
@@ -560,7 +560,7 @@ static int cyttsp5_hid_output_get_sysinfo(struct cyttsp5 *ts) · 559 unmodified lines
560560 static int cyttsp5_hid_output_bl_launch_app(struct cyttsp5 *ts)
561561 {
562562 int rc;
563− u8 cmd[HID_OUTPUT_BL_LAUNCH_APP];
563+ u8 cmd[HID_OUTPUT_BL_LAUNCH_APP_SIZE];
564564 u16 crc;
565565
566566 put_unaligned_le16(HID_OUTPUT_BL_LAUNCH_APP_SIZE, cmd);
drivers/iommu/Kconfig+1−0
@@ -282,6 +282,7 @@ config EXYNOS_IOMMU_DEBUG · 281 unmodified lines
282282 config IPMMU_VMSA
283283 bool "Renesas VMSA-compatible IPMMU"
284284 depends on ARCH_RENESAS || COMPILE_TEST
285+ depends on ARM || ARM64 || COMPILE_TEST
285286 depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_LPAE
286287 select IOMMU_API
287288 select IOMMU_IO_PGTABLE_LPAE
drivers/iommu/amd/amd_iommu.h+1−3
@@ -15,9 +15,7 @@ extern irqreturn_t amd_iommu_int_thread(int irq, void *data); · 14 unmodified lines
1515 extern irqreturn_t amd_iommu_int_handler(int irq, void *data);
1616 extern void amd_iommu_apply_erratum_63(struct amd_iommu *iommu, u16 devid);
1717 extern void amd_iommu_restart_event_logging(struct amd_iommu *iommu);
18−extern int amd_iommu_init_devices(void);
19−extern void amd_iommu_uninit_devices(void);
20−extern void amd_iommu_init_notifier(void);
18+extern void amd_iommu_restart_ga_log(struct amd_iommu *iommu);
2119 extern void amd_iommu_set_rlookup_table(struct amd_iommu *iommu, u16 devid);
2220
2321 #ifdef CONFIG_AMD_IOMMU_DEBUGFS
drivers/iommu/amd/init.c+24−0
@@ -758,6 +758,30 @@ void amd_iommu_restart_event_logging(struct amd_iommu *iommu) · 757 unmodified lines
758758 iommu_feature_enable(iommu, CONTROL_EVT_LOG_EN);
759759 }
760760
761+/*
762+ * This function restarts event logging in case the IOMMU experienced
763+ * an GA log overflow.
764+ */
765+void amd_iommu_restart_ga_log(struct amd_iommu *iommu)
766+{
767+ u32 status;
768+
769+ status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET);
770+ if (status & MMIO_STATUS_GALOG_RUN_MASK)
771+ return;
772+
773+ pr_info_ratelimited("IOMMU GA Log restarting\n");
774+
775+ iommu_feature_disable(iommu, CONTROL_GALOG_EN);
776+ iommu_feature_disable(iommu, CONTROL_GAINT_EN);
777+
778+ writel(MMIO_STATUS_GALOG_OVERFLOW_MASK,
779+ iommu->mmio_base + MMIO_STATUS_OFFSET);
780+
781+ iommu_feature_enable(iommu, CONTROL_GAINT_EN);
782+ iommu_feature_enable(iommu, CONTROL_GALOG_EN);
783+}
784+
761785 /*
762786 * This function resets the command buffer if the IOMMU stopped fetching
763787 * commands from it.
drivers/iommu/amd/iommu.c+25−6
@@ -845,6 +845,7 @@ amd_iommu_set_pci_msi_domain(struct device *dev, struct amd_iommu *iommu) { } · 844 unmodified lines
845845 (MMIO_STATUS_EVT_OVERFLOW_INT_MASK | \
846846 MMIO_STATUS_EVT_INT_MASK | \
847847 MMIO_STATUS_PPR_INT_MASK | \
848+ MMIO_STATUS_GALOG_OVERFLOW_MASK | \
848849 MMIO_STATUS_GALOG_INT_MASK)
849850
850851 irqreturn_t amd_iommu_int_thread(int irq, void *data)
@@ -868,10 +869,16 @@ irqreturn_t amd_iommu_int_thread(int irq, void *data) · 17 unmodified lines
868869 }
869870
870871 #ifdef CONFIG_IRQ_REMAP
871− if (status & MMIO_STATUS_GALOG_INT_MASK) {
872+ if (status & (MMIO_STATUS_GALOG_INT_MASK |
873+ MMIO_STATUS_GALOG_OVERFLOW_MASK)) {
872874 pr_devel("Processing IOMMU GA Log\n");
873875 iommu_poll_ga_log(iommu);
874876 }
877+
878+ if (status & MMIO_STATUS_GALOG_OVERFLOW_MASK) {
879+ pr_info_ratelimited("IOMMU GA Log overflow\n");
880+ amd_iommu_restart_ga_log(iommu);
881+ }
875882 #endif
876883
877884 if (status & MMIO_STATUS_EVT_OVERFLOW_INT_MASK) {
@@ -2067,7 +2074,7 @@ static struct protection_domain *protection_domain_alloc(unsigned int type) · 1189 unmodified lines
20672074 {
20682075 struct io_pgtable_ops *pgtbl_ops;
20692076 struct protection_domain *domain;
2070− int pgtable = amd_iommu_pgtable;
2077+ int pgtable;
20712078 int mode = DEFAULT_PGTABLE_LEVEL;
20722079 int ret;
20732080
@@ -2084,6 +2091,10 @@ static struct protection_domain *protection_domain_alloc(unsigned int type) · 10 unmodified lines
20842091 mode = PAGE_MODE_NONE;
20852092 } else if (type == IOMMU_DOMAIN_UNMANAGED) {
20862093 pgtable = AMD_IOMMU_V1;
2094+ } else if (type == IOMMU_DOMAIN_DMA || type == IOMMU_DOMAIN_DMA_FQ) {
2095+ pgtable = amd_iommu_pgtable;
2096+ } else {
2097+ return NULL;
20872098 }
20882099
20892100 switch (pgtable) {
@@ -2118,6 +2129,15 @@ out_err: · 28 unmodified lines
21182129 return NULL;
21192130 }
21202131
2132+static inline u64 dma_max_address(void)
2133+{
2134+ if (amd_iommu_pgtable == AMD_IOMMU_V1)
2135+ return ~0ULL;
2136+
2137+ /* V2 with 4/5 level page table */
2138+ return ((1ULL << PM_LEVEL_SHIFT(amd_iommu_gpt_level)) - 1);
2139+}
2140+
21212141 static struct iommu_domain *amd_iommu_domain_alloc(unsigned type)
21222142 {
21232143 struct protection_domain *domain;
@@ -2134,7 +2154,7 @@ static struct iommu_domain *amd_iommu_domain_alloc(unsigned type) · 10 unmodified lines
21342154 return NULL;
21352155
21362156 domain->domain.geometry.aperture_start = 0;
2137− domain->domain.geometry.aperture_end = ~0ULL;
2157+ domain->domain.geometry.aperture_end = dma_max_address();
21382158 domain->domain.geometry.force_aperture = true;
21392159
21402160 return &domain->domain;
@@ -2387,7 +2407,7 @@ static void amd_iommu_iotlb_sync(struct iommu_domain *domain, · 246 unmodified lines
23872407 unsigned long flags;
23882408
23892409 spin_lock_irqsave(&dom->lock, flags);
2390− domain_flush_pages(dom, gather->start, gather->end - gather->start, 1);
2410+ domain_flush_pages(dom, gather->start, gather->end - gather->start + 1, 1);
23912411 amd_iommu_domain_flush_complete(dom);
23922412 spin_unlock_irqrestore(&dom->lock, flags);
23932413 }
@@ -3493,8 +3513,7 @@ int amd_iommu_activate_guest_mode(void *data) · 1099 unmodified lines
34933513 struct irte_ga *entry = (struct irte_ga *) ir_data->entry;
34943514 u64 valid;
34953515
3496− if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) ||
3497− !entry || entry->lo.fields_vapic.guest_mode)
3516+ if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) || !entry)
34983517 return 0;
34993518
35003519 valid = entry->lo.fields_vapic.valid;
drivers/iommu/mtk_iommu.c+2−1
@@ -781,7 +781,8 @@ static void mtk_iommu_flush_iotlb_all(struct iommu_domain *domain) · 780 unmodified lines
781781 {
782782 struct mtk_iommu_domain *dom = to_mtk_domain(domain);
783783
784− mtk_iommu_tlb_flush_all(dom->bank->parent_data);
784+ if (dom->bank)
785+ mtk_iommu_tlb_flush_all(dom->bank->parent_data);
785786 }
786787
787788 static void mtk_iommu_iotlb_sync(struct iommu_domain *domain,
drivers/iommu/rockchip-iommu.c+8−6
@@ -1335,20 +1335,22 @@ static int rk_iommu_probe(struct platform_device *pdev) · 1334 unmodified lines
13351335 for (i = 0; i < iommu->num_irq; i++) {
13361336 int irq = platform_get_irq(pdev, i);
13371337
1338− if (irq < 0)
1339− return irq;
1338+ if (irq < 0) {
1339+ err = irq;
1340+ goto err_pm_disable;
1341+ }
13401342
13411343 err = devm_request_irq(iommu->dev, irq, rk_iommu_irq,
13421344 IRQF_SHARED, dev_name(dev), iommu);
1343− if (err) {
1344− pm_runtime_disable(dev);
1345− goto err_remove_sysfs;
1346− }
1345+ if (err)
1346+ goto err_pm_disable;
13471347 }
13481348
13491349 dma_set_mask_and_coherent(dev, rk_ops->dma_bit_mask);
13501350
13511351 return 0;
1352+err_pm_disable:
1353+ pm_runtime_disable(dev);
13521354 err_remove_sysfs:
13531355 iommu_device_sysfs_remove(&iommu->iommu);
13541356 err_put_group:
drivers/irqchip/irq-gic-common.c+2−0
@@ -16,6 +16,8 @@ void gic_enable_of_quirks(const struct device_node *np, · 15 unmodified lines
1616 const struct gic_quirk *quirks, void *data)
1717 {
1818 for (; quirks->desc; quirks++) {
19+ if (!quirks->compatible && !quirks->property)
20+ continue;
1921 if (quirks->compatible &&
2022 !of_device_is_compatible(np, quirks->compatible))
2123 continue;
drivers/leds/rgb/leds-qcom-lpg.c+4−4
@@ -312,14 +312,14 @@ static int lpg_calc_freq(struct lpg_channel *chan, uint64_t period) · 311 unmodified lines
312312 max_res = LPG_RESOLUTION_9BIT;
313313 }
314314
315− min_period = (u64)NSEC_PER_SEC *
316− div64_u64((1 << pwm_resolution_arr[0]), clk_rate_arr[clk_len - 1]);
315+ min_period = div64_u64((u64)NSEC_PER_SEC * (1 << pwm_resolution_arr[0]),
316+ clk_rate_arr[clk_len - 1]);
317317 if (period <= min_period)
318318 return -EINVAL;
319319
320320 /* Limit period to largest possible value, to avoid overflows */
321− max_period = (u64)NSEC_PER_SEC * max_res * LPG_MAX_PREDIV *
322− div64_u64((1 << LPG_MAX_M), 1024);
321+ max_period = div64_u64((u64)NSEC_PER_SEC * max_res * LPG_MAX_PREDIV * (1 << LPG_MAX_M),
322+ 1024);
323323 if (period > max_period)
324324 period = max_period;
325325
drivers/md/raid5.c+1−1
@@ -5516,7 +5516,7 @@ static int raid5_read_one_chunk(struct mddev *mddev, struct bio *raid_bio) · 5515 unmodified lines
55165516
55175517 sector = raid5_compute_sector(conf, raid_bio->bi_iter.bi_sector, 0,
55185518 &dd_idx, NULL);
5519− end_sector = bio_end_sector(raid_bio);
5519+ end_sector = sector + bio_sectors(raid_bio);
55205520
55215521 rcu_read_lock();
55225522 if (r5c_big_stripe_cached(conf, sector))
drivers/media/cec/core/cec-adap.c+6−2
@@ -1091,7 +1091,8 @@ void cec_received_msg_ts(struct cec_adapter *adap, · 1090 unmodified lines
10911091 mutex_lock(&adap->lock);
10921092 dprintk(2, "%s: %*ph\n", __func__, msg->len, msg->msg);
10931093
1094− adap->last_initiator = 0xff;
1094+ if (!adap->transmit_in_progress)
1095+ adap->last_initiator = 0xff;
10951096
10961097 /* Check if this message was for us (directed or broadcast). */
10971098 if (!cec_msg_is_broadcast(msg)) {
@@ -1585,7 +1586,7 @@ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block) · 487 unmodified lines
15851586 *
15861587 * This function is called with adap->lock held.
15871588 */
1588−static int cec_adap_enable(struct cec_adapter *adap)
1589+int cec_adap_enable(struct cec_adapter *adap)
15891590 {
15901591 bool enable;
15911592 int ret = 0;
@@ -1595,6 +1596,9 @@ static int cec_adap_enable(struct cec_adapter *adap) · 3 unmodified lines
15951596 if (adap->needs_hpd)
15961597 enable = enable && adap->phys_addr != CEC_PHYS_ADDR_INVALID;
15971598
1599+ if (adap->devnode.unregistered)
1600+ enable = false;
1601+
15981602 if (enable == adap->is_enabled)
15991603 return 0;
16001604
drivers/media/cec/core/cec-core.c+2−0
@@ -191,6 +191,8 @@ static void cec_devnode_unregister(struct cec_adapter *adap) · 190 unmodified lines
191191 mutex_lock(&adap->lock);
192192 __cec_s_phys_addr(adap, CEC_PHYS_ADDR_INVALID, false);
193193 __cec_s_log_addrs(adap, NULL, false);
194+ // Disable the adapter (since adap->devnode.unregistered is true)
195+ cec_adap_enable(adap);
194196 mutex_unlock(&adap->lock);
195197
196198 cdev_device_del(&devnode->cdev, &devnode->dev);
drivers/media/cec/core/cec-priv.h+1−0
@@ -47,6 +47,7 @@ int cec_monitor_pin_cnt_inc(struct cec_adapter *adap); · 46 unmodified lines
4747 void cec_monitor_pin_cnt_dec(struct cec_adapter *adap);
4848 int cec_adap_status(struct seq_file *file, void *priv);
4949 int cec_thread_func(void *_adap);
50+int cec_adap_enable(struct cec_adapter *adap);
5051 void __cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block);
5152 int __cec_s_log_addrs(struct cec_adapter *adap,
5253 struct cec_log_addrs *log_addrs, bool block);
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c+3−0
@@ -584,6 +584,9 @@ static void mtk_init_vdec_params(struct mtk_vcodec_ctx *ctx) · 583 unmodified lines
584584
585585 if (!(ctx->dev->dec_capability & VCODEC_CAPABILITY_4K_DISABLED)) {
586586 for (i = 0; i < num_supported_formats; i++) {
587+ if (mtk_video_formats[i].type != MTK_FMT_DEC)
588+ continue;
589+
587590 mtk_video_formats[i].frmsize.max_width =
588591 VCODEC_DEC_4K_CODED_WIDTH;
589592 mtk_video_formats[i].frmsize.max_height =
drivers/media/platform/qcom/camss/camss-video.c+0−1
@@ -353,7 +353,6 @@ static int video_get_subdev_format(struct camss_video *video, · 352 unmodified lines
353353 if (subdev == NULL)
354354 return -EPIPE;
355355
356− memset(&fmt, 0, sizeof(fmt));
357356 fmt.pad = pad;
358357
359358 ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
drivers/media/platform/verisilicon/hantro_v4l2.c+4−2
@@ -397,10 +397,12 @@ hantro_reset_raw_fmt(struct hantro_ctx *ctx, int bit_depth) · 396 unmodified lines
397397 if (!raw_vpu_fmt)
398398 return -EINVAL;
399399
400− if (ctx->is_encoder)
400+ if (ctx->is_encoder) {
401401 encoded_fmt = &ctx->dst_fmt;
402− else
402+ ctx->vpu_src_fmt = raw_vpu_fmt;
403+ } else {
403404 encoded_fmt = &ctx->src_fmt;
405+ }
404406
405407 hantro_reset_fmt(&raw_fmt, raw_vpu_fmt);
406408 raw_fmt.width = encoded_fmt->width;
drivers/media/usb/uvc/uvc_driver.c+11−5
@@ -251,14 +251,17 @@ static int uvc_parse_format(struct uvc_device *dev, · 250 unmodified lines
251251 /* Find the format descriptor from its GUID. */
252252 fmtdesc = uvc_format_by_guid(&buffer[5]);
253253
254− if (fmtdesc != NULL) {
255− format->fcc = fmtdesc->fcc;
256− } else {
254+ if (!fmtdesc) {
255+ /*
256+ * Unknown video formats are not fatal errors, the
257+ * caller will skip this descriptor.
258+ */
257259 dev_info(&streaming->intf->dev,
258260 "Unknown video format %pUl\n", &buffer[5]);
259− format->fcc = 0;
261+ return 0;
260262 }
261263
264+ format->fcc = fmtdesc->fcc;
262265 format->bpp = buffer[21];
263266
264267 /*
@@ -675,7 +678,7 @@ static int uvc_parse_streaming(struct uvc_device *dev, · 410 unmodified lines
675678 interval = (u32 *)&frame[nframes];
676679
677680 streaming->format = format;
678− streaming->nformats = nformats;
681+ streaming->nformats = 0;
679682
680683 /* Parse the format descriptors. */
681684 while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE) {
@@ -689,7 +692,10 @@ static int uvc_parse_streaming(struct uvc_device *dev, · 7 unmodified lines
689692 &interval, buffer, buflen);
690693 if (ret < 0)
691694 goto error;
695+ if (!ret)
696+ break;
692697
698+ streaming->nformats++;
693699 frame += format->nframes;
694700 format++;
695701
drivers/media/v4l2-core/v4l2-mc.c+1−2
@@ -314,8 +314,7 @@ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, · 313 unmodified lines
314314 {
315315 struct fwnode_handle *endpoint;
316316
317− if (!(sink->flags & MEDIA_PAD_FL_SINK) ||
318− !is_media_entity_v4l2_subdev(sink->entity))
317+ if (!(sink->flags & MEDIA_PAD_FL_SINK))
319318 return -EINVAL;
320319
321320 fwnode_graph_for_each_endpoint(dev_fwnode(src_sd->dev), endpoint) {
drivers/misc/fastrpc.c+23−8
@@ -316,12 +316,14 @@ static void fastrpc_free_map(struct kref *ref) · 315 unmodified lines
316316 if (map->table) {
317317 if (map->attr & FASTRPC_ATTR_SECUREMAP) {
318318 struct qcom_scm_vmperm perm;
319+ int vmid = map->fl->cctx->vmperms[0].vmid;
320+ u64 src_perms = BIT(QCOM_SCM_VMID_HLOS) | BIT(vmid);
319321 int err = 0;
320322
321323 perm.vmid = QCOM_SCM_VMID_HLOS;
322324 perm.perm = QCOM_SCM_PERM_RWX;
323325 err = qcom_scm_assign_mem(map->phys, map->size,
324− &map->fl->cctx->perms, &perm, 1);
326+ &src_perms, &perm, 1);
325327 if (err) {
326328 dev_err(map->fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d",
327329 map->phys, map->size, err);
@@ -787,8 +789,12 @@ static int fastrpc_map_create(struct fastrpc_user *fl, int fd, · 459 unmodified lines
787789 goto map_err;
788790 }
789791
790− map->phys = sg_dma_address(map->table->sgl);
791− map->phys += ((u64)fl->sctx->sid << 32);
792+ if (attr & FASTRPC_ATTR_SECUREMAP) {
793+ map->phys = sg_phys(map->table->sgl);
794+ } else {
795+ map->phys = sg_dma_address(map->table->sgl);
796+ map->phys += ((u64)fl->sctx->sid << 32);
797+ }
792798 map->size = len;
793799 map->va = sg_virt(map->table->sgl);
794800 map->len = len;
@@ -798,9 +804,15 @@ static int fastrpc_map_create(struct fastrpc_user *fl, int fd, · 3 unmodified lines
798804 * If subsystem VMIDs are defined in DTSI, then do
799805 * hyp_assign from HLOS to those VM(s)
800806 */
807+ u64 src_perms = BIT(QCOM_SCM_VMID_HLOS);
808+ struct qcom_scm_vmperm dst_perms[2] = {0};
809+
810+ dst_perms[0].vmid = QCOM_SCM_VMID_HLOS;
811+ dst_perms[0].perm = QCOM_SCM_PERM_RW;
812+ dst_perms[1].vmid = fl->cctx->vmperms[0].vmid;
813+ dst_perms[1].perm = QCOM_SCM_PERM_RWX;
801814 map->attr = attr;
802− err = qcom_scm_assign_mem(map->phys, (u64)map->size, &fl->cctx->perms,
803− fl->cctx->vmperms, fl->cctx->vmcount);
815+ err = qcom_scm_assign_mem(map->phys, (u64)map->size, &src_perms, dst_perms, 2);
804816 if (err) {
805817 dev_err(sess->dev, "Failed to assign memory with phys 0x%llx size 0x%llx err %d",
806818 map->phys, map->size, err);
@@ -1892,7 +1904,7 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp) · 1085 unmodified lines
18921904 req.vaddrout = rsp_msg.vaddr;
18931905
18941906 /* Add memory to static PD pool, protection thru hypervisor */
1895− if (req.flags != ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) {
1907+ if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) {
18961908 struct qcom_scm_vmperm perm;
18971909
18981910 perm.vmid = QCOM_SCM_VMID_HLOS;
@@ -2337,8 +2349,10 @@ static void fastrpc_notify_users(struct fastrpc_user *user) · 438 unmodified lines
23372349 struct fastrpc_invoke_ctx *ctx;
23382350
23392351 spin_lock(&user->lock);
2340− list_for_each_entry(ctx, &user->pending, node)
2352+ list_for_each_entry(ctx, &user->pending, node) {
2353+ ctx->retval = -EPIPE;
23412354 complete(&ctx->work);
2355+ }
23422356 spin_unlock(&user->lock);
23432357 }
23442358
@@ -2349,7 +2363,9 @@ static void fastrpc_rpmsg_remove(struct rpmsg_device *rpdev) · 4 unmodified lines
23492363 struct fastrpc_user *user;
23502364 unsigned long flags;
23512365
2366+ /* No invocations past this point */
23522367 spin_lock_irqsave(&cctx->lock, flags);
2368+ cctx->rpdev = NULL;
23532369 list_for_each_entry(user, &cctx->users, user)
23542370 fastrpc_notify_users(user);
23552371 spin_unlock_irqrestore(&cctx->lock, flags);
@@ -2368,7 +2384,6 @@ static void fastrpc_rpmsg_remove(struct rpmsg_device *rpdev) · 12 unmodified lines
23682384
23692385 of_platform_depopulate(&rpdev->dev);
23702386
2371− cctx->rpdev = NULL;
23722387 fastrpc_channel_ctx_put(cctx);
23732388 }
23742389
drivers/mmc/core/pwrseq_sd8787.c+26−8
@@ -28,7 +28,6 @@ struct mmc_pwrseq_sd8787 { · 27 unmodified lines
2828 struct mmc_pwrseq pwrseq;
2929 struct gpio_desc *reset_gpio;
3030 struct gpio_desc *pwrdn_gpio;
31− u32 reset_pwrdwn_delay_ms;
3231 };
3332
3433 #define to_pwrseq_sd8787(p) container_of(p, struct mmc_pwrseq_sd8787, pwrseq)
@@ -39,7 +38,7 @@ static void mmc_pwrseq_sd8787_pre_power_on(struct mmc_host *host) · 4 unmodified lines
3938
4039 gpiod_set_value_cansleep(pwrseq->reset_gpio, 1);
4140
42− msleep(pwrseq->reset_pwrdwn_delay_ms);
41+ msleep(300);
4342 gpiod_set_value_cansleep(pwrseq->pwrdn_gpio, 1);
4443 }
4544
@@ -51,17 +50,37 @@ static void mmc_pwrseq_sd8787_power_off(struct mmc_host *host) · 5 unmodified lines
5150 gpiod_set_value_cansleep(pwrseq->reset_gpio, 0);
5251 }
5352
53+static void mmc_pwrseq_wilc1000_pre_power_on(struct mmc_host *host)
54+{
55+ struct mmc_pwrseq_sd8787 *pwrseq = to_pwrseq_sd8787(host->pwrseq);
56+
57+ /* The pwrdn_gpio is really CHIP_EN, reset_gpio is RESETN */
58+ gpiod_set_value_cansleep(pwrseq->pwrdn_gpio, 1);
59+ msleep(5);
60+ gpiod_set_value_cansleep(pwrseq->reset_gpio, 1);
61+}
62+
63+static void mmc_pwrseq_wilc1000_power_off(struct mmc_host *host)
64+{
65+ struct mmc_pwrseq_sd8787 *pwrseq = to_pwrseq_sd8787(host->pwrseq);
66+
67+ gpiod_set_value_cansleep(pwrseq->reset_gpio, 0);
68+ gpiod_set_value_cansleep(pwrseq->pwrdn_gpio, 0);
69+}
70+
5471 static const struct mmc_pwrseq_ops mmc_pwrseq_sd8787_ops = {
5572 .pre_power_on = mmc_pwrseq_sd8787_pre_power_on,
5673 .power_off = mmc_pwrseq_sd8787_power_off,
5774 };
5875
59−static const u32 sd8787_delay_ms = 300;
60−static const u32 wilc1000_delay_ms = 5;
76+static const struct mmc_pwrseq_ops mmc_pwrseq_wilc1000_ops = {
77+ .pre_power_on = mmc_pwrseq_wilc1000_pre_power_on,
78+ .power_off = mmc_pwrseq_wilc1000_power_off,
79+};
6180
6281 static const struct of_device_id mmc_pwrseq_sd8787_of_match[] = {
63− { .compatible = "mmc-pwrseq-sd8787", .data = &sd8787_delay_ms },
64− { .compatible = "mmc-pwrseq-wilc1000", .data = &wilc1000_delay_ms },
82+ { .compatible = "mmc-pwrseq-sd8787", .data = &mmc_pwrseq_sd8787_ops },
83+ { .compatible = "mmc-pwrseq-wilc1000", .data = &mmc_pwrseq_wilc1000_ops },
6584 {/* sentinel */},
6685 };
6786 MODULE_DEVICE_TABLE(of, mmc_pwrseq_sd8787_of_match);
@@ -77,7 +96,6 @@ static int mmc_pwrseq_sd8787_probe(struct platform_device *pdev) · 9 unmodified lines
7796 return -ENOMEM;
7897
7998 match = of_match_node(mmc_pwrseq_sd8787_of_match, pdev->dev.of_node);
80− pwrseq->reset_pwrdwn_delay_ms = *(u32 *)match->data;
8199
82100 pwrseq->pwrdn_gpio = devm_gpiod_get(dev, "powerdown", GPIOD_OUT_LOW);
83101 if (IS_ERR(pwrseq->pwrdn_gpio))
@@ -88,7 +106,7 @@ static int mmc_pwrseq_sd8787_probe(struct platform_device *pdev) · 4 unmodified lines
88106 return PTR_ERR(pwrseq->reset_gpio);
89107
90108 pwrseq->pwrseq.dev = dev;
91− pwrseq->pwrseq.ops = &mmc_pwrseq_sd8787_ops;
109+ pwrseq->pwrseq.ops = match->data;
92110 pwrseq->pwrseq.owner = THIS_MODULE;
93111 platform_set_drvdata(pdev, pwrseq);
94112
drivers/mmc/host/vub300.c+3−0
@@ -1713,6 +1713,9 @@ static void construct_request_response(struct vub300_mmc_host *vub300, · 1712 unmodified lines
17131713 int bytes = 3 & less_cmd;
17141714 int words = less_cmd >> 2;
17151715 u8 *r = vub300->resp.response.command_response;
1716+
1717+ if (!resp_len)
1718+ return;
17161719 if (bytes == 3) {
17171720 cmd->resp[words] = (r[1 + (words << 2)] << 24)
17181721 | (r[2 + (words << 2)] << 16)
drivers/mtd/mtdchar.c+4−4
@@ -590,8 +590,8 @@ static void adjust_oob_length(struct mtd_info *mtd, uint64_t start, · 589 unmodified lines
590590 (end_page - start_page + 1) * oob_per_page);
591591 }
592592
593−static int mtdchar_write_ioctl(struct mtd_info *mtd,
594− struct mtd_write_req __user *argp)
593+static noinline_for_stack int
594+mtdchar_write_ioctl(struct mtd_info *mtd, struct mtd_write_req __user *argp)
595595 {
596596 struct mtd_info *master = mtd_get_master(mtd);
597597 struct mtd_write_req req;
@@ -688,8 +688,8 @@ static int mtdchar_write_ioctl(struct mtd_info *mtd, · 90 unmodified lines
688688 return ret;
689689 }
690690
691−static int mtdchar_read_ioctl(struct mtd_info *mtd,
692− struct mtd_read_req __user *argp)
691+static noinline_for_stack int
692+mtdchar_read_ioctl(struct mtd_info *mtd, struct mtd_read_req __user *argp)
693693 {
694694 struct mtd_info *master = mtd_get_master(mtd);
695695 struct mtd_read_req req;
drivers/mtd/nand/raw/ingenic/ingenic_ecc.h+4−4
@@ -36,25 +36,25 @@ int ingenic_ecc_correct(struct ingenic_ecc *ecc, · 35 unmodified lines
3636 void ingenic_ecc_release(struct ingenic_ecc *ecc);
3737 struct ingenic_ecc *of_ingenic_ecc_get(struct device_node *np);
3838 #else /* CONFIG_MTD_NAND_INGENIC_ECC */
39−int ingenic_ecc_calculate(struct ingenic_ecc *ecc,
39+static inline int ingenic_ecc_calculate(struct ingenic_ecc *ecc,
4040 struct ingenic_ecc_params *params,
4141 const u8 *buf, u8 *ecc_code)
4242 {
4343 return -ENODEV;
4444 }
4545
46−int ingenic_ecc_correct(struct ingenic_ecc *ecc,
46+static inline int ingenic_ecc_correct(struct ingenic_ecc *ecc,
4747 struct ingenic_ecc_params *params, u8 *buf,
4848 u8 *ecc_code)
4949 {
5050 return -ENODEV;
5151 }
5252
53−void ingenic_ecc_release(struct ingenic_ecc *ecc)
53+static inline void ingenic_ecc_release(struct ingenic_ecc *ecc)
5454 {
5555 }
5656
57−struct ingenic_ecc *of_ingenic_ecc_get(struct device_node *np)
57+static inline struct ingenic_ecc *of_ingenic_ecc_get(struct device_node *np)
5858 {
5959 return ERR_PTR(-ENODEV);
6060 }
drivers/mtd/nand/raw/marvell_nand.c+6−4
@@ -2457,6 +2457,12 @@ static int marvell_nfc_setup_interface(struct nand_chip *chip, int chipnr, · 2456 unmodified lines
24572457 NDTR1_WAIT_MODE;
24582458 }
24592459
2460+ /*
2461+ * Reset nfc->selected_chip so the next command will cause the timing
2462+ * registers to be updated in marvell_nfc_select_target().
2463+ */
2464+ nfc->selected_chip = NULL;
2465+
24602466 return 0;
24612467 }
24622468
@@ -2894,10 +2900,6 @@ static int marvell_nfc_init(struct marvell_nfc *nfc) · 431 unmodified lines
28942900 regmap_update_bits(sysctrl_base, GENCONF_CLK_GATING_CTRL,
28952901 GENCONF_CLK_GATING_CTRL_ND_GATE,
28962902 GENCONF_CLK_GATING_CTRL_ND_GATE);
2897−
2898− regmap_update_bits(sysctrl_base, GENCONF_ND_CLK_CTRL,
2899− GENCONF_ND_CLK_CTRL_EN,
2900− GENCONF_ND_CLK_CTRL_EN);
29012903 }
29022904
29032905 /* Configure the DMA if appropriate */
drivers/mtd/spi-nor/core.c+4−1
@@ -2018,6 +2018,7 @@ static const struct spi_nor_manufacturer *manufacturers[] = { · 2017 unmodified lines
20182018
20192019 static const struct flash_info spi_nor_generic_flash = {
20202020 .name = "spi-nor-generic",
2021+ .n_banks = 1,
20212022 /*
20222023 * JESD216 rev A doesn't specify the page size, therefore we need a
20232024 * sane default.
@@ -2921,7 +2922,8 @@ static void spi_nor_late_init_params(struct spi_nor *nor) · 897 unmodified lines
29212922 if (nor->flags & SNOR_F_HAS_LOCK && !nor->params->locking_ops)
29222923 spi_nor_init_default_locking_ops(nor);
29232924
2924− nor->params->bank_size = div64_u64(nor->params->size, nor->info->n_banks);
2925+ if (nor->info->n_banks > 1)
2926+ params->bank_size = div64_u64(params->size, nor->info->n_banks);
29252927 }
29262928
29272929 /**
@@ -2987,6 +2989,7 @@ static void spi_nor_init_default_params(struct spi_nor *nor) · 59 unmodified lines
29872989 /* Set SPI NOR sizes. */
29882990 params->writesize = 1;
29892991 params->size = (u64)info->sector_size * info->n_sectors;
2992+ params->bank_size = params->size;
29902993 params->page_size = info->page_size;
29912994
29922995 if (!(info->flags & SPI_NOR_NO_FR)) {
drivers/mtd/spi-nor/spansion.c+2−2
@@ -361,7 +361,7 @@ static int cypress_nor_determine_addr_mode_by_sr1(struct spi_nor *nor, · 360 unmodified lines
361361 */
362362 static int cypress_nor_set_addr_mode_nbytes(struct spi_nor *nor)
363363 {
364− struct spi_mem_op op;
364+ struct spi_mem_op op = {};
365365 u8 addr_mode;
366366 int ret;
367367
@@ -492,7 +492,7 @@ s25fs256t_post_bfpt_fixup(struct spi_nor *nor, · 124 unmodified lines
492492 const struct sfdp_parameter_header *bfpt_header,
493493 const struct sfdp_bfpt *bfpt)
494494 {
495− struct spi_mem_op op;
495+ struct spi_mem_op op = {};
496496 int ret;
497497
498498 ret = cypress_nor_set_addr_mode_nbytes(nor);
drivers/net/dsa/lan9303-core.c+0−4
@@ -1188,8 +1188,6 @@ static int lan9303_port_fdb_add(struct dsa_switch *ds, int port, · 1187 unmodified lines
11881188 struct lan9303 *chip = ds->priv;
11891189
11901190 dev_dbg(chip->dev, "%s(%d, %pM, %d)\n", __func__, port, addr, vid);
1191− if (vid)
1192− return -EOPNOTSUPP;
11931191
11941192 return lan9303_alr_add_port(chip, addr, port, false);
11951193 }
@@ -1201,8 +1199,6 @@ static int lan9303_port_fdb_del(struct dsa_switch *ds, int port, · 5 unmodified lines
12011199 struct lan9303 *chip = ds->priv;
12021200
12031201 dev_dbg(chip->dev, "%s(%d, %pM, %d)\n", __func__, port, addr, vid);
1204− if (vid)
1205− return -EOPNOTSUPP;
12061202 lan9303_alr_del_port(chip, addr, port);
12071203
12081204 return 0;
drivers/net/dsa/qca/Kconfig+1−0
@@ -20,6 +20,7 @@ config NET_DSA_QCA8K_LEDS_SUPPORT · 19 unmodified lines
2020 bool "Qualcomm Atheros QCA8K Ethernet switch family LEDs support"
2121 depends on NET_DSA_QCA8K
2222 depends on LEDS_CLASS=y || LEDS_CLASS=NET_DSA_QCA8K
23+ depends on LEDS_TRIGGERS
2324 help
2425 This enabled support for LEDs present on the Qualcomm Atheros
2526 QCA8K Ethernet switch chips.
drivers/net/ethernet/amd/pds_core/dev.c+8−2
@@ -68,9 +68,15 @@ bool pdsc_is_fw_running(struct pdsc *pdsc) · 67 unmodified lines
6868
6969 bool pdsc_is_fw_good(struct pdsc *pdsc)
7070 {
71− u8 gen = pdsc->fw_status & PDS_CORE_FW_STS_F_GENERATION;
71+ bool fw_running = pdsc_is_fw_running(pdsc);
72+ u8 gen;
7273
73− return pdsc_is_fw_running(pdsc) && gen == pdsc->fw_generation;
74+ /* Make sure to update the cached fw_status by calling
75+ * pdsc_is_fw_running() before getting the generation
76+ */
77+ gen = pdsc->fw_status & PDS_CORE_FW_STS_F_GENERATION;
78+
79+ return fw_running && gen == pdsc->fw_generation;
7480 }
7581
7682 static u8 pdsc_devcmd_status(struct pdsc *pdsc)
drivers/net/ethernet/broadcom/bcmsysport.c+2−2
@@ -2531,9 +2531,9 @@ static int bcm_sysport_probe(struct platform_device *pdev) · 2530 unmodified lines
25312531 priv->irq0 = platform_get_irq(pdev, 0);
25322532 if (!priv->is_lite) {
25332533 priv->irq1 = platform_get_irq(pdev, 1);
2534− priv->wol_irq = platform_get_irq(pdev, 2);
2534+ priv->wol_irq = platform_get_irq_optional(pdev, 2);
25352535 } else {
2536− priv->wol_irq = platform_get_irq(pdev, 1);
2536+ priv->wol_irq = platform_get_irq_optional(pdev, 1);
25372537 }
25382538 if (priv->irq0 <= 0 || (priv->irq1 <= 0 && !priv->is_lite)) {
25392539 ret = -EINVAL;
drivers/net/ethernet/broadcom/bnxt/bnxt.c+32−10
@@ -692,7 +692,7 @@ next_tx_int: · 691 unmodified lines
692692
693693 __netif_txq_completed_wake(txq, nr_pkts, tx_bytes,
694694 bnxt_tx_avail(bp, txr), bp->tx_wake_thresh,
695− READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING);
695+ READ_ONCE(txr->dev_state) == BNXT_DEV_STATE_CLOSING);
696696 }
697697
698698 static struct page *__bnxt_alloc_rx_page(struct bnxt *bp, dma_addr_t *mapping,
@@ -2361,6 +2361,9 @@ static int bnxt_async_event_process(struct bnxt *bp, · 1662 unmodified lines
23612361 struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
23622362 u64 ns;
23632363
2364+ if (!ptp)
2365+ goto async_event_process_exit;
2366+
23642367 spin_lock_bh(&ptp->ptp_lock);
23652368 bnxt_ptp_update_current_time(bp);
23662369 ns = (((u64)BNXT_EVENT_PHC_RTC_UPDATE(data1) <<
@@ -4759,6 +4762,9 @@ int bnxt_hwrm_func_drv_rgtr(struct bnxt *bp, unsigned long *bmap, int bmap_size, · 2392 unmodified lines
47594762 if (event_id == ASYNC_EVENT_CMPL_EVENT_ID_ERROR_RECOVERY &&
47604763 !(bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY))
47614764 continue;
4765+ if (event_id == ASYNC_EVENT_CMPL_EVENT_ID_PHC_UPDATE &&
4766+ !bp->ptp_cfg)
4767+ continue;
47624768 __set_bit(bnxt_async_events_arr[i], async_events_bmap);
47634769 }
47644770 if (bmap && bmap_size) {
@@ -5346,6 +5352,7 @@ static void bnxt_hwrm_update_rss_hash_cfg(struct bnxt *bp) · 581 unmodified lines
53465352 if (hwrm_req_init(bp, req, HWRM_VNIC_RSS_QCFG))
53475353 return;
53485354
5355+ req->vnic_id = cpu_to_le16(vnic->fw_vnic_id);
53495356 /* all contexts configured to same hash_type, zero always exists */
53505357 req->rss_ctx_idx = cpu_to_le16(vnic->fw_rss_cos_lb_ctx[0]);
53515358 resp = hwrm_req_hold(bp, req);
@@ -8808,6 +8815,9 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init) · 3456 unmodified lines
88088815 goto err_out;
88098816 }
88108817
8818+ if (BNXT_VF(bp))
8819+ bnxt_hwrm_func_qcfg(bp);
8820+
88118821 rc = bnxt_setup_vnic(bp, 0);
88128822 if (rc)
88138823 goto err_out;
@@ -11594,6 +11604,7 @@ static void bnxt_tx_timeout(struct net_device *dev, unsigned int txqueue) · 2780 unmodified lines
1159411604 static void bnxt_fw_health_check(struct bnxt *bp)
1159511605 {
1159611606 struct bnxt_fw_health *fw_health = bp->fw_health;
11607+ struct pci_dev *pdev = bp->pdev;
1159711608 u32 val;
1159811609
1159911610 if (!fw_health->enabled || test_bit(BNXT_STATE_IN_FW_RESET, &bp->state))
@@ -11607,7 +11618,7 @@ static void bnxt_fw_health_check(struct bnxt *bp) · 7 unmodified lines
1160711618 }
1160811619
1160911620 val = bnxt_fw_health_readl(bp, BNXT_FW_HEARTBEAT_REG);
11610− if (val == fw_health->last_fw_heartbeat) {
11621+ if (val == fw_health->last_fw_heartbeat && pci_device_is_present(pdev)) {
1161111622 fw_health->arrests++;
1161211623 goto fw_reset;
1161311624 }
@@ -11615,7 +11626,7 @@ static void bnxt_fw_health_check(struct bnxt *bp) · 1 unmodified line
1161511626 fw_health->last_fw_heartbeat = val;
1161611627
1161711628 val = bnxt_fw_health_readl(bp, BNXT_FW_RESET_CNT_REG);
11618− if (val != fw_health->last_fw_reset_cnt) {
11629+ if (val != fw_health->last_fw_reset_cnt && pci_device_is_present(pdev)) {
1161911630 fw_health->discoveries++;
1162011631 goto fw_reset;
1162111632 }
@@ -13021,26 +13032,37 @@ static void bnxt_cfg_ntp_filters(struct bnxt *bp) · 1399 unmodified lines
1302113032
1302213033 #endif /* CONFIG_RFS_ACCEL */
1302313034
13024−static int bnxt_udp_tunnel_sync(struct net_device *netdev, unsigned int table)
13035+static int bnxt_udp_tunnel_set_port(struct net_device *netdev, unsigned int table,
13036+ unsigned int entry, struct udp_tunnel_info *ti)
1302513037 {
1302613038 struct bnxt *bp = netdev_priv(netdev);
13027− struct udp_tunnel_info ti;
1302813039 unsigned int cmd;
1302913040
13030− udp_tunnel_nic_get_port(netdev, table, 0, &ti);
13031− if (ti.type == UDP_TUNNEL_TYPE_VXLAN)
13041+ if (ti->type == UDP_TUNNEL_TYPE_VXLAN)
1303213042 cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN;
1303313043 else
1303413044 cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE;
1303513045
13036− if (ti.port)
13037− return bnxt_hwrm_tunnel_dst_port_alloc(bp, ti.port, cmd);
13046+ return bnxt_hwrm_tunnel_dst_port_alloc(bp, ti->port, cmd);
13047+}
13048+
13049+static int bnxt_udp_tunnel_unset_port(struct net_device *netdev, unsigned int table,
13050+ unsigned int entry, struct udp_tunnel_info *ti)
13051+{
13052+ struct bnxt *bp = netdev_priv(netdev);
13053+ unsigned int cmd;
13054+
13055+ if (ti->type == UDP_TUNNEL_TYPE_VXLAN)
13056+ cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN;
13057+ else
13058+ cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE;
1303813059
1303913060 return bnxt_hwrm_tunnel_dst_port_free(bp, cmd);
1304013061 }
1304113062
1304213063 static const struct udp_tunnel_nic_info bnxt_udp_tunnels = {
13043− .sync_table = bnxt_udp_tunnel_sync,
13064+ .set_port = bnxt_udp_tunnel_set_port,
13065+ .unset_port = bnxt_udp_tunnel_unset_port,
1304413066 .flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP |
1304513067 UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
1304613068 .tables = {
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c+1−1
@@ -3831,7 +3831,7 @@ static int bnxt_reset(struct net_device *dev, u32 *flags) · 3830 unmodified lines
38313831 }
38323832 }
38333833
3834− if (req & BNXT_FW_RESET_AP) {
3834+ if (!BNXT_CHIP_P4_PLUS(bp) && (req & BNXT_FW_RESET_AP)) {
38353835 /* This feature is not supported in older firmware versions */
38363836 if (bp->hwrm_spec_code >= 0x10803) {
38373837 if (!bnxt_firmware_reset_ap(dev)) {
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c+1−0
@@ -952,6 +952,7 @@ int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg) · 951 unmodified lines
952952 bnxt_ptp_timecounter_init(bp, true);
953953 bnxt_ptp_adjfine_rtc(bp, 0);
954954 }
955+ bnxt_hwrm_func_drv_rgtr(bp, NULL, 0, true);
955956
956957 ptp->ptp_info = bnxt_ptp_caps;
957958 if ((bp->fw_cap & BNXT_FW_CAP_PTP_PPS)) {
drivers/net/ethernet/broadcom/genet/bcmgenet.c+8−14
@@ -1272,7 +1272,8 @@ static void bcmgenet_get_ethtool_stats(struct net_device *dev, · 1271 unmodified lines
12721272 }
12731273 }
12741274
1275−static void bcmgenet_eee_enable_set(struct net_device *dev, bool enable)
1275+void bcmgenet_eee_enable_set(struct net_device *dev, bool enable,
1276+ bool tx_lpi_enabled)
12761277 {
12771278 struct bcmgenet_priv *priv = netdev_priv(dev);
12781279 u32 off = priv->hw_params->tbuf_offset + TBUF_ENERGY_CTRL;
@@ -1292,7 +1293,7 @@ static void bcmgenet_eee_enable_set(struct net_device *dev, bool enable) · 13 unmodified lines
12921293
12931294 /* Enable EEE and switch to a 27Mhz clock automatically */
12941295 reg = bcmgenet_readl(priv->base + off);
1295− if (enable)
1296+ if (tx_lpi_enabled)
12961297 reg |= TBUF_EEE_EN | TBUF_PM_EN;
12971298 else
12981299 reg &= ~(TBUF_EEE_EN | TBUF_PM_EN);
@@ -1313,6 +1314,7 @@ static void bcmgenet_eee_enable_set(struct net_device *dev, bool enable) · 14 unmodified lines
13131314
13141315 priv->eee.eee_enabled = enable;
13151316 priv->eee.eee_active = enable;
1317+ priv->eee.tx_lpi_enabled = tx_lpi_enabled;
13161318 }
13171319
13181320 static int bcmgenet_get_eee(struct net_device *dev, struct ethtool_eee *e)
@@ -1328,6 +1330,7 @@ static int bcmgenet_get_eee(struct net_device *dev, struct ethtool_eee *e) · 9 unmodified lines
13281330
13291331 e->eee_enabled = p->eee_enabled;
13301332 e->eee_active = p->eee_active;
1333+ e->tx_lpi_enabled = p->tx_lpi_enabled;
13311334 e->tx_lpi_timer = bcmgenet_umac_readl(priv, UMAC_EEE_LPI_TIMER);
13321335
13331336 return phy_ethtool_get_eee(dev->phydev, e);
@@ -1337,7 +1340,6 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e) · 3 unmodified lines
13371340 {
13381341 struct bcmgenet_priv *priv = netdev_priv(dev);
13391342 struct ethtool_eee *p = &priv->eee;
1340− int ret = 0;
13411343
13421344 if (GENET_IS_V1(priv))
13431345 return -EOPNOTSUPP;
@@ -1348,16 +1350,11 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e) · 4 unmodified lines
13481350 p->eee_enabled = e->eee_enabled;
13491351
13501352 if (!p->eee_enabled) {
1351− bcmgenet_eee_enable_set(dev, false);
1353+ bcmgenet_eee_enable_set(dev, false, false);
13521354 } else {
1353− ret = phy_init_eee(dev->phydev, false);
1354− if (ret) {
1355− netif_err(priv, hw, dev, "EEE initialization failed\n");
1356− return ret;
1357− }
1358−
1355+ p->eee_active = phy_init_eee(dev->phydev, false) >= 0;
13591356 bcmgenet_umac_writel(priv, e->tx_lpi_timer, UMAC_EEE_LPI_TIMER);
1360− bcmgenet_eee_enable_set(dev, true);
1357+ bcmgenet_eee_enable_set(dev, p->eee_active, e->tx_lpi_enabled);
13611358 }
13621359
13631360 return phy_ethtool_set_eee(dev->phydev, e);
@@ -4279,9 +4276,6 @@ static int bcmgenet_resume(struct device *d) · 2915 unmodified lines
42794276 if (!device_may_wakeup(d))
42804277 phy_resume(dev->phydev);
42814278
4282− if (priv->eee.eee_enabled)
4283− bcmgenet_eee_enable_set(dev, true);
4284−
42854279 bcmgenet_netif_start(dev);
42864280
42874281 netif_device_attach(dev);
drivers/net/ethernet/broadcom/genet/bcmgenet.h+3−0
@@ -703,4 +703,7 @@ int bcmgenet_wol_power_down_cfg(struct bcmgenet_priv *priv, · 702 unmodified lines
703703 void bcmgenet_wol_power_up_cfg(struct bcmgenet_priv *priv,
704704 enum bcmgenet_power_mode mode);
705705
706+void bcmgenet_eee_enable_set(struct net_device *dev, bool enable,
707+ bool tx_lpi_enabled);
708+
706709 #endif /* __BCMGENET_H__ */
drivers/net/ethernet/broadcom/genet/bcmmii.c+5−0
@@ -87,6 +87,11 @@ static void bcmgenet_mac_config(struct net_device *dev) · 86 unmodified lines
8787 reg |= CMD_TX_EN | CMD_RX_EN;
8888 }
8989 bcmgenet_umac_writel(priv, reg, UMAC_CMD);
90+
91+ priv->eee.eee_active = phy_init_eee(phydev, 0) >= 0;
92+ bcmgenet_eee_enable_set(dev,
93+ priv->eee.eee_enabled && priv->eee.eee_active,
94+ priv->eee.tx_lpi_enabled);
9095 }
9196
9297 /* setup netdev link state when PHY link status change and
drivers/net/ethernet/freescale/enetc/enetc.c+15−1
@@ -1229,7 +1229,13 @@ static int enetc_clean_rx_ring(struct enetc_bdr *rx_ring, · 1228 unmodified lines
12291229 if (!skb)
12301230 break;
12311231
1232− rx_byte_cnt += skb->len;
1232+ /* When set, the outer VLAN header is extracted and reported
1233+ * in the receive buffer descriptor. So rx_byte_cnt should
1234+ * add the length of the extracted VLAN header.
1235+ */
1236+ if (bd_status & ENETC_RXBD_FLAG_VLAN)
1237+ rx_byte_cnt += VLAN_HLEN;
1238+ rx_byte_cnt += skb->len + ETH_HLEN;
12331239 rx_frm_cnt++;
12341240
12351241 napi_gro_receive(napi, skb);
@@ -1564,6 +1570,14 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring, · 328 unmodified lines
15641570 enetc_build_xdp_buff(rx_ring, bd_status, &rxbd, &i,
15651571 &cleaned_cnt, &xdp_buff);
15661572
1573+ /* When set, the outer VLAN header is extracted and reported
1574+ * in the receive buffer descriptor. So rx_byte_cnt should
1575+ * add the length of the extracted VLAN header.
1576+ */
1577+ if (bd_status & ENETC_RXBD_FLAG_VLAN)
1578+ rx_byte_cnt += VLAN_HLEN;
1579+ rx_byte_cnt += xdp_get_buff_len(&xdp_buff);
1580+
15671581 xdp_act = bpf_prog_run_xdp(prog, &xdp_buff);
15681582
15691583 switch (xdp_act) {
drivers/net/ethernet/intel/ice/ice_common.c+1−1
@@ -5160,7 +5160,7 @@ ice_aq_read_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr, · 5159 unmodified lines
51605160 */
51615161 int
51625162 ice_aq_write_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr,
5163− u16 bus_addr, __le16 addr, u8 params, u8 *data,
5163+ u16 bus_addr, __le16 addr, u8 params, const u8 *data,
51645164 struct ice_sq_cd *cd)
51655165 {
51665166 struct ice_aq_desc desc = { 0 };
drivers/net/ethernet/intel/ice/ice_common.h+1−1
@@ -229,7 +229,7 @@ ice_aq_read_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr, · 228 unmodified lines
229229 struct ice_sq_cd *cd);
230230 int
231231 ice_aq_write_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr,
232− u16 bus_addr, __le16 addr, u8 params, u8 *data,
232+ u16 bus_addr, __le16 addr, u8 params, const u8 *data,
233233 struct ice_sq_cd *cd);
234234 bool ice_fw_supports_report_dflt_cfg(struct ice_hw *hw);
235235 #endif /* _ICE_COMMON_H_ */
drivers/net/ethernet/intel/ice/ice_gnss.c+4−60
@@ -16,8 +16,8 @@ · 15 unmodified lines
1616 * * number of bytes written - success
1717 * * negative - error code
1818 */
19−static unsigned int
20−ice_gnss_do_write(struct ice_pf *pf, unsigned char *buf, unsigned int size)
19+static int
20+ice_gnss_do_write(struct ice_pf *pf, const unsigned char *buf, unsigned int size)
2121 {
2222 struct ice_aqc_link_topo_addr link_topo;
2323 struct ice_hw *hw = &pf->hw;
@@ -72,39 +72,7 @@ err_out: · 48 unmodified lines
7272 dev_err(ice_pf_to_dev(pf), "GNSS failed to write, offset=%u, size=%u, err=%d\n",
7373 offset, size, err);
7474
75− return offset;
76−}
77−
78−/**
79− * ice_gnss_write_pending - Write all pending data to internal GNSS
80− * @work: GNSS write work structure
81− */
82−static void ice_gnss_write_pending(struct kthread_work *work)
83−{
84− struct gnss_serial *gnss = container_of(work, struct gnss_serial,
85− write_work);
86− struct ice_pf *pf = gnss->back;
87−
88− if (!pf)
89− return;
90−
91− if (!test_bit(ICE_FLAG_GNSS, pf->flags))
92− return;
93−
94− if (!list_empty(&gnss->queue)) {
95− struct gnss_write_buf *write_buf = NULL;
96− unsigned int bytes;
97−
98− write_buf = list_first_entry(&gnss->queue,
99− struct gnss_write_buf, queue);
100−
101− bytes = ice_gnss_do_write(pf, write_buf->buf, write_buf->size);
102− dev_dbg(ice_pf_to_dev(pf), "%u bytes written to GNSS\n", bytes);
103−
104− list_del(&write_buf->queue);
105− kfree(write_buf->buf);
106− kfree(write_buf);
107− }
75+ return err;
10876 }
10977
11078 /**
@@ -220,8 +188,6 @@ static struct gnss_serial *ice_gnss_struct_init(struct ice_pf *pf) · 109 unmodified lines
220188 pf->gnss_serial = gnss;
221189
222190 kthread_init_delayed_work(&gnss->read_work, ice_gnss_read);
223− INIT_LIST_HEAD(&gnss->queue);
224− kthread_init_work(&gnss->write_work, ice_gnss_write_pending);
225191 kworker = kthread_create_worker(0, "ice-gnss-%s", dev_name(dev));
226192 if (IS_ERR(kworker)) {
227193 kfree(gnss);
@@ -281,7 +247,6 @@ static void ice_gnss_close(struct gnss_device *gdev) · 53 unmodified lines
281247 if (!gnss)
282248 return;
283249
284− kthread_cancel_work_sync(&gnss->write_work);
285250 kthread_cancel_delayed_work_sync(&gnss->read_work);
286251 }
287252
@@ -300,10 +265,7 @@ ice_gnss_write(struct gnss_device *gdev, const unsigned char *buf, · 12 unmodified lines
300265 size_t count)
301266 {
302267 struct ice_pf *pf = gnss_get_drvdata(gdev);
303− struct gnss_write_buf *write_buf;
304268 struct gnss_serial *gnss;
305− unsigned char *cmd_buf;
306− int err = count;
307269
308270 /* We cannot write a single byte using our I2C implementation. */
309271 if (count <= 1 || count > ICE_GNSS_TTY_WRITE_BUF)
@@ -319,24 +281,7 @@ ice_gnss_write(struct gnss_device *gdev, const unsigned char *buf, · 9 unmodified lines
319281 if (!gnss)
320282 return -ENODEV;
321283
322− cmd_buf = kcalloc(count, sizeof(*buf), GFP_KERNEL);
323− if (!cmd_buf)
324− return -ENOMEM;
325−
326− memcpy(cmd_buf, buf, count);
327− write_buf = kzalloc(sizeof(*write_buf), GFP_KERNEL);
328− if (!write_buf) {
329− kfree(cmd_buf);
330− return -ENOMEM;
331− }
332−
333− write_buf->buf = cmd_buf;
334− write_buf->size = count;
335− INIT_LIST_HEAD(&write_buf->queue);
336− list_add_tail(&write_buf->queue, &gnss->queue);
337− kthread_queue_work(gnss->kworker, &gnss->write_work);
338−
339− return err;
284+ return ice_gnss_do_write(pf, buf, count);
340285 }
341286
342287 static const struct gnss_operations ice_gnss_ops = {
@@ -432,7 +377,6 @@ void ice_gnss_exit(struct ice_pf *pf) · 89 unmodified lines
432377 if (pf->gnss_serial) {
433378 struct gnss_serial *gnss = pf->gnss_serial;
434379
435− kthread_cancel_work_sync(&gnss->write_work);
436380 kthread_cancel_delayed_work_sync(&gnss->read_work);
437381 kthread_destroy_worker(gnss->kworker);
438382 gnss->kworker = NULL;
drivers/net/ethernet/intel/ice/ice_gnss.h+0−10
@@ -22,26 +22,16 @@ · 21 unmodified lines
2222 */
2323 #define ICE_GNSS_UBX_WRITE_BYTES (ICE_MAX_I2C_WRITE_BYTES + 1)
2424
25−struct gnss_write_buf {
26− struct list_head queue;
27− unsigned int size;
28− unsigned char *buf;
29−};
30−
3125 /**
3226 * struct gnss_serial - data used to initialize GNSS TTY port
3327 * @back: back pointer to PF
3428 * @kworker: kwork thread for handling periodic work
3529 * @read_work: read_work function for handling GNSS reads
36− * @write_work: write_work function for handling GNSS writes
37− * @queue: write buffers queue
3830 */
3931 struct gnss_serial {
4032 struct ice_pf *back;
4133 struct kthread_worker *kworker;
4234 struct kthread_delayed_work read_work;
43− struct kthread_work write_work;
44− struct list_head queue;
4535 };
4636
4737 #if IS_ENABLED(CONFIG_GNSS)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+1−1
@@ -1256,7 +1256,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector, · 1255 unmodified lines
12561256 if (!__netif_txq_completed_wake(txq, total_packets, total_bytes,
12571257 ixgbe_desc_unused(tx_ring),
12581258 TX_WAKE_THRESHOLD,
1259− netif_carrier_ok(tx_ring->netdev) &&
1259+ !netif_carrier_ok(tx_ring->netdev) ||
12601260 test_bit(__IXGBE_DOWN, &adapter->state)))
12611261 ++tx_ring->tx_stats.restart_queue;
12621262
drivers/net/ethernet/qlogic/qed/qed_l2.c+1−1
@@ -1903,7 +1903,7 @@ void qed_get_vport_stats(struct qed_dev *cdev, struct qed_eth_stats *stats) · 1902 unmodified lines
19031903 {
19041904 u32 i;
19051905
1906− if (!cdev) {
1906+ if (!cdev || cdev->recov_in_prog) {
19071907 memset(stats, 0, sizeof(*stats));
19081908 return;
19091909 }
drivers/net/ethernet/qlogic/qede/qede.h+4−0
@@ -269,6 +269,10 @@ struct qede_dev { · 268 unmodified lines
269269 #define QEDE_ERR_WARN 3
270270
271271 struct qede_dump_info dump_info;
272+ struct delayed_work periodic_task;
273+ unsigned long stats_coal_ticks;
274+ u32 stats_coal_usecs;
275+ spinlock_t stats_lock; /* lock for vport stats access */
272276 };
273277
274278 enum QEDE_STATE {
drivers/net/ethernet/qlogic/qede/qede_ethtool.c+22−2
@@ -429,6 +429,8 @@ static void qede_get_ethtool_stats(struct net_device *dev, · 428 unmodified lines
429429 }
430430 }
431431
432+ spin_lock(&edev->stats_lock);
433+
432434 for (i = 0; i < QEDE_NUM_STATS; i++) {
433435 if (qede_is_irrelevant_stat(edev, i))
434436 continue;
@@ -438,6 +440,8 @@ static void qede_get_ethtool_stats(struct net_device *dev, · 3 unmodified lines
438440 buf++;
439441 }
440442
443+ spin_unlock(&edev->stats_lock);
444+
441445 __qede_unlock(edev);
442446 }
443447
@@ -829,6 +833,7 @@ out: · 385 unmodified lines
829833
830834 coal->rx_coalesce_usecs = rx_coal;
831835 coal->tx_coalesce_usecs = tx_coal;
836+ coal->stats_block_coalesce_usecs = edev->stats_coal_usecs;
832837
833838 return rc;
834839 }
@@ -842,6 +847,19 @@ int qede_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal, · 7 unmodified lines
842847 int i, rc = 0;
843848 u16 rxc, txc;
844849
850+ if (edev->stats_coal_usecs != coal->stats_block_coalesce_usecs) {
851+ edev->stats_coal_usecs = coal->stats_block_coalesce_usecs;
852+ if (edev->stats_coal_usecs) {
853+ edev->stats_coal_ticks = usecs_to_jiffies(edev->stats_coal_usecs);
854+ schedule_delayed_work(&edev->periodic_task, 0);
855+
856+ DP_INFO(edev, "Configured stats coal ticks=%lu jiffies\n",
857+ edev->stats_coal_ticks);
858+ } else {
859+ cancel_delayed_work_sync(&edev->periodic_task);
860+ }
861+ }
862+
845863 if (!netif_running(dev)) {
846864 DP_INFO(edev, "Interface is down\n");
847865 return -EINVAL;
@@ -2252,7 +2270,8 @@ out: · 1404 unmodified lines
22522270 }
22532271
22542272 static const struct ethtool_ops qede_ethtool_ops = {
2255− .supported_coalesce_params = ETHTOOL_COALESCE_USECS,
2273+ .supported_coalesce_params = ETHTOOL_COALESCE_USECS |
2274+ ETHTOOL_COALESCE_STATS_BLOCK_USECS,
22562275 .get_link_ksettings = qede_get_link_ksettings,
22572276 .set_link_ksettings = qede_set_link_ksettings,
22582277 .get_drvinfo = qede_get_drvinfo,
@@ -2303,7 +2322,8 @@ static const struct ethtool_ops qede_ethtool_ops = { · 44 unmodified lines
23032322 };
23042323
23052324 static const struct ethtool_ops qede_vf_ethtool_ops = {
2306− .supported_coalesce_params = ETHTOOL_COALESCE_USECS,
2325+ .supported_coalesce_params = ETHTOOL_COALESCE_USECS |
2326+ ETHTOOL_COALESCE_STATS_BLOCK_USECS,
23072327 .get_link_ksettings = qede_get_link_ksettings,
23082328 .get_drvinfo = qede_get_drvinfo,
23092329 .get_msglevel = qede_get_msglevel,
drivers/net/ethernet/qlogic/qede/qede_main.c+33−1
@@ -307,6 +307,8 @@ void qede_fill_by_demand_stats(struct qede_dev *edev) · 306 unmodified lines
307307
308308 edev->ops->get_vport_stats(edev->cdev, &stats);
309309
310+ spin_lock(&edev->stats_lock);
311+
310312 p_common->no_buff_discards = stats.common.no_buff_discards;
311313 p_common->packet_too_big_discard = stats.common.packet_too_big_discard;
312314 p_common->ttl0_discard = stats.common.ttl0_discard;
@@ -404,6 +406,8 @@ void qede_fill_by_demand_stats(struct qede_dev *edev) · 91 unmodified lines
404406 p_ah->tx_1519_to_max_byte_packets =
405407 stats.ah.tx_1519_to_max_byte_packets;
406408 }
409+
410+ spin_unlock(&edev->stats_lock);
407411 }
408412
409413 static void qede_get_stats64(struct net_device *dev,
@@ -412,9 +416,10 @@ static void qede_get_stats64(struct net_device *dev, · 2 unmodified lines
412416 struct qede_dev *edev = netdev_priv(dev);
413417 struct qede_stats_common *p_common;
414418
415− qede_fill_by_demand_stats(edev);
416419 p_common = &edev->stats.common;
417420
421+ spin_lock(&edev->stats_lock);
422+
418423 stats->rx_packets = p_common->rx_ucast_pkts + p_common->rx_mcast_pkts +
419424 p_common->rx_bcast_pkts;
420425 stats->tx_packets = p_common->tx_ucast_pkts + p_common->tx_mcast_pkts +
@@ -434,6 +439,8 @@ static void qede_get_stats64(struct net_device *dev, · 13 unmodified lines
434439 stats->collisions = edev->stats.bb.tx_total_collisions;
435440 stats->rx_crc_errors = p_common->rx_crc_errors;
436441 stats->rx_frame_errors = p_common->rx_align_errors;
442+
443+ spin_unlock(&edev->stats_lock);
437444 }
438445
439446 #ifdef CONFIG_QED_SRIOV
@@ -1063,6 +1070,23 @@ static void qede_unlock(struct qede_dev *edev) · 623 unmodified lines
10631070 rtnl_unlock();
10641071 }
10651072
1073+static void qede_periodic_task(struct work_struct *work)
1074+{
1075+ struct qede_dev *edev = container_of(work, struct qede_dev,
1076+ periodic_task.work);
1077+
1078+ qede_fill_by_demand_stats(edev);
1079+ schedule_delayed_work(&edev->periodic_task, edev->stats_coal_ticks);
1080+}
1081+
1082+static void qede_init_periodic_task(struct qede_dev *edev)
1083+{
1084+ INIT_DELAYED_WORK(&edev->periodic_task, qede_periodic_task);
1085+ spin_lock_init(&edev->stats_lock);
1086+ edev->stats_coal_usecs = USEC_PER_SEC;
1087+ edev->stats_coal_ticks = usecs_to_jiffies(USEC_PER_SEC);
1088+}
1089+
10661090 static void qede_sp_task(struct work_struct *work)
10671091 {
10681092 struct qede_dev *edev = container_of(work, struct qede_dev,
@@ -1082,6 +1106,7 @@ static void qede_sp_task(struct work_struct *work) · 13 unmodified lines
10821106 */
10831107
10841108 if (test_and_clear_bit(QEDE_SP_RECOVERY, &edev->sp_flags)) {
1109+ cancel_delayed_work_sync(&edev->periodic_task);
10851110 #ifdef CONFIG_QED_SRIOV
10861111 /* SRIOV must be disabled outside the lock to avoid a deadlock.
10871112 * The recovery of the active VFs is currently not supported.
@@ -1272,6 +1297,7 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level, · 184 unmodified lines
12721297 */
12731298 INIT_DELAYED_WORK(&edev->sp_task, qede_sp_task);
12741299 mutex_init(&edev->qede_lock);
1300+ qede_init_periodic_task(edev);
12751301
12761302 rc = register_netdev(edev->ndev);
12771303 if (rc) {
@@ -1296,6 +1322,11 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level, · 18 unmodified lines
12961322 edev->rx_copybreak = QEDE_RX_HDR_SIZE;
12971323
12981324 qede_log_probe(edev);
1325+
1326+ /* retain user config (for example - after recovery) */
1327+ if (edev->stats_coal_usecs)
1328+ schedule_delayed_work(&edev->periodic_task, 0);
1329+
12991330 return 0;
13001331
13011332 err4:
@@ -1364,6 +1395,7 @@ static void __qede_remove(struct pci_dev *pdev, enum qede_remove_mode mode) · 62 unmodified lines
13641395 unregister_netdev(ndev);
13651396
13661397 cancel_delayed_work_sync(&edev->sp_task);
1398+ cancel_delayed_work_sync(&edev->periodic_task);
13671399
13681400 edev->ops->common->set_power_state(cdev, PCI_D0);
13691401
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c+2−1
@@ -644,7 +644,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev) · 643 unmodified lines
644644 plat_dat->fix_mac_speed = ethqos_fix_mac_speed;
645645 plat_dat->dump_debug_regs = rgmii_dump;
646646 plat_dat->has_gmac4 = 1;
647− plat_dat->dwmac4_addrs = &data->dwmac4_addrs;
647+ if (ethqos->has_emac3)
648+ plat_dat->dwmac4_addrs = &data->dwmac4_addrs;
648649 plat_dat->pmt = 1;
649650 plat_dat->tso_en = of_property_read_bool(np, "snps,tso");
650651 if (of_device_is_compatible(np, "qcom,qcs404-ethqos"))
drivers/net/phy/phylink.c+10−5
@@ -2259,11 +2259,13 @@ int phylink_ethtool_ksettings_set(struct phylink *pl, · 2258 unmodified lines
22592259
22602260 ASSERT_RTNL();
22612261
2262− /* Mask out unsupported advertisements */
2263− linkmode_and(config.advertising, kset->link_modes.advertising,
2264− pl->supported);
2265−
22662262 if (pl->phydev) {
2263+ struct ethtool_link_ksettings phy_kset = *kset;
2264+
2265+ linkmode_and(phy_kset.link_modes.advertising,
2266+ phy_kset.link_modes.advertising,
2267+ pl->supported);
2268+
22672269 /* We can rely on phylib for this update; we also do not need
22682270 * to update the pl->link_config settings:
22692271 * - the configuration returned via ksettings_get() will come
@@ -2282,10 +2284,13 @@ int phylink_ethtool_ksettings_set(struct phylink *pl, · 12 unmodified lines
22822284 * the presence of a PHY, this should not be changed as that
22832285 * should be determined from the media side advertisement.
22842286 */
2285− return phy_ethtool_ksettings_set(pl->phydev, kset);
2287+ return phy_ethtool_ksettings_set(pl->phydev, &phy_kset);
22862288 }
22872289
22882290 config = pl->link_config;
2291+ /* Mask out unsupported advertisements */
2292+ linkmode_and(config.advertising, kset->link_modes.advertising,
2293+ pl->supported);
22892294
22902295 /* FIXME: should we reject autoneg if phy/mac does not support it? */
22912296 switch (kset->base.autoneg) {
drivers/net/virtio_net.c+8−8
@@ -205,6 +205,8 @@ struct control_buf { · 204 unmodified lines
205205 __virtio16 vid;
206206 __virtio64 offloads;
207207 struct virtio_net_ctrl_rss rss;
208+ struct virtio_net_ctrl_coal_tx coal_tx;
209+ struct virtio_net_ctrl_coal_rx coal_rx;
208210 };
209211
210212 struct virtnet_info {
@@ -3043,12 +3045,10 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi, · 2832 unmodified lines
30433045 struct ethtool_coalesce *ec)
30443046 {
30453047 struct scatterlist sgs_tx, sgs_rx;
3046− struct virtio_net_ctrl_coal_tx coal_tx;
3047− struct virtio_net_ctrl_coal_rx coal_rx;
30483048
3049− coal_tx.tx_usecs = cpu_to_le32(ec->tx_coalesce_usecs);
3050− coal_tx.tx_max_packets = cpu_to_le32(ec->tx_max_coalesced_frames);
3051− sg_init_one(&sgs_tx, &coal_tx, sizeof(coal_tx));
3049+ vi->ctrl->coal_tx.tx_usecs = cpu_to_le32(ec->tx_coalesce_usecs);
3050+ vi->ctrl->coal_tx.tx_max_packets = cpu_to_le32(ec->tx_max_coalesced_frames);
3051+ sg_init_one(&sgs_tx, &vi->ctrl->coal_tx, sizeof(vi->ctrl->coal_tx));
30523052
30533053 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_NOTF_COAL,
30543054 VIRTIO_NET_CTRL_NOTF_COAL_TX_SET,
@@ -3059,9 +3059,9 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi, · 4 unmodified lines
30593059 vi->tx_usecs = ec->tx_coalesce_usecs;
30603060 vi->tx_max_packets = ec->tx_max_coalesced_frames;
30613061
3062− coal_rx.rx_usecs = cpu_to_le32(ec->rx_coalesce_usecs);
3063− coal_rx.rx_max_packets = cpu_to_le32(ec->rx_max_coalesced_frames);
3064− sg_init_one(&sgs_rx, &coal_rx, sizeof(coal_rx));
3062+ vi->ctrl->coal_rx.rx_usecs = cpu_to_le32(ec->rx_coalesce_usecs);
3063+ vi->ctrl->coal_rx.rx_max_packets = cpu_to_le32(ec->rx_max_coalesced_frames);
3064+ sg_init_one(&sgs_rx, &vi->ctrl->coal_rx, sizeof(vi->ctrl->coal_rx));
30653065
30663066 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_NOTF_COAL,
30673067 VIRTIO_NET_CTRL_NOTF_COAL_RX_SET,
drivers/net/wireless/intel/iwlwifi/mvm/d3.c+2−6
@@ -2732,17 +2732,13 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait, · 2731 unmodified lines
27322732 if (wowlan_info_ver < 2) {
27332733 struct iwl_wowlan_info_notif_v1 *notif_v1 = (void *)pkt->data;
27342734
2735− notif = kmemdup(notif_v1,
2736− offsetofend(struct iwl_wowlan_info_notif,
2737− received_beacons),
2738− GFP_ATOMIC);
2739−
2735+ notif = kmemdup(notif_v1, sizeof(*notif), GFP_ATOMIC);
27402736 if (!notif)
27412737 return false;
27422738
27432739 notif->tid_tear_down = notif_v1->tid_tear_down;
27442740 notif->station_id = notif_v1->station_id;
2745−
2741+ memset_after(notif, 0, station_id);
27462742 } else {
27472743 notif = (void *)pkt->data;
27482744 }
drivers/net/wireless/mediatek/mt76/mt7615/mac.c+3−0
@@ -914,7 +914,10 @@ void mt7615_mac_sta_poll(struct mt7615_dev *dev) · 913 unmodified lines
914914
915915 msta = list_first_entry(&sta_poll_list, struct mt7615_sta,
916916 poll_list);
917+
918+ spin_lock_bh(&dev->sta_poll_lock);
917919 list_del_init(&msta->poll_list);
920+ spin_unlock_bh(&dev->sta_poll_lock);
918921
919922 addr = mt7615_mac_wtbl_addr(dev, msta->wcid.idx) + 19 * 4;
920923
drivers/net/wireless/mediatek/mt76/mt7996/mac.c+12−7
@@ -1004,10 +1004,10 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi, · 1003 unmodified lines
10041004 {
10051005 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
10061006 struct ieee80211_vif *vif = info->control.vif;
1007− struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
10081007 u8 band_idx = (info->hw_queue & MT_TX_HW_QUEUE_PHY) >> 2;
10091008 u8 p_fmt, q_idx, omac_idx = 0, wmm_idx = 0;
10101009 bool is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP;
1010+ struct mt7996_vif *mvif;
10111011 u16 tx_count = 15;
10121012 u32 val;
10131013 bool beacon = !!(changed & (BSS_CHANGED_BEACON |
@@ -1015,7 +1015,8 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi, · 1 unmodified line
10151015 bool inband_disc = !!(changed & (BSS_CHANGED_UNSOL_BCAST_PROBE_RESP |
10161016 BSS_CHANGED_FILS_DISCOVERY));
10171017
1018− if (vif) {
1018+ mvif = vif ? (struct mt7996_vif *)vif->drv_priv : NULL;
1019+ if (mvif) {
10191020 omac_idx = mvif->mt76.omac_idx;
10201021 wmm_idx = mvif->mt76.wmm_idx;
10211022 band_idx = mvif->mt76.band_idx;
@@ -1081,12 +1082,16 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi, · 59 unmodified lines
10811082 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
10821083 bool mcast = ieee80211_is_data(hdr->frame_control) &&
10831084 is_multicast_ether_addr(hdr->addr1);
1084− u8 idx = mvif->basic_rates_idx;
1085+ u8 idx = MT7996_BASIC_RATES_TBL;
10851086
1086− if (mcast && mvif->mcast_rates_idx)
1087− idx = mvif->mcast_rates_idx;
1088− else if (beacon && mvif->beacon_rates_idx)
1089− idx = mvif->beacon_rates_idx;
1087+ if (mvif) {
1088+ if (mcast && mvif->mcast_rates_idx)
1089+ idx = mvif->mcast_rates_idx;
1090+ else if (beacon && mvif->beacon_rates_idx)
1091+ idx = mvif->beacon_rates_idx;
1092+ else
1093+ idx = mvif->basic_rates_idx;
1094+ }
10901095
10911096 txwi[6] |= cpu_to_le32(FIELD_PREP(MT_TXD6_TX_RATE, idx));
10921097 txwi[3] |= cpu_to_le32(MT_TXD3_BA_DISABLE);
drivers/net/wireless/realtek/rtw88/mac80211.c+5−9
@@ -88,15 +88,6 @@ static int rtw_ops_config(struct ieee80211_hw *hw, u32 changed) · 87 unmodified lines
8888 }
8989 }
9090
91− if (changed & IEEE80211_CONF_CHANGE_PS) {
92− if (hw->conf.flags & IEEE80211_CONF_PS) {
93− rtwdev->ps_enabled = true;
94− } else {
95− rtwdev->ps_enabled = false;
96− rtw_leave_lps(rtwdev);
97− }
98− }
99−
10091 if (changed & IEEE80211_CONF_CHANGE_CHANNEL)
10192 rtw_set_channel(rtwdev);
10293
@@ -215,6 +206,7 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw, · 112 unmodified lines
215206 config |= PORT_SET_BCN_CTRL;
216207 rtw_vif_port_config(rtwdev, rtwvif, config);
217208 rtw_core_port_switch(rtwdev, vif);
209+ rtw_recalc_lps(rtwdev, vif);
218210
219211 mutex_unlock(&rtwdev->mutex);
220212
@@ -246,6 +238,7 @@ static void rtw_ops_remove_interface(struct ieee80211_hw *hw, · 25 unmodified lines
246238 config |= PORT_SET_BCN_CTRL;
247239 rtw_vif_port_config(rtwdev, rtwvif, config);
248240 clear_bit(rtwvif->port, rtwdev->hw_port);
241+ rtw_recalc_lps(rtwdev, NULL);
249242
250243 mutex_unlock(&rtwdev->mutex);
251244 }
@@ -440,6 +433,9 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw, · 188 unmodified lines
440433 if (changed & BSS_CHANGED_ERP_SLOT)
441434 rtw_conf_tx(rtwdev, rtwvif);
442435
436+ if (changed & BSS_CHANGED_PS)
437+ rtw_recalc_lps(rtwdev, NULL);
438+
443439 rtw_vif_port_config(rtwdev, rtwvif, config);
444440
445441 mutex_unlock(&rtwdev->mutex);
drivers/net/wireless/realtek/rtw88/main.c+2−2
@@ -271,8 +271,8 @@ static void rtw_watch_dog_work(struct work_struct *work) · 270 unmodified lines
271271 * more than two stations associated to the AP, then we can not enter
272272 * lps, because fw does not handle the overlapped beacon interval
273273 *
274− * mac80211 should iterate vifs and determine if driver can enter
275− * ps by passing IEEE80211_CONF_PS to us, all we need to do is to
274+ * rtw_recalc_lps() iterate vifs and determine if driver can enter
275+ * ps by vif->type and vif->cfg.ps, all we need to do here is to
276276 * get that vif and check if device is having traffic more than the
277277 * threshold.
278278 */
drivers/net/wireless/realtek/rtw88/ps.c+43−0
@@ -299,3 +299,46 @@ void rtw_leave_lps_deep(struct rtw_dev *rtwdev) · 298 unmodified lines
299299
300300 __rtw_leave_lps_deep(rtwdev);
301301 }
302+
303+struct rtw_vif_recalc_lps_iter_data {
304+ struct rtw_dev *rtwdev;
305+ struct ieee80211_vif *found_vif;
306+ int count;
307+};
308+
309+static void __rtw_vif_recalc_lps(struct rtw_vif_recalc_lps_iter_data *data,
310+ struct ieee80211_vif *vif)
311+{
312+ if (data->count < 0)
313+ return;
314+
315+ if (vif->type != NL80211_IFTYPE_STATION) {
316+ data->count = -1;
317+ return;
318+ }
319+
320+ data->count++;
321+ data->found_vif = vif;
322+}
323+
324+static void rtw_vif_recalc_lps_iter(void *data, u8 *mac,
325+ struct ieee80211_vif *vif)
326+{
327+ __rtw_vif_recalc_lps(data, vif);
328+}
329+
330+void rtw_recalc_lps(struct rtw_dev *rtwdev, struct ieee80211_vif *new_vif)
331+{
332+ struct rtw_vif_recalc_lps_iter_data data = { .rtwdev = rtwdev };
333+
334+ if (new_vif)
335+ __rtw_vif_recalc_lps(&data, new_vif);
336+ rtw_iterate_vifs(rtwdev, rtw_vif_recalc_lps_iter, &data);
337+
338+ if (data.count == 1 && data.found_vif->cfg.ps) {
339+ rtwdev->ps_enabled = true;
340+ } else {
341+ rtwdev->ps_enabled = false;
342+ rtw_leave_lps(rtwdev);
343+ }
344+}
drivers/net/wireless/realtek/rtw88/ps.h+2−0
@@ -23,4 +23,6 @@ void rtw_enter_lps(struct rtw_dev *rtwdev, u8 port_id); · 22 unmodified lines
2323 void rtw_leave_lps(struct rtw_dev *rtwdev);
2424 void rtw_leave_lps_deep(struct rtw_dev *rtwdev);
2525 enum rtw_lps_deep_mode rtw_get_lps_deep_mode(struct rtw_dev *rtwdev);
26+void rtw_recalc_lps(struct rtw_dev *rtwdev, struct ieee80211_vif *new_vif);
27+
2628 #endif
drivers/net/wireless/realtek/rtw89/core.c+0−3
@@ -2603,9 +2603,6 @@ static void rtw89_vif_enter_lps(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwv · 2602 unmodified lines
26032603 rtwvif->tdls_peer)
26042604 return;
26052605
2606− if (rtwdev->total_sta_assoc > 1)
2607− return;
2608−
26092606 if (rtwvif->offchan)
26102607 return;
26112608
drivers/net/wireless/realtek/rtw89/mac80211.c+6−9
@@ -89,15 +89,6 @@ static int rtw89_ops_config(struct ieee80211_hw *hw, u32 changed) · 88 unmodified lines
8989 !(hw->conf.flags & IEEE80211_CONF_IDLE))
9090 rtw89_leave_ips(rtwdev);
9191
92− if (changed & IEEE80211_CONF_CHANGE_PS) {
93− if (hw->conf.flags & IEEE80211_CONF_PS) {
94− rtwdev->lps_enabled = true;
95− } else {
96− rtw89_leave_lps(rtwdev);
97− rtwdev->lps_enabled = false;
98− }
99− }
100−
10192 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
10293 rtw89_config_entity_chandef(rtwdev, RTW89_SUB_ENTITY_0,
10394 &hw->conf.chandef);
@@ -168,6 +159,8 @@ static int rtw89_ops_add_interface(struct ieee80211_hw *hw, · 64 unmodified lines
168159 rtw89_core_txq_init(rtwdev, vif->txq);
169160
170161 rtw89_btc_ntfy_role_info(rtwdev, rtwvif, NULL, BTC_ROLE_START);
162+
163+ rtw89_recalc_lps(rtwdev);
171164 out:
172165 mutex_unlock(&rtwdev->mutex);
173166
@@ -192,6 +185,7 @@ static void rtw89_ops_remove_interface(struct ieee80211_hw *hw, · 18 unmodified lines
192185 rtw89_mac_remove_vif(rtwdev, rtwvif);
193186 rtw89_core_release_bit_map(rtwdev->hw_port, rtwvif->port);
194187 list_del_init(&rtwvif->list);
188+ rtw89_recalc_lps(rtwdev);
195189 rtw89_enter_ips_by_hwflags(rtwdev);
196190
197191 mutex_unlock(&rtwdev->mutex);
@@ -451,6 +445,9 @@ static void rtw89_ops_bss_info_changed(struct ieee80211_hw *hw, · 253 unmodified lines
451445 if (changed & BSS_CHANGED_CQM)
452446 rtw89_fw_h2c_set_bcn_fltr_cfg(rtwdev, vif, true);
453447
448+ if (changed & BSS_CHANGED_PS)
449+ rtw89_recalc_lps(rtwdev);
450+
454451 mutex_unlock(&rtwdev->mutex);
455452 }
456453
drivers/net/wireless/realtek/rtw89/ps.c+26−0
@@ -252,3 +252,29 @@ void rtw89_process_p2p_ps(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif) · 251 unmodified lines
252252 rtw89_p2p_disable_all_noa(rtwdev, vif);
253253 rtw89_p2p_update_noa(rtwdev, vif);
254254 }
255+
256+void rtw89_recalc_lps(struct rtw89_dev *rtwdev)
257+{
258+ struct ieee80211_vif *vif, *found_vif = NULL;
259+ struct rtw89_vif *rtwvif;
260+ int count = 0;
261+
262+ rtw89_for_each_rtwvif(rtwdev, rtwvif) {
263+ vif = rtwvif_to_vif(rtwvif);
264+
265+ if (vif->type != NL80211_IFTYPE_STATION) {
266+ count = 0;
267+ break;
268+ }
269+
270+ count++;
271+ found_vif = vif;
272+ }
273+
274+ if (count == 1 && found_vif->cfg.ps) {
275+ rtwdev->lps_enabled = true;
276+ } else {
277+ rtw89_leave_lps(rtwdev);
278+ rtwdev->lps_enabled = false;
279+ }
280+}
drivers/net/wireless/realtek/rtw89/ps.h+1−0
@@ -15,6 +15,7 @@ void rtw89_enter_ips(struct rtw89_dev *rtwdev); · 14 unmodified lines
1515 void rtw89_leave_ips(struct rtw89_dev *rtwdev);
1616 void rtw89_set_coex_ctrl_lps(struct rtw89_dev *rtwdev, bool btc_ctrl);
1717 void rtw89_process_p2p_ps(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif);
18+void rtw89_recalc_lps(struct rtw89_dev *rtwdev);
1819
1920 static inline void rtw89_leave_ips_by_hwflags(struct rtw89_dev *rtwdev)
2021 {
drivers/nvme/host/constants.c+1−1
@@ -21,7 +21,7 @@ static const char * const nvme_ops[] = { · 20 unmodified lines
2121 [nvme_cmd_resv_release] = "Reservation Release",
2222 [nvme_cmd_zone_mgmt_send] = "Zone Management Send",
2323 [nvme_cmd_zone_mgmt_recv] = "Zone Management Receive",
24− [nvme_cmd_zone_append] = "Zone Management Append",
24+ [nvme_cmd_zone_append] = "Zone Append",
2525 };
2626
2727 static const char * const nvme_admin_ops[] = {
drivers/nvme/host/core.c+48−4
@@ -397,7 +397,16 @@ void nvme_complete_rq(struct request *req) · 396 unmodified lines
397397 trace_nvme_complete_rq(req);
398398 nvme_cleanup_cmd(req);
399399
400− if (ctrl->kas)
400+ /*
401+ * Completions of long-running commands should not be able to
402+ * defer sending of periodic keep alives, since the controller
403+ * may have completed processing such commands a long time ago
404+ * (arbitrarily close to command submission time).
405+ * req->deadline - req->timeout is the command submission time
406+ * in jiffies.
407+ */
408+ if (ctrl->kas &&
409+ req->deadline - req->timeout >= ctrl->ka_last_check_time)
401410 ctrl->comp_seen = true;
402411
403412 switch (nvme_decide_disposition(req)) {
@@ -1115,7 +1124,7 @@ u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opcode) · 711 unmodified lines
11151124 }
11161125 EXPORT_SYMBOL_NS_GPL(nvme_passthru_start, NVME_TARGET_PASSTHRU);
11171126
1118−void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,
1127+void nvme_passthru_end(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u32 effects,
11191128 struct nvme_command *cmd, int status)
11201129 {
11211130 if (effects & NVME_CMD_EFFECTS_CSE_MASK) {
@@ -1132,6 +1141,8 @@ void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, · 10 unmodified lines
11321141 nvme_queue_scan(ctrl);
11331142 flush_work(&ctrl->scan_work);
11341143 }
1144+ if (ns)
1145+ return;
11351146
11361147 switch (cmd->common.opcode) {
11371148 case nvme_admin_set_features:
@@ -1161,9 +1172,25 @@ EXPORT_SYMBOL_NS_GPL(nvme_passthru_end, NVME_TARGET_PASSTHRU); · 23 unmodified lines
11611172 * The host should send Keep Alive commands at half of the Keep Alive Timeout
11621173 * accounting for transport roundtrip times [..].
11631174 */
1175+static unsigned long nvme_keep_alive_work_period(struct nvme_ctrl *ctrl)
1176+{
1177+ unsigned long delay = ctrl->kato * HZ / 2;
1178+
1179+ /*
1180+ * When using Traffic Based Keep Alive, we need to run
1181+ * nvme_keep_alive_work at twice the normal frequency, as one
1182+ * command completion can postpone sending a keep alive command
1183+ * by up to twice the delay between runs.
1184+ */
1185+ if (ctrl->ctratt & NVME_CTRL_ATTR_TBKAS)
1186+ delay /= 2;
1187+ return delay;
1188+}
1189+
11641190 static void nvme_queue_keep_alive_work(struct nvme_ctrl *ctrl)
11651191 {
1166− queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ / 2);
1192+ queue_delayed_work(nvme_wq, &ctrl->ka_work,
1193+ nvme_keep_alive_work_period(ctrl));
11671194 }
11681195
11691196 static enum rq_end_io_ret nvme_keep_alive_end_io(struct request *rq,
@@ -1172,6 +1199,20 @@ static enum rq_end_io_ret nvme_keep_alive_end_io(struct request *rq, · 2 unmodified lines
11721199 struct nvme_ctrl *ctrl = rq->end_io_data;
11731200 unsigned long flags;
11741201 bool startka = false;
1202+ unsigned long rtt = jiffies - (rq->deadline - rq->timeout);
1203+ unsigned long delay = nvme_keep_alive_work_period(ctrl);
1204+
1205+ /*
1206+ * Subtract off the keepalive RTT so nvme_keep_alive_work runs
1207+ * at the desired frequency.
1208+ */
1209+ if (rtt <= delay) {
1210+ delay -= rtt;
1211+ } else {
1212+ dev_warn(ctrl->device, "long keepalive RTT (%u ms)\n",
1213+ jiffies_to_msecs(rtt));
1214+ delay = 0;
1215+ }
11751216
11761217 blk_mq_free_request(rq);
11771218
@@ -1182,6 +1223,7 @@ static enum rq_end_io_ret nvme_keep_alive_end_io(struct request *rq, · 4 unmodified lines
11821223 return RQ_END_IO_NONE;
11831224 }
11841225
1226+ ctrl->ka_last_check_time = jiffies;
11851227 ctrl->comp_seen = false;
11861228 spin_lock_irqsave(&ctrl->lock, flags);
11871229 if (ctrl->state == NVME_CTRL_LIVE ||
@@ -1189,7 +1231,7 @@ static enum rq_end_io_ret nvme_keep_alive_end_io(struct request *rq, · 1 unmodified line
11891231 startka = true;
11901232 spin_unlock_irqrestore(&ctrl->lock, flags);
11911233 if (startka)
1192− nvme_queue_keep_alive_work(ctrl);
1234+ queue_delayed_work(nvme_wq, &ctrl->ka_work, delay);
11931235 return RQ_END_IO_NONE;
11941236 }
11951237
@@ -1200,6 +1242,8 @@ static void nvme_keep_alive_work(struct work_struct *work) · 4 unmodified lines
12001242 bool comp_seen = ctrl->comp_seen;
12011243 struct request *rq;
12021244
1245+ ctrl->ka_last_check_time = jiffies;
1246+
12031247 if ((ctrl->ctratt & NVME_CTRL_ATTR_TBKAS) && comp_seen) {
12041248 dev_dbg(ctrl->device,
12051249 "reschedule traffic based keep-alive timer\n");
drivers/nvme/host/ioctl.c+1−1
@@ -254,7 +254,7 @@ static int nvme_submit_user_cmd(struct request_queue *q, · 253 unmodified lines
254254 blk_mq_free_request(req);
255255
256256 if (effects)
257− nvme_passthru_end(ctrl, effects, cmd, ret);
257+ nvme_passthru_end(ctrl, ns, effects, cmd, ret);
258258
259259 return ret;
260260 }
drivers/nvme/host/nvme.h+2−1
@@ -328,6 +328,7 @@ struct nvme_ctrl { · 327 unmodified lines
328328 struct delayed_work ka_work;
329329 struct delayed_work failfast_work;
330330 struct nvme_command ka_cmd;
331+ unsigned long ka_last_check_time;
331332 struct work_struct fw_act_work;
332333 unsigned long events;
333334
@@ -1077,7 +1078,7 @@ u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, · 743 unmodified lines
10771078 u8 opcode);
10781079 u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opcode);
10791080 int nvme_execute_rq(struct request *rq, bool at_head);
1080−void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,
1081+void nvme_passthru_end(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u32 effects,
10811082 struct nvme_command *cmd, int status);
10821083 struct nvme_ctrl *nvme_ctrl_from_file(struct file *file);
10831084 struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid);
drivers/nvme/target/passthru.c+1−1
@@ -243,7 +243,7 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w) · 242 unmodified lines
243243 blk_mq_free_request(rq);
244244
245245 if (effects)
246− nvme_passthru_end(ctrl, effects, req->cmd, status);
246+ nvme_passthru_end(ctrl, ns, effects, req->cmd, status);
247247 }
248248
249249 static enum rq_end_io_ret nvmet_passthru_req_done(struct request *rq,
drivers/platform/surface/aggregator/controller.c+1−1
@@ -825,7 +825,7 @@ static int ssam_cplt_init(struct ssam_cplt *cplt, struct device *dev) · 824 unmodified lines
825825
826826 cplt->dev = dev;
827827
828− cplt->wq = create_workqueue(SSAM_CPLT_WQ_NAME);
828+ cplt->wq = alloc_workqueue(SSAM_CPLT_WQ_NAME, WQ_UNBOUND | WQ_MEM_RECLAIM, 0);
829829 if (!cplt->wq)
830830 return -ENOMEM;
831831
drivers/platform/surface/surface_aggregator_tabletsw.c+10−0
@@ -210,6 +210,7 @@ enum ssam_kip_cover_state { · 209 unmodified lines
210210 SSAM_KIP_COVER_STATE_LAPTOP = 0x03,
211211 SSAM_KIP_COVER_STATE_FOLDED_CANVAS = 0x04,
212212 SSAM_KIP_COVER_STATE_FOLDED_BACK = 0x05,
213+ SSAM_KIP_COVER_STATE_BOOK = 0x06,
213214 };
214215
215216 static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw,
@@ -231,6 +232,9 @@ static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw, · 15 unmodified lines
231232 case SSAM_KIP_COVER_STATE_FOLDED_BACK:
232233 return "folded-back";
233234
235+ case SSAM_KIP_COVER_STATE_BOOK:
236+ return "book";
237+
234238 default:
235239 dev_warn(&sw->sdev->dev, "unknown KIP cover state: %u\n", state->state);
236240 return "<unknown>";
@@ -244,6 +248,7 @@ static bool ssam_kip_cover_state_is_tablet_mode(struct ssam_tablet_sw *sw, · 7 unmodified lines
244248 case SSAM_KIP_COVER_STATE_DISCONNECTED:
245249 case SSAM_KIP_COVER_STATE_FOLDED_CANVAS:
246250 case SSAM_KIP_COVER_STATE_FOLDED_BACK:
251+ case SSAM_KIP_COVER_STATE_BOOK:
247252 return true;
248253
249254 case SSAM_KIP_COVER_STATE_CLOSED:
@@ -335,6 +340,7 @@ enum ssam_pos_state_cover { · 85 unmodified lines
335340 SSAM_POS_COVER_LAPTOP = 0x03,
336341 SSAM_POS_COVER_FOLDED_CANVAS = 0x04,
337342 SSAM_POS_COVER_FOLDED_BACK = 0x05,
343+ SSAM_POS_COVER_BOOK = 0x06,
338344 };
339345
340346 enum ssam_pos_state_sls {
@@ -367,6 +373,9 @@ static const char *ssam_pos_state_name_cover(struct ssam_tablet_sw *sw, u32 stat · 26 unmodified lines
367373 case SSAM_POS_COVER_FOLDED_BACK:
368374 return "folded-back";
369375
376+ case SSAM_POS_COVER_BOOK:
377+ return "book";
378+
370379 default:
371380 dev_warn(&sw->sdev->dev, "unknown device posture for type-cover: %u\n", state);
372381 return "<unknown>";
@@ -416,6 +425,7 @@ static bool ssam_pos_state_is_tablet_mode_cover(struct ssam_tablet_sw *sw, u32 s · 43 unmodified lines
416425 case SSAM_POS_COVER_DISCONNECTED:
417426 case SSAM_POS_COVER_FOLDED_CANVAS:
418427 case SSAM_POS_COVER_FOLDED_BACK:
428+ case SSAM_POS_COVER_BOOK:
419429 return true;
420430
421431 case SSAM_POS_COVER_CLOSED:
drivers/platform/x86/intel/int3472/clk_and_regulator.c+8−5
@@ -101,9 +101,11 @@ int skl_int3472_register_clock(struct int3472_discrete_device *int3472, · 100 unmodified lines
101101
102102 int3472->clock.ena_gpio = acpi_get_and_request_gpiod(path, agpio->pin_table[0],
103103 "int3472,clk-enable");
104− if (IS_ERR(int3472->clock.ena_gpio))
105− return dev_err_probe(int3472->dev, PTR_ERR(int3472->clock.ena_gpio),
106− "getting clk-enable GPIO\n");
104+ if (IS_ERR(int3472->clock.ena_gpio)) {
105+ ret = PTR_ERR(int3472->clock.ena_gpio);
106+ int3472->clock.ena_gpio = NULL;
107+ return dev_err_probe(int3472->dev, ret, "getting clk-enable GPIO\n");
108+ }
107109
108110 if (polarity == GPIO_ACTIVE_LOW)
109111 gpiod_toggle_active_low(int3472->clock.ena_gpio);
@@ -199,8 +201,9 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472, · 89 unmodified lines
199201 int3472->regulator.gpio = acpi_get_and_request_gpiod(path, agpio->pin_table[0],
200202 "int3472,regulator");
201203 if (IS_ERR(int3472->regulator.gpio)) {
202− dev_err(int3472->dev, "Failed to get regulator GPIO line\n");
203− return PTR_ERR(int3472->regulator.gpio);
204+ ret = PTR_ERR(int3472->regulator.gpio);
205+ int3472->regulator.gpio = NULL;
206+ return dev_err_probe(int3472->dev, ret, "getting regulator GPIO\n");
204207 }
205208
206209 /* Ensure the pin is in output mode and non-active state */
drivers/scsi/qla2xxx/qla_def.h+1−0
@@ -3796,6 +3796,7 @@ struct qla_qpair { · 3795 unmodified lines
37963796 uint64_t retry_term_jiff;
37973797 struct qla_tgt_counters tgt_counters;
37983798 uint16_t cpuid;
3799+ bool cpu_mapped;
37993800 struct qla_fw_resources fwres ____cacheline_aligned;
38003801 struct qla_buf_pool buf_pool;
38013802 u32 cmd_cnt;
drivers/scsi/qla2xxx/qla_init.c+3−0
@@ -9426,6 +9426,9 @@ struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos, · 9425 unmodified lines
94269426 qpair->rsp->req = qpair->req;
94279427 qpair->rsp->qpair = qpair;
94289428
9429+ if (!qpair->cpu_mapped)
9430+ qla_cpu_update(qpair, raw_smp_processor_id());
9431+
94299432 if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) {
94309433 if (ha->fw_attributes & BIT_4)
94319434 qpair->difdix_supported = 1;
drivers/scsi/qla2xxx/qla_inline.h+3−0
@@ -539,11 +539,14 @@ qla_mapq_init_qp_cpu_map(struct qla_hw_data *ha, · 538 unmodified lines
539539 if (!ha->qp_cpu_map)
540540 return;
541541 mask = pci_irq_get_affinity(ha->pdev, msix->vector_base0);
542+ if (!mask)
543+ return;
542544 qpair->cpuid = cpumask_first(mask);
543545 for_each_cpu(cpu, mask) {
544546 ha->qp_cpu_map[cpu] = qpair;
545547 }
546548 msix->cpuid = qpair->cpuid;
549+ qpair->cpu_mapped = true;
547550 }
548551
549552 static inline void
drivers/scsi/qla2xxx/qla_isr.c+3−0
@@ -3770,6 +3770,9 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, · 3769 unmodified lines
37703770
37713771 if (rsp->qpair->cpuid != smp_processor_id() || !rsp->qpair->rcv_intr) {
37723772 rsp->qpair->rcv_intr = 1;
3773+
3774+ if (!rsp->qpair->cpu_mapped)
3775+ qla_cpu_update(rsp->qpair, raw_smp_processor_id());
37733776 }
37743777
37753778 #define __update_rsp_in(_is_shadow_hba, _rsp, _rsp_in) \
drivers/scsi/stex.c+4−0
@@ -109,7 +109,9 @@ enum { · 108 unmodified lines
109109 TASK_ATTRIBUTE_HEADOFQUEUE = 0x1,
110110 TASK_ATTRIBUTE_ORDERED = 0x2,
111111 TASK_ATTRIBUTE_ACA = 0x4,
112+};
112113
114+enum {
113115 SS_STS_NORMAL = 0x80000000,
114116 SS_STS_DONE = 0x40000000,
115117 SS_STS_HANDSHAKE = 0x20000000,
@@ -121,7 +123,9 @@ enum { · 5 unmodified lines
121123 SS_I2H_REQUEST_RESET = 0x2000,
122124
123125 SS_MU_OPERATIONAL = 0x80000000,
126+};
124127
128+enum {
125129 STEX_CDB_LENGTH = 16,
126130 STATUS_VAR_LEN = 128,
127131
drivers/soc/fsl/qe/Kconfig+2−2
@@ -36,7 +36,7 @@ config UCC · 35 unmodified lines
3636 config CPM_TSA
3737 tristate "CPM TSA support"
3838 depends on OF && HAS_IOMEM
39− depends on CPM1 || COMPILE_TEST
39+ depends on CPM1 || (CPM && COMPILE_TEST)
4040 help
4141 Freescale CPM Time Slot Assigner (TSA)
4242 controller.
@@ -47,7 +47,7 @@ config CPM_TSA · 4 unmodified lines
4747 config CPM_QMC
4848 tristate "CPM QMC support"
4949 depends on OF && HAS_IOMEM
50− depends on CPM1 || (FSL_SOC && COMPILE_TEST)
50+ depends on CPM1 || (FSL_SOC && CPM && COMPILE_TEST)
5151 depends on CPM_TSA
5252 help
5353 Freescale CPM QUICC Multichannel Controller
drivers/spi/spi-fsl-lpspi.c+6−1
@@ -910,9 +910,14 @@ static int fsl_lpspi_probe(struct platform_device *pdev) · 909 unmodified lines
910910 ret = fsl_lpspi_dma_init(&pdev->dev, fsl_lpspi, controller);
911911 if (ret == -EPROBE_DEFER)
912912 goto out_pm_get;
913−
914913 if (ret < 0)
915914 dev_err(&pdev->dev, "dma setup error %d, use pio\n", ret);
915+ else
916+ /*
917+ * disable LPSPI module IRQ when enable DMA mode successfully,
918+ * to prevent the unexpected LPSPI module IRQ events.
919+ */
920+ disable_irq(irq);
916921
917922 ret = devm_spi_register_controller(&pdev->dev, controller);
918923 if (ret < 0) {
drivers/spi/spi-mt65xx.c+3−0
@@ -1275,6 +1275,9 @@ static int mtk_spi_remove(struct platform_device *pdev) · 1274 unmodified lines
12751275 struct mtk_spi *mdata = spi_master_get_devdata(master);
12761276 int ret;
12771277
1278+ if (mdata->use_spimem && !completion_done(&mdata->spimem_done))
1279+ complete(&mdata->spimem_done);
1280+
12781281 ret = pm_runtime_resume_and_get(&pdev->dev);
12791282 if (ret < 0)
12801283 return ret;
drivers/spi/spi-qup.c+18−19
@@ -1028,23 +1028,8 @@ static int spi_qup_probe(struct platform_device *pdev) · 1027 unmodified lines
10281028 return -ENXIO;
10291029 }
10301030
1031− ret = clk_prepare_enable(cclk);
1032− if (ret) {
1033− dev_err(dev, "cannot enable core clock\n");
1034− return ret;
1035− }
1036−
1037− ret = clk_prepare_enable(iclk);
1038− if (ret) {
1039− clk_disable_unprepare(cclk);
1040− dev_err(dev, "cannot enable iface clock\n");
1041− return ret;
1042− }
1043−
10441031 master = spi_alloc_master(dev, sizeof(struct spi_qup));
10451032 if (!master) {
1046− clk_disable_unprepare(cclk);
1047− clk_disable_unprepare(iclk);
10481033 dev_err(dev, "cannot allocate master\n");
10491034 return -ENOMEM;
10501035 }
@@ -1092,6 +1077,19 @@ static int spi_qup_probe(struct platform_device *pdev) · 41 unmodified lines
10921077 spin_lock_init(&controller->lock);
10931078 init_completion(&controller->done);
10941079
1080+ ret = clk_prepare_enable(cclk);
1081+ if (ret) {
1082+ dev_err(dev, "cannot enable core clock\n");
1083+ goto error_dma;
1084+ }
1085+
1086+ ret = clk_prepare_enable(iclk);
1087+ if (ret) {
1088+ clk_disable_unprepare(cclk);
1089+ dev_err(dev, "cannot enable iface clock\n");
1090+ goto error_dma;
1091+ }
1092+
10951093 iomode = readl_relaxed(base + QUP_IO_M_MODES);
10961094
10971095 size = QUP_IO_M_OUTPUT_BLOCK_SIZE(iomode);
@@ -1121,7 +1119,7 @@ static int spi_qup_probe(struct platform_device *pdev) · 23 unmodified lines
11211119 ret = spi_qup_set_state(controller, QUP_STATE_RESET);
11221120 if (ret) {
11231121 dev_err(dev, "cannot set RESET state\n");
1124− goto error_dma;
1122+ goto error_clk;
11251123 }
11261124
11271125 writel_relaxed(0, base + QUP_OPERATIONAL);
@@ -1145,7 +1143,7 @@ static int spi_qup_probe(struct platform_device *pdev) · 17 unmodified lines
11451143 ret = devm_request_irq(dev, irq, spi_qup_qup_irq,
11461144 IRQF_TRIGGER_HIGH, pdev->name, controller);
11471145 if (ret)
1148− goto error_dma;
1146+ goto error_clk;
11491147
11501148 pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
11511149 pm_runtime_use_autosuspend(dev);
@@ -1160,11 +1158,12 @@ static int spi_qup_probe(struct platform_device *pdev) · 8 unmodified lines
11601158
11611159 disable_pm:
11621160 pm_runtime_disable(&pdev->dev);
1161+error_clk:
1162+ clk_disable_unprepare(cclk);
1163+ clk_disable_unprepare(iclk);
11631164 error_dma:
11641165 spi_qup_release_dma(master);
11651166 error:
1166− clk_disable_unprepare(cclk);
1167− clk_disable_unprepare(iclk);
11681167 spi_master_put(master);
11691168 return ret;
11701169 }
drivers/staging/media/atomisp/i2c/atomisp-ov2680.c+2−2
@@ -373,7 +373,7 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd, · 372 unmodified lines
373373 static int ov2680_detect(struct i2c_client *client)
374374 {
375375 struct i2c_adapter *adapter = client->adapter;
376− u32 high, low;
376+ u32 high = 0, low = 0;
377377 int ret;
378378 u16 id;
379379 u8 revision;
@@ -383,7 +383,7 @@ static int ov2680_detect(struct i2c_client *client) · 3 unmodified lines
383383
384384 ret = ov_read_reg8(client, OV2680_SC_CMMN_CHIP_ID_H, &high);
385385 if (ret) {
386− dev_err(&client->dev, "sensor_id_high = 0x%x\n", high);
386+ dev_err(&client->dev, "sensor_id_high read failed (%d)\n", ret);
387387 return -ENODEV;
388388 }
389389 ret = ov_read_reg8(client, OV2680_SC_CMMN_CHIP_ID_L, &low);
drivers/staging/media/imx/imx8mq-mipi-csi2.c+1−1
@@ -354,7 +354,7 @@ static int imx8mq_mipi_csi_start_stream(struct csi_state *state, · 353 unmodified lines
354354 struct v4l2_subdev_state *sd_state)
355355 {
356356 int ret;
357− u32 hs_settle;
357+ u32 hs_settle = 0;
358358
359359 ret = imx8mq_mipi_csi_sw_reset(state);
360360 if (ret)
drivers/target/iscsi/iscsi_target.c+0−2
@@ -364,8 +364,6 @@ struct iscsi_np *iscsit_add_np( · 363 unmodified lines
364364 init_completion(&np->np_restart_comp);
365365 INIT_LIST_HEAD(&np->np_list);
366366
367− timer_setup(&np->np_login_timer, iscsi_handle_login_thread_timeout, 0);
368−
369367 ret = iscsi_target_setup_login_socket(np, sockaddr);
370368 if (ret != 0) {
371369 kfree(np);
drivers/target/iscsi/iscsi_target_login.c+5−58
@@ -811,59 +811,6 @@ void iscsi_post_login_handler( · 810 unmodified lines
811811 iscsit_dec_conn_usage_count(conn);
812812 }
813813
814−void iscsi_handle_login_thread_timeout(struct timer_list *t)
815−{
816− struct iscsi_np *np = from_timer(np, t, np_login_timer);
817−
818− spin_lock_bh(&np->np_thread_lock);
819− pr_err("iSCSI Login timeout on Network Portal %pISpc\n",
820− &np->np_sockaddr);
821−
822− if (np->np_login_timer_flags & ISCSI_TF_STOP) {
823− spin_unlock_bh(&np->np_thread_lock);
824− return;
825− }
826−
827− if (np->np_thread)
828− send_sig(SIGINT, np->np_thread, 1);
829−
830− np->np_login_timer_flags &= ~ISCSI_TF_RUNNING;
831− spin_unlock_bh(&np->np_thread_lock);
832−}
833−
834−static void iscsi_start_login_thread_timer(struct iscsi_np *np)
835−{
836− /*
837− * This used the TA_LOGIN_TIMEOUT constant because at this
838− * point we do not have access to ISCSI_TPG_ATTRIB(tpg)->login_timeout
839− */
840− spin_lock_bh(&np->np_thread_lock);
841− np->np_login_timer_flags &= ~ISCSI_TF_STOP;
842− np->np_login_timer_flags |= ISCSI_TF_RUNNING;
843− mod_timer(&np->np_login_timer, jiffies + TA_LOGIN_TIMEOUT * HZ);
844−
845− pr_debug("Added timeout timer to iSCSI login request for"
846− " %u seconds.\n", TA_LOGIN_TIMEOUT);
847− spin_unlock_bh(&np->np_thread_lock);
848−}
849−
850−static void iscsi_stop_login_thread_timer(struct iscsi_np *np)
851−{
852− spin_lock_bh(&np->np_thread_lock);
853− if (!(np->np_login_timer_flags & ISCSI_TF_RUNNING)) {
854− spin_unlock_bh(&np->np_thread_lock);
855− return;
856− }
857− np->np_login_timer_flags |= ISCSI_TF_STOP;
858− spin_unlock_bh(&np->np_thread_lock);
859−
860− del_timer_sync(&np->np_login_timer);
861−
862− spin_lock_bh(&np->np_thread_lock);
863− np->np_login_timer_flags &= ~ISCSI_TF_RUNNING;
864− spin_unlock_bh(&np->np_thread_lock);
865−}
866−
867814 int iscsit_setup_np(
868815 struct iscsi_np *np,
869816 struct sockaddr_storage *sockaddr)
@@ -1123,10 +1070,13 @@ static struct iscsit_conn *iscsit_alloc_conn(struct iscsi_np *np) · 253 unmodified lines
11231070 spin_lock_init(&conn->nopin_timer_lock);
11241071 spin_lock_init(&conn->response_queue_lock);
11251072 spin_lock_init(&conn->state_lock);
1073+ spin_lock_init(&conn->login_worker_lock);
1074+ spin_lock_init(&conn->login_timer_lock);
11261075
11271076 timer_setup(&conn->nopin_response_timer,
11281077 iscsit_handle_nopin_response_timeout, 0);
11291078 timer_setup(&conn->nopin_timer, iscsit_handle_nopin_timeout, 0);
1079+ timer_setup(&conn->login_timer, iscsit_login_timeout, 0);
11301080
11311081 if (iscsit_conn_set_transport(conn, np->np_transport) < 0)
11321082 goto free_conn;
@@ -1304,7 +1254,7 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) · 171 unmodified lines
13041254 goto new_sess_out;
13051255 }
13061256
1307− iscsi_start_login_thread_timer(np);
1257+ iscsit_start_login_timer(conn, current);
13081258
13091259 pr_debug("Moving to TARG_CONN_STATE_XPT_UP.\n");
13101260 conn->conn_state = TARG_CONN_STATE_XPT_UP;
@@ -1417,8 +1367,6 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) · 106 unmodified lines
14171367 if (ret < 0)
14181368 goto new_sess_out;
14191369
1420− iscsi_stop_login_thread_timer(np);
1421−
14221370 if (ret == 1) {
14231371 tpg_np = conn->tpg_np;
14241372
@@ -1434,7 +1382,7 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) · 9 unmodified lines
14341382 new_sess_out:
14351383 new_sess = true;
14361384 old_sess_out:
1437− iscsi_stop_login_thread_timer(np);
1385+ iscsit_stop_login_timer(conn);
14381386 tpg_np = conn->tpg_np;
14391387 iscsi_target_login_sess_out(conn, zero_tsih, new_sess);
14401388 new_sess = false;
@@ -1448,7 +1396,6 @@ old_sess_out: · 7 unmodified lines
14481396 return 1;
14491397
14501398 exit:
1451− iscsi_stop_login_thread_timer(np);
14521399 spin_lock_bh(&np->np_thread_lock);
14531400 np->np_thread_state = ISCSI_NP_THREAD_EXIT;
14541401 spin_unlock_bh(&np->np_thread_lock);
drivers/target/iscsi/iscsi_target_nego.c+42−32
@@ -535,25 +535,6 @@ static void iscsi_target_login_drop(struct iscsit_conn *conn, struct iscsi_login · 534 unmodified lines
535535 iscsi_target_login_sess_out(conn, zero_tsih, true);
536536 }
537537
538−struct conn_timeout {
539− struct timer_list timer;
540− struct iscsit_conn *conn;
541−};
542−
543−static void iscsi_target_login_timeout(struct timer_list *t)
544−{
545− struct conn_timeout *timeout = from_timer(timeout, t, timer);
546− struct iscsit_conn *conn = timeout->conn;
547−
548− pr_debug("Entering iscsi_target_login_timeout >>>>>>>>>>>>>>>>>>>\n");
549−
550− if (conn->login_kworker) {
551− pr_debug("Sending SIGINT to conn->login_kworker %s/%d\n",
552− conn->login_kworker->comm, conn->login_kworker->pid);
553− send_sig(SIGINT, conn->login_kworker, 1);
554− }
555−}
556−
557538 static void iscsi_target_do_login_rx(struct work_struct *work)
558539 {
559540 struct iscsit_conn *conn = container_of(work,
@@ -562,12 +543,15 @@ static void iscsi_target_do_login_rx(struct work_struct *work) · 2 unmodified lines
562543 struct iscsi_np *np = login->np;
563544 struct iscsi_portal_group *tpg = conn->tpg;
564545 struct iscsi_tpg_np *tpg_np = conn->tpg_np;
565− struct conn_timeout timeout;
566546 int rc, zero_tsih = login->zero_tsih;
567547 bool state;
568548
569549 pr_debug("entering iscsi_target_do_login_rx, conn: %p, %s:%d\n",
570550 conn, current->comm, current->pid);
551+
552+ spin_lock(&conn->login_worker_lock);
553+ set_bit(LOGIN_FLAGS_WORKER_RUNNING, &conn->login_flags);
554+ spin_unlock(&conn->login_worker_lock);
571555 /*
572556 * If iscsi_target_do_login_rx() has been invoked by ->sk_data_ready()
573557 * before initial PDU processing in iscsi_target_start_negotiation()
@@ -597,19 +581,16 @@ static void iscsi_target_do_login_rx(struct work_struct *work) · 23 unmodified lines
597581 goto err;
598582 }
599583
600− conn->login_kworker = current;
601584 allow_signal(SIGINT);
602−
603− timeout.conn = conn;
604− timer_setup_on_stack(&timeout.timer, iscsi_target_login_timeout, 0);
605− mod_timer(&timeout.timer, jiffies + TA_LOGIN_TIMEOUT * HZ);
606− pr_debug("Starting login timer for %s/%d\n", current->comm, current->pid);
585+ rc = iscsit_set_login_timer_kworker(conn, current);
586+ if (rc < 0) {
587+ /* The login timer has already expired */
588+ pr_debug("iscsi_target_do_login_rx, login failed\n");
589+ goto err;
590+ }
607591
608592 rc = conn->conn_transport->iscsit_get_login_rx(conn, login);
609− del_timer_sync(&timeout.timer);
610− destroy_timer_on_stack(&timeout.timer);
611593 flush_signals(current);
612− conn->login_kworker = NULL;
613594
614595 if (rc < 0)
615596 goto err;
@@ -646,7 +627,17 @@ static void iscsi_target_do_login_rx(struct work_struct *work) · 30 unmodified lines
646627 if (iscsi_target_sk_check_and_clear(conn,
647628 LOGIN_FLAGS_WRITE_ACTIVE))
648629 goto err;
630+
631+ /*
632+ * Set the login timer thread pointer to NULL to prevent the
633+ * login process from getting stuck if the initiator
634+ * stops sending data.
635+ */
636+ rc = iscsit_set_login_timer_kworker(conn, NULL);
637+ if (rc < 0)
638+ goto err;
649639 } else if (rc == 1) {
640+ iscsit_stop_login_timer(conn);
650641 cancel_delayed_work(&conn->login_work);
651642 iscsi_target_nego_release(conn);
652643 iscsi_post_login_handler(np, conn, zero_tsih);
@@ -656,6 +647,7 @@ static void iscsi_target_do_login_rx(struct work_struct *work) · 3 unmodified lines
656647
657648 err:
658649 iscsi_target_restore_sock_callbacks(conn);
650+ iscsit_stop_login_timer(conn);
659651 cancel_delayed_work(&conn->login_work);
660652 iscsi_target_login_drop(conn, login);
661653 iscsit_deaccess_np(np, tpg, tpg_np);
@@ -1130,6 +1122,7 @@ int iscsi_target_locate_portal( · 468 unmodified lines
11301122 iscsi_target_set_sock_callbacks(conn);
11311123
11321124 login->np = np;
1125+ conn->tpg = NULL;
11331126
11341127 login_req = (struct iscsi_login_req *) login->req;
11351128 payload_length = ntoh24(login_req->dlength);
@@ -1197,7 +1190,6 @@ int iscsi_target_locate_portal( · 61 unmodified lines
11971190 */
11981191 sessiontype = strncmp(s_buf, DISCOVERY, 9);
11991192 if (!sessiontype) {
1200− conn->tpg = iscsit_global->discovery_tpg;
12011193 if (!login->leading_connection)
12021194 goto get_target;
12031195
@@ -1214,9 +1206,11 @@ int iscsi_target_locate_portal( · 10 unmodified lines
12141206 * Serialize access across the discovery struct iscsi_portal_group to
12151207 * process login attempt.
12161208 */
1209+ conn->tpg = iscsit_global->discovery_tpg;
12171210 if (iscsit_access_np(np, conn->tpg) < 0) {
12181211 iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
12191212 ISCSI_LOGIN_STATUS_SVC_UNAVAILABLE);
1213+ conn->tpg = NULL;
12201214 ret = -1;
12211215 goto out;
12221216 }
@@ -1368,14 +1362,30 @@ int iscsi_target_start_negotiation( · 145 unmodified lines
13681362 * and perform connection cleanup now.
13691363 */
13701364 ret = iscsi_target_do_login(conn, login);
1371− if (!ret && iscsi_target_sk_check_and_clear(conn, LOGIN_FLAGS_INITIAL_PDU))
1372− ret = -1;
1365+ if (!ret) {
1366+ spin_lock(&conn->login_worker_lock);
1367+
1368+ if (iscsi_target_sk_check_and_clear(conn, LOGIN_FLAGS_INITIAL_PDU))
1369+ ret = -1;
1370+ else if (!test_bit(LOGIN_FLAGS_WORKER_RUNNING, &conn->login_flags)) {
1371+ if (iscsit_set_login_timer_kworker(conn, NULL) < 0) {
1372+ /*
1373+ * The timeout has expired already.
1374+ * Schedule login_work to perform the cleanup.
1375+ */
1376+ schedule_delayed_work(&conn->login_work, 0);
1377+ }
1378+ }
1379+
1380+ spin_unlock(&conn->login_worker_lock);
1381+ }
13731382
13741383 if (ret < 0) {
13751384 iscsi_target_restore_sock_callbacks(conn);
13761385 iscsi_remove_failed_auth_entry(conn);
13771386 }
13781387 if (ret != 0) {
1388+ iscsit_stop_login_timer(conn);
13791389 cancel_delayed_work_sync(&conn->login_work);
13801390 iscsi_target_nego_release(conn);
13811391 }
drivers/target/iscsi/iscsi_target_util.c+51−0
@@ -1040,6 +1040,57 @@ void iscsit_stop_nopin_timer(struct iscsit_conn *conn) · 1039 unmodified lines
10401040 spin_unlock_bh(&conn->nopin_timer_lock);
10411041 }
10421042
1043+void iscsit_login_timeout(struct timer_list *t)
1044+{
1045+ struct iscsit_conn *conn = from_timer(conn, t, login_timer);
1046+ struct iscsi_login *login = conn->login;
1047+
1048+ pr_debug("Entering iscsi_target_login_timeout >>>>>>>>>>>>>>>>>>>\n");
1049+
1050+ spin_lock_bh(&conn->login_timer_lock);
1051+ login->login_failed = 1;
1052+
1053+ if (conn->login_kworker) {
1054+ pr_debug("Sending SIGINT to conn->login_kworker %s/%d\n",
1055+ conn->login_kworker->comm, conn->login_kworker->pid);
1056+ send_sig(SIGINT, conn->login_kworker, 1);
1057+ } else {
1058+ schedule_delayed_work(&conn->login_work, 0);
1059+ }
1060+ spin_unlock_bh(&conn->login_timer_lock);
1061+}
1062+
1063+void iscsit_start_login_timer(struct iscsit_conn *conn, struct task_struct *kthr)
1064+{
1065+ pr_debug("Login timer started\n");
1066+
1067+ conn->login_kworker = kthr;
1068+ mod_timer(&conn->login_timer, jiffies + TA_LOGIN_TIMEOUT * HZ);
1069+}
1070+
1071+int iscsit_set_login_timer_kworker(struct iscsit_conn *conn, struct task_struct *kthr)
1072+{
1073+ struct iscsi_login *login = conn->login;
1074+ int ret = 0;
1075+
1076+ spin_lock_bh(&conn->login_timer_lock);
1077+ if (login->login_failed) {
1078+ /* The timer has already expired */
1079+ ret = -1;
1080+ } else {
1081+ conn->login_kworker = kthr;
1082+ }
1083+ spin_unlock_bh(&conn->login_timer_lock);
1084+
1085+ return ret;
1086+}
1087+
1088+void iscsit_stop_login_timer(struct iscsit_conn *conn)
1089+{
1090+ pr_debug("Login timer stopped\n");
1091+ timer_delete_sync(&conn->login_timer);
1092+}
1093+
10431094 int iscsit_send_tx_data(
10441095 struct iscsit_cmd *cmd,
10451096 struct iscsit_conn *conn,
drivers/target/iscsi/iscsi_target_util.h+4−0
@@ -56,6 +56,10 @@ extern void iscsit_handle_nopin_timeout(struct timer_list *t); · 55 unmodified lines
5656 extern void __iscsit_start_nopin_timer(struct iscsit_conn *);
5757 extern void iscsit_start_nopin_timer(struct iscsit_conn *);
5858 extern void iscsit_stop_nopin_timer(struct iscsit_conn *);
59+extern void iscsit_login_timeout(struct timer_list *t);
60+extern void iscsit_start_login_timer(struct iscsit_conn *, struct task_struct *kthr);
61+extern void iscsit_stop_login_timer(struct iscsit_conn *);
62+extern int iscsit_set_login_timer_kworker(struct iscsit_conn *, struct task_struct *kthr);
5963 extern int iscsit_send_tx_data(struct iscsit_cmd *, struct iscsit_conn *, int);
6064 extern int iscsit_fe_sendpage_sg(struct iscsit_cmd *, struct iscsit_conn *);
6165 extern int iscsit_tx_login_rsp(struct iscsit_conn *, u8, u8);
drivers/tty/serial/8250/8250_tegra.c+3−1
@@ -113,13 +113,15 @@ static int tegra_uart_probe(struct platform_device *pdev) · 112 unmodified lines
113113
114114 ret = serial8250_register_8250_port(&port8250);
115115 if (ret < 0)
116− goto err_clkdisable;
116+ goto err_ctrl_assert;
117117
118118 platform_set_drvdata(pdev, uart);
119119 uart->line = ret;
120120
121121 return 0;
122122
123+err_ctrl_assert:
124+ reset_control_assert(uart->rst);
123125 err_clkdisable:
124126 clk_disable_unprepare(uart->clk);
125127
drivers/tty/serial/Kconfig+1−1
@@ -762,7 +762,7 @@ config SERIAL_PMACZILOG_CONSOLE · 761 unmodified lines
762762
763763 config SERIAL_CPM
764764 tristate "CPM SCC/SMC serial port support"
765− depends on CPM2 || CPM1 || (PPC32 && COMPILE_TEST)
765+ depends on CPM2 || CPM1
766766 select SERIAL_CORE
767767 help
768768 This driver supports the SCC and SMC serial ports on Motorola
drivers/tty/serial/cpm_uart/cpm_uart.h+0−2
@@ -19,8 +19,6 @@ struct gpio_desc; · 18 unmodified lines
1919 #include "cpm_uart_cpm2.h"
2020 #elif defined(CONFIG_CPM1)
2121 #include "cpm_uart_cpm1.h"
22−#elif defined(CONFIG_COMPILE_TEST)
23−#include "cpm_uart_cpm2.h"
2422 #endif
2523
2624 #define SERIAL_CPM_MAJOR 204
drivers/tty/serial/fsl_lpuart.c+23−21
@@ -1495,34 +1495,36 @@ static void lpuart_break_ctl(struct uart_port *port, int break_state) · 1494 unmodified lines
14951495
14961496 static void lpuart32_break_ctl(struct uart_port *port, int break_state)
14971497 {
1498− unsigned long temp, modem;
1499− struct tty_struct *tty;
1500− unsigned int cflag = 0;
1501−
1502− tty = tty_port_tty_get(&port->state->port);
1503− if (tty) {
1504− cflag = tty->termios.c_cflag;
1505− tty_kref_put(tty);
1506− }
1498+ unsigned long temp;
15071499
1508− temp = lpuart32_read(port, UARTCTRL) & ~UARTCTRL_SBK;
1509− modem = lpuart32_read(port, UARTMODIR);
1500+ temp = lpuart32_read(port, UARTCTRL);
15101501
1502+ /*
1503+ * LPUART IP now has two known bugs, one is CTS has higher priority than the
1504+ * break signal, which causes the break signal sending through UARTCTRL_SBK
1505+ * may impacted by the CTS input if the HW flow control is enabled. It
1506+ * exists on all platforms we support in this driver.
1507+ * Another bug is i.MX8QM LPUART may have an additional break character
1508+ * being sent after SBK was cleared.
1509+ * To avoid above two bugs, we use Transmit Data Inversion function to send
1510+ * the break signal instead of UARTCTRL_SBK.
1511+ */
15111512 if (break_state != 0) {
1512− temp |= UARTCTRL_SBK;
15131513 /*
1514− * LPUART CTS has higher priority than SBK, need to disable CTS before
1515− * asserting SBK to avoid any interference if flow control is enabled.
1514+ * Disable the transmitter to prevent any data from being sent out
1515+ * during break, then invert the TX line to send break.
15161516 */
1517− if (cflag & CRTSCTS && modem & UARTMODIR_TXCTSE)
1518− lpuart32_write(port, modem & ~UARTMODIR_TXCTSE, UARTMODIR);
1517+ temp &= ~UARTCTRL_TE;
1518+ lpuart32_write(port, temp, UARTCTRL);
1519+ temp |= UARTCTRL_TXINV;
1520+ lpuart32_write(port, temp, UARTCTRL);
15191521 } else {
1520− /* Re-enable the CTS when break off. */
1521− if (cflag & CRTSCTS && !(modem & UARTMODIR_TXCTSE))
1522− lpuart32_write(port, modem | UARTMODIR_TXCTSE, UARTMODIR);
1522+ /* Disable the TXINV to turn off break and re-enable transmitter. */
1523+ temp &= ~UARTCTRL_TXINV;
1524+ lpuart32_write(port, temp, UARTCTRL);
1525+ temp |= UARTCTRL_TE;
1526+ lpuart32_write(port, temp, UARTCTRL);
15231527 }
1524−
1525− lpuart32_write(port, temp, UARTCTRL);
15261528 }
15271529
15281530 static void lpuart_setup_watermark(struct lpuart_port *sport)
drivers/usb/cdns3/cdns3-gadget.c+13−0
@@ -2097,6 +2097,19 @@ int cdns3_ep_config(struct cdns3_endpoint *priv_ep, bool enable) · 2096 unmodified lines
20972097 else
20982098 priv_ep->trb_burst_size = 16;
20992099
2100+ /*
2101+ * In versions preceding DEV_VER_V2, for example, iMX8QM, there exit the bugs
2102+ * in the DMA. These bugs occur when the trb_burst_size exceeds 16 and the
2103+ * address is not aligned to 128 Bytes (which is a product of the 64-bit AXI
2104+ * and AXI maximum burst length of 16 or 0xF+1, dma_axi_ctrl0[3:0]). This
2105+ * results in data corruption when it crosses the 4K border. The corruption
2106+ * specifically occurs from the position (4K - (address & 0x7F)) to 4K.
2107+ *
2108+ * So force trb_burst_size to 16 at such platform.
2109+ */
2110+ if (priv_dev->dev_ver < DEV_VER_V2)
2111+ priv_ep->trb_burst_size = 16;
2112+
21002113 mult = min_t(u8, mult, EP_CFG_MULT_MAX);
21012114 buffering = min_t(u8, buffering, EP_CFG_BUFFERING_MAX);
21022115 maxburst = min_t(u8, maxburst, EP_CFG_MAXBURST_MAX);
drivers/usb/core/buffer.c+41−0
@@ -172,3 +172,44 @@ void hcd_buffer_free( · 171 unmodified lines
172172 }
173173 dma_free_coherent(hcd->self.sysdev, size, addr, dma);
174174 }
175+
176+void *hcd_buffer_alloc_pages(struct usb_hcd *hcd,
177+ size_t size, gfp_t mem_flags, dma_addr_t *dma)
178+{
179+ if (size == 0)
180+ return NULL;
181+
182+ if (hcd->localmem_pool)
183+ return gen_pool_dma_alloc_align(hcd->localmem_pool,
184+ size, dma, PAGE_SIZE);
185+
186+ /* some USB hosts just use PIO */
187+ if (!hcd_uses_dma(hcd)) {
188+ *dma = DMA_MAPPING_ERROR;
189+ return (void *)__get_free_pages(mem_flags,
190+ get_order(size));
191+ }
192+
193+ return dma_alloc_coherent(hcd->self.sysdev,
194+ size, dma, mem_flags);
195+}
196+
197+void hcd_buffer_free_pages(struct usb_hcd *hcd,
198+ size_t size, void *addr, dma_addr_t dma)
199+{
200+ if (!addr)
201+ return;
202+
203+ if (hcd->localmem_pool) {
204+ gen_pool_free(hcd->localmem_pool,
205+ (unsigned long)addr, size);
206+ return;
207+ }
208+
209+ if (!hcd_uses_dma(hcd)) {
210+ free_pages((unsigned long)addr, get_order(size));
211+ return;
212+ }
213+
214+ dma_free_coherent(hcd->self.sysdev, size, addr, dma);
215+}
drivers/usb/core/devio.c+14−6
@@ -186,6 +186,7 @@ static int connected(struct usb_dev_state *ps) · 185 unmodified lines
186186 static void dec_usb_memory_use_count(struct usb_memory *usbm, int *count)
187187 {
188188 struct usb_dev_state *ps = usbm->ps;
189+ struct usb_hcd *hcd = bus_to_hcd(ps->dev->bus);
189190 unsigned long flags;
190191
191192 spin_lock_irqsave(&ps->lock, flags);
@@ -194,8 +195,8 @@ static void dec_usb_memory_use_count(struct usb_memory *usbm, int *count) · 2 unmodified lines
194195 list_del(&usbm->memlist);
195196 spin_unlock_irqrestore(&ps->lock, flags);
196197
197− usb_free_coherent(ps->dev, usbm->size, usbm->mem,
198− usbm->dma_handle);
198+ hcd_buffer_free_pages(hcd, usbm->size,
199+ usbm->mem, usbm->dma_handle);
199200 usbfs_decrease_memory_usage(
200201 usbm->size + sizeof(struct usb_memory));
201202 kfree(usbm);
@@ -234,7 +235,7 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma) · 32 unmodified lines
234235 size_t size = vma->vm_end - vma->vm_start;
235236 void *mem;
236237 unsigned long flags;
237− dma_addr_t dma_handle;
238+ dma_addr_t dma_handle = DMA_MAPPING_ERROR;
238239 int ret;
239240
240241 ret = usbfs_increase_memory_usage(size + sizeof(struct usb_memory));
@@ -247,8 +248,8 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma) · 6 unmodified lines
247248 goto error_decrease_mem;
248249 }
249250
250− mem = usb_alloc_coherent(ps->dev, size, GFP_USER | __GFP_NOWARN,
251− &dma_handle);
251+ mem = hcd_buffer_alloc_pages(hcd,
252+ size, GFP_USER | __GFP_NOWARN, &dma_handle);
252253 if (!mem) {
253254 ret = -ENOMEM;
254255 goto error_free_usbm;
@@ -264,7 +265,14 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma) · 9 unmodified lines
264265 usbm->vma_use_count = 1;
265266 INIT_LIST_HEAD(&usbm->memlist);
266267
267− if (hcd->localmem_pool || !hcd_uses_dma(hcd)) {
268+ /*
269+ * In DMA-unavailable cases, hcd_buffer_alloc_pages allocates
270+ * normal pages and assigns DMA_MAPPING_ERROR to dma_handle. Check
271+ * whether we are in such cases, and then use remap_pfn_range (or
272+ * dma_mmap_coherent) to map normal (or DMA) pages into the user
273+ * space, respectively.
274+ */
275+ if (dma_handle == DMA_MAPPING_ERROR) {
268276 if (remap_pfn_range(vma, vma->vm_start,
269277 virt_to_phys(usbm->mem) >> PAGE_SHIFT,
270278 size, vma->vm_page_prot) < 0) {
drivers/usb/gadget/function/f_fs.c+1−1
@@ -3535,6 +3535,7 @@ static void ffs_func_unbind(struct usb_configuration *c, · 3534 unmodified lines
35353535 /* Drain any pending AIO completions */
35363536 drain_workqueue(ffs->io_completion_wq);
35373537
3538+ ffs_event_add(ffs, FUNCTIONFS_UNBIND);
35383539 if (!--opts->refcnt)
35393540 functionfs_unbind(ffs);
35403541
@@ -3559,7 +3560,6 @@ static void ffs_func_unbind(struct usb_configuration *c, · 18 unmodified lines
35593560 func->function.ssp_descriptors = NULL;
35603561 func->interfaces_nums = NULL;
35613562
3562− ffs_event_add(ffs, FUNCTIONFS_UNBIND);
35633563 }
35643564
35653565 static struct usb_function *ffs_alloc(struct usb_function_instance *fi)
drivers/usb/gadget/udc/amd5536udc_pci.c+3−0
@@ -170,6 +170,9 @@ static int udc_pci_probe( · 169 unmodified lines
170170 retval = -ENODEV;
171171 goto err_probe;
172172 }
173+
174+ udc = dev;
175+
173176 return 0;
174177
175178 err_probe:
drivers/usb/typec/tipd/core.c+1−1
@@ -920,7 +920,7 @@ static int __maybe_unused tps6598x_resume(struct device *dev) · 919 unmodified lines
920920 enable_irq(client->irq);
921921 }
922922
923− if (client->irq)
923+ if (!client->irq)
924924 queue_delayed_work(system_power_efficient_wq, &tps->wq_poll,
925925 msecs_to_jiffies(POLL_INTERVAL));
926926
drivers/video/fbdev/arcfb.c+2−3
@@ -590,7 +590,7 @@ err_fb_alloc: · 589 unmodified lines
590590 return retval;
591591 }
592592
593−static int arcfb_remove(struct platform_device *dev)
593+static void arcfb_remove(struct platform_device *dev)
594594 {
595595 struct fb_info *info = platform_get_drvdata(dev);
596596
@@ -601,12 +601,11 @@ static int arcfb_remove(struct platform_device *dev) · 4 unmodified lines
601601 vfree((void __force *)info->screen_base);
602602 framebuffer_release(info);
603603 }
604− return 0;
605604 }
606605
607606 static struct platform_driver arcfb_driver = {
608607 .probe = arcfb_probe,
609− .remove = arcfb_remove,
608+ .remove_new = arcfb_remove,
610609 .driver = {
611610 .name = "arcfb",
612611 },
drivers/video/fbdev/au1100fb.c+3−8
@@ -520,13 +520,10 @@ failed: · 519 unmodified lines
520520 return -ENODEV;
521521 }
522522
523−int au1100fb_drv_remove(struct platform_device *dev)
523+void au1100fb_drv_remove(struct platform_device *dev)
524524 {
525525 struct au1100fb_device *fbdev = NULL;
526526
527− if (!dev)
528− return -ENODEV;
529−
530527 fbdev = platform_get_drvdata(dev);
531528
532529 #if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO)
@@ -543,8 +540,6 @@ int au1100fb_drv_remove(struct platform_device *dev) · 10 unmodified lines
543540 clk_disable_unprepare(fbdev->lcdclk);
544541 clk_put(fbdev->lcdclk);
545542 }
546−
547− return 0;
548543 }
549544
550545 #ifdef CONFIG_PM
@@ -593,9 +588,9 @@ static struct platform_driver au1100fb_driver = { · 42 unmodified lines
593588 .name = "au1100-lcd",
594589 },
595590 .probe = au1100fb_drv_probe,
596− .remove = au1100fb_drv_remove,
591+ .remove_new = au1100fb_drv_remove,
597592 .suspend = au1100fb_drv_suspend,
598− .resume = au1100fb_drv_resume,
593+ .resume = au1100fb_drv_resume,
599594 };
600595 module_platform_driver(au1100fb_driver);
601596
drivers/video/fbdev/au1200fb.c+2−4
@@ -1765,7 +1765,7 @@ failed: · 1764 unmodified lines
17651765 return ret;
17661766 }
17671767
1768−static int au1200fb_drv_remove(struct platform_device *dev)
1768+static void au1200fb_drv_remove(struct platform_device *dev)
17691769 {
17701770 struct au1200fb_platdata *pd = platform_get_drvdata(dev);
17711771 struct fb_info *fbi;
@@ -1788,8 +1788,6 @@ static int au1200fb_drv_remove(struct platform_device *dev) · 16 unmodified lines
17881788 }
17891789
17901790 free_irq(platform_get_irq(dev, 0), (void *)dev);
1791−
1792− return 0;
17931791 }
17941792
17951793 #ifdef CONFIG_PM
@@ -1840,7 +1838,7 @@ static struct platform_driver au1200fb_driver = { · 44 unmodified lines
18401838 .pm = AU1200FB_PMOPS,
18411839 },
18421840 .probe = au1200fb_drv_probe,
1843− .remove = au1200fb_drv_remove,
1841+ .remove_new = au1200fb_drv_remove,
18441842 };
18451843 module_platform_driver(au1200fb_driver);
18461844
drivers/video/fbdev/broadsheetfb.c+2−3
@@ -1193,7 +1193,7 @@ err: · 1192 unmodified lines
11931193
11941194 }
11951195
1196−static int broadsheetfb_remove(struct platform_device *dev)
1196+static void broadsheetfb_remove(struct platform_device *dev)
11971197 {
11981198 struct fb_info *info = platform_get_drvdata(dev);
11991199
@@ -1209,12 +1209,11 @@ static int broadsheetfb_remove(struct platform_device *dev) · 9 unmodified lines
12091209 module_put(par->board->owner);
12101210 framebuffer_release(info);
12111211 }
1212− return 0;
12131212 }
12141213
12151214 static struct platform_driver broadsheetfb_driver = {
12161215 .probe = broadsheetfb_probe,
1217− .remove = broadsheetfb_remove,
1216+ .remove_new = broadsheetfb_remove,
12181217 .driver = {
12191218 .name = "broadsheetfb",
12201219 },
drivers/video/fbdev/bw2.c+2−4
@@ -352,7 +352,7 @@ out_err: · 351 unmodified lines
352352 return err;
353353 }
354354
355−static int bw2_remove(struct platform_device *op)
355+static void bw2_remove(struct platform_device *op)
356356 {
357357 struct fb_info *info = dev_get_drvdata(&op->dev);
358358 struct bw2_par *par = info->par;
@@ -363,8 +363,6 @@ static int bw2_remove(struct platform_device *op) · 4 unmodified lines
363363 of_iounmap(&op->resource[0], info->screen_base, info->fix.smem_len);
364364
365365 framebuffer_release(info);
366−
367− return 0;
368366 }
369367
370368 static const struct of_device_id bw2_match[] = {
@@ -381,7 +379,7 @@ static struct platform_driver bw2_driver = { · 10 unmodified lines
381379 .of_match_table = bw2_match,
382380 },
383381 .probe = bw2_probe,
384− .remove = bw2_remove,
382+ .remove_new = bw2_remove,
385383 };
386384
387385 static int __init bw2_init(void)
drivers/video/fbdev/core/bitblit.c+3−0
@@ -247,6 +247,9 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode, · 246 unmodified lines
247247
248248 cursor.set = 0;
249249
250+ if (!vc->vc_font.data)
251+ return;
252+
250253 c = scr_readw((u16 *) vc->vc_pos);
251254 attribute = get_attribute(info, c);
252255 src = vc->vc_font.data + ((c & charmask) * (w * vc->vc_font.height));
drivers/video/fbdev/imsttfb.c+9−3
@@ -1452,9 +1452,13 @@ static int init_imstt(struct fb_info *info) · 1451 unmodified lines
14521452 FBINFO_HWACCEL_FILLRECT |
14531453 FBINFO_HWACCEL_YPAN;
14541454
1455− fb_alloc_cmap(&info->cmap, 0, 0);
1455+ if (fb_alloc_cmap(&info->cmap, 0, 0)) {
1456+ framebuffer_release(info);
1457+ return -ENODEV;
1458+ }
14561459
14571460 if (register_framebuffer(info) < 0) {
1461+ fb_dealloc_cmap(&info->cmap);
14581462 framebuffer_release(info);
14591463 return -ENODEV;
14601464 }
@@ -1531,8 +1535,10 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 70 unmodified lines
15311535 goto error;
15321536 info->pseudo_palette = par->palette;
15331537 ret = init_imstt(info);
1534− if (!ret)
1535− pci_set_drvdata(pdev, info);
1538+ if (ret)
1539+ goto error;
1540+
1541+ pci_set_drvdata(pdev, info);
15361542 return ret;
15371543
15381544 error:
drivers/video/fbdev/matrox/matroxfb_maven.c+1−1
@@ -1291,7 +1291,7 @@ static struct i2c_driver maven_driver={ · 1290 unmodified lines
12911291 .driver = {
12921292 .name = "maven",
12931293 },
1294− .probe_new = maven_probe,
1294+ .probe = maven_probe,
12951295 .remove = maven_remove,
12961296 .id_table = maven_id,
12971297 };
drivers/video/fbdev/ssd1307fb.c+1−1
@@ -844,7 +844,7 @@ static const struct i2c_device_id ssd1307fb_i2c_id[] = { · 843 unmodified lines
844844 MODULE_DEVICE_TABLE(i2c, ssd1307fb_i2c_id);
845845
846846 static struct i2c_driver ssd1307fb_driver = {
847− .probe_new = ssd1307fb_probe,
847+ .probe = ssd1307fb_probe,
848848 .remove = ssd1307fb_remove,
849849 .id_table = ssd1307fb_i2c_id,
850850 .driver = {
fs/afs/dir.c+3−0
@@ -1358,6 +1358,7 @@ static int afs_mkdir(struct mnt_idmap *idmap, struct inode *dir, · 1357 unmodified lines
13581358 op->dentry = dentry;
13591359 op->create.mode = S_IFDIR | mode;
13601360 op->create.reason = afs_edit_dir_for_mkdir;
1361+ op->mtime = current_time(dir);
13611362 op->ops = &afs_mkdir_operation;
13621363 return afs_do_sync_operation(op);
13631364 }
@@ -1661,6 +1662,7 @@ static int afs_create(struct mnt_idmap *idmap, struct inode *dir, · 297 unmodified lines
16611662 op->dentry = dentry;
16621663 op->create.mode = S_IFREG | mode;
16631664 op->create.reason = afs_edit_dir_for_create;
1665+ op->mtime = current_time(dir);
16641666 op->ops = &afs_create_operation;
16651667 return afs_do_sync_operation(op);
16661668
@@ -1796,6 +1798,7 @@ static int afs_symlink(struct mnt_idmap *idmap, struct inode *dir, · 129 unmodified lines
17961798 op->ops = &afs_symlink_operation;
17971799 op->create.reason = afs_edit_dir_for_symlink;
17981800 op->create.symlink = content;
1801+ op->mtime = current_time(dir);
17991802 return afs_do_sync_operation(op);
18001803
18011804 error:
fs/btrfs/bio.c+0−4
@@ -811,10 +811,6 @@ void btrfs_submit_repair_write(struct btrfs_bio *bbio, int mirror_num, bool dev_ · 810 unmodified lines
811811 goto fail;
812812
813813 if (dev_replace) {
814− if (btrfs_op(&bbio->bio) == BTRFS_MAP_WRITE && btrfs_is_zoned(fs_info)) {
815− bbio->bio.bi_opf &= ~REQ_OP_WRITE;
816− bbio->bio.bi_opf |= REQ_OP_ZONE_APPEND;
817− }
818814 ASSERT(smap.dev == fs_info->dev_replace.srcdev);
819815 smap.dev = fs_info->dev_replace.tgtdev;
820816 }
fs/btrfs/scrub.c+32−16
@@ -1137,6 +1137,35 @@ static void scrub_write_endio(struct btrfs_bio *bbio) · 1136 unmodified lines
11371137 wake_up(&stripe->io_wait);
11381138 }
11391139
1140+static void scrub_submit_write_bio(struct scrub_ctx *sctx,
1141+ struct scrub_stripe *stripe,
1142+ struct btrfs_bio *bbio, bool dev_replace)
1143+{
1144+ struct btrfs_fs_info *fs_info = sctx->fs_info;
1145+ u32 bio_len = bbio->bio.bi_iter.bi_size;
1146+ u32 bio_off = (bbio->bio.bi_iter.bi_sector << SECTOR_SHIFT) -
1147+ stripe->logical;
1148+
1149+ fill_writer_pointer_gap(sctx, stripe->physical + bio_off);
1150+ atomic_inc(&stripe->pending_io);
1151+ btrfs_submit_repair_write(bbio, stripe->mirror_num, dev_replace);
1152+ if (!btrfs_is_zoned(fs_info))
1153+ return;
1154+ /*
1155+ * For zoned writeback, queue depth must be 1, thus we must wait for
1156+ * the write to finish before the next write.
1157+ */
1158+ wait_scrub_stripe_io(stripe);
1159+
1160+ /*
1161+ * And also need to update the write pointer if write finished
1162+ * successfully.
1163+ */
1164+ if (!test_bit(bio_off >> fs_info->sectorsize_bits,
1165+ &stripe->write_error_bitmap))
1166+ sctx->write_pointer += bio_len;
1167+}
1168+
11401169 /*
11411170 * Submit the write bio(s) for the sectors specified by @write_bitmap.
11421171 *
@@ -1155,7 +1184,6 @@ static void scrub_write_sectors(struct scrub_ctx *sctx, struct scrub_stripe *str · 12 unmodified lines
11551184 {
11561185 struct btrfs_fs_info *fs_info = stripe->bg->fs_info;
11571186 struct btrfs_bio *bbio = NULL;
1158− const bool zoned = btrfs_is_zoned(fs_info);
11591187 int sector_nr;
11601188
11611189 for_each_set_bit(sector_nr, &write_bitmap, stripe->nr_sectors) {
@@ -1168,13 +1196,7 @@ static void scrub_write_sectors(struct scrub_ctx *sctx, struct scrub_stripe *str · 6 unmodified lines
11681196
11691197 /* Cannot merge with previous sector, submit the current one. */
11701198 if (bbio && sector_nr && !test_bit(sector_nr - 1, &write_bitmap)) {
1171− fill_writer_pointer_gap(sctx, stripe->physical +
1172− (sector_nr << fs_info->sectorsize_bits));
1173− atomic_inc(&stripe->pending_io);
1174− btrfs_submit_repair_write(bbio, stripe->mirror_num, dev_replace);
1175− /* For zoned writeback, queue depth must be 1. */
1176− if (zoned)
1177− wait_scrub_stripe_io(stripe);
1199+ scrub_submit_write_bio(sctx, stripe, bbio, dev_replace);
11781200 bbio = NULL;
11791201 }
11801202 if (!bbio) {
@@ -1187,14 +1209,8 @@ static void scrub_write_sectors(struct scrub_ctx *sctx, struct scrub_stripe *str · 6 unmodified lines
11871209 ret = bio_add_page(&bbio->bio, page, fs_info->sectorsize, pgoff);
11881210 ASSERT(ret == fs_info->sectorsize);
11891211 }
1190− if (bbio) {
1191− fill_writer_pointer_gap(sctx, bbio->bio.bi_iter.bi_sector <<
1192− SECTOR_SHIFT);
1193− atomic_inc(&stripe->pending_io);
1194− btrfs_submit_repair_write(bbio, stripe->mirror_num, dev_replace);
1195− if (zoned)
1196− wait_scrub_stripe_io(stripe);
1197− }
1212+ if (bbio)
1213+ scrub_submit_write_bio(sctx, stripe, bbio, dev_replace);
11981214 }
11991215
12001216 /*
fs/ext4/mballoc.c+15−1
@@ -2062,7 +2062,7 @@ static void ext4_mb_check_limits(struct ext4_allocation_context *ac, · 2061 unmodified lines
20622062 if (bex->fe_len < gex->fe_len)
20632063 return;
20642064
2065− if (finish_group)
2065+ if (finish_group || ac->ac_found > sbi->s_mb_min_to_scan)
20662066 ext4_mb_use_best_found(ac, e4b);
20672067 }
20682068
@@ -2074,6 +2074,20 @@ static void ext4_mb_check_limits(struct ext4_allocation_context *ac, · 5 unmodified lines
20742074 * in the context. Later, the best found extent will be used, if
20752075 * mballoc can't find good enough extent.
20762076 *
2077+ * The algorithm used is roughly as follows:
2078+ *
2079+ * * If free extent found is exactly as big as goal, then
2080+ * stop the scan and use it immediately
2081+ *
2082+ * * If free extent found is smaller than goal, then keep retrying
2083+ * upto a max of sbi->s_mb_max_to_scan times (default 200). After
2084+ * that stop scanning and use whatever we have.
2085+ *
2086+ * * If free extent found is bigger than goal, then keep retrying
2087+ * upto a max of sbi->s_mb_min_to_scan times (default 10) before
2088+ * stopping the scan and using the extent.
2089+ *
2090+ *
20772091 * FIXME: real allocation policy is to be designed yet!
20782092 */
20792093 static void ext4_mb_measure_extent(struct ext4_allocation_context *ac,
fs/gfs2/file.c+14−3
@@ -784,9 +784,13 @@ static inline bool should_fault_in_pages(struct iov_iter *i, · 783 unmodified lines
784784 if (!user_backed_iter(i))
785785 return false;
786786
787+ /*
788+ * Try to fault in multiple pages initially. When that doesn't result
789+ * in any progress, fall back to a single page.
790+ */
787791 size = PAGE_SIZE;
788792 offs = offset_in_page(iocb->ki_pos);
789− if (*prev_count != count || !*window_size) {
793+ if (*prev_count != count) {
790794 size_t nr_dirtied;
791795
792796 nr_dirtied = max(current->nr_dirtied_pause -
@@ -870,6 +874,7 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from, · 77 unmodified lines
870874 struct gfs2_inode *ip = GFS2_I(inode);
871875 size_t prev_count = 0, window_size = 0;
872876 size_t written = 0;
877+ bool enough_retries;
873878 ssize_t ret;
874879
875880 /*
@@ -913,11 +918,17 @@ retry: · 37 unmodified lines
913918 if (ret > 0)
914919 written = ret;
915920
921+ enough_retries = prev_count == iov_iter_count(from) &&
922+ window_size <= PAGE_SIZE;
916923 if (should_fault_in_pages(from, iocb, &prev_count, &window_size)) {
917924 gfs2_glock_dq(gh);
918925 window_size -= fault_in_iov_iter_readable(from, window_size);
919− if (window_size)
920− goto retry;
926+ if (window_size) {
927+ if (!enough_retries)
928+ goto retry;
929+ /* fall back to buffered I/O */
930+ ret = 0;
931+ }
921932 }
922933 out_unlock:
923934 if (gfs2_holder_queued(gh))
fs/nfsd/nfsctl.c+1−6
@@ -690,16 +690,11 @@ static ssize_t __write_ports_addfd(char *buf, struct net *net, const struct cred · 689 unmodified lines
690690 if (err != 0 || fd < 0)
691691 return -EINVAL;
692692
693− if (svc_alien_sock(net, fd)) {
694− printk(KERN_ERR "%s: socket net is different to NFSd's one\n", __func__);
695− return -EINVAL;
696− }
697−
698693 err = nfsd_create_serv(net);
699694 if (err != 0)
700695 return err;
701696
702− err = svc_addsock(nn->nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT, cred);
697+ err = svc_addsock(nn->nfsd_serv, net, fd, buf, SIMPLE_TRANSACTION_LIMIT, cred);
703698
704699 if (err >= 0 &&
705700 !nn->nfsd_serv->sv_nrthreads && !xchg(&nn->keep_active, 1))
fs/nfsd/vfs.c+9−1
@@ -536,7 +536,15 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, · 535 unmodified lines
536536
537537 inode_lock(inode);
538538 for (retries = 1;;) {
539− host_err = __nfsd_setattr(dentry, iap);
539+ struct iattr attrs;
540+
541+ /*
542+ * notify_change() can alter its iattr argument, making
543+ * @iap unsuitable for submission multiple times. Make a
544+ * copy for every loop iteration.
545+ */
546+ attrs = *iap;
547+ host_err = __nfsd_setattr(dentry, &attrs);
540548 if (host_err != -EAGAIN || !retries--)
541549 break;
542550 if (!nfsd_wait_for_delegreturn(rqstp, inode))
fs/xfs/libxfs/xfs_ag.c+4−1
@@ -984,7 +984,10 @@ xfs_ag_shrink_space( · 983 unmodified lines
984984 if (err2 != -ENOSPC)
985985 goto resv_err;
986986
987− __xfs_free_extent_later(*tpp, args.fsbno, delta, NULL, true);
987+ err2 = __xfs_free_extent_later(*tpp, args.fsbno, delta, NULL,
988+ true);
989+ if (err2)
990+ goto resv_err;
988991
989992 /*
990993 * Roll the transaction before trying to re-init the per-ag
fs/xfs/libxfs/xfs_alloc.c+65−26
@@ -628,6 +628,25 @@ xfs_alloc_fixup_trees( · 627 unmodified lines
628628 return 0;
629629 }
630630
631+/*
632+ * We do not verify the AGFL contents against AGF-based index counters here,
633+ * even though we may have access to the perag that contains shadow copies. We
634+ * don't know if the AGF based counters have been checked, and if they have they
635+ * still may be inconsistent because they haven't yet been reset on the first
636+ * allocation after the AGF has been read in.
637+ *
638+ * This means we can only check that all agfl entries contain valid or null
639+ * values because we can't reliably determine the active range to exclude
640+ * NULLAGBNO as a valid value.
641+ *
642+ * However, we can't even do that for v4 format filesystems because there are
643+ * old versions of mkfs out there that does not initialise the AGFL to known,
644+ * verifiable values. HEnce we can't tell the difference between a AGFL block
645+ * allocated by mkfs and a corrupted AGFL block here on v4 filesystems.
646+ *
647+ * As a result, we can only fully validate AGFL block numbers when we pull them
648+ * from the freelist in xfs_alloc_get_freelist().
649+ */
631650 static xfs_failaddr_t
632651 xfs_agfl_verify(
633652 struct xfs_buf *bp)
@@ -637,12 +656,6 @@ xfs_agfl_verify( · 3 unmodified lines
637656 __be32 *agfl_bno = xfs_buf_to_agfl_bno(bp);
638657 int i;
639658
640− /*
641− * There is no verification of non-crc AGFLs because mkfs does not
642− * initialise the AGFL to zero or NULL. Hence the only valid part of the
643− * AGFL is what the AGF says is active. We can't get to the AGF, so we
644− * can't verify just those entries are valid.
645− */
646659 if (!xfs_has_crc(mp))
647660 return NULL;
648661
@@ -2321,12 +2334,16 @@ xfs_free_agfl_block( · 1672 unmodified lines
23212334 }
23222335
23232336 /*
2324− * Check the agfl fields of the agf for inconsistency or corruption. The purpose
2325− * is to detect an agfl header padding mismatch between current and early v5
2326− * kernels. This problem manifests as a 1-slot size difference between the
2327− * on-disk flcount and the active [first, last] range of a wrapped agfl. This
2328− * may also catch variants of agfl count corruption unrelated to padding. Either
2329− * way, we'll reset the agfl and warn the user.
2337+ * Check the agfl fields of the agf for inconsistency or corruption.
2338+ *
2339+ * The original purpose was to detect an agfl header padding mismatch between
2340+ * current and early v5 kernels. This problem manifests as a 1-slot size
2341+ * difference between the on-disk flcount and the active [first, last] range of
2342+ * a wrapped agfl.
2343+ *
2344+ * However, we need to use these same checks to catch agfl count corruptions
2345+ * unrelated to padding. This could occur on any v4 or v5 filesystem, so either
2346+ * way, we need to reset the agfl and warn the user.
23302347 *
23312348 * Return true if a reset is required before the agfl can be used, false
23322349 * otherwise.
@@ -2342,10 +2359,6 @@ xfs_agfl_needs_reset( · 9 unmodified lines
23422359 int agfl_size = xfs_agfl_size(mp);
23432360 int active;
23442361
2345− /* no agfl header on v4 supers */
2346− if (!xfs_has_crc(mp))
2347− return false;
2348−
23492362 /*
23502363 * The agf read verifier catches severe corruption of these fields.
23512364 * Repeat some sanity checks to cover a packed -> unpacked mismatch if
@@ -2418,7 +2431,7 @@ xfs_agfl_reset( · 66 unmodified lines
24182431 * the real allocation can proceed. Deferring the free disconnects freeing up
24192432 * the AGFL slot from freeing the block.
24202433 */
2421−STATIC void
2434+static int
24222435 xfs_defer_agfl_block(
24232436 struct xfs_trans *tp,
24242437 xfs_agnumber_t agno,
@@ -2437,17 +2450,21 @@ xfs_defer_agfl_block( · 12 unmodified lines
24372450 xefi->xefi_blockcount = 1;
24382451 xefi->xefi_owner = oinfo->oi_owner;
24392452
2453+ if (XFS_IS_CORRUPT(mp, !xfs_verify_fsbno(mp, xefi->xefi_startblock)))
2454+ return -EFSCORRUPTED;
2455+
24402456 trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1);
24412457
24422458 xfs_extent_free_get_group(mp, xefi);
24432459 xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_AGFL_FREE, &xefi->xefi_list);
2460+ return 0;
24442461 }
24452462
24462463 /*
24472464 * Add the extent to the list of extents to be free at transaction end.
24482465 * The list is maintained sorted (by block number).
24492466 */
2450−void
2467+int
24512468 __xfs_free_extent_later(
24522469 struct xfs_trans *tp,
24532470 xfs_fsblock_t bno,
@@ -2474,6 +2491,9 @@ __xfs_free_extent_later( · 20 unmodified lines
24742491 #endif
24752492 ASSERT(xfs_extfree_item_cache != NULL);
24762493
2494+ if (XFS_IS_CORRUPT(mp, !xfs_verify_fsbext(mp, bno, len)))
2495+ return -EFSCORRUPTED;
2496+
24772497 xefi = kmem_cache_zalloc(xfs_extfree_item_cache,
24782498 GFP_KERNEL | __GFP_NOFAIL);
24792499 xefi->xefi_startblock = bno;
@@ -2497,6 +2517,7 @@ __xfs_free_extent_later( · 17 unmodified lines
24972517
24982518 xfs_extent_free_get_group(mp, xefi);
24992519 xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_FREE, &xefi->xefi_list);
2520+ return 0;
25002521 }
25012522
25022523 #ifdef DEBUG
@@ -2657,7 +2678,9 @@ xfs_alloc_fix_freelist( · 154 unmodified lines
26572678 goto out_agbp_relse;
26582679
26592680 /* defer agfl frees */
2660− xfs_defer_agfl_block(tp, args->agno, bno, &targs.oinfo);
2681+ error = xfs_defer_agfl_block(tp, args->agno, bno, &targs.oinfo);
2682+ if (error)
2683+ goto out_agbp_relse;
26612684 }
26622685
26632686 targs.tp = tp;
@@ -2767,6 +2790,9 @@ xfs_alloc_get_freelist( · 103 unmodified lines
27672790 */
27682791 agfl_bno = xfs_buf_to_agfl_bno(agflbp);
27692792 bno = be32_to_cpu(agfl_bno[be32_to_cpu(agf->agf_flfirst)]);
2793+ if (XFS_IS_CORRUPT(tp->t_mountp, !xfs_verify_agbno(pag, bno)))
2794+ return -EFSCORRUPTED;
2795+
27702796 be32_add_cpu(&agf->agf_flfirst, 1);
27712797 xfs_trans_brelse(tp, agflbp);
27722798 if (be32_to_cpu(agf->agf_flfirst) == xfs_agfl_size(mp))
@@ -2889,6 +2915,19 @@ xfs_alloc_put_freelist( · 116 unmodified lines
28892915 return 0;
28902916 }
28912917
2918+/*
2919+ * Verify the AGF is consistent.
2920+ *
2921+ * We do not verify the AGFL indexes in the AGF are fully consistent here
2922+ * because of issues with variable on-disk structure sizes. Instead, we check
2923+ * the agfl indexes for consistency when we initialise the perag from the AGF
2924+ * information after a read completes.
2925+ *
2926+ * If the index is inconsistent, then we mark the perag as needing an AGFL
2927+ * reset. The first AGFL update performed then resets the AGFL indexes and
2928+ * refills the AGFL with known good free blocks, allowing the filesystem to
2929+ * continue operating normally at the cost of a few leaked free space blocks.
2930+ */
28922931 static xfs_failaddr_t
28932932 xfs_agf_verify(
28942933 struct xfs_buf *bp)
@@ -2962,7 +3001,6 @@ xfs_agf_verify( · 67 unmodified lines
29623001 return __this_address;
29633002
29643003 return NULL;
2965−
29663004 }
29673005
29683006 static void
@@ -3187,7 +3225,8 @@ xfs_alloc_vextent_check_args( · 218 unmodified lines
31873225 */
31883226 static int
31893227 xfs_alloc_vextent_prepare_ag(
3190− struct xfs_alloc_arg *args)
3228+ struct xfs_alloc_arg *args,
3229+ uint32_t flags)
31913230 {
31923231 bool need_pag = !args->pag;
31933232 int error;
@@ -3196,7 +3235,7 @@ xfs_alloc_vextent_prepare_ag( · 2 unmodified lines
31963235 args->pag = xfs_perag_get(args->mp, args->agno);
31973236
31983237 args->agbp = NULL;
3199− error = xfs_alloc_fix_freelist(args, 0);
3238+ error = xfs_alloc_fix_freelist(args, flags);
32003239 if (error) {
32013240 trace_xfs_alloc_vextent_nofix(args);
32023241 if (need_pag)
@@ -3336,7 +3375,7 @@ xfs_alloc_vextent_this_ag( · 133 unmodified lines
33363375 return error;
33373376 }
33383377
3339− error = xfs_alloc_vextent_prepare_ag(args);
3378+ error = xfs_alloc_vextent_prepare_ag(args, 0);
33403379 if (!error && args->agbp)
33413380 error = xfs_alloc_ag_vextent_size(args);
33423381
@@ -3380,7 +3419,7 @@ restart: · 37 unmodified lines
33803419 for_each_perag_wrap_range(mp, start_agno, restart_agno,
33813420 mp->m_sb.sb_agcount, agno, args->pag) {
33823421 args->agno = agno;
3383− error = xfs_alloc_vextent_prepare_ag(args);
3422+ error = xfs_alloc_vextent_prepare_ag(args, flags);
33843423 if (error)
33853424 break;
33863425 if (!args->agbp) {
@@ -3546,7 +3585,7 @@ xfs_alloc_vextent_exact_bno( · 159 unmodified lines
35463585 return error;
35473586 }
35483587
3549− error = xfs_alloc_vextent_prepare_ag(args);
3588+ error = xfs_alloc_vextent_prepare_ag(args, 0);
35503589 if (!error && args->agbp)
35513590 error = xfs_alloc_ag_vextent_exact(args);
35523591
@@ -3587,7 +3626,7 @@ xfs_alloc_vextent_near_bno( · 34 unmodified lines
35873626 if (needs_perag)
35883627 args->pag = xfs_perag_grab(mp, args->agno);
35893628
3590− error = xfs_alloc_vextent_prepare_ag(args);
3629+ error = xfs_alloc_vextent_prepare_ag(args, 0);
35913630 if (!error && args->agbp)
35923631 error = xfs_alloc_ag_vextent_near(args);
35933632
fs/xfs/libxfs/xfs_alloc.h+3−3
@@ -230,7 +230,7 @@ xfs_buf_to_agfl_bno( · 229 unmodified lines
230230 return bp->b_addr;
231231 }
232232
233−void __xfs_free_extent_later(struct xfs_trans *tp, xfs_fsblock_t bno,
233+int __xfs_free_extent_later(struct xfs_trans *tp, xfs_fsblock_t bno,
234234 xfs_filblks_t len, const struct xfs_owner_info *oinfo,
235235 bool skip_discard);
236236
@@ -254,14 +254,14 @@ void xfs_extent_free_get_group(struct xfs_mount *mp, · 17 unmodified lines
254254 #define XFS_EFI_ATTR_FORK (1U << 1) /* freeing attr fork block */
255255 #define XFS_EFI_BMBT_BLOCK (1U << 2) /* freeing bmap btree block */
256256
257−static inline void
257+static inline int
258258 xfs_free_extent_later(
259259 struct xfs_trans *tp,
260260 xfs_fsblock_t bno,
261261 xfs_filblks_t len,
262262 const struct xfs_owner_info *oinfo)
263263 {
264− __xfs_free_extent_later(tp, bno, len, oinfo, false);
264+ return __xfs_free_extent_later(tp, bno, len, oinfo, false);
265265 }
266266
267267
fs/xfs/libxfs/xfs_bmap.c+8−2
@@ -572,8 +572,12 @@ xfs_bmap_btree_to_extents( · 571 unmodified lines
572572 cblock = XFS_BUF_TO_BLOCK(cbp);
573573 if ((error = xfs_btree_check_block(cur, cblock, 0, cbp)))
574574 return error;
575+
575576 xfs_rmap_ino_bmbt_owner(&oinfo, ip->i_ino, whichfork);
576− xfs_free_extent_later(cur->bc_tp, cbno, 1, &oinfo);
577+ error = xfs_free_extent_later(cur->bc_tp, cbno, 1, &oinfo);
578+ if (error)
579+ return error;
580+
577581 ip->i_nblocks--;
578582 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, -1L);
579583 xfs_trans_binval(tp, cbp);
@@ -5230,10 +5234,12 @@ xfs_bmap_del_extent_real( · 4650 unmodified lines
52305234 if (xfs_is_reflink_inode(ip) && whichfork == XFS_DATA_FORK) {
52315235 xfs_refcount_decrease_extent(tp, del);
52325236 } else {
5233− __xfs_free_extent_later(tp, del->br_startblock,
5237+ error = __xfs_free_extent_later(tp, del->br_startblock,
52345238 del->br_blockcount, NULL,
52355239 (bflags & XFS_BMAPI_NODISCARD) ||
52365240 del->br_state == XFS_EXT_UNWRITTEN);
5241+ if (error)
5242+ goto done;
52375243 }
52385244 }
52395245
fs/xfs/libxfs/xfs_bmap_btree.c+5−2
@@ -268,11 +268,14 @@ xfs_bmbt_free_block( · 267 unmodified lines
268268 struct xfs_trans *tp = cur->bc_tp;
269269 xfs_fsblock_t fsbno = XFS_DADDR_TO_FSB(mp, xfs_buf_daddr(bp));
270270 struct xfs_owner_info oinfo;
271+ int error;
271272
272273 xfs_rmap_ino_bmbt_owner(&oinfo, ip->i_ino, cur->bc_ino.whichfork);
273− xfs_free_extent_later(cur->bc_tp, fsbno, 1, &oinfo);
274− ip->i_nblocks--;
274+ error = xfs_free_extent_later(cur->bc_tp, fsbno, 1, &oinfo);
275+ if (error)
276+ return error;
275277
278+ ip->i_nblocks--;
276279 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
277280 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, -1L);
278281 return 0;
fs/xfs/libxfs/xfs_ialloc.c+16−8
@@ -1834,7 +1834,7 @@ retry: · 1833 unmodified lines
18341834 * might be sparse and only free the regions that are allocated as part of the
18351835 * chunk.
18361836 */
1837−STATIC void
1837+static int
18381838 xfs_difree_inode_chunk(
18391839 struct xfs_trans *tp,
18401840 xfs_agnumber_t agno,
@@ -1851,10 +1851,10 @@ xfs_difree_inode_chunk( · 10 unmodified lines
18511851
18521852 if (!xfs_inobt_issparse(rec->ir_holemask)) {
18531853 /* not sparse, calculate extent info directly */
1854− xfs_free_extent_later(tp, XFS_AGB_TO_FSB(mp, agno, sagbno),
1855− M_IGEO(mp)->ialloc_blks,
1856− &XFS_RMAP_OINFO_INODES);
1857− return;
1854+ return xfs_free_extent_later(tp,
1855+ XFS_AGB_TO_FSB(mp, agno, sagbno),
1856+ M_IGEO(mp)->ialloc_blks,
1857+ &XFS_RMAP_OINFO_INODES);
18581858 }
18591859
18601860 /* holemask is only 16-bits (fits in an unsigned long) */
@@ -1871,6 +1871,8 @@ xfs_difree_inode_chunk( · 10 unmodified lines
18711871 XFS_INOBT_HOLEMASK_BITS);
18721872 nextbit = startidx + 1;
18731873 while (startidx < XFS_INOBT_HOLEMASK_BITS) {
1874+ int error;
1875+
18741876 nextbit = find_next_zero_bit(holemask, XFS_INOBT_HOLEMASK_BITS,
18751877 nextbit);
18761878 /*
@@ -1896,8 +1898,11 @@ xfs_difree_inode_chunk( · 19 unmodified lines
18961898
18971899 ASSERT(agbno % mp->m_sb.sb_spino_align == 0);
18981900 ASSERT(contigblk % mp->m_sb.sb_spino_align == 0);
1899− xfs_free_extent_later(tp, XFS_AGB_TO_FSB(mp, agno, agbno),
1900− contigblk, &XFS_RMAP_OINFO_INODES);
1901+ error = xfs_free_extent_later(tp,
1902+ XFS_AGB_TO_FSB(mp, agno, agbno),
1903+ contigblk, &XFS_RMAP_OINFO_INODES);
1904+ if (error)
1905+ return error;
19011906
19021907 /* reset range to current bit and carry on... */
19031908 startidx = endidx = nextbit;
@@ -1905,6 +1910,7 @@ xfs_difree_inode_chunk( · 1 unmodified line
19051910 next:
19061911 nextbit++;
19071912 }
1913+ return 0;
19081914 }
19091915
19101916 STATIC int
@@ -2003,7 +2009,9 @@ xfs_difree_inobt( · 92 unmodified lines
20032009 goto error0;
20042010 }
20052011
2006− xfs_difree_inode_chunk(tp, pag->pag_agno, &rec);
2012+ error = xfs_difree_inode_chunk(tp, pag->pag_agno, &rec);
2013+ if (error)
2014+ goto error0;
20072015 } else {
20082016 xic->deleted = false;
20092017
fs/xfs/libxfs/xfs_log_format.h+8−1
@@ -324,7 +324,6 @@ struct xfs_inode_log_format_32 { · 323 unmodified lines
324324 #define XFS_ILOG_DOWNER 0x200 /* change the data fork owner on replay */
325325 #define XFS_ILOG_AOWNER 0x400 /* change the attr fork owner on replay */
326326
327−
328327 /*
329328 * The timestamps are dirty, but not necessarily anything else in the inode
330329 * core. Unlike the other fields above this one must never make it to disk
@@ -333,6 +332,14 @@ struct xfs_inode_log_format_32 { · 2 unmodified lines
333332 */
334333 #define XFS_ILOG_TIMESTAMP 0x4000
335334
335+/*
336+ * The version field has been changed, but not necessarily anything else of
337+ * interest. This must never make it to disk - it is used purely to ensure that
338+ * the inode item ->precommit operation can update the fsync flag triggers
339+ * in the inode item correctly.
340+ */
341+#define XFS_ILOG_IVERSION 0x8000
342+
336343 #define XFS_ILOG_NONCORE (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
337344 XFS_ILOG_DBROOT | XFS_ILOG_DEV | \
338345 XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
fs/xfs/libxfs/xfs_refcount.c+10−3
@@ -1151,8 +1151,10 @@ xfs_refcount_adjust_extents( · 1150 unmodified lines
11511151 fsbno = XFS_AGB_TO_FSB(cur->bc_mp,
11521152 cur->bc_ag.pag->pag_agno,
11531153 tmp.rc_startblock);
1154− xfs_free_extent_later(cur->bc_tp, fsbno,
1154+ error = xfs_free_extent_later(cur->bc_tp, fsbno,
11551155 tmp.rc_blockcount, NULL);
1156+ if (error)
1157+ goto out_error;
11561158 }
11571159
11581160 (*agbno) += tmp.rc_blockcount;
@@ -1210,8 +1212,10 @@ xfs_refcount_adjust_extents( · 51 unmodified lines
12101212 fsbno = XFS_AGB_TO_FSB(cur->bc_mp,
12111213 cur->bc_ag.pag->pag_agno,
12121214 ext.rc_startblock);
1213− xfs_free_extent_later(cur->bc_tp, fsbno,
1215+ error = xfs_free_extent_later(cur->bc_tp, fsbno,
12141216 ext.rc_blockcount, NULL);
1217+ if (error)
1218+ goto out_error;
12151219 }
12161220
12171221 skip:
@@ -1976,7 +1980,10 @@ xfs_refcount_recover_cow_leftovers( · 758 unmodified lines
19761980 rr->rr_rrec.rc_blockcount);
19771981
19781982 /* Free the block. */
1979− xfs_free_extent_later(tp, fsb, rr->rr_rrec.rc_blockcount, NULL);
1983+ error = xfs_free_extent_later(tp, fsb,
1984+ rr->rr_rrec.rc_blockcount, NULL);
1985+ if (error)
1986+ goto out_trans;
19801987
19811988 error = xfs_trans_commit(tp);
19821989 if (error)
fs/xfs/libxfs/xfs_trans_inode.c+8−105
@@ -40,9 +40,8 @@ xfs_trans_ijoin( · 39 unmodified lines
4040 iip->ili_lock_flags = lock_flags;
4141 ASSERT(!xfs_iflags_test(ip, XFS_ISTALE));
4242
43− /*
44− * Get a log_item_desc to point at the new item.
45− */
43+ /* Reset the per-tx dirty context and add the item to the tx. */
44+ iip->ili_dirty_flags = 0;
4645 xfs_trans_add_item(tp, &iip->ili_item);
4746 }
4847
@@ -76,17 +75,10 @@ xfs_trans_ichgtime( · 27 unmodified lines
7675 /*
7776 * This is called to mark the fields indicated in fieldmask as needing to be
7877 * logged when the transaction is committed. The inode must already be
79− * associated with the given transaction.
80− *
81− * The values for fieldmask are defined in xfs_inode_item.h. We always log all
82− * of the core inode if any of it has changed, and we always log all of the
83− * inline data/extents/b-tree root if any of them has changed.
84− *
85− * Grab and pin the cluster buffer associated with this inode to avoid RMW
86− * cycles at inode writeback time. Avoid the need to add error handling to every
87− * xfs_trans_log_inode() call by shutting down on read error. This will cause
88− * transactions to fail and everything to error out, just like if we return a
89− * read error in a dirty transaction and cancel it.
78+ * associated with the given transaction. All we do here is record where the
79+ * inode was dirtied and mark the transaction and inode log item dirty;
80+ * everything else is done in the ->precommit log item operation after the
81+ * changes in the transaction have been completed.
9082 */
9183 void
9284 xfs_trans_log_inode(
@@ -96,7 +88,6 @@ xfs_trans_log_inode( · 3 unmodified lines
9688 {
9789 struct xfs_inode_log_item *iip = ip->i_itemp;
9890 struct inode *inode = VFS_I(ip);
99− uint iversion_flags = 0;
10091
10192 ASSERT(iip);
10293 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
@@ -104,18 +95,6 @@ xfs_trans_log_inode( · 1 unmodified line
10495
10596 tp->t_flags |= XFS_TRANS_DIRTY;
10697
107− /*
108− * Don't bother with i_lock for the I_DIRTY_TIME check here, as races
109− * don't matter - we either will need an extra transaction in 24 hours
110− * to log the timestamps, or will clear already cleared fields in the
111− * worst case.
112− */
113− if (inode->i_state & I_DIRTY_TIME) {
114− spin_lock(&inode->i_lock);
115− inode->i_state &= ~I_DIRTY_TIME;
116− spin_unlock(&inode->i_lock);
117− }
118−
11998 /*
12099 * First time we log the inode in a transaction, bump the inode change
121100 * counter if it is configured for this to occur. While we have the
@@ -128,86 +107,10 @@ xfs_trans_log_inode( · 6 unmodified lines
128107 if (!test_and_set_bit(XFS_LI_DIRTY, &iip->ili_item.li_flags)) {
129108 if (IS_I_VERSION(inode) &&
130109 inode_maybe_inc_iversion(inode, flags & XFS_ILOG_CORE))
131− iversion_flags = XFS_ILOG_CORE;
132− }
133−
134− /*
135− * If we're updating the inode core or the timestamps and it's possible
136− * to upgrade this inode to bigtime format, do so now.
137− */
138− if ((flags & (XFS_ILOG_CORE | XFS_ILOG_TIMESTAMP)) &&
139− xfs_has_bigtime(ip->i_mount) &&
140− !xfs_inode_has_bigtime(ip)) {
141− ip->i_diflags2 |= XFS_DIFLAG2_BIGTIME;
142− flags |= XFS_ILOG_CORE;
143− }
144−
145− /*
146− * Inode verifiers do not check that the extent size hint is an integer
147− * multiple of the rt extent size on a directory with both rtinherit
148− * and extszinherit flags set. If we're logging a directory that is
149− * misconfigured in this way, clear the hint.
150− */
151− if ((ip->i_diflags & XFS_DIFLAG_RTINHERIT) &&
152− (ip->i_diflags & XFS_DIFLAG_EXTSZINHERIT) &&
153− (ip->i_extsize % ip->i_mount->m_sb.sb_rextsize) > 0) {
154− ip->i_diflags &= ~(XFS_DIFLAG_EXTSIZE |
155− XFS_DIFLAG_EXTSZINHERIT);
156− ip->i_extsize = 0;
157− flags |= XFS_ILOG_CORE;
110+ flags |= XFS_ILOG_IVERSION;
158111 }
159112
160− /*
161− * Record the specific change for fdatasync optimisation. This allows
162− * fdatasync to skip log forces for inodes that are only timestamp
163− * dirty.
164− */
165− spin_lock(&iip->ili_lock);
166− iip->ili_fsync_fields |= flags;
167−
168− if (!iip->ili_item.li_buf) {
169− struct xfs_buf *bp;
170− int error;
171−
172− /*
173− * We hold the ILOCK here, so this inode is not going to be
174− * flushed while we are here. Further, because there is no
175− * buffer attached to the item, we know that there is no IO in
176− * progress, so nothing will clear the ili_fields while we read
177− * in the buffer. Hence we can safely drop the spin lock and
178− * read the buffer knowing that the state will not change from
179− * here.
180− */
181− spin_unlock(&iip->ili_lock);
182− error = xfs_imap_to_bp(ip->i_mount, tp, &ip->i_imap, &bp);
183− if (error) {
184− xfs_force_shutdown(ip->i_mount, SHUTDOWN_META_IO_ERROR);
185− return;
186− }
187−
188− /*
189− * We need an explicit buffer reference for the log item but
190− * don't want the buffer to remain attached to the transaction.
191− * Hold the buffer but release the transaction reference once
192− * we've attached the inode log item to the buffer log item
193− * list.
194− */
195− xfs_buf_hold(bp);
196− spin_lock(&iip->ili_lock);
197− iip->ili_item.li_buf = bp;
198− bp->b_flags |= _XBF_INODES;
199− list_add_tail(&iip->ili_item.li_bio_list, &bp->b_li_list);
200− xfs_trans_brelse(tp, bp);
201− }
202−
203− /*
204− * Always OR in the bits from the ili_last_fields field. This is to
205− * coordinate with the xfs_iflush() and xfs_buf_inode_iodone() routines
206− * in the eventual clearing of the ili_fields bits. See the big comment
207− * in xfs_iflush() for an explanation of this coordination mechanism.
208− */
209− iip->ili_fields |= (flags | iip->ili_last_fields | iversion_flags);
210− spin_unlock(&iip->ili_lock);
113+ iip->ili_dirty_flags |= flags;
211114 }
212115
213116 int
fs/xfs/scrub/bmap.c+13−12
@@ -769,14 +769,14 @@ xchk_are_bmaps_contiguous( · 768 unmodified lines
769769 * mapping or false if there are no more mappings. Caller must ensure that
770770 * @info.icur is zeroed before the first call.
771771 */
772−static int
772+static bool
773773 xchk_bmap_iext_iter(
774774 struct xchk_bmap_info *info,
775775 struct xfs_bmbt_irec *irec)
776776 {
777777 struct xfs_bmbt_irec got;
778778 struct xfs_ifork *ifp;
779− xfs_filblks_t prev_len;
779+ unsigned int nr = 0;
780780
781781 ifp = xfs_ifork_ptr(info->sc->ip, info->whichfork);
782782
@@ -790,12 +790,12 @@ xchk_bmap_iext_iter( · 7 unmodified lines
790790 irec->br_startoff);
791791 return false;
792792 }
793+ nr++;
793794
794795 /*
795796 * Iterate subsequent iextent records and merge them with the one
796797 * that we just read, if possible.
797798 */
798− prev_len = irec->br_blockcount;
799799 while (xfs_iext_peek_next_extent(ifp, &info->icur, &got)) {
800800 if (!xchk_are_bmaps_contiguous(irec, &got))
801801 break;
@@ -805,20 +805,21 @@ xchk_bmap_iext_iter( · 3 unmodified lines
805805 got.br_startoff);
806806 return false;
807807 }
808−
809− /*
810− * Notify the user of mergeable records in the data or attr
811− * forks. CoW forks only exist in memory so we ignore them.
812− */
813− if (info->whichfork != XFS_COW_FORK &&
814− prev_len + got.br_blockcount > BMBT_BLOCKCOUNT_MASK)
815− xchk_ino_set_preen(info->sc, info->sc->ip->i_ino);
808+ nr++;
816809
817810 irec->br_blockcount += got.br_blockcount;
818− prev_len = got.br_blockcount;
819811 xfs_iext_next(ifp, &info->icur);
820812 }
821813
814+ /*
815+ * If the merged mapping could be expressed with fewer bmbt records
816+ * than we actually found, notify the user that this fork could be
817+ * optimized. CoW forks only exist in memory so we ignore them.
818+ */
819+ if (nr > 1 && info->whichfork != XFS_COW_FORK &&
820+ howmany_64(irec->br_blockcount, XFS_MAX_BMBT_EXTLEN) < nr)
821+ xchk_ino_set_preen(info->sc, info->sc->ip->i_ino);
822+
822823 return true;
823824 }
824825
fs/xfs/scrub/scrub.h+4−4
@@ -105,10 +105,10 @@ struct xfs_scrub { · 104 unmodified lines
105105 };
106106
107107 /* XCHK state flags grow up from zero, XREP state flags grown down from 2^31 */
108−#define XCHK_TRY_HARDER (1 << 0) /* can't get resources, try again */
109−#define XCHK_FSGATES_DRAIN (1 << 2) /* defer ops draining enabled */
110−#define XCHK_NEED_DRAIN (1 << 3) /* scrub needs to drain defer ops */
111−#define XREP_ALREADY_FIXED (1 << 31) /* checking our repair work */
108+#define XCHK_TRY_HARDER (1U << 0) /* can't get resources, try again */
109+#define XCHK_FSGATES_DRAIN (1U << 2) /* defer ops draining enabled */
110+#define XCHK_NEED_DRAIN (1U << 3) /* scrub needs to drain defer ops */
111+#define XREP_ALREADY_FIXED (1U << 31) /* checking our repair work */
112112
113113 /*
114114 * The XCHK_FSGATES* flags reflect functionality in the main filesystem that
fs/xfs/xfs_buf_item.c+65−23
@@ -452,10 +452,18 @@ xfs_buf_item_format( · 451 unmodified lines
452452 * This is called to pin the buffer associated with the buf log item in memory
453453 * so it cannot be written out.
454454 *
455− * We also always take a reference to the buffer log item here so that the bli
456− * is held while the item is pinned in memory. This means that we can
457− * unconditionally drop the reference count a transaction holds when the
458− * transaction is completed.
455+ * We take a reference to the buffer log item here so that the BLI life cycle
456+ * extends at least until the buffer is unpinned via xfs_buf_item_unpin() and
457+ * inserted into the AIL.
458+ *
459+ * We also need to take a reference to the buffer itself as the BLI unpin
460+ * processing requires accessing the buffer after the BLI has dropped the final
461+ * BLI reference. See xfs_buf_item_unpin() for an explanation.
462+ * If unpins race to drop the final BLI reference and only the
463+ * BLI owns a reference to the buffer, then the loser of the race can have the
464+ * buffer fgreed from under it (e.g. on shutdown). Taking a buffer reference per
465+ * pin count ensures the life cycle of the buffer extends for as
466+ * long as we hold the buffer pin reference in xfs_buf_item_unpin().
459467 */
460468 STATIC void
461469 xfs_buf_item_pin(
@@ -470,13 +478,30 @@ xfs_buf_item_pin( · 8 unmodified lines
470478
471479 trace_xfs_buf_item_pin(bip);
472480
481+ xfs_buf_hold(bip->bli_buf);
473482 atomic_inc(&bip->bli_refcount);
474483 atomic_inc(&bip->bli_buf->b_pin_count);
475484 }
476485
477486 /*
478− * This is called to unpin the buffer associated with the buf log item which
479− * was previously pinned with a call to xfs_buf_item_pin().
487+ * This is called to unpin the buffer associated with the buf log item which was
488+ * previously pinned with a call to xfs_buf_item_pin(). We enter this function
489+ * with a buffer pin count, a buffer reference and a BLI reference.
490+ *
491+ * We must drop the BLI reference before we unpin the buffer because the AIL
492+ * doesn't acquire a BLI reference whenever it accesses it. Therefore if the
493+ * refcount drops to zero, the bli could still be AIL resident and the buffer
494+ * submitted for I/O at any point before we return. This can result in IO
495+ * completion freeing the buffer while we are still trying to access it here.
496+ * This race condition can also occur in shutdown situations where we abort and
497+ * unpin buffers from contexts other that journal IO completion.
498+ *
499+ * Hence we have to hold a buffer reference per pin count to ensure that the
500+ * buffer cannot be freed until we have finished processing the unpin operation.
501+ * The reference is taken in xfs_buf_item_pin(), and we must hold it until we
502+ * are done processing the buffer state. In the case of an abort (remove =
503+ * true) then we re-use the current pin reference as the IO reference we hand
504+ * off to IO failure handling.
480505 */
481506 STATIC void
482507 xfs_buf_item_unpin(
@@ -493,24 +518,18 @@ xfs_buf_item_unpin( · 10 unmodified lines
493518
494519 trace_xfs_buf_item_unpin(bip);
495520
496− /*
497− * Drop the bli ref associated with the pin and grab the hold required
498− * for the I/O simulation failure in the abort case. We have to do this
499− * before the pin count drops because the AIL doesn't acquire a bli
500− * reference. Therefore if the refcount drops to zero, the bli could
501− * still be AIL resident and the buffer submitted for I/O (and freed on
502− * completion) at any point before we return. This can be removed once
503− * the AIL properly holds a reference on the bli.
504− */
505521 freed = atomic_dec_and_test(&bip->bli_refcount);
506− if (freed && !stale && remove)
507− xfs_buf_hold(bp);
508522 if (atomic_dec_and_test(&bp->b_pin_count))
509523 wake_up_all(&bp->b_waiters);
510524
511− /* nothing to do but drop the pin count if the bli is active */
512− if (!freed)
525+ /*
526+ * Nothing to do but drop the buffer pin reference if the BLI is
527+ * still active.
528+ */
529+ if (!freed) {
530+ xfs_buf_rele(bp);
513531 return;
532+ }
514533
515534 if (stale) {
516535 ASSERT(bip->bli_flags & XFS_BLI_STALE);
@@ -522,6 +541,15 @@ xfs_buf_item_unpin( · 5 unmodified lines
522541
523542 trace_xfs_buf_item_unpin_stale(bip);
524543
544+ /*
545+ * The buffer has been locked and referenced since it was marked
546+ * stale so we own both lock and reference exclusively here. We
547+ * do not need the pin reference any more, so drop it now so
548+ * that we only have one reference to drop once item completion
549+ * processing is complete.
550+ */
551+ xfs_buf_rele(bp);
552+
525553 /*
526554 * If we get called here because of an IO error, we may or may
527555 * not have the item on the AIL. xfs_trans_ail_delete() will
@@ -538,16 +566,30 @@ xfs_buf_item_unpin( · 10 unmodified lines
538566 ASSERT(bp->b_log_item == NULL);
539567 }
540568 xfs_buf_relse(bp);
541− } else if (remove) {
569+ return;
570+ }
571+
572+ if (remove) {
542573 /*
543− * The buffer must be locked and held by the caller to simulate
544− * an async I/O failure. We acquired the hold for this case
545− * before the buffer was unpinned.
574+ * We need to simulate an async IO failures here to ensure that
575+ * the correct error completion is run on this buffer. This
576+ * requires a reference to the buffer and for the buffer to be
577+ * locked. We can safely pass ownership of the pin reference to
578+ * the IO to ensure that nothing can free the buffer while we
579+ * wait for the lock and then run the IO failure completion.
546580 */
547581 xfs_buf_lock(bp);
548582 bp->b_flags |= XBF_ASYNC;
549583 xfs_buf_ioend_fail(bp);
584+ return;
550585 }
586+
587+ /*
588+ * BLI has no more active references - it will be moved to the AIL to
589+ * manage the remaining BLI/buffer life cycle. There is nothing left for
590+ * us to do here so drop the pin reference to the buffer.
591+ */
592+ xfs_buf_rele(bp);
551593 }
552594
553595 STATIC uint
fs/xfs/xfs_filestream.c+0−1
@@ -78,7 +78,6 @@ restart: · 77 unmodified lines
7878 *longest = 0;
7979 err = xfs_bmap_longest_free_extent(pag, NULL, longest);
8080 if (err) {
81− xfs_perag_rele(pag);
8281 if (err != -EAGAIN)
8382 break;
8483 /* Couldn't lock the AGF, skip this AG. */
fs/xfs/xfs_icache.c+37−9
@@ -454,6 +454,27 @@ xfs_inodegc_queue_all( · 453 unmodified lines
454454 return ret;
455455 }
456456
457+/* Wait for all queued work and collect errors */
458+static int
459+xfs_inodegc_wait_all(
460+ struct xfs_mount *mp)
461+{
462+ int cpu;
463+ int error = 0;
464+
465+ flush_workqueue(mp->m_inodegc_wq);
466+ for_each_online_cpu(cpu) {
467+ struct xfs_inodegc *gc;
468+
469+ gc = per_cpu_ptr(mp->m_inodegc, cpu);
470+ if (gc->error && !error)
471+ error = gc->error;
472+ gc->error = 0;
473+ }
474+
475+ return error;
476+}
477+
457478 /*
458479 * Check the validity of the inode we just found it the cache
459480 */
@@ -1491,15 +1512,14 @@ xfs_blockgc_free_space( · 1031 unmodified lines
14911512 if (error)
14921513 return error;
14931514
1494− xfs_inodegc_flush(mp);
1495− return 0;
1515+ return xfs_inodegc_flush(mp);
14961516 }
14971517
14981518 /*
14991519 * Reclaim all the free space that we can by scheduling the background blockgc
15001520 * and inodegc workers immediately and waiting for them all to clear.
15011521 */
1502−void
1522+int
15031523 xfs_blockgc_flush_all(
15041524 struct xfs_mount *mp)
15051525 {
@@ -1520,7 +1540,7 @@ xfs_blockgc_flush_all( · 14 unmodified lines
15201540 for_each_perag_tag(mp, agno, pag, XFS_ICI_BLOCKGC_TAG)
15211541 flush_delayed_work(&pag->pag_blockgc_work);
15221542
1523− xfs_inodegc_flush(mp);
1543+ return xfs_inodegc_flush(mp);
15241544 }
15251545
15261546 /*
@@ -1842,13 +1862,17 @@ xfs_inodegc_set_reclaimable( · 315 unmodified lines
18421862 * This is the last chance to make changes to an otherwise unreferenced file
18431863 * before incore reclamation happens.
18441864 */
1845−static void
1865+static int
18461866 xfs_inodegc_inactivate(
18471867 struct xfs_inode *ip)
18481868 {
1869+ int error;
1870+
18491871 trace_xfs_inode_inactivating(ip);
1850− xfs_inactive(ip);
1872+ error = xfs_inactive(ip);
18511873 xfs_inodegc_set_reclaimable(ip);
1874+ return error;
1875+
18521876 }
18531877
18541878 void
@@ -1880,8 +1904,12 @@ xfs_inodegc_worker( · 25 unmodified lines
18801904
18811905 WRITE_ONCE(gc->shrinker_hits, 0);
18821906 llist_for_each_entry_safe(ip, n, node, i_gclist) {
1907+ int error;
1908+
18831909 xfs_iflags_set(ip, XFS_INACTIVATING);
1884− xfs_inodegc_inactivate(ip);
1910+ error = xfs_inodegc_inactivate(ip);
1911+ if (error && !gc->error)
1912+ gc->error = error;
18851913 }
18861914
18871915 memalloc_nofs_restore(nofs_flag);
@@ -1905,13 +1933,13 @@ xfs_inodegc_push( · 17 unmodified lines
19051933 * Force all currently queued inode inactivation work to run immediately and
19061934 * wait for the work to finish.
19071935 */
1908−void
1936+int
19091937 xfs_inodegc_flush(
19101938 struct xfs_mount *mp)
19111939 {
19121940 xfs_inodegc_push(mp);
19131941 trace_xfs_inodegc_flush(mp, __return_address);
1914− flush_workqueue(mp->m_inodegc_wq);
1942+ return xfs_inodegc_wait_all(mp);
19151943 }
19161944
19171945 /*
fs/xfs/xfs_icache.h+2−2
@@ -62,7 +62,7 @@ int xfs_blockgc_free_dquots(struct xfs_mount *mp, struct xfs_dquot *udqp, · 61 unmodified lines
6262 unsigned int iwalk_flags);
6363 int xfs_blockgc_free_quota(struct xfs_inode *ip, unsigned int iwalk_flags);
6464 int xfs_blockgc_free_space(struct xfs_mount *mp, struct xfs_icwalk *icm);
65−void xfs_blockgc_flush_all(struct xfs_mount *mp);
65+int xfs_blockgc_flush_all(struct xfs_mount *mp);
6666
6767 void xfs_inode_set_eofblocks_tag(struct xfs_inode *ip);
6868 void xfs_inode_clear_eofblocks_tag(struct xfs_inode *ip);
@@ -80,7 +80,7 @@ void xfs_blockgc_start(struct xfs_mount *mp); · 11 unmodified lines
8080
8181 void xfs_inodegc_worker(struct work_struct *work);
8282 void xfs_inodegc_push(struct xfs_mount *mp);
83−void xfs_inodegc_flush(struct xfs_mount *mp);
83+int xfs_inodegc_flush(struct xfs_mount *mp);
8484 void xfs_inodegc_stop(struct xfs_mount *mp);
8585 void xfs_inodegc_start(struct xfs_mount *mp);
8686 void xfs_inodegc_cpu_dead(struct xfs_mount *mp, unsigned int cpu);
fs/xfs/xfs_inode.c+6−14
@@ -1620,16 +1620,7 @@ xfs_inactive_ifree( · 1619 unmodified lines
16201620 */
16211621 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_ICOUNT, -1);
16221622
1623− /*
1624− * Just ignore errors at this point. There is nothing we can do except
1625− * to try to keep going. Make sure it's not a silent error.
1626− */
1627− error = xfs_trans_commit(tp);
1628− if (error)
1629− xfs_notice(mp, "%s: xfs_trans_commit returned error %d",
1630− __func__, error);
1631−
1632− return 0;
1623+ return xfs_trans_commit(tp);
16331624 }
16341625
16351626 /*
@@ -1693,12 +1684,12 @@ xfs_inode_needs_inactive( · 57 unmodified lines
16931684 * now be truncated. Also, we clear all of the read-ahead state
16941685 * kept for the inode here since the file is now closed.
16951686 */
1696−void
1687+int
16971688 xfs_inactive(
16981689 xfs_inode_t *ip)
16991690 {
17001691 struct xfs_mount *mp;
1701− int error;
1692+ int error = 0;
17021693 int truncate = 0;
17031694
17041695 /*
@@ -1736,7 +1727,7 @@ xfs_inactive( · 31 unmodified lines
17361727 * reference to the inode at this point anyways.
17371728 */
17381729 if (xfs_can_free_eofblocks(ip, true))
1739− xfs_free_eofblocks(ip);
1730+ error = xfs_free_eofblocks(ip);
17401731
17411732 goto out;
17421733 }
@@ -1773,7 +1764,7 @@ xfs_inactive( · 30 unmodified lines
17731764 /*
17741765 * Free the inode.
17751766 */
1776− xfs_inactive_ifree(ip);
1767+ error = xfs_inactive_ifree(ip);
17771768
17781769 out:
17791770 /*
@@ -1781,6 +1772,7 @@ out: · 1 unmodified line
17811772 * the attached dquots.
17821773 */
17831774 xfs_qm_dqdetach(ip);
1775+ return error;
17841776 }
17851777
17861778 /*
fs/xfs/xfs_inode.h+1−1
@@ -470,7 +470,7 @@ enum layout_break_reason { · 469 unmodified lines
470470 (xfs_has_grpid((pip)->i_mount) || (VFS_I(pip)->i_mode & S_ISGID))
471471
472472 int xfs_release(struct xfs_inode *ip);
473−void xfs_inactive(struct xfs_inode *ip);
473+int xfs_inactive(struct xfs_inode *ip);
474474 int xfs_lookup(struct xfs_inode *dp, const struct xfs_name *name,
475475 struct xfs_inode **ipp, struct xfs_name *ci_name);
476476 int xfs_create(struct mnt_idmap *idmap,
fs/xfs/xfs_inode_item.c+149−0
@@ -29,6 +29,153 @@ static inline struct xfs_inode_log_item *INODE_ITEM(struct xfs_log_item *lip) · 28 unmodified lines
2929 return container_of(lip, struct xfs_inode_log_item, ili_item);
3030 }
3131
32+static uint64_t
33+xfs_inode_item_sort(
34+ struct xfs_log_item *lip)
35+{
36+ return INODE_ITEM(lip)->ili_inode->i_ino;
37+}
38+
39+/*
40+ * Prior to finally logging the inode, we have to ensure that all the
41+ * per-modification inode state changes are applied. This includes VFS inode
42+ * state updates, format conversions, verifier state synchronisation and
43+ * ensuring the inode buffer remains in memory whilst the inode is dirty.
44+ *
45+ * We have to be careful when we grab the inode cluster buffer due to lock
46+ * ordering constraints. The unlinked inode modifications (xfs_iunlink_item)
47+ * require AGI -> inode cluster buffer lock order. The inode cluster buffer is
48+ * not locked until ->precommit, so it happens after everything else has been
49+ * modified.
50+ *
51+ * Further, we have AGI -> AGF lock ordering, and with O_TMPFILE handling we
52+ * have AGI -> AGF -> iunlink item -> inode cluster buffer lock order. Hence we
53+ * cannot safely lock the inode cluster buffer in xfs_trans_log_inode() because
54+ * it can be called on a inode (e.g. via bumplink/droplink) before we take the
55+ * AGF lock modifying directory blocks.
56+ *
57+ * Rather than force a complete rework of all the transactions to call
58+ * xfs_trans_log_inode() once and once only at the end of every transaction, we
59+ * move the pinning of the inode cluster buffer to a ->precommit operation. This
60+ * matches how the xfs_iunlink_item locks the inode cluster buffer, and it
61+ * ensures that the inode cluster buffer locking is always done last in a
62+ * transaction. i.e. we ensure the lock order is always AGI -> AGF -> inode
63+ * cluster buffer.
64+ *
65+ * If we return the inode number as the precommit sort key then we'll also
66+ * guarantee that the order all inode cluster buffer locking is the same all the
67+ * inodes and unlink items in the transaction.
68+ */
69+static int
70+xfs_inode_item_precommit(
71+ struct xfs_trans *tp,
72+ struct xfs_log_item *lip)
73+{
74+ struct xfs_inode_log_item *iip = INODE_ITEM(lip);
75+ struct xfs_inode *ip = iip->ili_inode;
76+ struct inode *inode = VFS_I(ip);
77+ unsigned int flags = iip->ili_dirty_flags;
78+
79+ /*
80+ * Don't bother with i_lock for the I_DIRTY_TIME check here, as races
81+ * don't matter - we either will need an extra transaction in 24 hours
82+ * to log the timestamps, or will clear already cleared fields in the
83+ * worst case.
84+ */
85+ if (inode->i_state & I_DIRTY_TIME) {
86+ spin_lock(&inode->i_lock);
87+ inode->i_state &= ~I_DIRTY_TIME;
88+ spin_unlock(&inode->i_lock);
89+ }
90+
91+ /*
92+ * If we're updating the inode core or the timestamps and it's possible
93+ * to upgrade this inode to bigtime format, do so now.
94+ */
95+ if ((flags & (XFS_ILOG_CORE | XFS_ILOG_TIMESTAMP)) &&
96+ xfs_has_bigtime(ip->i_mount) &&
97+ !xfs_inode_has_bigtime(ip)) {
98+ ip->i_diflags2 |= XFS_DIFLAG2_BIGTIME;
99+ flags |= XFS_ILOG_CORE;
100+ }
101+
102+ /*
103+ * Inode verifiers do not check that the extent size hint is an integer
104+ * multiple of the rt extent size on a directory with both rtinherit
105+ * and extszinherit flags set. If we're logging a directory that is
106+ * misconfigured in this way, clear the hint.
107+ */
108+ if ((ip->i_diflags & XFS_DIFLAG_RTINHERIT) &&
109+ (ip->i_diflags & XFS_DIFLAG_EXTSZINHERIT) &&
110+ (ip->i_extsize % ip->i_mount->m_sb.sb_rextsize) > 0) {
111+ ip->i_diflags &= ~(XFS_DIFLAG_EXTSIZE |
112+ XFS_DIFLAG_EXTSZINHERIT);
113+ ip->i_extsize = 0;
114+ flags |= XFS_ILOG_CORE;
115+ }
116+
117+ /*
118+ * Record the specific change for fdatasync optimisation. This allows
119+ * fdatasync to skip log forces for inodes that are only timestamp
120+ * dirty. Once we've processed the XFS_ILOG_IVERSION flag, convert it
121+ * to XFS_ILOG_CORE so that the actual on-disk dirty tracking
122+ * (ili_fields) correctly tracks that the version has changed.
123+ */
124+ spin_lock(&iip->ili_lock);
125+ iip->ili_fsync_fields |= (flags & ~XFS_ILOG_IVERSION);
126+ if (flags & XFS_ILOG_IVERSION)
127+ flags = ((flags & ~XFS_ILOG_IVERSION) | XFS_ILOG_CORE);
128+
129+ if (!iip->ili_item.li_buf) {
130+ struct xfs_buf *bp;
131+ int error;
132+
133+ /*
134+ * We hold the ILOCK here, so this inode is not going to be
135+ * flushed while we are here. Further, because there is no
136+ * buffer attached to the item, we know that there is no IO in
137+ * progress, so nothing will clear the ili_fields while we read
138+ * in the buffer. Hence we can safely drop the spin lock and
139+ * read the buffer knowing that the state will not change from
140+ * here.
141+ */
142+ spin_unlock(&iip->ili_lock);
143+ error = xfs_imap_to_bp(ip->i_mount, tp, &ip->i_imap, &bp);
144+ if (error)
145+ return error;
146+
147+ /*
148+ * We need an explicit buffer reference for the log item but
149+ * don't want the buffer to remain attached to the transaction.
150+ * Hold the buffer but release the transaction reference once
151+ * we've attached the inode log item to the buffer log item
152+ * list.
153+ */
154+ xfs_buf_hold(bp);
155+ spin_lock(&iip->ili_lock);
156+ iip->ili_item.li_buf = bp;
157+ bp->b_flags |= _XBF_INODES;
158+ list_add_tail(&iip->ili_item.li_bio_list, &bp->b_li_list);
159+ xfs_trans_brelse(tp, bp);
160+ }
161+
162+ /*
163+ * Always OR in the bits from the ili_last_fields field. This is to
164+ * coordinate with the xfs_iflush() and xfs_buf_inode_iodone() routines
165+ * in the eventual clearing of the ili_fields bits. See the big comment
166+ * in xfs_iflush() for an explanation of this coordination mechanism.
167+ */
168+ iip->ili_fields |= (flags | iip->ili_last_fields);
169+ spin_unlock(&iip->ili_lock);
170+
171+ /*
172+ * We are done with the log item transaction dirty state, so clear it so
173+ * that it doesn't pollute future transactions.
174+ */
175+ iip->ili_dirty_flags = 0;
176+ return 0;
177+}
178+
32179 /*
33180 * The logged size of an inode fork is always the current size of the inode
34181 * fork. This means that when an inode fork is relogged, the size of the logged
@@ -662,6 +809,8 @@ xfs_inode_item_committing( · 627 unmodified lines
662809 }
663810
664811 static const struct xfs_item_ops xfs_inode_item_ops = {
812+ .iop_sort = xfs_inode_item_sort,
813+ .iop_precommit = xfs_inode_item_precommit,
665814 .iop_size = xfs_inode_item_size,
666815 .iop_format = xfs_inode_item_format,
667816 .iop_pin = xfs_inode_item_pin,
fs/xfs/xfs_inode_item.h+1−0
@@ -17,6 +17,7 @@ struct xfs_inode_log_item { · 16 unmodified lines
1717 struct xfs_log_item ili_item; /* common portion */
1818 struct xfs_inode *ili_inode; /* inode ptr */
1919 unsigned short ili_lock_flags; /* inode lock flags */
20+ unsigned int ili_dirty_flags; /* dirty in current tx */
2021 /*
2122 * The ili_lock protects the interactions between the dirty state and
2223 * the flush state of the inode log item. This allows us to do atomic
fs/xfs/xfs_log_recover.c+9−10
@@ -2711,7 +2711,9 @@ xlog_recover_iunlink_bucket( · 2710 unmodified lines
27112711 * just to flush the inodegc queue and wait for it to
27122712 * complete.
27132713 */
2714− xfs_inodegc_flush(mp);
2714+ error = xfs_inodegc_flush(mp);
2715+ if (error)
2716+ break;
27152717 }
27162718
27172719 prev_agino = agino;
@@ -2719,10 +2721,15 @@ xlog_recover_iunlink_bucket( · 1 unmodified line
27192721 }
27202722
27212723 if (prev_ip) {
2724+ int error2;
2725+
27222726 ip->i_prev_unlinked = prev_agino;
27232727 xfs_irele(prev_ip);
2728+
2729+ error2 = xfs_inodegc_flush(mp);
2730+ if (error2 && !error)
2731+ return error2;
27242732 }
2725− xfs_inodegc_flush(mp);
27262733 return error;
27272734 }
27282735
@@ -2789,7 +2796,6 @@ xlog_recover_iunlink_ag( · 60 unmodified lines
27892796 * bucket and remaining inodes on it unreferenced and
27902797 * unfreeable.
27912798 */
2792− xfs_inodegc_flush(pag->pag_mount);
27932799 xlog_recover_clear_agi_bucket(pag, bucket);
27942800 }
27952801 }
@@ -2806,13 +2812,6 @@ xlog_recover_process_iunlinks( · 10 unmodified lines
28062812
28072813 for_each_perag(log->l_mp, agno, pag)
28082814 xlog_recover_iunlink_ag(pag);
2809−
2810− /*
2811− * Flush the pending unlinked inodes to ensure that the inactivations
2812− * are fully completed on disk and the incore inodes can be reclaimed
2813− * before we signal that recovery is complete.
2814− */
2815− xfs_inodegc_flush(log->l_mp);
28162815 }
28172816
28182817 STATIC void
fs/xfs/xfs_mount.h+1−0
@@ -62,6 +62,7 @@ struct xfs_error_cfg { · 61 unmodified lines
6262 struct xfs_inodegc {
6363 struct llist_head list;
6464 struct delayed_work work;
65+ int error;
6566
6667 /* approximate count of inodes in the list */
6768 unsigned int items;
fs/xfs/xfs_reflink.c+3−1
@@ -616,8 +616,10 @@ xfs_reflink_cancel_cow_blocks( · 615 unmodified lines
616616 xfs_refcount_free_cow_extent(*tpp, del.br_startblock,
617617 del.br_blockcount);
618618
619− xfs_free_extent_later(*tpp, del.br_startblock,
619+ error = xfs_free_extent_later(*tpp, del.br_startblock,
620620 del.br_blockcount, NULL);
621+ if (error)
622+ break;
621623
622624 /* Roll the transaction */
623625 error = xfs_defer_finish(tpp);
fs/xfs/xfs_super.c+1−0
@@ -1100,6 +1100,7 @@ xfs_inodegc_init_percpu( · 1099 unmodified lines
11001100 #endif
11011101 init_llist_head(&gc->list);
11021102 gc->items = 0;
1103+ gc->error = 0;
11031104 INIT_DELAYED_WORK(&gc->work, xfs_inodegc_worker);
11041105 }
11051106 return 0;
fs/xfs/xfs_trans.c+8−1
@@ -290,7 +290,9 @@ retry: · 289 unmodified lines
290290 * Do not perform a synchronous scan because callers can hold
291291 * other locks.
292292 */
293− xfs_blockgc_flush_all(mp);
293+ error = xfs_blockgc_flush_all(mp);
294+ if (error)
295+ return error;
294296 want_retry = false;
295297 goto retry;
296298 }
@@ -970,6 +972,11 @@ __xfs_trans_commit( · 673 unmodified lines
970972 error = xfs_defer_finish_noroll(&tp);
971973 if (error)
972974 goto out_unreserve;
975+
976+ /* Run precommits from final tx in defer chain. */
977+ error = xfs_trans_run_precommits(tp);
978+ if (error)
979+ goto out_unreserve;
973980 }
974981
975982 /*
include/linux/cper.h+6−0
@@ -572,4 +572,10 @@ void cper_print_proc_ia(const char *pfx, · 571 unmodified lines
572572 int cper_mem_err_location(struct cper_mem_err_compact *mem, char *msg);
573573 int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg);
574574
575+struct acpi_hest_generic_status;
576+void cper_estatus_print(const char *pfx,
577+ const struct acpi_hest_generic_status *estatus);
578+int cper_estatus_check_header(const struct acpi_hest_generic_status *estatus);
579+int cper_estatus_check(const struct acpi_hest_generic_status *estatus);
580+
575581 #endif
include/linux/efi.h+2−0
@@ -1338,4 +1338,6 @@ bool efi_config_table_is_usable(const efi_guid_t *guid, unsigned long table) · 1337 unmodified lines
13381338 return xen_efi_config_table_is_usable(guid, table);
13391339 }
13401340
1341+umode_t efi_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n);
1342+
13411343 #endif /* _LINUX_EFI_H */
include/linux/iio/iio-gts-helper.h+1−1
@@ -135,7 +135,7 @@ static inline int iio_gts_find_int_time_by_sel(struct iio_gts *gts, int sel) · 134 unmodified lines
135135 /**
136136 * iio_gts_find_sel_by_int_time - find selector matching integration time
137137 * @gts: Gain time scale descriptor
138− * @gain: HW-gain for which matching selector is searched for
138+ * @time: Integration time for which matching selector is searched for
139139 *
140140 * Return: a selector matching given integration time or -EINVAL if
141141 * selector was not found.
include/linux/netdevice.h+6−3
@@ -620,7 +620,7 @@ struct netdev_queue { · 619 unmodified lines
620620 netdevice_tracker dev_tracker;
621621
622622 struct Qdisc __rcu *qdisc;
623− struct Qdisc *qdisc_sleeping;
623+ struct Qdisc __rcu *qdisc_sleeping;
624624 #ifdef CONFIG_SYSFS
625625 struct kobject kobj;
626626 #endif
@@ -768,8 +768,11 @@ static inline void rps_record_sock_flow(struct rps_sock_flow_table *table, · 141 unmodified lines
768768 /* We only give a hint, preemption can change CPU under us */
769769 val |= raw_smp_processor_id();
770770
771− if (table->ents[index] != val)
772− table->ents[index] = val;
771+ /* The following WRITE_ONCE() is paired with the READ_ONCE()
772+ * here, and another one in get_rps_cpu().
773+ */
774+ if (READ_ONCE(table->ents[index]) != val)
775+ WRITE_ONCE(table->ents[index], val);
773776 }
774777 }
775778
include/linux/page-flags.h+6−0
@@ -617,6 +617,12 @@ PAGEFLAG_FALSE(VmemmapSelfHosted, vmemmap_self_hosted) · 616 unmodified lines
617617 * Please note that, confusingly, "page_mapping" refers to the inode
618618 * address_space which maps the page from disk; whereas "page_mapped"
619619 * refers to user virtual address space into which the page is mapped.
620+ *
621+ * For slab pages, since slab reuses the bits in struct page to store its
622+ * internal states, the page->mapping does not exist as such, nor do these
623+ * flags below. So in order to avoid testing non-existent bits, please
624+ * make sure that PageSlab(page) actually evaluates to false before calling
625+ * the following functions (e.g., PageAnon). See mm/slab.h.
620626 */
621627 #define PAGE_MAPPING_ANON 0x1
622628 #define PAGE_MAPPING_MOVABLE 0x2
include/linux/pe.h+13−12
@@ -11,25 +11,26 @@ · 10 unmodified lines
1111 #include <linux/types.h>
1212
1313 /*
14− * Linux EFI stub v1.0 adds the following functionality:
15− * - Loading initrd from the LINUX_EFI_INITRD_MEDIA_GUID device path,
16− * - Loading/starting the kernel from firmware that targets a different
17− * machine type, via the entrypoint exposed in the .compat PE/COFF section.
14+ * Starting from version v3.0, the major version field should be interpreted as
15+ * a bit mask of features supported by the kernel's EFI stub:
16+ * - 0x1: initrd loading from the LINUX_EFI_INITRD_MEDIA_GUID device path,
17+ * - 0x2: initrd loading using the initrd= command line option, where the file
18+ * may be specified using device path notation, and is not required to
19+ * reside on the same volume as the loaded kernel image.
1820 *
1921 * The recommended way of loading and starting v1.0 or later kernels is to use
2022 * the LoadImage() and StartImage() EFI boot services, and expose the initrd
2123 * via the LINUX_EFI_INITRD_MEDIA_GUID device path.
2224 *
23− * Versions older than v1.0 support initrd loading via the image load options
24− * (using initrd=, limited to the volume from which the kernel itself was
25− * loaded), or via arch specific means (bootparams, DT, etc).
25+ * Versions older than v1.0 may support initrd loading via the image load
26+ * options (using initrd=, limited to the volume from which the kernel itself
27+ * was loaded), or only via arch specific means (bootparams, DT, etc).
2628 *
27− * On x86, LoadImage() and StartImage() can be omitted if the EFI handover
28− * protocol is implemented, which can be inferred from the version,
29− * handover_offset and xloadflags fields in the bootparams structure.
29+ * The minor version field must remain 0x0.
30+ * (https://lore.kernel.org/all/efd6f2d4-547c-1378-1faa-53c044dbd297@gmail.com/)
3031 */
31−#define LINUX_EFISTUB_MAJOR_VERSION 0x1
32−#define LINUX_EFISTUB_MINOR_VERSION 0x1
32+#define LINUX_EFISTUB_MAJOR_VERSION 0x3
33+#define LINUX_EFISTUB_MINOR_VERSION 0x0
3334
3435 /*
3536 * LINUX_PE_MAGIC appears at offset 0x38 into the MS-DOS header of EFI bootable
include/linux/sunrpc/svcsock.h+3−4
@@ -61,10 +61,9 @@ int svc_recv(struct svc_rqst *, long); · 60 unmodified lines
6161 void svc_send(struct svc_rqst *rqstp);
6262 void svc_drop(struct svc_rqst *);
6363 void svc_sock_update_bufs(struct svc_serv *serv);
64−bool svc_alien_sock(struct net *net, int fd);
65−int svc_addsock(struct svc_serv *serv, const int fd,
66− char *name_return, const size_t len,
67− const struct cred *cred);
64+int svc_addsock(struct svc_serv *serv, struct net *net,
65+ const int fd, char *name_return, const size_t len,
66+ const struct cred *cred);
6867 void svc_init_xprt_sock(void);
6968 void svc_cleanup_xprt_sock(void);
7069 struct svc_xprt *svc_sock_create(struct svc_serv *serv, int prot);
include/linux/surface_aggregator/device.h+1−5
@@ -243,11 +243,7 @@ static inline bool is_ssam_device(struct device *d) · 242 unmodified lines
243243 * Return: Returns the pointer to the &struct ssam_device_driver wrapping the
244244 * given device driver @d.
245245 */
246−static inline
247−struct ssam_device_driver *to_ssam_device_driver(struct device_driver *d)
248−{
249− return container_of(d, struct ssam_device_driver, driver);
250−}
246+#define to_ssam_device_driver(d) container_of_const(d, struct ssam_device_driver, driver)
251247
252248 const struct ssam_device_id *ssam_device_id_match(const struct ssam_device_id *table,
253249 const struct ssam_device_uid uid);
include/linux/usb/hcd.h+5−0
@@ -501,6 +501,11 @@ void *hcd_buffer_alloc(struct usb_bus *bus, size_t size, · 500 unmodified lines
501501 void hcd_buffer_free(struct usb_bus *bus, size_t size,
502502 void *addr, dma_addr_t dma);
503503
504+void *hcd_buffer_alloc_pages(struct usb_hcd *hcd,
505+ size_t size, gfp_t mem_flags, dma_addr_t *dma);
506+void hcd_buffer_free_pages(struct usb_hcd *hcd,
507+ size_t size, void *addr, dma_addr_t dma);
508+
504509 /* generic bus glue, needed for host controllers that don't use PCI */
505510 extern irqreturn_t usb_hcd_irq(int irq, void *__hcd);
506511
include/media/v4l2-subdev.h+1−0
@@ -1119,6 +1119,7 @@ struct v4l2_subdev { · 1118 unmodified lines
11191119 * @vfh: pointer to &struct v4l2_fh
11201120 * @state: pointer to &struct v4l2_subdev_state
11211121 * @owner: module pointer to the owner of this file handle
1122+ * @client_caps: bitmask of ``V4L2_SUBDEV_CLIENT_CAP_*``
11221123 */
11231124 struct v4l2_subdev_fh {
11241125 struct v4l2_fh vfh;
include/net/bluetooth/hci.h+1−0
@@ -350,6 +350,7 @@ enum { · 349 unmodified lines
350350 enum {
351351 HCI_SETUP,
352352 HCI_CONFIG,
353+ HCI_DEBUGFS_CREATED,
353354 HCI_AUTO_OFF,
354355 HCI_RFKILLED,
355356 HCI_MGMT,
include/net/bluetooth/hci_core.h+3−1
@@ -515,6 +515,7 @@ struct hci_dev { · 514 unmodified lines
515515 struct work_struct cmd_sync_work;
516516 struct list_head cmd_sync_work_list;
517517 struct mutex cmd_sync_work_lock;
518+ struct mutex unregister_lock;
518519 struct work_struct cmd_sync_cancel_work;
519520 struct work_struct reenable_adv_work;
520521
@@ -1201,7 +1202,8 @@ static inline struct hci_conn *hci_conn_hash_lookup_cis(struct hci_dev *hdev, · 680 unmodified lines
12011202 if (id != BT_ISO_QOS_CIS_UNSET && id != c->iso_qos.ucast.cis)
12021203 continue;
12031204
1204− if (ba_type == c->dst_type && !bacmp(&c->dst, ba)) {
1205+ /* Match destination address if set */
1206+ if (!ba || (ba_type == c->dst_type && !bacmp(&c->dst, ba))) {
12051207 rcu_read_unlock();
12061208 return c;
12071209 }
include/net/neighbour.h+1−1
@@ -180,7 +180,7 @@ struct pneigh_entry { · 179 unmodified lines
180180 netdevice_tracker dev_tracker;
181181 u32 flags;
182182 u8 protocol;
183− u8 key[];
183+ u32 key[];
184184 };
185185
186186 /*
include/net/netns/ipv6.h+1−1
@@ -53,7 +53,7 @@ struct netns_sysctl_ipv6 { · 52 unmodified lines
5353 int seg6_flowlabel;
5454 u32 ioam6_id;
5555 u64 ioam6_id_wide;
56− bool skip_notify_on_dev_down;
56+ u8 skip_notify_on_dev_down;
5757 u8 fib_notify_on_flag_change;
5858 u8 icmpv6_error_anycast_as_unicast;
5959 };
include/net/ping.h+1−5
@@ -16,11 +16,7 @@ · 15 unmodified lines
1616 #define PING_HTABLE_SIZE 64
1717 #define PING_HTABLE_MASK (PING_HTABLE_SIZE-1)
1818
19−/*
20− * gid_t is either uint or ushort. We want to pass it to
21− * proc_dointvec_minmax(), so it must not be larger than MAX_INT
22− */
23−#define GID_T_MAX (((gid_t)~0U) >> 1)
19+#define GID_T_MAX (((gid_t)~0U) - 1)
2420
2521 /* Compatibility glue so we can support IPv6 when it's compiled as a module */
2622 struct pingv6_ops {
include/net/pkt_sched.h+2−0
@@ -127,6 +127,8 @@ static inline void qdisc_run(struct Qdisc *q) · 126 unmodified lines
127127 }
128128 }
129129
130+extern const struct nla_policy rtm_tca_policy[TCA_MAX + 1];
131+
130132 /* Calculate maximal size of packet seen by hard_start_xmit
131133 routine of this device.
132134 */
include/net/rpl.h+0−3
@@ -23,9 +23,6 @@ static inline int rpl_init(void) · 22 unmodified lines
2323 static inline void rpl_exit(void) {}
2424 #endif
2525
26−/* Worst decompression memory usage ipv6 address (16) + pad 7 */
27−#define IPV6_RPL_SRH_WORST_SWAP_SIZE (sizeof(struct in6_addr) + 7)
28−
2926 size_t ipv6_rpl_srh_size(unsigned char n, unsigned char cmpri,
3027 unsigned char cmpre);
3128
include/net/sch_generic.h+4−2
@@ -545,7 +545,7 @@ static inline struct Qdisc *qdisc_root_bh(const struct Qdisc *qdisc) · 544 unmodified lines
545545
546546 static inline struct Qdisc *qdisc_root_sleeping(const struct Qdisc *qdisc)
547547 {
548− return qdisc->dev_queue->qdisc_sleeping;
548+ return rcu_dereference_rtnl(qdisc->dev_queue->qdisc_sleeping);
549549 }
550550
551551 static inline spinlock_t *qdisc_root_sleeping_lock(const struct Qdisc *qdisc)
@@ -754,7 +754,9 @@ static inline bool qdisc_tx_changing(const struct net_device *dev) · 202 unmodified lines
754754
755755 for (i = 0; i < dev->num_tx_queues; i++) {
756756 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
757− if (rcu_access_pointer(txq->qdisc) != txq->qdisc_sleeping)
757+
758+ if (rcu_access_pointer(txq->qdisc) !=
759+ rcu_access_pointer(txq->qdisc_sleeping))
758760 return true;
759761 }
760762 return false;
include/net/sock.h+13−5
@@ -1152,8 +1152,12 @@ static inline void sock_rps_record_flow(const struct sock *sk) · 1151 unmodified lines
11521152 * OR an additional socket flag
11531153 * [1] : sk_state and sk_prot are in the same cache line.
11541154 */
1155− if (sk->sk_state == TCP_ESTABLISHED)
1156− sock_rps_record_flow_hash(sk->sk_rxhash);
1155+ if (sk->sk_state == TCP_ESTABLISHED) {
1156+ /* This READ_ONCE() is paired with the WRITE_ONCE()
1157+ * from sock_rps_save_rxhash() and sock_rps_reset_rxhash().
1158+ */
1159+ sock_rps_record_flow_hash(READ_ONCE(sk->sk_rxhash));
1160+ }
11571161 }
11581162 #endif
11591163 }
@@ -1162,15 +1166,19 @@ static inline void sock_rps_save_rxhash(struct sock *sk, · 2 unmodified lines
11621166 const struct sk_buff *skb)
11631167 {
11641168 #ifdef CONFIG_RPS
1165− if (unlikely(sk->sk_rxhash != skb->hash))
1166− sk->sk_rxhash = skb->hash;
1169+ /* The following WRITE_ONCE() is paired with the READ_ONCE()
1170+ * here, and another one in sock_rps_record_flow().
1171+ */
1172+ if (unlikely(READ_ONCE(sk->sk_rxhash) != skb->hash))
1173+ WRITE_ONCE(sk->sk_rxhash, skb->hash);
11671174 #endif
11681175 }
11691176
11701177 static inline void sock_rps_reset_rxhash(struct sock *sk)
11711178 {
11721179 #ifdef CONFIG_RPS
1173− sk->sk_rxhash = 0;
1180+ /* Paired with READ_ONCE() in sock_rps_record_flow() */
1181+ WRITE_ONCE(sk->sk_rxhash, 0);
11741182 #endif
11751183 }
11761184
include/target/iscsi/iscsi_target_core.h+4−3
@@ -562,12 +562,13 @@ struct iscsit_conn { · 561 unmodified lines
562562 #define LOGIN_FLAGS_READ_ACTIVE 2
563563 #define LOGIN_FLAGS_WRITE_ACTIVE 3
564564 #define LOGIN_FLAGS_CLOSED 4
565+#define LOGIN_FLAGS_WORKER_RUNNING 5
565566 unsigned long login_flags;
566567 struct delayed_work login_work;
567568 struct iscsi_login *login;
568569 struct timer_list nopin_timer;
569570 struct timer_list nopin_response_timer;
570− struct timer_list transport_timer;
571+ struct timer_list login_timer;
571572 struct task_struct *login_kworker;
572573 /* Spinlock used for add/deleting cmd's from conn_cmd_list */
573574 spinlock_t cmd_lock;
@@ -576,6 +577,8 @@ struct iscsit_conn { · 2 unmodified lines
576577 spinlock_t nopin_timer_lock;
577578 spinlock_t response_queue_lock;
578579 spinlock_t state_lock;
580+ spinlock_t login_timer_lock;
581+ spinlock_t login_worker_lock;
579582 /* libcrypto RX and TX contexts for crc32c */
580583 struct ahash_request *conn_rx_hash;
581584 struct ahash_request *conn_tx_hash;
@@ -792,7 +795,6 @@ struct iscsi_np { · 210 unmodified lines
792795 enum np_thread_state_table np_thread_state;
793796 bool enabled;
794797 atomic_t np_reset_count;
795− enum iscsi_timer_flags_table np_login_timer_flags;
796798 u32 np_exports;
797799 enum np_flags_table np_flags;
798800 spinlock_t np_thread_lock;
@@ -800,7 +802,6 @@ struct iscsi_np { · 1 unmodified line
800802 struct socket *np_socket;
801803 struct sockaddr_storage np_sockaddr;
802804 struct task_struct *np_thread;
803− struct timer_list np_login_timer;
804805 void *np_context;
805806 struct iscsit_transport *np_transport;
806807 struct list_head np_list;
include/uapi/linux/bpf.h+1−0
@@ -1035,6 +1035,7 @@ enum bpf_attach_type { · 1034 unmodified lines
10351035 BPF_TRACE_KPROBE_MULTI,
10361036 BPF_LSM_CGROUP,
10371037 BPF_STRUCT_OPS,
1038+ BPF_NETFILTER,
10381039 __MAX_BPF_ATTACH_TYPE
10391040 };
10401041
io_uring/epoll.c+0−4
@@ -25,10 +25,6 @@ int io_epoll_ctl_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 24 unmodified lines
2525 {
2626 struct io_epoll *epoll = io_kiocb_to_cmd(req, struct io_epoll);
2727
28− pr_warn_once("%s: epoll_ctl support in io_uring is deprecated and will "
29− "be removed in a future Linux kernel version.\n",
30− current->comm);
31−
3228 if (sqe->buf_index || sqe->splice_fd_in)
3329 return -EINVAL;
3430
kernel/bpf/map_in_map.c+6−2
@@ -69,9 +69,13 @@ struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd) · 68 unmodified lines
6969 /* Misc members not needed in bpf_map_meta_equal() check. */
7070 inner_map_meta->ops = inner_map->ops;
7171 if (inner_map->ops == &array_map_ops) {
72+ struct bpf_array *inner_array_meta =
73+ container_of(inner_map_meta, struct bpf_array, map);
74+ struct bpf_array *inner_array = container_of(inner_map, struct bpf_array, map);
75+
76+ inner_array_meta->index_mask = inner_array->index_mask;
77+ inner_array_meta->elem_size = inner_array->elem_size;
7278 inner_map_meta->bypass_spec_v1 = inner_map->bypass_spec_v1;
73− container_of(inner_map_meta, struct bpf_array, map)->index_mask =
74− container_of(inner_map, struct bpf_array, map)->index_mask;
7579 }
7680
7781 fdput(f);
kernel/bpf/syscall.c+9−0
@@ -2434,6 +2434,10 @@ bpf_prog_load_check_attach(enum bpf_prog_type prog_type, · 2433 unmodified lines
24342434 default:
24352435 return -EINVAL;
24362436 }
2437+ case BPF_PROG_TYPE_NETFILTER:
2438+ if (expected_attach_type == BPF_NETFILTER)
2439+ return 0;
2440+ return -EINVAL;
24372441 case BPF_PROG_TYPE_SYSCALL:
24382442 case BPF_PROG_TYPE_EXT:
24392443 if (expected_attach_type)
@@ -4613,7 +4617,12 @@ static int link_create(union bpf_attr *attr, bpfptr_t uattr) · 2173 unmodified lines
46134617
46144618 switch (prog->type) {
46154619 case BPF_PROG_TYPE_EXT:
4620+ break;
46164621 case BPF_PROG_TYPE_NETFILTER:
4622+ if (attr->link_create.attach_type != BPF_NETFILTER) {
4623+ ret = -EINVAL;
4624+ goto out;
4625+ }
46174626 break;
46184627 case BPF_PROG_TYPE_PERF_EVENT:
46194628 case BPF_PROG_TYPE_TRACEPOINT:
kernel/fork.c+1−1
@@ -627,6 +627,7 @@ void free_task(struct task_struct *tsk) · 626 unmodified lines
627627 arch_release_task_struct(tsk);
628628 if (tsk->flags & PF_KTHREAD)
629629 free_kthread_struct(tsk);
630+ bpf_task_storage_free(tsk);
630631 free_task_struct(tsk);
631632 }
632633 EXPORT_SYMBOL(free_task);
@@ -979,7 +980,6 @@ void __put_task_struct(struct task_struct *tsk) · 346 unmodified lines
979980 cgroup_free(tsk);
980981 task_numa_free(tsk, true);
981982 security_task_free(tsk);
982− bpf_task_storage_free(tsk);
983983 exit_creds(tsk);
984984 delayacct_tsk_free(tsk);
985985 put_signal_struct(tsk->signal);
kernel/module/decompress.c+1−1
@@ -257,7 +257,7 @@ static ssize_t module_zstd_decompress(struct load_info *info, · 256 unmodified lines
257257 do {
258258 struct page *page = module_get_next_page(info);
259259
260− if (!IS_ERR(page)) {
260+ if (IS_ERR(page)) {
261261 retval = PTR_ERR(page);
262262 goto out;
263263 }
kernel/trace/bpf_trace.c+11−1
@@ -900,13 +900,23 @@ static const struct bpf_func_proto bpf_send_signal_thread_proto = { · 899 unmodified lines
900900
901901 BPF_CALL_3(bpf_d_path, struct path *, path, char *, buf, u32, sz)
902902 {
903+ struct path copy;
903904 long len;
904905 char *p;
905906
906907 if (!sz)
907908 return 0;
908909
909− p = d_path(path, buf, sz);
910+ /*
911+ * The path pointer is verified as trusted and safe to use,
912+ * but let's double check it's valid anyway to workaround
913+ * potentially broken verifier.
914+ */
915+ len = copy_from_kernel_nofault(&copy, path, sizeof(*path));
916+ if (len < 0)
917+ return len;
918+
919+ p = d_path(&copy, buf, sz);
910920 if (IS_ERR(p)) {
911921 len = PTR_ERR(p);
912922 } else {
kernel/trace/trace_probe.h+1−1
@@ -308,7 +308,7 @@ trace_probe_primary_from_call(struct trace_event_call *call) · 307 unmodified lines
308308 {
309309 struct trace_probe_event *tpe = trace_probe_event_from_call(call);
310310
311− return list_first_entry(&tpe->probes, struct trace_probe, list);
311+ return list_first_entry_or_null(&tpe->probes, struct trace_probe, list);
312312 }
313313
314314 static inline struct list_head *trace_probe_probe_list(struct trace_probe *tp)
lib/cpu_rmap.c+1−1
@@ -280,8 +280,8 @@ static void irq_cpu_rmap_release(struct kref *ref) · 279 unmodified lines
280280 struct irq_glue *glue =
281281 container_of(ref, struct irq_glue, notify.kref);
282282
283− cpu_rmap_put(glue->rmap);
284283 glue->rmap->obj[glue->index] = NULL;
284+ cpu_rmap_put(glue->rmap);
285285 kfree(glue);
286286 }
287287
lib/test_firmware.c+63−18
@@ -45,6 +45,7 @@ struct test_batched_req { · 44 unmodified lines
4545 bool sent;
4646 const struct firmware *fw;
4747 const char *name;
48+ const char *fw_buf;
4849 struct completion completion;
4950 struct task_struct *task;
5051 struct device *dev;
@@ -175,8 +176,14 @@ static void __test_release_all_firmware(void) · 124 unmodified lines
175176
176177 for (i = 0; i < test_fw_config->num_requests; i++) {
177178 req = &test_fw_config->reqs[i];
178− if (req->fw)
179+ if (req->fw) {
180+ if (req->fw_buf) {
181+ kfree_const(req->fw_buf);
182+ req->fw_buf = NULL;
183+ }
179184 release_firmware(req->fw);
185+ req->fw = NULL;
186+ }
180187 }
181188
182189 vfree(test_fw_config->reqs);
@@ -353,16 +360,26 @@ static ssize_t config_test_show_str(char *dst, · 170 unmodified lines
353360 return len;
354361 }
355362
356−static int test_dev_config_update_bool(const char *buf, size_t size,
363+static inline int __test_dev_config_update_bool(const char *buf, size_t size,
357364 bool *cfg)
358365 {
359366 int ret;
360367
361− mutex_lock(&test_fw_mutex);
362368 if (kstrtobool(buf, cfg) < 0)
363369 ret = -EINVAL;
364370 else
365371 ret = size;
372+
373+ return ret;
374+}
375+
376+static int test_dev_config_update_bool(const char *buf, size_t size,
377+ bool *cfg)
378+{
379+ int ret;
380+
381+ mutex_lock(&test_fw_mutex);
382+ ret = __test_dev_config_update_bool(buf, size, cfg);
366383 mutex_unlock(&test_fw_mutex);
367384
368385 return ret;
@@ -373,7 +390,8 @@ static ssize_t test_dev_config_show_bool(char *buf, bool val) · 4 unmodified lines
373390 return snprintf(buf, PAGE_SIZE, "%d\n", val);
374391 }
375392
376−static int test_dev_config_update_size_t(const char *buf,
393+static int __test_dev_config_update_size_t(
394+ const char *buf,
377395 size_t size,
378396 size_t *cfg)
379397 {
@@ -384,9 +402,7 @@ static int test_dev_config_update_size_t(const char *buf, · 4 unmodified lines
384402 if (ret)
385403 return ret;
386404
387− mutex_lock(&test_fw_mutex);
388405 *(size_t *)cfg = new;
389− mutex_unlock(&test_fw_mutex);
390406
391407 /* Always return full write size even if we didn't consume all */
392408 return size;
@@ -402,7 +418,7 @@ static ssize_t test_dev_config_show_int(char *buf, int val) · 9 unmodified lines
402418 return snprintf(buf, PAGE_SIZE, "%d\n", val);
403419 }
404420
405−static int test_dev_config_update_u8(const char *buf, size_t size, u8 *cfg)
421+static int __test_dev_config_update_u8(const char *buf, size_t size, u8 *cfg)
406422 {
407423 u8 val;
408424 int ret;
@@ -411,14 +427,23 @@ static int test_dev_config_update_u8(const char *buf, size_t size, u8 *cfg) · 2 unmodified lines
411427 if (ret)
412428 return ret;
413429
414− mutex_lock(&test_fw_mutex);
415430 *(u8 *)cfg = val;
416− mutex_unlock(&test_fw_mutex);
417431
418432 /* Always return full write size even if we didn't consume all */
419433 return size;
420434 }
421435
436+static int test_dev_config_update_u8(const char *buf, size_t size, u8 *cfg)
437+{
438+ int ret;
439+
440+ mutex_lock(&test_fw_mutex);
441+ ret = __test_dev_config_update_u8(buf, size, cfg);
442+ mutex_unlock(&test_fw_mutex);
443+
444+ return ret;
445+}
446+
422447 static ssize_t test_dev_config_show_u8(char *buf, u8 val)
423448 {
424449 return snprintf(buf, PAGE_SIZE, "%u\n", val);
@@ -471,10 +496,10 @@ static ssize_t config_num_requests_store(struct device *dev, · 46 unmodified lines
471496 mutex_unlock(&test_fw_mutex);
472497 goto out;
473498 }
474− mutex_unlock(&test_fw_mutex);
475499
476− rc = test_dev_config_update_u8(buf, count,
477− &test_fw_config->num_requests);
500+ rc = __test_dev_config_update_u8(buf, count,
501+ &test_fw_config->num_requests);
502+ mutex_unlock(&test_fw_mutex);
478503
479504 out:
480505 return rc;
@@ -518,10 +543,10 @@ static ssize_t config_buf_size_store(struct device *dev, · 37 unmodified lines
518543 mutex_unlock(&test_fw_mutex);
519544 goto out;
520545 }
521− mutex_unlock(&test_fw_mutex);
522546
523− rc = test_dev_config_update_size_t(buf, count,
524− &test_fw_config->buf_size);
547+ rc = __test_dev_config_update_size_t(buf, count,
548+ &test_fw_config->buf_size);
549+ mutex_unlock(&test_fw_mutex);
525550
526551 out:
527552 return rc;
@@ -548,10 +573,10 @@ static ssize_t config_file_offset_store(struct device *dev, · 20 unmodified lines
548573 mutex_unlock(&test_fw_mutex);
549574 goto out;
550575 }
551− mutex_unlock(&test_fw_mutex);
552576
553− rc = test_dev_config_update_size_t(buf, count,
554− &test_fw_config->file_offset);
577+ rc = __test_dev_config_update_size_t(buf, count,
578+ &test_fw_config->file_offset);
579+ mutex_unlock(&test_fw_mutex);
555580
556581 out:
557582 return rc;
@@ -652,6 +677,8 @@ static ssize_t trigger_request_store(struct device *dev, · 94 unmodified lines
652677
653678 mutex_lock(&test_fw_mutex);
654679 release_firmware(test_firmware);
680+ if (test_fw_config->reqs)
681+ __test_release_all_firmware();
655682 test_firmware = NULL;
656683 rc = request_firmware(&test_firmware, name, dev);
657684 if (rc) {
@@ -752,6 +779,8 @@ static ssize_t trigger_async_request_store(struct device *dev, · 94 unmodified lines
752779 mutex_lock(&test_fw_mutex);
753780 release_firmware(test_firmware);
754781 test_firmware = NULL;
782+ if (test_fw_config->reqs)
783+ __test_release_all_firmware();
755784 rc = request_firmware_nowait(THIS_MODULE, 1, name, dev, GFP_KERNEL,
756785 NULL, trigger_async_request_cb);
757786 if (rc) {
@@ -794,6 +823,8 @@ static ssize_t trigger_custom_fallback_store(struct device *dev, · 36 unmodified lines
794823
795824 mutex_lock(&test_fw_mutex);
796825 release_firmware(test_firmware);
826+ if (test_fw_config->reqs)
827+ __test_release_all_firmware();
797828 test_firmware = NULL;
798829 rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOUEVENT, name,
799830 dev, GFP_KERNEL, NULL,
@@ -856,6 +887,8 @@ static int test_fw_run_batch_request(void *data) · 56 unmodified lines
856887 test_fw_config->buf_size);
857888 if (!req->fw)
858889 kfree(test_buf);
890+ else
891+ req->fw_buf = test_buf;
859892 } else {
860893 req->rc = test_fw_config->req_firmware(&req->fw,
861894 req->name,
@@ -895,6 +928,11 @@ static ssize_t trigger_batched_requests_store(struct device *dev, · 33 unmodified lines
895928
896929 mutex_lock(&test_fw_mutex);
897930
931+ if (test_fw_config->reqs) {
932+ rc = -EBUSY;
933+ goto out_bail;
934+ }
935+
898936 test_fw_config->reqs =
899937 vzalloc(array3_size(sizeof(struct test_batched_req),
900938 test_fw_config->num_requests, 2));
@@ -911,6 +949,7 @@ static ssize_t trigger_batched_requests_store(struct device *dev, · 10 unmodified lines
911949 req->fw = NULL;
912950 req->idx = i;
913951 req->name = test_fw_config->name;
952+ req->fw_buf = NULL;
914953 req->dev = dev;
915954 init_completion(&req->completion);
916955 req->task = kthread_run(test_fw_run_batch_request, req,
@@ -993,6 +1032,11 @@ ssize_t trigger_batched_requests_async_store(struct device *dev, · 76 unmodified lines
9931032
9941033 mutex_lock(&test_fw_mutex);
9951034
1035+ if (test_fw_config->reqs) {
1036+ rc = -EBUSY;
1037+ goto out_bail;
1038+ }
1039+
9961040 test_fw_config->reqs =
9971041 vzalloc(array3_size(sizeof(struct test_batched_req),
9981042 test_fw_config->num_requests, 2));
@@ -1010,6 +1054,7 @@ ssize_t trigger_batched_requests_async_store(struct device *dev, · 11 unmodified lines
10101054 for (i = 0; i < test_fw_config->num_requests; i++) {
10111055 req = &test_fw_config->reqs[i];
10121056 req->name = test_fw_config->name;
1057+ req->fw_buf = NULL;
10131058 req->fw = NULL;
10141059 req->idx = i;
10151060 init_completion(&req->completion);
mm/Kconfig.debug+1−0
@@ -98,6 +98,7 @@ config PAGE_OWNER · 97 unmodified lines
9898 config PAGE_TABLE_CHECK
9999 bool "Check for invalid mappings in user page tables"
100100 depends on ARCH_SUPPORTS_PAGE_TABLE_CHECK
101+ depends on EXCLUSIVE_SYSTEM_RAM
101102 select PAGE_EXTENSION
102103 help
103104 Check that anonymous page is not being mapped twice with read write
mm/page_table_check.c+6−0
@@ -71,6 +71,8 @@ static void page_table_check_clear(struct mm_struct *mm, unsigned long addr, · 70 unmodified lines
7171
7272 page = pfn_to_page(pfn);
7373 page_ext = page_ext_get(page);
74+
75+ BUG_ON(PageSlab(page));
7476 anon = PageAnon(page);
7577
7678 for (i = 0; i < pgcnt; i++) {
@@ -107,6 +109,8 @@ static void page_table_check_set(struct mm_struct *mm, unsigned long addr, · 30 unmodified lines
107109
108110 page = pfn_to_page(pfn);
109111 page_ext = page_ext_get(page);
112+
113+ BUG_ON(PageSlab(page));
110114 anon = PageAnon(page);
111115
112116 for (i = 0; i < pgcnt; i++) {
@@ -133,6 +137,8 @@ void __page_table_check_zero(struct page *page, unsigned int order) · 20 unmodified lines
133137 struct page_ext *page_ext;
134138 unsigned long i;
135139
140+ BUG_ON(PageSlab(page));
141+
136142 page_ext = page_ext_get(page);
137143 BUG_ON(!page_ext);
138144 for (i = 0; i < (1ul << order); i++) {
net/batman-adv/distributed-arp-table.c+1−1
@@ -101,7 +101,6 @@ static void batadv_dat_purge(struct work_struct *work); · 100 unmodified lines
101101 */
102102 static void batadv_dat_start_timer(struct batadv_priv *bat_priv)
103103 {
104− INIT_DELAYED_WORK(&bat_priv->dat.work, batadv_dat_purge);
105104 queue_delayed_work(batadv_event_workqueue, &bat_priv->dat.work,
106105 msecs_to_jiffies(10000));
107106 }
@@ -819,6 +818,7 @@ int batadv_dat_init(struct batadv_priv *bat_priv) · 711 unmodified lines
819818 if (!bat_priv->dat.hash)
820819 return -ENOMEM;
821820
821+ INIT_DELAYED_WORK(&bat_priv->dat.work, batadv_dat_purge);
822822 batadv_dat_start_timer(bat_priv);
823823
824824 batadv_tvlv_handler_register(bat_priv, batadv_dat_tvlv_ogm_handler_v1,
net/bluetooth/hci_conn.c+13−9
@@ -947,8 +947,8 @@ static void find_cis(struct hci_conn *conn, void *data) · 946 unmodified lines
947947 {
948948 struct iso_list_data *d = data;
949949
950− /* Ignore broadcast */
951− if (!bacmp(&conn->dst, BDADDR_ANY))
950+ /* Ignore broadcast or if CIG don't match */
951+ if (!bacmp(&conn->dst, BDADDR_ANY) || d->cig != conn->iso_qos.ucast.cig)
952952 return;
953953
954954 d->count++;
@@ -963,12 +963,17 @@ static void cis_cleanup(struct hci_conn *conn) · 8 unmodified lines
963963 struct hci_dev *hdev = conn->hdev;
964964 struct iso_list_data d;
965965
966+ if (conn->iso_qos.ucast.cig == BT_ISO_QOS_CIG_UNSET)
967+ return;
968+
966969 memset(&d, 0, sizeof(d));
967970 d.cig = conn->iso_qos.ucast.cig;
968971
969972 /* Check if ISO connection is a CIS and remove CIG if there are
970973 * no other connections using it.
971974 */
975+ hci_conn_hash_list_state(hdev, find_cis, ISO_LINK, BT_BOUND, &d);
976+ hci_conn_hash_list_state(hdev, find_cis, ISO_LINK, BT_CONNECT, &d);
972977 hci_conn_hash_list_state(hdev, find_cis, ISO_LINK, BT_CONNECTED, &d);
973978 if (d.count)
974979 return;
@@ -1766,24 +1771,23 @@ static bool hci_le_set_cig_params(struct hci_conn *conn, struct bt_iso_qos *qos) · 791 unmodified lines
17661771
17671772 memset(&data, 0, sizeof(data));
17681773
1769− /* Allocate a CIG if not set */
1774+ /* Allocate first still reconfigurable CIG if not set */
17701775 if (qos->ucast.cig == BT_ISO_QOS_CIG_UNSET) {
1771− for (data.cig = 0x00; data.cig < 0xff; data.cig++) {
1776+ for (data.cig = 0x00; data.cig < 0xf0; data.cig++) {
17721777 data.count = 0;
1773− data.cis = 0xff;
17741778
1775− hci_conn_hash_list_state(hdev, cis_list, ISO_LINK,
1776− BT_BOUND, &data);
1779+ hci_conn_hash_list_state(hdev, find_cis, ISO_LINK,
1780+ BT_CONNECT, &data);
17771781 if (data.count)
17781782 continue;
17791783
1780− hci_conn_hash_list_state(hdev, cis_list, ISO_LINK,
1784+ hci_conn_hash_list_state(hdev, find_cis, ISO_LINK,
17811785 BT_CONNECTED, &data);
17821786 if (!data.count)
17831787 break;
17841788 }
17851789
1786− if (data.cig == 0xff)
1790+ if (data.cig == 0xf0)
17871791 return false;
17881792
17891793 /* Update CIG */
net/bluetooth/hci_core.c+6−4
@@ -1416,10 +1416,10 @@ int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr) · 1415 unmodified lines
14161416
14171417 int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type)
14181418 {
1419− struct smp_ltk *k;
1419+ struct smp_ltk *k, *tmp;
14201420 int removed = 0;
14211421
1422− list_for_each_entry_rcu(k, &hdev->long_term_keys, list) {
1422+ list_for_each_entry_safe(k, tmp, &hdev->long_term_keys, list) {
14231423 if (bacmp(bdaddr, &k->bdaddr) || k->bdaddr_type != bdaddr_type)
14241424 continue;
14251425
@@ -1435,9 +1435,9 @@ int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type) · 9 unmodified lines
14351435
14361436 void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type)
14371437 {
1438− struct smp_irk *k;
1438+ struct smp_irk *k, *tmp;
14391439
1440− list_for_each_entry_rcu(k, &hdev->identity_resolving_keys, list) {
1440+ list_for_each_entry_safe(k, tmp, &hdev->identity_resolving_keys, list) {
14411441 if (bacmp(bdaddr, &k->bdaddr) || k->addr_type != addr_type)
14421442 continue;
14431443
@@ -2686,7 +2686,9 @@ void hci_unregister_dev(struct hci_dev *hdev) · 1242 unmodified lines
26862686 {
26872687 BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
26882688
2689+ mutex_lock(&hdev->unregister_lock);
26892690 hci_dev_set_flag(hdev, HCI_UNREGISTER);
2691+ mutex_unlock(&hdev->unregister_lock);
26902692
26912693 write_lock(&hci_dev_list_lock);
26922694 list_del(&hdev->list);
net/bluetooth/hci_event.c+26−18
@@ -3804,48 +3804,56 @@ static u8 hci_cc_le_set_cig_params(struct hci_dev *hdev, void *data, · 3803 unmodified lines
38043804 struct sk_buff *skb)
38053805 {
38063806 struct hci_rp_le_set_cig_params *rp = data;
3807+ struct hci_cp_le_set_cig_params *cp;
38073808 struct hci_conn *conn;
3808− int i = 0;
3809+ u8 status = rp->status;
3810+ int i;
38093811
38103812 bt_dev_dbg(hdev, "status 0x%2.2x", rp->status);
38113813
3814+ cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_CIG_PARAMS);
3815+ if (!cp || rp->num_handles != cp->num_cis || rp->cig_id != cp->cig_id) {
3816+ bt_dev_err(hdev, "unexpected Set CIG Parameters response data");
3817+ status = HCI_ERROR_UNSPECIFIED;
3818+ }
3819+
38123820 hci_dev_lock(hdev);
38133821
3814− if (rp->status) {
3822+ if (status) {
38153823 while ((conn = hci_conn_hash_lookup_cig(hdev, rp->cig_id))) {
38163824 conn->state = BT_CLOSED;
3817− hci_connect_cfm(conn, rp->status);
3825+ hci_connect_cfm(conn, status);
38183826 hci_conn_del(conn);
38193827 }
38203828 goto unlock;
38213829 }
38223830
3823− rcu_read_lock();
3831+ /* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E page 2553
3832+ *
3833+ * If the Status return parameter is zero, then the Controller shall
3834+ * set the Connection_Handle arrayed return parameter to the connection
3835+ * handle(s) corresponding to the CIS configurations specified in
3836+ * the CIS_IDs command parameter, in the same order.
3837+ */
3838+ for (i = 0; i < rp->num_handles; ++i) {
3839+ conn = hci_conn_hash_lookup_cis(hdev, NULL, 0, rp->cig_id,
3840+ cp->cis[i].cis_id);
3841+ if (!conn || !bacmp(&conn->dst, BDADDR_ANY))
3842+ continue;
38243843
3825− list_for_each_entry_rcu(conn, &hdev->conn_hash.list, list) {
3826− if (conn->type != ISO_LINK ||
3827− conn->iso_qos.ucast.cig != rp->cig_id ||
3828− conn->state == BT_CONNECTED)
3844+ if (conn->state != BT_BOUND && conn->state != BT_CONNECT)
38293845 continue;
38303846
3831− conn->handle = __le16_to_cpu(rp->handle[i++]);
3847+ conn->handle = __le16_to_cpu(rp->handle[i]);
38323848
38333849 bt_dev_dbg(hdev, "%p handle 0x%4.4x parent %p", conn,
38343850 conn->handle, conn->parent);
38353851
38363852 /* Create CIS if LE is already connected */
3837− if (conn->parent && conn->parent->state == BT_CONNECTED) {
3838− rcu_read_unlock();
3853+ if (conn->parent && conn->parent->state == BT_CONNECTED)
38393854 hci_le_create_cis(conn);
3840− rcu_read_lock();
3841− }
3842−
3843− if (i == rp->num_handles)
3844− break;
38453855 }
38463856
3847− rcu_read_unlock();
3848−
38493857 unlock:
38503858 hci_dev_unlock(hdev);
38513859
net/bluetooth/hci_sync.c+17−6
@@ -629,6 +629,7 @@ void hci_cmd_sync_init(struct hci_dev *hdev) · 628 unmodified lines
629629 INIT_WORK(&hdev->cmd_sync_work, hci_cmd_sync_work);
630630 INIT_LIST_HEAD(&hdev->cmd_sync_work_list);
631631 mutex_init(&hdev->cmd_sync_work_lock);
632+ mutex_init(&hdev->unregister_lock);
632633
633634 INIT_WORK(&hdev->cmd_sync_cancel_work, hci_cmd_sync_cancel_work);
634635 INIT_WORK(&hdev->reenable_adv_work, reenable_adv);
@@ -692,14 +693,19 @@ int hci_cmd_sync_submit(struct hci_dev *hdev, hci_cmd_sync_work_func_t func, · 57 unmodified lines
692693 void *data, hci_cmd_sync_work_destroy_t destroy)
693694 {
694695 struct hci_cmd_sync_work_entry *entry;
696+ int err = 0;
695697
696− if (hci_dev_test_flag(hdev, HCI_UNREGISTER))
697− return -ENODEV;
698+ mutex_lock(&hdev->unregister_lock);
699+ if (hci_dev_test_flag(hdev, HCI_UNREGISTER)) {
700+ err = -ENODEV;
701+ goto unlock;
702+ }
698703
699704 entry = kmalloc(sizeof(*entry), GFP_KERNEL);
700− if (!entry)
701− return -ENOMEM;
702−
705+ if (!entry) {
706+ err = -ENOMEM;
707+ goto unlock;
708+ }
703709 entry->func = func;
704710 entry->data = data;
705711 entry->destroy = destroy;
@@ -710,7 +716,9 @@ int hci_cmd_sync_submit(struct hci_dev *hdev, hci_cmd_sync_work_func_t func, · 4 unmodified lines
710716
711717 queue_work(hdev->req_workqueue, &hdev->cmd_sync_work);
712718
713− return 0;
719+unlock:
720+ mutex_unlock(&hdev->unregister_lock);
721+ return err;
714722 }
715723 EXPORT_SYMBOL(hci_cmd_sync_submit);
716724
@@ -4543,6 +4551,9 @@ static int hci_init_sync(struct hci_dev *hdev) · 3826 unmodified lines
45434551 !hci_dev_test_flag(hdev, HCI_CONFIG))
45444552 return 0;
45454553
4554+ if (hci_dev_test_and_set_flag(hdev, HCI_DEBUGFS_CREATED))
4555+ return 0;
4556+
45464557 hci_debugfs_create_common(hdev);
45474558
45484559 if (lmp_bredr_capable(hdev))
net/bluetooth/l2cap_core.c+13−0
@@ -4306,6 +4306,10 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, · 4305 unmodified lines
43064306 result = __le16_to_cpu(rsp->result);
43074307 status = __le16_to_cpu(rsp->status);
43084308
4309+ if (result == L2CAP_CR_SUCCESS && (dcid < L2CAP_CID_DYN_START ||
4310+ dcid > L2CAP_CID_DYN_END))
4311+ return -EPROTO;
4312+
43094313 BT_DBG("dcid 0x%4.4x scid 0x%4.4x result 0x%2.2x status 0x%2.2x",
43104314 dcid, scid, result, status);
43114315
@@ -4337,6 +4341,11 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, · 25 unmodified lines
43374341
43384342 switch (result) {
43394343 case L2CAP_CR_SUCCESS:
4344+ if (__l2cap_get_chan_by_dcid(conn, dcid)) {
4345+ err = -EBADSLT;
4346+ break;
4347+ }
4348+
43404349 l2cap_state_change(chan, BT_CONFIG);
43414350 chan->ident = 0;
43424351 chan->dcid = dcid;
@@ -4663,7 +4672,9 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, · 320 unmodified lines
46634672
46644673 chan->ops->set_shutdown(chan);
46654674
4675+ l2cap_chan_unlock(chan);
46664676 mutex_lock(&conn->chan_lock);
4677+ l2cap_chan_lock(chan);
46674678 l2cap_chan_del(chan, ECONNRESET);
46684679 mutex_unlock(&conn->chan_lock);
46694680
@@ -4702,7 +4713,9 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, · 32 unmodified lines
47024713 return 0;
47034714 }
47044715
4716+ l2cap_chan_unlock(chan);
47054717 mutex_lock(&conn->chan_lock);
4718+ l2cap_chan_lock(chan);
47064719 l2cap_chan_del(chan, 0);
47074720 mutex_unlock(&conn->chan_lock);
47084721
net/can/j1939/main.c+13−11
@@ -126,7 +126,7 @@ static void j1939_can_recv(struct sk_buff *iskb, void *data) · 125 unmodified lines
126126 #define J1939_CAN_ID CAN_EFF_FLAG
127127 #define J1939_CAN_MASK (CAN_EFF_FLAG | CAN_RTR_FLAG)
128128
129−static DEFINE_SPINLOCK(j1939_netdev_lock);
129+static DEFINE_MUTEX(j1939_netdev_lock);
130130
131131 static struct j1939_priv *j1939_priv_create(struct net_device *ndev)
132132 {
@@ -220,7 +220,7 @@ static void __j1939_rx_release(struct kref *kref) · 87 unmodified lines
220220 j1939_can_rx_unregister(priv);
221221 j1939_ecu_unmap_all(priv);
222222 j1939_priv_set(priv->ndev, NULL);
223− spin_unlock(&j1939_netdev_lock);
223+ mutex_unlock(&j1939_netdev_lock);
224224 }
225225
226226 /* get pointer to priv without increasing ref counter */
@@ -248,9 +248,9 @@ static struct j1939_priv *j1939_priv_get_by_ndev(struct net_device *ndev) · 21 unmodified lines
248248 {
249249 struct j1939_priv *priv;
250250
251− spin_lock(&j1939_netdev_lock);
251+ mutex_lock(&j1939_netdev_lock);
252252 priv = j1939_priv_get_by_ndev_locked(ndev);
253− spin_unlock(&j1939_netdev_lock);
253+ mutex_unlock(&j1939_netdev_lock);
254254
255255 return priv;
256256 }
@@ -260,14 +260,14 @@ struct j1939_priv *j1939_netdev_start(struct net_device *ndev) · 3 unmodified lines
260260 struct j1939_priv *priv, *priv_new;
261261 int ret;
262262
263− spin_lock(&j1939_netdev_lock);
263+ mutex_lock(&j1939_netdev_lock);
264264 priv = j1939_priv_get_by_ndev_locked(ndev);
265265 if (priv) {
266266 kref_get(&priv->rx_kref);
267− spin_unlock(&j1939_netdev_lock);
267+ mutex_unlock(&j1939_netdev_lock);
268268 return priv;
269269 }
270− spin_unlock(&j1939_netdev_lock);
270+ mutex_unlock(&j1939_netdev_lock);
271271
272272 priv = j1939_priv_create(ndev);
273273 if (!priv)
@@ -277,29 +277,31 @@ struct j1939_priv *j1939_netdev_start(struct net_device *ndev) · 3 unmodified lines
277277 spin_lock_init(&priv->j1939_socks_lock);
278278 INIT_LIST_HEAD(&priv->j1939_socks);
279279
280− spin_lock(&j1939_netdev_lock);
280+ mutex_lock(&j1939_netdev_lock);
281281 priv_new = j1939_priv_get_by_ndev_locked(ndev);
282282 if (priv_new) {
283283 /* Someone was faster than us, use their priv and roll
284284 * back our's.
285285 */
286286 kref_get(&priv_new->rx_kref);
287− spin_unlock(&j1939_netdev_lock);
287+ mutex_unlock(&j1939_netdev_lock);
288288 dev_put(ndev);
289289 kfree(priv);
290290 return priv_new;
291291 }
292292 j1939_priv_set(ndev, priv);
293− spin_unlock(&j1939_netdev_lock);
294293
295294 ret = j1939_can_rx_register(priv);
296295 if (ret < 0)
297296 goto out_priv_put;
298297
298+ mutex_unlock(&j1939_netdev_lock);
299299 return priv;
300300
301301 out_priv_put:
302302 j1939_priv_set(ndev, NULL);
303+ mutex_unlock(&j1939_netdev_lock);
304+
303305 dev_put(ndev);
304306 kfree(priv);
305307
@@ -308,7 +310,7 @@ struct j1939_priv *j1939_netdev_start(struct net_device *ndev) · 2 unmodified lines
308310
309311 void j1939_netdev_stop(struct j1939_priv *priv)
310312 {
311− kref_put_lock(&priv->rx_kref, __j1939_rx_release, &j1939_netdev_lock);
313+ kref_put_mutex(&priv->rx_kref, __j1939_rx_release, &j1939_netdev_lock);
312314 j1939_priv_put(priv);
313315 }
314316
net/can/j1939/socket.c+5−0
@@ -1088,6 +1088,11 @@ void j1939_sk_errqueue(struct j1939_session *session, · 1087 unmodified lines
10881088
10891089 void j1939_sk_send_loop_abort(struct sock *sk, int err)
10901090 {
1091+ struct j1939_sock *jsk = j1939_sk(sk);
1092+
1093+ if (jsk->state & J1939_SOCK_ERRQUEUE)
1094+ return;
1095+
10911096 sk->sk_err = err;
10921097
10931098 sk_error_report(sk);
net/core/dev.c+5−3
@@ -4471,8 +4471,10 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb, · 4470 unmodified lines
44714471 u32 next_cpu;
44724472 u32 ident;
44734473
4474− /* First check into global flow table if there is a match */
4475− ident = sock_flow_table->ents[hash & sock_flow_table->mask];
4474+ /* First check into global flow table if there is a match.
4475+ * This READ_ONCE() pairs with WRITE_ONCE() from rps_record_sock_flow().
4476+ */
4477+ ident = READ_ONCE(sock_flow_table->ents[hash & sock_flow_table->mask]);
44764478 if ((ident ^ hash) & ~rps_cpu_mask)
44774479 goto try_rps;
44784480
@@ -10544,7 +10546,7 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev) · 6065 unmodified lines
1054410546 return NULL;
1054510547 netdev_init_one_queue(dev, queue, NULL);
1054610548 RCU_INIT_POINTER(queue->qdisc, &noop_qdisc);
10547− queue->qdisc_sleeping = &noop_qdisc;
10549+ RCU_INIT_POINTER(queue->qdisc_sleeping, &noop_qdisc);
1054810550 rcu_assign_pointer(dev->ingress_queue, queue);
1054910551 #endif
1055010552 return queue;
net/core/skmsg.c+2−1
@@ -1210,7 +1210,8 @@ static void sk_psock_verdict_data_ready(struct sock *sk) · 1209 unmodified lines
12101210
12111211 rcu_read_lock();
12121212 psock = sk_psock(sk);
1213− psock->saved_data_ready(sk);
1213+ if (psock)
1214+ psock->saved_data_ready(sk);
12141215 rcu_read_unlock();
12151216 }
12161217 }
net/ipv4/sysctl_net_ipv4.c+4−4
@@ -35,8 +35,8 @@ static int ip_ttl_max = 255; · 34 unmodified lines
3535 static int tcp_syn_retries_min = 1;
3636 static int tcp_syn_retries_max = MAX_TCP_SYNCNT;
3737 static int tcp_syn_linear_timeouts_max = MAX_TCP_SYNCNT;
38−static int ip_ping_group_range_min[] = { 0, 0 };
39−static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
38+static unsigned long ip_ping_group_range_min[] = { 0, 0 };
39+static unsigned long ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
4040 static u32 u32_max_div_HZ = UINT_MAX / HZ;
4141 static int one_day_secs = 24 * 3600;
4242 static u32 fib_multipath_hash_fields_all_mask __maybe_unused =
@@ -166,7 +166,7 @@ static int ipv4_ping_group_range(struct ctl_table *table, int write, · 123 unmodified lines
166166 {
167167 struct user_namespace *user_ns = current_user_ns();
168168 int ret;
169− gid_t urange[2];
169+ unsigned long urange[2];
170170 kgid_t low, high;
171171 struct ctl_table tmp = {
172172 .data = &urange,
@@ -179,7 +179,7 @@ static int ipv4_ping_group_range(struct ctl_table *table, int write, · 6 unmodified lines
179179 inet_get_ping_group_range_table(table, &low, &high);
180180 urange[0] = from_kgid_munged(user_ns, low);
181181 urange[1] = from_kgid_munged(user_ns, high);
182− ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
182+ ret = proc_doulongvec_minmax(&tmp, write, buffer, lenp, ppos);
183183
184184 if (write && ret == 0) {
185185 low = make_kgid(user_ns, urange[0]);
net/ipv4/tcp_offload.c+9−10
@@ -60,12 +60,12 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, · 59 unmodified lines
6060 struct tcphdr *th;
6161 unsigned int thlen;
6262 unsigned int seq;
63− __be32 delta;
6463 unsigned int oldlen;
6564 unsigned int mss;
6665 struct sk_buff *gso_skb = skb;
6766 __sum16 newcheck;
6867 bool ooo_okay, copy_destructor;
68+ __wsum delta;
6969
7070 th = tcp_hdr(skb);
7171 thlen = th->doff * 4;
@@ -75,7 +75,7 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, · 3 unmodified lines
7575 if (!pskb_may_pull(skb, thlen))
7676 goto out;
7777
78− oldlen = (u16)~skb->len;
78+ oldlen = ~skb->len;
7979 __skb_pull(skb, thlen);
8080
8181 mss = skb_shinfo(skb)->gso_size;
@@ -110,7 +110,7 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, · 28 unmodified lines
110110 if (skb_is_gso(segs))
111111 mss *= skb_shinfo(segs)->gso_segs;
112112
113− delta = htonl(oldlen + (thlen + mss));
113+ delta = (__force __wsum)htonl(oldlen + thlen + mss);
114114
115115 skb = segs;
116116 th = tcp_hdr(skb);
@@ -119,8 +119,7 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, · 2 unmodified lines
119119 if (unlikely(skb_shinfo(gso_skb)->tx_flags & SKBTX_SW_TSTAMP))
120120 tcp_gso_tstamp(segs, skb_shinfo(gso_skb)->tskey, seq, mss);
121121
122− newcheck = ~csum_fold((__force __wsum)((__force u32)th->check +
123− (__force u32)delta));
122+ newcheck = ~csum_fold(csum_add(csum_unfold(th->check), delta));
124123
125124 while (skb->next) {
126125 th->fin = th->psh = 0;
@@ -165,11 +164,11 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb, · 38 unmodified lines
165164 WARN_ON_ONCE(refcount_sub_and_test(-delta, &skb->sk->sk_wmem_alloc));
166165 }
167166
168− delta = htonl(oldlen + (skb_tail_pointer(skb) -
169− skb_transport_header(skb)) +
170− skb->data_len);
171− th->check = ~csum_fold((__force __wsum)((__force u32)th->check +
172− (__force u32)delta));
167+ delta = (__force __wsum)htonl(oldlen +
168+ (skb_tail_pointer(skb) -
169+ skb_transport_header(skb)) +
170+ skb->data_len);
171+ th->check = ~csum_fold(csum_add(csum_unfold(th->check), delta));
173172 if (skb->ip_summed == CHECKSUM_PARTIAL)
174173 gso_reset_checksum(skb, ~th->check);
175174 else
net/ipv6/exthdrs.c+11−18
@@ -567,24 +567,6 @@ looped_back: · 566 unmodified lines
567567 return -1;
568568 }
569569
570− if (skb_cloned(skb)) {
571− if (pskb_expand_head(skb, IPV6_RPL_SRH_WORST_SWAP_SIZE, 0,
572− GFP_ATOMIC)) {
573− __IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
574− IPSTATS_MIB_OUTDISCARDS);
575− kfree_skb(skb);
576− return -1;
577− }
578− } else {
579− err = skb_cow_head(skb, IPV6_RPL_SRH_WORST_SWAP_SIZE);
580− if (unlikely(err)) {
581− kfree_skb(skb);
582− return -1;
583− }
584− }
585−
586− hdr = (struct ipv6_rpl_sr_hdr *)skb_transport_header(skb);
587−
588570 if (!pskb_may_pull(skb, ipv6_rpl_srh_size(n, hdr->cmpri,
589571 hdr->cmpre))) {
590572 kfree_skb(skb);
@@ -628,6 +610,17 @@ looped_back: · 37 unmodified lines
628610 skb_pull(skb, ((hdr->hdrlen + 1) << 3));
629611 skb_postpull_rcsum(skb, oldhdr,
630612 sizeof(struct ipv6hdr) + ((hdr->hdrlen + 1) << 3));
613+ if (unlikely(!hdr->segments_left)) {
614+ if (pskb_expand_head(skb, sizeof(struct ipv6hdr) + ((chdr->hdrlen + 1) << 3), 0,
615+ GFP_ATOMIC)) {
616+ __IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_OUTDISCARDS);
617+ kfree_skb(skb);
618+ kfree(buf);
619+ return -1;
620+ }
621+
622+ oldhdr = ipv6_hdr(skb);
623+ }
631624 skb_push(skb, ((chdr->hdrlen + 1) << 3) + sizeof(struct ipv6hdr));
632625 skb_reset_network_header(skb);
633626 skb_mac_header_rebuild(skb);
net/ipv6/route.c+2−2
@@ -6412,9 +6412,9 @@ static struct ctl_table ipv6_route_table_template[] = { · 6411 unmodified lines
64126412 {
64136413 .procname = "skip_notify_on_dev_down",
64146414 .data = &init_net.ipv6.sysctl.skip_notify_on_dev_down,
6415− .maxlen = sizeof(int),
6415+ .maxlen = sizeof(u8),
64166416 .mode = 0644,
6417− .proc_handler = proc_dointvec_minmax,
6417+ .proc_handler = proc_dou8vec_minmax,
64186418 .extra1 = SYSCTL_ZERO,
64196419 .extra2 = SYSCTL_ONE,
64206420 },
net/mac80211/he.c+10−5
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 * HE handling
44 *
55 * Copyright(c) 2017 Intel Deutschland GmbH
6− * Copyright(c) 2019 - 2022 Intel Corporation
6+ * Copyright(c) 2019 - 2023 Intel Corporation
77 */
88
99 #include "ieee80211_i.h"
@@ -114,6 +114,7 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata, · 104 unmodified lines
114114 struct link_sta_info *link_sta)
115115 {
116116 struct ieee80211_sta_he_cap *he_cap = &link_sta->pub->he_cap;
117+ const struct ieee80211_sta_he_cap *own_he_cap_ptr;
117118 struct ieee80211_sta_he_cap own_he_cap;
118119 struct ieee80211_he_cap_elem *he_cap_ie_elem = (void *)he_cap_ie;
119120 u8 he_ppe_size;
@@ -123,12 +124,16 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata, · 3 unmodified lines
123124
124125 memset(he_cap, 0, sizeof(*he_cap));
125126
126− if (!he_cap_ie ||
127− !ieee80211_get_he_iftype_cap(sband,
128− ieee80211_vif_type_p2p(&sdata->vif)))
127+ if (!he_cap_ie)
129128 return;
130129
131− own_he_cap = sband->iftype_data->he_cap;
130+ own_he_cap_ptr =
131+ ieee80211_get_he_iftype_cap(sband,
132+ ieee80211_vif_type_p2p(&sdata->vif));
133+ if (!own_he_cap_ptr)
134+ return;
135+
136+ own_he_cap = *own_he_cap_ptr;
132137
133138 /* Make sure size is OK */
134139 mcs_nss_size = ieee80211_he_mcs_nss_size(he_cap_ie_elem);
net/mac80211/mlme.c+7−1
@@ -1217,6 +1217,7 @@ static void ieee80211_add_non_inheritance_elem(struct sk_buff *skb, · 1216 unmodified lines
12171217 const u16 *inner)
12181218 {
12191219 unsigned int skb_len = skb->len;
1220+ bool at_extension = false;
12201221 bool added = false;
12211222 int i, j;
12221223 u8 *len, *list_len = NULL;
@@ -1228,7 +1229,6 @@ static void ieee80211_add_non_inheritance_elem(struct sk_buff *skb, · 5 unmodified lines
12281229 for (i = 0; i < PRESENT_ELEMS_MAX && outer[i]; i++) {
12291230 u16 elem = outer[i];
12301231 bool have_inner = false;
1231− bool at_extension = false;
12321232
12331233 /* should at least be sorted in the sense of normal -> ext */
12341234 WARN_ON(at_extension && elem < PRESENT_ELEM_EXT_OFFS);
@@ -1257,8 +1257,14 @@ static void ieee80211_add_non_inheritance_elem(struct sk_buff *skb, · 22 unmodified lines
12571257 }
12581258 *list_len += 1;
12591259 skb_put_u8(skb, (u8)elem);
1260+ added = true;
12601261 }
12611262
1263+ /* if we added a list but no extension list, make a zero-len one */
1264+ if (added && (!at_extension || !list_len))
1265+ skb_put_u8(skb, 0);
1266+
1267+ /* if nothing added remove extension element completely */
12621268 if (!added)
12631269 skb_trim(skb, skb_len);
12641270 else
net/mac80211/rx.c+3−1
@@ -4965,7 +4965,9 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, · 4964 unmodified lines
49654965 }
49664966
49674967 if (unlikely(rx->sta && rx->sta->sta.mlo) &&
4968− is_unicast_ether_addr(hdr->addr1)) {
4968+ is_unicast_ether_addr(hdr->addr1) &&
4969+ !ieee80211_is_probe_resp(hdr->frame_control) &&
4970+ !ieee80211_is_beacon(hdr->frame_control)) {
49694971 /* translate to MLD addresses */
49704972 if (ether_addr_equal(link->conf->addr, hdr->addr1))
49714973 ether_addr_copy(hdr->addr1, rx->sdata->vif.addr);
net/mac80211/tx.c+1−1
@@ -5528,7 +5528,7 @@ ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw, · 5527 unmodified lines
55285528 {
55295529 struct ieee80211_ema_beacons *ema_beacons = NULL;
55305530
5531− WARN_ON(__ieee80211_beacon_get(hw, vif, NULL, false, link_id, 0,
5531+ WARN_ON(__ieee80211_beacon_get(hw, vif, NULL, true, link_id, 0,
55325532 &ema_beacons));
55335533
55345534 return ema_beacons;
net/mptcp/pm.c+19−4
@@ -89,8 +89,15 @@ bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) · 88 unmodified lines
8989 unsigned int subflows_max;
9090 int ret = 0;
9191
92− if (mptcp_pm_is_userspace(msk))
93− return mptcp_userspace_pm_active(msk);
92+ if (mptcp_pm_is_userspace(msk)) {
93+ if (mptcp_userspace_pm_active(msk)) {
94+ spin_lock_bh(&pm->lock);
95+ pm->subflows++;
96+ spin_unlock_bh(&pm->lock);
97+ return true;
98+ }
99+ return false;
100+ }
94101
95102 subflows_max = mptcp_pm_get_subflows_max(msk);
96103
@@ -183,8 +190,16 @@ void mptcp_pm_subflow_check_next(struct mptcp_sock *msk, const struct sock *ssk, · 86 unmodified lines
183190 struct mptcp_pm_data *pm = &msk->pm;
184191 bool update_subflows;
185192
186− update_subflows = (subflow->request_join || subflow->mp_join) &&
187− mptcp_pm_is_kernel(msk);
193+ update_subflows = subflow->request_join || subflow->mp_join;
194+ if (mptcp_pm_is_userspace(msk)) {
195+ if (update_subflows) {
196+ spin_lock_bh(&pm->lock);
197+ pm->subflows--;
198+ spin_unlock_bh(&pm->lock);
199+ }
200+ return;
201+ }
202+
188203 if (!READ_ONCE(pm->work_pending) && !update_subflows)
189204 return;
190205
net/mptcp/pm_netlink.c+18−0
@@ -1558,6 +1558,24 @@ static int mptcp_nl_cmd_del_addr(struct sk_buff *skb, struct genl_info *info) · 1557 unmodified lines
15581558 return ret;
15591559 }
15601560
1561+void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list)
1562+{
1563+ struct mptcp_rm_list alist = { .nr = 0 };
1564+ struct mptcp_pm_addr_entry *entry;
1565+
1566+ list_for_each_entry(entry, rm_list, list) {
1567+ remove_anno_list_by_saddr(msk, &entry->addr);
1568+ if (alist.nr < MPTCP_RM_IDS_MAX)
1569+ alist.ids[alist.nr++] = entry->addr.id;
1570+ }
1571+
1572+ if (alist.nr) {
1573+ spin_lock_bh(&msk->pm.lock);
1574+ mptcp_pm_remove_addr(msk, &alist);
1575+ spin_unlock_bh(&msk->pm.lock);
1576+ }
1577+}
1578+
15611579 void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk,
15621580 struct list_head *rm_list)
15631581 {
net/mptcp/pm_userspace.c+47−1
@@ -69,6 +69,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, · 68 unmodified lines
6969 MPTCP_PM_MAX_ADDR_ID + 1,
7070 1);
7171 list_add_tail_rcu(&e->list, &msk->pm.userspace_pm_local_addr_list);
72+ msk->pm.local_addr_used++;
7273 ret = e->addr.id;
7374 } else if (match) {
7475 ret = entry->addr.id;
@@ -79,6 +80,31 @@ append_err: · 4 unmodified lines
7980 return ret;
8081 }
8182
83+/* If the subflow is closed from the other peer (not via a
84+ * subflow destroy command then), we want to keep the entry
85+ * not to assign the same ID to another address and to be
86+ * able to send RM_ADDR after the removal of the subflow.
87+ */
88+static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk,
89+ struct mptcp_pm_addr_entry *addr)
90+{
91+ struct mptcp_pm_addr_entry *entry, *tmp;
92+
93+ list_for_each_entry_safe(entry, tmp, &msk->pm.userspace_pm_local_addr_list, list) {
94+ if (mptcp_addresses_equal(&entry->addr, &addr->addr, false)) {
95+ /* TODO: a refcount is needed because the entry can
96+ * be used multiple times (e.g. fullmesh mode).
97+ */
98+ list_del_rcu(&entry->list);
99+ kfree(entry);
100+ msk->pm.local_addr_used--;
101+ return 0;
102+ }
103+ }
104+
105+ return -EINVAL;
106+}
107+
82108 int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk,
83109 unsigned int id,
84110 u8 *flags, int *ifindex)
@@ -171,6 +197,7 @@ int mptcp_nl_cmd_announce(struct sk_buff *skb, struct genl_info *info) · 86 unmodified lines
171197 spin_lock_bh(&msk->pm.lock);
172198
173199 if (mptcp_pm_alloc_anno_list(msk, &addr_val)) {
200+ msk->pm.add_addr_signaled++;
174201 mptcp_pm_announce_addr(msk, &addr_val.addr, false);
175202 mptcp_pm_nl_addr_send_ack(msk);
176203 }
@@ -232,7 +259,7 @@ int mptcp_nl_cmd_remove(struct sk_buff *skb, struct genl_info *info) · 55 unmodified lines
232259
233260 list_move(&match->list, &free_list);
234261
235− mptcp_pm_remove_addrs_and_subflows(msk, &free_list);
262+ mptcp_pm_remove_addrs(msk, &free_list);
236263
237264 release_sock((struct sock *)msk);
238265
@@ -251,6 +278,7 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info) · 12 unmodified lines
251278 struct nlattr *raddr = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE];
252279 struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN];
253280 struct nlattr *laddr = info->attrs[MPTCP_PM_ATTR_ADDR];
281+ struct mptcp_pm_addr_entry local = { 0 };
254282 struct mptcp_addr_info addr_r;
255283 struct mptcp_addr_info addr_l;
256284 struct mptcp_sock *msk;
@@ -302,12 +330,26 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info) · 45 unmodified lines
302330 goto create_err;
303331 }
304332
333+ local.addr = addr_l;
334+ err = mptcp_userspace_pm_append_new_local_addr(msk, &local);
335+ if (err < 0) {
336+ GENL_SET_ERR_MSG(info, "did not match address and id");
337+ goto create_err;
338+ }
339+
305340 lock_sock(sk);
306341
307342 err = __mptcp_subflow_connect(sk, &addr_l, &addr_r);
308343
309344 release_sock(sk);
310345
346+ spin_lock_bh(&msk->pm.lock);
347+ if (err)
348+ mptcp_userspace_pm_delete_local_addr(msk, &local);
349+ else
350+ msk->pm.subflows++;
351+ spin_unlock_bh(&msk->pm.lock);
352+
311353 create_err:
312354 sock_put((struct sock *)msk);
313355 return err;
@@ -420,7 +462,11 @@ int mptcp_nl_cmd_sf_destroy(struct sk_buff *skb, struct genl_info *info) · 106 unmodified lines
420462 ssk = mptcp_nl_find_ssk(msk, &addr_l, &addr_r);
421463 if (ssk) {
422464 struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
465+ struct mptcp_pm_addr_entry entry = { .addr = addr_l };
423466
467+ spin_lock_bh(&msk->pm.lock);
468+ mptcp_userspace_pm_delete_local_addr(msk, &entry);
469+ spin_unlock_bh(&msk->pm.lock);
424470 mptcp_subflow_shutdown(sk, ssk, RCV_SHUTDOWN | SEND_SHUTDOWN);
425471 mptcp_close_ssk(sk, ssk, subflow);
426472 MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RMSUBFLOW);
net/mptcp/protocol.h+1−0
@@ -832,6 +832,7 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk, · 831 unmodified lines
832832 bool echo);
833833 int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list);
834834 int mptcp_pm_remove_subflow(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list);
835+void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list);
835836 void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk,
836837 struct list_head *rm_list);
837838
net/netfilter/ipset/ip_set_core.c+8−0
@@ -1694,6 +1694,14 @@ call_ad(struct net *net, struct sock *ctnl, struct sk_buff *skb, · 1693 unmodified lines
16941694 bool eexist = flags & IPSET_FLAG_EXIST, retried = false;
16951695
16961696 do {
1697+ if (retried) {
1698+ __ip_set_get(set);
1699+ nfnl_unlock(NFNL_SUBSYS_IPSET);
1700+ cond_resched();
1701+ nfnl_lock(NFNL_SUBSYS_IPSET);
1702+ __ip_set_put(set);
1703+ }
1704+
16971705 ip_set_lock(set);
16981706 ret = set->variant->uadt(set, tb, adt, &lineno, flags, retried);
16991707 ip_set_unlock(set);
net/netfilter/nf_conntrack_core.c+3−0
@@ -2260,6 +2260,9 @@ static int nf_confirm_cthelper(struct sk_buff *skb, struct nf_conn *ct, · 2259 unmodified lines
22602260 return 0;
22612261
22622262 helper = rcu_dereference(help->helper);
2263+ if (!helper)
2264+ return 0;
2265+
22632266 if (!(helper->flags & NF_CT_HELPER_F_USERSPACE))
22642267 return 0;
22652268
net/netfilter/nf_tables_api.c+3−1
@@ -1600,6 +1600,8 @@ static int nft_dump_basechain_hook(struct sk_buff *skb, int family, · 1599 unmodified lines
16001600
16011601 if (nft_base_chain_netdev(family, ops->hooknum)) {
16021602 nest_devs = nla_nest_start_noflag(skb, NFTA_HOOK_DEVS);
1603+ if (!nest_devs)
1604+ goto nla_put_failure;
16031605
16041606 if (!hook_list)
16051607 hook_list = &basechain->hook_list;
@@ -9008,7 +9010,7 @@ static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *cha · 7402 unmodified lines
90089010 continue;
90099011 }
90109012
9011− if (WARN_ON_ONCE(data + expr->ops->size > data_boundary))
9013+ if (WARN_ON_ONCE(data + size + expr->ops->size > data_boundary))
90129014 return -ENOMEM;
90139015
90149016 memcpy(data + size, expr, expr->ops->size);
net/netfilter/nft_bitwise.c+1−1
@@ -323,7 +323,7 @@ static bool nft_bitwise_reduce(struct nft_regs_track *track, · 322 unmodified lines
323323 dreg = priv->dreg;
324324 regcount = DIV_ROUND_UP(priv->len, NFT_REG32_SIZE);
325325 for (i = 0; i < regcount; i++, dreg++)
326− track->regs[priv->dreg].bitwise = expr;
326+ track->regs[dreg].bitwise = expr;
327327
328328 return false;
329329 }
net/openvswitch/datapath.c+0−19
@@ -236,9 +236,6 @@ void ovs_dp_detach_port(struct vport *p) · 235 unmodified lines
236236 /* First drop references to device. */
237237 hlist_del_rcu(&p->dp_hash_node);
238238
239− /* Free percpu memory */
240− free_percpu(p->upcall_stats);
241−
242239 /* Then destroy it. */
243240 ovs_vport_del(p);
244241 }
@@ -1858,12 +1855,6 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) · 1613 unmodified lines
18581855 goto err_destroy_portids;
18591856 }
18601857
1861− vport->upcall_stats = netdev_alloc_pcpu_stats(struct vport_upcall_stats_percpu);
1862− if (!vport->upcall_stats) {
1863− err = -ENOMEM;
1864− goto err_destroy_vport;
1865− }
1866−
18671858 err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid,
18681859 info->snd_seq, 0, OVS_DP_CMD_NEW);
18691860 BUG_ON(err < 0);
@@ -1876,8 +1867,6 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) · 6 unmodified lines
18761867 ovs_notify(&dp_datapath_genl_family, reply, info);
18771868 return 0;
18781869
1879−err_destroy_vport:
1880− ovs_dp_detach_port(vport);
18811870 err_destroy_portids:
18821871 kfree(rcu_dereference_raw(dp->upcall_portids));
18831872 err_unlock_and_destroy_meters:
@@ -2322,12 +2311,6 @@ restart: · 438 unmodified lines
23222311 goto exit_unlock_free;
23232312 }
23242313
2325− vport->upcall_stats = netdev_alloc_pcpu_stats(struct vport_upcall_stats_percpu);
2326− if (!vport->upcall_stats) {
2327− err = -ENOMEM;
2328− goto exit_unlock_free_vport;
2329− }
2330−
23312314 err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info),
23322315 info->snd_portid, info->snd_seq, 0,
23332316 OVS_VPORT_CMD_NEW, GFP_KERNEL);
@@ -2345,8 +2328,6 @@ restart: · 11 unmodified lines
23452328 ovs_notify(&dp_vport_genl_family, reply, info);
23462329 return 0;
23472330
2348−exit_unlock_free_vport:
2349− ovs_dp_detach_port(vport);
23502331 exit_unlock_free:
23512332 ovs_unlock();
23522333 kfree_skb(reply);
net/openvswitch/vport.c+16−2
@@ -124,6 +124,7 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops, · 123 unmodified lines
124124 {
125125 struct vport *vport;
126126 size_t alloc_size;
127+ int err;
127128
128129 alloc_size = sizeof(struct vport);
129130 if (priv_size) {
@@ -135,17 +136,29 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops, · 5 unmodified lines
135136 if (!vport)
136137 return ERR_PTR(-ENOMEM);
137138
139+ vport->upcall_stats = netdev_alloc_pcpu_stats(struct vport_upcall_stats_percpu);
140+ if (!vport->upcall_stats) {
141+ err = -ENOMEM;
142+ goto err_kfree_vport;
143+ }
144+
138145 vport->dp = parms->dp;
139146 vport->port_no = parms->port_no;
140147 vport->ops = ops;
141148 INIT_HLIST_NODE(&vport->dp_hash_node);
142149
143150 if (ovs_vport_set_upcall_portids(vport, parms->upcall_portids)) {
144− kfree(vport);
145− return ERR_PTR(-EINVAL);
151+ err = -EINVAL;
152+ goto err_free_percpu;
146153 }
147154
148155 return vport;
156+
157+err_free_percpu:
158+ free_percpu(vport->upcall_stats);
159+err_kfree_vport:
160+ kfree(vport);
161+ return ERR_PTR(err);
149162 }
150163 EXPORT_SYMBOL_GPL(ovs_vport_alloc);
151164
@@ -165,6 +178,7 @@ void ovs_vport_free(struct vport *vport) · 13 unmodified lines
165178 * it is safe to use raw dereference.
166179 */
167180 kfree(rcu_dereference_raw(vport->upcall_portids));
181+ free_percpu(vport->upcall_stats);
168182 kfree(vport);
169183 }
170184 EXPORT_SYMBOL_GPL(ovs_vport_free);
net/sched/act_police.c+5−5
@@ -357,23 +357,23 @@ static int tcf_police_dump(struct sk_buff *skb, struct tc_action *a, · 356 unmodified lines
357357 opt.burst = PSCHED_NS2TICKS(p->tcfp_burst);
358358 if (p->rate_present) {
359359 psched_ratecfg_getrate(&opt.rate, &p->rate);
360− if ((police->params->rate.rate_bytes_ps >= (1ULL << 32)) &&
360+ if ((p->rate.rate_bytes_ps >= (1ULL << 32)) &&
361361 nla_put_u64_64bit(skb, TCA_POLICE_RATE64,
362− police->params->rate.rate_bytes_ps,
362+ p->rate.rate_bytes_ps,
363363 TCA_POLICE_PAD))
364364 goto nla_put_failure;
365365 }
366366 if (p->peak_present) {
367367 psched_ratecfg_getrate(&opt.peakrate, &p->peak);
368− if ((police->params->peak.rate_bytes_ps >= (1ULL << 32)) &&
368+ if ((p->peak.rate_bytes_ps >= (1ULL << 32)) &&
369369 nla_put_u64_64bit(skb, TCA_POLICE_PEAKRATE64,
370− police->params->peak.rate_bytes_ps,
370+ p->peak.rate_bytes_ps,
371371 TCA_POLICE_PAD))
372372 goto nla_put_failure;
373373 }
374374 if (p->pps_present) {
375375 if (nla_put_u64_64bit(skb, TCA_POLICE_PKTRATE64,
376− police->params->ppsrate.rate_pkts_ps,
376+ p->ppsrate.rate_pkts_ps,
377377 TCA_POLICE_PAD))
378378 goto nla_put_failure;
379379 if (nla_put_u64_64bit(skb, TCA_POLICE_PKTBURST64,
net/sched/cls_api.c+1−2
@@ -43,8 +43,6 @@ · 42 unmodified lines
4343 #include <net/flow_offload.h>
4444 #include <net/tc_wrapper.h>
4545
46−extern const struct nla_policy rtm_tca_policy[TCA_MAX + 1];
47−
4846 /* The list of all installed classifier types */
4947 static LIST_HEAD(tcf_proto_base);
5048
@@ -2952,6 +2950,7 @@ static int tc_chain_tmplt_add(struct tcf_chain *chain, struct net *net, · 2901 unmodified lines
29522950 return PTR_ERR(ops);
29532951 if (!ops->tmplt_create || !ops->tmplt_destroy || !ops->tmplt_dump) {
29542952 NL_SET_ERR_MSG(extack, "Chain templates are not supported with specified classifier");
2953+ module_put(ops->owner);
29552954 return -EOPNOTSUPP;
29562955 }
29572956
net/sched/sch_api.c+18−10
@@ -309,7 +309,7 @@ struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle) · 308 unmodified lines
309309
310310 if (dev_ingress_queue(dev))
311311 q = qdisc_match_from_root(
312− dev_ingress_queue(dev)->qdisc_sleeping,
312+ rtnl_dereference(dev_ingress_queue(dev)->qdisc_sleeping),
313313 handle);
314314 out:
315315 return q;
@@ -328,7 +328,8 @@ struct Qdisc *qdisc_lookup_rcu(struct net_device *dev, u32 handle) · 12 unmodified lines
328328
329329 nq = dev_ingress_queue_rcu(dev);
330330 if (nq)
331− q = qdisc_match_from_root(nq->qdisc_sleeping, handle);
331+ q = qdisc_match_from_root(rcu_dereference(nq->qdisc_sleeping),
332+ handle);
332333 out:
333334 return q;
334335 }
@@ -634,8 +635,13 @@ EXPORT_SYMBOL(qdisc_watchdog_init); · 299 unmodified lines
634635 void qdisc_watchdog_schedule_range_ns(struct qdisc_watchdog *wd, u64 expires,
635636 u64 delta_ns)
636637 {
637− if (test_bit(__QDISC_STATE_DEACTIVATED,
638− &qdisc_root_sleeping(wd->qdisc)->state))
638+ bool deactivated;
639+
640+ rcu_read_lock();
641+ deactivated = test_bit(__QDISC_STATE_DEACTIVATED,
642+ &qdisc_root_sleeping(wd->qdisc)->state);
643+ rcu_read_unlock();
644+ if (deactivated)
639645 return;
640646
641647 if (hrtimer_is_queued(&wd->timer)) {
@@ -1478,7 +1484,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, · 836 unmodified lines
14781484 }
14791485 q = qdisc_leaf(p, clid);
14801486 } else if (dev_ingress_queue(dev)) {
1481− q = dev_ingress_queue(dev)->qdisc_sleeping;
1487+ q = rtnl_dereference(dev_ingress_queue(dev)->qdisc_sleeping);
14821488 }
14831489 } else {
14841490 q = rtnl_dereference(dev->qdisc);
@@ -1564,7 +1570,7 @@ replay: · 79 unmodified lines
15641570 }
15651571 q = qdisc_leaf(p, clid);
15661572 } else if (dev_ingress_queue_create(dev)) {
1567− q = dev_ingress_queue(dev)->qdisc_sleeping;
1573+ q = rtnl_dereference(dev_ingress_queue(dev)->qdisc_sleeping);
15681574 }
15691575 } else {
15701576 q = rtnl_dereference(dev->qdisc);
@@ -1805,8 +1811,8 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) · 234 unmodified lines
18051811
18061812 dev_queue = dev_ingress_queue(dev);
18071813 if (dev_queue &&
1808− tc_dump_qdisc_root(dev_queue->qdisc_sleeping, skb, cb,
1809− &q_idx, s_q_idx, false,
1814+ tc_dump_qdisc_root(rtnl_dereference(dev_queue->qdisc_sleeping),
1815+ skb, cb, &q_idx, s_q_idx, false,
18101816 tca[TCA_DUMP_INVISIBLE]) < 0)
18111817 goto done;
18121818
@@ -2249,8 +2255,8 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) · 436 unmodified lines
22492255
22502256 dev_queue = dev_ingress_queue(dev);
22512257 if (dev_queue &&
2252− tc_dump_tclass_root(dev_queue->qdisc_sleeping, skb, tcm, cb,
2253− &t, s_t, false) < 0)
2258+ tc_dump_tclass_root(rtnl_dereference(dev_queue->qdisc_sleeping),
2259+ skb, tcm, cb, &t, s_t, false) < 0)
22542260 goto done;
22552261
22562262 done:
@@ -2302,7 +2308,9 @@ static struct pernet_operations psched_net_ops = { · 45 unmodified lines
23022308 .exit = psched_net_exit,
23032309 };
23042310
2311+#if IS_ENABLED(CONFIG_RETPOLINE)
23052312 DEFINE_STATIC_KEY_FALSE(tc_skip_wrapper);
2313+#endif
23062314
23072315 static int __init pktsched_init(void)
23082316 {
net/sched/sch_fq_pie.c+9−1
@@ -201,6 +201,11 @@ out: · 200 unmodified lines
201201 return NET_XMIT_CN;
202202 }
203203
204+static struct netlink_range_validation fq_pie_q_range = {
205+ .min = 1,
206+ .max = 1 << 20,
207+};
208+
204209 static const struct nla_policy fq_pie_policy[TCA_FQ_PIE_MAX + 1] = {
205210 [TCA_FQ_PIE_LIMIT] = {.type = NLA_U32},
206211 [TCA_FQ_PIE_FLOWS] = {.type = NLA_U32},
@@ -208,7 +213,8 @@ static const struct nla_policy fq_pie_policy[TCA_FQ_PIE_MAX + 1] = { · 1 unmodified line
208213 [TCA_FQ_PIE_TUPDATE] = {.type = NLA_U32},
209214 [TCA_FQ_PIE_ALPHA] = {.type = NLA_U32},
210215 [TCA_FQ_PIE_BETA] = {.type = NLA_U32},
211− [TCA_FQ_PIE_QUANTUM] = {.type = NLA_U32},
216+ [TCA_FQ_PIE_QUANTUM] =
217+ NLA_POLICY_FULL_RANGE(NLA_U32, &fq_pie_q_range),
212218 [TCA_FQ_PIE_MEMORY_LIMIT] = {.type = NLA_U32},
213219 [TCA_FQ_PIE_ECN_PROB] = {.type = NLA_U32},
214220 [TCA_FQ_PIE_ECN] = {.type = NLA_U32},
@@ -373,6 +379,7 @@ static void fq_pie_timer(struct timer_list *t) · 158 unmodified lines
373379 spinlock_t *root_lock; /* to lock qdisc for probability calculations */
374380 u32 idx;
375381
382+ rcu_read_lock();
376383 root_lock = qdisc_lock(qdisc_root_sleeping(sch));
377384 spin_lock(root_lock);
378385
@@ -385,6 +392,7 @@ static void fq_pie_timer(struct timer_list *t) · 6 unmodified lines
385392 mod_timer(&q->adapt_timer, jiffies + q->p_params.tupdate);
386393
387394 spin_unlock(root_lock);
395+ rcu_read_unlock();
388396 }
389397
390398 static int fq_pie_init(struct Qdisc *sch, struct nlattr *opt,
net/sched/sch_generic.c+15−15
@@ -648,7 +648,7 @@ struct Qdisc_ops noop_qdisc_ops __read_mostly = { · 647 unmodified lines
648648
649649 static struct netdev_queue noop_netdev_queue = {
650650 RCU_POINTER_INITIALIZER(qdisc, &noop_qdisc),
651− .qdisc_sleeping = &noop_qdisc,
651+ RCU_POINTER_INITIALIZER(qdisc_sleeping, &noop_qdisc),
652652 };
653653
654654 struct Qdisc noop_qdisc = {
@@ -1103,7 +1103,7 @@ EXPORT_SYMBOL(qdisc_put_unlocked); · 448 unmodified lines
11031103 struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue,
11041104 struct Qdisc *qdisc)
11051105 {
1106− struct Qdisc *oqdisc = dev_queue->qdisc_sleeping;
1106+ struct Qdisc *oqdisc = rtnl_dereference(dev_queue->qdisc_sleeping);
11071107 spinlock_t *root_lock;
11081108
11091109 root_lock = qdisc_lock(oqdisc);
@@ -1112,7 +1112,7 @@ struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, · 2 unmodified lines
11121112 /* ... and graft new one */
11131113 if (qdisc == NULL)
11141114 qdisc = &noop_qdisc;
1115− dev_queue->qdisc_sleeping = qdisc;
1115+ rcu_assign_pointer(dev_queue->qdisc_sleeping, qdisc);
11161116 rcu_assign_pointer(dev_queue->qdisc, &noop_qdisc);
11171117
11181118 spin_unlock_bh(root_lock);
@@ -1125,12 +1125,12 @@ static void shutdown_scheduler_queue(struct net_device *dev, · 6 unmodified lines
11251125 struct netdev_queue *dev_queue,
11261126 void *_qdisc_default)
11271127 {
1128− struct Qdisc *qdisc = dev_queue->qdisc_sleeping;
1128+ struct Qdisc *qdisc = rtnl_dereference(dev_queue->qdisc_sleeping);
11291129 struct Qdisc *qdisc_default = _qdisc_default;
11301130
11311131 if (qdisc) {
11321132 rcu_assign_pointer(dev_queue->qdisc, qdisc_default);
1133− dev_queue->qdisc_sleeping = qdisc_default;
1133+ rcu_assign_pointer(dev_queue->qdisc_sleeping, qdisc_default);
11341134
11351135 qdisc_put(qdisc);
11361136 }
@@ -1154,7 +1154,7 @@ static void attach_one_default_qdisc(struct net_device *dev, · 17 unmodified lines
11541154
11551155 if (!netif_is_multiqueue(dev))
11561156 qdisc->flags |= TCQ_F_ONETXQUEUE | TCQ_F_NOPARENT;
1157− dev_queue->qdisc_sleeping = qdisc;
1157+ rcu_assign_pointer(dev_queue->qdisc_sleeping, qdisc);
11581158 }
11591159
11601160 static void attach_default_qdiscs(struct net_device *dev)
@@ -1167,7 +1167,7 @@ static void attach_default_qdiscs(struct net_device *dev) · 6 unmodified lines
11671167 if (!netif_is_multiqueue(dev) ||
11681168 dev->priv_flags & IFF_NO_QUEUE) {
11691169 netdev_for_each_tx_queue(dev, attach_one_default_qdisc, NULL);
1170− qdisc = txq->qdisc_sleeping;
1170+ qdisc = rtnl_dereference(txq->qdisc_sleeping);
11711171 rcu_assign_pointer(dev->qdisc, qdisc);
11721172 qdisc_refcount_inc(qdisc);
11731173 } else {
@@ -1186,7 +1186,7 @@ static void attach_default_qdiscs(struct net_device *dev) · 12 unmodified lines
11861186 netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc);
11871187 dev->priv_flags |= IFF_NO_QUEUE;
11881188 netdev_for_each_tx_queue(dev, attach_one_default_qdisc, NULL);
1189− qdisc = txq->qdisc_sleeping;
1189+ qdisc = rtnl_dereference(txq->qdisc_sleeping);
11901190 rcu_assign_pointer(dev->qdisc, qdisc);
11911191 qdisc_refcount_inc(qdisc);
11921192 dev->priv_flags ^= IFF_NO_QUEUE;
@@ -1202,7 +1202,7 @@ static void transition_one_qdisc(struct net_device *dev, · 9 unmodified lines
12021202 struct netdev_queue *dev_queue,
12031203 void *_need_watchdog)
12041204 {
1205− struct Qdisc *new_qdisc = dev_queue->qdisc_sleeping;
1205+ struct Qdisc *new_qdisc = rtnl_dereference(dev_queue->qdisc_sleeping);
12061206 int *need_watchdog_p = _need_watchdog;
12071207
12081208 if (!(new_qdisc->flags & TCQ_F_BUILTIN))
@@ -1272,7 +1272,7 @@ static void dev_reset_queue(struct net_device *dev, · 63 unmodified lines
12721272 struct Qdisc *qdisc;
12731273 bool nolock;
12741274
1275− qdisc = dev_queue->qdisc_sleeping;
1275+ qdisc = rtnl_dereference(dev_queue->qdisc_sleeping);
12761276 if (!qdisc)
12771277 return;
12781278
@@ -1303,7 +1303,7 @@ static bool some_qdisc_is_busy(struct net_device *dev) · 24 unmodified lines
13031303 int val;
13041304
13051305 dev_queue = netdev_get_tx_queue(dev, i);
1306− q = dev_queue->qdisc_sleeping;
1306+ q = rtnl_dereference(dev_queue->qdisc_sleeping);
13071307
13081308 root_lock = qdisc_lock(q);
13091309 spin_lock_bh(root_lock);
@@ -1379,7 +1379,7 @@ EXPORT_SYMBOL(dev_deactivate); · 69 unmodified lines
13791379 static int qdisc_change_tx_queue_len(struct net_device *dev,
13801380 struct netdev_queue *dev_queue)
13811381 {
1382− struct Qdisc *qdisc = dev_queue->qdisc_sleeping;
1382+ struct Qdisc *qdisc = rtnl_dereference(dev_queue->qdisc_sleeping);
13831383 const struct Qdisc_ops *ops = qdisc->ops;
13841384
13851385 if (ops->change_tx_queue_len)
@@ -1404,7 +1404,7 @@ void mq_change_real_num_tx(struct Qdisc *sch, unsigned int new_real_tx) · 18 unmodified lines
14041404 unsigned int i;
14051405
14061406 for (i = new_real_tx; i < dev->real_num_tx_queues; i++) {
1407− qdisc = netdev_get_tx_queue(dev, i)->qdisc_sleeping;
1407+ qdisc = rtnl_dereference(netdev_get_tx_queue(dev, i)->qdisc_sleeping);
14081408 /* Only update the default qdiscs we created,
14091409 * qdiscs with handles are always hashed.
14101410 */
@@ -1412,7 +1412,7 @@ void mq_change_real_num_tx(struct Qdisc *sch, unsigned int new_real_tx) · 1 unmodified line
14121412 qdisc_hash_del(qdisc);
14131413 }
14141414 for (i = dev->real_num_tx_queues; i < new_real_tx; i++) {
1415− qdisc = netdev_get_tx_queue(dev, i)->qdisc_sleeping;
1415+ qdisc = rtnl_dereference(netdev_get_tx_queue(dev, i)->qdisc_sleeping);
14161416 if (qdisc != &noop_qdisc && !qdisc->handle)
14171417 qdisc_hash_add(qdisc, false);
14181418 }
@@ -1449,7 +1449,7 @@ static void dev_init_scheduler_queue(struct net_device *dev, · 30 unmodified lines
14491449 struct Qdisc *qdisc = _qdisc;
14501450
14511451 rcu_assign_pointer(dev_queue->qdisc, qdisc);
1452− dev_queue->qdisc_sleeping = qdisc;
1452+ rcu_assign_pointer(dev_queue->qdisc_sleeping, qdisc);
14531453 }
14541454
14551455 void dev_init_scheduler(struct net_device *dev)
net/sched/sch_mq.c+4−4
@@ -141,7 +141,7 @@ static int mq_dump(struct Qdisc *sch, struct sk_buff *skb) · 140 unmodified lines
141141 * qdisc totals are added at end.
142142 */
143143 for (ntx = 0; ntx < dev->num_tx_queues; ntx++) {
144− qdisc = netdev_get_tx_queue(dev, ntx)->qdisc_sleeping;
144+ qdisc = rtnl_dereference(netdev_get_tx_queue(dev, ntx)->qdisc_sleeping);
145145 spin_lock_bh(qdisc_lock(qdisc));
146146
147147 gnet_stats_add_basic(&sch->bstats, qdisc->cpu_bstats,
@@ -202,7 +202,7 @@ static struct Qdisc *mq_leaf(struct Qdisc *sch, unsigned long cl) · 54 unmodified lines
202202 {
203203 struct netdev_queue *dev_queue = mq_queue_get(sch, cl);
204204
205− return dev_queue->qdisc_sleeping;
205+ return rtnl_dereference(dev_queue->qdisc_sleeping);
206206 }
207207
208208 static unsigned long mq_find(struct Qdisc *sch, u32 classid)
@@ -221,7 +221,7 @@ static int mq_dump_class(struct Qdisc *sch, unsigned long cl, · 12 unmodified lines
221221
222222 tcm->tcm_parent = TC_H_ROOT;
223223 tcm->tcm_handle |= TC_H_MIN(cl);
224− tcm->tcm_info = dev_queue->qdisc_sleeping->handle;
224+ tcm->tcm_info = rtnl_dereference(dev_queue->qdisc_sleeping)->handle;
225225 return 0;
226226 }
227227
@@ -230,7 +230,7 @@ static int mq_dump_class_stats(struct Qdisc *sch, unsigned long cl, · 2 unmodified lines
230230 {
231231 struct netdev_queue *dev_queue = mq_queue_get(sch, cl);
232232
233− sch = dev_queue->qdisc_sleeping;
233+ sch = rtnl_dereference(dev_queue->qdisc_sleeping);
234234 if (gnet_stats_copy_basic(d, sch->cpu_bstats, &sch->bstats, true) < 0 ||
235235 qdisc_qstats_copy(d, sch) < 0)
236236 return -1;
net/sched/sch_mqprio.c+4−4
@@ -557,7 +557,7 @@ static int mqprio_dump(struct Qdisc *sch, struct sk_buff *skb) · 556 unmodified lines
557557 * qdisc totals are added at end.
558558 */
559559 for (ntx = 0; ntx < dev->num_tx_queues; ntx++) {
560− qdisc = netdev_get_tx_queue(dev, ntx)->qdisc_sleeping;
560+ qdisc = rtnl_dereference(netdev_get_tx_queue(dev, ntx)->qdisc_sleeping);
561561 spin_lock_bh(qdisc_lock(qdisc));
562562
563563 gnet_stats_add_basic(&sch->bstats, qdisc->cpu_bstats,
@@ -604,7 +604,7 @@ static struct Qdisc *mqprio_leaf(struct Qdisc *sch, unsigned long cl) · 40 unmodified lines
604604 if (!dev_queue)
605605 return NULL;
606606
607− return dev_queue->qdisc_sleeping;
607+ return rtnl_dereference(dev_queue->qdisc_sleeping);
608608 }
609609
610610 static unsigned long mqprio_find(struct Qdisc *sch, u32 classid)
@@ -637,7 +637,7 @@ static int mqprio_dump_class(struct Qdisc *sch, unsigned long cl, · 26 unmodified lines
637637 tcm->tcm_parent = (tc < 0) ? 0 :
638638 TC_H_MAKE(TC_H_MAJ(sch->handle),
639639 TC_H_MIN(tc + TC_H_MIN_PRIORITY));
640− tcm->tcm_info = dev_queue->qdisc_sleeping->handle;
640+ tcm->tcm_info = rtnl_dereference(dev_queue->qdisc_sleeping)->handle;
641641 } else {
642642 tcm->tcm_parent = TC_H_ROOT;
643643 tcm->tcm_info = 0;
@@ -693,7 +693,7 @@ static int mqprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, · 49 unmodified lines
693693 } else {
694694 struct netdev_queue *dev_queue = mqprio_queue_get(sch, cl);
695695
696− sch = dev_queue->qdisc_sleeping;
696+ sch = rtnl_dereference(dev_queue->qdisc_sleeping);
697697 if (gnet_stats_copy_basic(d, sch->cpu_bstats,
698698 &sch->bstats, true) < 0 ||
699699 qdisc_qstats_copy(d, sch) < 0)
net/sched/sch_pie.c+4−1
@@ -421,8 +421,10 @@ static void pie_timer(struct timer_list *t) · 420 unmodified lines
421421 {
422422 struct pie_sched_data *q = from_timer(q, t, adapt_timer);
423423 struct Qdisc *sch = q->sch;
424− spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch));
424+ spinlock_t *root_lock;
425425
426+ rcu_read_lock();
427+ root_lock = qdisc_lock(qdisc_root_sleeping(sch));
426428 spin_lock(root_lock);
427429 pie_calculate_probability(&q->params, &q->vars, sch->qstats.backlog);
428430
@@ -430,6 +432,7 @@ static void pie_timer(struct timer_list *t) · 1 unmodified line
430432 if (q->params.tupdate)
431433 mod_timer(&q->adapt_timer, jiffies + q->params.tupdate);
432434 spin_unlock(root_lock);
435+ rcu_read_unlock();
433436 }
434437
435438 static int pie_init(struct Qdisc *sch, struct nlattr *opt,
net/sched/sch_red.c+4−1
@@ -321,12 +321,15 @@ static inline void red_adaptative_timer(struct timer_list *t) · 320 unmodified lines
321321 {
322322 struct red_sched_data *q = from_timer(q, t, adapt_timer);
323323 struct Qdisc *sch = q->sch;
324− spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch));
324+ spinlock_t *root_lock;
325325
326+ rcu_read_lock();
327+ root_lock = qdisc_lock(qdisc_root_sleeping(sch));
326328 spin_lock(root_lock);
327329 red_adaptative_algo(&q->parms, &q->vars);
328330 mod_timer(&q->adapt_timer, jiffies + HZ/2);
329331 spin_unlock(root_lock);
332+ rcu_read_unlock();
330333 }
331334
332335 static int red_init(struct Qdisc *sch, struct nlattr *opt,
net/sched/sch_sfq.c+4−1
@@ -606,10 +606,12 @@ static void sfq_perturbation(struct timer_list *t) · 605 unmodified lines
606606 {
607607 struct sfq_sched_data *q = from_timer(q, t, perturb_timer);
608608 struct Qdisc *sch = q->sch;
609− spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch));
609+ spinlock_t *root_lock;
610610 siphash_key_t nkey;
611611
612612 get_random_bytes(&nkey, sizeof(nkey));
613+ rcu_read_lock();
614+ root_lock = qdisc_lock(qdisc_root_sleeping(sch));
613615 spin_lock(root_lock);
614616 q->perturbation = nkey;
615617 if (!q->filter_list && q->tail)
@@ -618,6 +620,7 @@ static void sfq_perturbation(struct timer_list *t) · 2 unmodified lines
618620
619621 if (q->perturb_period)
620622 mod_timer(&q->perturb_timer, jiffies + q->perturb_period);
623+ rcu_read_unlock();
621624 }
622625
623626 static int sfq_change(struct Qdisc *sch, struct nlattr *opt)
net/sched/sch_taprio.c+4−3
@@ -2426,7 +2426,7 @@ static struct Qdisc *taprio_leaf(struct Qdisc *sch, unsigned long cl) · 2425 unmodified lines
24262426 if (!dev_queue)
24272427 return NULL;
24282428
2429− return dev_queue->qdisc_sleeping;
2429+ return rtnl_dereference(dev_queue->qdisc_sleeping);
24302430 }
24312431
24322432 static unsigned long taprio_find(struct Qdisc *sch, u32 classid)
@@ -2445,7 +2445,7 @@ static int taprio_dump_class(struct Qdisc *sch, unsigned long cl, · 12 unmodified lines
24452445
24462446 tcm->tcm_parent = TC_H_ROOT;
24472447 tcm->tcm_handle |= TC_H_MIN(cl);
2448− tcm->tcm_info = dev_queue->qdisc_sleeping->handle;
2448+ tcm->tcm_info = rtnl_dereference(dev_queue->qdisc_sleeping)->handle;
24492449
24502450 return 0;
24512451 }
@@ -2456,14 +2456,15 @@ static int taprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, · 4 unmodified lines
24562456 __acquires(d->lock)
24572457 {
24582458 struct netdev_queue *dev_queue = taprio_queue_get(sch, cl);
2459− struct Qdisc *child = dev_queue->qdisc_sleeping;
24602459 struct tc_taprio_qopt_offload offload = {
24612460 .cmd = TAPRIO_CMD_TC_STATS,
24622461 .tc_stats = {
24632462 .tc = cl - 1,
24642463 },
24652464 };
2465+ struct Qdisc *child;
24662466
2467+ child = rtnl_dereference(dev_queue->qdisc_sleeping);
24672468 if (gnet_stats_copy_basic(d, NULL, &child->bstats, true) < 0 ||
24682469 qdisc_qstats_copy(d, child) < 0)
24692470 return -1;
net/sched/sch_teql.c+1−1
@@ -297,7 +297,7 @@ restart: · 296 unmodified lines
297297 struct net_device *slave = qdisc_dev(q);
298298 struct netdev_queue *slave_txq = netdev_get_tx_queue(slave, 0);
299299
300− if (slave_txq->qdisc_sleeping != q)
300+ if (rcu_access_pointer(slave_txq->qdisc_sleeping) != q)
301301 continue;
302302 if (netif_xmit_stopped(netdev_get_tx_queue(slave, subq)) ||
303303 !netif_running(slave)) {
net/smc/smc_llc.c+2−2
@@ -851,6 +851,8 @@ static int smc_llc_add_link_cont(struct smc_link *link, · 850 unmodified lines
851851 addc_llc->num_rkeys = *num_rkeys_todo;
852852 n = *num_rkeys_todo;
853853 for (i = 0; i < min_t(u8, n, SMC_LLC_RKEYS_PER_CONT_MSG); i++) {
854+ while (*buf_pos && !(*buf_pos)->used)
855+ *buf_pos = smc_llc_get_next_rmb(lgr, buf_lst, *buf_pos);
854856 if (!*buf_pos) {
855857 addc_llc->num_rkeys = addc_llc->num_rkeys -
856858 *num_rkeys_todo;
@@ -867,8 +869,6 @@ static int smc_llc_add_link_cont(struct smc_link *link, · 10 unmodified lines
867869
868870 (*num_rkeys_todo)--;
869871 *buf_pos = smc_llc_get_next_rmb(lgr, buf_lst, *buf_pos);
870− while (*buf_pos && !(*buf_pos)->used)
871− *buf_pos = smc_llc_get_next_rmb(lgr, buf_lst, *buf_pos);
872872 }
873873 addc_llc->hd.common.llc_type = SMC_LLC_ADD_LINK_CONT;
874874 addc_llc->hd.length = sizeof(struct smc_llc_msg_add_link_cont);
net/sunrpc/svcsock.c+6−18
@@ -1480,25 +1480,10 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, · 1479 unmodified lines
14801480 return svsk;
14811481 }
14821482
1483−bool svc_alien_sock(struct net *net, int fd)
1484−{
1485− int err;
1486− struct socket *sock = sockfd_lookup(fd, &err);
1487− bool ret = false;
1488−
1489− if (!sock)
1490− goto out;
1491− if (sock_net(sock->sk) != net)
1492− ret = true;
1493− sockfd_put(sock);
1494−out:
1495− return ret;
1496−}
1497−EXPORT_SYMBOL_GPL(svc_alien_sock);
1498−
14991483 /**
15001484 * svc_addsock - add a listener socket to an RPC service
15011485 * @serv: pointer to RPC service to which to add a new listener
1486+ * @net: caller's network namespace
15021487 * @fd: file descriptor of the new listener
15031488 * @name_return: pointer to buffer to fill in with name of listener
15041489 * @len: size of the buffer
@@ -1508,8 +1493,8 @@ EXPORT_SYMBOL_GPL(svc_alien_sock); · 3 unmodified lines
15081493 * Name is terminated with '\n'. On error, returns a negative errno
15091494 * value.
15101495 */
1511−int svc_addsock(struct svc_serv *serv, const int fd, char *name_return,
1512− const size_t len, const struct cred *cred)
1496+int svc_addsock(struct svc_serv *serv, struct net *net, const int fd,
1497+ char *name_return, const size_t len, const struct cred *cred)
15131498 {
15141499 int err = 0;
15151500 struct socket *so = sockfd_lookup(fd, &err);
@@ -1520,6 +1505,9 @@ int svc_addsock(struct svc_serv *serv, const int fd, char *name_return, · 4 unmodified lines
15201505
15211506 if (!so)
15221507 return err;
1508+ err = -EINVAL;
1509+ if (sock_net(so->sk) != net)
1510+ goto out;
15231511 err = -EAFNOSUPPORT;
15241512 if ((so->sk->sk_family != PF_INET) && (so->sk->sk_family != PF_INET6))
15251513 goto out;
net/wireless/core.c+2−2
@@ -368,12 +368,12 @@ static void cfg80211_sched_scan_stop_wk(struct work_struct *work) · 367 unmodified lines
368368 rdev = container_of(work, struct cfg80211_registered_device,
369369 sched_scan_stop_wk);
370370
371− rtnl_lock();
371+ wiphy_lock(&rdev->wiphy);
372372 list_for_each_entry_safe(req, tmp, &rdev->sched_scan_req_list, list) {
373373 if (req->nl_owner_dead)
374374 cfg80211_stop_sched_scan_req(rdev, req, false);
375375 }
376− rtnl_unlock();
376+ wiphy_unlock(&rdev->wiphy);
377377 }
378378
379379 static void cfg80211_propagate_radar_detect_wk(struct work_struct *work)
net/wireless/nl80211.c+2−0
@@ -10723,6 +10723,8 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) · 10722 unmodified lines
1072310723 if (!info->attrs[NL80211_ATTR_MLD_ADDR])
1072410724 return -EINVAL;
1072510725 req.ap_mld_addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]);
10726+ if (!is_valid_ether_addr(req.ap_mld_addr))
10727+ return -EINVAL;
1072610728 }
1072710729
1072810730 req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len,
net/wireless/reg.c+2−2
@@ -2440,11 +2440,11 @@ static void reg_leave_invalid_chans(struct wiphy *wiphy) · 2439 unmodified lines
24402440 struct wireless_dev *wdev;
24412441 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
24422442
2443− ASSERT_RTNL();
2444−
2443+ wiphy_lock(wiphy);
24452444 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list)
24462445 if (!reg_wdev_chan_valid(wiphy, wdev))
24472446 cfg80211_leave(rdev, wdev);
2447+ wiphy_unlock(wiphy);
24482448 }
24492449
24502450 static void reg_check_chans_work(struct work_struct *work)
security/selinux/Makefile+5−1
@@ -26,5 +26,9 @@ quiet_cmd_flask = GEN $(obj)/flask.h $(obj)/av_permissions.h · 25 unmodified lines
2626 cmd_flask = $< $(obj)/flask.h $(obj)/av_permissions.h
2727
2828 targets += flask.h av_permissions.h
29−$(obj)/flask.h $(obj)/av_permissions.h &: scripts/selinux/genheaders/genheaders FORCE
29+# once make >= 4.3 is required, we can use grouped targets in the rule below,
30+# which basically involves adding both headers and a '&' before the colon, see
31+# the example below:
32+# $(obj)/flask.h $(obj)/av_permissions.h &: scripts/selinux/...
33+$(obj)/flask.h: scripts/selinux/genheaders/genheaders FORCE
3034 $(call if_changed,flask)
tools/include/uapi/linux/bpf.h+1−0
@@ -1035,6 +1035,7 @@ enum bpf_attach_type { · 1034 unmodified lines
10351035 BPF_TRACE_KPROBE_MULTI,
10361036 BPF_LSM_CGROUP,
10371037 BPF_STRUCT_OPS,
1038+ BPF_NETFILTER,
10381039 __MAX_BPF_ATTACH_TYPE
10391040 };
10401041
tools/lib/bpf/libbpf.c+2−1
@@ -117,6 +117,7 @@ static const char * const attach_type_name[] = { · 116 unmodified lines
117117 [BPF_PERF_EVENT] = "perf_event",
118118 [BPF_TRACE_KPROBE_MULTI] = "trace_kprobe_multi",
119119 [BPF_STRUCT_OPS] = "struct_ops",
120+ [BPF_NETFILTER] = "netfilter",
120121 };
121122
122123 static const char * const link_type_name[] = {
@@ -8736,7 +8737,7 @@ static const struct bpf_sec_def section_defs[] = { · 8613 unmodified lines
87368737 SEC_DEF("struct_ops+", STRUCT_OPS, 0, SEC_NONE),
87378738 SEC_DEF("struct_ops.s+", STRUCT_OPS, 0, SEC_SLEEPABLE),
87388739 SEC_DEF("sk_lookup", SK_LOOKUP, BPF_SK_LOOKUP, SEC_ATTACHABLE),
8739− SEC_DEF("netfilter", NETFILTER, 0, SEC_NONE),
8740+ SEC_DEF("netfilter", NETFILTER, BPF_NETFILTER, SEC_NONE),
87408741 };
87418742
87428743 static size_t custom_sec_def_cnt;
tools/lib/bpf/libbpf_probes.c+2−0
@@ -180,7 +180,9 @@ static int probe_prog_load(enum bpf_prog_type prog_type, · 179 unmodified lines
180180 case BPF_PROG_TYPE_SK_REUSEPORT:
181181 case BPF_PROG_TYPE_FLOW_DISSECTOR:
182182 case BPF_PROG_TYPE_CGROUP_SYSCTL:
183+ break;
183184 case BPF_PROG_TYPE_NETFILTER:
185+ opts.expected_attach_type = BPF_NETFILTER;
184186 break;
185187 default:
186188 return -EOPNOTSUPP;
tools/testing/selftests/bpf/prog_tests/inner_array_lookup.c+31−0
@@ -0,0 +1,31 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+
3+#include <test_progs.h>
4+
5+#include "inner_array_lookup.skel.h"
6+
7+void test_inner_array_lookup(void)
8+{
9+ int map1_fd, err;
10+ int key = 3;
11+ int val = 1;
12+ struct inner_array_lookup *skel;
13+
14+ skel = inner_array_lookup__open_and_load();
15+ if (!ASSERT_OK_PTR(skel, "open_load_skeleton"))
16+ return;
17+
18+ err = inner_array_lookup__attach(skel);
19+ if (!ASSERT_OK(err, "skeleton_attach"))
20+ goto cleanup;
21+
22+ map1_fd = bpf_map__fd(skel->maps.inner_map1);
23+ bpf_map_update_elem(map1_fd, &key, &val, 0);
24+
25+ /* Probe should have set the element at index 3 to 2 */
26+ bpf_map_lookup_elem(map1_fd, &key, &val);
27+ ASSERT_EQ(val, 2, "value_is_2");
28+
29+cleanup:
30+ inner_array_lookup__destroy(skel);
31+}
tools/testing/selftests/bpf/prog_tests/sockopt_sk.c+1−1
@@ -209,7 +209,7 @@ static int getsetsockopt(void) · 208 unmodified lines
209209 err, errno);
210210 goto err;
211211 }
212− ASSERT_EQ(optlen, 4, "Unexpected NETLINK_LIST_MEMBERSHIPS value");
212+ ASSERT_EQ(optlen, 8, "Unexpected NETLINK_LIST_MEMBERSHIPS value");
213213
214214 free(big_buf);
215215 close(fd);
tools/testing/selftests/bpf/progs/inner_array_lookup.c+45−0
@@ -0,0 +1,45 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+
3+#include <linux/bpf.h>
4+#include <bpf/bpf_helpers.h>
5+
6+struct inner_map {
7+ __uint(type, BPF_MAP_TYPE_ARRAY);
8+ __uint(max_entries, 5);
9+ __type(key, int);
10+ __type(value, int);
11+} inner_map1 SEC(".maps");
12+
13+struct outer_map {
14+ __uint(type, BPF_MAP_TYPE_HASH_OF_MAPS);
15+ __uint(max_entries, 3);
16+ __type(key, int);
17+ __array(values, struct inner_map);
18+} outer_map1 SEC(".maps") = {
19+ .values = {
20+ [2] = &inner_map1,
21+ },
22+};
23+
24+SEC("raw_tp/sys_enter")
25+int handle__sys_enter(void *ctx)
26+{
27+ int outer_key = 2, inner_key = 3;
28+ int *val;
29+ void *map;
30+
31+ map = bpf_map_lookup_elem(&outer_map1, &outer_key);
32+ if (!map)
33+ return 1;
34+
35+ val = bpf_map_lookup_elem(map, &inner_key);
36+ if (!val)
37+ return 1;
38+
39+ if (*val == 1)
40+ *val = 2;
41+
42+ return 0;
43+}
44+
45+char _license[] SEC("license") = "GPL";
tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc+27−18
@@ -9,18 +9,33 @@ fail() { #msg · 8 unmodified lines
99 exit_fail
1010 }
1111
12−echo "Test event filter function name"
12+sample_events() {
13+ echo > trace
14+ echo 1 > events/kmem/kmem_cache_free/enable
15+ echo 1 > tracing_on
16+ ls > /dev/null
17+ echo 0 > tracing_on
18+ echo 0 > events/kmem/kmem_cache_free/enable
19+}
20+
1321 echo 0 > tracing_on
1422 echo 0 > events/enable
23+
24+echo "Get the most frequently calling function"
25+sample_events
26+
27+target_func=`cut -d: -f3 trace | sed 's/call_site=\([^+]*\)+0x.*/\1/' | sort | uniq -c | sort | tail -n 1 | sed 's/^[ 0-9]*//'`
28+if [ -z "$target_func" ]; then
29+ exit_fail
30+fi
1531 echo > trace
16−echo 'call_site.function == exit_mmap' > events/kmem/kmem_cache_free/filter
17−echo 1 > events/kmem/kmem_cache_free/enable
18−echo 1 > tracing_on
19−ls > /dev/null
20−echo 0 > events/kmem/kmem_cache_free/enable
2132
22−hitcnt=`grep kmem_cache_free trace| grep exit_mmap | wc -l`
23−misscnt=`grep kmem_cache_free trace| grep -v exit_mmap | wc -l`
33+echo "Test event filter function name"
34+echo "call_site.function == $target_func" > events/kmem/kmem_cache_free/filter
35+sample_events
36+
37+hitcnt=`grep kmem_cache_free trace| grep $target_func | wc -l`
38+misscnt=`grep kmem_cache_free trace| grep -v $target_func | wc -l`
2439
2540 if [ $hitcnt -eq 0 ]; then
2641 exit_fail
@@ -30,20 +45,14 @@ if [ $misscnt -gt 0 ]; then · 3 unmodified lines
3045 exit_fail
3146 fi
3247
33−address=`grep ' exit_mmap$' /proc/kallsyms | cut -d' ' -f1`
48+address=`grep " ${target_func}\$" /proc/kallsyms | cut -d' ' -f1`
3449
3550 echo "Test event filter function address"
36−echo 0 > tracing_on
37−echo 0 > events/enable
38−echo > trace
3951 echo "call_site.function == 0x$address" > events/kmem/kmem_cache_free/filter
40−echo 1 > events/kmem/kmem_cache_free/enable
41−echo 1 > tracing_on
42−sleep 1
43−echo 0 > events/kmem/kmem_cache_free/enable
52+sample_events
4453
45−hitcnt=`grep kmem_cache_free trace| grep exit_mmap | wc -l`
46−misscnt=`grep kmem_cache_free trace| grep -v exit_mmap | wc -l`
54+hitcnt=`grep kmem_cache_free trace| grep $target_func | wc -l`
55+misscnt=`grep kmem_cache_free trace| grep -v $target_func | wc -l`
4756
4857 if [ $hitcnt -eq 0 ]; then
4958 exit_fail
tools/testing/selftests/kvm/Makefile+1−0
@@ -116,6 +116,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/sev_migrate_tests · 115 unmodified lines
116116 TEST_GEN_PROGS_x86_64 += x86_64/amx_test
117117 TEST_GEN_PROGS_x86_64 += x86_64/max_vcpuid_cap_test
118118 TEST_GEN_PROGS_x86_64 += x86_64/triple_fault_event_test
119+TEST_GEN_PROGS_x86_64 += x86_64/recalc_apic_map_test
119120 TEST_GEN_PROGS_x86_64 += access_tracking_perf_test
120121 TEST_GEN_PROGS_x86_64 += demand_paging_test
121122 TEST_GEN_PROGS_x86_64 += dirty_log_test
tools/testing/selftests/kvm/x86_64/recalc_apic_map_test.c+74−0
@@ -0,0 +1,74 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+/*
3+ * Test edge cases and race conditions in kvm_recalculate_apic_map().
4+ */
5+
6+#include <sys/ioctl.h>
7+#include <pthread.h>
8+#include <time.h>
9+
10+#include "processor.h"
11+#include "test_util.h"
12+#include "kvm_util.h"
13+#include "apic.h"
14+
15+#define TIMEOUT 5 /* seconds */
16+
17+#define LAPIC_DISABLED 0
18+#define LAPIC_X2APIC (MSR_IA32_APICBASE_ENABLE | X2APIC_ENABLE)
19+#define MAX_XAPIC_ID 0xff
20+
21+static void *race(void *arg)
22+{
23+ struct kvm_lapic_state lapic = {};
24+ struct kvm_vcpu *vcpu = arg;
25+
26+ while (1) {
27+ /* Trigger kvm_recalculate_apic_map(). */
28+ vcpu_ioctl(vcpu, KVM_SET_LAPIC, &lapic);
29+ pthread_testcancel();
30+ }
31+
32+ return NULL;
33+}
34+
35+int main(void)
36+{
37+ struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
38+ struct kvm_vcpu *vcpuN;
39+ struct kvm_vm *vm;
40+ pthread_t thread;
41+ time_t t;
42+ int i;
43+
44+ kvm_static_assert(KVM_MAX_VCPUS > MAX_XAPIC_ID);
45+
46+ /*
47+ * Create the max number of vCPUs supported by selftests so that KVM
48+ * has decent amount of work to do when recalculating the map, i.e. to
49+ * make the problematic window large enough to hit.
50+ */
51+ vm = vm_create_with_vcpus(KVM_MAX_VCPUS, NULL, vcpus);
52+
53+ /*
54+ * Enable x2APIC on all vCPUs so that KVM doesn't bail from the recalc
55+ * due to vCPUs having aliased xAPIC IDs (truncated to 8 bits).
56+ */
57+ for (i = 0; i < KVM_MAX_VCPUS; i++)
58+ vcpu_set_msr(vcpus[i], MSR_IA32_APICBASE, LAPIC_X2APIC);
59+
60+ ASSERT_EQ(pthread_create(&thread, NULL, race, vcpus[0]), 0);
61+
62+ vcpuN = vcpus[KVM_MAX_VCPUS - 1];
63+ for (t = time(NULL) + TIMEOUT; time(NULL) < t;) {
64+ vcpu_set_msr(vcpuN, MSR_IA32_APICBASE, LAPIC_X2APIC);
65+ vcpu_set_msr(vcpuN, MSR_IA32_APICBASE, LAPIC_DISABLED);
66+ }
67+
68+ ASSERT_EQ(pthread_cancel(thread), 0);
69+ ASSERT_EQ(pthread_join(thread, NULL), 0);
70+
71+ kvm_vm_free(vm);
72+
73+ return 0;
74+}
tools/testing/selftests/net/.gitignore+3−0
@@ -8,8 +8,10 @@ diag_uid · 7 unmodified lines
88 fin_ack_lat
99 gro
1010 hwtstamp_config
11+io_uring_zerocopy_tx
1112 ioam6_parser
1213 ip_defrag
14+ip_local_port_range
1315 ipsec
1416 ipv6_flowlabel
1517 ipv6_flowlabel_mgr
@@ -26,6 +28,7 @@ reuseport_bpf_cpu · 10 unmodified lines
2628 reuseport_bpf_numa
2729 reuseport_dualstack
2830 rxtimestamp
31+sctp_hello
2932 sk_bind_sendto_listen
3033 sk_connect_zero_addr
3134 socket
tools/testing/selftests/net/mptcp/mptcp_join.sh+10−1
@@ -867,7 +867,15 @@ do_transfer() · 866 unmodified lines
867867 sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q')
868868 ip netns exec ${listener_ns} ./pm_nl_ctl ann $addr token $tk id $id
869869 sleep 1
870+ sp=$(grep "type:10" "$evts_ns1" |
871+ sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
872+ da=$(grep "type:10" "$evts_ns1" |
873+ sed -n 's/.*\(daddr6:\)\([0-9a-f:.]*\).*$/\2/p;q')
874+ dp=$(grep "type:10" "$evts_ns1" |
875+ sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q')
870876 ip netns exec ${listener_ns} ./pm_nl_ctl rem token $tk id $id
877+ ip netns exec ${listener_ns} ./pm_nl_ctl dsf lip "::ffff:$addr" \
878+ lport $sp rip $da rport $dp token $tk
871879 fi
872880
873881 counter=$((counter + 1))
@@ -933,6 +941,7 @@ do_transfer() · 59 unmodified lines
933941 sleep 1
934942 sp=$(grep "type:10" "$evts_ns2" |
935943 sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
944+ ip netns exec ${connector_ns} ./pm_nl_ctl rem token $tk id $id
936945 ip netns exec ${connector_ns} ./pm_nl_ctl dsf lip $addr lport $sp \
937946 rip $da rport $dp token $tk
938947 fi
@@ -3148,7 +3157,7 @@ userspace_tests() · 2209 unmodified lines
31483157 pm_nl_set_limits $ns1 0 1
31493158 run_tests $ns1 $ns2 10.0.1.1 0 0 userspace_1 slow
31503159 chk_join_nr 1 1 1
3151− chk_rm_nr 0 1
3160+ chk_rm_nr 1 1
31523161 kill_events_pids
31533162 fi
31543163 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t