History

Merge branch 'for-linus' into for-next

Pull 7.2 devel branch for put_device auto-clean fixes.

Takashi Iwai committed 3 months ago

Commit 78fbf082 parents 6bd8a57 c973e61603 files · +6721 −2503Browse files

Unified · Split

603 files
  1. .mailmap +9 −4
  2. Documentation/ABI/testing/sysfs-kernel-mm-damon +87 −87
  3. Documentation/devicetree/bindings/sound/realtek,rt5640.yaml +0 −1
  4. Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml +5 −1
  5. Documentation/netlink/specs/rt-link.yaml +20 −20
  6. Documentation/watchdog/watchdog-parameters.rst +2 −2
  7. MAINTAINERS +10 −7
  8. Makefile +6 −1
  9. arch/arm64/include/asm/esr.h +1 −1
  10. arch/arm64/include/asm/fixmap.h +5 −1
  11. arch/arm64/include/asm/kprobes.h +6 −0
  12. arch/arm64/kernel/probes/kprobes.c +44 −1
  13. arch/arm64/mm/fault.c +4 −3
  14. arch/arm64/mm/hugetlbpage.c +1 −1
  15. arch/arm64/mm/mmu.c +1 −1
  16. arch/loongarch/include/asm/asmmacro.h +1 −1
  17. arch/loongarch/kernel/acpi.c +26 −1
  18. arch/loongarch/kernel/kgdb.c +2 −1
  19. arch/loongarch/kernel/machine_kexec.c +4 −1
  20. arch/loongarch/kernel/rethook_trampoline.S +9 −9
  21. arch/loongarch/kernel/setup.c +1 −2
  22. arch/loongarch/kernel/smp.c +2 −2
  23. arch/loongarch/net/bpf_jit.c +5 −4
  24. arch/m68k/coldfire/m528x.c +1 −1
  25. arch/m68k/include/asm/page_mm.h +2 −0
  26. arch/riscv/include/asm/kvm_host.h +5 −5
  27. arch/riscv/kvm/aia.c +28 −7
  28. arch/riscv/kvm/gstage.c +5 −1
  29. arch/riscv/kvm/mmu.c +2 −1
  30. arch/riscv/kvm/vcpu.c +48 −20
  31. arch/riscv/kvm/vcpu_exit.c +19 −0
  32. arch/riscv/kvm/vcpu_onereg.c +12 −34
  33. arch/riscv/kvm/vcpu_pmu.c +2 −2
  34. arch/riscv/kvm/vcpu_sbi_fwft.c +4 −2
  35. arch/riscv/kvm/vcpu_vector.c +12 −2
  36. arch/s390/kernel/time.c +1 −0
  37. arch/x86/boot/compressed/Makefile +1 −0
  38. arch/x86/kvm/lapic.c +1 −1
  39. arch/x86/kvm/mmu/mmu.c +8 −4
  40. arch/x86/kvm/mmu/paging_tmpl.h +6 −4
  41. arch/x86/kvm/vmx/nested.c +9 −2
  42. drivers/accel/amdxdna/aie2_ctx.c +18 −8
  43. drivers/accel/amdxdna/aie2_pci.c +1 −0
  44. drivers/accel/amdxdna/aie2_pci.h +1 −6
  45. drivers/accel/ethosu/ethosu_gem.c +36 −18
  46. drivers/android/binder/thread.rs +7 −7
  47. drivers/block/rbd.c +6 −1
  48. drivers/block/ublk_drv.c +30 −17
  49. drivers/bluetooth/btusb.c +3 −1
  50. drivers/cdrom/cdrom.c +1 −0
  51. drivers/comedi/drivers/comedi_parport.c +10 −3
  52. drivers/firewire/net.c +21 −18
  53. drivers/firmware/stratix10-svc.c +11 −8
  54. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 −1
  55. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +11 −2
  56. drivers/gpu/drm/drm_gpusvm.c +4 −2
  57. drivers/gpu/drm/drm_pagemap.c +8 −3
  58. drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c +16 −5
  59. drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +1 −6
  60. drivers/gpu/drm/imagination/pvr_vm.c +2 −0
  61. drivers/gpu/drm/panel/Kconfig +3 −0
  62. drivers/gpu/drm/panel/panel-ilitek-ili9881c.c +5 −2
  63. drivers/gpu/drm/tests/drm_gem_shmem_test.c +10 −6
  64. drivers/gpu/drm/tiny/appletbdrm.c +30 −23
  65. drivers/gpu/drm/ttm/ttm_backup.c +85 −44
  66. drivers/gpu/drm/ttm/ttm_pool.c +74 −15
  67. drivers/gpu/drm/ttm/ttm_pool_internal.h +8 −0
  68. drivers/gpu/drm/v3d/v3d_drv.h +2 −0
  69. drivers/gpu/drm/v3d/v3d_gem.c +14 −2
  70. drivers/gpu/drm/v3d/v3d_power.c +7 −0
  71. drivers/gpu/drm/vc4/vc4_bo.c +8 −4
  72. drivers/gpu/drm/vc4/vc4_hvs.c +1 −1
  73. drivers/gpu/drm/vc4/vc4_v3d.c +1 −1
  74. drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +17 −5
  75. drivers/gpu/drm/xe/xe_i2c.c +4 −1
  76. drivers/gpu/drm/xe/xe_migrate.c +10 −6
  77. drivers/gpu/drm/xe/xe_migrate.h +2 −1
  78. drivers/gpu/drm/xe/xe_sriov_vf_ccs.c +12 −2
  79. drivers/gpu/drm/xe/xe_vm.c +4 −4
  80. drivers/gpu/drm/xe/xe_vm_madvise.c +17 −2
  81. drivers/hwmon/asus-ec-sensors.c +10 −8
  82. drivers/hwmon/corsair-cpro.c +1 −0
  83. drivers/hwmon/corsair-psu.c +1 −0
  84. drivers/hwmon/gigabyte_waterforce.c +3 −1
  85. drivers/hwmon/nzxt-kraken3.c +4 −2
  86. drivers/hwmon/nzxt-smart2.c +1 −1
  87. drivers/hwmon/occ/common.c +30 −8
  88. drivers/hwmon/pmbus/max34440.c +80 −0
  89. drivers/hwtracing/intel_th/core.c +0 −10
  90. drivers/hwtracing/intel_th/msu.c +2 −0
  91. drivers/infiniband/hw/bng_re/bng_dev.c +3 −3
  92. drivers/iommu/amd/init.c +6 −0
  93. drivers/iommu/amd/iommu.c +16 −6
  94. drivers/iommu/amd/nested.c +19 −15
  95. drivers/iommu/intel/perf.c +1 −1
  96. drivers/iommu/intel/svm.c +1 −1
  97. drivers/misc/mei/bus.c +9 −7
  98. drivers/misc/nsm.c +2 −1
  99. drivers/net/amt.c +74 −27
  100. drivers/net/bonding/bond_main.c +2 −1
  101. drivers/net/ethernet/airoha/airoha_eth.c +106 −68
  102. drivers/net/ethernet/airoha/airoha_eth.h +27 −0
  103. drivers/net/ethernet/airoha/airoha_npu.c +2 −2
  104. drivers/net/ethernet/airoha/airoha_ppe.c +1 −0
  105. drivers/net/ethernet/amd/pds_core/adminq.c +11 −1
  106. drivers/net/ethernet/amd/pds_core/auxbus.c +14 −3
  107. drivers/net/ethernet/amd/pds_core/core.c +15 −7
  108. drivers/net/ethernet/amd/pds_core/devlink.c +6 −0
  109. drivers/net/ethernet/amd/pds_core/main.c +10 −4
  110. drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +8 −3
  111. drivers/net/ethernet/broadcom/bnge/bnge.h +1 −0
  112. drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c +4 −4
  113. drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.h +1 −1
  114. drivers/net/ethernet/broadcom/bnge/bnge_netdev.c +24 −26
  115. drivers/net/ethernet/broadcom/bnge/bnge_netdev.h +2 −2
  116. drivers/net/ethernet/broadcom/bnge/bnge_rmem.h +1 −1
  117. drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +1 −0
  118. drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +1 −0
  119. drivers/net/ethernet/freescale/fman/fman_dtsec.c +12 −5
  120. drivers/net/ethernet/google/gve/gve.h +3 −0
  121. drivers/net/ethernet/google/gve/gve_rx_dqo.c +34 −0
  122. drivers/net/ethernet/hisilicon/hip04_eth.c +8 −3
  123. drivers/net/ethernet/huawei/hinic/hinic_dev.h +0 −2
  124. drivers/net/ethernet/huawei/hinic/hinic_ethtool.c +0 −21
  125. drivers/net/ethernet/intel/ice/ice.h +3 −0
  126. drivers/net/ethernet/intel/ice/ice_eswitch.c +0 −3
  127. drivers/net/ethernet/intel/ice/ice_lag.c +1 −1
  128. drivers/net/ethernet/intel/ice/ice_parser.c +3 −0
  129. drivers/net/ethernet/intel/ice/ice_ptp.c +6 −1
  130. drivers/net/ethernet/intel/ice/ice_sriov.c +8 −6
  131. drivers/net/ethernet/intel/ice/ice_txrx.c +9 −11
  132. drivers/net/ethernet/intel/ice/ice_vf_lib.c +2 −1
  133. drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +6 −1
  134. drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +1 −0
  135. drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +16 −13
  136. drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +15 −0
  137. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 −2
  138. drivers/net/ethernet/mellanox/mlx5/core/esw/acl/helper.c +1 −1
  139. drivers/net/ethernet/mellanox/mlx5/core/port.c +2 −2
  140. drivers/net/ethernet/netronome/nfp/nfpcore/nfp_resource.c +3 −0
  141. drivers/net/ethernet/realtek/rtase/rtase.h +8 −0
  142. drivers/net/ethernet/realtek/rtase/rtase_main.c +197 −0
  143. drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +31 −0
  144. drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +24 −0
  145. drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +16 −12
  146. drivers/net/ethernet/stmicro/stmmac/hwif.h +4 −0
  147. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +41 −55
  148. drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +35 −0
  149. drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c +4 −2
  150. drivers/net/ethernet/wangxun/txgbe/txgbe_main.c +1 −0
  151. drivers/net/geneve.c +24 −3
  152. drivers/net/gtp.c +9 −8
  153. drivers/net/mctp/mctp-i3c.c +7 −4
  154. drivers/net/mctp/mctp-serial.c +1 −1
  155. drivers/net/ovpn/io.c +2 −2
  156. drivers/net/ovpn/peer.c +9 −7
  157. drivers/net/ovpn/tcp.c +4 −2
  158. drivers/net/pcs/pcs-xpcs.c +7 −25
  159. drivers/net/phy/marvell.c +1 −1
  160. drivers/net/ppp/ppp_generic.c +44 −38
  161. drivers/net/ppp/pppoe.c +1 −0
  162. drivers/net/slip/slip.c +4 −0
  163. drivers/net/vmxnet3/vmxnet3_drv.c +16 −6
  164. drivers/net/vxlan/vxlan_core.c +3 −0
  165. drivers/net/vxlan/vxlan_mdb.c +18 −12
  166. drivers/net/wan/wanxl.c +2 −1
  167. drivers/net/wireless/ath/ath10k/htt_rx.c +2 −0
  168. drivers/net/wireless/ath/ath11k/ahb.c +1 −0
  169. drivers/net/wireless/ath/ath11k/dp_rx.c +3 −0
  170. drivers/net/wireless/ath/ath11k/pci.c +4 −0
  171. drivers/net/wireless/ath/ath11k/qmi.c +8 −3
  172. drivers/net/wireless/ath/ath12k/dp_peer.c +9 −2
  173. drivers/net/wireless/ath/ath12k/dp_peer.h +1 −0
  174. drivers/net/wireless/ath/ath12k/dp_rx.c +3 −4
  175. drivers/net/wireless/ath/ath12k/hw.h +16 −0
  176. drivers/net/wireless/ath/ath12k/mac.c +7 −3
  177. drivers/net/wireless/ath/ath12k/pci.c +4 −0
  178. drivers/net/wireless/ath/ath12k/peer.c +3 −0
  179. drivers/net/wireless/ath/ath12k/wifi7/dp_rx.c +33 −0
  180. drivers/net/wireless/ath/ath12k/wifi7/dp_rx.h +6 −0
  181. drivers/net/wireless/ath/ath12k/wifi7/hw.c +3 −0
  182. drivers/net/wireless/ath/ath6kl/txrx.c +7 −5
  183. drivers/net/wireless/ath/ath6kl/wmi.c +20 −0
  184. drivers/net/wireless/ath/ath9k/hif_usb.c +1 −6
  185. drivers/net/wireless/ath/carl9170/rx.c +5 −2
  186. drivers/net/wireless/ath/carl9170/tx.c +1 −1
  187. drivers/net/wireless/atmel/at76c50x-usb.c +5 −2
  188. drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +14 −0
  189. drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +6 −0
  190. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +1 −1
  191. drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +42 −4
  192. drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +12 −2
  193. drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +6 −0
  194. drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h +1 −0
  195. drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +3 −0
  196. drivers/net/wireless/intel/iwlwifi/cfg/rf-pe.c +1 −0
  197. drivers/net/wireless/intel/iwlwifi/fw/acpi.c +5 −0
  198. drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h +30 −3
  199. drivers/net/wireless/intel/iwlwifi/fw/api/scan.h +2 −2
  200. drivers/net/wireless/intel/iwlwifi/fw/pnvm.c +8 −1
  201. drivers/net/wireless/intel/iwlwifi/fw/regulatory.c +1 −1
  202. drivers/net/wireless/intel/iwlwifi/fw/smem.c +23 −5
  203. drivers/net/wireless/intel/iwlwifi/fw/uefi.c +1 −1
  204. drivers/net/wireless/intel/iwlwifi/iwl-config.h +2 −0
  205. drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +11 −2
  206. drivers/net/wireless/intel/iwlwifi/iwl-drv.c +15 −3
  207. drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +41 −23
  208. drivers/net/wireless/intel/iwlwifi/mld/agg.c +6 −1
  209. drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +1 −1
  210. drivers/net/wireless/intel/iwlwifi/mld/mcc.c +8 −2
  211. drivers/net/wireless/intel/iwlwifi/mld/thermal.c +4 −5
  212. drivers/net/wireless/intel/iwlwifi/mld/tx.c +4 −0
  213. drivers/net/wireless/intel/iwlwifi/mvm/d3.c +33 −13
  214. drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +38 −17
  215. drivers/net/wireless/intel/iwlwifi/mvm/fw.c +10 −0
  216. drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +15 −10
  217. drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +2 −5
  218. drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +0 −3
  219. drivers/net/wireless/intel/iwlwifi/mvm/nvm.c +36 −7
  220. drivers/net/wireless/intel/iwlwifi/mvm/ptp.c +3 −1
  221. drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c +7 −2
  222. drivers/net/wireless/intel/iwlwifi/mvm/rx.c +5 −0
  223. drivers/net/wireless/intel/iwlwifi/mvm/scan.c +7 −3
  224. drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +5 −0
  225. drivers/net/wireless/intel/iwlwifi/mvm/tx.c +44 −1
  226. drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c +6 −1
  227. drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/rx.c +7 −2
  228. drivers/net/wireless/marvell/mwifiex/fw.h +9 −9
  229. drivers/net/wireless/marvell/mwifiex/join.c +4 −4
  230. drivers/net/wireless/marvell/mwifiex/sta_cmd.c +1 −1
  231. drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +8 −6
  232. drivers/net/wireless/marvell/mwifiex/tdls.c +1 −1
  233. drivers/net/wireless/marvell/mwifiex/uap_event.c +22 −2
  234. drivers/net/wireless/mediatek/mt76/Kconfig +2 −2
  235. drivers/net/wireless/mediatek/mt76/Makefile +5 −1
  236. drivers/net/wireless/mediatek/mt76/dma.c +4 −1
  237. drivers/net/wireless/mediatek/mt76/eeprom.c +1 −1
  238. drivers/net/wireless/mediatek/mt76/mt76.h +3 −3
  239. drivers/net/wireless/mediatek/mt76/mt7615/mac.c +6 −0
  240. drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +2 −0
  241. drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +13 −5
  242. drivers/net/wireless/mediatek/mt76/mt7921/mac.c +7 −3
  243. drivers/net/wireless/mediatek/mt76/mt7925/mac.c +10 −3
  244. drivers/net/wireless/mediatek/mt76/mt7925/main.c +3 −0
  245. drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +2 −0
  246. drivers/net/wireless/mediatek/mt76/mt7996/Kconfig +1 −1
  247. drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +13 −6
  248. drivers/net/wireless/microchip/wilc1000/hif.c +5 −0
  249. drivers/net/wireless/virtual/mac80211_hwsim_main.c +3 −3
  250. drivers/platform/loongarch/loongson-laptop.c +1 −3
  251. drivers/platform/x86/asus-wmi.c +23 −3
  252. drivers/platform/x86/intel/vsec.c +12 −5
  253. drivers/ptp/ptp_netc.c +1 −0
  254. drivers/ptp/ptp_s390.c +5 −1
  255. drivers/regulator/core.c +90 −73
  256. drivers/regulator/mt6358-regulator.c +1 −1
  257. drivers/resctrl/mpam_devices.c +22 −14
  258. drivers/spi/spi-spacemit-k1.c +2 −2
  259. drivers/staging/rtl8723bs/core/rtw_ieee80211.c +8 −1
  260. drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +1 −1
  261. drivers/tty/serial/8250/8250_mid.c +9 −5
  262. drivers/tty/serial/sc16is7xx.c +12 −0
  263. drivers/uio/uio_hv_generic.c +7 −1
  264. drivers/usb/atm/ueagle-atm.c +17 −0
  265. drivers/usb/chipidea/core.c +1 −0
  266. drivers/usb/core/port.c +2 −0
  267. drivers/usb/core/sysfs.c +7 −1
  268. drivers/usb/gadget/function/f_midi.c +1 −0
  269. drivers/usb/gadget/function/f_ncm.c +13 −4
  270. drivers/usb/gadget/function/f_printer.c +18 −5
  271. drivers/usb/gadget/function/f_tcm.c +164 −28
  272. drivers/usb/gadget/function/tcm.h +13 −0
  273. drivers/usb/gadget/function/uvc_v4l2.c +2 −0
  274. drivers/usb/gadget/udc/bdc/bdc_core.c +20 −0
  275. drivers/usb/gadget/udc/bdc/bdc_udc.c +4 −3
  276. drivers/usb/gadget/udc/dummy_hcd.c +27 −13
  277. drivers/usb/gadget/udc/fsl_udc_core.c +42 −57
  278. drivers/usb/gadget/udc/fsl_usb2_udc.h +1 −0
  279. drivers/usb/gadget/udc/pxa27x_udc.c +3 −7
  280. drivers/usb/gadget/udc/snps_udc_core.c +0 −1
  281. drivers/usb/host/xhci-pci.c +1 −0
  282. drivers/usb/host/xhci.c +10 −5
  283. drivers/usb/host/xhci.h +1 −0
  284. drivers/usb/musb/omap2430.c +0 −2
  285. drivers/usb/serial/ftdi_sio.c +2 −0
  286. drivers/usb/serial/ftdi_sio_ids.h +5 −0
  287. drivers/usb/serial/io_edgeport.c +2 −1
  288. drivers/usb/serial/io_ti.c +6 −0
  289. drivers/usb/serial/keyspan_pda.c +35 −9
  290. drivers/usb/serial/mxuport.c +7 −0
  291. drivers/usb/serial/option.c +1 −0
  292. drivers/usb/storage/unusual_devs.h +7 −0
  293. drivers/usb/typec/ucsi/ucsi.c +187 −53
  294. drivers/usb/typec/ucsi/ucsi_yoga_c630.c +0 −23
  295. drivers/vhost/net.c +5 −3
  296. drivers/virt/coco/pkvm-guest/arm-pkvm-guest.c +1 −1
  297. drivers/virtio/virtio_balloon.c +1 −4
  298. drivers/watchdog/airoha_wdt.c +3 −0
  299. drivers/watchdog/ni903x_wdt.c +6 −1
  300. drivers/watchdog/s32g_wdt.c +1 −2
  301. drivers/watchdog/watchdog_pretimeout.c +2 −0
  302. fs/afs/dir_edit.c +1 −1
  303. fs/binfmt_elf_fdpic.c +4 −0
  304. fs/binfmt_misc.c +2 −3
  305. fs/btrfs/backref.c +4 −1
  306. fs/btrfs/btrfs_inode.h +2 −0
  307. fs/btrfs/extent_io.c +2 −2
  308. fs/btrfs/extent_map.c +2 −2
  309. fs/btrfs/inode.c +2 −1
  310. fs/btrfs/ioctl.c +1 −0
  311. fs/btrfs/relocation.c +43 −12
  312. fs/btrfs/subpage.c +23 −3
  313. fs/btrfs/super.c +10 −0
  314. fs/ceph/addr.c +9 −0
  315. fs/ceph/caps.c +16 −2
  316. fs/ceph/dir.c +6 −1
  317. fs/ceph/file.c +5 −4
  318. fs/ceph/ioctl.c +6 −0
  319. fs/ceph/mds_client.c +11 −0
  320. fs/ceph/mds_client.h +1 −0
  321. fs/crypto/inline_crypt.c +20 −37
  322. fs/crypto/keysetup_v1.c +7 −1
  323. fs/eventpoll.c +17 −1
  324. fs/exec.c +1 −1
  325. fs/f2fs/super.c +14 −11
  326. fs/fat/fat.h +2 −2
  327. fs/fat/fat_test.c +2 −2
  328. fs/iomap/buffered-io.c +44 −14
  329. fs/iomap/ioend.c +2 −0
  330. fs/lockd/svcproc.c +2 −1
  331. fs/overlayfs/file.c +15 −1
  332. fs/overlayfs/xattrs.c +1 −1
  333. fs/pidfs.c +37 −17
  334. fs/posix_acl.c +7 −0
  335. fs/proc/namespaces.c +3 −1
  336. fs/smb/client/cifsfs.c +1 −0
  337. fs/smb/client/cifsglob.h +1 −0
  338. fs/smb/client/file.c +64 −5
  339. fs/smb/client/inode.c +6 −0
  340. fs/smb/client/misc.c +88 −18
  341. fs/smb/client/readdir.c +7 −2
  342. fs/smb/client/smb2file.c +21 −0
  343. fs/smb/client/smb2inode.c +20 −3
  344. fs/smb/server/compress.c +2 −1
  345. fs/smb/server/connection.c +11 −5
  346. fs/smb/server/server.c +9 −1
  347. fs/smb/server/smb2pdu.c +5 −7
  348. fs/smb/server/smbacl.c +26 −10
  349. fs/smb/server/vfs.c +1 −25
  350. fs/super.c +20 −14
  351. include/drm/ttm/ttm_backup.h +6 −6
  352. include/linux/alloc_tag.h +3 −0
  353. include/linux/bnge/hsi.h +3 −4
  354. include/linux/damon.h +0 −2
  355. include/linux/firmware/intel/stratix10-smc.h +11 −5
  356. include/linux/fscrypt.h +10 −8
  357. include/linux/memcontrol.h +21 −0
  358. include/linux/mlx5/mlx5_ifc.h +1 −12
  359. include/linux/page_reporting.h +3 −1
  360. include/linux/slab.h +22 −3
  361. include/net/bluetooth/rfcomm.h +3 −0
  362. include/net/pkt_cls.h +13 −1
  363. include/net/tcp.h +2 −0
  364. include/sound/sdca_fdl.h +2 −0
  365. include/sound/sdca_interrupts.h +12 −2
  366. include/sound/sdca_jack.h +3 −0
  367. include/sound/soc-component.h +2 −0
  368. include/trace/events/memory-failure.h +5 −1
  369. include/uapi/linux/btrfs.h +1 −1
  370. include/uapi/linux/io_uring/query.h +7 −7
  371. include/uapi/linux/io_uring/zcrx.h +16 −16
  372. init/Kconfig +3 −0
  373. io_uring/query.c +6 −6
  374. io_uring/rw.c +25 −17
  375. io_uring/zcrx.c +17 −17
  376. io_uring/zcrx.h +4 −3
  377. kernel/bpf/verifier.c +2 −1
  378. kernel/liveupdate/luo_session.c +1 −1
  379. kernel/smp.c +25 −5
  380. kernel/trace/ftrace.c +13 −0
  381. kernel/trace/trace.c +1 −1
  382. kernel/trace/trace.h +1 −0
  383. kernel/trace/trace_eprobe.c +2 −1
  384. kernel/trace/trace_events.c +3 −1
  385. kernel/trace/trace_events_hist.c +2 −0
  386. kernel/trace/trace_events_trigger.c +18 −4
  387. kernel/trace/trace_mmiotrace.c +2 −2
  388. kernel/trace/trace_probe.c +7 −6
  389. kernel/trace/trace_remote.c +13 −3
  390. kernel/trace/trace_syscalls.c +5 −0
  391. lib/alloc_tag.c +9 −0
  392. lib/rhashtable.c +1 −0
  393. mm/damon/core.c +13 −2
  394. mm/damon/lru_sort.c +0 −2
  395. mm/damon/modules-common.c +0 −2
  396. mm/damon/modules-common.h +0 −2
  397. mm/damon/ops-common.c +0 −2
  398. mm/damon/ops-common.h +0 −2
  399. mm/damon/paddr.c +0 −2
  400. mm/damon/reclaim.c +0 −2
  401. mm/damon/sysfs-common.c +0 −2
  402. mm/damon/sysfs-common.h +0 −2
  403. mm/damon/sysfs-schemes.c +0 −2
  404. mm/damon/sysfs.c +0 −2
  405. mm/damon/tests/core-kunit.h +0 −4
  406. mm/damon/tests/sysfs-kunit.h +0 −2
  407. mm/damon/tests/vaddr-kunit.h +0 −4
  408. mm/damon/vaddr.c +0 −2
  409. mm/huge_memory.c +8 −4
  410. mm/kmemleak.c +4 −3
  411. mm/page_reporting.c +12 −12
  412. mm/page_vma_mapped.c +17 −14
  413. mm/shmem.c +10 −0
  414. mm/slab.h +29 −3
  415. mm/slab_common.c +18 −1
  416. mm/slub.c +50 −71
  417. mm/userfaultfd.c +4 −1
  418. net/bluetooth/hci_sync.c +11 −2
  419. net/bluetooth/rfcomm/core.c +17 −0
  420. net/bluetooth/rfcomm/tty.c +3 −4
  421. net/bridge/br_netlink_tunnel.c +2 −1
  422. net/bridge/br_private.h +4 −2
  423. net/bridge/br_vlan.c +6 −4
  424. net/bridge/br_vlan_options.c +1 −2
  425. net/ceph/auth_x.c +8 −1
  426. net/ceph/ceph_common.c +2 −2
  427. net/ceph/cls_lock_client.c +6 −2
  428. net/ceph/mon_client.c +2 −2
  429. net/ceph/osdmap.c +12 −4
  430. net/core/drop_monitor.c +7 −11
  431. net/core/filter.c +11 −6
  432. net/core/gro.c +3 −1
  433. net/core/sock.c +5 −5
  434. net/hsr/hsr_slave.c +2 −0
  435. net/ipv4/datagram.c +2 −2
  436. net/ipv4/icmp.c +15 −3
  437. net/ipv4/ip_gre.c +2 −2
  438. net/ipv4/nexthop.c +1 −1
  439. net/ipv4/raw.c +16 −7
  440. net/ipv4/tcp_bpf.c +1 −1
  441. net/ipv4/tcp_input.c +43 −13
  442. net/ipv4/tcp_ipv4.c +7 −1
  443. net/ipv4/tcp_minisocks.c +11 −1
  444. net/ipv6/ila/ila_common.c +12 −0
  445. net/ipv6/ip6_gre.c +2 −2
  446. net/ipv6/raw.c +1 −1
  447. net/ipv6/route.c +2 −2
  448. net/ipv6/tcp_ipv6.c +2 −0
  449. net/iucv/af_iucv.c +16 −1
  450. net/mac80211/cfg.c +3 −0
  451. net/mac80211/link.c +4 −0
  452. net/mac80211/rx.c +2 −0
  453. net/mac802154/llsec.c +5 −0
  454. net/mac802154/scan.c +11 −0
  455. net/mctp/device.c +3 −1
  456. net/mpls/af_mpls.c +5 −3
  457. net/mptcp/options.c +7 −10
  458. net/mptcp/pm_userspace.c +5 −2
  459. net/mptcp/protocol.c +20 −14
  460. net/openvswitch/actions.c +7 −12
  461. net/openvswitch/datapath.c +14 −11
  462. net/openvswitch/datapath.h +1 −1
  463. net/openvswitch/vport.c +1 −1
  464. net/packet/af_packet.c +5 −1
  465. net/phonet/pep.c +2 −0
  466. net/phonet/pn_dev.c +24 −6
  467. net/qrtr/af_qrtr.c +8 −0
  468. net/qrtr/ns.c +2 −2
  469. net/rds/ib.c +4 −0
  470. net/rds/ib_cm.c +4 −0
  471. net/rds/recv.c +15 −0
  472. net/rds/tcp.c +7 −5
  473. net/rxrpc/ar-internal.h +4 −2
  474. net/sched/cls_api.c +1 −5
  475. net/sched/sch_api.c +19 −5
  476. net/sched/sch_cake.c +1 −1
  477. net/sched/sch_drr.c +1 −1
  478. net/sched/sch_dualpi2.c +1 −1
  479. net/sched/sch_ets.c +1 −1
  480. net/sched/sch_fq_codel.c +1 −1
  481. net/sched/sch_fq_pie.c +1 −1
  482. net/sched/sch_hfsc.c +1 −1
  483. net/sched/sch_htb.c +1 −1
  484. net/sched/sch_multiq.c +1 −1
  485. net/sched/sch_prio.c +1 −1
  486. net/sched/sch_qfq.c +1 −1
  487. net/sched/sch_sfb.c +1 −1
  488. net/sched/sch_sfq.c +1 −1
  489. net/sctp/auth.c +1 −1
  490. net/sctp/protocol.c +13 −8
  491. net/sctp/sm_make_chunk.c +6 −0
  492. net/sctp/sm_statefuns.c +1 −1
  493. net/sctp/stream.c +5 −1
  494. net/sctp/sysctl.c +7 −2
  495. net/tipc/netlink.c +5 −1
  496. net/tipc/netlink_compat.c +4 −0
  497. net/tipc/socket.c +3 −2
  498. net/tipc/udp_media.c +27 −29
  499. net/tls/tls_device.c +4 −2
  500. net/vmw_vsock/virtio_transport_common.c +164 −1
  501. net/wireless/pmsr.c +3 −2
  502. net/x25/af_x25.c +6 −2
  503. rust/Makefile +13 −3
  504. rust/bindings/lib.rs +4 −0
  505. rust/kernel/device.rs +9 −11
  506. rust/kernel/time.rs +9 −2
  507. rust/uapi/lib.rs +4 −0
  508. rust/zerocopy-derive/README.md +7 −7
  509. rust/zerocopy-derive/derive/from_bytes.rs +1 −1
  510. rust/zerocopy-derive/derive/into_bytes.rs +1 −1
  511. rust/zerocopy-derive/derive/known_layout.rs +1 −2
  512. rust/zerocopy-derive/derive/mod.rs +12 −8
  513. rust/zerocopy-derive/derive/try_from_bytes.rs +3 −3
  514. rust/zerocopy-derive/derive/unaligned.rs +1 −1
  515. rust/zerocopy-derive/lib.rs +35 −1
  516. rust/zerocopy-derive/repr.rs +1 −1
  517. rust/zerocopy-derive/util.rs +26 −8
  518. rust/zerocopy/README.md +7 −8
  519. rust/zerocopy/rustdoc/style.css +0 −1
  520. rust/zerocopy/src/byte_slice.rs +1 −1
  521. rust/zerocopy/src/byteorder.rs +41 −9
  522. rust/zerocopy/src/deprecated.rs +1 −1
  523. rust/zerocopy/src/error.rs +1 −1
  524. rust/zerocopy/src/impls.rs +2 −2
  525. rust/zerocopy/src/layout.rs +3 −1
  526. rust/zerocopy/src/lib.rs +7 −5
  527. rust/zerocopy/src/macros.rs +1 −1
  528. rust/zerocopy/src/pointer/inner.rs +1 −1
  529. rust/zerocopy/src/pointer/invariant.rs +1 −1
  530. rust/zerocopy/src/pointer/mod.rs +1 −1
  531. rust/zerocopy/src/pointer/ptr.rs +1 −1
  532. rust/zerocopy/src/pointer/transmute.rs +1 −1
  533. rust/zerocopy/src/ref.rs +1 −1
  534. rust/zerocopy/src/split_at.rs +1 −1
  535. rust/zerocopy/src/util/macro_util.rs +1 −1
  536. rust/zerocopy/src/util/macros.rs +1 −1
  537. rust/zerocopy/src/util/mod.rs +7 −1
  538. rust/zerocopy/src/wrappers.rs +1 −1
  539. sound/hda/codecs/side-codecs/tas2781_hda_spi.c +2 −1
  540. sound/soc/amd/acp-config.c +7 −0
  541. sound/soc/amd/yc/acp6x-mach.c +22 −0
  542. sound/soc/codecs/max98090.c +3 −2
  543. sound/soc/codecs/max98095.c +3 −2
  544. sound/soc/codecs/rt722-sdca-sdw.c +4 −0
  545. sound/soc/codecs/rt722-sdca.c +14 −0
  546. sound/soc/codecs/tas2562.c +32 −14
  547. sound/soc/codecs/tas2781-i2c.c +2 −2
  548. sound/soc/fsl/fsl_asrc.c +1 −1
  549. sound/soc/fsl/fsl_easrc.c +1 −1
  550. sound/soc/intel/common/soc-acpi-intel-nvl-match.c +13 −0
  551. sound/soc/sdca/sdca_class.c +2 −2
  552. sound/soc/sdca/sdca_class_function.c +3 −3
  553. sound/soc/sdca/sdca_device.c +1 −1
  554. sound/soc/sdca/sdca_fdl.c +15 −3
  555. sound/soc/sdca/sdca_functions.c +2 −0
  556. sound/soc/sdca/sdca_interrupts.c +100 −74
  557. sound/soc/sdca/sdca_jack.c +50 −38
  558. sound/soc/sdca/sdca_ump.c +2 −2
  559. sound/soc/soc-component.c +10 −0
  560. sound/soc/soc-core.c +5 −0
  561. sound/soc/sophgo/cv1800b-sound-adc.c +8 −2
  562. sound/usb/quirks.c +2 −0
  563. tools/arch/s390/include/uapi/asm/kvm.h +1 −0
  564. tools/arch/x86/include/asm/cpufeatures.h +3 −0
  565. tools/arch/x86/include/asm/msr-index.h +11 −0
  566. tools/arch/x86/include/uapi/asm/kvm.h +8 −6
  567. tools/arch/x86/include/uapi/asm/svm.h +16 −16
  568. tools/include/linux/gfp_types.h +8 −8
  569. tools/include/uapi/linux/const.h +18 −0
  570. tools/include/uapi/linux/kvm.h +15 −5
  571. tools/include/uapi/linux/rtnetlink.h +1 −0
  572. tools/objtool/check.c +1 −0
  573. tools/perf/bench/bpf_skel/.gitignore +4 −0
  574. tools/perf/trace/beauty/include/linux/socket.h +1 −1
  575. tools/perf/trace/beauty/include/uapi/drm/drm.h +8 −19
  576. tools/perf/trace/beauty/include/uapi/linux/fs.h +10 −1
  577. tools/testing/selftests/bpf/config +1 −0
  578. tools/testing/selftests/bpf/prog_tests/tc_qevent.c +113 −0
  579. tools/testing/selftests/bpf/progs/test_tc_qevent.c +23 −0
  580. tools/testing/selftests/bpf/progs/verifier_global_subprogs.c +10 −0
  581. tools/testing/selftests/drivers/net/config +3 −0
  582. tools/testing/selftests/drivers/net/netconsole/netcons_cmdline.sh +1 −1
  583. tools/testing/selftests/drivers/net/netconsole/netcons_fragmented_msg.sh +2 −2
  584. tools/testing/selftests/drivers/net/netconsole/netcons_resume.sh +1 −1
  585. tools/testing/selftests/drivers/net/netconsole/netcons_sysdata.sh +1 −1
  586. tools/testing/selftests/drivers/net/settings +1 −0
  587. tools/testing/selftests/drivers/ntsync/config +1 −1
  588. tools/testing/selftests/filesystems/fuse/Makefile +10 −0
  589. tools/testing/selftests/filesystems/fuse/fuse_acl_cache_test.c +347 −0
  590. tools/testing/selftests/ftrace/ftracetest +1 −0
  591. tools/testing/selftests/kvm/x86/sev_init2_tests.c +11 −5
  592. tools/testing/selftests/kvm/x86/sev_smoke_test.c +8 −1
  593. tools/testing/selftests/net/af_unix/config +1 −0
  594. tools/testing/selftests/net/bridge_vlan_dump.sh +23 −0
  595. tools/testing/selftests/net/mptcp/userspace_pm.sh +1 −1
  596. tools/testing/selftests/net/openvswitch/config +16 −0
  597. tools/testing/selftests/net/ovpn/config +2 −0
  598. tools/testing/selftests/net/ovpn/ovpn-cli.c +3 −1
  599. tools/testing/selftests/net/ovpn/settings +1 −0
  600. tools/testing/selftests/net/packetdrill/tcp_rfc5961_rst-syn-recv.pkt +61 −0
  601. tools/testing/selftests/net/tun.c +4 −4
  602. tools/testing/selftests/pidfd/pidfd_file_handle_test.c +1 −0
  603. tools/testing/vsock/vsock_test.c +87 −0
.mailmap+9−4
@@ -66,6 +66,11 @@ Alex Hung <alexhung@gmail.com> <alex.hung@canonical.com> · 65 unmodified lines
6666 Alex Shi <alexs@kernel.org> <alex.shi@intel.com>
6767 Alex Shi <alexs@kernel.org> <alex.shi@linaro.org>
6868 Alex Shi <alexs@kernel.org> <alex.shi@linux.alibaba.com>
69+Alice Mikityanska <alice.kernel@fastmail.im> <maxtram95@gmail.com>
70+Alice Mikityanska <alice.kernel@fastmail.im> <maximmi@mellanox.com>
71+Alice Mikityanska <alice.kernel@fastmail.im> <maximmi@nvidia.com>
72+Alice Mikityanska <alice.kernel@fastmail.im> <maxim@isovalent.com>
73+Alice Mikityanska <alice.kernel@fastmail.im> <alice@isovalent.com>
6974 Aloka Dixit <quic_alokad@quicinc.com> <alokad@codeaurora.org>
7075 Al Viro <viro@ftp.linux.org.uk>
7176 Al Viro <viro@zenIV.linux.org.uk>
@@ -540,6 +545,7 @@ Maciej W. Rozycki <macro@mips.com> <macro@imgtec.com> · 468 unmodified lines
540545 Maciej W. Rozycki <macro@orcam.me.uk> <macro@linux-mips.org>
541546 Maharaja Kennadyrajan <quic_mkenna@quicinc.com> <mkenna@codeaurora.org>
542547 Maheshwar Ajja <quic_majja@quicinc.com> <majja@codeaurora.org>
548+Maíra Canal <mairacanal@riseup.net> <maira.canal@usp.br>
543549 Malathi Gottam <quic_mgottam@quicinc.com> <mgottam@codeaurora.org>
544550 Manikanta Pubbisetty <quic_mpubbise@quicinc.com> <mpubbise@codeaurora.org>
545551 Manivannan Sadhasivam <mani@kernel.org> <manivannanece23@gmail.com>
@@ -585,8 +591,6 @@ Mauro Carvalho Chehab <mchehab@kernel.org> <mchehab@osg.samsung.com> · 39 unmodified lines
585591 Mauro Carvalho Chehab <mchehab@kernel.org> <mchehab@redhat.com>
586592 Mauro Carvalho Chehab <mchehab@kernel.org> <m.chehab@samsung.com>
587593 Mauro Carvalho Chehab <mchehab@kernel.org> <mchehab@s-opensource.com>
588−Maxim Mikityanskiy <maxtram95@gmail.com> <maximmi@mellanox.com>
589−Maxim Mikityanskiy <maxtram95@gmail.com> <maximmi@nvidia.com>
590594 Maxime Ripard <mripard@kernel.org> <maxime@cerno.tech>
591595 Maxime Ripard <mripard@kernel.org> <maxime.ripard@bootlin.com>
592596 Maxime Ripard <mripard@kernel.org> <maxime.ripard@free-electrons.com>
@@ -595,8 +599,8 @@ Mayuresh Janorkar <mayur@ti.com> · 2 unmodified lines
595599 Md Sadre Alam <quic_mdalam@quicinc.com> <mdalam@codeaurora.org>
596600 Miaoqing Pan <quic_miaoqing@quicinc.com> <miaoqing@codeaurora.org>
597601 Michael Buesch <m@bues.ch>
598−Michal Grzeschik <mgr@kernel.org> <m.grzeschik@pengutronix.de>
599−Michal Grzeschik <mgr@kernel.org> <mgr@pengutronix.de>
602+Michael Grzeschik <mgr@kernel.org> <m.grzeschik@pengutronix.de>
603+Michael Grzeschik <mgr@kernel.org> <mgr@pengutronix.de>
600604 Michael Riesch <michael.riesch@collabora.com> <michael.riesch@wolfvision.net>
601605 Michal Simek <michal.simek@amd.com> <michal.simek@xilinx.com>
602606 Michel Dänzer <michel@tungstengraphics.com>
@@ -817,6 +821,7 @@ Simon Wunderlich <sw@simonwunderlich.de> <simon.wunderlich@s2003.tu-chemnitz.de> · 214 unmodified lines
817821 Simon Wunderlich <sw@simonwunderlich.de> <simon.wunderlich@saxnet.de>
818822 Simon Wunderlich <sw@simonwunderlich.de> <simon@open-mesh.com>
819823 Simon Wunderlich <sw@simonwunderlich.de> <siwu@hrz.tu-chemnitz.de>
824+SJ Park <sj@kernel.org>
820825 Sricharan Ramabadhran <quic_srichara@quicinc.com> <sricharan@codeaurora.org>
821826 Srinivas Kandagatla <srini@kernel.org> <srinivas.kandagatla@st.com>
822827 Srinivas Kandagatla <srini@kernel.org> <srinivas.kandagatla@linaro.org>
Documentation/ABI/testing/sysfs-kernel-mm-damon+87−87
@@ -1,26 +1,26 @@
11 what: /sys/kernel/mm/damon/
22 Date: Mar 2022
3−Contact: SeongJae Park <sj@kernel.org>
3+Contact: SJ Park <sj@kernel.org>
44 Description: Interface for Data Access MONitoring (DAMON). Contains files
55 for controlling DAMON. For more details on DAMON itself,
66 please refer to Documentation/admin-guide/mm/damon/index.rst.
77
88 What: /sys/kernel/mm/damon/admin/
99 Date: Mar 2022
10−Contact: SeongJae Park <sj@kernel.org>
10+Contact: SJ Park <sj@kernel.org>
1111 Description: Interface for privileged users of DAMON. Contains files for
1212 controlling DAMON that aimed to be used by privileged users.
1313
1414 What: /sys/kernel/mm/damon/admin/kdamonds/nr_kdamonds
1515 Date: Mar 2022
16−Contact: SeongJae Park <sj@kernel.org>
16+Contact: SJ Park <sj@kernel.org>
1717 Description: Writing a number 'N' to this file creates the number of
1818 directories for controlling each DAMON worker thread (kdamond)
1919 named '0' to 'N-1' under the kdamonds/ directory.
2020
2121 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/state
2222 Date: Mar 2022
23−Contact: SeongJae Park <sj@kernel.org>
23+Contact: SJ Park <sj@kernel.org>
2424 Description: Writing 'on' or 'off' to this file makes the kdamond starts or
2525 stops, respectively. Reading the file returns the keywords
2626 based on the current status. Writing 'commit' to this file
@@ -40,33 +40,33 @@ Description: Writing 'on' or 'off' to this file makes the kdamond starts or · 13 unmodified lines
4040
4141 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/pid
4242 Date: Mar 2022
43−Contact: SeongJae Park <sj@kernel.org>
43+Contact: SJ Park <sj@kernel.org>
4444 Description: Reading this file returns the pid of the kdamond if it is
4545 running.
4646
4747 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/refresh_ms
4848 Date: Jul 2025
49−Contact: SeongJae Park <sj@kernel.org>
49+Contact: SJ Park <sj@kernel.org>
5050 Description: Writing a value to this file sets the time interval for
5151 automatic DAMON status file contents update. Writing '0'
5252 disables the update. Reading this file returns the value.
5353
5454 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/nr_contexts
5555 Date: Mar 2022
56−Contact: SeongJae Park <sj@kernel.org>
56+Contact: SJ Park <sj@kernel.org>
5757 Description: Writing a number 'N' to this file creates the number of
5858 directories for controlling each DAMON context named '0' to
5959 'N-1' under the contexts/ directory.
6060
6161 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/avail_operations
6262 Date: Apr 2022
63−Contact: SeongJae Park <sj@kernel.org>
63+Contact: SJ Park <sj@kernel.org>
6464 Description: Reading this file returns the available monitoring operations
6565 sets on the currently running kernel.
6666
6767 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/operations
6868 Date: Mar 2022
69−Contact: SeongJae Park <sj@kernel.org>
69+Contact: SJ Park <sj@kernel.org>
7070 Description: Writing a keyword for a monitoring operations set ('vaddr' for
7171 virtual address spaces monitoring, 'fvaddr' for fixed virtual
7272 address ranges monitoring, and 'paddr' for the physical address
@@ -79,42 +79,42 @@ Description: Writing a keyword for a monitoring operations set ('vaddr' for · 6 unmodified lines
7979
8080 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/addr_unit
8181 Date: Aug 2025
82−Contact: SeongJae Park <sj@kernel.org>
82+Contact: SJ Park <sj@kernel.org>
8383 Description: Writing an integer to this file sets the 'address unit'
8484 parameter of the given operations set of the context. Reading
8585 the file returns the last-written 'address unit' value.
8686
8787 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/pause
8888 Date: Mar 2026
89−Contact: SeongJae Park <sj@kernel.org>
89+Contact: SJ Park <sj@kernel.org>
9090 Description: Writing a boolean keyword to this file sets the 'pause' request
9191 parameter for the context. Reading the file returns the
9292 last-written 'pause' value.
9393
9494 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/monitoring_attrs/intervals/sample_us
9595 Date: Mar 2022
96−Contact: SeongJae Park <sj@kernel.org>
96+Contact: SJ Park <sj@kernel.org>
9797 Description: Writing a value to this file sets the sampling interval of the
9898 DAMON context in microseconds as the value. Reading this file
9999 returns the value.
100100
101101 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/monitoring_attrs/intervals/aggr_us
102102 Date: Mar 2022
103−Contact: SeongJae Park <sj@kernel.org>
103+Contact: SJ Park <sj@kernel.org>
104104 Description: Writing a value to this file sets the aggregation interval of
105105 the DAMON context in microseconds as the value. Reading this
106106 file returns the value.
107107
108108 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/monitoring_attrs/intervals/update_us
109109 Date: Mar 2022
110−Contact: SeongJae Park <sj@kernel.org>
110+Contact: SJ Park <sj@kernel.org>
111111 Description: Writing a value to this file sets the update interval of the
112112 DAMON context in microseconds as the value. Reading this file
113113 returns the value.
114114
115115 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/monitoring_attrs/intervals/intrvals_goal/access_bp
116116 Date: Feb 2025
117−Contact: SeongJae Park <sj@kernel.org>
117+Contact: SJ Park <sj@kernel.org>
118118 Description: Writing a value to this file sets the monitoring intervals
119119 auto-tuning target DAMON-observed access events ratio within
120120 the given time interval (aggrs in same directory), in bp
@@ -122,7 +122,7 @@ Description: Writing a value to this file sets the monitoring intervals · 1 unmodified line
122122
123123 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/monitoring_attrs/intervals/intrvals_goal/aggrs
124124 Date: Feb 2025
125−Contact: SeongJae Park <sj@kernel.org>
125+Contact: SJ Park <sj@kernel.org>
126126 Description: Writing a value to this file sets the time interval to achieve
127127 the monitoring intervals auto-tuning target DAMON-observed
128128 access events ratio (access_bp in same directory) within.
@@ -130,14 +130,14 @@ Description: Writing a value to this file sets the time interval to achieve · 1 unmodified line
130130
131131 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/monitoring_attrs/intervals/intrvals_goal/min_sample_us
132132 Date: Feb 2025
133−Contact: SeongJae Park <sj@kernel.org>
133+Contact: SJ Park <sj@kernel.org>
134134 Description: Writing a value to this file sets the minimum value of
135135 auto-tuned sampling interval in microseconds. Reading this
136136 file returns the value.
137137
138138 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/monitoring_attrs/intervals/intrvals_goal/max_sample_us
139139 Date: Feb 2025
140−Contact: SeongJae Park <sj@kernel.org>
140+Contact: SJ Park <sj@kernel.org>
141141 Description: Writing a value to this file sets the maximum value of
142142 auto-tuned sampling interval in microseconds. Reading this
143143 file returns the value.
@@ -145,42 +145,42 @@ Description: Writing a value to this file sets the maximum value of · 1 unmodified line
145145 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/monitoring_attrs/nr_regions/min
146146
147147 WDate: Mar 2022
148−Contact: SeongJae Park <sj@kernel.org>
148+Contact: SJ Park <sj@kernel.org>
149149 Description: Writing a value to this file sets the minimum number of
150150 monitoring regions of the DAMON context as the value. Reading
151151 this file returns the value.
152152
153153 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/monitoring_attrs/nr_regions/max
154154 Date: Mar 2022
155−Contact: SeongJae Park <sj@kernel.org>
155+Contact: SJ Park <sj@kernel.org>
156156 Description: Writing a value to this file sets the maximum number of
157157 monitoring regions of the DAMON context as the value. Reading
158158 this file returns the value.
159159
160160 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/targets/nr_targets
161161 Date: Mar 2022
162−Contact: SeongJae Park <sj@kernel.org>
162+Contact: SJ Park <sj@kernel.org>
163163 Description: Writing a number 'N' to this file creates the number of
164164 directories for controlling each DAMON target of the context
165165 named '0' to 'N-1' under the contexts/ directory.
166166
167167 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/targets/<T>/pid_target
168168 Date: Mar 2022
169−Contact: SeongJae Park <sj@kernel.org>
169+Contact: SJ Park <sj@kernel.org>
170170 Description: Writing to and reading from this file sets and gets the pid of
171171 the target process if the context is for virtual address spaces
172172 monitoring, respectively.
173173
174174 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/targets/<T>/obsolete_target
175175 Date: Oct 2025
176−Contact: SeongJae Park <sj@kernel.org>
176+Contact: SJ Park <sj@kernel.org>
177177 Description: Writing to and reading from this file sets and gets the
178178 obsoleteness of the matching parameters commit destination
179179 target.
180180
181181 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/targets/<T>/regions/nr_regions
182182 Date: Mar 2022
183−Contact: SeongJae Park <sj@kernel.org>
183+Contact: SJ Park <sj@kernel.org>
184184 Description: Writing a number 'N' to this file creates the number of
185185 directories for setting each DAMON target memory region of the
186186 context named '0' to 'N-1' under the regions/ directory. In
@@ -190,181 +190,181 @@ Description: Writing a number 'N' to this file creates the number of · 3 unmodified lines
190190
191191 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/targets/<T>/regions/<R>/start
192192 Date: Mar 2022
193−Contact: SeongJae Park <sj@kernel.org>
193+Contact: SJ Park <sj@kernel.org>
194194 Description: Writing to and reading from this file sets and gets the start
195195 address of the monitoring region.
196196
197197 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/targets/<T>/regions/<R>/end
198198 Date: Mar 2022
199−Contact: SeongJae Park <sj@kernel.org>
199+Contact: SJ Park <sj@kernel.org>
200200 Description: Writing to and reading from this file sets and gets the end
201201 address of the monitoring region.
202202
203203 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/nr_schemes
204204 Date: Mar 2022
205−Contact: SeongJae Park <sj@kernel.org>
205+Contact: SJ Park <sj@kernel.org>
206206 Description: Writing a number 'N' to this file creates the number of
207207 directories for controlling each DAMON-based operation scheme
208208 of the context named '0' to 'N-1' under the schemes/ directory.
209209
210210 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/action
211211 Date: Mar 2022
212−Contact: SeongJae Park <sj@kernel.org>
212+Contact: SJ Park <sj@kernel.org>
213213 Description: Writing to and reading from this file sets and gets the action
214214 of the scheme.
215215
216216 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/target_nid
217217 Date: Jun 2024
218−Contact: SeongJae Park <sj@kernel.org>
218+Contact: SJ Park <sj@kernel.org>
219219 Description: Action's target NUMA node id. Supported by only relevant
220220 actions.
221221
222222 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/apply_interval_us
223223 Date: Sep 2023
224−Contact: SeongJae Park <sj@kernel.org>
224+Contact: SJ Park <sj@kernel.org>
225225 Description: Writing a value to this file sets the action apply interval of
226226 the scheme in microseconds. Reading this file returns the
227227 value.
228228
229229 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/access_pattern/sz/min
230230 Date: Mar 2022
231−Contact: SeongJae Park <sj@kernel.org>
231+Contact: SJ Park <sj@kernel.org>
232232 Description: Writing to and reading from this file sets and gets the minimum
233233 size of the scheme's target regions in bytes.
234234
235235 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/access_pattern/sz/max
236236 Date: Mar 2022
237−Contact: SeongJae Park <sj@kernel.org>
237+Contact: SJ Park <sj@kernel.org>
238238 Description: Writing to and reading from this file sets and gets the maximum
239239 size of the scheme's target regions in bytes.
240240
241241 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/access_pattern/nr_accesses/min
242242 Date: Mar 2022
243−Contact: SeongJae Park <sj@kernel.org>
243+Contact: SJ Park <sj@kernel.org>
244244 Description: Writing to and reading from this file sets and gets the manimum
245245 'nr_accesses' of the scheme's target regions.
246246
247247 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/access_pattern/nr_accesses/max
248248 Date: Mar 2022
249−Contact: SeongJae Park <sj@kernel.org>
249+Contact: SJ Park <sj@kernel.org>
250250 Description: Writing to and reading from this file sets and gets the maximum
251251 'nr_accesses' of the scheme's target regions.
252252
253253 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/access_pattern/age/min
254254 Date: Mar 2022
255−Contact: SeongJae Park <sj@kernel.org>
255+Contact: SJ Park <sj@kernel.org>
256256 Description: Writing to and reading from this file sets and gets the minimum
257257 'age' of the scheme's target regions.
258258
259259 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/access_pattern/age/max
260260 Date: Mar 2022
261−Contact: SeongJae Park <sj@kernel.org>
261+Contact: SJ Park <sj@kernel.org>
262262 Description: Writing to and reading from this file sets and gets the maximum
263263 'age' of the scheme's target regions.
264264
265265 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/ms
266266 Date: Mar 2022
267−Contact: SeongJae Park <sj@kernel.org>
267+Contact: SJ Park <sj@kernel.org>
268268 Description: Writing to and reading from this file sets and gets the time
269269 quota of the scheme in milliseconds.
270270
271271 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/bytes
272272 Date: Mar 2022
273−Contact: SeongJae Park <sj@kernel.org>
273+Contact: SJ Park <sj@kernel.org>
274274 Description: Writing to and reading from this file sets and gets the size
275275 quota of the scheme in bytes.
276276
277277 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/effective_bytes
278278 Date: Feb 2024
279−Contact: SeongJae Park <sj@kernel.org>
279+Contact: SJ Park <sj@kernel.org>
280280 Description: Reading from this file gets the effective size quota of the
281281 scheme in bytes, which adjusted for the time quota and goals.
282282
283283 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/reset_interval_ms
284284 Date: Mar 2022
285−Contact: SeongJae Park <sj@kernel.org>
285+Contact: SJ Park <sj@kernel.org>
286286 Description: Writing to and reading from this file sets and gets the quotas
287287 charge reset interval of the scheme in milliseconds.
288288
289289 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/goals/nr_goals
290290 Date: Nov 2023
291−Contact: SeongJae Park <sj@kernel.org>
291+Contact: SJ Park <sj@kernel.org>
292292 Description: Writing a number 'N' to this file creates the number of
293293 directories for setting automatic tuning of the scheme's
294294 aggressiveness named '0' to 'N-1' under the goals/ directory.
295295
296296 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/goals/<G>/target_metric
297297 Date: Feb 2024
298−Contact: SeongJae Park <sj@kernel.org>
298+Contact: SJ Park <sj@kernel.org>
299299 Description: Writing to and reading from this file sets and gets the quota
300300 auto-tuning goal metric.
301301
302302 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/goals/<G>/target_value
303303 Date: Nov 2023
304−Contact: SeongJae Park <sj@kernel.org>
304+Contact: SJ Park <sj@kernel.org>
305305 Description: Writing to and reading from this file sets and gets the target
306306 value of the goal metric.
307307
308308 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/goals/<G>/current_value
309309 Date: Nov 2023
310−Contact: SeongJae Park <sj@kernel.org>
310+Contact: SJ Park <sj@kernel.org>
311311 Description: Writing to and reading from this file sets and gets the current
312312 value of the goal metric.
313313
314314 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/goals/<G>/nid
315315 Date: Apr 2025
316−Contact: SeongJae Park <sj@kernel.org>
316+Contact: SJ Park <sj@kernel.org>
317317 Description: Writing to and reading from this file sets and gets the nid
318318 parameter of the goal.
319319
320320 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/goals/<G>/path
321321 Date: Oct 2025
322−Contact: SeongJae Park <sj@kernel.org>
322+Contact: SJ Park <sj@kernel.org>
323323 Description: Writing to and reading from this file sets and gets the path
324324 parameter of the goal.
325325
326326 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/goal_tuner
327327 Date: Mar 2026
328−Contact: SeongJae Park <sj@kernel.org>
328+Contact: SJ Park <sj@kernel.org>
329329 Description: Writing to and reading from this file sets and gets the
330330 goal-based effective quota auto-tuning algorithm to use.
331331
332332 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/fail_charge_num
333333 Date: Mar 2026
334−Contact: SeongJae Park <sj@kernel.org>
334+Contact: SJ Park <sj@kernel.org>
335335 Description: Writing to and reading from this file sets and gets the
336336 action-failed memory quota charging ratio numerator.
337337
338338 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/fail_charge_denom
339339 Date: Mar 2026
340−Contact: SeongJae Park <sj@kernel.org>
340+Contact: SJ Park <sj@kernel.org>
341341 Description: Writing to and reading from this file sets and gets the
342342 action-failed memory quota charging ratio denominator.
343343
344344 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/weights/sz_permil
345345 Date: Mar 2022
346−Contact: SeongJae Park <sj@kernel.org>
346+Contact: SJ Park <sj@kernel.org>
347347 Description: Writing to and reading from this file sets and gets the
348348 under-quota limit regions prioritization weight for 'size' in
349349 permil.
350350
351351 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/weights/nr_accesses_permil
352352 Date: Mar 2022
353−Contact: SeongJae Park <sj@kernel.org>
353+Contact: SJ Park <sj@kernel.org>
354354 Description: Writing to and reading from this file sets and gets the
355355 under-quota limit regions prioritization weight for
356356 'nr_accesses' in permil.
357357
358358 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/quotas/weights/age_permil
359359 Date: Mar 2022
360−Contact: SeongJae Park <sj@kernel.org>
360+Contact: SJ Park <sj@kernel.org>
361361 Description: Writing to and reading from this file sets and gets the
362362 under-quota limit regions prioritization weight for 'age' in
363363 permil.
364364
365365 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/watermarks/metric
366366 Date: Mar 2022
367−Contact: SeongJae Park <sj@kernel.org>
367+Contact: SJ Park <sj@kernel.org>
368368 Description: Writing to and reading from this file sets and gets the metric
369369 of the watermarks for the scheme. The writable/readable
370370 keywords for this file are 'none' for disabling the watermarks
@@ -373,44 +373,44 @@ Description: Writing to and reading from this file sets and gets the metric · 2 unmodified lines
373373
374374 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/watermarks/interval_us
375375 Date: Mar 2022
376−Contact: SeongJae Park <sj@kernel.org>
376+Contact: SJ Park <sj@kernel.org>
377377 Description: Writing to and reading from this file sets and gets the metric
378378 check interval of the watermarks for the scheme in
379379 microseconds.
380380
381381 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/watermarks/high
382382 Date: Mar 2022
383−Contact: SeongJae Park <sj@kernel.org>
383+Contact: SJ Park <sj@kernel.org>
384384 Description: Writing to and reading from this file sets and gets the high
385385 watermark of the scheme in permil.
386386
387387 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/watermarks/mid
388388 Date: Mar 2022
389−Contact: SeongJae Park <sj@kernel.org>
389+Contact: SJ Park <sj@kernel.org>
390390 Description: Writing to and reading from this file sets and gets the mid
391391 watermark of the scheme in permil.
392392
393393 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/watermarks/low
394394 Date: Mar 2022
395−Contact: SeongJae Park <sj@kernel.org>
395+Contact: SJ Park <sj@kernel.org>
396396 Description: Writing to and reading from this file sets and gets the low
397397 watermark of the scheme in permil.
398398
399399 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/core_filters
400400 Date: Feb 2025
401−Contact: SeongJae Park <sj@kernel.org>
401+Contact: SJ Park <sj@kernel.org>
402402 Description: Directory for DAMON core layer-handled DAMOS filters.
403403
404404 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/core_filters/nr_filters
405405 Date: Feb 2025
406−Contact: SeongJae Park <sj@kernel.org>
406+Contact: SJ Park <sj@kernel.org>
407407 Description: Writing a number 'N' to this file creates the number of
408408 directories for setting filters of the scheme named '0' to
409409 'N-1' under the core_filters/ directory.
410410
411411 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/core_filters/<F>/type
412412 Date: Feb 2025
413−Contact: SeongJae Park <sj@kernel.org>
413+Contact: SJ Park <sj@kernel.org>
414414 Description: Writing to and reading from this file sets and gets the type of
415415 the memory of the interest. 'anon' for anonymous pages,
416416 'memcg' for specific memory cgroup, 'young' for young pages,
@@ -419,62 +419,62 @@ Description: Writing to and reading from this file sets and gets the type of · 2 unmodified lines
419419
420420 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/core_filters/<F>/memcg_path
421421 Date: Feb 2025
422−Contact: SeongJae Park <sj@kernel.org>
422+Contact: SJ Park <sj@kernel.org>
423423 Description: If 'memcg' is written to the 'type' file, writing to and
424424 reading from this file sets and gets the path to the memory
425425 cgroup of the interest.
426426
427427 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/core_filters/<F>/addr_start
428428 Date: Feb 2025
429−Contact: SeongJae Park <sj@kernel.org>
429+Contact: SJ Park <sj@kernel.org>
430430 Description: If 'addr' is written to the 'type' file, writing to or reading
431431 from this file sets or gets the start address of the address
432432 range for the filter.
433433
434434 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/core_filters/<F>/addr_end
435435 Date: Feb 2025
436−Contact: SeongJae Park <sj@kernel.org>
436+Contact: SJ Park <sj@kernel.org>
437437 Description: If 'addr' is written to the 'type' file, writing to or reading
438438 from this file sets or gets the end address of the address
439439 range for the filter.
440440
441441 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/core_filters/<F>/min
442442 Date: Feb 2025
443−Contact: SeongJae Park <sj@kernel.org>
443+Contact: SJ Park <sj@kernel.org>
444444 Description: If 'hugepage_size' is written to the 'type' file, writing to
445445 or reading from this file sets or gets the minimum size of the
446446 hugepage for the filter.
447447
448448 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/core_filters/<F>/max
449449 Date: Feb 2025
450−Contact: SeongJae Park <sj@kernel.org>
450+Contact: SJ Park <sj@kernel.org>
451451 Description: If 'hugepage_size' is written to the 'type' file, writing to
452452 or reading from this file sets or gets the maximum size of the
453453 hugepage for the filter.
454454
455455 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/core_filters/<F>/damon_target_idx
456456 Date: Feb 2025
457−Contact: SeongJae Park <sj@kernel.org>
457+Contact: SJ Park <sj@kernel.org>
458458 Description: If 'target' is written to the 'type' file, writing to or
459459 reading from this file sets or gets the index of the DAMON
460460 monitoring target of the interest.
461461
462462 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/core_filters/<F>/matching
463463 Date: Feb 2025
464−Contact: SeongJae Park <sj@kernel.org>
464+Contact: SJ Park <sj@kernel.org>
465465 Description: Writing 'Y' or 'N' to this file sets whether the filter is for
466466 the memory of the 'type', or all except the 'type'.
467467
468468 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/core_filters/<F>/allow
469469 Date: Feb 2025
470−Contact: SeongJae Park <sj@kernel.org>
470+Contact: SJ Park <sj@kernel.org>
471471 Description: Writing 'Y' or 'N' to this file sets whether to allow or reject
472472 applying the scheme's action to the memory that satisfies the
473473 'type' and the 'matching' of the directory.
474474
475475 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/ops_filters
476476 Date: Feb 2025
477−Contact: SeongJae Park <sj@kernel.org>
477+Contact: SJ Park <sj@kernel.org>
478478 Description: Directory for DAMON operations set layer-handled DAMOS filters.
479479 Files under this directory works same to those of
480480 /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/core_filters
@@ -482,7 +482,7 @@ Description: Directory for DAMON operations set layer-handled DAMOS filters. · 1 unmodified line
482482
483483 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/filters
484484 Date: Dec 2022
485−Contact: SeongJae Park <sj@kernel.org>
485+Contact: SJ Park <sj@kernel.org>
486486 Description: Directory for DAMOS filters. Files under this directory works
487487 same to those of
488488 /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/{core,ops}_filters
@@ -491,14 +491,14 @@ Description: Directory for DAMOS filters. Files under this directory works · 2 unmodified lines
491491
492492 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/dests/nr_dests
493493 Date: Jul 2025
494−Contact: SeongJae Park <sj@kernel.org>
494+Contact: SJ Park <sj@kernel.org>
495495 Description: Writing a number 'N' to this file creates the number of
496496 directories for setting action destinations of the scheme named
497497 '0' to 'N-1' under the dests/ directory.
498498
499499 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/dests/<D>/id
500500 Date: Jul 2025
501−Contact: SeongJae Park <sj@kernel.org>
501+Contact: SJ Park <sj@kernel.org>
502502 Description: Writing to and reading from this file sets and gets the id of
503503 the DAMOS action destination. For DAMOS_MIGRATE_{HOT,COLD}
504504 actions, the destination node's node id can be written and
@@ -506,98 +506,98 @@ Description: Writing to and reading from this file sets and gets the id of · 1 unmodified line
506506
507507 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/dests/<D>/weight
508508 Date: Jul 2025
509−Contact: SeongJae Park <sj@kernel.org>
509+Contact: SJ Park <sj@kernel.org>
510510 Description: Writing to and reading from this file sets and gets the weight
511511 of the DAMOS action destination to select as the destination of
512512 each action among the destinations.
513513
514514 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/nr_tried
515515 Date: Mar 2022
516−Contact: SeongJae Park <sj@kernel.org>
516+Contact: SJ Park <sj@kernel.org>
517517 Description: Reading this file returns the number of regions that the action
518518 of the scheme has tried to be applied.
519519
520520 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/sz_tried
521521 Date: Mar 2022
522−Contact: SeongJae Park <sj@kernel.org>
522+Contact: SJ Park <sj@kernel.org>
523523 Description: Reading this file returns the total size of regions that the
524524 action of the scheme has tried to be applied in bytes.
525525
526526 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/nr_applied
527527 Date: Mar 2022
528−Contact: SeongJae Park <sj@kernel.org>
528+Contact: SJ Park <sj@kernel.org>
529529 Description: Reading this file returns the number of regions that the action
530530 of the scheme has successfully applied.
531531
532532 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/sz_applied
533533 Date: Mar 2022
534−Contact: SeongJae Park <sj@kernel.org>
534+Contact: SJ Park <sj@kernel.org>
535535 Description: Reading this file returns the total size of regions that the
536536 action of the scheme has successfully applied in bytes.
537537
538538 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/sz_ops_filter_passed
539539 Date: Dec 2024
540−Contact: SeongJae Park <sj@kernel.org>
540+Contact: SJ Park <sj@kernel.org>
541541 Description: Reading this file returns the total size of memory that passed
542542 DAMON operations layer-handled filters of the scheme in bytes.
543543
544544 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/qt_exceeds
545545 Date: Mar 2022
546−Contact: SeongJae Park <sj@kernel.org>
546+Contact: SJ Park <sj@kernel.org>
547547 Description: Reading this file returns the number of the exceed events of
548548 the scheme's quotas.
549549
550550 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/nr_snapshots
551551 Date: Dec 2025
552−Contact: SeongJae Park <sj@kernel.org>
552+Contact: SJ Park <sj@kernel.org>
553553 Description: Reading this file returns the total number of DAMON snapshots
554554 that the scheme has tried to be applied.
555555
556556 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/stats/max_nr_snapshots
557557 Date: Dec 2025
558−Contact: SeongJae Park <sj@kernel.org>
558+Contact: SJ Park <sj@kernel.org>
559559 Description: Writing a number to this file sets the upper limit of
560560 nr_snapshots that deactivates the scheme when the limit is
561561 reached or exceeded.
562562
563563 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/tried_regions/total_bytes
564564 Date: Jul 2023
565−Contact: SeongJae Park <sj@kernel.org>
565+Contact: SJ Park <sj@kernel.org>
566566 Description: Reading this file returns the total amount of memory that
567567 corresponding DAMON-based Operation Scheme's action has tried
568568 to be applied.
569569
570570 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/tried_regions/<R>/start
571571 Date: Oct 2022
572−Contact: SeongJae Park <sj@kernel.org>
572+Contact: SJ Park <sj@kernel.org>
573573 Description: Reading this file returns the start address of a memory region
574574 that corresponding DAMON-based Operation Scheme's action has
575575 tried to be applied.
576576
577577 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/tried_regions/<R>/end
578578 Date: Oct 2022
579−Contact: SeongJae Park <sj@kernel.org>
579+Contact: SJ Park <sj@kernel.org>
580580 Description: Reading this file returns the end address of a memory region
581581 that corresponding DAMON-based Operation Scheme's action has
582582 tried to be applied.
583583
584584 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/tried_regions/<R>/nr_accesses
585585 Date: Oct 2022
586−Contact: SeongJae Park <sj@kernel.org>
586+Contact: SJ Park <sj@kernel.org>
587587 Description: Reading this file returns the 'nr_accesses' of a memory region
588588 that corresponding DAMON-based Operation Scheme's action has
589589 tried to be applied.
590590
591591 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/tried_regions/<R>/age
592592 Date: Oct 2022
593−Contact: SeongJae Park <sj@kernel.org>
593+Contact: SJ Park <sj@kernel.org>
594594 Description: Reading this file returns the 'age' of a memory region that
595595 corresponding DAMON-based Operation Scheme's action has tried
596596 to be applied.
597597
598598 What: /sys/kernel/mm/damon/admin/kdamonds/<K>/contexts/<C>/schemes/<S>/tried_regions/<R>/sz_filter_passed
599599 Date: Dec 2024
600−Contact: SeongJae Park <sj@kernel.org>
600+Contact: SJ Park <sj@kernel.org>
601601 Description: Reading this file returns the size of the memory in the region
602602 that passed DAMON operations layer-handled filters of the
603603 scheme in bytes.
Documentation/devicetree/bindings/sound/realtek,rt5640.yaml+0−1
@@ -135,7 +135,6 @@ properties: · 134 unmodified lines
135135 required:
136136 - compatible
137137 - reg
138− - interrupts
139138
140139 unevaluatedProperties: false
141140
Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml+5−1
@@ -24,7 +24,11 @@ allOf: · 23 unmodified lines
2424
2525 properties:
2626 compatible:
27− const: spacemit,k1-spi
27+ oneOf:
28+ - const: spacemit,k1-spi
29+ - items:
30+ - const: spacemit,k3-spi
31+ - const: spacemit,k1-spi
2832
2933 reg:
3034 maxItems: 1
Documentation/netlink/specs/rt-link.yaml+20−20
@@ -1585,31 +1585,31 @@ attribute-sets: · 1584 unmodified lines
15851585 type: u32
15861586 -
15871587 name: mode
1588− type: flag
1588+ type: u8
15891589 -
15901590 name: guard
1591− type: flag
1591+ type: u8
15921592 -
15931593 name: protect
1594− type: flag
1594+ type: u8
15951595 -
15961596 name: fast-leave
1597− type: flag
1597+ type: u8
15981598 -
15991599 name: learning
1600− type: flag
1600+ type: u8
16011601 -
16021602 name: unicast-flood
1603− type: flag
1603+ type: u8
16041604 -
16051605 name: proxyarp
1606− type: flag
1606+ type: u8
16071607 -
16081608 name: learning-sync
1609− type: flag
1609+ type: u8
16101610 -
16111611 name: proxyarp-wifi
1612− type: flag
1612+ type: u8
16131613 -
16141614 name: root-id
16151615 type: binary
@@ -1656,34 +1656,34 @@ attribute-sets: · 40 unmodified lines
16561656 type: pad
16571657 -
16581658 name: mcast-flood
1659− type: flag
1659+ type: u8
16601660 -
16611661 name: mcast-to-ucast
1662− type: flag
1662+ type: u8
16631663 -
16641664 name: vlan-tunnel
1665− type: flag
1665+ type: u8
16661666 -
16671667 name: bcast-flood
1668− type: flag
1668+ type: u8
16691669 -
16701670 name: group-fwd-mask
16711671 type: u16
16721672 -
16731673 name: neigh-suppress
1674− type: flag
1674+ type: u8
16751675 -
16761676 name: isolated
1677− type: flag
1677+ type: u8
16781678 -
16791679 name: backup-port
16801680 type: u32
16811681 -
16821682 name: mrp-ring-open
1683− type: flag
1683+ type: u8
16841684 -
16851685 name: mrp-in-open
1686− type: flag
1686+ type: u8
16871687 -
16881688 name: mcast-eht-hosts-limit
16891689 type: u32
@@ -1692,10 +1692,10 @@ attribute-sets: · 2 unmodified lines
16921692 type: u32
16931693 -
16941694 name: locked
1695− type: flag
1695+ type: u8
16961696 -
16971697 name: mab
1698− type: flag
1698+ type: u8
16991699 -
17001700 name: mcast-n-groups
17011701 type: u32
@@ -1704,7 +1704,7 @@ attribute-sets: · 2 unmodified lines
17041704 type: u32
17051705 -
17061706 name: neigh-vlan-suppress
1707− type: flag
1707+ type: u8
17081708 -
17091709 name: backup-nhid
17101710 type: u32
Documentation/watchdog/watchdog-parameters.rst+2−2
@@ -59,7 +59,7 @@ advantechwdt: · 58 unmodified lines
5959
6060 alim1535_wdt:
6161 timeout:
62− Watchdog timeout in seconds. (0 < timeout < 18000, default=60
62+ Watchdog timeout in seconds. (0 < timeout < 18000, default=60)
6363 nowayout:
6464 Watchdog cannot be stopped once started
6565 (default=kernel config parameter)
@@ -68,7 +68,7 @@ alim1535_wdt: · 2 unmodified lines
6868
6969 alim7101_wdt:
7070 timeout:
71− Watchdog timeout in seconds. (1<=timeout<=3600, default=30
71+ Watchdog timeout in seconds. (1<=timeout<=3600, default=30)
7272 use_gpio:
7373 Use the gpio watchdog (required by old cobalt boards).
7474 default=0/off/no
MAINTAINERS+10−7
@@ -6478,7 +6478,7 @@ L: linux-cifs@vger.kernel.org · 6477 unmodified lines
64786478 L: samba-technical@lists.samba.org (moderated for non-subscribers)
64796479 S: Supported
64806480 W: https://wiki.samba.org/index.php/LinuxCIFS
6481−T: git https://git.samba.org/sfrench/cifs-2.6.git
6481+T: git https://git.samba.org/sfrench/cifs-2.6.git for-next
64826482 F: Documentation/admin-guide/cifs/
64836483 F: fs/smb/client/
64846484 F: fs/smb/common/
@@ -7125,7 +7125,7 @@ W: https://docs.dasharo.com/ · 640 unmodified lines
71257125 F: drivers/platform/x86/dasharo-acpi.c
71267126
71277127 DAMON
7128−M: SeongJae Park <sj@kernel.org>
7128+M: SJ Park <sj@kernel.org>
71297129 L: damon@lists.linux.dev
71307130 L: linux-mm@kvack.org
71317131 S: Maintained
@@ -11108,6 +11108,7 @@ F: drivers/platform/x86/gpd-pocket-fan.c · 3976 unmodified lines
1110811108
1110911109 GPIB DRIVERS
1111011110 M: Dave Penkler <dpenkler@gmail.com>
11111+M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1111111112 S: Maintained
1111211113 F: drivers/gpib/
1111311114 F: include/uapi/linux/gpib.h
@@ -14142,7 +14143,7 @@ R: Sergey Senozhatsky <senozhatsky@chromium.org> · 3028 unmodified lines
1414214143 R: Tom Talpey <tom@talpey.com>
1414314144 L: linux-cifs@vger.kernel.org
1414414145 S: Maintained
14145−T: git https://git.samba.org/ksmbd.git
14146+T: git https://git.samba.org/ksmbd.git ksmbd-for-next
1414614147 F: Documentation/filesystems/smb/ksmbd.rst
1414714148 F: fs/smb/common/
1414814149 F: fs/smb/server/
@@ -17257,6 +17258,7 @@ R: Ryan Roberts <ryan.roberts@arm.com> · 3108 unmodified lines
1725717258 R: Dev Jain <dev.jain@arm.com>
1725817259 R: Barry Song <baohua@kernel.org>
1725917260 R: Lance Yang <lance.yang@linux.dev>
17261+R: Usama Arif <usama.arif@linux.dev>
1726017262 L: linux-mm@kvack.org
1726117263 S: Maintained
1726217264 W: http://www.linux-mm.org
@@ -19108,6 +19110,7 @@ F: drivers/nfc/ · 1845 unmodified lines
1910819110 F: include/net/nfc/
1910919111 F: include/uapi/linux/nfc.h
1911019112 F: net/nfc/
19113+F: tools/testing/selftests/nci/
1911119114
1911219115 NFC VIRTUAL NCI DEVICE DRIVER
1911319116 M: Bongsu Jeon <bongsu.jeon@samsung.com>
@@ -19299,7 +19302,7 @@ F: fs/ntfs3/ · 185 unmodified lines
1929919302
1930019303 NTSYNC SYNCHRONIZATION PRIMITIVE DRIVER
1930119304 M: Elizabeth Figura <zfigura@codeweavers.com>
19302−L: wine-devel@winehq.org
19305+L: wine-devel@list.winehq.org
1930319306 S: Supported
1930419307 F: Documentation/userspace-api/ntsync.rst
1930519308 F: drivers/misc/ntsync.c
@@ -25972,8 +25975,9 @@ F: Documentation/devicetree/bindings/phy/st,stm32mp25-combophy.yaml · 6666 unmodified lines
2597225975 F: drivers/phy/st/phy-stm32-combophy.c
2597325976
2597425977 STMMAC ETHERNET DRIVER
25978+M: Maxime Chevallier <maxime.chevallier@bootlin.com>
2597525979 L: netdev@vger.kernel.org
25976−S: Orphan
25980+S: Maintained
2597725981 F: Documentation/networking/device_drivers/ethernet/stmicro/
2597825982 F: drivers/net/ethernet/stmicro/stmmac/
2597925983
@@ -27929,7 +27933,6 @@ F: drivers/usb/isp1760/* · 1949 unmodified lines
2792927933
2793027934 USB LAN78XX ETHERNET DRIVER
2793127935 M: Thangaraj Samynathan <Thangaraj.S@microchip.com>
27932−M: Rengarajan Sundararajan <Rengarajan.S@microchip.com>
2793327936 M: UNGLinuxDriver@microchip.com
2793427937 L: netdev@vger.kernel.org
2793527938 S: Maintained
@@ -29398,7 +29401,7 @@ F: net/xdp/ · 1462 unmodified lines
2939829401 F: tools/testing/selftests/bpf/*xsk*
2939929402
2940029403 XEN BLOCK SUBSYSTEM
29401−M: Roger Pau Monné <roger.pau@citrix.com>
29404+M: Roger Pau Monné <roger@xenproject.org>
2940229405 L: xen-devel@lists.xenproject.org (moderated for non-subscribers)
2940329406 S: Supported
2940429407 F: drivers/block/xen*
Makefile+6−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 7
33 PATCHLEVEL = 2
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc4
5+EXTRAVERSION = -rc5
66 NAME = Baby Opossum Posse
77
88 # *DOCUMENTATION*
@@ -475,6 +475,10 @@ KBUILD_USERLDFLAGS := $(USERLDFLAGS) · 466 unmodified lines
475475
476476 # These flags apply to all Rust code in the tree, including the kernel and
477477 # host programs.
478+#
479+# `-Aclippy::unwrap_or_default`: the lint is buggy [1] and ignores our
480+# MSRV. It can trigger depending on the optimization level.
481+# [1] https://github.com/rust-lang/rust-clippy/issues/17379
478482 export rust_common_flags := --edition=2021 \
479483 -Zbinary_dep_depinfo=y \
480484 -Astable_features \
@@ -503,6 +507,7 @@ export rust_common_flags := --edition=2021 \ · 22 unmodified lines
503507 -Aclippy::uninlined_format_args \
504508 -Wclippy::unnecessary_safety_comment \
505509 -Wclippy::unnecessary_safety_doc \
510+ -Aclippy::unwrap_or_default \
506511 -Wrustdoc::missing_crate_level_docs \
507512 -Wrustdoc::unescaped_backticks
508513
arch/arm64/include/asm/esr.h+1−1
@@ -131,7 +131,7 @@ · 130 unmodified lines
131131 * Annoyingly, the negative levels for Address size faults aren't laid out
132132 * contiguously (or in the desired order)
133133 */
134−#define ESR_ELx_FSC_ADDRSZ_nL(n) ((n) == -1 ? 0x25 : 0x2C)
134+#define ESR_ELx_FSC_ADDRSZ_nL(n) ((n) == -1 ? 0x29 : 0x2C)
135135 #define ESR_ELx_FSC_ADDRSZ_L(n) ((n) < 0 ? ESR_ELx_FSC_ADDRSZ_nL(n) : \
136136 (ESR_ELx_FSC_ADDRSZ + (n)))
137137
arch/arm64/include/asm/fixmap.h+5−1
@@ -78,8 +78,12 @@ enum fixed_addresses { · 77 unmodified lines
7878 /*
7979 * Temporary boot-time mappings, used by early_ioremap(),
8080 * before ioremap() is functional.
81+ *
82+ * Reserve one extra page so a 256K mapping may start at any
83+ * offset within a page. early_ioremap() maps the page-aligned
84+ * physical range, so the initial offset can consume an extra page.
8185 */
82−#define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE)
86+#define NR_FIX_BTMAPS ((SZ_256K / PAGE_SIZE) + 1)
8387 #define FIX_BTMAPS_SLOTS 7
8488 #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
8589
arch/arm64/include/asm/kprobes.h+6−0
@@ -26,6 +26,12 @@ · 25 unmodified lines
2626 struct prev_kprobe {
2727 struct kprobe *kp;
2828 unsigned int status;
29+
30+ /*
31+ * The original DAIF state of the outer kprobe, saved here before
32+ * a nested kprobe overwrites kcb->saved_irqflag during reentry.
33+ */
34+ unsigned long saved_irqflag;
2935 };
3036
3137 /* per-cpu kprobe control block */
arch/arm64/kernel/probes/kprobes.c+44−1
@@ -174,12 +174,27 @@ static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) · 173 unmodified lines
174174 {
175175 kcb->prev_kprobe.kp = kprobe_running();
176176 kcb->prev_kprobe.status = kcb->kprobe_status;
177+
178+ /*
179+ * Save the outer kprobe's original DAIF flags before the nested
180+ * kprobe calls kprobes_save_local_irqflag() and overwrites
181+ * kcb->saved_irqflag. Without this, the outer kprobe will restore
182+ * the wrong DAIF state and leave interrupts permanently masked.
183+ */
184+ kcb->prev_kprobe.saved_irqflag = kcb->saved_irqflag;
177185 }
178186
179187 static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
180188 {
181189 __this_cpu_write(current_kprobe, kcb->prev_kprobe.kp);
182190 kcb->kprobe_status = kcb->prev_kprobe.status;
191+
192+ /*
193+ * Restore the outer kprobe's saved_irqflag so that when its
194+ * single-step completes, kprobes_restore_local_irqflag() uses
195+ * the correct original DAIF value.
196+ */
197+ kcb->saved_irqflag = kcb->prev_kprobe.saved_irqflag;
183198 }
184199
185200 static void __kprobes set_current_kprobe(struct kprobe *p)
@@ -240,10 +255,16 @@ static int __kprobes reenter_kprobe(struct kprobe *p, · 54 unmodified lines
240255 switch (kcb->kprobe_status) {
241256 case KPROBE_HIT_SSDONE:
242257 case KPROBE_HIT_ACTIVE:
258+ case KPROBE_HIT_SS:
259+ /*
260+ * A probe can be hit while another kprobe is preparing or
261+ * executing its XOL single-step instruction. This is still a
262+ * recoverable one-level reentry, so handle it in the same way as
263+ * reentry from KPROBE_HIT_ACTIVE or KPROBE_HIT_SSDONE.
264+ */
243265 kprobes_inc_nmissed_count(p);
244266 setup_singlestep(p, regs, kcb, 1);
245267 break;
246− case KPROBE_HIT_SS:
247268 case KPROBE_REENTER:
248269 pr_warn("Failed to recover from reentered kprobes.\n");
249270 dump_kprobe(p);
@@ -282,9 +303,31 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr) · 32 unmodified lines
282303 struct kprobe *cur = kprobe_running();
283304 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
284305
306+ /*
307+ * Simulated kprobes execute in the debug trap context and have no
308+ * XOL slot. Any page fault taken while a simulated kprobe is in
309+ * progress cannot have been caused by kprobe single-stepping and
310+ * must be left alone for the normal page fault handler, including
311+ * fixup_exception.
312+ */
313+ if (cur && !cur->ainsn.xol_insn)
314+ return 0;
315+
285316 switch (kcb->kprobe_status) {
286317 case KPROBE_HIT_SS:
287318 case KPROBE_REENTER:
319+ /*
320+ * A page fault taken while in KPROBE_HIT_SS or
321+ * KPROBE_REENTER state is only attributable to kprobe
322+ * single-stepping if the faulting PC points to the
323+ * current kprobe's XOL instruction. If the fault occurred
324+ * elsewhere (e.g. in perf or tracing code invoked from the
325+ * debug exception path), leave it for the normal page fault
326+ * handler to process.
327+ */
328+ if (instruction_pointer(regs) != (unsigned long)cur->ainsn.xol_insn)
329+ break;
330+
288331 /*
289332 * We are here because the instruction being single
290333 * stepped caused a page fault. We reset the current
arch/arm64/mm/fault.c+4−3
@@ -76,6 +76,8 @@ static void data_abort_decode(unsigned long esr) · 75 unmodified lines
7676 pr_alert(" SF = %lu, AR = %lu\n",
7777 (esr & ESR_ELx_SF) >> ESR_ELx_SF_SHIFT,
7878 (esr & ESR_ELx_AR) >> ESR_ELx_AR_SHIFT);
79+ pr_alert(" Xs = %llu\n",
80+ (iss2 & ESR_ELx_Xs_MASK) >> ESR_ELx_Xs_SHIFT);
7981 } else {
8082 pr_alert(" ISV = 0, ISS = 0x%08lx, ISS2 = 0x%08lx\n",
8183 esr & ESR_ELx_ISS_MASK, iss2);
@@ -87,11 +89,10 @@ static void data_abort_decode(unsigned long esr) · 5 unmodified lines
8789 (iss2 & ESR_ELx_TnD) >> ESR_ELx_TnD_SHIFT,
8890 (iss2 & ESR_ELx_TagAccess) >> ESR_ELx_TagAccess_SHIFT);
8991
90− pr_alert(" GCS = %ld, Overlay = %lu, DirtyBit = %lu, Xs = %llu\n",
92+ pr_alert(" GCS = %ld, Overlay = %lu, DirtyBit = %lu\n",
9193 (iss2 & ESR_ELx_GCS) >> ESR_ELx_GCS_SHIFT,
9294 (iss2 & ESR_ELx_Overlay) >> ESR_ELx_Overlay_SHIFT,
93− (iss2 & ESR_ELx_DirtyBit) >> ESR_ELx_DirtyBit_SHIFT,
94− (iss2 & ESR_ELx_Xs_MASK) >> ESR_ELx_Xs_SHIFT);
95+ (iss2 & ESR_ELx_DirtyBit) >> ESR_ELx_DirtyBit_SHIFT);
9596 }
9697
9798 static void mem_abort_decode(unsigned long esr)
arch/arm64/mm/hugetlbpage.c+1−1
@@ -87,7 +87,7 @@ static int find_num_contig(struct mm_struct *mm, unsigned long addr, · 86 unmodified lines
8787 p4dp = p4d_offset(pgdp, addr);
8888 pudp = pud_offset(p4dp, addr);
8989 pmdp = pmd_offset(pudp, addr);
90− if ((pte_t *)pmdp == ptep) {
90+ if ((pte_t *)PTR_ALIGN_DOWN(pmdp, sizeof(*pmdp) * CONT_PMDS) == ptep) {
9191 *pgsize = PMD_SIZE;
9292 return CONT_PMDS;
9393 }
arch/arm64/mm/mmu.c+1−1
@@ -2194,7 +2194,7 @@ static int prevent_memory_remove_notifier(struct notifier_block *nb, · 2193 unmodified lines
21942194 }
21952195 }
21962196
2197− if (!can_unmap_without_split(pfn, arg->nr_pages))
2197+ if (!can_unmap_without_split(arg->start_pfn, arg->nr_pages))
21982198 return NOTIFY_BAD;
21992199
22002200 return NOTIFY_OK;
arch/loongarch/include/asm/asmmacro.h+1−1
@@ -14,7 +14,7 @@ · 13 unmodified lines
1414 #ifdef CONFIG_64BIT
1515 #define TASK_STRUCT_OFFSET 0
1616 #else
17−#define TASK_STRUCT_OFFSET 2000
17+#define TASK_STRUCT_OFFSET 2040
1818 #endif
1919
2020 .macro cpu_save_nonscratch thread
arch/loongarch/kernel/acpi.c+26−1
@@ -201,10 +201,12 @@ static void __init acpi_process_madt(void) · 200 unmodified lines
201201 }
202202
203203 int pptt_enabled;
204+static int acpi_nr_packages;
205+static int acpi_package_ids[MAX_PACKAGES];
204206
205207 int __init parse_acpi_topology(void)
206208 {
207− int cpu, topology_id;
209+ int i, cpu, topology_id;
208210
209211 for_each_possible_cpu(cpu) {
210212 topology_id = find_acpi_cpu_topology(cpu, 0);
@@ -222,6 +224,29 @@ int __init parse_acpi_topology(void) · 11 unmodified lines
222224
223225 cpu_data[cpu].core = topology_id;
224226 }
227+
228+ topology_id = find_acpi_cpu_topology_package(cpu);
229+ if (topology_id < 0) {
230+ pr_warn("Invalid BIOS PPTT\n");
231+ return -ENOENT;
232+ }
233+
234+ for (i = 0; i < acpi_nr_packages; i++)
235+ if (acpi_package_ids[i] == topology_id)
236+ break;
237+
238+ if (i == acpi_nr_packages)
239+ acpi_package_ids[acpi_nr_packages++] = topology_id;
240+
241+ cpu_data[cpu].package = topology_id;
242+ }
243+
244+ for_each_possible_cpu(cpu) {
245+ for (i = 0; i < acpi_nr_packages; i++)
246+ if (cpu_data[cpu].package == acpi_package_ids[i]) {
247+ cpu_data[cpu].package = i; /* Canonicalize */
248+ break;
249+ }
225250 }
226251
227252 pptt_enabled = 1;
arch/loongarch/kernel/kgdb.c+2−1
@@ -252,7 +252,8 @@ static int kgdb_loongarch_notify(struct notifier_block *self, unsigned long cmd, · 251 unmodified lines
252252 if (atomic_read(&kgdb_active) != -1)
253253 kgdb_nmicallback(smp_processor_id(), regs);
254254
255− if (kgdb_handle_exception(args->trapnr, args->signr, cmd, regs))
255+ if (kgdb_handle_exception(regs->csr_era == stepped_address ? 0 : args->trapnr,
256+ args->signr, cmd, regs))
256257 return NOTIFY_DONE;
257258
258259 if (atomic_read(&kgdb_setting_breakpoint))
arch/loongarch/kernel/machine_kexec.c+4−1
@@ -42,6 +42,7 @@ static unsigned long first_ind_entry; · 41 unmodified lines
4242 int machine_kexec_prepare(struct kimage *kimage)
4343 {
4444 int i;
45+ char head[8];
4546 char *bootloader = "kexec";
4647 void *cmdline_ptr = (void *)KEXEC_CMDLINE_ADDR;
4748
@@ -59,7 +60,9 @@ int machine_kexec_prepare(struct kimage *kimage) · 11 unmodified lines
5960 } else {
6061 /* Find the command line */
6162 for (i = 0; i < kimage->nr_segments; i++) {
62− if (!strncmp(bootloader, (char __user *)kimage->segment[i].buf, strlen(bootloader))) {
63+ if (copy_from_user(head, kimage->segment[i].buf, strlen(bootloader)))
64+ continue;
65+ if (!strncmp(bootloader, head, strlen(bootloader))) {
6366 if (!copy_from_user(cmdline_ptr, kimage->segment[i].buf, COMMAND_LINE_SIZE))
6467 kimage->arch.cmdline_ptr = (unsigned long)cmdline_ptr;
6568 break;
arch/loongarch/kernel/rethook_trampoline.S+9−9
@@ -71,27 +71,27 @@ · 70 unmodified lines
7171 cfi_ld s7, PT_R30
7272 cfi_ld s8, PT_R31
7373 LONG_L t0, sp, PT_CRMD
74− li.d t1, 0x7 /* mask bit[1:0] PLV, bit[2] IE */
74+ LONG_LI t1, 0x7 /* mask bit[1:0] PLV, bit[2] IE */
7575 csrxchg t0, t1, LOONGARCH_CSR_CRMD
7676 .endm
7777
7878 SYM_CODE_START(arch_rethook_trampoline)
7979 UNWIND_HINT_UNDEFINED
80− addi.d sp, sp, -PT_SIZE
80+ PTR_ADDI sp, sp, -PT_SIZE
8181 save_all_base_regs
8282
83− addi.d t0, sp, PT_SIZE
84− LONG_S t0, sp, PT_R3
83+ PTR_ADDI t0, sp, PT_SIZE
84+ LONG_S t0, sp, PT_R3
8585
86− move a0, sp /* pt_regs */
86+ move a0, sp /* pt_regs */
8787
88− bl arch_rethook_trampoline_callback
88+ bl arch_rethook_trampoline_callback
8989
9090 /* use the result as the return-address */
91− move ra, a0
91+ move ra, a0
9292
9393 restore_all_base_regs
94− addi.d sp, sp, PT_SIZE
94+ PTR_ADDI sp, sp, PT_SIZE
9595
96− jr ra
96+ jr ra
9797 SYM_CODE_END(arch_rethook_trampoline)
arch/loongarch/kernel/setup.c+1−2
@@ -603,6 +603,7 @@ void __init setup_arch(char **cmdline_p) · 602 unmodified lines
603603 memblock_init();
604604 pagetable_init();
605605 bootcmdline_init(cmdline_p);
606+ jump_label_init(); /* Initialise the static keys for early params */
606607 parse_early_param();
607608 reserve_initrd_mem();
608609
@@ -610,8 +611,6 @@ void __init setup_arch(char **cmdline_p) · 1 unmodified line
610611 arch_mem_init(cmdline_p);
611612
612613 resource_init();
613− jump_label_init(); /* Initialise the static keys for paravirtualization */
614−
615614 #ifdef CONFIG_SMP
616615 plat_smp_setup();
617616 prefill_possible_map();
arch/loongarch/kernel/smp.c+2−2
@@ -426,10 +426,10 @@ void loongson_init_secondary(void) · 425 unmodified lines
426426 numa_add_cpu(cpu);
427427 #endif
428428 per_cpu(cpu_state, cpu) = CPU_ONLINE;
429− cpu_data[cpu].package =
430− cpu_logical_map(cpu) / loongson_sysconf.cores_per_package;
431429 cpu_data[cpu].core = pptt_enabled ? cpu_data[cpu].core :
432430 cpu_logical_map(cpu) % loongson_sysconf.cores_per_package;
431+ cpu_data[cpu].package = pptt_enabled ? cpu_data[cpu].package :
432+ cpu_logical_map(cpu) / loongson_sysconf.cores_per_package;
433433 cpu_data[cpu].global_id = cpu_logical_map(cpu);
434434 }
435435
arch/loongarch/net/bpf_jit.c+5−4
@@ -835,7 +835,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext · 834 unmodified lines
835835 move_reg(ctx, t1, src);
836836 emit_sext_32(ctx, t1, is32);
837837 emit_insn(ctx, divd, dst, dst, t1);
838− emit_sext_32(ctx, dst, is32);
838+ emit_zext_32(ctx, dst, is32);
839839 }
840840 break;
841841
@@ -852,7 +852,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext · 10 unmodified lines
852852 emit_sext_32(ctx, t1, is32);
853853 emit_sext_32(ctx, dst, is32);
854854 emit_insn(ctx, divd, dst, dst, t1);
855− emit_sext_32(ctx, dst, is32);
855+ emit_zext_32(ctx, dst, is32);
856856 }
857857 break;
858858
@@ -870,7 +870,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext · 11 unmodified lines
870870 move_reg(ctx, t1, src);
871871 emit_sext_32(ctx, t1, is32);
872872 emit_insn(ctx, modd, dst, dst, t1);
873− emit_sext_32(ctx, dst, is32);
873+ emit_zext_32(ctx, dst, is32);
874874 }
875875 break;
876876
@@ -887,7 +887,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext · 10 unmodified lines
887887 emit_sext_32(ctx, t1, is32);
888888 emit_sext_32(ctx, dst, is32);
889889 emit_insn(ctx, modd, dst, dst, t1);
890− emit_sext_32(ctx, dst, is32);
890+ emit_zext_32(ctx, dst, is32);
891891 }
892892 break;
893893
@@ -2361,6 +2361,7 @@ void bpf_jit_free(struct bpf_prog *prog) · 1467 unmodified lines
23612361 */
23622362 if (jit_data) {
23632363 bpf_jit_binary_pack_finalize(jit_data->ro_header, jit_data->header);
2364+ kvfree(jit_data->ctx.offset);
23642365 kfree(jit_data);
23652366 }
23662367 hdr = bpf_jit_binary_pack_hdr(prog);
arch/m68k/coldfire/m528x.c+1−1
@@ -110,7 +110,7 @@ void wildfiremod_halt(void) · 109 unmodified lines
110110 printk(KERN_INFO "WildFireMod hibernating...\n");
111111
112112 /* Set portE.5 to Digital IO */
113− mcf_write16(read16(MCFGPIO_PEPAR) & ~(1 << (5 * 2)), MCFGPIO_PEPAR);
113+ mcf_write16(mcf_read16(MCFGPIO_PEPAR) & ~(1 << (5 * 2)), MCFGPIO_PEPAR);
114114
115115 /* Make portE.5 an output */
116116 mcf_write8(mcf_read8(MCFGPIO_PDDR_E) | (1 << 5), MCFGPIO_PDDR_E);
arch/m68k/include/asm/page_mm.h+2−0
@@ -55,10 +55,12 @@ static inline void clear_page(void *page) · 54 unmodified lines
5555 #define clear_user_page(addr, vaddr, page) \
5656 do { clear_page(addr); \
5757 flush_dcache_page(page); \
58+ (void)(vaddr); \
5859 } while (0)
5960 #define copy_user_page(to, from, vaddr, page) \
6061 do { copy_page(to, from); \
6162 flush_dcache_page(page); \
63+ (void)(vaddr); \
6264 } while (0)
6365
6466 extern unsigned long m68k_memoffset;
arch/riscv/include/asm/kvm_host.h+5−5
@@ -209,13 +209,13 @@ struct kvm_vcpu_arch { · 208 unmodified lines
209209 /*
210210 * VCPU interrupts
211211 *
212− * We have a lockless approach for tracking pending VCPU interrupts
213− * implemented using atomic bitops. The irqs_pending bitmap represent
214− * pending interrupts whereas irqs_pending_mask represent bits changed
215− * in irqs_pending. Our approach is modeled around multiple producer
216− * and single consumer problem where the consumer is the VCPU itself.
212+ * The irqs_pending bitmap represents pending interrupts whereas
213+ * irqs_pending_mask represents bits changed in irqs_pending. Updates
214+ * to these bitmaps are serialized so vcpu interrupt sync/flush cannot
215+ * drop a newly injected interrupt while syncing guest-visible HVIP.
217216 */
218217 #define KVM_RISCV_VCPU_NR_IRQS 64
218+ raw_spinlock_t irqs_pending_lock;
219219 DECLARE_BITMAP(irqs_pending, KVM_RISCV_VCPU_NR_IRQS);
220220 DECLARE_BITMAP(irqs_pending_mask, KVM_RISCV_VCPU_NR_IRQS);
221221
arch/riscv/kvm/aia.c+28−7
@@ -53,12 +53,15 @@ void kvm_riscv_vcpu_aia_flush_interrupts(struct kvm_vcpu *vcpu) · 52 unmodified lines
5353 struct kvm_vcpu_aia_csr *csr = &vcpu->arch.aia_context.guest_csr;
5454 unsigned long mask, val;
5555
56+ lockdep_assert_held(&vcpu->arch.irqs_pending_lock);
57+
5658 if (!kvm_riscv_aia_available())
5759 return;
5860
59− if (READ_ONCE(vcpu->arch.irqs_pending_mask[1])) {
60− mask = xchg_acquire(&vcpu->arch.irqs_pending_mask[1], 0);
61− val = READ_ONCE(vcpu->arch.irqs_pending[1]) & mask;
61+ mask = vcpu->arch.irqs_pending_mask[1];
62+ if (mask) {
63+ vcpu->arch.irqs_pending_mask[1] = 0;
64+ val = vcpu->arch.irqs_pending[1] & mask;
6265
6366 csr->hviph &= ~mask;
6467 csr->hviph |= val;
@@ -69,6 +72,8 @@ void kvm_riscv_vcpu_aia_sync_interrupts(struct kvm_vcpu *vcpu) · 4 unmodified lines
6972 {
7073 struct kvm_vcpu_aia_csr *csr = &vcpu->arch.aia_context.guest_csr;
7174
75+ lockdep_assert_held(&vcpu->arch.irqs_pending_lock);
76+
7277 if (kvm_riscv_aia_available())
7378 csr->vsieh = ncsr_read(CSR_VSIEH);
7479 }
@@ -77,13 +82,22 @@ void kvm_riscv_vcpu_aia_sync_interrupts(struct kvm_vcpu *vcpu) · 2 unmodified lines
7782 bool kvm_riscv_vcpu_aia_has_interrupts(struct kvm_vcpu *vcpu, u64 mask)
7883 {
7984 unsigned long seip;
85+#ifdef CONFIG_32BIT
86+ unsigned long flags;
87+ bool pending;
88+#endif
8089
8190 if (!kvm_riscv_aia_available())
8291 return false;
8392
8493 #ifdef CONFIG_32BIT
85− if (READ_ONCE(vcpu->arch.irqs_pending[1]) &
86− (vcpu->arch.aia_context.guest_csr.vsieh & upper_32_bits(mask)))
94+ raw_spin_lock_irqsave(&vcpu->arch.irqs_pending_lock, flags);
95+ pending = vcpu->arch.irqs_pending[1] &
96+ (vcpu->arch.aia_context.guest_csr.vsieh &
97+ upper_32_bits(mask));
98+ raw_spin_unlock_irqrestore(&vcpu->arch.irqs_pending_lock, flags);
99+
100+ if (pending)
87101 return true;
88102 #endif
89103
@@ -207,6 +221,9 @@ int kvm_riscv_vcpu_aia_set_csr(struct kvm_vcpu *vcpu, · 117 unmodified lines
207221 {
208222 struct kvm_vcpu_aia_csr *csr = &vcpu->arch.aia_context.guest_csr;
209223 unsigned long regs_max = sizeof(struct kvm_riscv_aia_csr) / sizeof(unsigned long);
224+#ifdef CONFIG_32BIT
225+ unsigned long flags;
226+#endif
210227
211228 if (!riscv_isa_extension_available(vcpu->arch.isa, SSAIA))
212229 return -ENOENT;
@@ -219,8 +236,12 @@ int kvm_riscv_vcpu_aia_set_csr(struct kvm_vcpu *vcpu, · 6 unmodified lines
219236 ((unsigned long *)csr)[reg_num] = val;
220237
221238 #ifdef CONFIG_32BIT
222− if (reg_num == KVM_REG_RISCV_CSR_AIA_REG(siph))
223− WRITE_ONCE(vcpu->arch.irqs_pending_mask[1], 0);
239+ if (reg_num == KVM_REG_RISCV_CSR_AIA_REG(siph)) {
240+ raw_spin_lock_irqsave(&vcpu->arch.irqs_pending_lock, flags);
241+ vcpu->arch.irqs_pending_mask[1] = 0;
242+ raw_spin_unlock_irqrestore(&vcpu->arch.irqs_pending_lock,
243+ flags);
244+ }
224245 #endif
225246 }
226247
arch/riscv/kvm/gstage.c+5−1
@@ -5,11 +5,13 @@ · 4 unmodified lines
55 */
66
77 #include <linux/bitops.h>
8+#include <linux/cpufeature.h>
89 #include <linux/errno.h>
910 #include <linux/kvm_host.h>
1011 #include <linux/module.h>
1112 #include <linux/pgtable.h>
1213 #include <asm/kvm_gstage.h>
14+#include <asm/hwcap.h>
1315
1416 #ifdef CONFIG_64BIT
1517 unsigned long kvm_riscv_gstage_max_pgd_levels __ro_after_init = 3;
@@ -171,8 +173,10 @@ int kvm_riscv_gstage_set_pte(struct kvm_gstage *gstage, · 155 unmodified lines
171173 }
172174
173175 if (pte_val(*ptep) != pte_val(map->pte)) {
176+ bool was_invalid = !pte_val(*ptep);
174177 set_pte(ptep, map->pte);
175− if (gstage_pte_leaf(ptep))
178+ if (gstage_pte_leaf(ptep) &&
179+ !(was_invalid && riscv_has_extension_unlikely(RISCV_ISA_EXT_SVVPTC)))
176180 gstage_tlb_flush(gstage, current_level, map->addr);
177181 }
178182
arch/riscv/kvm/mmu.c+2−1
@@ -41,6 +41,7 @@ int kvm_riscv_mmu_ioremap(struct kvm *kvm, gpa_t gpa, phys_addr_t hpa, · 40 unmodified lines
4141 pgprot_t prot;
4242 unsigned long pfn;
4343 phys_addr_t addr, end;
44+ unsigned long pgd_levels = kvm->arch.pgd_levels;
4445 struct kvm_mmu_memory_cache pcache = {
4546 .gfp_custom = (in_atomic) ? GFP_ATOMIC | __GFP_ACCOUNT : 0,
4647 .gfp_zero = __GFP_ZERO,
@@ -63,7 +64,7 @@ int kvm_riscv_mmu_ioremap(struct kvm *kvm, gpa_t gpa, phys_addr_t hpa, · 16 unmodified lines
6364 if (!writable)
6465 map.pte = pte_wrprotect(map.pte);
6566
66− ret = kvm_mmu_topup_memory_cache(&pcache, kvm->arch.pgd_levels);
67+ ret = __kvm_mmu_topup_memory_cache(&pcache, pgd_levels, pgd_levels);
6768 if (ret)
6869 goto out;
6970
arch/riscv/kvm/vcpu.c+48−20
@@ -80,6 +80,7 @@ static void kvm_riscv_vcpu_context_reset(struct kvm_vcpu *vcpu, · 79 unmodified lines
8080
8181 static void kvm_riscv_reset_vcpu(struct kvm_vcpu *vcpu, bool kvm_sbi_reset)
8282 {
83+ unsigned long flags;
8384 bool loaded;
8485
8586 /**
@@ -104,8 +105,10 @@ static void kvm_riscv_reset_vcpu(struct kvm_vcpu *vcpu, bool kvm_sbi_reset) · 18 unmodified lines
104105
105106 kvm_riscv_vcpu_aia_reset(vcpu);
106107
108+ raw_spin_lock_irqsave(&vcpu->arch.irqs_pending_lock, flags);
107109 bitmap_zero(vcpu->arch.irqs_pending, KVM_RISCV_VCPU_NR_IRQS);
108110 bitmap_zero(vcpu->arch.irqs_pending_mask, KVM_RISCV_VCPU_NR_IRQS);
111+ raw_spin_unlock_irqrestore(&vcpu->arch.irqs_pending_lock, flags);
109112
110113 kvm_riscv_vcpu_pmu_reset(vcpu);
111114
@@ -151,6 +154,7 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) · 39 unmodified lines
151154
152155 /* Setup VCPU hfence queue */
153156 spin_lock_init(&vcpu->arch.hfence_lock);
157+ raw_spin_lock_init(&vcpu->arch.irqs_pending_lock);
154158
155159 spin_lock_init(&vcpu->arch.reset_state.lock);
156160
@@ -352,10 +356,14 @@ void kvm_riscv_vcpu_flush_interrupts(struct kvm_vcpu *vcpu) · 195 unmodified lines
352356 {
353357 struct kvm_vcpu_csr *csr = &vcpu->arch.guest_csr;
354358 unsigned long mask, val;
359+ unsigned long flags;
355360
356− if (READ_ONCE(vcpu->arch.irqs_pending_mask[0])) {
357− mask = xchg_acquire(&vcpu->arch.irqs_pending_mask[0], 0);
358− val = READ_ONCE(vcpu->arch.irqs_pending[0]) & mask;
361+ raw_spin_lock_irqsave(&vcpu->arch.irqs_pending_lock, flags);
362+
363+ mask = vcpu->arch.irqs_pending_mask[0];
364+ if (mask) {
365+ vcpu->arch.irqs_pending_mask[0] = 0;
366+ val = vcpu->arch.irqs_pending[0] & mask;
359367
360368 csr->hvip &= ~mask;
361369 csr->hvip |= val;
@@ -363,11 +371,14 @@ void kvm_riscv_vcpu_flush_interrupts(struct kvm_vcpu *vcpu) · 1 unmodified line
363371
364372 /* Flush AIA high interrupts */
365373 kvm_riscv_vcpu_aia_flush_interrupts(vcpu);
374+
375+ raw_spin_unlock_irqrestore(&vcpu->arch.irqs_pending_lock, flags);
366376 }
367377
368378 void kvm_riscv_vcpu_sync_interrupts(struct kvm_vcpu *vcpu)
369379 {
370380 unsigned long hvip;
381+ unsigned long flags;
371382 struct kvm_vcpu_arch *v = &vcpu->arch;
372383 struct kvm_vcpu_csr *csr = &vcpu->arch.guest_csr;
373384
@@ -376,34 +387,41 @@ void kvm_riscv_vcpu_sync_interrupts(struct kvm_vcpu *vcpu) · 2 unmodified lines
376387
377388 /* Sync-up HVIP.VSSIP bit changes does by Guest */
378389 hvip = ncsr_read(CSR_HVIP);
390+
391+ raw_spin_lock_irqsave(&v->irqs_pending_lock, flags);
392+
379393 if ((csr->hvip ^ hvip) & (1UL << IRQ_VS_SOFT)) {
380394 if (hvip & (1UL << IRQ_VS_SOFT)) {
381− if (!test_and_set_bit(IRQ_VS_SOFT,
382− v->irqs_pending_mask))
383− set_bit(IRQ_VS_SOFT, v->irqs_pending);
395+ if (!__test_and_set_bit(IRQ_VS_SOFT,
396+ v->irqs_pending_mask))
397+ __set_bit(IRQ_VS_SOFT, v->irqs_pending);
384398 } else {
385− if (!test_and_set_bit(IRQ_VS_SOFT,
386− v->irqs_pending_mask))
387− clear_bit(IRQ_VS_SOFT, v->irqs_pending);
399+ if (!__test_and_set_bit(IRQ_VS_SOFT,
400+ v->irqs_pending_mask))
401+ __clear_bit(IRQ_VS_SOFT, v->irqs_pending);
388402 }
389403 }
390404
391405 /* Sync up the HVIP.LCOFIP bit changes (only clear) by the guest */
392406 if ((csr->hvip ^ hvip) & (1UL << IRQ_PMU_OVF)) {
393407 if (!(hvip & (1UL << IRQ_PMU_OVF)) &&
394− !test_and_set_bit(IRQ_PMU_OVF, v->irqs_pending_mask))
395− clear_bit(IRQ_PMU_OVF, v->irqs_pending);
408+ !__test_and_set_bit(IRQ_PMU_OVF, v->irqs_pending_mask))
409+ __clear_bit(IRQ_PMU_OVF, v->irqs_pending);
396410 }
397411
398412 /* Sync-up AIA high interrupts */
399413 kvm_riscv_vcpu_aia_sync_interrupts(vcpu);
400414
415+ raw_spin_unlock_irqrestore(&v->irqs_pending_lock, flags);
416+
401417 /* Sync-up timer CSRs */
402418 kvm_riscv_vcpu_timer_sync(vcpu);
403419 }
404420
405421 int kvm_riscv_vcpu_set_interrupt(struct kvm_vcpu *vcpu, unsigned int irq)
406422 {
423+ unsigned long flags;
424+
407425 /*
408426 * We only allow VS-mode software, timer, and external
409427 * interrupts when irq is one of the local interrupts
@@ -416,9 +434,10 @@ int kvm_riscv_vcpu_set_interrupt(struct kvm_vcpu *vcpu, unsigned int irq) · 6 unmodified lines
416434 irq != IRQ_PMU_OVF)
417435 return -EINVAL;
418436
419− set_bit(irq, vcpu->arch.irqs_pending);
420− smp_mb__before_atomic();
421− set_bit(irq, vcpu->arch.irqs_pending_mask);
437+ raw_spin_lock_irqsave(&vcpu->arch.irqs_pending_lock, flags);
438+ __set_bit(irq, vcpu->arch.irqs_pending);
439+ __set_bit(irq, vcpu->arch.irqs_pending_mask);
440+ raw_spin_unlock_irqrestore(&vcpu->arch.irqs_pending_lock, flags);
422441
423442 kvm_vcpu_kick(vcpu);
424443
@@ -427,6 +446,8 @@ int kvm_riscv_vcpu_set_interrupt(struct kvm_vcpu *vcpu, unsigned int irq) · 2 unmodified lines
427446
428447 int kvm_riscv_vcpu_unset_interrupt(struct kvm_vcpu *vcpu, unsigned int irq)
429448 {
449+ unsigned long flags;
450+
430451 /*
431452 * We only allow VS-mode software, timer, counter overflow and external
432453 * interrupts when irq is one of the local interrupts
@@ -439,26 +460,33 @@ int kvm_riscv_vcpu_unset_interrupt(struct kvm_vcpu *vcpu, unsigned int irq) · 6 unmodified lines
439460 irq != IRQ_PMU_OVF)
440461 return -EINVAL;
441462
442− clear_bit(irq, vcpu->arch.irqs_pending);
443− smp_mb__before_atomic();
444− set_bit(irq, vcpu->arch.irqs_pending_mask);
463+ raw_spin_lock_irqsave(&vcpu->arch.irqs_pending_lock, flags);
464+ __clear_bit(irq, vcpu->arch.irqs_pending);
465+ __set_bit(irq, vcpu->arch.irqs_pending_mask);
466+ raw_spin_unlock_irqrestore(&vcpu->arch.irqs_pending_lock, flags);
445467
446468 return 0;
447469 }
448470
449471 bool kvm_riscv_vcpu_has_interrupts(struct kvm_vcpu *vcpu, u64 mask)
450472 {
473+ unsigned long flags;
451474 unsigned long ie;
475+ bool ret;
452476
477+ raw_spin_lock_irqsave(&vcpu->arch.irqs_pending_lock, flags);
453478 ie = ((vcpu->arch.guest_csr.vsie & VSIP_VALID_MASK)
454479 << VSIP_TO_HVIP_SHIFT) & (unsigned long)mask;
455480 ie |= vcpu->arch.guest_csr.vsie & ~IRQ_LOCAL_MASK &
456481 (unsigned long)mask;
457− if (READ_ONCE(vcpu->arch.irqs_pending[0]) & ie)
458− return true;
482+ ret = vcpu->arch.irqs_pending[0] & ie;
483+ raw_spin_unlock_irqrestore(&vcpu->arch.irqs_pending_lock, flags);
459484
460485 /* Check AIA high interrupts */
461− return kvm_riscv_vcpu_aia_has_interrupts(vcpu, mask);
486+ if (!ret)
487+ ret = kvm_riscv_vcpu_aia_has_interrupts(vcpu, mask);
488+
489+ return ret;
462490 }
463491
464492 void __kvm_riscv_vcpu_power_off(struct kvm_vcpu *vcpu)
arch/riscv/kvm/vcpu_exit.c+19−0
@@ -38,6 +38,25 @@ static int gstage_page_fault(struct kvm_vcpu *vcpu, struct kvm_run *run, · 37 unmodified lines
3838 return kvm_riscv_vcpu_mmio_store(vcpu, run,
3939 fault_addr,
4040 trap->htinst);
41+ case EXC_INST_GUEST_PAGE_FAULT: {
42+ /*
43+ * No memslot backs this GPA and an instruction fetch
44+ * cannot be emulated as MMIO. On bare metal a fetch
45+ * from an unbacked physical address raises an
46+ * instruction access fault, so reflect that back to
47+ * the guest.
48+ */
49+ struct kvm_cpu_trap inst_trap = {
50+ .sepc = trap->sepc,
51+ .scause = EXC_INST_ACCESS,
52+ .stval = trap->stval,
53+ .htval = 0,
54+ .htinst = 0,
55+ };
56+
57+ kvm_riscv_vcpu_trap_redirect(vcpu, &inst_trap);
58+ return 1;
59+ }
4160 default:
4261 return -EOPNOTSUPP;
4362 };
arch/riscv/kvm/vcpu_onereg.c+12−34
@@ -50,19 +50,13 @@ static int kvm_riscv_vcpu_get_reg_config(struct kvm_vcpu *vcpu, · 49 unmodified lines
5050 reg_val = vcpu->arch.isa[0] & KVM_RISCV_BASE_ISA_MASK;
5151 break;
5252 case KVM_REG_RISCV_CONFIG_REG(zicbom_block_size):
53− if (kvm_riscv_isa_check_host(ZICBOM))
54− return -ENOENT;
55− reg_val = riscv_cbom_block_size;
53+ reg_val = (kvm_riscv_isa_check_host(ZICBOM)) ? 0 : riscv_cbom_block_size;
5654 break;
5755 case KVM_REG_RISCV_CONFIG_REG(zicboz_block_size):
58− if (kvm_riscv_isa_check_host(ZICBOZ))
59− return -ENOENT;
60− reg_val = riscv_cboz_block_size;
56+ reg_val = (kvm_riscv_isa_check_host(ZICBOZ)) ? 0 : riscv_cboz_block_size;
6157 break;
6258 case KVM_REG_RISCV_CONFIG_REG(zicbop_block_size):
63− if (kvm_riscv_isa_check_host(ZICBOP))
64− return -ENOENT;
65− reg_val = riscv_cbop_block_size;
59+ reg_val = (kvm_riscv_isa_check_host(ZICBOP)) ? 0 : riscv_cbop_block_size;
6660 break;
6761 case KVM_REG_RISCV_CONFIG_REG(mvendorid):
6862 reg_val = vcpu->arch.mvendorid;
@@ -144,21 +138,15 @@ static int kvm_riscv_vcpu_set_reg_config(struct kvm_vcpu *vcpu, · 75 unmodified lines
144138 }
145139 break;
146140 case KVM_REG_RISCV_CONFIG_REG(zicbom_block_size):
147− if (kvm_riscv_isa_check_host(ZICBOM))
148− return -ENOENT;
149− if (reg_val != riscv_cbom_block_size)
141+ if (reg_val && reg_val != riscv_cbom_block_size)
150142 return -EINVAL;
151143 break;
152144 case KVM_REG_RISCV_CONFIG_REG(zicboz_block_size):
153− if (kvm_riscv_isa_check_host(ZICBOZ))
154− return -ENOENT;
155− if (reg_val != riscv_cboz_block_size)
145+ if (reg_val && reg_val != riscv_cboz_block_size)
156146 return -EINVAL;
157147 break;
158148 case KVM_REG_RISCV_CONFIG_REG(zicbop_block_size):
159− if (kvm_riscv_isa_check_host(ZICBOP))
160− return -ENOENT;
161− if (reg_val != riscv_cbop_block_size)
149+ if (reg_val && reg_val != riscv_cbop_block_size)
162150 return -EINVAL;
163151 break;
164152 case KVM_REG_RISCV_CONFIG_REG(mvendorid):
@@ -298,6 +286,7 @@ static int kvm_riscv_vcpu_general_set_csr(struct kvm_vcpu *vcpu, · 133 unmodified lines
298286 {
299287 struct kvm_vcpu_csr *csr = &vcpu->arch.guest_csr;
300288 unsigned long regs_max = sizeof(struct kvm_riscv_csr) / sizeof(unsigned long);
289+ unsigned long flags;
301290
302291 if (reg_num >= regs_max)
303292 return -ENOENT;
@@ -311,8 +300,11 @@ static int kvm_riscv_vcpu_general_set_csr(struct kvm_vcpu *vcpu, · 7 unmodified lines
311300
312301 ((unsigned long *)csr)[reg_num] = reg_val;
313302
314− if (reg_num == KVM_REG_RISCV_CSR_REG(sip))
315− WRITE_ONCE(vcpu->arch.irqs_pending_mask[0], 0);
303+ if (reg_num == KVM_REG_RISCV_CSR_REG(sip)) {
304+ raw_spin_lock_irqsave(&vcpu->arch.irqs_pending_lock, flags);
305+ vcpu->arch.irqs_pending_mask[0] = 0;
306+ raw_spin_unlock_irqrestore(&vcpu->arch.irqs_pending_lock, flags);
307+ }
316308
317309 return 0;
318310 }
@@ -614,20 +606,6 @@ static int copy_config_reg_indices(const struct kvm_vcpu *vcpu, · 295 unmodified lines
614606 u64 size;
615607 u64 reg;
616608
617− /*
618− * Avoid reporting config reg if the corresponding extension
619− * was not available.
620− */
621− if (i == KVM_REG_RISCV_CONFIG_REG(zicbom_block_size) &&
622− kvm_riscv_isa_check_host(ZICBOM))
623− continue;
624− else if (i == KVM_REG_RISCV_CONFIG_REG(zicboz_block_size) &&
625− kvm_riscv_isa_check_host(ZICBOZ))
626− continue;
627− else if (i == KVM_REG_RISCV_CONFIG_REG(zicbop_block_size) &&
628− kvm_riscv_isa_check_host(ZICBOP))
629− continue;
630−
631609 size = IS_ENABLED(CONFIG_32BIT) ? KVM_REG_SIZE_U32 : KVM_REG_SIZE_U64;
632610 reg = KVM_REG_RISCV | size | KVM_REG_RISCV_CONFIG | i;
633611
arch/riscv/kvm/vcpu_pmu.c+2−2
@@ -586,7 +586,7 @@ int kvm_riscv_vcpu_pmu_ctr_start(struct kvm_vcpu *vcpu, unsigned long ctr_base, · 585 unmodified lines
586586 }
587587 }
588588 /* Start the counters that have been configured and requested by the guest */
589− for_each_set_bit(i, &ctr_mask, RISCV_MAX_COUNTERS) {
589+ for_each_set_bit(i, &ctr_mask, BITS_PER_LONG) {
590590 pmc_index = array_index_nospec(i + ctr_base,
591591 RISCV_KVM_MAX_COUNTERS);
592592 if (!test_bit(pmc_index, kvpmu->pmc_in_use))
@@ -658,7 +658,7 @@ int kvm_riscv_vcpu_pmu_ctr_stop(struct kvm_vcpu *vcpu, unsigned long ctr_base, · 65 unmodified lines
658658 }
659659
660660 /* Stop the counters that have been configured and requested by the guest */
661− for_each_set_bit(i, &ctr_mask, RISCV_MAX_COUNTERS) {
661+ for_each_set_bit(i, &ctr_mask, BITS_PER_LONG) {
662662 pmc_index = array_index_nospec(i + ctr_base,
663663 RISCV_KVM_MAX_COUNTERS);
664664 if (!test_bit(pmc_index, kvpmu->pmc_in_use))
arch/riscv/kvm/vcpu_sbi_fwft.c+4−2
@@ -327,9 +327,11 @@ static int kvm_sbi_fwft_set(struct kvm_vcpu *vcpu, u32 feature, · 326 unmodified lines
327327 if (conf->flags & SBI_FWFT_SET_FLAG_LOCK)
328328 return SBI_ERR_DENIED_LOCKED;
329329
330− conf->flags = flags;
330+ ret = conf->feature->set(vcpu, conf, false, value);
331+ if (ret == SBI_SUCCESS)
332+ conf->flags = flags;
331333
332− return conf->feature->set(vcpu, conf, false, value);
334+ return ret;
333335 }
334336
335337 static int kvm_sbi_fwft_get(struct kvm_vcpu *vcpu, unsigned long feature,
arch/riscv/kvm/vcpu_vector.c+12−2
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <linux/errno.h>
1111 #include <linux/err.h>
1212 #include <linux/kvm_host.h>
13+#include <linux/nospec.h>
1314 #include <linux/uaccess.h>
1415 #include <asm/cpufeature.h>
1516 #include <asm/kvm_isa.h>
@@ -129,11 +130,20 @@ static int kvm_riscv_vcpu_vreg_addr(struct kvm_vcpu *vcpu, · 113 unmodified lines
129130 return -ENOENT;
130131 }
131132 } else if (reg_num <= KVM_REG_RISCV_VECTOR_REG(31)) {
133+ unsigned long reg_offset;
134+
132135 if (reg_size != vlenb)
133136 return -EINVAL;
134137 WARN_ON(!cntx->vector.datap);
135− *reg_addr = cntx->vector.datap +
136− (reg_num - KVM_REG_RISCV_VECTOR_REG(0)) * vlenb;
138+ /*
139+ * The reg_num is derived from the userspace-provided ONE_REG
140+ * id. Sanitize it with array_index_nospec() to prevent
141+ * speculative out-of-bounds access to the vector register
142+ * buffer (32 vector registers: v0..v31).
143+ */
144+ reg_offset = array_index_nospec(
145+ reg_num - KVM_REG_RISCV_VECTOR_REG(0), 32);
146+ *reg_addr = cntx->vector.datap + reg_offset * vlenb;
137147 } else {
138148 return -ENOENT;
139149 }
arch/s390/kernel/time.c+1−0
@@ -65,6 +65,7 @@ ATOMIC_NOTIFIER_HEAD(s390_epoch_delta_notifier); · 64 unmodified lines
6565 EXPORT_SYMBOL(s390_epoch_delta_notifier);
6666
6767 unsigned char ptff_function_mask[16];
68+EXPORT_SYMBOL(ptff_function_mask);
6869
6970 static unsigned long lpar_offset;
7071 static unsigned long initial_leap_seconds;
arch/x86/boot/compressed/Makefile+1−0
@@ -27,6 +27,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \ · 26 unmodified lines
2727 KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS)
2828 KBUILD_CFLAGS += $(CC_FLAGS_DIALECT)
2929 KBUILD_CFLAGS += -fno-strict-aliasing -fPIE
30+KBUILD_CFLAGS += -fno-jump-tables
3031 KBUILD_CFLAGS += -Wundef
3132 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
3233 cflags-$(CONFIG_X86_32) := -march=i386
arch/x86/kvm/lapic.c+1−1
@@ -2052,7 +2052,7 @@ static void apic_timer_expired(struct kvm_lapic *apic, bool from_timer_fn) · 2051 unmodified lines
20522052 if (apic_lvtt_tscdeadline(apic) || ktimer->hv_timer_in_use)
20532053 ktimer->expired_tscdeadline = ktimer->tscdeadline;
20542054
2055− if (!from_timer_fn && apic->apicv_active) {
2055+ if (!from_timer_fn && apic->apicv_active && vcpu->wants_to_run) {
20562056 WARN_ON(kvm_get_running_vcpu() != vcpu);
20572057 kvm_apic_inject_pending_timer_irqs(apic);
20582058 return;
arch/x86/kvm/mmu/mmu.c+8−4
@@ -2642,6 +2642,7 @@ static int mmu_page_zap_pte(struct kvm *kvm, struct kvm_mmu_page *sp, · 2641 unmodified lines
26422642 */
26432643 if (tdp_enabled && invalid_list &&
26442644 child->role.guest_mode &&
2645+ !child->root_count &&
26452646 !atomic_long_read(&child->parent_ptes.val))
26462647 return kvm_mmu_prepare_zap_page(kvm, child,
26472648 invalid_list);
@@ -4852,16 +4853,17 @@ static int direct_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault · 2204 unmodified lines
48524853 if (r != RET_PF_CONTINUE)
48534854 return r;
48544855
4855− r = RET_PF_RETRY;
48564856 write_lock(&vcpu->kvm->mmu_lock);
48574857
4858− if (is_page_fault_stale(vcpu, fault))
4859− goto out_unlock;
4860−
48614858 r = make_mmu_pages_available(vcpu);
48624859 if (r)
48634860 goto out_unlock;
48644861
4862+ if (is_page_fault_stale(vcpu, fault)) {
4863+ r = RET_PF_RETRY;
4864+ goto out_unlock;
4865+ }
4866+
48654867 r = direct_map(vcpu, fault);
48664868
48674869 out_unlock:
@@ -7574,7 +7576,9 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm, u64 gen) · 2706 unmodified lines
75747576 static void mmu_destroy_caches(void)
75757577 {
75767578 kmem_cache_destroy(pte_list_desc_cache);
7579+ pte_list_desc_cache = NULL;
75777580 kmem_cache_destroy(mmu_page_header_cache);
7581+ mmu_page_header_cache = NULL;
75787582 }
75797583
75807584 static void kvm_wake_nx_recovery_thread(struct kvm *kvm)
arch/x86/kvm/mmu/paging_tmpl.h+6−4
@@ -864,15 +864,17 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault · 863 unmodified lines
864864 }
865865 #endif
866866
867− r = RET_PF_RETRY;
868867 write_lock(&vcpu->kvm->mmu_lock);
869868
870− if (is_page_fault_stale(vcpu, fault))
871− goto out_unlock;
872−
873869 r = make_mmu_pages_available(vcpu);
874870 if (r)
875871 goto out_unlock;
872+
873+ if (is_page_fault_stale(vcpu, fault)) {
874+ r = RET_PF_RETRY;
875+ goto out_unlock;
876+ }
877+
876878 r = FNAME(fetch)(vcpu, fault, &walker);
877879
878880 out_unlock:
arch/x86/kvm/vmx/nested.c+9−2
@@ -336,6 +336,7 @@ static void nested_put_vmcs12_pages(struct kvm_vcpu *vcpu) · 335 unmodified lines
336336 static void free_nested(struct kvm_vcpu *vcpu)
337337 {
338338 struct vcpu_vmx *vmx = to_vmx(vcpu);
339+ struct vmcs *shadow_vmcs;
339340
340341 if (WARN_ON_ONCE(vmx->loaded_vmcs != &vmx->vmcs01))
341342 vmx_switch_vmcs(vcpu, &vmx->vmcs01);
@@ -353,9 +354,15 @@ static void free_nested(struct kvm_vcpu *vcpu) · 11 unmodified lines
353354 vmx->nested.current_vmptr = INVALID_GPA;
354355 if (enable_shadow_vmcs) {
355356 vmx_disable_shadow_vmcs(vmx);
356− vmcs_clear(vmx->vmcs01.shadow_vmcs);
357− free_vmcs(vmx->vmcs01.shadow_vmcs);
357+
358+ /*
359+ * Keep the pointer visible until after VMCLEAR, so migration
360+ * can clear an active shadow VMCS on the old CPU.
361+ */
362+ shadow_vmcs = vmx->vmcs01.shadow_vmcs;
363+ vmcs_clear(shadow_vmcs);
358364 vmx->vmcs01.shadow_vmcs = NULL;
365+ free_vmcs(shadow_vmcs);
359366 }
360367 kfree(vmx->nested.cached_vmcs12);
361368 vmx->nested.cached_vmcs12 = NULL;
drivers/accel/amdxdna/aie2_ctx.c+18−8
@@ -43,20 +43,22 @@ struct aie2_ctx_health { · 42 unmodified lines
4343
4444 static inline void aie2_tdr_signal(struct amdxdna_dev *xdna)
4545 {
46− WRITE_ONCE(xdna->dev_handle->tdr_status, AIE2_TDR_SIGNALED);
46+ WRITE_ONCE(xdna->dev_handle->last_signal_ts, jiffies);
4747 }
4848
4949 static bool aie2_tdr_detect(struct amdxdna_dev *xdna)
5050 {
5151 struct amdxdna_dev_hdl *ndev = xdna->dev_handle;
52+ unsigned long last = READ_ONCE(ndev->last_signal_ts);
5253
53− if (READ_ONCE(ndev->tdr_status) == AIE2_TDR_WAIT) {
54− XDNA_ERR(xdna, "TDR timeout detected");
55− return true;
56− }
54+ if (!tdr_timeout_ms)
55+ return false;
56+
57+ if (!time_after(jiffies, last + msecs_to_jiffies(tdr_timeout_ms)))
58+ return false;
5759
58− WRITE_ONCE(ndev->tdr_status, AIE2_TDR_WAIT);
59− return false;
60+ XDNA_ERR(xdna, "TDR timeout detected");
61+ return true;
6062 }
6163
6264 static void aie2_cmd_release(struct kref *ref)
@@ -434,6 +436,12 @@ out: · 371 unmodified lines
434436 mmput(job->mm);
435437 fence = ERR_PTR(ret);
436438 } else {
439+ /*
440+ * Command is successfully posted to hardware, update the
441+ * tdr timestamp. The total pending commands are limited.
442+ * So there will not be a case that driver keeps posting
443+ * commands without getting any hardware respond.
444+ */
437445 aie2_tdr_signal(hwctx->client->xdna);
438446 }
439447 trace_xdna_job(sched_job, hwctx->name, "sent to device",
@@ -658,7 +666,9 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx) · 218 unmodified lines
658666 const struct drm_sched_init_args args = {
659667 .ops = &sched_ops,
660668 .credit_limit = HWCTX_MAX_CMDS,
661− .timeout = msecs_to_jiffies(tdr_timeout_ms),
669+ .timeout = tdr_timeout_ms ?
670+ msecs_to_jiffies(tdr_timeout_ms) :
671+ MAX_SCHEDULE_TIMEOUT,
662672 .name = "amdxdna_js",
663673 .dev = xdna->ddev.dev,
664674 };
drivers/accel/amdxdna/aie2_pci.c+1−0
@@ -420,6 +420,7 @@ static int aie2_hw_start(struct amdxdna_dev *xdna) · 419 unmodified lines
420420 goto stop_fw;
421421 }
422422
423+ WRITE_ONCE(ndev->last_signal_ts, jiffies);
423424 ndev->dev_status = AIE2_DEV_START;
424425
425426 return 0;
drivers/accel/amdxdna/aie2_pci.h+1−6
@@ -143,11 +143,6 @@ struct aie2_exec_msg_ops { · 142 unmodified lines
143143 u32 (*get_chain_msg_op)(u32 cmd_op);
144144 };
145145
146−enum aie2_tdr_status {
147− AIE2_TDR_WAIT,
148− AIE2_TDR_SIGNALED,
149−};
150−
151146 struct amdxdna_dev_hdl {
152147 struct aie_device aie;
153148 const struct amdxdna_dev_priv *priv;
@@ -179,7 +174,7 @@ struct amdxdna_dev_hdl { · 25 unmodified lines
179174 u32 hwctx_num;
180175
181176 struct amdxdna_async_error last_async_err;
182− enum aie2_tdr_status tdr_status;
177+ unsigned long last_signal_ts;
183178 };
184179
185180 struct aie2_hw_ops {
drivers/accel/ethosu/ethosu_gem.c+36−18
@@ -192,9 +192,17 @@ static u64 dma_length(struct ethosu_validated_cmdstream_info *info, · 191 unmodified lines
192192 return len;
193193 }
194194
195−static u64 feat_matrix_length(struct ethosu_validated_cmdstream_info *info,
195+static bool feat_matrix_chained(struct ethosu_device *edev, struct feat_matrix *fm)
196+{
197+ u32 storage = fm->precision >> 14;
198+
199+ return !ethosu_is_u65(edev) && storage == 2;
200+}
201+
202+static u64 feat_matrix_length(struct ethosu_device *edev,
203+ struct ethosu_validated_cmdstream_info *info,
196204 struct feat_matrix *fm,
197− u32 x, u32 y, u32 c)
205+ u32 x, u32 y, u32 c, bool ofm)
198206 {
199207 u32 element_size, storage = fm->precision >> 14;
200208 int tile = 0;
@@ -203,6 +211,9 @@ static u64 feat_matrix_length(struct ethosu_validated_cmdstream_info *info, · 2 unmodified lines
203211 if (fm->region < 0)
204212 return U64_MAX;
205213
214+ if (feat_matrix_chained(edev, fm))
215+ return 0;
216+
206217 switch (storage) {
207218 case 0:
208219 if (x >= fm->width0 + 1) {
@@ -223,6 +234,8 @@ static u64 feat_matrix_length(struct ethosu_validated_cmdstream_info *info, · 14 unmodified lines
223234 tile = 1;
224235 }
225236 break;
237+ default:
238+ return U64_MAX;
226239 }
227240 if (fm->base[tile] == U64_MAX)
228241 return U64_MAX;
@@ -231,10 +244,11 @@ static u64 feat_matrix_length(struct ethosu_validated_cmdstream_info *info, · 2 unmodified lines
231244
232245 switch ((fm->precision >> 6) & 0x3) { // format
233246 case 0: //nhwc:
234− addr += x * fm->stride_x + c;
247+ element_size = BIT((fm->precision >> (ofm ? 1 : 2)) & 0x3);
248+ addr += x * fm->stride_x + c * element_size;
235249 break;
236250 case 1: //nhcwb16:
237− element_size = BIT((fm->precision >> 1) & 0x3);
251+ element_size = BIT((fm->precision >> (ofm ? 1 : 2)) & 0x3);
238252
239253 addr += (c / 16) * fm->stride_c + (16 * x + (c & 0xf)) * element_size;
240254 break;
@@ -250,6 +264,7 @@ static int calc_sizes(struct drm_device *ddev, · 9 unmodified lines
250264 u16 op, struct cmd_state *st,
251265 bool ifm, bool ifm2, bool weight, bool scale)
252266 {
267+ struct ethosu_device *edev = to_ethosu_device(ddev);
253268 u64 len;
254269
255270 if (ifm) {
@@ -267,8 +282,8 @@ static int calc_sizes(struct drm_device *ddev, · 11 unmodified lines
267282 if (ifm_height < 0 || ifm_width < 0)
268283 return -EINVAL;
269284
270− len = feat_matrix_length(info, &st->ifm, ifm_width,
271− ifm_height, st->ifm.depth);
285+ len = feat_matrix_length(edev, info, &st->ifm, ifm_width,
286+ ifm_height, st->ifm.depth, false);
272287 dev_dbg(ddev->dev, "op %d: IFM:%d:0x%llx-0x%llx\n",
273288 op, st->ifm.region, st->ifm.base[0], len);
274289 if (len == U64_MAX)
@@ -276,8 +291,8 @@ static int calc_sizes(struct drm_device *ddev, · 1 unmodified line
276291 }
277292
278293 if (ifm2) {
279− len = feat_matrix_length(info, &st->ifm2, st->ifm.depth,
280− 0, st->ofm.depth);
294+ len = feat_matrix_length(edev, info, &st->ifm2, st->ifm.depth,
295+ 0, st->ofm.depth, false);
281296 dev_dbg(ddev->dev, "op %d: IFM2:%d:0x%llx-0x%llx\n",
282297 op, st->ifm2.region, st->ifm2.base[0], len);
283298 if (len == U64_MAX)
@@ -308,13 +323,14 @@ static int calc_sizes(struct drm_device *ddev, · 24 unmodified lines
308323 st->scale[0].base + st->scale[0].length);
309324 }
310325
311− len = feat_matrix_length(info, &st->ofm, st->ofm.width,
312− st->ofm.height[2], st->ofm.depth);
326+ len = feat_matrix_length(edev, info, &st->ofm, st->ofm.width,
327+ st->ofm.height[2], st->ofm.depth, true);
313328 dev_dbg(ddev->dev, "op %d: OFM:%d:0x%llx-0x%llx\n",
314329 op, st->ofm.region, st->ofm.base[0], len);
315330 if (len == U64_MAX)
316331 return -EINVAL;
317− info->output_region[st->ofm.region] = true;
332+ if (!feat_matrix_chained(edev, &st->ofm))
333+ info->output_region[st->ofm.region] = true;
318334
319335 return 0;
320336 }
@@ -324,6 +340,7 @@ static int calc_sizes_elemwise(struct drm_device *ddev, · 3 unmodified lines
324340 u16 op, struct cmd_state *st,
325341 bool ifm, bool ifm2)
326342 {
343+ struct ethosu_device *edev = to_ethosu_device(ddev);
327344 u32 height, width, depth;
328345 u64 len;
329346
@@ -332,8 +349,8 @@ static int calc_sizes_elemwise(struct drm_device *ddev, · 2 unmodified lines
332349 width = st->ifm.broadcast & 0x2 ? 0 : st->ofm.width;
333350 depth = st->ifm.broadcast & 0x4 ? 0 : st->ofm.depth;
334351
335− len = feat_matrix_length(info, &st->ifm, width,
336− height, depth);
352+ len = feat_matrix_length(edev, info, &st->ifm, width,
353+ height, depth, false);
337354 dev_dbg(ddev->dev, "op %d: IFM:%d:0x%llx-0x%llx\n",
338355 op, st->ifm.region, st->ifm.base[0], len);
339356 if (len == U64_MAX)
@@ -345,21 +362,22 @@ static int calc_sizes_elemwise(struct drm_device *ddev, · 5 unmodified lines
345362 width = st->ifm2.broadcast & 0x2 ? 0 : st->ofm.width;
346363 depth = st->ifm2.broadcast & 0x4 ? 0 : st->ofm.depth;
347364
348− len = feat_matrix_length(info, &st->ifm2, width,
349− height, depth);
365+ len = feat_matrix_length(edev, info, &st->ifm2, width,
366+ height, depth, false);
350367 dev_dbg(ddev->dev, "op %d: IFM2:%d:0x%llx-0x%llx\n",
351368 op, st->ifm2.region, st->ifm2.base[0], len);
352369 if (len == U64_MAX)
353370 return -EINVAL;
354371 }
355372
356− len = feat_matrix_length(info, &st->ofm, st->ofm.width,
357− st->ofm.height[2], st->ofm.depth);
373+ len = feat_matrix_length(edev, info, &st->ofm, st->ofm.width,
374+ st->ofm.height[2], st->ofm.depth, true);
358375 dev_dbg(ddev->dev, "op %d: OFM:%d:0x%llx-0x%llx\n",
359376 op, st->ofm.region, st->ofm.base[0], len);
360377 if (len == U64_MAX)
361378 return -EINVAL;
362− info->output_region[st->ofm.region] = true;
379+ if (!feat_matrix_chained(edev, &st->ofm))
380+ info->output_region[st->ofm.region] = true;
363381
364382 return 0;
365383 }
drivers/android/binder/thread.rs+7−7
@@ -1273,14 +1273,14 @@ impl Thread { · 1272 unmodified lines
12731273 inner.extended_error =
12741274 ExtendedError::new(info.debug_id as u32, err.reply, source.to_errno());
12751275 }
1276− }
12771276
1278− pr_warn!(
1279− "{}:{} transaction to {} failed: {err:?}",
1280− info.from_pid,
1281− info.from_tid,
1282− info.to_pid
1283− );
1277+ pr_warn!(
1278+ "{}:{} transaction to {} failed: {err:?}",
1279+ info.from_pid,
1280+ info.from_tid,
1281+ info.to_pid
1282+ );
1283+ }
12841284 }
12851285 }
12861286
drivers/block/rbd.c+6−1
@@ -1950,9 +1950,14 @@ static int rbd_object_map_update_finish(struct rbd_obj_request *obj_req, · 1949 unmodified lines
19501950 bool has_current_state;
19511951 void *p;
19521952
1953− if (osd_req->r_result)
1953+ if (osd_req->r_result < 0)
19541954 return osd_req->r_result;
19551955
1956+ /*
1957+ * Writes aren't allowed to return a data payload.
1958+ */
1959+ WARN_ON_ONCE(osd_req->r_result > 0);
1960+
19561961 /*
19571962 * Nothing to do for a snapshot object map.
19581963 */
drivers/block/ublk_drv.c+30−17
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <linux/errno.h>
2020 #include <linux/major.h>
2121 #include <linux/wait.h>
22+#include <linux/wait_bit.h>
2223 #include <linux/blkdev.h>
2324 #include <linux/init.h>
2425 #include <linux/swap.h>
@@ -26,7 +27,6 @@ · 1 unmodified line
2627 #include <linux/compat.h>
2728 #include <linux/mutex.h>
2829 #include <linux/writeback.h>
29−#include <linux/completion.h>
3030 #include <linux/highmem.h>
3131 #include <linux/sysfs.h>
3232 #include <linux/miscdevice.h>
@@ -327,7 +327,6 @@ struct ublk_device { · 294 unmodified lines
327327
328328 struct ublk_params params;
329329
330− struct completion completion;
331330 u32 nr_queue_ready;
332331 bool unprivileged_daemons;
333332 struct mutex cancel_mutex;
@@ -3054,12 +3053,12 @@ static void ublk_mark_io_ready(struct ublk_device *ub, u16 q_id, · 2720 unmodified lines
30543053 if (ublk_dev_ready(ub)) {
30553054 /*
30563055 * All queues ready - clear device-level canceling flag
3057− * and complete the recovery/initialization.
3056+ * and wake ublk_dev_ready() waiters.
30583057 */
30593058 mutex_lock(&ub->cancel_mutex);
30603059 ub->canceling = false;
30613060 mutex_unlock(&ub->cancel_mutex);
3062− complete_all(&ub->completion);
3061+ wake_up_var(&ub->nr_queue_ready);
30633062 }
30643063 }
30653064
@@ -4273,7 +4272,6 @@ static int ublk_init_queues(struct ublk_device *ub) · 1207 unmodified lines
42734272 goto fail;
42744273 }
42754274
4276− init_completion(&ub->completion);
42774275 return 0;
42784276
42794277 fail:
@@ -4417,6 +4415,26 @@ static bool ublk_validate_user_pid(struct ublk_device *ub, pid_t ublksrv_pid) · 137 unmodified lines
44174415 return ub->ublksrv_tgid == ublksrv_pid;
44184416 }
44194417
4418+/*
4419+ * Wait until all queues have fetched their I/O commands, and return with
4420+ * ub->mutex held and readiness guaranteed: then every queue's ->canceling
4421+ * is cleared. Ready may regress between wakeup and mutex_lock() (F_BATCH
4422+ * UNPREP, daemon death), so re-check it under the mutex and wait again.
4423+ */
4424+static int ublk_wait_dev_ready_and_lock(struct ublk_device *ub)
4425+{
4426+ while (true) {
4427+ if (wait_var_event_interruptible(&ub->nr_queue_ready,
4428+ ublk_dev_ready(ub)))
4429+ return -EINTR;
4430+
4431+ mutex_lock(&ub->mutex);
4432+ if (ublk_dev_ready(ub))
4433+ return 0;
4434+ mutex_unlock(&ub->mutex);
4435+ }
4436+}
4437+
44204438 static int ublk_ctrl_start_dev(struct ublk_device *ub,
44214439 const struct ublksrv_ctrl_cmd *header)
44224440 {
@@ -4499,15 +4517,10 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub, · 76 unmodified lines
44994517 };
45004518 }
45014519
4502− if (wait_for_completion_interruptible(&ub->completion) != 0)
4520+ if (ublk_wait_dev_ready_and_lock(ub))
45034521 return -EINTR;
45044522
4505− if (!ublk_validate_user_pid(ub, ublksrv_pid))
4506− return -EINVAL;
4507−
4508− mutex_lock(&ub->mutex);
4509− /* device may become not ready in case of F_BATCH */
4510− if (!ublk_dev_ready(ub)) {
4523+ if (!ublk_validate_user_pid(ub, ublksrv_pid)) {
45114524 ret = -EINVAL;
45124525 goto out_unlock;
45134526 }
@@ -5071,7 +5084,6 @@ static int ublk_ctrl_start_recovery(struct ublk_device *ub) · 557 unmodified lines
50715084 goto out_unlock;
50725085 }
50735086 pr_devel("%s: start recovery for dev id %d\n", __func__, ub->ub_number);
5074− init_completion(&ub->completion);
50755087 ret = 0;
50765088 out_unlock:
50775089 mutex_unlock(&ub->mutex);
@@ -5087,16 +5099,17 @@ static int ublk_ctrl_end_recovery(struct ublk_device *ub, · 9 unmodified lines
50875099 pr_devel("%s: Waiting for all FETCH_REQs, dev id %d...\n", __func__,
50885100 header->dev_id);
50895101
5090− if (wait_for_completion_interruptible(&ub->completion))
5102+ if (ublk_wait_dev_ready_and_lock(ub))
50915103 return -EINTR;
50925104
50935105 pr_devel("%s: All FETCH_REQs received, dev id %d\n", __func__,
50945106 header->dev_id);
50955107
5096− if (!ublk_validate_user_pid(ub, ublksrv_pid))
5097− return -EINVAL;
5108+ if (!ublk_validate_user_pid(ub, ublksrv_pid)) {
5109+ ret = -EINVAL;
5110+ goto out_unlock;
5111+ }
50985112
5099− mutex_lock(&ub->mutex);
51005113 if (ublk_nosrv_should_stop_dev(ub))
51015114 goto out_unlock;
51025115
drivers/bluetooth/btusb.c+3−1
@@ -2782,7 +2782,9 @@ static int btusb_setup_realtek(struct hci_dev *hdev) · 2781 unmodified lines
27822782
27832783 static int btusb_recv_event_realtek(struct hci_dev *hdev, struct sk_buff *skb)
27842784 {
2785− if (skb->data[0] == HCI_VENDOR_PKT && skb->data[2] == RTK_SUB_EVENT_CODE_COREDUMP) {
2785+ if (skb->len >= HCI_EVENT_HDR_SIZE + 1 &&
2786+ skb->data[0] == HCI_VENDOR_PKT &&
2787+ skb->data[2] == RTK_SUB_EVENT_CODE_COREDUMP) {
27862788 struct rtk_dev_coredump_hdr hdr = {
27872789 .code = RTK_DEVCOREDUMP_CODE_MEMDUMP,
27882790 };
drivers/cdrom/cdrom.c+1−0
@@ -3187,6 +3187,7 @@ static noinline int mmc_ioctl_cdrom_volume(struct cdrom_device_info *cdi, · 3186 unmodified lines
31873187
31883188 /* set volume */
31893189 cgc->buffer = buffer + offset - 8;
3190+ cgc->buflen -= offset - 8;
31903191 memset(cgc->buffer, 0, 8);
31913192 return cdrom_mode_select(cdi, cgc);
31923193 }
drivers/comedi/drivers/comedi_parport.c+10−3
@@ -211,6 +211,13 @@ static irqreturn_t parport_interrupt(int irq, void *d) · 210 unmodified lines
211211 unsigned int ctrl;
212212 unsigned short val = 0;
213213
214+ /*
215+ * Check device is fully attached. Device interrupts should have
216+ * been disabled, but do this in case of bad hardware.
217+ */
218+ if (!dev->attached)
219+ return IRQ_NONE;
220+
214221 ctrl = inb(dev->iobase + PARPORT_CTRL_REG);
215222 if (!(ctrl & PARPORT_CTRL_IRQ_ENA))
216223 return IRQ_NONE;
@@ -233,6 +240,9 @@ static int parport_attach(struct comedi_device *dev, · 16 unmodified lines
233240 if (ret)
234241 return ret;
235242
243+ outb(0, dev->iobase + PARPORT_DATA_REG);
244+ outb(0, dev->iobase + PARPORT_CTRL_REG);
245+
236246 if (it->options[1]) {
237247 ret = request_irq(it->options[1], parport_interrupt, 0,
238248 dev->board_name, dev);
@@ -288,9 +298,6 @@ static int parport_attach(struct comedi_device *dev, · 49 unmodified lines
288298 s->cancel = parport_intr_cancel;
289299 }
290300
291− outb(0, dev->iobase + PARPORT_DATA_REG);
292− outb(0, dev->iobase + PARPORT_CTRL_REG);
293−
294301 return 0;
295302 }
296303
drivers/firewire/net.c+21−18
@@ -297,31 +297,34 @@ static struct fwnet_fragment_info *fwnet_frag_new( · 296 unmodified lines
297297 if (fi->offset + fi->len == offset) {
298298 /* The new fragment can be tacked on to the end */
299299 /* Did the new fragment plug a hole? */
300− fi2 = list_entry(fi->fi_link.next,
301− struct fwnet_fragment_info, fi_link);
302− if (fi->offset + fi->len == fi2->offset) {
303− /* glue fragments together */
304− fi->len += len + fi2->len;
305− list_del(&fi2->fi_link);
306− kfree(fi2);
307− } else {
308− fi->len += len;
300+ if (!list_is_last(&fi->fi_link, &pd->fi_list)) {
301+ fi2 = list_next_entry(fi, fi_link);
302+ if (offset + len == fi2->offset) {
303+ /* glue fragments together */
304+ fi->len += len + fi2->len;
305+ list_del(&fi2->fi_link);
306+ kfree(fi2);
307+
308+ return fi;
309+ }
309310 }
311+ fi->len += len;
310312
311313 return fi;
312314 }
313315 if (offset + len == fi->offset) {
314316 /* The new fragment can be tacked on to the beginning */
315317 /* Did the new fragment plug a hole? */
316− fi2 = list_entry(fi->fi_link.prev,
317− struct fwnet_fragment_info, fi_link);
318− if (fi2->offset + fi2->len == fi->offset) {
319− /* glue fragments together */
320− fi2->len += fi->len + len;
321− list_del(&fi->fi_link);
322− kfree(fi);
323−
324− return fi2;
318+ if (!list_is_first(&fi->fi_link, &pd->fi_list)) {
319+ fi2 = list_prev_entry(fi, fi_link);
320+ if (fi2->offset + fi2->len == offset) {
321+ /* glue fragments together */
322+ fi2->len += fi->len + len;
323+ list_del(&fi->fi_link);
324+ kfree(fi);
325+
326+ return fi2;
327+ }
325328 }
326329 fi->offset = offset;
327330 fi->len += len;
drivers/firmware/stratix10-svc.c+11−8
@@ -1499,8 +1499,9 @@ int stratix10_svc_async_poll(struct stratix10_svc_chan *chan, · 1498 unmodified lines
14991499 WARN_ON_ONCE(1);
15001500 }
15011501 return 0;
1502− } else if (handle->res.a0 == INTEL_SIP_SMC_STATUS_BUSY) {
1503− dev_dbg(ctrl->dev, "async message is still in progress\n");
1502+ } else if (handle->res.a0 == INTEL_SIP_SMC_STATUS_BUSY ||
1503+ handle->res.a0 == INTEL_SIP_SMC_STATUS_NO_RESPONSE) {
1504+ dev_dbg(ctrl->dev, "async message is not ready yet\n");
15041505 return -EAGAIN;
15051506 }
15061507
@@ -1857,14 +1858,16 @@ void *stratix10_svc_allocate_memory(struct stratix10_svc_chan *chan, · 350 unmodified lines
18571858 struct gen_pool *genpool = chan->ctrl->genpool;
18581859 size_t s = roundup(size, 1 << genpool->min_alloc_order);
18591860
1860− pmem = devm_kzalloc(chan->ctrl->dev, sizeof(*pmem), GFP_KERNEL);
1861+ pmem = kzalloc_obj(*pmem);
18611862 if (!pmem)
18621863 return ERR_PTR(-ENOMEM);
18631864
18641865 guard(mutex)(&svc_mem_lock);
18651866 va = gen_pool_alloc(genpool, s);
1866− if (!va)
1867+ if (!va) {
1868+ kfree(pmem);
18671869 return ERR_PTR(-ENOMEM);
1870+ }
18681871
18691872 memset((void *)va, 0, s);
18701873 pa = gen_pool_virt_to_phys(genpool, va);
@@ -1890,6 +1893,7 @@ EXPORT_SYMBOL_GPL(stratix10_svc_allocate_memory); · 19 unmodified lines
18901893 void stratix10_svc_free_memory(struct stratix10_svc_chan *chan, void *kaddr)
18911894 {
18921895 struct stratix10_svc_data_mem *pmem;
1896+
18931897 guard(mutex)(&svc_mem_lock);
18941898
18951899 list_for_each_entry(pmem, &svc_data_mem, node)
@@ -1898,10 +1902,9 @@ void stratix10_svc_free_memory(struct stratix10_svc_chan *chan, void *kaddr) · 2 unmodified lines
18981902 (unsigned long)kaddr, pmem->size);
18991903 pmem->vaddr = NULL;
19001904 list_del(&pmem->node);
1905+ kfree(pmem);
19011906 return;
19021907 }
1903−
1904− list_del(&svc_data_mem);
19051908 }
19061909 EXPORT_SYMBOL_GPL(stratix10_svc_free_memory);
19071910
@@ -2046,12 +2049,12 @@ static void stratix10_svc_drv_remove(struct platform_device *pdev) · 138 unmodified lines
20462049 struct stratix10_svc_controller *ctrl = platform_get_drvdata(pdev);
20472050 struct stratix10_svc *svc = ctrl->svc;
20482051
2052+ platform_device_unregister(svc->stratix10_svc_rsu);
2053+
20492054 stratix10_svc_async_exit(ctrl);
20502055
20512056 of_platform_depopulate(ctrl->dev);
20522057
2053− platform_device_unregister(svc->stratix10_svc_rsu);
2054−
20552058 for (i = 0; i < SVC_NUM_CHANNEL; i++) {
20562059 if (ctrl->chans[i].task) {
20572060 kthread_stop(ctrl->chans[i].task);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+2−1
@@ -3324,7 +3324,8 @@ static void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev, · 3323 unmodified lines
33243324 acrtc = get_crtc_by_otg_inst(
33253325 adev, state->stream_status[i].primary_otg_inst);
33263326
3327− if (acrtc && state->stream_status[i].plane_count != 0) {
3327+ if (acrtc && state->stream_status[i].plane_count != 0 &&
3328+ amdgpu_ip_version(adev, DCE_HWIP, 0) == 0) {
33283329 irq_source = IRQ_TYPE_PFLIP + acrtc->otg_inst;
33293330 rc = dc_interrupt_set(adev->dm.dc, irq_source, enable) ? 0 : -EBUSY;
33303331 if (rc)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c+11−2
@@ -280,10 +280,19 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable) · 279 unmodified lines
280280 * is enabled. On DCE, vupdate is only needed in VRR mode.
281281 */
282282 if (amdgpu_ip_version(adev, DCE_HWIP, 0) != 0) {
283− rc = amdgpu_dm_crtc_set_vupdate_irq(crtc, enable);
283+ if (enable) {
284+ rc = amdgpu_irq_get(adev, &adev->vupdate_irq, irq_type);
285+ drm_dbg_vbl(crtc->dev, "Get vupdate_irq ret=%d\n", rc);
286+ } else {
287+ rc = amdgpu_irq_put(adev, &adev->vupdate_irq, irq_type);
288+ drm_dbg_vbl(crtc->dev, "Put vupdate_irq ret=%d\n", rc);
289+ }
284290 } else if (dc_supports_vrr(dm->dc->ctx->dce_version)) {
285291 if (enable) {
286− /* vblank irq on -> Only need vupdate irq in vrr mode */
292+ /* vblank irq on -> Only need vupdate irq in vrr mode
293+ * Not ref-counted since we need explicit enable/disable
294+ * for DCE VRR handling
295+ */
287296 if (amdgpu_dm_crtc_vrr_active(acrtc_state))
288297 rc = amdgpu_dm_crtc_set_vupdate_irq(crtc, true);
289298 } else {
drivers/gpu/drm/drm_gpusvm.c+4−2
@@ -781,7 +781,7 @@ enum drm_gpusvm_scan_result drm_gpusvm_scan_mm(struct drm_gpusvm_range *range, · 780 unmodified lines
781781 const struct dev_pagemap *other = NULL;
782782 int err, i;
783783
784− pfns = kvmalloc_array(npages, sizeof(*pfns), GFP_KERNEL);
784+ pfns = kvcalloc(npages, sizeof(*pfns), GFP_KERNEL);
785785 if (!pfns)
786786 return DRM_GPUSVM_SCAN_UNPOPULATED;
787787
@@ -1753,8 +1753,10 @@ int drm_gpusvm_range_evict(struct drm_gpusvm *gpusvm, · 965 unmodified lines
17531753 return -EFAULT;
17541754
17551755 pfns = kvmalloc_array(npages, sizeof(*pfns), GFP_KERNEL);
1756− if (!pfns)
1756+ if (!pfns) {
1757+ mmput(mm);
17571758 return -ENOMEM;
1759+ }
17581760
17591761 hmm_range.hmm_pfns = pfns;
17601762 while (!time_after(jiffies, timeout)) {
drivers/gpu/drm/drm_pagemap.c+8−3
@@ -727,8 +727,10 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation, · 726 unmodified lines
727727 }
728728
729729 err = ops->populate_devmem_pfn(devmem_allocation, npages, migrate.dst);
730− if (err)
731− goto err_aborted_migration;
730+ if (err) {
731+ npages = 0;
732+ goto err_finalize;
733+ }
732734
733735 own_pages = 0;
734736
@@ -807,8 +809,11 @@ next: · 72 unmodified lines
807809 msecs_to_jiffies(mdetails->timeslice_ms);
808810
809811 err_finalize:
810− if (err)
812+ if (err) {
811813 drm_pagemap_migration_unlock_put_pages(npages, migrate.dst);
814+ for (i = npages; i < npages_in_range(start, end); ++i)
815+ migrate.dst[i] = 0;
816+ }
812817 err_aborted_migration:
813818 migrate_vma_pages(&migrate);
814819
drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c+16−5
@@ -98,6 +98,7 @@ static int xfer_read(struct i2c_adapter *adap, struct i2c_msg *pmsg) · 97 unmodified lines
9898 struct oaktrail_hdmi_dev *hdmi_dev = i2c_get_adapdata(adap);
9999 struct hdmi_i2c_dev *i2c_dev = hdmi_dev->i2c_dev;
100100 u32 temp;
101+ int ret;
101102
102103 i2c_dev->status = I2C_STAT_INIT;
103104 i2c_dev->msg = pmsg;
@@ -109,9 +110,14 @@ static int xfer_read(struct i2c_adapter *adap, struct i2c_msg *pmsg) · 5 unmodified lines
109110 HDMI_WRITE(HDMI_HI2CHCR, temp);
110111 HDMI_READ(HDMI_HI2CHCR);
111112
112− while (i2c_dev->status != I2C_TRANSACTION_DONE)
113− wait_for_completion_interruptible_timeout(&i2c_dev->complete,
113+ while (i2c_dev->status != I2C_TRANSACTION_DONE) {
114+ ret = wait_for_completion_interruptible_timeout(&i2c_dev->complete,
114115 10 * HZ);
116+ if (ret < 0)
117+ return ret;
118+ if (!ret)
119+ return -ETIMEDOUT;
120+ }
115121
116122 return 0;
117123 }
@@ -130,7 +136,7 @@ static int oaktrail_hdmi_i2c_access(struct i2c_adapter *adap, · 12 unmodified lines
130136 {
131137 struct oaktrail_hdmi_dev *hdmi_dev = i2c_get_adapdata(adap);
132138 struct hdmi_i2c_dev *i2c_dev = hdmi_dev->i2c_dev;
133− int i;
139+ int i, ret = 0;
134140
135141 mutex_lock(&i2c_dev->i2c_lock);
136142
@@ -142,9 +148,11 @@ static int oaktrail_hdmi_i2c_access(struct i2c_adapter *adap, · 5 unmodified lines
142148 for (i = 0; i < num; i++) {
143149 if (pmsg->len && pmsg->buf) {
144150 if (pmsg->flags & I2C_M_RD)
145− xfer_read(adap, pmsg);
151+ ret = xfer_read(adap, pmsg);
146152 else
147− xfer_write(adap, pmsg);
153+ ret = xfer_write(adap, pmsg);
154+ if (ret)
155+ break;
148156 }
149157 pmsg++; /* next message */
150158 }
@@ -154,6 +162,9 @@ static int oaktrail_hdmi_i2c_access(struct i2c_adapter *adap, · 3 unmodified lines
154162
155163 mutex_unlock(&i2c_dev->i2c_lock);
156164
165+ if (ret)
166+ return ret;
167+
157168 return i;
158169 }
159170
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c+1−6
@@ -615,12 +615,7 @@ check_if_vesa_backlight_possible(struct intel_dp *intel_dp) · 614 unmodified lines
615615 int ret;
616616 u8 bit_min, bit_max;
617617
618− /*
619− * Since we only support Fully AUX Based VESA Backlight interface make sure
620− * backlight enable is possible via AUX along with backlight adjustment
621− */
622− if (!(intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP &&
623− intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP))
618+ if (!(intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP))
624619 return false;
625620
626621 ret = drm_dp_dpcd_read_byte(&intel_dp->aux, DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN, &bit_min);
drivers/gpu/drm/imagination/pvr_vm.c+2−0
@@ -747,6 +747,7 @@ pvr_vm_map(struct pvr_vm_context *vm_ctx, struct pvr_gem_object *pvr_obj, · 746 unmodified lines
747747
748748 pvr_gem_object_get(pvr_obj);
749749
750+ mutex_lock(&vm_ctx->lock);
750751 err = drm_gpuvm_exec_lock(&vm_exec);
751752 if (err)
752753 goto err_cleanup;
@@ -756,6 +757,7 @@ pvr_vm_map(struct pvr_vm_context *vm_ctx, struct pvr_gem_object *pvr_obj, · 3 unmodified lines
756757 drm_gpuvm_exec_unlock(&vm_exec);
757758
758759 err_cleanup:
760+ mutex_unlock(&vm_ctx->lock);
759761 pvr_vm_bind_op_fini(&bind_op);
760762
761763 return err;
drivers/gpu/drm/panel/Kconfig+3−0
@@ -232,6 +232,7 @@ config DRM_PANEL_HIMAX_HX83121A · 231 unmodified lines
232232 depends on OF
233233 depends on DRM_MIPI_DSI
234234 depends on BACKLIGHT_CLASS_DEVICE
235+ select DRM_DISPLAY_HELPER
235236 select DRM_DISPLAY_DSC_HELPER
236237 select DRM_KMS_HELPER
237238 help
@@ -332,6 +333,7 @@ config DRM_PANEL_ILITEK_ILI9882T · 94 unmodified lines
332333 depends on OF
333334 depends on DRM_MIPI_DSI
334335 depends on BACKLIGHT_CLASS_DEVICE
336+ select DRM_DISPLAY_HELPER
335337 select DRM_DISPLAY_DSC_HELPER
336338 help
337339 Say Y if you want to enable support for panels based on the
@@ -954,6 +956,7 @@ config DRM_PANEL_SAMSUNG_S6E3HA8 · 616 unmodified lines
954956 depends on OF
955957 depends on DRM_MIPI_DSI
956958 depends on BACKLIGHT_CLASS_DEVICE
959+ select DRM_DISPLAY_HELPER
957960 select DRM_DISPLAY_DSC_HELPER
958961 help
959962 Say Y or M here if you want to enable support for the
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c+5−2
@@ -2562,9 +2562,12 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi) · 2561 unmodified lines
25622562 "Couldn't get our power regulator\n");
25632563
25642564 ctx->iovcc = devm_regulator_get_optional(&dsi->dev, "iovcc");
2565− if (IS_ERR(ctx->iovcc))
2566− return dev_err_probe(&dsi->dev, PTR_ERR(ctx->iovcc),
2565+ if (IS_ERR(ctx->iovcc)) {
2566+ if (PTR_ERR(ctx->iovcc) != -ENODEV)
2567+ return dev_err_probe(&dsi->dev, PTR_ERR(ctx->iovcc),
25672568 "Couldn't get our iovcc regulator\n");
2569+ ctx->iovcc = NULL;
2570+ }
25682571
25692572 ctx->reset = devm_gpiod_get_optional(&dsi->dev, "reset", GPIOD_OUT_LOW);
25702573 if (IS_ERR(ctx->reset))
drivers/gpu/drm/tests/drm_gem_shmem_test.c+10−6
@@ -95,13 +95,9 @@ static void drm_gem_shmem_test_obj_create_private(struct kunit *test) · 94 unmodified lines
9595 sg_init_one(sgt->sgl, buf, TEST_SIZE);
9696
9797 /*
98− * Set the DMA mask to 64-bits and map the sgtables
99− * otherwise drm_gem_shmem_free will cause a warning
100− * on debug kernels.
98+ * Map the sgtables otherwise drm_gem_shmem_free will cause a warning on
99+ * debug kernels.
101100 */
102− ret = dma_set_mask(drm_dev->dev, DMA_BIT_MASK(64));
103− KUNIT_ASSERT_EQ(test, ret, 0);
104−
105101 ret = dma_map_sgtable(drm_dev->dev, sgt, DMA_BIDIRECTIONAL, 0);
106102 KUNIT_ASSERT_EQ(test, ret, 0);
107103
@@ -352,11 +348,19 @@ static int drm_gem_shmem_test_init(struct kunit *test) · 244 unmodified lines
352348 {
353349 struct device *dev;
354350 struct drm_device *drm_dev;
351+ int ret;
355352
356353 /* Allocate a parent device */
357354 dev = drm_kunit_helper_alloc_device(test);
358355 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
359356
357+ /*
358+ * Set the DMA mask to 64-bits to avoid intermittent failures calling
359+ * drm_gem_shmem_get_pages_sgt().
360+ */
361+ ret = dma_set_mask(dev, DMA_BIT_MASK(64));
362+ KUNIT_ASSERT_EQ(test, ret, 0);
363+
360364 /*
361365 * The DRM core will automatically initialize the GEM core and create
362366 * a DRM Memory Manager object which provides an address space pool
drivers/gpu/drm/tiny/appletbdrm.c+30−23
@@ -315,33 +315,16 @@ static const u32 appletbdrm_primary_plane_formats[] = { · 314 unmodified lines
315315 DRM_FORMAT_XRGB8888, /* emulated */
316316 };
317317
318−static int appletbdrm_primary_plane_helper_atomic_check(struct drm_plane *plane,
319− struct drm_atomic_commit *state)
318+static int appletbdrm_primary_plane_helper_begin_fb_access(struct drm_plane *plane,
319+ struct drm_plane_state *new_plane_state)
320320 {
321− struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state, plane);
322− struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state, plane);
323− struct drm_crtc *new_crtc = new_plane_state->crtc;
324− struct drm_crtc_state *new_crtc_state = NULL;
325321 struct appletbdrm_plane_state *appletbdrm_state = to_appletbdrm_plane_state(new_plane_state);
322+ size_t frames_size = 0;
326323 struct drm_atomic_helper_damage_iter iter;
327324 struct drm_rect damage;
328− size_t frames_size = 0;
329325 size_t request_size;
330− int ret;
331−
332− if (new_crtc)
333− new_crtc_state = drm_atomic_get_new_crtc_state(state, new_crtc);
334326
335− ret = drm_atomic_helper_check_plane_state(new_plane_state, new_crtc_state,
336− DRM_PLANE_NO_SCALING,
337− DRM_PLANE_NO_SCALING,
338− false, false);
339− if (ret)
340− return ret;
341− else if (!new_plane_state->visible)
342− return 0;
343−
344− drm_atomic_helper_damage_iter_init(&iter, old_plane_state, new_plane_state);
327+ drm_atomic_helper_damage_iter_init(&iter, plane->state, new_plane_state);
345328 drm_atomic_for_each_plane_damage(&iter, &damage) {
346329 frames_size += struct_size((struct appletbdrm_frame *)0, buf, rect_size(&damage));
347330 }
@@ -366,6 +349,29 @@ static int appletbdrm_primary_plane_helper_atomic_check(struct drm_plane *plane, · 18 unmodified lines
366349 appletbdrm_state->request_size = request_size;
367350 appletbdrm_state->frames_size = frames_size;
368351
352+ return drm_gem_begin_shadow_fb_access(plane, new_plane_state);
353+}
354+
355+static int appletbdrm_primary_plane_helper_atomic_check(struct drm_plane *plane,
356+ struct drm_atomic_commit *state)
357+{
358+ struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state, plane);
359+ struct drm_crtc *new_crtc = new_plane_state->crtc;
360+ struct drm_crtc_state *new_crtc_state = NULL;
361+ int ret;
362+
363+ if (new_crtc)
364+ new_crtc_state = drm_atomic_get_new_crtc_state(state, new_crtc);
365+
366+ ret = drm_atomic_helper_check_plane_state(new_plane_state, new_crtc_state,
367+ DRM_PLANE_NO_SCALING,
368+ DRM_PLANE_NO_SCALING,
369+ false, false);
370+ if (ret)
371+ return ret;
372+ else if (!new_plane_state->visible)
373+ return 0;
374+
369375 return 0;
370376 }
371377
@@ -468,7 +474,7 @@ end_fb_cpu_access: · 96 unmodified lines
468474 }
469475
470476 static void appletbdrm_primary_plane_helper_atomic_update(struct drm_plane *plane,
471− struct drm_atomic_commit *old_state)
477+ struct drm_atomic_commit *old_state)
472478 {
473479 struct appletbdrm_device *adev = drm_to_adev(plane->dev);
474480 struct drm_device *drm = plane->dev;
@@ -552,7 +558,8 @@ static void appletbdrm_primary_plane_destroy_state(struct drm_plane *plane, · 77 unmodified lines
552558 }
553559
554560 static const struct drm_plane_helper_funcs appletbdrm_primary_plane_helper_funcs = {
555− DRM_GEM_SHADOW_PLANE_HELPER_FUNCS,
561+ .begin_fb_access = appletbdrm_primary_plane_helper_begin_fb_access,
562+ .end_fb_access = drm_gem_end_shadow_fb_access,
556563 .atomic_check = appletbdrm_primary_plane_helper_atomic_check,
557564 .atomic_update = appletbdrm_primary_plane_helper_atomic_update,
558565 .atomic_disable = appletbdrm_primary_plane_helper_atomic_disable,
drivers/gpu/drm/ttm/ttm_backup.c+85−44
@@ -6,9 +6,10 @@ · 5 unmodified lines
66 #include <drm/ttm/ttm_backup.h>
77
88 #include <linux/export.h>
9−#include <linux/page-flags.h>
109 #include <linux/swap.h>
1110
11+#include "ttm_pool_internal.h"
12+
1213 /*
1314 * Need to map shmem indices to handle since a handle value
1415 * of 0 means error, following the swp_entry_t convention.
@@ -68,17 +69,23 @@ int ttm_backup_copy_page(struct file *backup, struct page *dst, · 53 unmodified lines
6869 }
6970
7071 /**
71− * ttm_backup_backup_page() - Backup a page
72+ * ttm_backup_backup_folio() - Backup a folio
7273 * @backup: The struct backup pointer to use.
73− * @page: The page to back up.
74− * @writeback: Whether to perform immediate writeback of the page.
74+ * @folio: The folio to back up.
75+ * @order: The allocation order of @folio. Since TTM allocates higher-order
76+ * pages without __GFP_COMP, folio_nr_pages(@folio) would always
77+ * return 1; the caller must pass the true order explicitly.
78+ * @writeback: Whether to perform immediate writeback of the folio's pages.
7579 * This may have performance implications.
76− * @idx: A unique integer for each page and each struct backup.
80+ * @idx: A unique integer for the first page of the folio and each struct backup.
7781 * This allows the backup implementation to avoid managing
7882 * its address space separately.
79− * @page_gfp: The gfp value used when the page was allocated.
80− * This is used for accounting purposes.
83+ * @folio_gfp: The gfp value used when the folio was allocated.
84+ * Currently unused.
8185 * @alloc_gfp: The gfp to be used when allocating memory.
86+ * @nr_pages_backed: Output. On a successful return, set to the number of
87+ * pages actually backed up, which may be less than (1 << @order)
88+ * if an -ENOMEM was encountered mid-folio.
8289 *
8390 * Context: If called from reclaim context, the caller needs to
8491 * assert that the shrinker gfp has __GFP_FS set, to avoid
@@ -87,53 +94,87 @@ int ttm_backup_copy_page(struct file *backup, struct page *dst, · 2 unmodified lines
8794 * that the shrinker gfp has __GFP_IO set, since without it,
8895 * we're not allowed to start backup IO.
8996 *
90− * Return: A handle on success. Negative error code on failure.
91− *
92− * Note: This function could be extended to back up a folio and
93− * implementations would then split the folio internally if needed.
94− * Drawback is that the caller would then have to keep track of
95− * the folio size- and usage.
97+ * Return: A handle for the first backed-up page on success (handles for
98+ * subsequent pages follow sequentially). -ENOMEM if no pages could be backed
99+ * up. Any other negative error code if a non-ENOMEM failure occurred; in that
100+ * case any pages backed up so far are truncated before returning.
96101 */
97102 s64
98−ttm_backup_backup_page(struct file *backup, struct page *page,
99− bool writeback, pgoff_t idx, gfp_t page_gfp,
100− gfp_t alloc_gfp)
103+ttm_backup_backup_folio(struct file *backup, struct folio *folio,
104+ unsigned int order, bool writeback, pgoff_t idx,
105+ gfp_t folio_gfp, gfp_t alloc_gfp,
106+ pgoff_t *nr_pages_backed)
101107 {
102108 struct address_space *mapping = backup->f_mapping;
103− unsigned long handle = 0;
109+ int nr_pages = 1 << order;
104110 struct folio *to_folio;
105− int ret;
106−
107− to_folio = shmem_read_folio_gfp(mapping, idx, alloc_gfp);
108− if (IS_ERR(to_folio))
109− return PTR_ERR(to_folio);
110−
111− folio_mark_accessed(to_folio);
112− folio_lock(to_folio);
113− folio_mark_dirty(to_folio);
114− copy_highpage(folio_file_page(to_folio, idx), page);
115− handle = ttm_backup_shmem_idx_to_handle(idx);
116−
117− if (writeback && !folio_mapped(to_folio) &&
118− folio_clear_dirty_for_io(to_folio)) {
119− folio_set_reclaim(to_folio);
120− ret = shmem_writeout(to_folio, NULL, NULL);
121− if (!folio_test_writeback(to_folio))
122− folio_clear_reclaim(to_folio);
111+ int ret, i;
112+
113+ *nr_pages_backed = 0;
114+
115+ for (i = 0; i < nr_pages; ) {
116+ int to_nr, j;
117+
123118 /*
124− * If writeout succeeds, it unlocks the folio. errors
125− * are otherwise dropped, since writeout is only best
126− * effort here.
119+ * Only inject past the first subpage so *nr_pages_backed is
120+ * always > 0 here, matching a genuine mid-compound -ENOMEM
121+ * and driving the caller's reactive split fallback instead
122+ * of an early, no-progress failure.
127123 */
128− if (ret)
124+ if (IS_ENABLED(CONFIG_FAULT_INJECTION) && i &&
125+ ttm_backup_fault_inject_folio())
126+ to_folio = ERR_PTR(-ENOMEM);
127+ else
128+ to_folio = shmem_read_folio_gfp(mapping, idx + i, alloc_gfp);
129+ if (IS_ERR(to_folio)) {
130+ int err = PTR_ERR(to_folio);
131+
132+ if (err == -ENOMEM && *nr_pages_backed)
133+ return ttm_backup_shmem_idx_to_handle(idx);
134+
135+ if (*nr_pages_backed) {
136+ shmem_truncate_range(file_inode(backup),
137+ (loff_t)idx << PAGE_SHIFT,
138+ ((loff_t)(idx + i) << PAGE_SHIFT) - 1);
139+ /*
140+ * The pages just truncated are no longer
141+ * backed up; don't let the caller mistake
142+ * them for valid handles.
143+ */
144+ *nr_pages_backed = 0;
145+ }
146+ return err;
147+ }
148+
149+ to_nr = min_t(int, nr_pages - i,
150+ folio_next_index(to_folio) - (idx + i));
151+
152+ folio_mark_accessed(to_folio);
153+ folio_lock(to_folio);
154+ folio_mark_dirty(to_folio);
155+
156+ for (j = 0; j < to_nr; j++)
157+ copy_highpage(folio_file_page(to_folio, idx + i + j),
158+ folio_page(folio, i + j));
159+
160+ if (writeback && !folio_mapped(to_folio) &&
161+ folio_clear_dirty_for_io(to_folio)) {
162+ folio_set_reclaim(to_folio);
163+ ret = shmem_writeout(to_folio, NULL, NULL);
164+ if (!folio_test_writeback(to_folio))
165+ folio_clear_reclaim(to_folio);
166+ if (ret == AOP_WRITEPAGE_ACTIVATE)
167+ folio_unlock(to_folio);
168+ } else {
129169 folio_unlock(to_folio);
130− } else {
131− folio_unlock(to_folio);
132− }
170+ }
133171
134− folio_put(to_folio);
172+ folio_put(to_folio);
173+ i += to_nr;
174+ *nr_pages_backed = i;
175+ }
135176
136− return handle;
177+ return ttm_backup_shmem_idx_to_handle(idx);
137178 }
138179
139180 /**
drivers/gpu/drm/ttm/ttm_pool.c+74−15
@@ -53,8 +53,23 @@ · 52 unmodified lines
5353 #ifdef CONFIG_FAULT_INJECTION
5454 #include <linux/fault-inject.h>
5555 static DECLARE_FAULT_ATTR(backup_fault_inject);
56+
57+/*
58+ * Exposed to ttm_backup.c so a mid-compound subpage can be made to fail
59+ * with -ENOMEM, exercising the reactive split-and-retry fallback in
60+ * ttm_pool_backup() for high-order backups.
61+ */
62+bool ttm_backup_fault_inject_folio(void)
63+{
64+ return should_fail(&backup_fault_inject, 1);
65+}
5666 #else
5767 #define should_fail(...) false
68+
69+bool ttm_backup_fault_inject_folio(void)
70+{
71+ return false;
72+}
5873 #endif
5974
6075 /**
@@ -487,7 +502,7 @@ static void ttm_pool_split_for_swap(struct ttm_pool *pool, struct page *p) · 426 unmodified lines
487502 /**
488503 * DOC: Partial backup and restoration of a struct ttm_tt.
489504 *
490− * Swapout using ttm_backup_backup_page() and swapin using
505+ * Swapout using ttm_backup_backup_folio() and swapin using
491506 * ttm_backup_copy_page() may fail.
492507 * The former most likely due to lack of swap-space or memory, the latter due
493508 * to lack of memory or because of signal interruption during waits.
@@ -1036,12 +1051,12 @@ long ttm_pool_backup(struct ttm_pool *pool, struct ttm_tt *tt, · 542 unmodified lines
10361051 {
10371052 struct file *backup = tt->backup;
10381053 struct page *page;
1039− unsigned long handle;
10401054 gfp_t alloc_gfp;
10411055 gfp_t gfp;
10421056 int ret = 0;
10431057 pgoff_t shrunken = 0;
1044− pgoff_t i, num_pages;
1058+ pgoff_t i, j, num_pages, npages;
1059+ pgoff_t nr_backed;
10451060
10461061 if (WARN_ON(ttm_tt_is_backed_up(tt)))
10471062 return -EINVAL;
@@ -1119,9 +1134,11 @@ long ttm_pool_backup(struct ttm_pool *pool, struct ttm_tt *tt, · 71 unmodified lines
11191134 if (IS_ENABLED(CONFIG_FAULT_INJECTION) && should_fail(&backup_fault_inject, 1))
11201135 num_pages = DIV_ROUND_UP(num_pages, 2);
11211136
1122− for (i = 0; i < num_pages; ++i) {
1123− s64 shandle;
1137+ for (i = 0; i < num_pages; i += npages) {
1138+ unsigned int order;
1139+ s64 handle;
11241140
1141+ npages = 1;
11251142 page = tt->pages[i];
11261143 if (unlikely(!page))
11271144 continue;
@@ -1130,19 +1147,61 @@ long ttm_pool_backup(struct ttm_pool *pool, struct ttm_tt *tt, · 2 unmodified lines
11301147 if (unlikely(ttm_backup_page_ptr_is_handle(page)))
11311148 continue;
11321149
1133− ttm_pool_split_for_swap(pool, page);
1150+ order = ttm_pool_page_order(pool, page);
1151+ npages = 1UL << order;
1152+
1153+ /*
1154+ * We don't allow dipping kernel reserves for high order backup
1155+ */
1156+ if (order)
1157+ alloc_gfp |= __GFP_NOMEMALLOC;
1158+ else
1159+ alloc_gfp &= ~__GFP_NOMEMALLOC;
1160+
1161+ /*
1162+ * Back up the compound atomically at its native order. If
1163+ * fault injection truncated num_pages mid-compound, skip
1164+ * the partial tail rather than splitting.
1165+ */
1166+ if (unlikely(i + npages > num_pages))
1167+ break;
11341168
1135− shandle = ttm_backup_backup_page(backup, page, flags->writeback, i,
1136− gfp, alloc_gfp);
1137− if (shandle < 0) {
1138− /* We allow partially shrunken tts */
1139− ret = shandle;
1169+ handle = ttm_backup_backup_folio(backup, page_folio(page),
1170+ order, flags->writeback, i,
1171+ gfp, alloc_gfp,
1172+ &nr_backed);
1173+ /*
1174+ * Zero progress on this compound (whether order 0 or a
1175+ * high-order compound that failed before backing up even
1176+ * its first subpage) is unrecoverable: bail out rather than
1177+ * looping forever with npages == nr_backed == 0 below.
1178+ */
1179+ if (unlikely(handle < 0 && !nr_backed)) {
1180+ ret = handle;
11401181 break;
11411182 }
1142− handle = shandle;
1143− tt->pages[i] = ttm_backup_handle_to_page_ptr(handle);
1144− __free_pages_gpu_account(page, 0, false);
1145− shrunken++;
1183+
1184+ for (j = 0; j < nr_backed; j++)
1185+ tt->pages[i + j] = ttm_backup_handle_to_page_ptr(handle + j);
1186+
1187+ shrunken += nr_backed;
1188+
1189+ if (unlikely(nr_backed < npages)) {
1190+ /*
1191+ * Partial OOM backup: split the compound and free the
1192+ * subpages whose content is now in shmem. Continue the
1193+ * loop from the first un-backed order-0 page.
1194+ */
1195+ ttm_pool_split_for_swap(pool, page);
1196+ for (j = 0; j < nr_backed; j++)
1197+ __free_pages_gpu_account(page + j, 0, false);
1198+ npages = nr_backed;
1199+ continue;
1200+ }
1201+
1202+ /* Fully backed up: free at native order. */
1203+ page->private = 0;
1204+ __free_pages_gpu_account(page, order, false);
11461205 }
11471206
11481207 return shrunken ? shrunken : ret;
drivers/gpu/drm/ttm/ttm_pool_internal.h+8−0
@@ -22,4 +22,12 @@ static inline unsigned int ttm_pool_beneficial_order(struct ttm_pool *pool) · 21 unmodified lines
2222 return pool->alloc_flags & 0xff;
2323 }
2424
25+/*
26+ * Implemented in ttm_pool.c, used by ttm_backup.c. Returns true if a fault
27+ * should be injected mid-compound to test the reactive split-and-retry
28+ * fallback in ttm_pool_backup(). Always returns false when
29+ * CONFIG_FAULT_INJECTION is disabled.
30+ */
31+bool ttm_backup_fault_inject_folio(void);
32+
2533 #endif
drivers/gpu/drm/v3d/v3d_drv.h+2−0
@@ -571,6 +571,8 @@ extern bool super_pages; · 570 unmodified lines
571571 void v3d_init_hw_state(struct v3d_dev *v3d);
572572 int v3d_gem_init(struct drm_device *dev);
573573 void v3d_gem_destroy(struct drm_device *dev);
574+void v3d_idle_axi(struct v3d_dev *v3d, int core);
575+void v3d_idle_gca(struct v3d_dev *v3d);
574576 void v3d_reset_sms(struct v3d_dev *v3d);
575577 void v3d_reset(struct v3d_dev *v3d);
576578 void v3d_invalidate_caches(struct v3d_dev *v3d);
drivers/gpu/drm/v3d/v3d_gem.c+14−2
@@ -36,9 +36,21 @@ v3d_init_core(struct v3d_dev *v3d, int core) · 35 unmodified lines
3636 V3D_CORE_WRITE(core, V3D_CTL_L2TFLEND, ~0);
3737 }
3838
39−static void
39+void
4040 v3d_idle_axi(struct v3d_dev *v3d, int core)
4141 {
42+ if (v3d->ver >= V3D_GEN_71) {
43+ V3D_WRITE(V3D_GMP_CFG(v3d->ver), V3D_GMP_CFG_STOP_REQ);
44+
45+ if (wait_for((V3D_READ(V3D_GMP_STATUS(v3d->ver)) &
46+ (V3D_GMP_STATUS_RD_COUNT_MASK |
47+ V3D_GMP_STATUS_WR_COUNT_MASK |
48+ V3D_GMP_STATUS_CFG_BUSY)) == 0, 100)) {
49+ drm_err(&v3d->drm, "Failed to wait for safe GMP shutdown\n");
50+ }
51+ return;
52+ }
53+
4254 V3D_CORE_WRITE(core, V3D_GMP_CFG(v3d->ver), V3D_GMP_CFG_STOP_REQ);
4355
4456 if (wait_for((V3D_CORE_READ(core, V3D_GMP_STATUS(v3d->ver)) &
@@ -49,7 +61,7 @@ v3d_idle_axi(struct v3d_dev *v3d, int core) · 4 unmodified lines
4961 }
5062 }
5163
52−static void
64+void
5365 v3d_idle_gca(struct v3d_dev *v3d)
5466 {
5567 if (v3d->ver >= V3D_GEN_41)
drivers/gpu/drm/v3d/v3d_power.c+7−0
@@ -54,8 +54,15 @@ int v3d_power_suspend(struct device *dev) · 53 unmodified lines
5454
5555 v3d_clean_caches(v3d);
5656
57+ /* Wait until V3D has no active or pending AXI transactions. */
58+ v3d_idle_axi(v3d, 0);
59+ v3d_idle_gca(v3d);
60+
5761 ret = v3d_suspend_sms(v3d);
5862 if (ret) {
63+ /* Staying active: undo the GMP STOP_REQ from v3d_idle_axi(). */
64+ V3D_WRITE(V3D_GMP_CFG(v3d->ver),
65+ V3D_READ(V3D_GMP_CFG(v3d->ver)) & ~V3D_GMP_CFG_STOP_REQ);
5966 v3d_irq_enable(v3d);
6067 return ret;
6168 }
drivers/gpu/drm/vc4/vc4_bo.c+8−4
@@ -732,9 +732,13 @@ static int vc4_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_struct · 731 unmodified lines
732732 {
733733 struct vc4_bo *bo = to_vc4_bo(obj);
734734
735− if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) {
736− DRM_DEBUG("mmapping of shader BOs for writing not allowed.\n");
737− return -EINVAL;
735+ if (bo->validated_shader) {
736+ if (vma->vm_flags & VM_WRITE) {
737+ DRM_DEBUG("mmapping of shader BOs for writing not allowed.\n");
738+ return -EINVAL;
739+ }
740+
741+ vm_flags_clear(vma, VM_MAYWRITE);
738742 }
739743
740744 mutex_lock(&bo->madv_lock);
@@ -1044,7 +1048,7 @@ static void vc4_bo_cache_destroy(struct drm_device *dev, void *unused) · 303 unmodified lines
10441048 struct vc4_dev *vc4 = to_vc4_dev(dev);
10451049 int i;
10461050
1047− timer_delete(&vc4->bo_cache.time_timer);
1051+ timer_shutdown_sync(&vc4->bo_cache.time_timer);
10481052 cancel_work_sync(&vc4->bo_cache.time_work);
10491053
10501054 vc4_bo_cache_purge(dev);
drivers/gpu/drm/vc4/vc4_hvs.c+1−1
@@ -1752,7 +1752,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) · 1751 unmodified lines
17521752 static void vc4_hvs_unbind(struct device *dev, struct device *master,
17531753 void *data)
17541754 {
1755− struct drm_device *drm = dev_get_drvdata(master);
1755+ struct drm_device *drm = data;
17561756 struct vc4_dev *vc4 = to_vc4_dev(drm);
17571757 struct vc4_hvs *hvs = vc4->hvs;
17581758 struct drm_mm_node *node, *next;
drivers/gpu/drm/vc4/vc4_v3d.c+1−1
@@ -494,7 +494,7 @@ err_put_runtime_pm: · 493 unmodified lines
494494 static void vc4_v3d_unbind(struct device *dev, struct device *master,
495495 void *data)
496496 {
497− struct drm_device *drm = dev_get_drvdata(master);
497+ struct drm_device *drm = data;
498498 struct vc4_dev *vc4 = to_vc4_dev(drm);
499499
500500 vc4_irq_uninstall(drm);
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c+17−5
@@ -78,7 +78,7 @@ static int vmw_gb_surface_unbind(struct vmw_resource *res, · 77 unmodified lines
7878 static int vmw_gb_surface_destroy(struct vmw_resource *res);
7979 static int
8080 vmw_gb_surface_define_internal(struct drm_device *dev,
81− struct drm_vmw_gb_surface_create_ext_req *req,
81+ const struct drm_vmw_gb_surface_create_ext_req *req,
8282 struct drm_vmw_gb_surface_create_rep *rep,
8383 struct drm_file *file_priv);
8484 static int
@@ -1503,7 +1503,7 @@ int vmw_gb_surface_reference_ext_ioctl(struct drm_device *dev, void *data, · 1418 unmodified lines
15031503 */
15041504 static int
15051505 vmw_gb_surface_define_internal(struct drm_device *dev,
1506− struct drm_vmw_gb_surface_create_ext_req *req,
1506+ const struct drm_vmw_gb_surface_create_ext_req *req,
15071507 struct drm_vmw_gb_surface_create_rep *rep,
15081508 struct drm_file *file_priv)
15091509 {
@@ -1521,9 +1521,21 @@ vmw_gb_surface_define_internal(struct drm_device *dev, · 11 unmodified lines
15211521 req->base.svga3d_flags);
15221522
15231523 /* array_size must be null for non-GL3 host. */
1524− if (req->base.array_size > 0 && !has_sm4_context(dev_priv)) {
1525− VMW_DEBUG_USER("SM4 surface not supported.\n");
1526− return -EINVAL;
1524+ if (req->base.array_size > 0) {
1525+ if (has_sm5_context(dev_priv)) {
1526+ if (req->base.array_size > SVGA3D_SM5_MAX_SURFACE_ARRAYSIZE) {
1527+ VMW_DEBUG_USER("Invalid Surface Array Size.\n");
1528+ return -EINVAL;
1529+ }
1530+ } else if (has_sm4_context(dev_priv)) {
1531+ if (req->base.array_size > SVGA3D_SM4_MAX_SURFACE_ARRAYSIZE) {
1532+ VMW_DEBUG_USER("Invalid Surface Array Size.\n");
1533+ return -EINVAL;
1534+ }
1535+ } else {
1536+ VMW_DEBUG_USER("SM4+ surface not supported.\n");
1537+ return -EINVAL;
1538+ }
15271539 }
15281540
15291541 if (!has_sm4_1_context(dev_priv)) {
drivers/gpu/drm/xe/xe_i2c.c+4−1
@@ -95,18 +95,21 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c) · 94 unmodified lines
9595 struct platform_device *pdev;
9696 struct fwnode_handle *fwnode;
9797 int ret;
98+ u32 id;
9899
99100 fwnode = fwnode_create_software_node(xe_i2c_adapter_properties, NULL);
100101 if (IS_ERR(fwnode))
101102 return PTR_ERR(fwnode);
102103
104+ id = (pci_domain_nr(pci->bus) << 16) | pci_dev_id(pci);
105+
103106 /*
104107 * Not using platform_device_register_full() here because we don't have
105108 * a handle to the platform_device before it returns. xe_i2c_notifier()
106109 * uses that handle, but it may be called before
107110 * platform_device_register_full() is done.
108111 */
109− pdev = platform_device_alloc(adapter_name, pci_dev_id(pci));
112+ pdev = platform_device_alloc(adapter_name, id);
110113 if (!pdev) {
111114 ret = -ENOMEM;
112115 goto err_fwnode_remove;
drivers/gpu/drm/xe/xe_migrate.c+10−6
@@ -1313,6 +1313,7 @@ int xe_migrate_ccs_rw_copy(struct xe_tile *tile, struct xe_exec_queue *q, · 1312 unmodified lines
13131313 * content.
13141314 * @src_bo: The buffer object @src is currently bound to.
13151315 * @read_write : Creates BB commands for CCS read/write.
1316+ * @bound: Device is bound
13161317 *
13171318 * Directly clearing the BB lacks atomicity and can lead to undefined
13181319 * behavior if the vCPU is halted mid-operation during the clearing
@@ -1325,7 +1326,8 @@ int xe_migrate_ccs_rw_copy(struct xe_tile *tile, struct xe_exec_queue *q, · 6 unmodified lines
13251326 * Returns: None.
13261327 */
13271328 void xe_migrate_ccs_rw_copy_clear(struct xe_bo *src_bo,
1328− enum xe_sriov_vf_ccs_rw_ctxs read_write)
1329+ enum xe_sriov_vf_ccs_rw_ctxs read_write,
1330+ bool bound)
13291331 {
13301332 struct xe_mem_pool_node *bb = src_bo->bb_ccs[read_write];
13311333 struct xe_device *xe = xe_bo_device(src_bo);
@@ -1339,13 +1341,15 @@ void xe_migrate_ccs_rw_copy_clear(struct xe_bo *src_bo, · 7 unmodified lines
13391341 bb_pool = ctx->mem.ccs_bb_pool;
13401342
13411343 scoped_guard(mutex, xe_mem_pool_bo_swap_guard(bb_pool)) {
1342− xe_mem_pool_swap_shadow_locked(bb_pool);
1344+ if (bound) {
1345+ xe_mem_pool_swap_shadow_locked(bb_pool);
13431346
1344− cs = xe_mem_pool_node_cpu_addr(bb);
1345− memset(cs, MI_NOOP, bb->sa_node.size);
1346− xe_sriov_vf_ccs_rw_update_bb_addr(ctx);
1347+ cs = xe_mem_pool_node_cpu_addr(bb);
1348+ memset(cs, MI_NOOP, bb->sa_node.size);
1349+ xe_sriov_vf_ccs_rw_update_bb_addr(ctx);
13471350
1348− xe_mem_pool_sync_shadow_locked(bb);
1351+ xe_mem_pool_sync_shadow_locked(bb);
1352+ }
13491353 xe_mem_pool_free_node(bb);
13501354 src_bo->bb_ccs[read_write] = NULL;
13511355 }
drivers/gpu/drm/xe/xe_migrate.h+2−1
@@ -142,7 +142,8 @@ int xe_migrate_ccs_rw_copy(struct xe_tile *tile, struct xe_exec_queue *q, · 141 unmodified lines
142142 enum xe_sriov_vf_ccs_rw_ctxs read_write);
143143
144144 void xe_migrate_ccs_rw_copy_clear(struct xe_bo *src_bo,
145− enum xe_sriov_vf_ccs_rw_ctxs read_write);
145+ enum xe_sriov_vf_ccs_rw_ctxs read_write,
146+ bool bound);
146147
147148 struct xe_lrc *xe_migrate_lrc(struct xe_migrate *migrate);
148149 struct xe_exec_queue *xe_migrate_exec_queue(struct xe_migrate *migrate);
drivers/gpu/drm/xe/xe_sriov_vf_ccs.c+12−2
@@ -3,6 +3,8 @@ · 2 unmodified lines
33 * Copyright © 2025 Intel Corporation
44 */
55
6+#include <drm/drm_drv.h>
7+
68 #include "instructions/xe_mi_commands.h"
79 #include "instructions/xe_gpu_commands.h"
810 #include "xe_bb.h"
@@ -446,7 +448,7 @@ err_unwind: · 437 unmodified lines
446448 */
447449 for_each_ccs_rw_ctx(ctx_id) {
448450 if (bo->bb_ccs[ctx_id])
449− xe_migrate_ccs_rw_copy_clear(bo, ctx_id);
451+ xe_migrate_ccs_rw_copy_clear(bo, ctx_id, true);
450452 }
451453 return err;
452454 }
@@ -466,19 +468,27 @@ int xe_sriov_vf_ccs_detach_bo(struct xe_bo *bo) · 13 unmodified lines
466468 struct xe_device *xe = xe_bo_device(bo);
467469 enum xe_sriov_vf_ccs_rw_ctxs ctx_id;
468470 struct xe_mem_pool_node *bb;
471+ bool bound;
472+ int idx;
469473
470474 xe_assert(xe, IS_VF_CCS_READY(xe));
471475
472476 if (!xe_bo_has_valid_ccs_bb(bo))
473477 return 0;
474478
479+ bound = drm_dev_enter(&xe->drm, &idx);
480+
475481 for_each_ccs_rw_ctx(ctx_id) {
476482 bb = bo->bb_ccs[ctx_id];
477483 if (!bb)
478484 continue;
479485
480− xe_migrate_ccs_rw_copy_clear(bo, ctx_id);
486+ xe_migrate_ccs_rw_copy_clear(bo, ctx_id, bound);
481487 }
488+
489+ if (bound)
490+ drm_dev_exit(idx);
491+
482492 return 0;
483493 }
484494
drivers/gpu/drm/xe/xe_vm.c+4−4
@@ -1809,10 +1809,10 @@ err_close: · 1808 unmodified lines
18091809 return ERR_PTR(err);
18101810
18111811 err_svm_fini:
1812− if (flags & XE_VM_FLAG_FAULT_MODE) {
1813− vm->size = 0; /* close the vm */
1814− xe_svm_fini(vm);
1815− }
1812+ vm->size = 0; /* close the vm */
1813+ if (flags & XE_VM_FLAG_FAULT_MODE)
1814+ xe_svm_close(vm);
1815+ xe_svm_fini(vm);
18161816 err_no_resv:
18171817 mutex_destroy(&vm->snap_mutex);
18181818 for_each_tile(tile, xe, id)
drivers/gpu/drm/xe/xe_vm_madvise.c+17−2
@@ -332,6 +332,20 @@ static int xe_vm_invalidate_madvise_range(struct xe_vm *vm, u64 start, u64 end) · 331 unmodified lines
332332 return err;
333333 }
334334
335+/**
336+ * madvise_range_needs_invalidation() - Check whether madvise needs invalidation
337+ * @args: madvise ioctl arguments
338+ *
339+ * Purgeable state updates only touch VMA/BO metadata. PTEs stay valid and are
340+ * zapped only if the BO is later purged.
341+ *
342+ * Return: true when the update needs PTE invalidation.
343+ */
344+static bool madvise_range_needs_invalidation(const struct drm_xe_madvise *args)
345+{
346+ return args->type != DRM_XE_VMA_ATTR_PURGEABLE_STATE;
347+}
348+
335349 static bool madvise_args_are_sane(struct xe_device *xe, const struct drm_xe_madvise *args)
336350 {
337351 if (XE_IOCTL_DBG(xe, !args))
@@ -708,8 +722,9 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data, struct drm_file *fil · 370 unmodified lines
708722 madvise_funcs[attr_type](xe, vm, madvise_range.vmas, madvise_range.num_vmas, args,
709723 &details);
710724
711− err = xe_vm_invalidate_madvise_range(vm, madvise_range.addr,
712− madvise_range.addr + args->range);
725+ if (madvise_range_needs_invalidation(args))
726+ err = xe_vm_invalidate_madvise_range(vm, madvise_range.addr,
727+ madvise_range.addr + args->range);
713728
714729 if (madvise_range.has_svm_userptr_vmas)
715730 xe_svm_notifier_unlock(vm);
drivers/hwmon/asus-ec-sensors.c+10−8
@@ -1009,7 +1009,7 @@ struct ec_sensors_data { · 1008 unmodified lines
10091009 /* sorted list of unique register banks */
10101010 u8 banks[ASUS_EC_MAX_BANK + 1];
10111011 /* in jiffies */
1012− unsigned long last_updated;
1012+ u64 next_update;
10131013 struct lock_data lock_data;
10141014 /* number of board EC sensors */
10151015 u8 nr_sensors;
@@ -1189,7 +1189,7 @@ static int asus_ec_block_read(const struct device *dev, · 173 unmodified lines
11891189 }
11901190 for (ireg = 0; ireg < ec->nr_registers; ireg++) {
11911191 reg_bank = register_bank(ec->registers[ireg]);
1192− if (reg_bank < bank) {
1192+ if (reg_bank != bank) {
11931193 continue;
11941194 }
11951195 ec_read(register_index(ec->registers[ireg]),
@@ -1278,13 +1278,12 @@ static int get_cached_value_or_update(const struct device *dev, · 82 unmodified lines
12781278 int sensor_index,
12791279 struct ec_sensors_data *state, s32 *value)
12801280 {
1281− if (time_after(jiffies, state->last_updated + HZ)) {
1281+ if (time_after64(get_jiffies_64(), state->next_update)) {
12821282 if (update_ec_sensors(dev, state)) {
12831283 dev_err(dev, "update_ec_sensors() failure\n");
12841284 return -EIO;
12851285 }
1286−
1287− state->last_updated = jiffies;
1286+ state->next_update = get_jiffies_64() + HZ;
12881287 }
12891288
12901289 *value = state->sensors[sensor_index].cached_value;
@@ -1402,6 +1401,7 @@ static int asus_ec_probe(struct platform_device *pdev) · 111 unmodified lines
14021401 if (!ec_data)
14031402 return -ENOMEM;
14041403
1404+ ec_data->next_update = INITIAL_JIFFIES;
14051405 dev_set_drvdata(dev, ec_data);
14061406 ec_data->board_info = pboard_info;
14071407
@@ -1495,9 +1495,11 @@ static int asus_ec_probe(struct platform_device *pdev) · 87 unmodified lines
14951495 if (!nr_count[type])
14961496 continue;
14971497
1498− asus_ec_hwmon_add_chan_info(asus_ec_hwmon_chan, dev,
1499− nr_count[type], type,
1500− hwmon_attributes[type]);
1498+ status = asus_ec_hwmon_add_chan_info(asus_ec_hwmon_chan, dev,
1499+ nr_count[type], type,
1500+ hwmon_attributes[type]);
1501+ if (status)
1502+ return status;
15011503 *ptr_asus_ec_ci++ = asus_ec_hwmon_chan++;
15021504 }
15031505
drivers/hwmon/corsair-cpro.c+1−0
@@ -645,6 +645,7 @@ static int ccp_probe(struct hid_device *hdev, const struct hid_device_id *id) · 644 unmodified lines
645645
646646 out_hw_close:
647647 hid_hw_close(hdev);
648+ hid_device_io_stop(hdev);
648649 out_hw_stop:
649650 hid_hw_stop(hdev);
650651 return ret;
drivers/hwmon/corsair-psu.c+1−0
@@ -822,6 +822,7 @@ static int corsairpsu_probe(struct hid_device *hdev, const struct hid_device_id · 821 unmodified lines
822822
823823 fail_and_close:
824824 hid_hw_close(hdev);
825+ hid_device_io_stop(hdev);
825826 fail_and_stop:
826827 hid_hw_stop(hdev);
827828 return ret;
drivers/hwmon/gigabyte_waterforce.c+3−1
@@ -371,13 +371,15 @@ static int waterforce_probe(struct hid_device *hdev, const struct hid_device_id · 370 unmodified lines
371371 if (IS_ERR(priv->hwmon_dev)) {
372372 ret = PTR_ERR(priv->hwmon_dev);
373373 hid_err(hdev, "hwmon registration failed with %d\n", ret);
374− goto fail_and_close;
374+ goto fail_and_io_stop;
375375 }
376376
377377 waterforce_debugfs_init(priv);
378378
379379 return 0;
380380
381+fail_and_io_stop:
382+ hid_device_io_stop(hdev);
381383 fail_and_close:
382384 hid_hw_close(hdev);
383385 fail_and_stop:
drivers/hwmon/nzxt-kraken3.c+4−2
@@ -948,7 +948,7 @@ static int kraken3_probe(struct hid_device *hdev, const struct hid_device_id *id · 947 unmodified lines
948948 ret = kraken3_init_device(hdev);
949949 if (ret < 0) {
950950 hid_err(hdev, "device init failed with %d\n", ret);
951− goto fail_and_close;
951+ goto fail_and_stop_io;
952952 }
953953
954954 ret = kraken3_get_fw_ver(hdev);
@@ -960,13 +960,15 @@ static int kraken3_probe(struct hid_device *hdev, const struct hid_device_id *id · 5 unmodified lines
960960 if (IS_ERR(priv->hwmon_dev)) {
961961 ret = PTR_ERR(priv->hwmon_dev);
962962 hid_err(hdev, "hwmon registration failed with %d\n", ret);
963− goto fail_and_close;
963+ goto fail_and_stop_io;
964964 }
965965
966966 kraken3_debugfs_init(priv, device_name);
967967
968968 return 0;
969969
970+fail_and_stop_io:
971+ hid_device_io_stop(hdev);
970972 fail_and_close:
971973 hid_hw_close(hdev);
972974 fail_and_stop:
drivers/hwmon/nzxt-smart2.c+1−1
@@ -768,7 +768,7 @@ static int nzxt_smart2_hid_probe(struct hid_device *hdev, · 767 unmodified lines
768768
769769 out_hw_close:
770770 hid_hw_close(hdev);
771−
771+ hid_device_io_stop(hdev);
772772 out_hw_stop:
773773 hid_hw_stop(hdev);
774774 return ret;
drivers/hwmon/occ/common.c+30−8
@@ -1052,32 +1052,49 @@ static int occ_setup_sensor_attrs(struct occ *occ) · 1051 unmodified lines
10521052 }
10531053
10541054 /* only need to do this once at startup, as OCC won't change sensors on us */
1055−static void occ_parse_poll_response(struct occ *occ)
1055+static int occ_parse_poll_response(struct occ *occ)
10561056 {
10571057 unsigned int i, old_offset, offset = 0, size = 0;
1058+ u16 data_length;
10581059 struct occ_sensor *sensor;
1059− struct occ_sensors *sensors = &occ->sensors;
1060+ struct occ_sensors parsed = {};
1061+ struct occ_sensors *sensors = &parsed;
10601062 struct occ_response *resp = &occ->resp;
10611063 struct occ_poll_response *poll =
10621064 (struct occ_poll_response *)&resp->data[0];
10631065 struct occ_poll_response_header *header = &poll->header;
10641066 struct occ_sensor_data_block *block = &poll->block;
10651067
1068+ data_length = get_unaligned_be16(&resp->data_length);
1069+ if (data_length < sizeof(*header) || data_length > OCC_RESP_DATA_BYTES) {
1070+ dev_err(occ->bus_dev, "invalid OCC poll response length %u\n",
1071+ data_length);
1072+ return -EMSGSIZE;
1073+ }
1074+
10661075 dev_info(occ->bus_dev, "OCC found, code level: %.16s\n",
10671076 header->occ_code_level);
10681077
10691078 for (i = 0; i < header->num_sensor_data_blocks; ++i) {
10701079 block = (struct occ_sensor_data_block *)((u8 *)block + offset);
1080+ if (size + sizeof(*header) + sizeof(block->header) >
1081+ data_length) {
1082+ dev_err(occ->bus_dev,
1083+ "truncated OCC sensor block header\n");
1084+ return -EMSGSIZE;
1085+ }
1086+
10711087 old_offset = offset;
10721088 offset = (block->header.num_sensors *
10731089 block->header.sensor_length) + sizeof(block->header);
1074− size += offset;
10751090
10761091 /* validate all the length/size fields */
1077− if ((size + sizeof(*header)) >= OCC_RESP_DATA_BYTES) {
1078− dev_warn(occ->bus_dev, "exceeded response buffer\n");
1079− return;
1092+ if (size + sizeof(*header) + offset > data_length) {
1093+ dev_err(occ->bus_dev,
1094+ "exceeded OCC poll response length\n");
1095+ return -EMSGSIZE;
10801096 }
1097+ size += offset;
10811098
10821099 dev_dbg(occ->bus_dev, " %04x..%04x: %.4s (%d sensors)\n",
10831100 old_offset, offset - 1, block->header.eye_catcher,
@@ -1107,6 +1124,9 @@ static void occ_parse_poll_response(struct occ *occ) · 23 unmodified lines
11071124
11081125 dev_dbg(occ->bus_dev, "Max resp size: %u+%zd=%zd\n", size,
11091126 sizeof(*header), size + sizeof(*header));
1127+ occ->sensors = parsed;
1128+
1129+ return 0;
11101130 }
11111131
11121132 int occ_active(struct occ *occ, bool active)
@@ -1138,10 +1158,12 @@ int occ_active(struct occ *occ, bool active) · 25 unmodified lines
11381158 goto unlock;
11391159 }
11401160
1141− occ->active = true;
11421161 occ->next_update = jiffies + OCC_UPDATE_FREQUENCY;
1143− occ_parse_poll_response(occ);
1162+ rc = occ_parse_poll_response(occ);
1163+ if (rc)
1164+ goto unlock;
11441165
1166+ occ->active = true;
11451167 rc = occ_setup_sensor_attrs(occ);
11461168 if (rc) {
11471169 dev_err(occ->bus_dev,
drivers/hwmon/pmbus/max34440.c+80−0
@@ -88,6 +88,33 @@ static int max34440_read_word_data(struct i2c_client *client, int page, · 87 unmodified lines
8888 ret = pmbus_read_word_data(client, page, phase,
8989 data->iout_oc_warn_limit);
9090 break;
91+ case PMBUS_VIN_OV_FAULT_LIMIT:
92+ case PMBUS_VIN_OV_WARN_LIMIT:
93+ case PMBUS_VIN_UV_WARN_LIMIT:
94+ case PMBUS_VIN_UV_FAULT_LIMIT:
95+ case PMBUS_MFR_VIN_MIN:
96+ case PMBUS_MFR_VIN_MAX:
97+ case PMBUS_IIN_OC_WARN_LIMIT:
98+ case PMBUS_IIN_OC_FAULT_LIMIT:
99+ case PMBUS_MFR_IIN_MAX:
100+ case PMBUS_MFR_VOUT_MIN:
101+ case PMBUS_MFR_VOUT_MAX:
102+ case PMBUS_IOUT_UC_FAULT_LIMIT:
103+ case PMBUS_MFR_IOUT_MAX:
104+ case PMBUS_UT_WARN_LIMIT:
105+ case PMBUS_UT_FAULT_LIMIT:
106+ case PMBUS_MFR_MAX_TEMP_1:
107+ /*
108+ * MAX34451/ADPM family do not support VIN/IIN limit registers,
109+ * manufacturer-specific min/max registers, or undercurrent/
110+ * undertemperature fault limits. Accessing these triggers CML
111+ * error and asserts ALERT.
112+ */
113+ if (data->id == max34451 || data->id == adpm12160 ||
114+ data->id == adpm12200 || data->id == adpm12250)
115+ return -ENXIO;
116+ ret = -ENODATA;
117+ break;
91118 case PMBUS_VIRT_READ_VOUT_MIN:
92119 ret = pmbus_read_word_data(client, page, phase,
93120 MAX34440_MFR_VOUT_MIN);
@@ -244,6 +271,51 @@ static int max34440_read_byte_data(struct i2c_client *client, int page, int reg) · 150 unmodified lines
244271 return ret;
245272 }
246273
274+static int max34451_read_byte_data(struct i2c_client *client, int page, int reg)
275+{
276+ const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
277+ const struct max34440_data *data = to_max34440_data(info);
278+
279+ switch (reg) {
280+ case PMBUS_STATUS_BYTE:
281+ case PMBUS_STATUS_OTHER:
282+ /*
283+ * MAX34451/ADPM family do not support STATUS_BYTE or
284+ * STATUS_OTHER registers. Accessing them triggers CML
285+ * error and asserts ALERT.
286+ */
287+ if (data->id == max34451 || data->id == adpm12160 ||
288+ data->id == adpm12200 || data->id == adpm12250)
289+ return -ENXIO;
290+ return -ENODATA;
291+ default:
292+ return -ENODATA;
293+ }
294+}
295+
296+static int max34451_write_byte_data(struct i2c_client *client, int page,
297+ int reg, u8 byte)
298+{
299+ const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
300+ const struct max34440_data *data = to_max34440_data(info);
301+
302+ switch (reg) {
303+ case PMBUS_STATUS_BYTE:
304+ case PMBUS_STATUS_OTHER:
305+ /*
306+ * MAX34451/ADPM family do not support STATUS_BYTE or
307+ * STATUS_OTHER registers. Writing to them triggers CML
308+ * error and asserts ALERT.
309+ */
310+ if (data->id == max34451 || data->id == adpm12160 ||
311+ data->id == adpm12200 || data->id == adpm12250)
312+ return -ENXIO;
313+ return -ENODATA;
314+ default:
315+ return -ENODATA;
316+ }
317+}
318+
247319 static int max34451_set_supported_funcs(struct i2c_client *client,
248320 struct max34440_data *data)
249321 {
@@ -363,7 +435,9 @@ static struct pmbus_driver_info max34440_info[] = { · 113 unmodified lines
363435 .func[9] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT,
364436 .func[10] = PMBUS_HAVE_IIN | PMBUS_HAVE_STATUS_INPUT,
365437 .func[18] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
438+ .read_byte_data = max34451_read_byte_data,
366439 .read_word_data = max34440_read_word_data,
440+ .write_byte_data = max34451_write_byte_data,
367441 .write_word_data = max34440_write_word_data,
368442 },
369443 [adpm12200] = {
@@ -399,7 +473,9 @@ static struct pmbus_driver_info max34440_info[] = { · 29 unmodified lines
399473 .func[10] = PMBUS_HAVE_IIN | PMBUS_HAVE_STATUS_INPUT,
400474 .func[14] = PMBUS_HAVE_IOUT,
401475 .func[18] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
476+ .read_byte_data = max34451_read_byte_data,
402477 .read_word_data = max34440_read_word_data,
478+ .write_byte_data = max34451_write_byte_data,
403479 .write_word_data = max34440_write_word_data,
404480 },
405481 [adpm12250] = {
@@ -433,7 +509,9 @@ static struct pmbus_driver_info max34440_info[] = { · 27 unmodified lines
433509 .func[10] = PMBUS_HAVE_IIN | PMBUS_HAVE_STATUS_INPUT,
434510 .func[14] = PMBUS_HAVE_IOUT,
435511 .func[18] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
512+ .read_byte_data = max34451_read_byte_data,
436513 .read_word_data = max34440_read_word_data,
514+ .write_byte_data = max34451_write_byte_data,
437515 .write_word_data = max34440_write_word_data,
438516 },
439517 [max34440] = {
@@ -581,7 +659,9 @@ static struct pmbus_driver_info max34440_info[] = { · 141 unmodified lines
581659 .func[18] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
582660 .func[19] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
583661 .func[20] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
662+ .read_byte_data = max34451_read_byte_data,
584663 .read_word_data = max34440_read_word_data,
664+ .write_byte_data = max34451_write_byte_data,
585665 .write_word_data = max34440_write_word_data,
586666 .page_change_delay = MAX34440_PAGE_CHANGE_DELAY,
587667 },
drivers/hwtracing/intel_th/core.c+0−10
@@ -843,18 +843,8 @@ err_put_dev: · 842 unmodified lines
843843 return err;
844844 }
845845
846−static int intel_th_output_release(struct inode *inode, struct file *file)
847−{
848− struct intel_th_device *thdev = file->private_data;
849−
850− put_device(&thdev->dev);
851−
852− return 0;
853−}
854−
855846 static const struct file_operations intel_th_output_fops = {
856847 .open = intel_th_output_open,
857− .release = intel_th_output_release,
858848 .llseek = noop_llseek,
859849 };
860850
drivers/hwtracing/intel_th/msu.c+2−0
@@ -1490,8 +1490,10 @@ static int intel_th_msc_release(struct inode *inode, struct file *file) · 1489 unmodified lines
14901490 {
14911491 struct msc_iter *iter = file->private_data;
14921492 struct msc *msc = iter->msc;
1493+ struct intel_th_device *thdev = msc->thdev;
14931494
14941495 msc_iter_remove(iter, msc);
1496+ put_device(&thdev->dev);
14951497
14961498 return 0;
14971499 }
drivers/infiniband/hw/bng_re/bng_dev.c+3−3
@@ -113,7 +113,7 @@ static void bng_re_fill_fw_msg(struct bnge_fw_msg *fw_msg, void *msg, · 112 unmodified lines
113113 }
114114
115115 static int bng_re_net_ring_free(struct bng_re_dev *rdev,
116− u16 fw_ring_id, int type)
116+ u32 fw_ring_id, int type)
117117 {
118118 struct bnge_auxr_dev *aux_dev = rdev->aux_dev;
119119 struct hwrm_ring_free_input req = {};
@@ -123,7 +123,7 @@ static int bng_re_net_ring_free(struct bng_re_dev *rdev, · 3 unmodified lines
123123
124124 bng_re_init_hwrm_hdr((void *)&req, HWRM_RING_FREE);
125125 req.ring_type = type;
126− req.ring_id = cpu_to_le16(fw_ring_id);
126+ req.ring_id = cpu_to_le32(fw_ring_id);
127127 bng_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
128128 sizeof(resp), BNGE_DFLT_HWRM_CMD_TIMEOUT);
129129 rc = bnge_send_msg(aux_dev, &fw_msg);
@@ -161,7 +161,7 @@ static int bng_re_net_ring_alloc(struct bng_re_dev *rdev, · 31 unmodified lines
161161 sizeof(resp), BNGE_DFLT_HWRM_CMD_TIMEOUT);
162162 rc = bnge_send_msg(aux_dev, &fw_msg);
163163 if (!rc)
164− *fw_ring_id = le16_to_cpu(resp.ring_id);
164+ *fw_ring_id = (u16)le32_to_cpu(resp.ring_id);
165165
166166 return rc;
167167 }
drivers/iommu/amd/init.c+6−0
@@ -3864,6 +3864,12 @@ not_found: · 3863 unmodified lines
38643864 return 1;
38653865
38663866 found:
3867+ if (early_acpihid_map_size == EARLY_MAP_SIZE) {
3868+ pr_err("Early ACPI HID map overflow - ignoring ivrs_acpihid%s\n",
3869+ str);
3870+ return 1;
3871+ }
3872+
38673873 p = acpiid;
38683874 hid = strsep(&p, ":");
38693875 uid = p;
drivers/iommu/amd/iommu.c+16−6
@@ -1450,11 +1450,23 @@ static int iommu_completion_wait(struct amd_iommu *iommu) · 1449 unmodified lines
14501450 int ret;
14511451 u64 data;
14521452
1453− if (!iommu->need_sync)
1454− return 0;
1455−
14561453 raw_spin_lock_irqsave(&iommu->lock, flags);
14571454
1455+ if (!iommu->need_sync) {
1456+ /*
1457+ * No command has been queued since the last completion-wait.
1458+ * A concurrent CPU may have already queued that CWAIT and
1459+ * cleared need_sync; need_sync == false only means a covering
1460+ * CWAIT is queued, not that all prior commands have completed.
1461+ * Wait for the last allocated sequence number so that any
1462+ * command queued before this call (possibly on another CPU)
1463+ * is guaranteed to have completed before returning.
1464+ */
1465+ data = iommu->cmd_sem_val;
1466+ raw_spin_unlock_irqrestore(&iommu->lock, flags);
1467+ return wait_on_sem(iommu, data);
1468+ }
1469+
14581470 data = get_cmdsem_val(iommu);
14591471 build_completion_wait(&cmd, iommu, data);
14601472
@@ -1464,9 +1476,7 @@ static int iommu_completion_wait(struct amd_iommu *iommu) · 3 unmodified lines
14641476 if (ret)
14651477 return ret;
14661478
1467− ret = wait_on_sem(iommu, data);
1468−
1469− return ret;
1479+ return wait_on_sem(iommu, data);
14701480 }
14711481
14721482 static void domain_flush_complete(struct protection_domain *domain)
drivers/iommu/amd/nested.c+19−15
@@ -59,7 +59,9 @@ static int validate_gdte_nested(struct iommu_hwpt_amd_guest *gdte) · 58 unmodified lines
5959 return 0;
6060 }
6161
62−static void *gdom_info_load_or_alloc_locked(struct xarray *xa, unsigned long index)
62+static void *gdom_info_load_or_alloc_locked(struct xarray *xa,
63+ unsigned long index,
64+ unsigned long *flags)
6365 {
6466 struct guest_domain_mapping_info *elm, *res;
6567
@@ -67,13 +69,13 @@ static void *gdom_info_load_or_alloc_locked(struct xarray *xa, unsigned long ind · 1 unmodified line
6769 if (elm)
6870 return elm;
6971
70− xa_unlock(xa);
72+ xa_unlock_irqrestore(xa, *flags);
7173 elm = kzalloc_obj(struct guest_domain_mapping_info);
72− xa_lock(xa);
74+ xa_lock_irqsave(xa, *flags);
7375 if (!elm)
7476 return ERR_PTR(-ENOMEM);
7577
76− res = __xa_cmpxchg(xa, index, NULL, elm, GFP_KERNEL);
78+ res = __xa_cmpxchg(xa, index, NULL, elm, GFP_ATOMIC);
7779 if (xa_is_err(res))
7880 res = ERR_PTR(xa_err(res));
7981
@@ -95,6 +97,7 @@ amd_iommu_alloc_domain_nested(struct iommufd_viommu *viommu, u32 flags, · 15 unmodified lines
9597 const struct iommu_user_data *user_data)
9698 {
9799 int ret;
100+ unsigned long irqflags;
98101 struct nested_domain *ndom;
99102 struct guest_domain_mapping_info *gdom_info;
100103 struct amd_iommu_viommu *aviommu = container_of(viommu, struct amd_iommu_viommu, core);
@@ -136,11 +139,12 @@ amd_iommu_alloc_domain_nested(struct iommufd_viommu *viommu, u32 flags, · 35 unmodified lines
136139 * keep track of the gDomID mapping. When the S2 is changed, the INVALIDATE_IOMMU_PAGES
137140 * command must be issued for each hDomID in the xarray.
138141 */
139− xa_lock(&aviommu->gdomid_array);
142+ xa_lock_irqsave(&aviommu->gdomid_array, irqflags);
140143
141− gdom_info = gdom_info_load_or_alloc_locked(&aviommu->gdomid_array, ndom->gdom_id);
144+ gdom_info = gdom_info_load_or_alloc_locked(&aviommu->gdomid_array,
145+ ndom->gdom_id, &irqflags);
142146 if (IS_ERR(gdom_info)) {
143− xa_unlock(&aviommu->gdomid_array);
147+ xa_unlock_irqrestore(&aviommu->gdomid_array, irqflags);
144148 ret = PTR_ERR(gdom_info);
145149 goto out_err;
146150 }
@@ -148,7 +152,7 @@ amd_iommu_alloc_domain_nested(struct iommufd_viommu *viommu, u32 flags, · 1 unmodified line
148152 /* Check if gDomID exist */
149153 if (refcount_inc_not_zero(&gdom_info->users)) {
150154 ndom->gdom_info = gdom_info;
151− xa_unlock(&aviommu->gdomid_array);
155+ xa_unlock_irqrestore(&aviommu->gdomid_array, irqflags);
152156
153157 pr_debug("%s: Found gdom_id=%#x, hdom_id=%#x\n",
154158 __func__, ndom->gdom_id, gdom_info->hdom_id);
@@ -161,7 +165,7 @@ amd_iommu_alloc_domain_nested(struct iommufd_viommu *viommu, u32 flags, · 6 unmodified lines
161165 if (gdom_info->hdom_id <= 0) {
162166 __xa_cmpxchg(&aviommu->gdomid_array,
163167 ndom->gdom_id, gdom_info, NULL, GFP_ATOMIC);
164− xa_unlock(&aviommu->gdomid_array);
168+ xa_unlock_irqrestore(&aviommu->gdomid_array, irqflags);
165169 ret = -ENOSPC;
166170 goto out_err_gdom_info;
167171 }
@@ -169,7 +173,7 @@ amd_iommu_alloc_domain_nested(struct iommufd_viommu *viommu, u32 flags, · 1 unmodified line
169173 ndom->gdom_info = gdom_info;
170174 refcount_set(&gdom_info->users, 1);
171175
172− xa_unlock(&aviommu->gdomid_array);
176+ xa_unlock_irqrestore(&aviommu->gdomid_array, irqflags);
173177
174178 pr_debug("%s: Allocate gdom_id=%#x, hdom_id=%#x\n",
175179 __func__, ndom->gdom_id, gdom_info->hdom_id);
@@ -257,14 +261,15 @@ static int nested_attach_device(struct iommu_domain *dom, struct device *dev, · 81 unmodified lines
257261
258262 static void nested_domain_free(struct iommu_domain *dom)
259263 {
264+ unsigned long irqflags;
260265 struct guest_domain_mapping_info *curr;
261− struct nested_domain *ndom = to_ndomain(dom);
266+ struct nested_domain *ndom __free(kfree) = to_ndomain(dom);
262267 struct amd_iommu_viommu *aviommu = ndom->viommu;
263268
264− xa_lock(&aviommu->gdomid_array);
269+ xa_lock_irqsave(&aviommu->gdomid_array, irqflags);
265270
266271 if (!refcount_dec_and_test(&ndom->gdom_info->users)) {
267− xa_unlock(&aviommu->gdomid_array);
272+ xa_unlock_irqrestore(&aviommu->gdomid_array, irqflags);
268273 return;
269274 }
270275
@@ -275,7 +280,7 @@ static void nested_domain_free(struct iommu_domain *dom) · 4 unmodified lines
275280 curr = __xa_cmpxchg(&aviommu->gdomid_array, ndom->gdom_id,
276281 ndom->gdom_info, NULL, GFP_ATOMIC);
277282
278− xa_unlock(&aviommu->gdomid_array);
283+ xa_unlock_irqrestore(&aviommu->gdomid_array, irqflags);
279284 if (WARN_ON(!curr || xa_err(curr)))
280285 return;
281286
@@ -285,7 +290,6 @@ static void nested_domain_free(struct iommu_domain *dom) · 3 unmodified lines
285290
286291 amd_iommu_pdom_id_free(ndom->gdom_info->hdom_id);
287292 kfree(curr);
288− kfree(ndom);
289293 }
290294
291295 static const struct iommu_domain_ops nested_domain_ops = {
drivers/iommu/intel/perf.c+1−1
@@ -63,7 +63,7 @@ void dmar_latency_disable(struct intel_iommu *iommu, enum latency_type type) · 62 unmodified lines
6363 return;
6464
6565 spin_lock_irqsave(&latency_lock, flags);
66− memset(&lstat[type], 0, sizeof(*lstat) * DMAR_LATENCY_NUM);
66+ memset(&lstat[type], 0, sizeof(*lstat));
6767 spin_unlock_irqrestore(&latency_lock, flags);
6868 }
6969
drivers/iommu/intel/svm.c+1−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727
2828 void intel_svm_check(struct intel_iommu *iommu)
2929 {
30− if (!pasid_supported(iommu))
30+ if (!pasid_supported(iommu) || !ecap_smpwc(iommu->ecap))
3131 return;
3232
3333 if (cpu_feature_enabled(X86_FEATURE_GBPAGES) &&
drivers/misc/mei/bus.c+9−7
@@ -4,6 +4,7 @@ · 3 unmodified lines
44 * Intel Management Engine Interface (Intel MEI) Linux driver
55 */
66
7+#include <linux/cleanup.h>
78 #include <linux/module.h>
89 #include <linux/device.h>
910 #include <linux/kernel.h>
@@ -1330,15 +1331,16 @@ static void mei_dev_bus_put(struct mei_device *bus) · 1320 unmodified lines
13301331 static void mei_cl_bus_dev_release(struct device *dev)
13311332 {
13321333 struct mei_cl_device *cldev = to_mei_cl_device(dev);
1333− struct mei_device *mdev = cldev->cl->dev;
1334+ struct mei_device *bus = cldev->bus;
13341335 struct mei_cl *cl;
13351336
1336− mei_cl_flush_queues(cldev->cl, NULL);
1337− mei_me_cl_put(cldev->me_cl);
1338− mei_dev_bus_put(cldev->bus);
1339−
1340− list_for_each_entry(cl, &mdev->file_list, link)
1341− WARN_ON(cl == cldev->cl);
1337+ scoped_guard(mutex, &bus->device_lock) {
1338+ mei_cl_flush_queues(cldev->cl, NULL);
1339+ mei_me_cl_put(cldev->me_cl);
1340+ list_for_each_entry(cl, &bus->file_list, link)
1341+ WARN_ON(cl == cldev->cl);
1342+ }
1343+ mei_dev_bus_put(bus);
13421344
13431345 kfree(cldev->cl);
13441346 kfree(cldev);
drivers/misc/nsm.c+2−1
@@ -367,7 +367,7 @@ static long nsm_dev_ioctl(struct file *file, unsigned int cmd, · 366 unmodified lines
367367 /* Copy user argument struct to kernel argument struct */
368368 r = -EFAULT;
369369 if (copy_from_user(&raw, argp, _IOC_SIZE(cmd)))
370− goto out;
370+ return r;
371371
372372 mutex_lock(&nsm->lock);
373373
@@ -413,6 +413,7 @@ static int nsm_device_init_vq(struct virtio_device *vdev) · 39 unmodified lines
413413 }
414414
415415 static const struct file_operations nsm_dev_fops = {
416+ .owner = THIS_MODULE,
416417 .unlocked_ioctl = nsm_dev_ioctl,
417418 .compat_ioctl = compat_ptr_ioctl,
418419 };
drivers/net/amt.c+74−27
@@ -1211,7 +1211,7 @@ static netdev_tx_t amt_dev_xmit(struct sk_buff *skb, struct net_device *dev) · 1210 unmodified lines
12111211 data = true;
12121212 }
12131213 v6 = false;
1214− group.ip4 = iph->daddr;
1214+ group.ip4 = ip_hdr(skb)->daddr;
12151215 #if IS_ENABLED(CONFIG_IPV6)
12161216 } else if (iph->version == 6) {
12171217 ip6h = ipv6_hdr(skb);
@@ -1235,7 +1235,7 @@ static netdev_tx_t amt_dev_xmit(struct sk_buff *skb, struct net_device *dev) · 17 unmodified lines
12351235 data = true;
12361236 }
12371237 v6 = true;
1238− group.ip6 = ip6h->daddr;
1238+ group.ip6 = ipv6_hdr(skb)->daddr;
12391239 #endif
12401240 } else {
12411241 dev->stats.tx_errors++;
@@ -1278,12 +1278,12 @@ static netdev_tx_t amt_dev_xmit(struct sk_buff *skb, struct net_device *dev) · 36 unmodified lines
12781278 hlist_for_each_entry_rcu(gnode, &tunnel->groups[hash],
12791279 node) {
12801280 if (!v6) {
1281− if (gnode->group_addr.ip4 == iph->daddr)
1281+ if (gnode->group_addr.ip4 == group.ip4)
12821282 goto found;
12831283 #if IS_ENABLED(CONFIG_IPV6)
12841284 } else {
12851285 if (ipv6_addr_equal(&gnode->group_addr.ip6,
1286− &ip6h->daddr))
1286+ &group.ip6))
12871287 goto found;
12881288 #endif
12891289 }
@@ -2000,14 +2000,18 @@ static void amt_igmpv3_report_handler(struct amt_dev *amt, struct sk_buff *skb, · 710 unmodified lines
20002000 struct igmpv3_report *ihrv3 = igmpv3_report_hdr(skb);
20012001 int len = skb_transport_offset(skb) + sizeof(*ihrv3);
20022002 void *zero_grec = (void *)&igmpv3_zero_grec;
2003− struct iphdr *iph = ip_hdr(skb);
20042003 struct amt_group_node *gnode;
20052004 union amt_addr group, host;
20062005 struct igmpv3_grec *grec;
2006+ __be32 saddr;
20072007 u16 nsrcs;
2008+ u16 ngrec;
20082009 int i;
20092010
2010− for (i = 0; i < ntohs(ihrv3->ngrec); i++) {
2011+ saddr = ip_hdr(skb)->saddr;
2012+ ngrec = ntohs(ihrv3->ngrec);
2013+
2014+ for (i = 0; i < ngrec; i++) {
20112015 len += sizeof(*grec);
20122016 if (!ip_mc_may_pull(skb, len))
20132017 break;
@@ -2019,10 +2023,13 @@ static void amt_igmpv3_report_handler(struct amt_dev *amt, struct sk_buff *skb, · 5 unmodified lines
20192023 if (!ip_mc_may_pull(skb, len))
20202024 break;
20212025
2026+ grec = (void *)(skb->data + len - sizeof(*grec) -
2027+ nsrcs * sizeof(__be32));
2028+
20222029 memset(&group, 0, sizeof(union amt_addr));
20232030 group.ip4 = grec->grec_mca;
20242031 memset(&host, 0, sizeof(union amt_addr));
2025− host.ip4 = iph->saddr;
2032+ host.ip4 = saddr;
20262033 gnode = amt_lookup_group(tunnel, &group, &host, false);
20272034 if (!gnode) {
20282035 gnode = amt_add_group(amt, tunnel, &group, &host,
@@ -2162,14 +2169,18 @@ static void amt_mldv2_report_handler(struct amt_dev *amt, struct sk_buff *skb, · 133 unmodified lines
21622169 struct mld2_report *mld2r = (struct mld2_report *)icmp6_hdr(skb);
21632170 int len = skb_transport_offset(skb) + sizeof(*mld2r);
21642171 void *zero_grec = (void *)&mldv2_zero_grec;
2165− struct ipv6hdr *ip6h = ipv6_hdr(skb);
21662172 struct amt_group_node *gnode;
21672173 union amt_addr group, host;
21682174 struct mld2_grec *grec;
2175+ struct in6_addr saddr;
21692176 u16 nsrcs;
2177+ u16 ngrec;
21702178 int i;
21712179
2172− for (i = 0; i < ntohs(mld2r->mld2r_ngrec); i++) {
2180+ saddr = ipv6_hdr(skb)->saddr;
2181+ ngrec = ntohs(mld2r->mld2r_ngrec);
2182+
2183+ for (i = 0; i < ngrec; i++) {
21732184 len += sizeof(*grec);
21742185 if (!ipv6_mc_may_pull(skb, len))
21752186 break;
@@ -2181,10 +2192,13 @@ static void amt_mldv2_report_handler(struct amt_dev *amt, struct sk_buff *skb, · 5 unmodified lines
21812192 if (!ipv6_mc_may_pull(skb, len))
21822193 break;
21832194
2195+ grec = (void *)(skb->data + len - sizeof(*grec) -
2196+ nsrcs * sizeof(struct in6_addr));
2197+
21842198 memset(&group, 0, sizeof(union amt_addr));
21852199 group.ip6 = grec->grec_mca;
21862200 memset(&host, 0, sizeof(union amt_addr));
2187− host.ip6 = ip6h->saddr;
2201+ host.ip6 = saddr;
21882202 gnode = amt_lookup_group(tunnel, &group, &host, true);
21892203 if (!gnode) {
21902204 gnode = amt_add_group(amt, tunnel, &group, &host,
@@ -2305,7 +2319,9 @@ static bool amt_multicast_data_handler(struct amt_dev *amt, struct sk_buff *skb) · 114 unmodified lines
23052319 skb_push(skb, sizeof(*eth));
23062320 skb_reset_mac_header(skb);
23072321 skb_pull(skb, sizeof(*eth));
2308− eth = eth_hdr(skb);
2322+
2323+ if (skb_cow_head(skb, 0))
2324+ return true;
23092325
23102326 if (!pskb_may_pull(skb, sizeof(*iph)))
23112327 return true;
@@ -2315,6 +2331,7 @@ static bool amt_multicast_data_handler(struct amt_dev *amt, struct sk_buff *skb) · 3 unmodified lines
23152331 if (!ipv4_is_multicast(iph->daddr))
23162332 return true;
23172333 skb->protocol = htons(ETH_P_IP);
2334+ eth = eth_hdr(skb);
23182335 eth->h_proto = htons(ETH_P_IP);
23192336 ip_eth_mc_map(iph->daddr, eth->h_dest);
23202337 #if IS_ENABLED(CONFIG_IPV6)
@@ -2328,6 +2345,7 @@ static bool amt_multicast_data_handler(struct amt_dev *amt, struct sk_buff *skb) · 7 unmodified lines
23282345 if (!ipv6_addr_is_multicast(&ip6h->daddr))
23292346 return true;
23302347 skb->protocol = htons(ETH_P_IPV6);
2348+ eth = eth_hdr(skb);
23312349 eth->h_proto = htons(ETH_P_IPV6);
23322350 ipv6_eth_mc_map(&ip6h->daddr, eth->h_dest);
23332351 #endif
@@ -2351,10 +2369,12 @@ static bool amt_membership_query_handler(struct amt_dev *amt, · 17 unmodified lines
23512369 struct sk_buff *skb)
23522370 {
23532371 struct amt_header_membership_query *amtmq;
2354− struct igmpv3_query *ihv3;
23552372 struct ethhdr *eth, *oeth;
2373+ struct igmpv3_query *ihv3;
2374+ u8 h_source[ETH_ALEN];
23562375 struct iphdr *iph;
23572376 int hdr_size, len;
2377+ u64 response_mac;
23582378
23592379 hdr_size = sizeof(*amtmq) + sizeof(struct udphdr);
23602380 if (!pskb_may_pull(skb, hdr_size))
@@ -2367,6 +2387,8 @@ static bool amt_membership_query_handler(struct amt_dev *amt, · 6 unmodified lines
23672387 if (amtmq->nonce != amt->nonce)
23682388 return true;
23692389
2390+ response_mac = amtmq->response_mac;
2391+
23702392 hdr_size -= sizeof(*eth);
23712393 if (iptunnel_pull_header(skb, hdr_size, htons(ETH_P_TEB), false))
23722394 return true;
@@ -2376,6 +2398,9 @@ static bool amt_membership_query_handler(struct amt_dev *amt, · 3 unmodified lines
23762398 skb_pull(skb, sizeof(*eth));
23772399 skb_reset_network_header(skb);
23782400 eth = eth_hdr(skb);
2401+ ether_addr_copy(h_source, oeth->h_source);
2402+ if (skb_cow_head(skb, 0))
2403+ return true;
23792404 if (!pskb_may_pull(skb, sizeof(*iph)))
23802405 return true;
23812406
@@ -2388,6 +2413,7 @@ static bool amt_membership_query_handler(struct amt_dev *amt, · 6 unmodified lines
23882413 sizeof(*ihv3)))
23892414 return true;
23902415
2416+ iph = ip_hdr(skb);
23912417 if (!ipv4_is_multicast(iph->daddr))
23922418 return true;
23932419
@@ -2395,10 +2421,11 @@ static bool amt_membership_query_handler(struct amt_dev *amt, · 1 unmodified line
23952421 skb_reset_transport_header(skb);
23962422 skb_push(skb, sizeof(*iph) + AMT_IPHDR_OPTS);
23972423 WRITE_ONCE(amt->ready4, true);
2398− amt->mac = amtmq->response_mac;
2424+ amt->mac = response_mac;
23992425 amt->req_cnt = 0;
24002426 amt->qi = ihv3->qqic;
24012427 skb->protocol = htons(ETH_P_IP);
2428+ eth = eth_hdr(skb);
24022429 eth->h_proto = htons(ETH_P_IP);
24032430 ip_eth_mc_map(iph->daddr, eth->h_dest);
24042431 #if IS_ENABLED(CONFIG_IPV6)
@@ -2421,10 +2448,11 @@ static bool amt_membership_query_handler(struct amt_dev *amt, · 16 unmodified lines
24212448 skb_reset_transport_header(skb);
24222449 skb_push(skb, sizeof(*ip6h) + AMT_IP6HDR_OPTS);
24232450 WRITE_ONCE(amt->ready6, true);
2424− amt->mac = amtmq->response_mac;
2451+ amt->mac = response_mac;
24252452 amt->req_cnt = 0;
24262453 amt->qi = mld2q->mld2q_qqic;
24272454 skb->protocol = htons(ETH_P_IPV6);
2455+ eth = eth_hdr(skb);
24282456 eth->h_proto = htons(ETH_P_IPV6);
24292457 ipv6_eth_mc_map(&ip6h->daddr, eth->h_dest);
24302458 #endif
@@ -2432,7 +2460,7 @@ static bool amt_membership_query_handler(struct amt_dev *amt, · 1 unmodified line
24322460 return true;
24332461 }
24342462
2435− ether_addr_copy(eth->h_source, oeth->h_source);
2463+ ether_addr_copy(eth->h_source, h_source);
24362464 skb->pkt_type = PACKET_MULTICAST;
24372465 skb->ip_summed = CHECKSUM_NONE;
24382466 len = skb->len;
@@ -2455,8 +2483,11 @@ static bool amt_update_handler(struct amt_dev *amt, struct sk_buff *skb) · 16 unmodified lines
24552483 struct ethhdr *eth;
24562484 struct iphdr *iph;
24572485 int len, hdr_size;
2486+ u64 response_mac;
2487+ __be32 saddr;
2488+ __be32 nonce;
24582489
2459− iph = ip_hdr(skb);
2490+ saddr = ip_hdr(skb)->saddr;
24602491
24612492 hdr_size = sizeof(*amtmu) + sizeof(struct udphdr);
24622493 if (!pskb_may_pull(skb, hdr_size))
@@ -2466,15 +2497,18 @@ static bool amt_update_handler(struct amt_dev *amt, struct sk_buff *skb) · 3 unmodified lines
24662497 if (amtmu->reserved || amtmu->version)
24672498 return true;
24682499
2500+ nonce = amtmu->nonce;
2501+ response_mac = amtmu->response_mac;
2502+
24692503 if (iptunnel_pull_header(skb, hdr_size, skb->protocol, false))
24702504 return true;
24712505
24722506 skb_reset_network_header(skb);
24732507
24742508 list_for_each_entry_rcu(tunnel, &amt->tunnel_list, list) {
2475− if (tunnel->ip4 == iph->saddr) {
2476− if ((amtmu->nonce == tunnel->nonce &&
2477− amtmu->response_mac == tunnel->mac)) {
2509+ if (tunnel->ip4 == saddr) {
2510+ if ((nonce == tunnel->nonce &&
2511+ response_mac == tunnel->mac)) {
24782512 mod_delayed_work(amt_wq, &tunnel->gc_wq,
24792513 msecs_to_jiffies(amt_gmi(amt))
24802514 * 3);
@@ -2492,6 +2526,9 @@ report: · 11 unmodified lines
24922526 if (!pskb_may_pull(skb, sizeof(*iph)))
24932527 return true;
24942528
2529+ if (skb_cow_head(skb, 0))
2530+ return true;
2531+
24952532 iph = ip_hdr(skb);
24962533 if (iph->version == 4) {
24972534 if (ip_mc_check_igmp(skb)) {
@@ -2508,6 +2545,7 @@ report: · 10 unmodified lines
25082545 eth = eth_hdr(skb);
25092546 skb->protocol = htons(ETH_P_IP);
25102547 eth->h_proto = htons(ETH_P_IP);
2548+ iph = ip_hdr(skb);
25112549 ip_eth_mc_map(iph->daddr, eth->h_dest);
25122550 #if IS_ENABLED(CONFIG_IPV6)
25132551 } else if (iph->version == 6) {
@@ -2527,6 +2565,7 @@ report: · 13 unmodified lines
25272565 eth = eth_hdr(skb);
25282566 skb->protocol = htons(ETH_P_IPV6);
25292567 eth->h_proto = htons(ETH_P_IPV6);
2568+ ip6h = ipv6_hdr(skb);
25302569 ipv6_eth_mc_map(&ip6h->daddr, eth->h_dest);
25312570 #endif
25322571 } else {
@@ -2772,7 +2811,7 @@ drop: · 239 unmodified lines
27722811 static int amt_rcv(struct sock *sk, struct sk_buff *skb)
27732812 {
27742813 struct amt_dev *amt;
2775− struct iphdr *iph;
2814+ __be32 saddr;
27762815 int type;
27772816 bool err;
27782817
@@ -2785,7 +2824,7 @@ static int amt_rcv(struct sock *sk, struct sk_buff *skb) · 6 unmodified lines
27852824 }
27862825
27872826 skb->dev = amt->dev;
2788− iph = ip_hdr(skb);
2827+ saddr = ip_hdr(skb)->saddr;
27892828 type = amt_parse_type(skb);
27902829 if (type == -1) {
27912830 err = true;
@@ -2795,7 +2834,7 @@ static int amt_rcv(struct sock *sk, struct sk_buff *skb) · 3 unmodified lines
27952834 if (amt->mode == AMT_MODE_GATEWAY) {
27962835 switch (type) {
27972836 case AMT_MSG_ADVERTISEMENT:
2798− if (iph->saddr != amt->discovery_ip) {
2837+ if (saddr != amt->discovery_ip) {
27992838 netdev_dbg(amt->dev, "Invalid Relay IP\n");
28002839 err = true;
28012840 goto drop;
@@ -2807,7 +2846,7 @@ static int amt_rcv(struct sock *sk, struct sk_buff *skb) · 5 unmodified lines
28072846 }
28082847 goto out;
28092848 case AMT_MSG_MULTICAST_DATA:
2810− if (iph->saddr != amt->remote_ip) {
2849+ if (saddr != amt->remote_ip) {
28112850 netdev_dbg(amt->dev, "Invalid Relay IP\n");
28122851 err = true;
28132852 goto drop;
@@ -2818,7 +2857,7 @@ static int amt_rcv(struct sock *sk, struct sk_buff *skb) · 4 unmodified lines
28182857 else
28192858 goto out;
28202859 case AMT_MSG_MEMBERSHIP_QUERY:
2821− if (iph->saddr != amt->remote_ip) {
2860+ if (saddr != amt->remote_ip) {
28222861 netdev_dbg(amt->dev, "Invalid Relay IP\n");
28232862 err = true;
28242863 goto drop;
@@ -2995,9 +3034,15 @@ static int amt_dev_open(struct net_device *dev) · 170 unmodified lines
29953034 amt->event_idx = 0;
29963035 amt->nr_events = 0;
29973036
3037+ enable_delayed_work(&amt->discovery_wq);
3038+ enable_delayed_work(&amt->req_wq);
3039+
29983040 err = amt_socket_create(amt);
2999− if (err)
3041+ if (err) {
3042+ disable_delayed_work(&amt->req_wq);
3043+ disable_delayed_work(&amt->discovery_wq);
30003044 return err;
3045+ }
30013046
30023047 amt->req_cnt = 0;
30033048 amt->remote_ip = 0;
@@ -3023,8 +3068,8 @@ static int amt_dev_stop(struct net_device *dev) · 19 unmodified lines
30233068 struct sock *sk;
30243069 int i;
30253070
3026− cancel_delayed_work_sync(&amt->req_wq);
3027− cancel_delayed_work_sync(&amt->discovery_wq);
3071+ disable_delayed_work_sync(&amt->req_wq);
3072+ disable_delayed_work_sync(&amt->discovery_wq);
30283073 cancel_delayed_work_sync(&amt->secret_wq);
30293074
30303075 /* shutdown */
@@ -3278,6 +3323,8 @@ static int amt_newlink(struct net_device *dev, · 247 unmodified lines
32783323 INIT_DELAYED_WORK(&amt->req_wq, amt_req_work);
32793324 INIT_DELAYED_WORK(&amt->secret_wq, amt_secret_work);
32803325 INIT_WORK(&amt->event_wq, amt_event_work);
3326+ disable_delayed_work(&amt->req_wq);
3327+ disable_delayed_work(&amt->discovery_wq);
32813328 INIT_LIST_HEAD(&amt->tunnel_list);
32823329 return 0;
32833330 err:
drivers/net/bonding/bond_main.c+2−1
@@ -3455,7 +3455,8 @@ static void bond_send_validate(struct bonding *bond, struct slave *slave) · 3454 unmodified lines
34553455 {
34563456 bond_arp_send_all(bond, slave);
34573457 #if IS_ENABLED(CONFIG_IPV6)
3458− bond_ns_send_all(bond, slave);
3458+ if (likely(ipv6_mod_enabled()))
3459+ bond_ns_send_all(bond, slave);
34593460 #endif
34603461 }
34613462
drivers/net/ethernet/airoha/airoha_eth.c+106−68
@@ -1686,11 +1686,14 @@ static void airoha_qdma_stop_napi(struct airoha_qdma *qdma) · 1685 unmodified lines
16861686 }
16871687 }
16881688
1689−static void airoha_dev_get_hw_stats(struct airoha_gdm_dev *dev)
1689+static void airoha_update_hw_stats(struct airoha_gdm_dev *dev)
16901690 {
16911691 struct airoha_gdm_port *port = dev->port;
16921692 struct airoha_eth *eth = dev->eth;
16931693 u32 val, i = 0;
1694+ u64 data;
1695+
1696+ spin_lock(&port->stats_lock);
16941697
16951698 /* Read relevant MIB for GDM with multiple port attached */
16961699 if (port->id == AIROHA_GDM3_IDX || port->id == AIROHA_GDM4_IDX)
@@ -1701,152 +1704,188 @@ static void airoha_dev_get_hw_stats(struct airoha_gdm_dev *dev) · 4 unmodified lines
17011704
17021705 u64_stats_update_begin(&dev->stats.syncp);
17031706
1704− /* TX */
1707+ /* TX - 64-bit H+L registers: hw accumulates the total, read directly.
1708+ * Use local variable to prevent readers from seeing intermediate values.
1709+ * Clamp to prevent regression from torn reads between H and L.
1710+ */
17051711 val = airoha_fe_rr(eth, REG_FE_GDM_TX_OK_PKT_CNT_H(port->id));
1706− dev->stats.tx_ok_pkts += ((u64)val << 32);
1712+ data = (u64)val << 32;
17071713 val = airoha_fe_rr(eth, REG_FE_GDM_TX_OK_PKT_CNT_L(port->id));
1708− dev->stats.tx_ok_pkts += val;
1714+ data += val;
1715+ dev->stats.tx_ok_pkts = max(data, dev->stats.tx_ok_pkts);
17091716
17101717 val = airoha_fe_rr(eth, REG_FE_GDM_TX_OK_BYTE_CNT_H(port->id));
1711− dev->stats.tx_ok_bytes += ((u64)val << 32);
1718+ data = (u64)val << 32;
17121719 val = airoha_fe_rr(eth, REG_FE_GDM_TX_OK_BYTE_CNT_L(port->id));
1713− dev->stats.tx_ok_bytes += val;
1720+ data += val;
1721+ dev->stats.tx_ok_bytes = max(data, dev->stats.tx_ok_bytes);
17141722
1723+ /* TX - 32-bit registers: accumulate delta to handle wrap-around. */
17151724 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_DROP_CNT(port->id));
1716− dev->stats.tx_drops += val;
1725+ dev->stats.tx_drops += (u32)(val - dev->stats.mib_prev.tx_drops);
1726+ dev->stats.mib_prev.tx_drops = val;
17171727
17181728 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_BC_CNT(port->id));
1719− dev->stats.tx_broadcast += val;
1729+ dev->stats.tx_broadcast += (u32)(val - dev->stats.mib_prev.tx_broadcast);
1730+ dev->stats.mib_prev.tx_broadcast = val;
17201731
17211732 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_MC_CNT(port->id));
1722− dev->stats.tx_multicast += val;
1733+ dev->stats.tx_multicast += (u32)(val - dev->stats.mib_prev.tx_multicast);
1734+ dev->stats.mib_prev.tx_multicast = val;
17231735
17241736 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_RUNT_CNT(port->id));
1725− dev->stats.tx_len[i] += val;
1737+ dev->stats.mib_prev.tx_runt64 +=
1738+ (u32)(val - dev->stats.mib_prev.tx_runt);
1739+ dev->stats.mib_prev.tx_runt = val;
17261740
1741+ /* tx_len[0]: RUNT (32-bit, delta) + E64 (64-bit, absolute). */
1742+ data = dev->stats.mib_prev.tx_runt64;
17271743 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_E64_CNT_H(port->id));
1728− dev->stats.tx_len[i] += ((u64)val << 32);
1744+ data += (u64)val << 32;
17291745 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_E64_CNT_L(port->id));
1730− dev->stats.tx_len[i++] += val;
1746+ data += val;
1747+ dev->stats.tx_len[i] = max(data, dev->stats.tx_len[i]);
1748+ i++;
17311749
17321750 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L64_CNT_H(port->id));
1733− dev->stats.tx_len[i] += ((u64)val << 32);
1751+ data = (u64)val << 32;
17341752 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L64_CNT_L(port->id));
1735− dev->stats.tx_len[i++] += val;
1753+ data += val;
1754+ dev->stats.tx_len[i] = max(data, dev->stats.tx_len[i]);
1755+ i++;
17361756
17371757 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L127_CNT_H(port->id));
1738− dev->stats.tx_len[i] += ((u64)val << 32);
1758+ data = (u64)val << 32;
17391759 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L127_CNT_L(port->id));
1740− dev->stats.tx_len[i++] += val;
1760+ data += val;
1761+ dev->stats.tx_len[i] = max(data, dev->stats.tx_len[i]);
1762+ i++;
17411763
17421764 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L255_CNT_H(port->id));
1743− dev->stats.tx_len[i] += ((u64)val << 32);
1765+ data = (u64)val << 32;
17441766 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L255_CNT_L(port->id));
1745− dev->stats.tx_len[i++] += val;
1767+ data += val;
1768+ dev->stats.tx_len[i] = max(data, dev->stats.tx_len[i]);
1769+ i++;
17461770
17471771 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L511_CNT_H(port->id));
1748− dev->stats.tx_len[i] += ((u64)val << 32);
1772+ data = (u64)val << 32;
17491773 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L511_CNT_L(port->id));
1750− dev->stats.tx_len[i++] += val;
1774+ data += val;
1775+ dev->stats.tx_len[i] = max(data, dev->stats.tx_len[i]);
1776+ i++;
17511777
17521778 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L1023_CNT_H(port->id));
1753− dev->stats.tx_len[i] += ((u64)val << 32);
1779+ data = (u64)val << 32;
17541780 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_L1023_CNT_L(port->id));
1755− dev->stats.tx_len[i++] += val;
1781+ data += val;
1782+ dev->stats.tx_len[i] = max(data, dev->stats.tx_len[i]);
1783+ i++;
17561784
17571785 val = airoha_fe_rr(eth, REG_FE_GDM_TX_ETH_LONG_CNT(port->id));
1758− dev->stats.tx_len[i++] += val;
1786+ dev->stats.tx_len[i++] += (u32)(val - dev->stats.mib_prev.tx_long);
1787+ dev->stats.mib_prev.tx_long = val;
17591788
17601789 /* RX */
17611790 val = airoha_fe_rr(eth, REG_FE_GDM_RX_OK_PKT_CNT_H(port->id));
1762− dev->stats.rx_ok_pkts += ((u64)val << 32);
1791+ data = (u64)val << 32;
17631792 val = airoha_fe_rr(eth, REG_FE_GDM_RX_OK_PKT_CNT_L(port->id));
1764− dev->stats.rx_ok_pkts += val;
1793+ data += val;
1794+ dev->stats.rx_ok_pkts = max(data, dev->stats.rx_ok_pkts);
17651795
17661796 val = airoha_fe_rr(eth, REG_FE_GDM_RX_OK_BYTE_CNT_H(port->id));
1767− dev->stats.rx_ok_bytes += ((u64)val << 32);
1797+ data = (u64)val << 32;
17681798 val = airoha_fe_rr(eth, REG_FE_GDM_RX_OK_BYTE_CNT_L(port->id));
1769− dev->stats.rx_ok_bytes += val;
1799+ data += val;
1800+ dev->stats.rx_ok_bytes = max(data, dev->stats.rx_ok_bytes);
17701801
17711802 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_DROP_CNT(port->id));
1772− dev->stats.rx_drops += val;
1803+ dev->stats.rx_drops += (u32)(val - dev->stats.mib_prev.rx_drops);
1804+ dev->stats.mib_prev.rx_drops = val;
17731805
17741806 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_BC_CNT(port->id));
1775− dev->stats.rx_broadcast += val;
1807+ dev->stats.rx_broadcast += (u32)(val - dev->stats.mib_prev.rx_broadcast);
1808+ dev->stats.mib_prev.rx_broadcast = val;
17761809
17771810 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_MC_CNT(port->id));
1778− dev->stats.rx_multicast += val;
1811+ dev->stats.rx_multicast += (u32)(val - dev->stats.mib_prev.rx_multicast);
1812+ dev->stats.mib_prev.rx_multicast = val;
17791813
17801814 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ERROR_DROP_CNT(port->id));
1781− dev->stats.rx_errors += val;
1815+ dev->stats.rx_errors += (u32)(val - dev->stats.mib_prev.rx_errors);
1816+ dev->stats.mib_prev.rx_errors = val;
17821817
17831818 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_CRC_ERR_CNT(port->id));
1784− dev->stats.rx_crc_error += val;
1819+ dev->stats.rx_crc_error += (u32)(val - dev->stats.mib_prev.rx_crc_error);
1820+ dev->stats.mib_prev.rx_crc_error = val;
17851821
17861822 val = airoha_fe_rr(eth, REG_FE_GDM_RX_OVERFLOW_DROP_CNT(port->id));
1787− dev->stats.rx_over_errors += val;
1823+ dev->stats.rx_over_errors += (u32)(val - dev->stats.mib_prev.rx_over_errors);
1824+ dev->stats.mib_prev.rx_over_errors = val;
17881825
17891826 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_FRAG_CNT(port->id));
1790− dev->stats.rx_fragment += val;
1827+ dev->stats.rx_fragment += (u32)(val - dev->stats.mib_prev.rx_fragment);
1828+ dev->stats.mib_prev.rx_fragment = val;
17911829
17921830 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_JABBER_CNT(port->id));
1793− dev->stats.rx_jabber += val;
1831+ dev->stats.rx_jabber += (u32)(val - dev->stats.mib_prev.rx_jabber);
1832+ dev->stats.mib_prev.rx_jabber = val;
17941833
17951834 i = 0;
17961835 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_RUNT_CNT(port->id));
1797− dev->stats.rx_len[i] += val;
1836+ dev->stats.mib_prev.rx_runt64 +=
1837+ (u32)(val - dev->stats.mib_prev.rx_runt);
1838+ dev->stats.mib_prev.rx_runt = val;
17981839
1840+ /* rx_len[0]: RUNT (32-bit, delta) + E64 (64-bit, absolute). */
1841+ data = dev->stats.mib_prev.rx_runt64;
17991842 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_E64_CNT_H(port->id));
1800− dev->stats.rx_len[i] += ((u64)val << 32);
1843+ data += (u64)val << 32;
18011844 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_E64_CNT_L(port->id));
1802− dev->stats.rx_len[i++] += val;
1845+ data += val;
1846+ dev->stats.rx_len[i] = max(data, dev->stats.rx_len[i]);
1847+ i++;
18031848
18041849 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L64_CNT_H(port->id));
1805− dev->stats.rx_len[i] += ((u64)val << 32);
1850+ data = (u64)val << 32;
18061851 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L64_CNT_L(port->id));
1807− dev->stats.rx_len[i++] += val;
1852+ data += val;
1853+ dev->stats.rx_len[i] = max(data, dev->stats.rx_len[i]);
1854+ i++;
18081855
18091856 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L127_CNT_H(port->id));
1810− dev->stats.rx_len[i] += ((u64)val << 32);
1857+ data = (u64)val << 32;
18111858 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L127_CNT_L(port->id));
1812− dev->stats.rx_len[i++] += val;
1859+ data += val;
1860+ dev->stats.rx_len[i] = max(data, dev->stats.rx_len[i]);
1861+ i++;
18131862
18141863 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L255_CNT_H(port->id));
1815− dev->stats.rx_len[i] += ((u64)val << 32);
1864+ data = (u64)val << 32;
18161865 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L255_CNT_L(port->id));
1817− dev->stats.rx_len[i++] += val;
1866+ data += val;
1867+ dev->stats.rx_len[i] = max(data, dev->stats.rx_len[i]);
1868+ i++;
18181869
18191870 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L511_CNT_H(port->id));
1820− dev->stats.rx_len[i] += ((u64)val << 32);
1871+ data = (u64)val << 32;
18211872 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L511_CNT_L(port->id));
1822− dev->stats.rx_len[i++] += val;
1873+ data += val;
1874+ dev->stats.rx_len[i] = max(data, dev->stats.rx_len[i]);
1875+ i++;
18231876
18241877 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L1023_CNT_H(port->id));
1825− dev->stats.rx_len[i] += ((u64)val << 32);
1878+ data = (u64)val << 32;
18261879 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_L1023_CNT_L(port->id));
1827− dev->stats.rx_len[i++] += val;
1880+ data += val;
1881+ dev->stats.rx_len[i] = max(data, dev->stats.rx_len[i]);
1882+ i++;
18281883
18291884 val = airoha_fe_rr(eth, REG_FE_GDM_RX_ETH_LONG_CNT(port->id));
1830− dev->stats.rx_len[i++] += val;
1885+ dev->stats.rx_len[i] += (u32)(val - dev->stats.mib_prev.rx_long);
1886+ dev->stats.mib_prev.rx_long = val;
18311887
18321888 u64_stats_update_end(&dev->stats.syncp);
1833−}
1834−
1835−static void airoha_update_hw_stats(struct airoha_gdm_dev *dev)
1836−{
1837− struct airoha_gdm_port *port = dev->port;
1838− int i;
1839−
1840− spin_lock(&port->stats_lock);
1841−
1842− for (i = 0; i < ARRAY_SIZE(port->devs); i++) {
1843− if (port->devs[i])
1844− airoha_dev_get_hw_stats(port->devs[i]);
1845− }
1846−
1847− /* Reset MIB counters */
1848− airoha_fe_set(dev->eth, REG_FE_GDM_MIB_CLEAR(port->id),
1849− FE_GDM_MIB_RX_CLEAR_MASK | FE_GDM_MIB_TX_CLEAR_MASK);
18501889
18511890 spin_unlock(&port->stats_lock);
18521891 }
@@ -2504,8 +2543,7 @@ static int airoha_tc_setup_qdisc_ets(struct net_device *dev, · 651 unmodified lines
25042543 if (opt->parent == TC_H_ROOT)
25052544 return -EINVAL;
25062545
2507− channel = TC_H_MAJ(opt->handle) >> 16;
2508− channel = channel % AIROHA_NUM_QOS_CHANNELS;
2546+ channel = TC_H_MIN(opt->parent) % AIROHA_NUM_QOS_CHANNELS;
25092547
25102548 switch (opt->command) {
25112549 case TC_ETS_REPLACE:
drivers/net/ethernet/airoha/airoha_eth.h+27−0
@@ -245,6 +245,33 @@ struct airoha_hw_stats { · 244 unmodified lines
245245 u64 rx_fragment;
246246 u64 rx_jabber;
247247 u64 rx_len[7];
248+
249+ struct {
250+ /* Previous HW register values for 32-bit counter delta
251+ * tracking. Storing the last seen value and accumulating
252+ * (u32)(curr - prev) into the 64-bit software counter
253+ * handles wrap-around transparently via unsigned arithmetic.
254+ * tx_runt64/rx_runt64 hold the running sum of runt deltas.
255+ * These fields are never reported to userspace.
256+ */
257+ u32 tx_drops;
258+ u32 tx_broadcast;
259+ u32 tx_multicast;
260+ u32 tx_runt;
261+ u32 tx_long;
262+ u64 tx_runt64;
263+ u32 rx_drops;
264+ u32 rx_broadcast;
265+ u32 rx_multicast;
266+ u32 rx_errors;
267+ u32 rx_crc_error;
268+ u32 rx_over_errors;
269+ u32 rx_fragment;
270+ u32 rx_jabber;
271+ u32 rx_runt;
272+ u32 rx_long;
273+ u64 rx_runt64;
274+ } mib_prev;
248275 };
249276
250277 enum {
drivers/net/ethernet/airoha/airoha_npu.c+2−2
@@ -168,7 +168,7 @@ static int airoha_npu_send_msg(struct airoha_npu *npu, int func_id, · 167 unmodified lines
168168 dma_addr_t dma_addr;
169169 int ret;
170170
171− dma_addr = dma_map_single(npu->dev, p, size, DMA_TO_DEVICE);
171+ dma_addr = dma_map_single(npu->dev, p, size, DMA_BIDIRECTIONAL);
172172 ret = dma_mapping_error(npu->dev, dma_addr);
173173 if (ret)
174174 return ret;
@@ -191,7 +191,7 @@ static int airoha_npu_send_msg(struct airoha_npu *npu, int func_id, · 16 unmodified lines
191191
192192 spin_unlock_bh(&npu->cores[core].lock);
193193
194− dma_unmap_single(npu->dev, dma_addr, size, DMA_TO_DEVICE);
194+ dma_unmap_single(npu->dev, dma_addr, size, DMA_BIDIRECTIONAL);
195195
196196 return ret;
197197 }
drivers/net/ethernet/airoha/airoha_ppe.c+1−0
@@ -1659,6 +1659,7 @@ void airoha_ppe_deinit(struct airoha_eth *eth) · 1658 unmodified lines
16591659 npu = rcu_replace_pointer(eth->npu, NULL,
16601660 lockdep_is_held(&flow_offload_mutex));
16611661 if (npu) {
1662+ synchronize_rcu();
16621663 npu->ops.ppe_deinit(npu);
16631664 airoha_npu_put(npu);
16641665 }
drivers/net/ethernet/amd/pds_core/adminq.c+11−1
@@ -18,7 +18,13 @@ static int pdsc_process_notifyq(struct pdsc_qcq *qcq) · 17 unmodified lines
1818 comp = cq_info->comp;
1919 eid = le64_to_cpu(comp->event.eid);
2020 while (eid > pdsc->last_eid) {
21− u16 ecode = le16_to_cpu(comp->event.ecode);
21+ u16 ecode;
22+
23+ /* Order the payload read after the event id, the field the
24+ * driver uses to detect a new completion.
25+ */
26+ dma_rmb();
27+ ecode = le16_to_cpu(comp->event.ecode);
2228
2329 switch (ecode) {
2430 case PDS_EVENT_LINK_CHANGE:
@@ -101,6 +107,10 @@ void pdsc_process_adminq(struct pdsc_qcq *qcq) · 76 unmodified lines
101107 spin_lock_irqsave(&pdsc->adminq_lock, irqflags);
102108 comp = cq->info[cq->tail_idx].comp;
103109 while (pdsc_color_match(comp->color, cq->done_color)) {
110+ /* Order the payload reads after the color bit, the field the
111+ * driver uses to detect a new completion.
112+ */
113+ dma_rmb();
104114 q_info = &q->info[q->tail_idx];
105115 q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1);
106116
drivers/net/ethernet/amd/pds_core/auxbus.c+14−3
@@ -177,17 +177,21 @@ void pdsc_auxbus_dev_del(struct pdsc *cf, struct pdsc *pf, · 176 unmodified lines
177177 {
178178 struct pds_auxiliary_dev *padev;
179179
180− if (!*pd_ptr)
181− return;
182−
183180 mutex_lock(&pf->config_lock);
184181
182+ /* A concurrent del may have already torn this device down and
183+ * cleared it.
184+ */
185185 padev = *pd_ptr;
186+ if (!padev)
187+ goto out_unlock;
188+
186189 pds_client_unregister(pf, padev->client_id);
187190 auxiliary_device_delete(&padev->aux_dev);
188191 auxiliary_device_uninit(&padev->aux_dev);
189192 *pd_ptr = NULL;
190193
194+out_unlock:
191195 mutex_unlock(&pf->config_lock);
192196 }
193197
@@ -210,6 +214,13 @@ int pdsc_auxbus_dev_add(struct pdsc *cf, struct pdsc *pf, · 16 unmodified lines
210214
211215 mutex_lock(&pf->config_lock);
212216
217+ /* Nothing to do if the aux device is already present. This also
218+ * guards against a second add overwriting *pd_ptr and leaking the
219+ * first, symmetric with the check in pdsc_auxbus_dev_del().
220+ */
221+ if (*pd_ptr)
222+ goto out_unlock;
223+
213224 mask = BIT_ULL(PDSC_S_FW_DEAD) |
214225 BIT_ULL(PDSC_S_STOPPING_DRIVER);
215226 if (cf->state & mask) {
drivers/net/ethernet/amd/pds_core/core.c+15−7
@@ -110,7 +110,6 @@ static void pdsc_qcq_intr_free(struct pdsc *pdsc, struct pdsc_qcq *qcq) · 109 unmodified lines
110110 return;
111111
112112 pdsc_intr_free(pdsc, qcq->intx);
113− qcq->intx = PDS_CORE_INTR_INDEX_NOT_ASSIGNED;
114113 }
115114
116115 static int pdsc_qcq_intr_alloc(struct pdsc *pdsc, struct pdsc_qcq *qcq)
@@ -145,6 +144,12 @@ void pdsc_qcq_free(struct pdsc *pdsc, struct pdsc_qcq *qcq) · 28 unmodified lines
145144
146145 pdsc_qcq_intr_free(pdsc, qcq);
147146
147+ /* Drain any work queued by ISR before it was freed above */
148+ if (qcq->work.func)
149+ cancel_work_sync(&qcq->work);
150+
151+ qcq->intx = PDS_CORE_INTR_INDEX_NOT_ASSIGNED;
152+
148153 if (qcq->q_base)
149154 dma_free_coherent(dev, qcq->q_size,
150155 qcq->q_base, qcq->q_base_pa);
@@ -304,8 +309,11 @@ err_out: · 153 unmodified lines
304309
305310 static void pdsc_core_uninit(struct pdsc *pdsc)
306311 {
307− pdsc_qcq_free(pdsc, &pdsc->notifyqcq);
312+ /* Free adminqcq first: its work accesses notifyqcq, so we must
313+ * disable its IRQ and drain its work before freeing notifyqcq.
314+ */
308315 pdsc_qcq_free(pdsc, &pdsc->adminqcq);
316+ pdsc_qcq_free(pdsc, &pdsc->notifyqcq);
309317
310318 if (pdsc->kern_dbpage) {
311319 iounmap(pdsc->kern_dbpage);
@@ -479,8 +487,6 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing) · 167 unmodified lines
479487 {
480488 if (!pdsc->pdev->is_virtfn)
481489 pdsc_devcmd_reset(pdsc);
482− if (pdsc->adminqcq.work.func)
483− cancel_work_sync(&pdsc->adminqcq.work);
484490
485491 pci_clear_master(pdsc->pdev);
486492
@@ -533,6 +539,7 @@ static void pdsc_adminq_wait_and_dec_once_unused(struct pdsc *pdsc) · 46 unmodified lines
533539 dev_dbg_ratelimited(pdsc->dev, "%s: adminq in use\n",
534540 __func__);
535541 cpu_relax();
542+ cond_resched();
536543 }
537544 }
538545
@@ -606,9 +613,10 @@ void pdsc_pci_reset_thread(struct work_struct *work) · 67 unmodified lines
606613 struct pdsc *pdsc = container_of(work, struct pdsc, pci_reset_work);
607614 struct pci_dev *pdev = pdsc->pdev;
608615
609− pci_dev_get(pdev);
610− pci_reset_function(pdev);
611− pci_dev_put(pdev);
616+ /* Use try variant to avoid deadlock with pdsc_remove().
617+ * If lock is contended, the watchdog timer will retry.
618+ */
619+ pci_try_reset_function(pdev);
612620 }
613621
614622 static void pdsc_check_pci_health(struct pdsc *pdsc)
drivers/net/ethernet/amd/pds_core/devlink.c+6−0
@@ -90,6 +90,12 @@ int pdsc_dl_flash_update(struct devlink *dl, · 89 unmodified lines
9090 {
9191 struct pdsc *pdsc = devlink_priv(dl);
9292
93+ if (params->component) {
94+ NL_SET_ERR_MSG_MOD(extack,
95+ "Component update not supported by this device");
96+ return -EOPNOTSUPP;
97+ }
98+
9399 return pdsc_firmware_update(pdsc, params->fw, extack);
94100 }
95101
drivers/net/ethernet/amd/pds_core/main.c+10−4
@@ -238,6 +238,10 @@ static int pdsc_init_pf(struct pdsc *pdsc) · 237 unmodified lines
238238 /* General workqueue and timer, but don't start timer yet */
239239 snprintf(wq_name, sizeof(wq_name), "%s.%d", PDS_CORE_DRV_NAME, pdsc->uid);
240240 pdsc->wq = create_singlethread_workqueue(wq_name);
241+ if (!pdsc->wq) {
242+ err = -ENOMEM;
243+ goto err_out_unmap_bars;
244+ }
241245 INIT_WORK(&pdsc->health_work, pdsc_health_thread);
242246 INIT_WORK(&pdsc->pci_reset_work, pdsc_pci_reset_thread);
243247 timer_setup(&pdsc->wdtimer, pdsc_wdtimer_cb, 0);
@@ -253,7 +257,7 @@ static int pdsc_init_pf(struct pdsc *pdsc) · 9 unmodified lines
253257 err = pdsc_setup(pdsc, PDSC_SETUP_INIT);
254258 if (err) {
255259 mutex_unlock(&pdsc->config_lock);
256− goto err_out_unmap_bars;
260+ goto err_out_shutdown_timer;
257261 }
258262
259263 err = pdsc_start(pdsc);
@@ -305,13 +309,14 @@ err_out_stop: · 45 unmodified lines
305309 pdsc_stop(pdsc);
306310 err_out_teardown:
307311 pdsc_teardown(pdsc, PDSC_TEARDOWN_REMOVING);
308−err_out_unmap_bars:
312+err_out_shutdown_timer:
309313 timer_shutdown_sync(&pdsc->wdtimer);
310314 if (pdsc->wq)
311315 destroy_workqueue(pdsc->wq);
312316 mutex_destroy(&pdsc->config_lock);
313317 mutex_destroy(&pdsc->devcmd_lock);
314318 pci_free_irq_vectors(pdsc->pdev);
319+err_out_unmap_bars:
315320 pdsc_unmap_bars(pdsc);
316321 err_out_release_regions:
317322 pci_release_regions(pdsc->pdev);
@@ -435,8 +440,6 @@ static void pdsc_remove(struct pci_dev *pdev) · 117 unmodified lines
435440 pdsc_auxbus_dev_del(pdsc, pdsc, &pdsc->padev);
436441
437442 timer_shutdown_sync(&pdsc->wdtimer);
438− if (pdsc->wq)
439− destroy_workqueue(pdsc->wq);
440443
441444 mutex_lock(&pdsc->config_lock);
442445 set_bit(PDSC_S_STOPPING_DRIVER, &pdsc->state);
@@ -444,6 +447,9 @@ static void pdsc_remove(struct pci_dev *pdev) · 1 unmodified line
444447 pdsc_stop(pdsc);
445448 pdsc_teardown(pdsc, PDSC_TEARDOWN_REMOVING);
446449 mutex_unlock(&pdsc->config_lock);
450+
451+ if (pdsc->wq)
452+ destroy_workqueue(pdsc->wq);
447453 mutex_destroy(&pdsc->config_lock);
448454 mutex_destroy(&pdsc->devcmd_lock);
449455
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c+8−3
@@ -267,9 +267,14 @@ static void xgbe_an37_set(struct xgbe_prv_data *pdata, bool enable, · 266 unmodified lines
267267
268268 XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_CTRL1, reg);
269269
270− reg = XMDIO_READ(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL);
271− reg |= XGBE_VEND2_MAC_AUTO_SW;
272− XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL, reg);
270+ if (pdata->an_mode == XGBE_AN_MODE_CL37_SGMII) {
271+ reg = XMDIO_READ(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL);
272+ if (enable)
273+ reg |= XGBE_VEND2_MAC_AUTO_SW;
274+ else
275+ reg &= ~XGBE_VEND2_MAC_AUTO_SW;
276+ XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL, reg);
277+ }
273278 }
274279
275280 static void xgbe_an37_restart(struct xgbe_prv_data *pdata)
drivers/net/ethernet/broadcom/bnge/bnge.h+1−0
@@ -36,6 +36,7 @@ struct bnge_pf_info { · 35 unmodified lines
3636 };
3737
3838 #define INVALID_HW_RING_ID ((u16)-1)
39+#define INVALID_HW_RING_ID_32BIT (U32_MAX)
3940
4041 enum {
4142 BNGE_FW_CAP_SHORT_CMD = BIT_ULL(0),
drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.c+4−4
@@ -1283,7 +1283,7 @@ int bnge_hwrm_stat_ctx_alloc(struct bnge_net *bn) · 1282 unmodified lines
12831283
12841284 int hwrm_ring_free_send_msg(struct bnge_net *bn,
12851285 struct bnge_ring_struct *ring,
1286− u32 ring_type, int cmpl_ring_id)
1286+ u32 ring_type, u32 cmpl_ring_id)
12871287 {
12881288 struct hwrm_ring_free_input *req;
12891289 struct bnge_dev *bd = bn->bd;
@@ -1295,7 +1295,7 @@ int hwrm_ring_free_send_msg(struct bnge_net *bn, · 5 unmodified lines
12951295
12961296 req->cmpl_ring = cpu_to_le16(cmpl_ring_id);
12971297 req->ring_type = ring_type;
1298− req->ring_id = cpu_to_le16(ring->fw_ring_id);
1298+ req->ring_id = cpu_to_le32(ring->fw_ring_id);
12991299
13001300 bnge_hwrm_req_hold(bd, req);
13011301 rc = bnge_hwrm_req_send(bd, req);
@@ -1317,7 +1317,7 @@ int hwrm_ring_alloc_send_msg(struct bnge_net *bn, · 15 unmodified lines
13171317 struct hwrm_ring_alloc_output *resp;
13181318 struct hwrm_ring_alloc_input *req;
13191319 struct bnge_dev *bd = bn->bd;
1320− u16 ring_id, flags = 0;
1320+ u32 ring_id, flags = 0;
13211321 int rc;
13221322
13231323 rc = bnge_hwrm_req_init(bd, req, HWRM_RING_ALLOC);
@@ -1401,7 +1401,7 @@ int hwrm_ring_alloc_send_msg(struct bnge_net *bn, · 77 unmodified lines
14011401
14021402 resp = bnge_hwrm_req_hold(bd, req);
14031403 rc = bnge_hwrm_req_send(bd, req);
1404− ring_id = le16_to_cpu(resp->ring_id);
1404+ ring_id = le32_to_cpu(resp->ring_id);
14051405 bnge_hwrm_req_drop(bd, req);
14061406
14071407 exit:
drivers/net/ethernet/broadcom/bnge/bnge_hwrm_lib.h+1−1
@@ -50,7 +50,7 @@ int bnge_hwrm_cfa_l2_set_rx_mask(struct bnge_dev *bd, · 49 unmodified lines
5050 void bnge_hwrm_stat_ctx_free(struct bnge_net *bn);
5151 int bnge_hwrm_stat_ctx_alloc(struct bnge_net *bn);
5252 int hwrm_ring_free_send_msg(struct bnge_net *bn, struct bnge_ring_struct *ring,
53− u32 ring_type, int cmpl_ring_id);
53+ u32 ring_type, u32 cmpl_ring_id);
5454 int hwrm_ring_alloc_send_msg(struct bnge_net *bn,
5555 struct bnge_ring_struct *ring,
5656 u32 ring_type, u32 map_index);
drivers/net/ethernet/broadcom/bnge/bnge_netdev.c+24−26
@@ -1327,12 +1327,12 @@ err_free_core: · 1326 unmodified lines
13271327 return rc;
13281328 }
13291329
1330−u16 bnge_cp_ring_for_rx(struct bnge_rx_ring_info *rxr)
1330+u32 bnge_cp_ring_for_rx(struct bnge_rx_ring_info *rxr)
13311331 {
13321332 return rxr->rx_cpr->ring_struct.fw_ring_id;
13331333 }
13341334
1335−u16 bnge_cp_ring_for_tx(struct bnge_tx_ring_info *txr)
1335+u32 bnge_cp_ring_for_tx(struct bnge_tx_ring_info *txr)
13361336 {
13371337 return txr->tx_cpr->ring_struct.fw_ring_id;
13381338 }
@@ -1375,12 +1375,12 @@ static void bnge_init_nq_tree(struct bnge_net *bn) · 36 unmodified lines
13751375 struct bnge_nq_ring_info *nqr = &bn->bnapi[i]->nq_ring;
13761376 struct bnge_ring_struct *ring = &nqr->ring_struct;
13771377
1378− ring->fw_ring_id = INVALID_HW_RING_ID;
1378+ ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
13791379 for (j = 0; j < nqr->cp_ring_count; j++) {
13801380 struct bnge_cp_ring_info *cpr = &nqr->cp_ring_arr[j];
13811381
13821382 ring = &cpr->ring_struct;
1383− ring->fw_ring_id = INVALID_HW_RING_ID;
1383+ ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
13841384 }
13851385 }
13861386 }
@@ -1637,7 +1637,7 @@ static void bnge_init_one_rx_ring_rxbd(struct bnge_net *bn, · 250 unmodified lines
16371637
16381638 ring = &rxr->rx_ring_struct;
16391639 bnge_init_rxbd_pages(ring, type);
1640− ring->fw_ring_id = INVALID_HW_RING_ID;
1640+ ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
16411641 }
16421642
16431643 static void bnge_init_one_agg_ring_rxbd(struct bnge_net *bn,
@@ -1647,7 +1647,7 @@ static void bnge_init_one_agg_ring_rxbd(struct bnge_net *bn, · 3 unmodified lines
16471647 u32 type;
16481648
16491649 ring = &rxr->rx_agg_ring_struct;
1650− ring->fw_ring_id = INVALID_HW_RING_ID;
1650+ ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
16511651 if (bnge_is_agg_reqd(bn->bd)) {
16521652 type = ((u32)BNGE_RX_PAGE_SIZE << RX_BD_LEN_SHIFT) |
16531653 RX_BD_TYPE_RX_AGG_BD | RX_BD_FLAGS_SOP;
@@ -1708,7 +1708,7 @@ static void bnge_init_tx_rings(struct bnge_net *bn) · 54 unmodified lines
17081708 struct bnge_tx_ring_info *txr = &bn->tx_ring[i];
17091709 struct bnge_ring_struct *ring = &txr->tx_ring_struct;
17101710
1711− ring->fw_ring_id = INVALID_HW_RING_ID;
1711+ ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
17121712
17131713 netif_queue_set_napi(bn->netdev, i, NETDEV_QUEUE_TYPE_TX,
17141714 &txr->bnapi->napi);
@@ -1867,7 +1867,7 @@ static int bnge_hwrm_rx_agg_ring_alloc(struct bnge_net *bn, · 152 unmodified lines
18671867 ring->fw_ring_id);
18681868 bnge_db_write(bn->bd, &rxr->rx_agg_db, rxr->rx_agg_prod);
18691869 bnge_db_write(bn->bd, &rxr->rx_db, rxr->rx_prod);
1870− bn->grp_info[grp_idx].agg_fw_ring_id = ring->fw_ring_id;
1870+ bn->grp_info[grp_idx].agg_fw_ring_id = (u16)ring->fw_ring_id;
18711871
18721872 return 0;
18731873 }
@@ -1886,7 +1886,7 @@ static int bnge_hwrm_rx_ring_alloc(struct bnge_net *bn, · 12 unmodified lines
18861886 return rc;
18871887
18881888 bnge_set_db(bn, &rxr->rx_db, type, map_idx, ring->fw_ring_id);
1889− bn->grp_info[map_idx].rx_fw_ring_id = ring->fw_ring_id;
1889+ bn->grp_info[map_idx].rx_fw_ring_id = (u16)ring->fw_ring_id;
18901890
18911891 return 0;
18921892 }
@@ -1916,7 +1916,7 @@ static int bnge_hwrm_ring_alloc(struct bnge_net *bn) · 23 unmodified lines
19161916 bnge_set_db(bn, &nqr->nq_db, type, map_idx, ring->fw_ring_id);
19171917 bnge_db_nq(bn, &nqr->nq_db, nqr->nq_raw_cons);
19181918 enable_irq(vector);
1919− bn->grp_info[i].nq_fw_ring_id = ring->fw_ring_id;
1919+ bn->grp_info[i].nq_fw_ring_id = (u16)ring->fw_ring_id;
19201920
19211921 if (!i) {
19221922 rc = bnge_hwrm_set_async_event_cr(bd, ring->fw_ring_id);
@@ -1986,15 +1986,13 @@ void bnge_fill_hw_rss_tbl(struct bnge_net *bn, struct bnge_vnic_info *vnic) · 63 unmodified lines
19861986 tbl_size = bnge_get_rxfh_indir_size(bd);
19871987
19881988 for (i = 0; i < tbl_size; i++) {
1989− u16 ring_id, j;
1989+ u32 j;
19901990
19911991 j = bd->rss_indir_tbl[i];
19921992 rxr = &bn->rx_ring[j];
19931993
1994− ring_id = rxr->rx_ring_struct.fw_ring_id;
1995− *ring_tbl++ = cpu_to_le16(ring_id);
1996− ring_id = bnge_cp_ring_for_rx(rxr);
1997− *ring_tbl++ = cpu_to_le16(ring_id);
1994+ *ring_tbl++ = cpu_to_le16(rxr->rx_ring_struct.fw_ring_id);
1995+ *ring_tbl++ = cpu_to_le16(bnge_cp_ring_for_rx(rxr));
19981996 }
19991997 }
20001998
@@ -2285,7 +2283,7 @@ static void bnge_disable_int(struct bnge_net *bn) · 284 unmodified lines
22852283 nqr = &bnapi->nq_ring;
22862284 ring = &nqr->ring_struct;
22872285
2288− if (ring->fw_ring_id != INVALID_HW_RING_ID)
2286+ if (ring->fw_ring_id != INVALID_HW_RING_ID_32BIT)
22892287 bnge_db_nq(bn, &nqr->nq_db, nqr->nq_raw_cons);
22902288 }
22912289 }
@@ -2401,7 +2399,7 @@ static void bnge_hwrm_rx_ring_free(struct bnge_net *bn, · 109 unmodified lines
24012399 u32 grp_idx = rxr->bnapi->index;
24022400 u32 cmpl_ring_id;
24032401
2404− if (ring->fw_ring_id == INVALID_HW_RING_ID)
2402+ if (ring->fw_ring_id == INVALID_HW_RING_ID_32BIT)
24052403 return;
24062404
24072405 cmpl_ring_id = bnge_cp_ring_for_rx(rxr);
@@ -2409,7 +2407,7 @@ static void bnge_hwrm_rx_ring_free(struct bnge_net *bn, · 1 unmodified line
24092407 RING_FREE_REQ_RING_TYPE_RX,
24102408 close_path ? cmpl_ring_id :
24112409 INVALID_HW_RING_ID);
2412− ring->fw_ring_id = INVALID_HW_RING_ID;
2410+ ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
24132411 bn->grp_info[grp_idx].rx_fw_ring_id = INVALID_HW_RING_ID;
24142412 }
24152413
@@ -2421,14 +2419,14 @@ static void bnge_hwrm_rx_agg_ring_free(struct bnge_net *bn, · 5 unmodified lines
24212419 u32 grp_idx = rxr->bnapi->index;
24222420 u32 cmpl_ring_id;
24232421
2424− if (ring->fw_ring_id == INVALID_HW_RING_ID)
2422+ if (ring->fw_ring_id == INVALID_HW_RING_ID_32BIT)
24252423 return;
24262424
24272425 cmpl_ring_id = bnge_cp_ring_for_rx(rxr);
24282426 hwrm_ring_free_send_msg(bn, ring, RING_FREE_REQ_RING_TYPE_RX_AGG,
24292427 close_path ? cmpl_ring_id :
24302428 INVALID_HW_RING_ID);
2431− ring->fw_ring_id = INVALID_HW_RING_ID;
2429+ ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
24322430 bn->grp_info[grp_idx].agg_fw_ring_id = INVALID_HW_RING_ID;
24332431 }
24342432
@@ -2439,14 +2437,14 @@ static void bnge_hwrm_tx_ring_free(struct bnge_net *bn, · 4 unmodified lines
24392437 struct bnge_ring_struct *ring = &txr->tx_ring_struct;
24402438 u32 cmpl_ring_id;
24412439
2442− if (ring->fw_ring_id == INVALID_HW_RING_ID)
2440+ if (ring->fw_ring_id == INVALID_HW_RING_ID_32BIT)
24432441 return;
24442442
24452443 cmpl_ring_id = close_path ? bnge_cp_ring_for_tx(txr) :
24462444 INVALID_HW_RING_ID;
24472445 hwrm_ring_free_send_msg(bn, ring, RING_FREE_REQ_RING_TYPE_TX,
24482446 cmpl_ring_id);
2449− ring->fw_ring_id = INVALID_HW_RING_ID;
2447+ ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
24502448 }
24512449
24522450 static void bnge_hwrm_cp_ring_free(struct bnge_net *bn,
@@ -2455,12 +2453,12 @@ static void bnge_hwrm_cp_ring_free(struct bnge_net *bn, · 2 unmodified lines
24552453 struct bnge_ring_struct *ring;
24562454
24572455 ring = &cpr->ring_struct;
2458− if (ring->fw_ring_id == INVALID_HW_RING_ID)
2456+ if (ring->fw_ring_id == INVALID_HW_RING_ID_32BIT)
24592457 return;
24602458
24612459 hwrm_ring_free_send_msg(bn, ring, RING_FREE_REQ_RING_TYPE_L2_CMPL,
24622460 INVALID_HW_RING_ID);
2463− ring->fw_ring_id = INVALID_HW_RING_ID;
2461+ ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
24642462 }
24652463
24662464 static void bnge_hwrm_ring_free(struct bnge_net *bn, bool close_path)
@@ -2496,11 +2494,11 @@ static void bnge_hwrm_ring_free(struct bnge_net *bn, bool close_path) · 29 unmodified lines
24962494 bnge_hwrm_cp_ring_free(bn, &nqr->cp_ring_arr[j]);
24972495
24982496 ring = &nqr->ring_struct;
2499− if (ring->fw_ring_id != INVALID_HW_RING_ID) {
2497+ if (ring->fw_ring_id != INVALID_HW_RING_ID_32BIT) {
25002498 hwrm_ring_free_send_msg(bn, ring,
25012499 RING_FREE_REQ_RING_TYPE_NQ,
25022500 INVALID_HW_RING_ID);
2503− ring->fw_ring_id = INVALID_HW_RING_ID;
2501+ ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
25042502 bn->grp_info[i].nq_fw_ring_id = INVALID_HW_RING_ID;
25052503 }
25062504 }
drivers/net/ethernet/broadcom/bnge/bnge_netdev.h+2−2
@@ -630,8 +630,8 @@ struct bnge_l2_filter { · 629 unmodified lines
630630 refcount_t refcnt;
631631 };
632632
633−u16 bnge_cp_ring_for_rx(struct bnge_rx_ring_info *rxr);
634−u16 bnge_cp_ring_for_tx(struct bnge_tx_ring_info *txr);
633+u32 bnge_cp_ring_for_rx(struct bnge_rx_ring_info *rxr);
634+u32 bnge_cp_ring_for_tx(struct bnge_tx_ring_info *txr);
635635 void bnge_fill_hw_rss_tbl(struct bnge_net *bn, struct bnge_vnic_info *vnic);
636636 int bnge_alloc_rx_data(struct bnge_net *bn, struct bnge_rx_ring_info *rxr,
637637 u16 prod, gfp_t gfp);
drivers/net/ethernet/broadcom/bnge/bnge_rmem.h+1−1
@@ -184,7 +184,7 @@ struct bnge_ctx_mem_info { · 183 unmodified lines
184184 struct bnge_ring_struct {
185185 struct bnge_ring_mem_info ring_mem;
186186
187− u16 fw_ring_id;
187+ u32 fw_ring_id;
188188 union {
189189 u16 grp_idx;
190190 u16 map_idx; /* Used by NQs */
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c+1−0
@@ -4732,6 +4732,7 @@ static void dpaa2_eth_disconnect_mac(struct dpaa2_eth_priv *priv) · 4731 unmodified lines
47324732 dpaa2_mac_disconnect(mac);
47334733
47344734 dpaa2_mac_close(mac);
4735+ put_device(&mac->mc_dev->dev);
47354736 kfree(mac);
47364737 }
47374738
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c+1−0
@@ -1560,6 +1560,7 @@ static void dpaa2_switch_port_disconnect_mac(struct ethsw_port_priv *port_priv) · 1559 unmodified lines
15601560 dpaa2_mac_disconnect(mac);
15611561
15621562 dpaa2_mac_close(mac);
1563+ put_device(&mac->mc_dev->dev);
15631564 kfree(mac);
15641565 }
15651566
drivers/net/ethernet/freescale/fman/fman_dtsec.c+12−5
@@ -900,22 +900,28 @@ static void dtsec_mac_config(struct phylink_config *config, unsigned int mode, · 899 unmodified lines
900900 {
901901 struct mac_device *mac_dev = fman_config_to_mac(config);
902902 struct dtsec_regs __iomem *regs = mac_dev->fman_mac->regs;
903− u32 tmp;
903+ u32 ecntrl, maccfg2;
904+
905+ maccfg2 = ioread32be(&regs->maccfg2);
906+ maccfg2 &= ~(MACCFG2_NIBBLE_MODE | MACCFG2_BYTE_MODE);
904907
905908 switch (state->interface) {
906909 case PHY_INTERFACE_MODE_RMII:
907− tmp = DTSEC_ECNTRL_RMM;
910+ ecntrl = DTSEC_ECNTRL_RMM;
911+ maccfg2 |= MACCFG2_NIBBLE_MODE;
908912 break;
909913 case PHY_INTERFACE_MODE_RGMII:
910914 case PHY_INTERFACE_MODE_RGMII_ID:
911915 case PHY_INTERFACE_MODE_RGMII_RXID:
912916 case PHY_INTERFACE_MODE_RGMII_TXID:
913− tmp = DTSEC_ECNTRL_GMIIM | DTSEC_ECNTRL_RPM;
917+ ecntrl = DTSEC_ECNTRL_GMIIM | DTSEC_ECNTRL_RPM;
918+ maccfg2 |= MACCFG2_BYTE_MODE;
914919 break;
915920 case PHY_INTERFACE_MODE_SGMII:
916921 case PHY_INTERFACE_MODE_1000BASEX:
917922 case PHY_INTERFACE_MODE_2500BASEX:
918− tmp = DTSEC_ECNTRL_TBIM | DTSEC_ECNTRL_SGMIIM;
923+ ecntrl = DTSEC_ECNTRL_TBIM | DTSEC_ECNTRL_SGMIIM;
924+ maccfg2 |= MACCFG2_BYTE_MODE;
919925 break;
920926 default:
921927 dev_warn(mac_dev->dev, "cannot configure dTSEC for %s\n",
@@ -923,7 +929,8 @@ static void dtsec_mac_config(struct phylink_config *config, unsigned int mode, · 1 unmodified line
923929 return;
924930 }
925931
926− iowrite32be(tmp, &regs->ecntrl);
932+ iowrite32be(ecntrl, &regs->ecntrl);
933+ iowrite32be(maccfg2, &regs->maccfg2);
927934 }
928935
929936 static void dtsec_link_up(struct phylink_config *config, struct phy_device *phy,
drivers/net/ethernet/google/gve/gve.h+3−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/netdevice.h>
1414 #include <linux/net_tstamp.h>
1515 #include <linux/pci.h>
16+#include <linux/timer.h>
1617 #include <linux/ptp_clock_kernel.h>
1718 #include <linux/u64_stats_sync.h>
1819 #include <net/page_pool/helpers.h>
@@ -41,6 +42,7 @@ · 22 unmodified lines
4142
4243 /* Interval to schedule a stats report update, 20000ms. */
4344 #define GVE_STATS_REPORT_TIMER_PERIOD 20000
45+#define GVE_RX_NAPI_RESCHED_MS 20 /* msecs */
4446
4547 /* Numbers of NIC tx/rx stats in stats report. */
4648 #define NIC_TX_STATS_REPORT_NUM 0
@@ -341,6 +343,7 @@ struct gve_rx_ring { · 294 unmodified lines
341343 struct xdp_rxq_info xdp_rxq;
342344 struct xsk_buff_pool *xsk_pool;
343345 struct page_frag_cache page_cache; /* Page cache to allocate XDP frames */
346+ struct timer_list starvation_timer; /* for queue starvation recovery */
344347 };
345348
346349 /* A TX desc ring entry */
drivers/net/ethernet/google/gve/gve_rx_dqo.c+34−0
@@ -18,6 +18,16 @@ · 17 unmodified lines
1818 #include <net/tcp.h>
1919 #include <net/xdp_sock_drv.h>
2020
21+static void gve_rx_starvation_timer(struct timer_list *t)
22+{
23+ struct gve_rx_ring *rx = timer_container_of(rx, t, starvation_timer);
24+ struct gve_priv *priv = rx->gve;
25+ struct gve_notify_block *block;
26+
27+ block = &priv->ntfy_blocks[rx->ntfy_id];
28+ napi_schedule(&block->napi);
29+}
30+
2131 static void gve_rx_free_hdr_bufs(struct gve_priv *priv, struct gve_rx_ring *rx)
2232 {
2333 struct device *hdev = &priv->pdev->dev;
@@ -120,6 +130,7 @@ void gve_rx_stop_ring_dqo(struct gve_priv *priv, int idx) · 96 unmodified lines
120130
121131 if (rx->dqo.page_pool)
122132 page_pool_disable_direct_recycling(rx->dqo.page_pool);
133+ timer_shutdown_sync(&rx->starvation_timer);
123134 gve_remove_napi(priv, ntfy_idx);
124135 gve_rx_remove_from_block(priv, idx);
125136 gve_rx_reset_ring_dqo(priv, idx);
@@ -208,8 +219,10 @@ static int gve_rx_alloc_hdr_bufs(struct gve_priv *priv, struct gve_rx_ring *rx, · 82 unmodified lines
208219 void gve_rx_start_ring_dqo(struct gve_priv *priv, int idx)
209220 {
210221 int ntfy_idx = gve_rx_idx_to_ntfy(priv, idx);
222+ struct gve_rx_ring *rx = &priv->rx[idx];
211223
212224 gve_rx_add_to_block(priv, idx);
225+ timer_setup(&rx->starvation_timer, gve_rx_starvation_timer, 0);
213226 gve_add_napi(priv, ntfy_idx, gve_napi_poll_dqo);
214227 }
215228
@@ -365,6 +378,7 @@ void gve_rx_post_buffers_dqo(struct gve_rx_ring *rx) · 149 unmodified lines
365378 struct gve_rx_compl_queue_dqo *complq = &rx->dqo.complq;
366379 struct gve_rx_buf_queue_dqo *bufq = &rx->dqo.bufq;
367380 struct gve_priv *priv = rx->gve;
381+ u32 num_bufs_avail_to_hw;
368382 u32 num_avail_slots;
369383 u32 num_full_slots;
370384 u32 num_posted = 0;
@@ -400,6 +414,26 @@ void gve_rx_post_buffers_dqo(struct gve_rx_ring *rx) · 29 unmodified lines
400414 }
401415
402416 rx->fill_cnt += num_posted;
417+
418+ /* If the queue has fewer than GVE_RX_BUF_THRESH_DQO descriptors
419+ * visible to the hardware, the hardware is in danger of starving
420+ * and cannot trigger interrupts.
421+ *
422+ * We use a threshold of 32 because a single maximum-sized RSC
423+ * packet can consume up to 19 descriptors in the Rx path. Lower
424+ * thresholds (e.g., 8 or 16) would be unsafe as they could cause
425+ * the device to drop/stall on a maximum-sized RSC packet.
426+ *
427+ * Start the timer to periodically reschedule NAPI and recover.
428+ */
429+ num_bufs_avail_to_hw =
430+ ((bufq->tail & ~(GVE_RX_BUF_THRESH_DQO - 1)) -
431+ bufq->head) & bufq->mask;
432+
433+ if (num_bufs_avail_to_hw < GVE_RX_BUF_THRESH_DQO) {
434+ mod_timer(&rx->starvation_timer,
435+ jiffies + msecs_to_jiffies(GVE_RX_NAPI_RESCHED_MS));
436+ }
403437 }
404438
405439 static void gve_rx_skb_csum(struct sk_buff *skb,
drivers/net/ethernet/hisilicon/hip04_eth.c+8−3
@@ -594,7 +594,11 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) · 593 unmodified lines
594594 skb = build_skb(buf, priv->rx_buf_size);
595595 if (unlikely(!skb)) {
596596 net_dbg_ratelimited("build_skb failed\n");
597− goto refill;
597+ /* Retain the slot; return budget so NAPI retries this
598+ * buffer. Refill would overwrite rx_buf[]/rx_phys[]
599+ * and leak them.
600+ */
601+ return budget;
598602 }
599603
600604 dma_unmap_single(priv->dev, priv->rx_phys[priv->rx_head],
@@ -622,14 +626,15 @@ static int hip04_rx_poll(struct napi_struct *napi, int budget) · 21 unmodified lines
622626 rx++;
623627 }
624628
625−refill:
626629 buf = netdev_alloc_frag(priv->rx_buf_size);
627630 if (!buf)
628631 goto done;
629632 phys = dma_map_single(priv->dev, buf,
630633 RX_BUF_SIZE, DMA_FROM_DEVICE);
631− if (dma_mapping_error(priv->dev, phys))
634+ if (dma_mapping_error(priv->dev, phys)) {
635+ skb_free_frag(buf);
632636 goto done;
637+ }
633638 priv->rx_buf[priv->rx_head] = buf;
634639 priv->rx_phys[priv->rx_head] = phys;
635640 hip04_set_recv_desc(priv, phys);
drivers/net/ethernet/huawei/hinic/hinic_dev.h+0−2
@@ -104,8 +104,6 @@ struct hinic_dev { · 103 unmodified lines
104104 u16 num_rss;
105105 u16 rss_limit;
106106 struct hinic_rss_type rss_type;
107− u8 *rss_hkey_user;
108− s32 *rss_indir_user;
109107 struct hinic_intr_coal_info *rx_intr_coalesce;
110108 struct hinic_intr_coal_info *tx_intr_coalesce;
111109 struct hinic_sriov_info sriov_info;
drivers/net/ethernet/huawei/hinic/hinic_ethtool.c+0−21
@@ -1064,17 +1064,6 @@ static int __set_rss_rxfh(struct net_device *netdev, · 1063 unmodified lines
10641064 int err;
10651065
10661066 if (indir) {
1067− if (!nic_dev->rss_indir_user) {
1068− nic_dev->rss_indir_user =
1069− kzalloc(sizeof(u32) * HINIC_RSS_INDIR_SIZE,
1070− GFP_KERNEL);
1071− if (!nic_dev->rss_indir_user)
1072− return -ENOMEM;
1073− }
1074−
1075− memcpy(nic_dev->rss_indir_user, indir,
1076− sizeof(u32) * HINIC_RSS_INDIR_SIZE);
1077−
10781067 err = hinic_rss_set_indir_tbl(nic_dev,
10791068 nic_dev->rss_tmpl_idx, indir);
10801069 if (err)
@@ -1082,16 +1071,6 @@ static int __set_rss_rxfh(struct net_device *netdev, · 1 unmodified line
10821071 }
10831072
10841073 if (key) {
1085− if (!nic_dev->rss_hkey_user) {
1086− nic_dev->rss_hkey_user =
1087− kzalloc(HINIC_RSS_KEY_SIZE * 2, GFP_KERNEL);
1088−
1089− if (!nic_dev->rss_hkey_user)
1090− return -ENOMEM;
1091− }
1092−
1093− memcpy(nic_dev->rss_hkey_user, key, HINIC_RSS_KEY_SIZE);
1094−
10951074 err = hinic_rss_set_template_tbl(nic_dev,
10961075 nic_dev->rss_tmpl_idx, key);
10971076 if (err)
drivers/net/ethernet/intel/ice/ice.h+3−0
@@ -767,6 +767,9 @@ static inline bool ice_is_txtime_ena(const struct ice_tx_ring *ring) · 766 unmodified lines
767767 struct ice_vsi *vsi = ring->vsi;
768768 struct ice_pf *pf = vsi->back;
769769
770+ if (vsi->type != ICE_VSI_PF)
771+ return false;
772+
770773 return test_bit(ring->q_index, pf->txtime_txqs);
771774 }
772775
drivers/net/ethernet/intel/ice/ice_eswitch.c+0−3
@@ -512,9 +512,6 @@ int ice_eswitch_attach_vf(struct ice_pf *pf, struct ice_vf *vf) · 511 unmodified lines
512512 struct ice_repr *repr;
513513 int err;
514514
515− if (!ice_is_eswitch_mode_switchdev(pf))
516− return 0;
517−
518515 repr = ice_repr_create_vf(vf);
519516 if (IS_ERR(repr))
520517 return PTR_ERR(repr);
drivers/net/ethernet/intel/ice/ice_lag.c+1−1
@@ -2623,7 +2623,7 @@ int ice_init_lag(struct ice_pf *pf) · 2622 unmodified lines
26232623 goto free_lport_res;
26242624
26252625 /* associate recipes to profiles */
2626− for (n = 0; n < ICE_PROFID_IPV6_GTPU_IPV6_TCP_INNER; n++) {
2626+ for (n = 0; n < ICE_MAX_NUM_PROFILES; n++) {
26272627 err = ice_aq_get_recipe_to_profile(&pf->hw, n,
26282628 &recipe_bits, NULL);
26292629 if (err)
drivers/net/ethernet/intel/ice/ice_parser.c+3−0
@@ -2368,6 +2368,9 @@ int ice_parser_profile_init(struct ice_parser_result *rslt, · 2367 unmodified lines
23682368 u16 proto_off = 0;
23692369 u16 off;
23702370
2371+ if (rslt->ptype >= ICE_FLOW_PTYPE_MAX)
2372+ return -EINVAL;
2373+
23712374 memset(prof, 0, sizeof(*prof));
23722375 set_bit(rslt->ptype, prof->ptypes);
23732376 if (blk == ICE_BLK_SW) {
drivers/net/ethernet/intel/ice/ice_ptp.c+6−1
@@ -346,7 +346,7 @@ static u64 ice_ptp_extend_40b_ts(struct ice_pf *pf, u64 in_tstamp) · 345 unmodified lines
346346 return 0;
347347 }
348348
349− return ice_ptp_extend_32b_ts(pf->ptp.cached_phc_time,
349+ return ice_ptp_extend_32b_ts(READ_ONCE(pf->ptp.cached_phc_time),
350350 (in_tstamp >> 8) & mask);
351351 }
352352
@@ -3037,6 +3037,11 @@ void ice_ptp_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type) · 2684 unmodified lines
30373037 struct ice_ptp *ptp = &pf->ptp;
30383038 int err;
30393039
3040+ if (ptp->state == ICE_PTP_UNINIT) {
3041+ dev_dbg(ice_pf_to_dev(pf), "PTP was not initialized, skipping rebuild\n");
3042+ return;
3043+ }
3044+
30403045 if (ptp->state == ICE_PTP_READY) {
30413046 ice_ptp_prepare_for_reset(pf, reset_type);
30423047 } else if (ptp->state != ICE_PTP_RESETTING) {
drivers/net/ethernet/intel/ice/ice_sriov.c+8−6
@@ -484,12 +484,14 @@ static int ice_start_vfs(struct ice_pf *pf) · 483 unmodified lines
484484 goto teardown;
485485 }
486486
487− retval = ice_eswitch_attach_vf(pf, vf);
488− if (retval) {
489− dev_err(ice_pf_to_dev(pf), "Failed to attach VF %d to eswitch, error %d",
490− vf->vf_id, retval);
491− ice_vf_vsi_release(vf);
492− goto teardown;
487+ if (ice_is_eswitch_mode_switchdev(pf)) {
488+ retval = ice_eswitch_attach_vf(pf, vf);
489+ if (retval) {
490+ dev_err(ice_pf_to_dev(pf), "Failed to attach VF %d to eswitch, error %d",
491+ vf->vf_id, retval);
492+ ice_vf_vsi_release(vf);
493+ goto teardown;
494+ }
493495 }
494496
495497 set_bit(ICE_VF_STATE_INIT, vf->vf_states);
drivers/net/ethernet/intel/ice/ice_txrx.c+9−11
@@ -1654,7 +1654,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) · 1653 unmodified lines
16541654 ret = ipv6_skip_exthdr(skb, exthdr - skb->data,
16551655 &l4_proto, &frag_off);
16561656 if (ret < 0)
1657− return -1;
1657+ goto checksum_sw_fb;
16581658 }
16591659
16601660 /* define outer transport */
@@ -1673,11 +1673,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) · 12 unmodified lines
16731673 l4.hdr = skb_inner_network_header(skb);
16741674 break;
16751675 default:
1676− if (first->tx_flags & ICE_TX_FLAGS_TSO)
1677− return -1;
1678−
1679− skb_checksum_help(skb);
1680− return 0;
1676+ goto checksum_sw_fb;
16811677 }
16821678
16831679 /* compute outer L3 header size */
@@ -1736,7 +1732,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) · 52 unmodified lines
17361732 ipv6_skip_exthdr(skb, exthdr - skb->data, &l4_proto,
17371733 &frag_off);
17381734 } else {
1739− return -1;
1735+ goto checksum_sw_fb;
17401736 }
17411737
17421738 /* compute inner L3 header size */
@@ -1789,15 +1785,17 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) · 46 unmodified lines
17891785 break;
17901786
17911787 default:
1792− if (first->tx_flags & ICE_TX_FLAGS_TSO)
1793− return -1;
1794− skb_checksum_help(skb);
1795− return 0;
1788+ goto checksum_sw_fb;
17961789 }
17971790
17981791 off->td_cmd |= cmd;
17991792 off->td_offset |= offset;
18001793 return 1;
1794+
1795+checksum_sw_fb:
1796+ if (first->tx_flags & ICE_TX_FLAGS_TSO)
1797+ return -1;
1798+ return skb_checksum_help(skb);
18011799 }
18021800
18031801 /**
drivers/net/ethernet/intel/ice/ice_vf_lib.c+2−1
@@ -812,7 +812,8 @@ void ice_reset_all_vfs(struct ice_pf *pf) · 811 unmodified lines
812812 }
813813 ice_vf_post_vsi_rebuild(vf);
814814
815− ice_eswitch_attach_vf(pf, vf);
815+ if (ice_is_eswitch_mode_switchdev(pf))
816+ ice_eswitch_attach_vf(pf, vf);
816817
817818 mutex_unlock(&vf->cfg_lock);
818819 }
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c+6−1
@@ -3555,7 +3555,6 @@ restart: · 3554 unmodified lines
35553555
35563556 pci_sriov_set_totalvfs(adapter->pdev, idpf_get_max_vfs(adapter));
35573557 num_max_vports = idpf_get_max_vports(adapter);
3558− adapter->max_vports = num_max_vports;
35593558 adapter->vports = kzalloc_objs(*adapter->vports, num_max_vports);
35603559 if (!adapter->vports)
35613560 return -ENOMEM;
@@ -3576,6 +3575,12 @@ restart: · 14 unmodified lines
35763575 goto err_netdev_alloc;
35773576 }
35783577
3578+ /* Set max_vports only after vports, netdevs and vport_config buffers
3579+ * are allocated to make sure max_vport bound loops don't end up
3580+ * crashing, following allocation errors on init.
3581+ */
3582+ adapter->max_vports = num_max_vports;
3583+
35793584 /* Start the mailbox task before requesting vectors. This will ensure
35803585 * vector information response from mailbox is handled
35813586 */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c+1−0
@@ -272,6 +272,7 @@ exit: · 271 unmodified lines
272272 if (allocated) {
273273 pfvf->flags |= OTX2_FLAG_MCAM_ENTRIES_ALLOC;
274274 pfvf->flags |= OTX2_FLAG_NTUPLE_SUPPORT;
275+ pfvf->flags |= OTX2_FLAG_TC_FLOWER_SUPPORT;
275276 }
276277
277278 if (allocated != count)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c+16−13
@@ -30,6 +30,7 @@ · 29 unmodified lines
3030 #define OTX2_UNSUPP_LSE_DEPTH GENMASK(6, 4)
3131
3232 #define MCAST_INVALID_GRP (-1U)
33+#define RATE_MANTISSA_BITS 8
3334
3435 static void otx2_get_egress_burst_cfg(struct otx2_nic *nic, u32 burst,
3536 u32 *burst_exp, u32 *burst_mantissa)
@@ -66,28 +67,30 @@ static void otx2_get_egress_burst_cfg(struct otx2_nic *nic, u32 burst, · 30 unmodified lines
6667 static void otx2_get_egress_rate_cfg(u64 maxrate, u32 *exp,
6768 u32 *mantissa, u32 *div_exp)
6869 {
69− u64 tmp;
70−
7170 /* Rate calculation by hardware
7271 *
7372 * PIR_ADD = ((256 + mantissa) << exp) / 256
7473 * rate = (2 * PIR_ADD) / ( 1 << div_exp)
7574 * The resultant rate is in Mbps.
75+ *
76+ * Use div_exp = 0 and compute exp/mantissa for maxrate / 2; the
77+ * leading factor of two yields the full rate. Rates below 2 Mbps
78+ * are floored to the smallest step (exp = 0, mantissa = 0).
7679 */
7780
78− /* 2Mbps to 100Gbps can be expressed with div_exp = 0.
79− * Setting this to '0' will ease the calculation of
80− * exponent and mantissa.
81− */
8281 *div_exp = 0;
83−
8482 if (maxrate) {
85− *exp = ilog2(maxrate) ? ilog2(maxrate) - 1 : 0;
86− tmp = maxrate - rounddown_pow_of_two(maxrate);
87− if (maxrate < MAX_RATE_MANTISSA)
88− *mantissa = tmp * 2;
89− else
90− *mantissa = tmp / (1ULL << (*exp - 7));
83+ maxrate = maxrate / 2;
84+ if (!maxrate) {
85+ /* Rates below 2 Mbps map to the smallest step */
86+ *exp = 0;
87+ *mantissa = 0;
88+ } else {
89+ *exp = ilog2(maxrate);
90+ /* Clear MSB and derive fractional bits */
91+ maxrate &= ~BIT(*exp);
92+ *mantissa = (maxrate << RATE_MANTISSA_BITS) >> *exp;
93+ }
9194 } else {
9295 /* Instead of disabling rate limiting, set all values to max */
9396 *exp = MAX_RATE_EXPONENT;
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c+15−0
@@ -173,6 +173,13 @@ static int mlx5e_dcbnl_ieee_getets(struct net_device *netdev, · 172 unmodified lines
173173 }
174174 memcpy(ets->tc_tsa, priv->dcbx.tc_tsa, sizeof(ets->tc_tsa));
175175
176+ /* Report 0 for non ETS TSA */
177+ for (i = 0; i < ets->ets_cap; i++) {
178+ if (ets->tc_tx_bw[i] == MLX5E_MAX_BW_ALLOC &&
179+ priv->dcbx.tc_tsa[i] != IEEE_8021QAZ_TSA_ETS)
180+ ets->tc_tx_bw[i] = 0;
181+ }
182+
176183 return err;
177184 }
178185
@@ -317,6 +324,14 @@ static int mlx5e_dbcnl_validate_ets(struct net_device *netdev, · 138 unmodified lines
317324 }
318325 }
319326
327+ for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
328+ if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_CB_SHAPER) {
329+ netdev_err(netdev,
330+ "Failed to validate ETS: CB Shaper is not supported\n");
331+ return -EOPNOTSUPP;
332+ }
333+ }
334+
320335 /* Validate Bandwidth Sum */
321336 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
322337 if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) {
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+2−2
@@ -211,11 +211,11 @@ static void mlx5e_disable_async_events(struct mlx5e_priv *priv) · 210 unmodified lines
211211
212212 static int mlx5e_devcom_event_mpv(int event, void *my_data, void *event_data)
213213 {
214− struct mlx5e_priv *slave_priv = my_data;
214+ struct mlx5e_priv *master_priv = event_data;
215215
216216 switch (event) {
217217 case MPV_DEVCOM_MASTER_UP:
218− mlx5_devcom_comp_set_ready(slave_priv->devcom, true);
218+ mlx5_devcom_comp_set_ready(master_priv->devcom, true);
219219 break;
220220 case MPV_DEVCOM_MASTER_DOWN:
221221 /* no need for comp set ready false since we unregister after
drivers/net/ethernet/mellanox/mlx5/core/esw/acl/helper.c+1−1
@@ -71,7 +71,7 @@ int esw_egress_acl_vlan_create(struct mlx5_eswitch *esw, · 70 unmodified lines
7171 flow_act.action = flow_action;
7272 vport->egress.allowed_vlan =
7373 mlx5_add_flow_rules(vport->egress.acl, spec,
74− &flow_act, fwd_dest, 0);
74+ &flow_act, fwd_dest, fwd_dest ? 1 : 0);
7575 if (IS_ERR(vport->egress.allowed_vlan)) {
7676 err = PTR_ERR(vport->egress.allowed_vlan);
7777 esw_warn(esw->dev,
drivers/net/ethernet/mellanox/mlx5/core/port.c+2−2
@@ -314,7 +314,7 @@ static int mlx5_query_module_id(struct mlx5_core_dev *dev, int module_num, · 313 unmodified lines
314314 return -EIO;
315315 }
316316
317− ptr = MLX5_ADDR_OF(mcia_reg, out, dword_0);
317+ ptr = MLX5_ADDR_OF(mcia_reg, out, dwords);
318318
319319 *module_id = ptr[0];
320320
@@ -399,7 +399,7 @@ static int mlx5_query_mcia(struct mlx5_core_dev *dev, · 78 unmodified lines
399399 return -EIO;
400400 }
401401
402− ptr = MLX5_ADDR_OF(mcia_reg, out, dword_0);
402+ ptr = MLX5_ADDR_OF(mcia_reg, out, dwords);
403403 memcpy(data, ptr, size);
404404
405405 return size;
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_resource.c+3−0
@@ -96,6 +96,9 @@ static int nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res) · 95 unmodified lines
9696 res->mutex =
9797 nfp_cpp_mutex_alloc(cpp,
9898 NFP_RESOURCE_TBL_TARGET, addr, key);
99+ if (!res->mutex)
100+ return -ENOMEM;
101+
99102 res->cpp_id = NFP_CPP_ID(entry.region.cpp_target,
100103 entry.region.cpp_action,
101104 entry.region.cpp_token);
drivers/net/ethernet/realtek/rtase/rtase.h+8−0
@@ -192,6 +192,12 @@ enum rtase_sw_flag_content { · 191 unmodified lines
192192 RTASE_SWF_MSIX_ENABLED = BIT(2),
193193 };
194194
195+enum rtase_parse_result {
196+ RTASE_PARSE_OK,
197+ RTASE_PARSE_SKIP,
198+ RTASE_PARSE_DROP,
199+};
200+
195201 #define RSVD_MASK 0x3FFFC000
196202
197203 struct rtase_tx_desc {
@@ -363,4 +369,6 @@ struct rtase_private { · 165 unmodified lines
363369
364370 #define RTASE_MSS_MASK GENMASK(28, 18)
365371
372+#define RTASE_MIN_PAD_LEN 47
373+
366374 #endif /* RTASE_H */
drivers/net/ethernet/realtek/rtase/rtase_main.c+197−0
@@ -61,6 +61,7 @@ · 60 unmodified lines
6161 #include <linux/pci.h>
6262 #include <linux/pm_runtime.h>
6363 #include <linux/prefetch.h>
64+#include <linux/ptp_classify.h>
6465 #include <linux/rtnetlink.h>
6566 #include <linux/tcp.h>
6667 #include <asm/irq.h>
@@ -1252,6 +1253,199 @@ static u32 rtase_tx_csum(struct sk_buff *skb, const struct net_device *dev) · 1185 unmodified lines
12521253 return csum_cmd;
12531254 }
12541255
1256+static enum rtase_parse_result rtase_get_l3_proto(struct sk_buff *skb,
1257+ __be16 *proto,
1258+ u32 *network_offset)
1259+{
1260+ struct vlan_hdr *vh, _vh;
1261+ struct ethhdr *eh, _eh;
1262+ u32 offset = ETH_HLEN;
1263+
1264+ eh = skb_header_pointer(skb, 0, sizeof(_eh), &_eh);
1265+ if (!eh)
1266+ return RTASE_PARSE_DROP;
1267+
1268+ *proto = eh->h_proto;
1269+
1270+ while (eth_type_vlan(*proto)) {
1271+ vh = skb_header_pointer(skb, offset, sizeof(_vh), &_vh);
1272+ if (!vh)
1273+ return RTASE_PARSE_DROP;
1274+
1275+ *proto = vh->h_vlan_encapsulated_proto;
1276+ offset += VLAN_HLEN;
1277+ }
1278+
1279+ *network_offset = offset;
1280+
1281+ return RTASE_PARSE_OK;
1282+}
1283+
1284+static bool rtase_pad_to_transport_len(struct sk_buff *skb,
1285+ u32 transport_offset,
1286+ u32 pad_to_len)
1287+{
1288+ u32 trans_data_len;
1289+ u32 pad_len;
1290+
1291+ trans_data_len = skb->len - transport_offset;
1292+ if (trans_data_len >= pad_to_len)
1293+ return true;
1294+
1295+ if (skb_is_nonlinear(skb)) {
1296+ if (skb_linearize(skb))
1297+ return false;
1298+ }
1299+
1300+ pad_len = pad_to_len - trans_data_len;
1301+ if (__skb_put_padto(skb, skb->len + pad_len, false))
1302+ return false;
1303+
1304+ return true;
1305+}
1306+
1307+static enum rtase_parse_result rtase_get_transport_offset(struct sk_buff *skb,
1308+ u32 *transport_offset,
1309+ u8 *transport_proto,
1310+ u32 *pad_to_len)
1311+{
1312+ enum rtase_parse_result ret;
1313+ struct ipv6hdr *i6h, _i6h;
1314+ struct iphdr *ih, _ih;
1315+ bool non_first_frag;
1316+ __be16 proto;
1317+ u32 offset;
1318+ u32 no;
1319+
1320+ ret = rtase_get_l3_proto(skb, &proto, &no);
1321+ if (ret != RTASE_PARSE_OK)
1322+ return ret;
1323+
1324+ switch (proto) {
1325+ case htons(ETH_P_IP):
1326+ ih = skb_header_pointer(skb, no, sizeof(_ih), &_ih);
1327+ if (!ih)
1328+ return RTASE_PARSE_DROP;
1329+
1330+ if (ih->ihl < 5)
1331+ return RTASE_PARSE_DROP;
1332+
1333+ offset = no + ih->ihl * 4;
1334+ if (offset > skb->len)
1335+ return RTASE_PARSE_DROP;
1336+
1337+ non_first_frag = ntohs(ih->frag_off) & IP_OFFSET;
1338+
1339+ if (ih->protocol == IPPROTO_TCP) {
1340+ if (skb->len - offset < sizeof(struct tcphdr)) {
1341+ if (non_first_frag) {
1342+ *transport_offset = offset;
1343+ *transport_proto = IPPROTO_TCP;
1344+ *pad_to_len = sizeof(struct tcphdr);
1345+
1346+ return RTASE_PARSE_OK;
1347+ }
1348+
1349+ return RTASE_PARSE_DROP;
1350+ }
1351+
1352+ return RTASE_PARSE_SKIP;
1353+ }
1354+
1355+ if (ih->protocol != IPPROTO_UDP)
1356+ return RTASE_PARSE_SKIP;
1357+
1358+ *transport_offset = offset;
1359+ *transport_proto = IPPROTO_UDP;
1360+
1361+ if (skb->len - offset < sizeof(struct udphdr)) {
1362+ if (non_first_frag) {
1363+ *pad_to_len = sizeof(struct udphdr);
1364+
1365+ return RTASE_PARSE_OK;
1366+ }
1367+
1368+ return RTASE_PARSE_DROP;
1369+ }
1370+
1371+ return RTASE_PARSE_OK;
1372+
1373+ case htons(ETH_P_IPV6):
1374+ i6h = skb_header_pointer(skb, no, sizeof(_i6h), &_i6h);
1375+ if (!i6h)
1376+ return RTASE_PARSE_DROP;
1377+
1378+ offset = no + sizeof(*i6h);
1379+
1380+ if (i6h->nexthdr == IPPROTO_TCP) {
1381+ if (skb->len - offset < sizeof(struct tcphdr))
1382+ return RTASE_PARSE_DROP;
1383+
1384+ return RTASE_PARSE_SKIP;
1385+ }
1386+
1387+ if (i6h->nexthdr != IPPROTO_UDP)
1388+ return RTASE_PARSE_SKIP;
1389+
1390+ if (skb->len - offset < sizeof(struct udphdr))
1391+ return RTASE_PARSE_DROP;
1392+
1393+ *transport_offset = offset;
1394+ *transport_proto = IPPROTO_UDP;
1395+
1396+ return RTASE_PARSE_OK;
1397+
1398+ default:
1399+ return RTASE_PARSE_SKIP;
1400+ }
1401+}
1402+
1403+static bool rtase_skb_pad(struct sk_buff *skb)
1404+{
1405+ enum rtase_parse_result ret;
1406+ u32 transport_offset;
1407+ __be16 *dest, _dest;
1408+ u32 trans_data_len;
1409+ u32 pad_to_len = 0;
1410+ u8 transport_proto;
1411+ u16 dest_port;
1412+
1413+ ret = rtase_get_transport_offset(skb, &transport_offset,
1414+ &transport_proto, &pad_to_len);
1415+ if (ret == RTASE_PARSE_SKIP) {
1416+ return true;
1417+ } else if (ret == RTASE_PARSE_DROP) {
1418+ netdev_dbg(skb->dev, "drop malformed packet\n");
1419+ return false;
1420+ }
1421+
1422+ if (pad_to_len &&
1423+ !rtase_pad_to_transport_len(skb, transport_offset, pad_to_len))
1424+ return false;
1425+
1426+ if (transport_proto != IPPROTO_UDP)
1427+ return true;
1428+
1429+ trans_data_len = skb->len - transport_offset;
1430+ if (trans_data_len < offsetof(struct udphdr, len) ||
1431+ trans_data_len >= RTASE_MIN_PAD_LEN)
1432+ return true;
1433+
1434+ dest = skb_header_pointer(skb,
1435+ transport_offset +
1436+ offsetof(struct udphdr, dest),
1437+ sizeof(_dest), &_dest);
1438+ if (!dest)
1439+ return true;
1440+
1441+ dest_port = ntohs(*dest);
1442+ if (dest_port != PTP_EV_PORT && dest_port != PTP_GEN_PORT)
1443+ return true;
1444+
1445+ return rtase_pad_to_transport_len(skb, transport_offset,
1446+ RTASE_MIN_PAD_LEN);
1447+}
1448+
12551449 static int rtase_xmit_frags(struct rtase_ring *ring, struct sk_buff *skb,
12561450 u32 opts1, u32 opts2)
12571451 {
@@ -1365,6 +1559,9 @@ static netdev_tx_t rtase_start_xmit(struct sk_buff *skb, · 107 unmodified lines
13651559 opts2 |= rtase_tx_csum(skb, dev);
13661560 }
13671561
1562+ if (!rtase_skb_pad(skb))
1563+ goto err_dma_0;
1564+
13681565 frags = rtase_xmit_frags(ring, skb, opts1, opts2);
13691566 if (unlikely(frags < 0))
13701567 goto err_dma_0;
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c+31−0
@@ -525,6 +525,32 @@ static int intel_set_reg_access(const struct pmc_serdes_regs *regs, int max_regs · 524 unmodified lines
525525 return ret;
526526 }
527527
528+/*
529+ * Return true if the SerDes lane rate must change to serve @interface.
530+ * If the current rate cannot be determined, reconfigure as before.
531+ */
532+static bool intel_serdes_needs_reconfig(struct stmmac_priv *priv,
533+ struct intel_priv_data *intel_priv,
534+ phy_interface_t interface)
535+{
536+ u32 cur_rate, want_rate;
537+ int data;
538+
539+ if (!intel_priv->mdio_adhoc_addr)
540+ return true;
541+
542+ data = mdiobus_read(priv->mii, intel_priv->mdio_adhoc_addr,
543+ SERDES_GCR0);
544+ if (data < 0)
545+ return true;
546+
547+ cur_rate = (data & SERDES_RATE_MASK) >> SERDES_RATE_PCIE_SHIFT;
548+ want_rate = interface == PHY_INTERFACE_MODE_2500BASEX ?
549+ SERDES_RATE_PCIE_GEN2 : SERDES_RATE_PCIE_GEN1;
550+
551+ return cur_rate != want_rate;
552+}
553+
528554 static int intel_mac_finish(struct net_device *ndev,
529555 void *intel_data,
530556 unsigned int mode,
@@ -536,6 +562,11 @@ static int intel_mac_finish(struct net_device *ndev, · 5 unmodified lines
536562 int max_regs = 0;
537563 int ret = 0;
538564
565+ if (!intel_serdes_needs_reconfig(priv, intel_priv, interface)) {
566+ priv->plat->phy_interface = interface;
567+ return 0;
568+ }
569+
539570 ret = intel_tsn_lane_is_available(ndev, intel_priv);
540571 if (ret < 0) {
541572 netdev_info(priv->dev, "No TSN lane available to set the registers.\n");
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c+24−0
@@ -106,6 +106,17 @@ static void dwmac4_dma_init_channel(struct stmmac_priv *priv, · 105 unmodified lines
106106 ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
107107 }
108108
109+static void dwmac4_dma_deinit_channel(struct stmmac_priv *priv,
110+ void __iomem *ioaddr, u32 chan)
111+{
112+ const struct dwmac4_addrs *dwmac4_addrs = priv->plat->dwmac4_addrs;
113+ u32 value;
114+
115+ value = readl(ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
116+ value &= ~DMA_CHAN_INTR_DEFAULT_MASK;
117+ writel(value, ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
118+}
119+
109120 static void dwmac410_dma_init_channel(struct stmmac_priv *priv,
110121 void __iomem *ioaddr,
111122 struct stmmac_dma_cfg *dma_cfg, u32 chan)
@@ -125,6 +136,17 @@ static void dwmac410_dma_init_channel(struct stmmac_priv *priv, · 13 unmodified lines
125136 ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
126137 }
127138
139+static void dwmac410_dma_deinit_channel(struct stmmac_priv *priv,
140+ void __iomem *ioaddr, u32 chan)
141+{
142+ const struct dwmac4_addrs *dwmac4_addrs = priv->plat->dwmac4_addrs;
143+ u32 value;
144+
145+ value = readl(ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
146+ value &= ~DMA_CHAN_INTR_DEFAULT_MASK_4_10;
147+ writel(value, ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
148+}
149+
128150 static void dwmac4_dma_init(void __iomem *ioaddr,
129151 struct stmmac_dma_cfg *dma_cfg)
130152 {
@@ -548,6 +570,7 @@ const struct stmmac_dma_ops dwmac4_dma_ops = { · 417 unmodified lines
548570 .reset = dwmac4_dma_reset,
549571 .init = dwmac4_dma_init,
550572 .init_chan = dwmac4_dma_init_channel,
573+ .deinit_chan = dwmac4_dma_deinit_channel,
551574 .init_rx_chan = dwmac4_dma_init_rx_chan,
552575 .init_tx_chan = dwmac4_dma_init_tx_chan,
553576 .axi = dwmac4_dma_axi,
@@ -577,6 +600,7 @@ const struct stmmac_dma_ops dwmac410_dma_ops = { · 23 unmodified lines
577600 .reset = dwmac4_dma_reset,
578601 .init = dwmac4_dma_init,
579602 .init_chan = dwmac410_dma_init_channel,
603+ .deinit_chan = dwmac410_dma_deinit_channel,
580604 .init_rx_chan = dwmac4_dma_init_rx_chan,
581605 .init_tx_chan = dwmac4_dma_init_tx_chan,
582606 .axi = dwmac4_dma_axi,
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c+16−12
@@ -1370,36 +1370,40 @@ static int dwxgmac2_config_l4_filter(struct mac_device_info *hw, u32 filter_no, · 1369 unmodified lines
13701370 value &= ~XGMAC_L4PEN0;
13711371 }
13721372
1373− value &= ~(XGMAC_L4SPM0 | XGMAC_L4SPIM0);
1374− value &= ~(XGMAC_L4DPM0 | XGMAC_L4DPIM0);
13751373 if (sa) {
13761374 value |= XGMAC_L4SPM0;
13771375 if (inv)
13781376 value |= XGMAC_L4SPIM0;
1377+ else
1378+ value &= ~XGMAC_L4SPIM0;
13791379 } else {
13801380 value |= XGMAC_L4DPM0;
13811381 if (inv)
13821382 value |= XGMAC_L4DPIM0;
1383+ else
1384+ value &= ~XGMAC_L4DPIM0;
13831385 }
13841386
13851387 ret = dwxgmac2_filter_write(hw, filter_no, XGMAC_L3L4_CTRL, value);
13861388 if (ret)
13871389 return ret;
13881390
1389− if (sa) {
1390− value = FIELD_PREP(XGMAC_L4SP0, match);
1391+ ret = dwxgmac2_filter_read(hw, filter_no, XGMAC_L4_ADDR, &value);
1392+ if (ret)
1393+ return ret;
13911394
1392− ret = dwxgmac2_filter_write(hw, filter_no, XGMAC_L4_ADDR, value);
1393− if (ret)
1394− return ret;
1395+ if (sa) {
1396+ value &= ~XGMAC_L4SP0;
1397+ value |= FIELD_PREP(XGMAC_L4SP0, match);
13951398 } else {
1396− value = FIELD_PREP(XGMAC_L4DP0, match);
1397−
1398− ret = dwxgmac2_filter_write(hw, filter_no, XGMAC_L4_ADDR, value);
1399− if (ret)
1400− return ret;
1399+ value &= ~XGMAC_L4DP0;
1400+ value |= FIELD_PREP(XGMAC_L4DP0, match);
14011401 }
14021402
1403+ ret = dwxgmac2_filter_write(hw, filter_no, XGMAC_L4_ADDR, value);
1404+ if (ret)
1405+ return ret;
1406+
14031407 if (!en)
14041408 return dwxgmac2_filter_write(hw, filter_no, XGMAC_L3L4_CTRL, 0);
14051409
drivers/net/ethernet/stmicro/stmmac/hwif.h+4−0
@@ -170,6 +170,8 @@ struct stmmac_dma_ops { · 169 unmodified lines
170170 void (*init)(void __iomem *ioaddr, struct stmmac_dma_cfg *dma_cfg);
171171 void (*init_chan)(struct stmmac_priv *priv, void __iomem *ioaddr,
172172 struct stmmac_dma_cfg *dma_cfg, u32 chan);
173+ void (*deinit_chan)(struct stmmac_priv *priv, void __iomem *ioaddr,
174+ u32 chan);
173175 void (*init_rx_chan)(struct stmmac_priv *priv, void __iomem *ioaddr,
174176 struct stmmac_dma_cfg *dma_cfg,
175177 dma_addr_t phy, u32 chan);
@@ -235,6 +237,8 @@ struct stmmac_dma_ops { · 59 unmodified lines
235237 stmmac_do_void_callback(__priv, dma, init, __args)
236238 #define stmmac_init_chan(__priv, __args...) \
237239 stmmac_do_void_callback(__priv, dma, init_chan, __priv, __args)
240+#define stmmac_deinit_chan(__priv, __args...) \
241+ stmmac_do_void_callback(__priv, dma, deinit_chan, __priv, __args)
238242 #define stmmac_init_rx_chan(__priv, __args...) \
239243 stmmac_do_void_callback(__priv, dma, init_rx_chan, __priv, __args)
240244 #define stmmac_init_tx_chan(__priv, __args...) \
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+41−55
@@ -1083,63 +1083,45 @@ static void stmmac_mac_link_up(struct phylink_config *config, · 1082 unmodified lines
10831083 old_ctrl = readl(priv->ioaddr + MAC_CTRL_REG);
10841084 ctrl = old_ctrl & ~priv->hw->link.speed_mask;
10851085
1086− if (interface == PHY_INTERFACE_MODE_USXGMII) {
1087− switch (speed) {
1088− case SPEED_10000:
1089− ctrl |= priv->hw->link.xgmii.speed10000;
1090− break;
1091− case SPEED_5000:
1092− ctrl |= priv->hw->link.xgmii.speed5000;
1093− break;
1094− case SPEED_2500:
1086+ switch (speed) {
1087+ case SPEED_100000:
1088+ ctrl |= priv->hw->link.xlgmii.speed100000;
1089+ break;
1090+ case SPEED_50000:
1091+ ctrl |= priv->hw->link.xlgmii.speed50000;
1092+ break;
1093+ case SPEED_40000:
1094+ ctrl |= priv->hw->link.xlgmii.speed40000;
1095+ break;
1096+ case SPEED_25000:
1097+ ctrl |= priv->hw->link.xlgmii.speed25000;
1098+ break;
1099+ case SPEED_10000:
1100+ ctrl |= priv->hw->link.xgmii.speed10000;
1101+ break;
1102+ case SPEED_5000:
1103+ ctrl |= priv->hw->link.xgmii.speed5000;
1104+ break;
1105+ case SPEED_2500:
1106+ if (interface == PHY_INTERFACE_MODE_USXGMII)
10951107 ctrl |= priv->hw->link.xgmii.speed2500;
1096− break;
1097− default:
1098− return;
1099− }
1100− } else if (interface == PHY_INTERFACE_MODE_XLGMII) {
1101− switch (speed) {
1102− case SPEED_100000:
1103− ctrl |= priv->hw->link.xlgmii.speed100000;
1104− break;
1105− case SPEED_50000:
1106− ctrl |= priv->hw->link.xlgmii.speed50000;
1107− break;
1108− case SPEED_40000:
1109− ctrl |= priv->hw->link.xlgmii.speed40000;
1110− break;
1111− case SPEED_25000:
1112− ctrl |= priv->hw->link.xlgmii.speed25000;
1113− break;
1114− case SPEED_10000:
1115− ctrl |= priv->hw->link.xgmii.speed10000;
1116− break;
1117− case SPEED_2500:
1118− ctrl |= priv->hw->link.speed2500;
1119− break;
1120− case SPEED_1000:
1121− ctrl |= priv->hw->link.speed1000;
1122− break;
1123− default:
1124− return;
1125− }
1126− } else {
1127− switch (speed) {
1128− case SPEED_2500:
1108+ else
11291109 ctrl |= priv->hw->link.speed2500;
1130− break;
1131− case SPEED_1000:
1132− ctrl |= priv->hw->link.speed1000;
1133− break;
1134− case SPEED_100:
1135− ctrl |= priv->hw->link.speed100;
1136− break;
1137− case SPEED_10:
1138− ctrl |= priv->hw->link.speed10;
1139− break;
1140− default:
1141− return;
1142− }
1110+ break;
1111+ case SPEED_1000:
1112+ ctrl |= priv->hw->link.speed1000;
1113+ break;
1114+ case SPEED_100:
1115+ ctrl |= priv->hw->link.speed100;
1116+ break;
1117+ case SPEED_10:
1118+ ctrl |= priv->hw->link.speed10;
1119+ break;
1120+ default:
1121+ netdev_err(priv->dev,
1122+ "unsupported speed %s on %s, leaving the MAC disabled\n",
1123+ phy_speed_to_str(speed), phy_modes(interface));
1124+ return;
11431125 }
11441126
11451127 if (priv->plat->fix_mac_speed)
@@ -2560,6 +2542,7 @@ static void stmmac_stop_all_dma(struct stmmac_priv *priv) · 1414 unmodified lines
25602542 {
25612543 u8 rx_channels_count = priv->plat->rx_queues_to_use;
25622544 u8 tx_channels_count = priv->plat->tx_queues_to_use;
2545+ u8 dma_csr_ch = max(rx_channels_count, tx_channels_count);
25632546 u8 chan;
25642547
25652548 for (chan = 0; chan < rx_channels_count; chan++)
@@ -2567,6 +2550,9 @@ static void stmmac_stop_all_dma(struct stmmac_priv *priv) · 1 unmodified line
25672550
25682551 for (chan = 0; chan < tx_channels_count; chan++)
25692552 stmmac_stop_tx_dma(priv, chan);
2553+
2554+ for (chan = 0; chan < dma_csr_ch; chan++)
2555+ stmmac_deinit_chan(priv, priv->ioaddr, chan);
25702556 }
25712557
25722558 /**
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c+35−0
@@ -446,6 +446,7 @@ static int tc_parse_flow_actions(struct stmmac_priv *priv, · 445 unmodified lines
446446 }
447447
448448 #define ETHER_TYPE_FULL_MASK cpu_to_be16(~0)
449+#define IP_PROTO_FULL_MASK 0xFF
449450
450451 static int tc_add_basic_flow(struct stmmac_priv *priv,
451452 struct flow_cls_offload *cls,
@@ -461,6 +462,37 @@ static int tc_add_basic_flow(struct stmmac_priv *priv, · 9 unmodified lines
461462
462463 flow_rule_match_basic(rule, &match);
463464
465+ /* Both network proto and transport proto not present in the key */
466+ if (!match.mask || !(match.mask->n_proto || match.mask->ip_proto)) {
467+ NL_SET_ERR_MSG_MOD(cls->common.extack,
468+ "filter must specify network or transport protocol");
469+ return -EOPNOTSUPP;
470+ }
471+
472+ /* If the proto is present in the key and is not full mask */
473+ if ((match.mask->n_proto && match.mask->n_proto != ETHER_TYPE_FULL_MASK) ||
474+ (match.mask->ip_proto && match.mask->ip_proto != IP_PROTO_FULL_MASK)) {
475+ NL_SET_ERR_MSG_MOD(cls->common.extack,
476+ "only full protocol mask is supported");
477+ return -EOPNOTSUPP;
478+ }
479+
480+ /* Network proto is present in the key and is not IPv4 */
481+ if (match.mask->n_proto && match.key->n_proto != cpu_to_be16(ETH_P_IP)) {
482+ NL_SET_ERR_MSG_MOD(cls->common.extack,
483+ "only IPv4 network protocol is supported");
484+ return -EOPNOTSUPP;
485+ }
486+
487+ /* Transport proto is present in the key and is not TCP or UDP */
488+ if (match.mask->ip_proto &&
489+ match.key->ip_proto != IPPROTO_TCP &&
490+ match.key->ip_proto != IPPROTO_UDP) {
491+ NL_SET_ERR_MSG_MOD(cls->common.extack,
492+ "only TCP and UDP transport protocols are supported");
493+ return -EOPNOTSUPP;
494+ }
495+
464496 entry->ip_proto = match.key->ip_proto;
465497 return 0;
466498 }
@@ -598,6 +630,8 @@ static int tc_add_flow(struct stmmac_priv *priv, · 131 unmodified lines
598630 ret = tc_flow_parsers[i].fn(priv, cls, entry);
599631 if (!ret)
600632 entry->in_use = true;
633+ else if (ret == -EOPNOTSUPP)
634+ return ret;
601635 }
602636
603637 if (!entry->in_use)
@@ -627,6 +661,7 @@ static int tc_del_flow(struct stmmac_priv *priv, · 23 unmodified lines
627661 entry->in_use = false;
628662 entry->cookie = 0;
629663 entry->is_l4 = false;
664+ entry->action = 0;
630665 return ret;
631666 }
632667
drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c+4−2
@@ -96,11 +96,13 @@ int txgbe_read_eeprom_hostif(struct wx *wx, · 95 unmodified lines
9696 dword_len = round_up(length, 4) >> 2;
9797
9898 for (i = 0; i < dword_len; i++) {
99+ u32 copy_len = min_t(u32, 4, length - i * 4);
100+
99101 value = rd32a(wx, WX_FW2SW_MBOX, i + offset);
100102 le32_to_cpus(&value);
101103
102− memcpy(data, &value, 4);
103− data += 4;
104+ memcpy(data, &value, copy_len);
105+ data += copy_len;
104106 }
105107
106108 return 0;
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c+1−0
@@ -945,6 +945,7 @@ static void txgbe_remove(struct pci_dev *pdev) · 944 unmodified lines
945945 netdev = wx->netdev;
946946 wx_disable_sriov(wx);
947947 unregister_netdev(netdev);
948+ txgbe_fdir_filter_exit(wx);
948949
949950 timer_shutdown_sync(&wx->service_timer);
950951 cancel_work_sync(&wx->service_task);
drivers/net/geneve.c+24−3
@@ -43,8 +43,17 @@ MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN"); · 42 unmodified lines
4343 #define GENEVE_OPT_GRO_HINT_LEN 1
4444
4545 struct geneve_opt_gro_hint {
46+#if defined(__LITTLE_ENDIAN_BITFIELD)
4647 u8 inner_proto_id:2,
47− nested_is_v6:1;
48+ nested_is_v6:1,
49+ rsvd:5;
50+#elif defined(__BIG_ENDIAN_BITFIELD)
51+ u8 rsvd:5,
52+ nested_is_v6:1,
53+ inner_proto_id:2;
54+#else
55+#error "Please fix <asm/byteorder.h>"
56+#endif
4857 u8 nested_nh_offset;
4958 u8 nested_tp_offset;
5059 u8 nested_hdr_len;
@@ -577,6 +586,7 @@ static int geneve_post_decap_hint(const struct sock *sk, struct sk_buff *skb, · 526 unmodified lines
577586 struct iphdr *iph;
578587 struct udphdr *uh;
579588 __be16 p;
589+ int err;
580590
581591 hint_off = geneve_sk_gro_hint_off(sk, *geneveh, &p, &len);
582592 if (!hint_off)
@@ -601,12 +611,20 @@ static int geneve_post_decap_hint(const struct sock *sk, struct sk_buff *skb, · 18 unmodified lines
601611 !geneve_opt_gro_hint_validate(skb->data, gro_hint)))
602612 return -EINVAL;
603613
604− ipv6h = (void *)skb->data + gro_hint->nested_nh_offset;
605− iph = (struct iphdr *)ipv6h;
606614 total_len = skb->len - gro_hint->nested_nh_offset;
607615 if (total_len >= GRO_LEGACY_MAX_SIZE)
608616 return -E2BIG;
609617
618+ err = skb_ensure_writable(skb, gro_hint->nested_tp_offset + sizeof(*uh));
619+ if (unlikely(err))
620+ return err;
621+
622+ *geneveh = geneve_hdr(skb);
623+ gro_hint = geneve_opt_gro_hint(*geneveh, hint_off);
624+
625+ ipv6h = (void *)skb->data + gro_hint->nested_nh_offset;
626+ iph = (struct iphdr *)ipv6h;
627+
610628 /*
611629 * After stripping the outer encap, the packet still carries a
612630 * tunnel encapsulation: the nested one.
@@ -2376,6 +2394,9 @@ static int geneve_changelink(struct net_device *dev, struct nlattr *tb[], · 1763 unmodified lines
23762394 struct geneve_config cfg;
23772395 int err;
23782396
2397+ if (!rtnl_dev_link_net_capable(dev, geneve->net))
2398+ return -EPERM;
2399+
23792400 /* If the geneve device is configured for metadata (or externally
23802401 * controlled, for example, OVS), then nothing can be changed.
23812402 */
drivers/net/gtp.c+9−8
@@ -669,8 +669,9 @@ static int gtp1u_send_echo_resp(struct gtp_dev *gtp, struct sk_buff *skb) · 668 unmodified lines
669669 return -1;
670670
671671 /* pull GTP and UDP headers */
672− skb_pull_data(skb,
673− sizeof(struct gtp1_header_long) + sizeof(struct udphdr));
672+ if (!skb_pull_data(skb, sizeof(struct gtp1_header_long) +
673+ sizeof(struct udphdr)))
674+ return -1;
674675
675676 gtp_pkt = skb_push(skb, sizeof(struct gtp1u_packet));
676677 memset(gtp_pkt, 0, sizeof(struct gtp1u_packet));
@@ -826,13 +827,17 @@ static int gtp1u_udp_encap_recv(struct gtp_dev *gtp, struct sk_buff *skb) · 149 unmodified lines
826827 if (!pskb_may_pull(skb, hdrlen))
827828 return -1;
828829
830+ gtp1 = (struct gtp1_header *)(skb->data + sizeof(struct udphdr));
831+
832+ if (gtp1->flags & GTP1_F_EXTHDR &&
833+ gtp_parse_exthdrs(skb, &hdrlen) < 0)
834+ return -1;
835+
829836 if (gtp_inner_proto(skb, hdrlen, &inner_proto) < 0) {
830837 netdev_dbg(gtp->dev, "GTP packet does not encapsulate an IP packet\n");
831838 return -1;
832839 }
833840
834− gtp1 = (struct gtp1_header *)(skb->data + sizeof(struct udphdr));
835−
836841 pctx = gtp1_pdp_find(gtp, ntohl(gtp1->tid),
837842 gtp_proto_to_family(inner_proto));
838843 if (!pctx) {
@@ -840,10 +845,6 @@ static int gtp1u_udp_encap_recv(struct gtp_dev *gtp, struct sk_buff *skb) · 1 unmodified line
840845 return 1;
841846 }
842847
843− if (gtp1->flags & GTP1_F_EXTHDR &&
844− gtp_parse_exthdrs(skb, &hdrlen) < 0)
845− return -1;
846−
847848 return gtp_rx(pctx, skb, hdrlen, gtp->role, inner_proto);
848849 }
849850
drivers/net/mctp/mctp-i3c.c+7−4
@@ -731,18 +731,21 @@ static __init int mctp_i3c_mod_init(void) · 730 unmodified lines
731731 int rc;
732732
733733 rc = i3c_register_notifier(&mctp_i3c_notifier);
734− if (rc < 0) {
735− i3c_driver_unregister(&mctp_i3c_driver);
734+ if (rc < 0)
736735 return rc;
737− }
738736
739737 i3c_for_each_bus_locked(mctp_i3c_bus_add_new, NULL);
740738
741739 rc = i3c_driver_register(&mctp_i3c_driver);
742740 if (rc < 0)
743− return rc;
741+ goto err_unregister_notifier;
744742
745743 return 0;
744+
745+err_unregister_notifier:
746+ i3c_unregister_notifier(&mctp_i3c_notifier);
747+ mctp_i3c_bus_remove_all();
748+ return rc;
746749 }
747750
748751 static __exit void mctp_i3c_mod_exit(void)
drivers/net/mctp/mctp-serial.c+1−1
@@ -318,7 +318,7 @@ static void mctp_serial_push_header(struct mctp_serial *dev, u8 c) · 317 unmodified lines
318318 } else {
319319 dev->rxlen = c;
320320 dev->rxpos = 0;
321− dev->rxstate = STATE_DATA;
321+ dev->rxstate = c > 0 ? STATE_DATA : STATE_TRAILER;
322322 dev->rxfcs = crc_ccitt_byte(dev->rxfcs, c);
323323 }
324324 break;
drivers/net/ovpn/io.c+2−2
@@ -142,7 +142,7 @@ void ovpn_decrypt_post(void *data, int ret) · 141 unmodified lines
142142 }
143143
144144 /* keep track of last received authenticated packet for keepalive */
145− WRITE_ONCE(peer->last_recv, ktime_get_real_seconds());
145+ WRITE_ONCE(peer->last_recv, ktime_get_boottime_seconds());
146146
147147 rcu_read_lock();
148148 sock = rcu_dereference(peer->sock);
@@ -294,7 +294,7 @@ void ovpn_encrypt_post(void *data, int ret) · 145 unmodified lines
294294
295295 ovpn_peer_stats_increment_tx(&peer->link_stats, orig_len);
296296 /* keep track of last sent packet for keepalive */
297− WRITE_ONCE(peer->last_sent, ktime_get_real_seconds());
297+ WRITE_ONCE(peer->last_sent, ktime_get_boottime_seconds());
298298 /* skb passed down the stack - don't free it */
299299 skb = NULL;
300300 err_unlock:
drivers/net/ovpn/peer.c+9−7
@@ -26,11 +26,12 @@ static void unlock_ovpn(struct ovpn_priv *ovpn, · 25 unmodified lines
2626 struct llist_head *release_list)
2727 __releases(&ovpn->lock)
2828 {
29− struct ovpn_peer *peer;
29+ struct ovpn_peer *peer, *next;
3030
3131 spin_unlock_bh(&ovpn->lock);
3232
33− llist_for_each_entry(peer, release_list->first, release_entry) {
33+ llist_for_each_entry_safe(peer, next, release_list->first,
34+ release_entry) {
3435 ovpn_socket_release(peer);
3536 ovpn_peer_put(peer);
3637 }
@@ -44,7 +45,7 @@ static void unlock_ovpn(struct ovpn_priv *ovpn, · 7 unmodified lines
4445 */
4546 void ovpn_peer_keepalive_set(struct ovpn_peer *peer, u32 interval, u32 timeout)
4647 {
47− time64_t now = ktime_get_real_seconds();
48+ time64_t now = ktime_get_boottime_seconds();
4849
4950 netdev_dbg(peer->ovpn->dev,
5051 "scheduling keepalive for peer %u: interval=%u timeout=%u\n",
@@ -1167,7 +1168,6 @@ static void ovpn_peer_release_p2p(struct ovpn_priv *ovpn, struct sock *sk, · 1116 unmodified lines
11671168 ovpn_sock = rcu_access_pointer(peer->sock);
11681169 if (!ovpn_sock || ovpn_sock->sk != sk) {
11691170 spin_unlock_bh(&ovpn->lock);
1170− ovpn_peer_put(peer);
11711171 return;
11721172 }
11731173 }
@@ -1285,8 +1285,10 @@ static time64_t ovpn_peer_keepalive_work_single(struct ovpn_peer *peer, · 111 unmodified lines
12851285 netdev_dbg(peer->ovpn->dev,
12861286 "sending keepalive to peer %u\n",
12871287 peer->id);
1288− if (schedule_work(&peer->keepalive_work))
1289− ovpn_peer_hold(peer);
1288+ if (WARN_ON(!ovpn_peer_hold(peer)))
1289+ return 0;
1290+ if (!schedule_work(&peer->keepalive_work))
1291+ ovpn_peer_put(peer);
12901292 }
12911293
12921294 if (next_run1 < next_run2)
@@ -1357,7 +1359,7 @@ void ovpn_peer_keepalive_work(struct work_struct *work) · 64 unmodified lines
13571359 {
13581360 struct ovpn_priv *ovpn = container_of(work, struct ovpn_priv,
13591361 keepalive_work.work);
1360− time64_t next_run = 0, now = ktime_get_real_seconds();
1362+ time64_t next_run = 0, now = ktime_get_boottime_seconds();
13611363 LLIST_HEAD(release_list);
13621364
13631365 spin_lock_bh(&ovpn->lock);
drivers/net/ovpn/tcp.c+4−2
@@ -151,7 +151,8 @@ err: · 150 unmodified lines
151151 /* take reference for deferred peer deletion. should never fail */
152152 if (WARN_ON(!ovpn_peer_hold(peer)))
153153 goto err_nopeer;
154− schedule_work(&peer->tcp.defer_del_work);
154+ if (!schedule_work(&peer->tcp.defer_del_work))
155+ ovpn_peer_put(peer);
155156 ovpn_dev_dstats_rx_dropped(peer->ovpn->dev);
156157 err_nopeer:
157158 kfree_skb(skb);
@@ -283,7 +284,8 @@ static void ovpn_tcp_send_sock(struct ovpn_peer *peer, struct sock *sk) · 125 unmodified lines
283284 * stream therefore we abort the connection
284285 */
285286 ovpn_peer_hold(peer);
286− schedule_work(&peer->tcp.defer_del_work);
287+ if (!schedule_work(&peer->tcp.defer_del_work))
288+ ovpn_peer_put(peer);
287289
288290 /* we bail out immediately and keep tx_in_progress set
289291 * to true. This way we prevent more TX attempts
drivers/net/pcs/pcs-xpcs.c+7−25
@@ -1058,6 +1058,7 @@ static int xpcs_get_state_c37_sgmii(struct dw_xpcs *xpcs, · 1057 unmodified lines
10581058
10591059 /* Reset link_state */
10601060 state->link = false;
1061+ state->an_complete = false;
10611062 state->speed = SPEED_UNKNOWN;
10621063 state->duplex = DUPLEX_UNKNOWN;
10631064 state->pause = 0;
@@ -1069,6 +1070,8 @@ static int xpcs_get_state_c37_sgmii(struct dw_xpcs *xpcs, · 5 unmodified lines
10691070 if (ret < 0)
10701071 return ret;
10711072
1073+ state->an_complete = ret & DW_VR_MII_AN_STS_C37_ANCMPLT_INTR;
1074+
10721075 if (ret & DW_VR_MII_C37_ANSGM_SP_LNKSTS) {
10731076 int speed_value;
10741077
@@ -1086,34 +1089,13 @@ static int xpcs_get_state_c37_sgmii(struct dw_xpcs *xpcs, · 11 unmodified lines
10861089 state->duplex = DUPLEX_FULL;
10871090 else
10881091 state->duplex = DUPLEX_HALF;
1089− } else if (ret == DW_VR_MII_AN_STS_C37_ANCMPLT_INTR) {
1090− int speed, duplex;
1091−
1092− state->link = true;
1093−
1094− speed = xpcs_read(xpcs, MDIO_MMD_VEND2, MII_BMCR);
1095− if (speed < 0)
1096− return speed;
1097−
1098− speed &= BMCR_SPEED100 | BMCR_SPEED1000;
1099− if (speed == BMCR_SPEED1000)
1100− state->speed = SPEED_1000;
1101− else if (speed == BMCR_SPEED100)
1102− state->speed = SPEED_100;
1103− else if (speed == 0)
1104− state->speed = SPEED_10;
1105−
1106− duplex = xpcs_read(xpcs, MDIO_MMD_VEND2, MII_ADVERTISE);
1107− if (duplex < 0)
1108− return duplex;
11091092
1110− if (duplex & ADVERTISE_1000XFULL)
1111− state->duplex = DUPLEX_FULL;
1112− else if (duplex & ADVERTISE_1000XHALF)
1113− state->duplex = DUPLEX_HALF;
1093+ return 0;
1094+ }
11141095
1096+ /* Clear AN complete status or interrupt */
1097+ if (state->an_complete)
11151098 xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_AN_INTR_STS, 0);
1116− }
11171099
11181100 return 0;
11191101 }
drivers/net/phy/marvell.c+1−1
@@ -753,7 +753,7 @@ static int m88e1111_config_inband(struct phy_device *phydev, unsigned int modes) · 752 unmodified lines
753753 err = phy_modify(phydev, MII_M1111_PHY_EXT_SR,
754754 MII_M1111_HWCFG_SERIAL_AN_BYPASS, extsr);
755755 if (err < 0)
756− return extsr;
756+ return err;
757757
758758 return phy_modify_paged(phydev, MII_MARVELL_FIBER_PAGE, MII_BMCR,
759759 BMCR_ANENABLE, bmcr);
drivers/net/ppp/ppp_generic.c+44−38
@@ -810,7 +810,9 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 809 unmodified lines
810810 case PPPIOCSMRU:
811811 if (get_user(val, p))
812812 break;
813+ ppp_recv_lock(ppp);
813814 ppp->mru = val;
815+ ppp_recv_unlock(ppp);
814816 err = 0;
815817 break;
816818
@@ -831,7 +833,9 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 14 unmodified lines
831833 break;
832834
833835 case PPPIOCGFLAGS:
836+ ppp_lock(ppp);
834837 val = ppp->flags | ppp->xstate | ppp->rstate;
838+ ppp_unlock(ppp);
835839 if (put_user(val, p))
836840 break;
837841 err = 0;
@@ -855,7 +859,7 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 17 unmodified lines
855859 case PPPIOCSDEBUG:
856860 if (get_user(val, p))
857861 break;
858− ppp->debug = val;
862+ WRITE_ONCE(ppp->debug, val);
859863 err = 0;
860864 break;
861865
@@ -866,16 +870,16 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 4 unmodified lines
866870 break;
867871
868872 case PPPIOCGIDLE32:
869− idle32.xmit_idle = (jiffies - ppp->last_xmit) / HZ;
870− idle32.recv_idle = (jiffies - ppp->last_recv) / HZ;
871− if (copy_to_user(argp, &idle32, sizeof(idle32)))
873+ idle32.xmit_idle = max(0L, (long)(jiffies - READ_ONCE(ppp->last_xmit))) / HZ;
874+ idle32.recv_idle = max(0L, (long)(jiffies - READ_ONCE(ppp->last_recv))) / HZ;
875+ if (copy_to_user(argp, &idle32, sizeof(idle32)))
872876 break;
873877 err = 0;
874878 break;
875879
876880 case PPPIOCGIDLE64:
877− idle64.xmit_idle = (jiffies - ppp->last_xmit) / HZ;
878− idle64.recv_idle = (jiffies - ppp->last_recv) / HZ;
881+ idle64.xmit_idle = max(0L, (long)(jiffies - READ_ONCE(ppp->last_xmit))) / HZ;
882+ idle64.recv_idle = max(0L, (long)(jiffies - READ_ONCE(ppp->last_recv))) / HZ;
879883 if (copy_to_user(argp, &idle64, sizeof(idle64)))
880884 break;
881885 err = 0;
@@ -916,7 +920,7 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 34 unmodified lines
916920 if (copy_to_user(argp, &npi, sizeof(npi)))
917921 break;
918922 } else {
919− ppp->npmode[i] = npi.mode;
923+ WRITE_ONCE(ppp->npmode[i], npi.mode);
920924 /* we may be able to transmit more packets now (??) */
921925 netif_wake_queue(ppp->dev);
922926 }
@@ -1454,7 +1458,7 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) · 531 unmodified lines
14541458 goto outf;
14551459
14561460 /* Drop, accept or reject the packet */
1457− switch (ppp->npmode[npi]) {
1461+ switch (READ_ONCE(ppp->npmode[npi])) {
14581462 case NPMODE_PASS:
14591463 break;
14601464 case NPMODE_QUEUE:
@@ -1482,7 +1486,7 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) · 21 unmodified lines
14821486
14831487 outf:
14841488 kfree_skb(skb);
1485− ++dev->stats.tx_dropped;
1489+ DEV_STATS_INC(dev, tx_dropped);
14861490 return NETDEV_TX_OK;
14871491 }
14881492
@@ -1532,11 +1536,11 @@ ppp_net_siocdevprivate(struct net_device *dev, struct ifreq *ifr, · 43 unmodified lines
15321536 static void
15331537 ppp_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats64)
15341538 {
1535− stats64->rx_errors = dev->stats.rx_errors;
1536− stats64->tx_errors = dev->stats.tx_errors;
1537− stats64->rx_dropped = dev->stats.rx_dropped;
1538− stats64->tx_dropped = dev->stats.tx_dropped;
1539− stats64->rx_length_errors = dev->stats.rx_length_errors;
1539+ stats64->rx_errors = DEV_STATS_READ(dev, rx_errors);
1540+ stats64->tx_errors = DEV_STATS_READ(dev, tx_errors);
1541+ stats64->rx_dropped = DEV_STATS_READ(dev, rx_dropped);
1542+ stats64->tx_dropped = DEV_STATS_READ(dev, tx_dropped);
1543+ stats64->rx_length_errors = DEV_STATS_READ(dev, rx_length_errors);
15401544 dev_fetch_sw_netstats(stats64, dev->tstats);
15411545 }
15421546
@@ -1790,7 +1794,7 @@ ppp_prepare_tx_skb(struct ppp *ppp, struct sk_buff **pskb) · 247 unmodified lines
17901794 *(__be16 *)skb_push(skb, 2) = htons(PPP_FILTER_OUTBOUND_TAG);
17911795 if (ppp->pass_filter &&
17921796 bpf_prog_run(ppp->pass_filter, skb) == 0) {
1793− if (ppp->debug & 1)
1797+ if (READ_ONCE(ppp->debug) & 1)
17941798 netdev_printk(KERN_DEBUG, ppp->dev,
17951799 "PPP: outbound frame "
17961800 "not passed\n");
@@ -1800,11 +1804,11 @@ ppp_prepare_tx_skb(struct ppp *ppp, struct sk_buff **pskb) · 3 unmodified lines
18001804 /* if this packet passes the active filter, record the time */
18011805 if (!(ppp->active_filter &&
18021806 bpf_prog_run(ppp->active_filter, skb) == 0))
1803− ppp->last_xmit = jiffies;
1807+ WRITE_ONCE(ppp->last_xmit, jiffies);
18041808 skb_pull(skb, 2);
18051809 #else
18061810 /* for data packets, record the time */
1807− ppp->last_xmit = jiffies;
1811+ WRITE_ONCE(ppp->last_xmit, jiffies);
18081812 #endif /* CONFIG_PPP_FILTER */
18091813 }
18101814
@@ -1889,7 +1893,7 @@ ppp_prepare_tx_skb(struct ppp *ppp, struct sk_buff **pskb) · 78 unmodified lines
18891893
18901894 drop:
18911895 kfree_skb(skb);
1892− ++ppp->dev->stats.tx_errors;
1896+ DEV_STATS_INC(ppp->dev, tx_errors);
18931897 return 1;
18941898 }
18951899
@@ -2154,9 +2158,9 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) · 258 unmodified lines
21542158 noskb:
21552159 spin_unlock(&pch->downl);
21562160 err_linearize:
2157− if (ppp->debug & 1)
2161+ if (READ_ONCE(ppp->debug) & 1)
21582162 netdev_err(ppp->dev, "PPP: no memory (fragment)\n");
2159− ++ppp->dev->stats.tx_errors;
2163+ DEV_STATS_INC(ppp->dev, tx_errors);
21602164 ++ppp->nxseq;
21612165 return 1; /* abandon the frame */
21622166 }
@@ -2329,7 +2333,7 @@ ppp_input(struct ppp_channel *chan, struct sk_buff *skb) · 166 unmodified lines
23292333 if (!ppp_decompress_proto(skb)) {
23302334 kfree_skb(skb);
23312335 if (ppp) {
2332− ++ppp->dev->stats.rx_length_errors;
2336+ DEV_STATS_INC(ppp->dev, rx_length_errors);
23332337 ppp_receive_error(ppp);
23342338 }
23352339 goto done;
@@ -2391,7 +2395,7 @@ ppp_receive_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) · 55 unmodified lines
23912395 static void
23922396 ppp_receive_error(struct ppp *ppp)
23932397 {
2394− ++ppp->dev->stats.rx_errors;
2398+ DEV_STATS_INC(ppp->dev, rx_errors);
23952399 if (ppp->vj)
23962400 slhc_toss(ppp->vj);
23972401 }
@@ -2502,7 +2506,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) · 104 unmodified lines
25022506 *(__be16 *)skb_push(skb, 2) = htons(PPP_FILTER_INBOUND_TAG);
25032507 if (ppp->pass_filter &&
25042508 bpf_prog_run(ppp->pass_filter, skb) == 0) {
2505− if (ppp->debug & 1)
2509+ if (READ_ONCE(ppp->debug) & 1)
25062510 netdev_printk(KERN_DEBUG, ppp->dev,
25072511 "PPP: inbound frame "
25082512 "not passed\n");
@@ -2511,14 +2515,14 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) · 2 unmodified lines
25112515 }
25122516 if (!(ppp->active_filter &&
25132517 bpf_prog_run(ppp->active_filter, skb) == 0))
2514− ppp->last_recv = jiffies;
2518+ WRITE_ONCE(ppp->last_recv, jiffies);
25152519 __skb_pull(skb, 2);
25162520 } else
25172521 #endif /* CONFIG_PPP_FILTER */
2518− ppp->last_recv = jiffies;
2522+ WRITE_ONCE(ppp->last_recv, jiffies);
25192523
25202524 if ((ppp->dev->flags & IFF_UP) == 0 ||
2521− ppp->npmode[npi] != NPMODE_PASS) {
2525+ READ_ONCE(ppp->npmode[npi]) != NPMODE_PASS) {
25222526 kfree_skb(skb);
25232527 } else {
25242528 /* chop off protocol */
@@ -2658,7 +2662,7 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) · 133 unmodified lines
26582662 */
26592663 if (seq_before(seq, ppp->nextseq)) {
26602664 kfree_skb(skb);
2661− ++ppp->dev->stats.rx_dropped;
2665+ DEV_STATS_INC(ppp->dev, rx_dropped);
26622666 ppp_receive_error(ppp);
26632667 return;
26642668 }
@@ -2694,7 +2698,7 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) · 29 unmodified lines
26942698 if (pskb_may_pull(skb, 2))
26952699 ppp_receive_nonmp_frame(ppp, skb);
26962700 else {
2697− ++ppp->dev->stats.rx_length_errors;
2701+ DEV_STATS_INC(ppp->dev, rx_length_errors);
26982702 kfree_skb(skb);
26992703 ppp_receive_error(ppp);
27002704 }
@@ -2771,7 +2775,7 @@ ppp_mp_reconstruct(struct ppp *ppp) · 70 unmodified lines
27712775 seq = seq_before(minseq, PPP_MP_CB(p)->sequence)?
27722776 minseq + 1: PPP_MP_CB(p)->sequence;
27732777
2774− if (ppp->debug & 1)
2778+ if (READ_ONCE(ppp->debug) & 1)
27752779 netdev_printk(KERN_DEBUG, ppp->dev,
27762780 "lost frag %u..%u\n",
27772781 oldseq, seq-1);
@@ -2800,7 +2804,7 @@ ppp_mp_reconstruct(struct ppp *ppp) · 22 unmodified lines
28002804 if (lost == 0 && (PPP_MP_CB(p)->BEbits & E) &&
28012805 (PPP_MP_CB(head)->BEbits & B)) {
28022806 if (len > ppp->mrru + 2) {
2803− ++ppp->dev->stats.rx_length_errors;
2807+ DEV_STATS_INC(ppp->dev, rx_length_errors);
28042808 netdev_printk(KERN_DEBUG, ppp->dev,
28052809 "PPP: reconstructed packet"
28062810 " is too long (%d)\n", len);
@@ -2820,7 +2824,7 @@ ppp_mp_reconstruct(struct ppp *ppp) · 13 unmodified lines
28202824 struct sk_buff *tmp2;
28212825
28222826 skb_queue_reverse_walk_from_safe(list, p, tmp2) {
2823− if (ppp->debug & 1)
2827+ if (READ_ONCE(ppp->debug) & 1)
28242828 netdev_printk(KERN_DEBUG, ppp->dev,
28252829 "discarding frag %u\n",
28262830 PPP_MP_CB(p)->sequence);
@@ -2842,7 +2846,7 @@ ppp_mp_reconstruct(struct ppp *ppp) · 15 unmodified lines
28422846 skb_queue_walk_safe(list, p, tmp) {
28432847 if (p == head)
28442848 break;
2845− if (ppp->debug & 1)
2849+ if (READ_ONCE(ppp->debug) & 1)
28462850 netdev_printk(KERN_DEBUG, ppp->dev,
28472851 "discarding frag %u\n",
28482852 PPP_MP_CB(p)->sequence);
@@ -2850,12 +2854,12 @@ ppp_mp_reconstruct(struct ppp *ppp) · 1 unmodified line
28502854 kfree_skb(p);
28512855 }
28522856
2853− if (ppp->debug & 1)
2857+ if (READ_ONCE(ppp->debug) & 1)
28542858 netdev_printk(KERN_DEBUG, ppp->dev,
28552859 " missed pkts %u..%u\n",
28562860 ppp->nextseq,
28572861 PPP_MP_CB(head)->sequence-1);
2858− ++ppp->dev->stats.rx_dropped;
2862+ DEV_STATS_INC(ppp->dev, rx_dropped);
28592863 ppp_receive_error(ppp);
28602864 }
28612865
@@ -3161,7 +3165,8 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound) · 299 unmodified lines
31613165 if (!ppp->rc_state)
31623166 break;
31633167 if (ppp->rcomp->decomp_init(ppp->rc_state, dp, len,
3164− ppp->file.index, 0, ppp->mru, ppp->debug)) {
3168+ ppp->file.index, 0, ppp->mru,
3169+ READ_ONCE(ppp->debug))) {
31653170 ppp->rstate |= SC_DECOMP_RUN;
31663171 ppp->rstate &= ~(SC_DC_ERROR | SC_DC_FERROR);
31673172 }
@@ -3170,7 +3175,8 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound) · 2 unmodified lines
31703175 if (!ppp->xc_state)
31713176 break;
31723177 if (ppp->xcomp->comp_init(ppp->xc_state, dp, len,
3173− ppp->file.index, 0, ppp->debug))
3178+ ppp->file.index, 0,
3179+ READ_ONCE(ppp->debug)))
31743180 ppp->xstate |= SC_COMP_RUN;
31753181 }
31763182 break;
@@ -3322,8 +3328,8 @@ ppp_get_stats(struct ppp *ppp, struct ppp_stats *st) · 145 unmodified lines
33223328 st->p.ppp_opackets += tx_packets;
33233329 st->p.ppp_obytes += tx_bytes;
33243330 }
3325− st->p.ppp_ierrors = ppp->dev->stats.rx_errors;
3326− st->p.ppp_oerrors = ppp->dev->stats.tx_errors;
3331+ st->p.ppp_ierrors = DEV_STATS_READ(ppp->dev, rx_errors);
3332+ st->p.ppp_oerrors = DEV_STATS_READ(ppp->dev, tx_errors);
33273333 if (!vj)
33283334 return;
33293335 st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed;
drivers/net/ppp/pppoe.c+1−0
@@ -825,6 +825,7 @@ static int pppoe_sendmsg(struct socket *sock, struct msghdr *m, · 824 unmodified lines
825825 dev_hard_header(skb, dev, ETH_P_PPP_SES,
826826 po->pppoe_pa.remote, NULL, total_len);
827827
828+ ph = pppoe_hdr(skb);
828829 memcpy(ph, &hdr, sizeof(struct pppoe_hdr));
829830
830831 ph->length = htons(total_len);
drivers/net/slip/slip.c+4−0
@@ -693,6 +693,8 @@ static void slip_receive_buf(struct tty_struct *tty, const u8 *cp, const u8 *fp, · 692 unmodified lines
693693 if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev))
694694 return;
695695
696+ spin_lock_bh(&sl->lock);
697+
696698 /* Read the characters out of the buffer */
697699 while (count--) {
698700 if (fp && *fp++) {
@@ -708,6 +710,8 @@ static void slip_receive_buf(struct tty_struct *tty, const u8 *cp, const u8 *fp, · 9 unmodified lines
708710 #endif
709711 slip_unesc(sl, *cp++);
710712 }
713+
714+ spin_unlock_bh(&sl->lock);
711715 }
712716
713717 /************************************
drivers/net/vmxnet3/vmxnet3_drv.c+16−6
@@ -1530,7 +1530,11 @@ vmxnet3_get_hdr_len(struct vmxnet3_adapter *adapter, struct sk_buff *skb, · 1529 unmodified lines
15301530 struct ipv6hdr *ipv6;
15311531 struct tcphdr *tcp;
15321532 } hdr;
1533− BUG_ON(gdesc->rcd.tcp == 0);
1533+
1534+ /* v4/v6/tcp then describe the inner header, which we can't locate. */
1535+ if ((le32_to_cpu(gdesc->dword[0]) & (1UL << VMXNET3_RCD_HDR_INNER_SHIFT)) ||
1536+ gdesc->rcd.tcp == 0)
1537+ return 0;
15341538
15351539 maplen = skb_headlen(skb);
15361540 if (unlikely(sizeof(struct iphdr) + sizeof(struct tcphdr) > maplen))
@@ -1544,15 +1548,21 @@ vmxnet3_get_hdr_len(struct vmxnet3_adapter *adapter, struct sk_buff *skb, · 7 unmodified lines
15441548
15451549 hdr.eth = eth_hdr(skb);
15461550 if (gdesc->rcd.v4) {
1547− BUG_ON(hdr.eth->h_proto != htons(ETH_P_IP) &&
1548− hdr.veth->h_vlan_encapsulated_proto != htons(ETH_P_IP));
1551+ if (hdr.eth->h_proto != htons(ETH_P_IP) &&
1552+ hdr.veth->h_vlan_encapsulated_proto != htons(ETH_P_IP))
1553+ return 0;
1554+
15491555 hdr.ptr += hlen;
1550− BUG_ON(hdr.ipv4->protocol != IPPROTO_TCP);
1556+ if (hdr.ipv4->protocol != IPPROTO_TCP)
1557+ return 0;
1558+
15511559 hlen = hdr.ipv4->ihl << 2;
15521560 hdr.ptr += hdr.ipv4->ihl << 2;
15531561 } else if (gdesc->rcd.v6) {
1554− BUG_ON(hdr.eth->h_proto != htons(ETH_P_IPV6) &&
1555− hdr.veth->h_vlan_encapsulated_proto != htons(ETH_P_IPV6));
1562+ if (hdr.eth->h_proto != htons(ETH_P_IPV6) &&
1563+ hdr.veth->h_vlan_encapsulated_proto != htons(ETH_P_IPV6))
1564+ return 0;
1565+
15561566 hdr.ptr += hlen;
15571567 /* Use an estimated value, since we also need to handle
15581568 * TSO case.
drivers/net/vxlan/vxlan_core.c+3−0
@@ -4421,6 +4421,9 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[], · 4420 unmodified lines
44214421 struct vxlan_rdst *dst;
44224422 int err;
44234423
4424+ if (!rtnl_dev_link_net_capable(dev, vxlan->net))
4425+ return -EPERM;
4426+
44244427 dst = &vxlan->default_dst;
44254428 err = vxlan_nl2conf(tb, data, dev, &conf, true, extack);
44264429 if (err)
drivers/net/vxlan/vxlan_mdb.c+18−12
@@ -42,6 +42,7 @@ struct vxlan_mdb_remote { · 41 unmodified lines
4242 };
4343
4444 #define VXLAN_SGRP_F_DELETE BIT(0)
45+#define VXLAN_SGRP_F_NEW BIT(1)
4546
4647 struct vxlan_mdb_src_entry {
4748 struct hlist_node node;
@@ -844,6 +845,7 @@ vxlan_mdb_remote_src_add(const struct vxlan_mdb_config *cfg, · 796 unmodified lines
844845 ent = vxlan_mdb_remote_src_entry_add(remote, &src->addr);
845846 if (!ent)
846847 return -ENOMEM;
848+ ent->flags |= VXLAN_SGRP_F_NEW;
847849 } else if (!(cfg->nlflags & NLM_F_REPLACE)) {
848850 NL_SET_ERR_MSG_MOD(extack, "Source entry already exists");
849851 return -EEXIST;
@@ -853,15 +855,16 @@ vxlan_mdb_remote_src_add(const struct vxlan_mdb_config *cfg, · 3 unmodified lines
853855 if (err)
854856 goto err_src_del;
855857
856− /* Clear flags in case source entry was marked for deletion as part of
857− * replace flow.
858+ /* Clear the deletion mark so the entry survives the replace sweep.
859+ * The new mark is retained until the whole operation succeeds.
858860 */
859− ent->flags = 0;
861+ ent->flags &= ~VXLAN_SGRP_F_DELETE;
860862
861863 return 0;
862864
863865 err_src_del:
864− vxlan_mdb_remote_src_entry_del(ent);
866+ if (ent->flags & VXLAN_SGRP_F_NEW)
867+ vxlan_mdb_remote_src_entry_del(ent);
865868 return err;
866869 }
867870
@@ -889,11 +892,19 @@ static int vxlan_mdb_remote_srcs_add(const struct vxlan_mdb_config *cfg, · 21 unmodified lines
889892 goto err_src_del;
890893 }
891894
895+ hlist_for_each_entry(ent, &remote->src_list, node)
896+ ent->flags &= ~VXLAN_SGRP_F_NEW;
897+
892898 return 0;
893899
894900 err_src_del:
895− hlist_for_each_entry_safe(ent, tmp, &remote->src_list, node)
896− vxlan_mdb_remote_src_del(cfg->vxlan, &cfg->group, remote, ent);
901+ hlist_for_each_entry_safe(ent, tmp, &remote->src_list, node) {
902+ if (ent->flags & VXLAN_SGRP_F_NEW)
903+ vxlan_mdb_remote_src_del(cfg->vxlan, &cfg->group, remote,
904+ ent);
905+ else
906+ ent->flags &= ~VXLAN_SGRP_F_DELETE;
907+ }
897908 return err;
898909 }
899910
@@ -1069,7 +1080,7 @@ vxlan_mdb_remote_srcs_replace(const struct vxlan_mdb_config *cfg, · 169 unmodified lines
10691080
10701081 err = vxlan_mdb_remote_srcs_add(cfg, remote, extack);
10711082 if (err)
1072− goto err_clear_delete;
1083+ return err;
10731084
10741085 hlist_for_each_entry_safe(ent, tmp, &remote->src_list, node) {
10751086 if (ent->flags & VXLAN_SGRP_F_DELETE)
@@ -1078,11 +1089,6 @@ vxlan_mdb_remote_srcs_replace(const struct vxlan_mdb_config *cfg, · 2 unmodified lines
10781089 }
10791090
10801091 return 0;
1081−
1082−err_clear_delete:
1083− hlist_for_each_entry(ent, &remote->src_list, node)
1084− ent->flags &= ~VXLAN_SGRP_F_DELETE;
1085− return err;
10861092 }
10871093
10881094 static int vxlan_mdb_remote_replace(const struct vxlan_mdb_config *cfg,
drivers/net/wan/wanxl.c+2−1
@@ -514,7 +514,8 @@ static void wanxl_pci_remove_one(struct pci_dev *pdev) · 513 unmodified lines
514514 if (card->irq)
515515 free_irq(card->irq, card);
516516
517− wanxl_reset(card);
517+ if (card->plx)
518+ wanxl_reset(card);
518519
519520 for (i = 0; i < RX_QUEUE_LENGTH; i++)
520521 if (card->rx_skbs[i]) {
drivers/net/wireless/ath/ath10k/htt_rx.c+2−0
@@ -706,6 +706,7 @@ static int ath10k_htt_rx_pop_paddr32_list(struct ath10k_htt *htt, · 705 unmodified lines
706706 if (!(__le32_to_cpu(rxd_attention->flags) &
707707 RX_ATTENTION_FLAGS_MSDU_DONE)) {
708708 ath10k_warn(htt->ar, "tried to pop an incomplete frame, oops!\n");
709+ __skb_queue_purge(list);
709710 return -EIO;
710711 }
711712 }
@@ -770,6 +771,7 @@ static int ath10k_htt_rx_pop_paddr64_list(struct ath10k_htt *htt, · 58 unmodified lines
770771 if (!(__le32_to_cpu(rxd_attention->flags) &
771772 RX_ATTENTION_FLAGS_MSDU_DONE)) {
772773 ath10k_warn(htt->ar, "tried to pop an incomplete frame, oops!\n");
774+ __skb_queue_purge(list);
773775 return -EIO;
774776 }
775777 }
drivers/net/wireless/ath/ath11k/ahb.c+1−0
@@ -996,6 +996,7 @@ static int ath11k_ahb_fw_resources_init(struct ath11k_base *ab) · 995 unmodified lines
996996 ret = ath11k_ahb_setup_msa_resources(ab);
997997 if (ret) {
998998 ath11k_err(ab, "failed to setup msa resources\n");
999+ of_node_put(node);
9991000 return ret;
10001001 }
10011002
drivers/net/wireless/ath/ath11k/dp_rx.c+3−0
@@ -4618,6 +4618,9 @@ static void ath11k_hal_rx_msdu_list_get(struct ath11k *ar, · 4617 unmodified lines
46184618 msdu_details = &msdu_link->msdu_link[0];
46194619
46204620 for (i = 0; i < HAL_RX_NUM_MSDU_DESC; i++) {
4621+ if (!i && FIELD_GET(BUFFER_ADDR_INFO0_ADDR,
4622+ msdu_details[i].buf_addr_info.info0) == 0)
4623+ break;
46214624 if (FIELD_GET(BUFFER_ADDR_INFO0_ADDR,
46224625 msdu_details[i].buf_addr_info.info0) == 0) {
46234626 msdu_desc_info = &msdu_details[i - 1].rx_msdu_info;
drivers/net/wireless/ath/ath11k/pci.c+4−0
@@ -199,6 +199,8 @@ static void ath11k_pci_soc_global_reset(struct ath11k_base *ab) · 198 unmodified lines
199199 val |= PCIE_SOC_GLOBAL_RESET_V;
200200
201201 ath11k_pcic_write32(ab, PCIE_SOC_GLOBAL_RESET, val);
202+ /* Flush the posted write to the device */
203+ ath11k_pcic_read32(ab, PCIE_SOC_GLOBAL_RESET);
202204
203205 /* TODO: exact time to sleep is uncertain */
204206 delay = 10;
@@ -208,6 +210,8 @@ static void ath11k_pci_soc_global_reset(struct ath11k_base *ab) · 3 unmodified lines
208210 val &= ~PCIE_SOC_GLOBAL_RESET_V;
209211
210212 ath11k_pcic_write32(ab, PCIE_SOC_GLOBAL_RESET, val);
213+ /* Flush the posted write to the device */
214+ ath11k_pcic_read32(ab, PCIE_SOC_GLOBAL_RESET);
211215
212216 mdelay(delay);
213217
drivers/net/wireless/ath/ath11k/qmi.c+8−3
@@ -3294,9 +3294,14 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work) · 3293 unmodified lines
32943294 clear_bit(ATH11K_FLAG_CRASH_FLUSH,
32953295 &ab->dev_flags);
32963296 clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
3297− ath11k_core_qmi_firmware_ready(ab);
3298− set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags);
3299−
3297+ if (!test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) {
3298+ ret = ath11k_core_qmi_firmware_ready(ab);
3299+ if (ret) {
3300+ set_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags);
3301+ break;
3302+ }
3303+ set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags);
3304+ }
33003305 break;
33013306 case ATH11K_QMI_EVENT_COLD_BOOT_CAL_DONE:
33023307 break;
drivers/net/wireless/ath/ath12k/dp_peer.c+9−2
@@ -274,11 +274,14 @@ int ath12k_dp_link_peer_rhash_tbl_init(struct ath12k_dp *dp) · 273 unmodified lines
274274
275275 void ath12k_dp_link_peer_rhash_tbl_destroy(struct ath12k_dp *dp)
276276 {
277− mutex_lock(&dp->link_peer_rhash_tbl_lock);
277+ guard(mutex)(&dp->link_peer_rhash_tbl_lock);
278+
279+ if (!dp->rhead_peer_addr)
280+ return;
281+
278282 rhashtable_destroy(dp->rhead_peer_addr);
279283 kfree(dp->rhead_peer_addr);
280284 dp->rhead_peer_addr = NULL;
281− mutex_unlock(&dp->link_peer_rhash_tbl_lock);
282285 }
283286
284287 static int ath12k_dp_link_peer_rhash_insert(struct ath12k_dp *dp,
@@ -570,6 +573,8 @@ int ath12k_dp_link_peer_assign(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_hw, · 285 unmodified lines
570573 peerid_index = ath12k_dp_peer_get_peerid_index(dp, peer->peer_id);
571574
572575 rcu_assign_pointer(dp_peer->link_peers[peer->link_id], peer);
576+ WRITE_ONCE(dp_peer->link_peers_map,
577+ READ_ONCE(dp_peer->link_peers_map) | BIT(peer->link_id));
573578
574579 rcu_assign_pointer(dp_hw->dp_peers[peerid_index], dp_peer);
575580
@@ -632,6 +637,8 @@ void ath12k_dp_link_peer_unassign(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_ · 56 unmodified lines
632637 peerid_index = ath12k_dp_peer_get_peerid_index(dp, peer->peer_id);
633638
634639 rcu_assign_pointer(dp_peer->link_peers[peer->link_id], NULL);
640+ WRITE_ONCE(dp_peer->link_peers_map,
641+ READ_ONCE(dp_peer->link_peers_map) & ~BIT(peer->link_id));
635642
636643 rcu_assign_pointer(dp_hw->dp_peers[peerid_index], NULL);
637644
drivers/net/wireless/ath/ath12k/dp_peer.h+1−0
@@ -140,6 +140,7 @@ struct ath12k_dp_peer { · 139 unmodified lines
140140
141141 /* Info used in MMIC verification of * RX fragments */
142142 struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1];
143+ unsigned long link_peers_map;
143144 struct ath12k_dp_link_peer __rcu *link_peers[ATH12K_NUM_MAX_LINKS];
144145 struct ath12k_reoq_buf reoq_bufs[IEEE80211_NUM_TIDS + 1];
145146 struct ath12k_dp_rx_tid rx_tid[IEEE80211_NUM_TIDS + 1];
drivers/net/wireless/ath/ath12k/dp_rx.c+3−4
@@ -1384,10 +1384,9 @@ void ath12k_dp_rx_deliver_msdu(struct ath12k_pdev_dp *dp_pdev, struct napi_struc · 1383 unmodified lines
13841384
13851385 pubsta = peer ? peer->sta : NULL;
13861386
1387− if (pubsta && pubsta->valid_links) {
1388− status->link_valid = 1;
1389− status->link_id = peer->hw_links[rxcb->hw_link_id];
1390− }
1387+ status->link_valid = 0;
1388+ if (pubsta && pubsta->valid_links)
1389+ ath12k_hw_set_rx_link_id(dp->hw_params, peer, rxcb, status);
13911390
13921391 ath12k_dbg(dp->ab, ATH12K_DBG_DATA,
13931392 "rx skb %p len %u peer %pM %d %s sn %u %s%s%s%s%s%s%s%s%s%s rate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i mic-err %i amsdu-more %i\n",
drivers/net/wireless/ath/ath12k/hw.h+16−0
@@ -13,6 +13,10 @@ · 12 unmodified lines
1313 #include "wmi.h"
1414 #include "hal.h"
1515
16+struct ath12k_dp_peer;
17+struct ath12k_skb_rxcb;
18+struct ieee80211_rx_status;
19+
1620 /* Target configuration defines */
1721
1822 /* Num VDEVS per radio */
@@ -243,6 +247,9 @@ struct ath12k_hw_ops { · 224 unmodified lines
243247 bool (*dp_srng_is_tx_comp_ring)(int ring_num);
244248 bool (*is_frame_link_agnostic)(struct ath12k_link_vif *arvif,
245249 struct ieee80211_mgmt *mgmt);
250+ void (*set_rx_link_id)(struct ath12k_dp_peer *dp_peer,
251+ struct ath12k_skb_rxcb *rxcb,
252+ struct ieee80211_rx_status *status);
246253 };
247254
248255 static inline
@@ -273,6 +280,15 @@ static inline int ath12k_hw_mac_id_to_srng_id(const struct ath12k_hw_params *hw, · 24 unmodified lines
273280 return 0;
274281 }
275282
283+static inline void ath12k_hw_set_rx_link_id(const struct ath12k_hw_params *hw,
284+ struct ath12k_dp_peer *dp_peer,
285+ struct ath12k_skb_rxcb *rxcb,
286+ struct ieee80211_rx_status *status)
287+{
288+ if (hw->hw_ops->set_rx_link_id)
289+ hw->hw_ops->set_rx_link_id(dp_peer, rxcb, status);
290+}
291+
276292 struct ath12k_fw_ie {
277293 __le32 id;
278294 __le32 len;
drivers/net/wireless/ath/ath12k/mac.c+7−3
@@ -1238,9 +1238,13 @@ void ath12k_mac_peer_cleanup_all(struct ath12k *ar) · 1237 unmodified lines
12381238 /* cleanup dp peer */
12391239 spin_lock_bh(&dp_hw->peer_lock);
12401240 dp_peer = peer->dp_peer;
1241− peerid_index = ath12k_dp_peer_get_peerid_index(dp, peer->peer_id);
1242− rcu_assign_pointer(dp_peer->link_peers[peer->link_id], NULL);
1243− rcu_assign_pointer(dp_hw->dp_peers[peerid_index], NULL);
1241+ if (dp_peer) {
1242+ peerid_index = ath12k_dp_peer_get_peerid_index(dp, peer->peer_id);
1243+ rcu_assign_pointer(dp_peer->link_peers[peer->link_id], NULL);
1244+ WRITE_ONCE(dp_peer->link_peers_map,
1245+ READ_ONCE(dp_peer->link_peers_map) & ~BIT(peer->link_id));
1246+ rcu_assign_pointer(dp_hw->dp_peers[peerid_index], NULL);
1247+ }
12441248 spin_unlock_bh(&dp_hw->peer_lock);
12451249
12461250 ath12k_dp_link_peer_rhash_delete(dp, peer);
drivers/net/wireless/ath/ath12k/pci.c+4−0
@@ -188,6 +188,8 @@ static void ath12k_pci_soc_global_reset(struct ath12k_base *ab) · 187 unmodified lines
188188 val |= PCIE_SOC_GLOBAL_RESET_V;
189189
190190 ath12k_pci_write32(ab, PCIE_SOC_GLOBAL_RESET, val);
191+ /* Flush the posted write to the device */
192+ ath12k_pci_read32(ab, PCIE_SOC_GLOBAL_RESET);
191193
192194 /* TODO: exact time to sleep is uncertain */
193195 delay = 10;
@@ -197,6 +199,8 @@ static void ath12k_pci_soc_global_reset(struct ath12k_base *ab) · 3 unmodified lines
197199 val &= ~PCIE_SOC_GLOBAL_RESET_V;
198200
199201 ath12k_pci_write32(ab, PCIE_SOC_GLOBAL_RESET, val);
202+ /* Flush the posted write to the device */
203+ ath12k_pci_read32(ab, PCIE_SOC_GLOBAL_RESET);
200204
201205 mdelay(delay);
202206
drivers/net/wireless/ath/ath12k/peer.c+3−0
@@ -453,6 +453,9 @@ err_free: · 452 unmodified lines
453453
454454 void ath12k_link_sta_rhash_tbl_destroy(struct ath12k_base *ab)
455455 {
456+ if (!ab->rhead_sta_addr)
457+ return;
458+
456459 rhashtable_destroy(ab->rhead_sta_addr);
457460 kfree(ab->rhead_sta_addr);
458461 ab->rhead_sta_addr = NULL;
drivers/net/wireless/ath/ath12k/wifi7/dp_rx.c+33−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 */
66
77 #include "dp_rx.h"
8+#include "../dp_peer.h"
89 #include "../dp_tx.h"
910 #include "../peer.h"
1011 #include "hal_qcn9274.h"
@@ -2315,3 +2316,35 @@ ath12k_wifi7_dp_rxdesc_mpdu_valid(struct ath12k_base *ab, · 2304 unmodified lines
23152316
23162317 return tlv_tag == HAL_RX_MPDU_START;
23172318 }
2319+
2320+void
2321+ath12k_wifi7_dp_rx_set_link_id_qcn9274(struct ath12k_dp_peer *dp_peer,
2322+ struct ath12k_skb_rxcb *rxcb,
2323+ struct ieee80211_rx_status *status)
2324+{
2325+ status->link_valid = 1;
2326+ status->link_id = dp_peer->hw_links[rxcb->hw_link_id];
2327+}
2328+
2329+void
2330+ath12k_wifi7_dp_rx_set_link_id_wcn7850(struct ath12k_dp_peer *dp_peer,
2331+ struct ath12k_skb_rxcb *rxcb,
2332+ struct ieee80211_rx_status *status)
2333+{
2334+ struct ath12k_dp_link_peer *link_peer;
2335+ unsigned long links_map;
2336+ int i;
2337+
2338+ RCU_LOCKDEP_WARN(!rcu_read_lock_held(),
2339+ "ath12k set rx link id called without rcu lock");
2340+
2341+ links_map = READ_ONCE(dp_peer->link_peers_map);
2342+ for_each_set_bit(i, &links_map, ATH12K_NUM_MAX_LINKS) {
2343+ link_peer = rcu_dereference(dp_peer->link_peers[i]);
2344+ if (link_peer && link_peer->peer_id == rxcb->peer_id) {
2345+ status->link_valid = 1;
2346+ status->link_id = link_peer->link_id;
2347+ return;
2348+ }
2349+ }
2350+}
drivers/net/wireless/ath/ath12k/wifi7/dp_rx.h+6−0
@@ -57,4 +57,10 @@ ath12k_wifi7_dp_rxdesc_mpdu_valid(struct ath12k_base *ab, · 56 unmodified lines
5757 struct hal_rx_desc *rx_desc);
5858 int ath12k_wifi7_dp_rx_tid_delete_handler(struct ath12k_base *ab,
5959 struct ath12k_dp_rx_tid_rxq *rx_tid);
60+void ath12k_wifi7_dp_rx_set_link_id_qcn9274(struct ath12k_dp_peer *dp_peer,
61+ struct ath12k_skb_rxcb *rxcb,
62+ struct ieee80211_rx_status *status);
63+void ath12k_wifi7_dp_rx_set_link_id_wcn7850(struct ath12k_dp_peer *dp_peer,
64+ struct ath12k_skb_rxcb *rxcb,
65+ struct ieee80211_rx_status *status);
6066 #endif
drivers/net/wireless/ath/ath12k/wifi7/hw.c+3−0
@@ -158,6 +158,7 @@ static const struct ath12k_hw_ops qcn9274_ops = { · 157 unmodified lines
158158 .get_ring_selector = ath12k_wifi7_hw_get_ring_selector_qcn9274,
159159 .dp_srng_is_tx_comp_ring = ath12k_wifi7_dp_srng_is_comp_ring_qcn9274,
160160 .is_frame_link_agnostic = ath12k_wifi7_is_frame_link_agnostic_qcn9274,
161+ .set_rx_link_id = ath12k_wifi7_dp_rx_set_link_id_qcn9274,
161162 };
162163
163164 static const struct ath12k_hw_ops wcn7850_ops = {
@@ -168,6 +169,7 @@ static const struct ath12k_hw_ops wcn7850_ops = { · 4 unmodified lines
168169 .get_ring_selector = ath12k_wifi7_hw_get_ring_selector_wcn7850,
169170 .dp_srng_is_tx_comp_ring = ath12k_wifi7_dp_srng_is_comp_ring_wcn7850,
170171 .is_frame_link_agnostic = ath12k_wifi7_is_frame_link_agnostic_wcn7850,
172+ .set_rx_link_id = ath12k_wifi7_dp_rx_set_link_id_wcn7850,
171173 };
172174
173175 static const struct ath12k_hw_ops qcc2072_ops = {
@@ -178,6 +180,7 @@ static const struct ath12k_hw_ops qcc2072_ops = { · 4 unmodified lines
178180 .get_ring_selector = ath12k_wifi7_hw_get_ring_selector_wcn7850,
179181 .dp_srng_is_tx_comp_ring = ath12k_wifi7_dp_srng_is_comp_ring_wcn7850,
180182 .is_frame_link_agnostic = ath12k_wifi7_is_frame_link_agnostic_wcn7850,
183+ .set_rx_link_id = ath12k_wifi7_dp_rx_set_link_id_wcn7850,
181184 };
182185
183186 #define ATH12K_TX_RING_MASK_0 0x1
drivers/net/wireless/ath/ath6kl/txrx.c+7−5
@@ -1723,13 +1723,15 @@ void aggr_recv_addba_req_evt(struct ath6kl_vif *vif, u8 tid_mux, u16 seq_no, · 1722 unmodified lines
17231723
17241724 rxtid = &aggr_conn->rx_tid[tid];
17251725
1726− if (win_sz < AGGR_WIN_SZ_MIN || win_sz > AGGR_WIN_SZ_MAX)
1727− ath6kl_dbg(ATH6KL_DBG_WLAN_RX, "%s: win_sz %d, tid %d\n",
1728− __func__, win_sz, tid);
1729−
17301726 if (rxtid->aggr)
17311727 aggr_delete_tid_state(aggr_conn, tid);
17321728
1729+ if (win_sz < AGGR_WIN_SZ_MIN || win_sz > AGGR_WIN_SZ_MAX) {
1730+ ath6kl_dbg(ATH6KL_DBG_WLAN_RX, "%s: win_sz %d, tid %d\n",
1731+ __func__, win_sz, tid);
1732+ return;
1733+ }
1734+
17331735 rxtid->seq_next = seq_no;
17341736 hold_q_size = TID_WINDOW_SZ(win_sz) * sizeof(struct skb_hold_q);
17351737 rxtid->hold_q = kzalloc(hold_q_size, GFP_KERNEL);
@@ -1828,7 +1830,7 @@ void aggr_reset_state(struct aggr_info_conn *aggr_conn) · 92 unmodified lines
18281830 return;
18291831
18301832 if (aggr_conn->timer_scheduled) {
1831− timer_delete(&aggr_conn->timer);
1833+ timer_delete_sync(&aggr_conn->timer);
18321834 aggr_conn->timer_scheduled = false;
18331835 }
18341836
drivers/net/wireless/ath/ath6kl/wmi.c+20−0
@@ -484,6 +484,18 @@ static int ath6kl_wmi_tx_complete_event_rx(u8 *datap, int len) · 483 unmodified lines
484484
485485 evt = (struct wmi_tx_complete_event *) datap;
486486
487+ if (len < sizeof(*evt)) {
488+ ath6kl_dbg(ATH6KL_DBG_WMI, "tx complete: invalid len %d\n",
489+ len);
490+ return -EINVAL;
491+ }
492+
493+ if (len < sizeof(*evt) + evt->num_msg * sizeof(struct tx_complete_msg_v1)) {
494+ ath6kl_dbg(ATH6KL_DBG_WMI, "tx complete: invalid len %d for %u msgs\n",
495+ len, evt->num_msg);
496+ return -EINVAL;
497+ }
498+
487499 ath6kl_dbg(ATH6KL_DBG_WMI, "comp: %d %d %d\n",
488500 evt->num_msg, evt->msg_len, evt->msg_type);
489501
@@ -862,6 +874,14 @@ static int ath6kl_wmi_connect_event_rx(struct wmi *wmi, u8 *datap, int len, · 372 unmodified lines
862874
863875 ev = (struct wmi_connect_event *) datap;
864876
877+ if (len < sizeof(*ev) + ev->beacon_ie_len +
878+ ev->assoc_req_len + ev->assoc_resp_len) {
879+ ath6kl_dbg(ATH6KL_DBG_WMI,
880+ "connect event: IE lengths %u+%u+%u exceed buffer %d\n",
881+ ev->beacon_ie_len, ev->assoc_req_len,
882+ ev->assoc_resp_len, len);
883+ return -EINVAL;
884+ }
865885 if (vif->nw_type == AP_NETWORK) {
866886 /* AP mode start/STA connected event */
867887 struct net_device *dev = vif->ndev;
drivers/net/wireless/ath/ath9k/hif_usb.c+1−6
@@ -1215,15 +1215,10 @@ static int ath9k_hif_request_firmware(struct hif_device_usb *hif_dev, · 1214 unmodified lines
12151215 ret = request_firmware_nowait(THIS_MODULE, true, hif_dev->fw_name,
12161216 &hif_dev->udev->dev, GFP_KERNEL,
12171217 hif_dev, ath9k_hif_usb_firmware_cb);
1218− if (ret) {
1218+ if (ret)
12191219 dev_err(&hif_dev->udev->dev,
12201220 "ath9k_htc: Async request for firmware %s failed\n",
12211221 hif_dev->fw_name);
1222− return ret;
1223− }
1224−
1225− dev_info(&hif_dev->udev->dev, "ath9k_htc: Firmware %s requested\n",
1226− hif_dev->fw_name);
12271222
12281223 return ret;
12291224 }
drivers/net/wireless/ath/carl9170/rx.c+5−2
@@ -150,7 +150,8 @@ static void carl9170_cmd_callback(struct ar9170 *ar, u32 len, void *buffer) · 149 unmodified lines
150150 spin_lock(&ar->cmd_lock);
151151 if (ar->readbuf) {
152152 if (len >= 4)
153− memcpy(ar->readbuf, buffer + 4, len - 4);
153+ memcpy(ar->readbuf, buffer + 4,
154+ min_t(u32, len - 4, ar->readlen));
154155
155156 ar->readbuf = NULL;
156157 }
@@ -917,7 +918,9 @@ static void carl9170_rx_stream(struct ar9170 *ar, void *buf, unsigned int len) · 760 unmodified lines
917918 }
918919 }
919920
920− skb_put_data(ar->rx_failover, tbuf, tlen);
921+ skb_put_data(ar->rx_failover, tbuf,
922+ min_t(unsigned int, tlen,
923+ ar->rx_failover_missing));
921924 ar->rx_failover_missing -= tlen;
922925
923926 if (ar->rx_failover_missing <= 0) {
drivers/net/wireless/ath/carl9170/tx.c+1−1
@@ -692,7 +692,7 @@ void carl9170_tx_process_status(struct ar9170 *ar, · 691 unmodified lines
692692 unsigned int i;
693693
694694 for (i = 0; i < cmd->hdr.ext; i++) {
695− if (WARN_ON(i > ((cmd->hdr.len / 2) + 1))) {
695+ if (WARN_ON(i >= (cmd->hdr.len / 2))) {
696696 print_hex_dump_bytes("UU:", DUMP_PREFIX_NONE,
697697 (void *) cmd, cmd->hdr.len + 4);
698698 break;
drivers/net/wireless/atmel/at76c50x-usb.c+5−2
@@ -1521,13 +1521,16 @@ static inline int at76_guess_freq(struct at76_priv *priv) · 1520 unmodified lines
15211521
15221522 if (ieee80211_is_probe_resp(hdr->frame_control)) {
15231523 el_off = offsetof(struct ieee80211_mgmt, u.probe_resp.variable);
1524− el = ((struct ieee80211_mgmt *)hdr)->u.probe_resp.variable;
15251524 } else if (ieee80211_is_beacon(hdr->frame_control)) {
15261525 el_off = offsetof(struct ieee80211_mgmt, u.beacon.variable);
1527− el = ((struct ieee80211_mgmt *)hdr)->u.beacon.variable;
15281526 } else {
15291527 goto exit;
15301528 }
1529+
1530+ if (len < el_off)
1531+ goto exit;
1532+
1533+ el = priv->rx_skb->data + el_off;
15311534 len -= el_off;
15321535
15331536 el = cfg80211_find_ie(WLAN_EID_DS_PARAMS, el, len);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c+14−0
@@ -911,6 +911,7 @@ int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev) · 910 unmodified lines
911911 return ret;
912912 }
913913 switch (sdiodev->func2->device) {
914+ case SDIO_DEVICE_ID_BROADCOM_43752:
914915 case SDIO_DEVICE_ID_BROADCOM_CYPRESS_4373:
915916 f2_blksz = SDIO_4373_FUNC2_BLOCKSIZE;
916917 break;
@@ -1069,6 +1070,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, · 152 unmodified lines
10691070 bus_if = kzalloc_obj(*bus_if);
10701071 if (!bus_if)
10711072 return -ENOMEM;
1073+ mutex_init(&bus_if->bus_reset_lock);
10721074 sdiodev = kzalloc_obj(*sdiodev);
10731075 if (!sdiodev) {
10741076 kfree(bus_if);
@@ -1130,6 +1132,14 @@ static void brcmf_ops_sdio_remove(struct sdio_func *func) · 55 unmodified lines
11301132 if (func->num != 1)
11311133 return;
11321134
1135+ /* Drain bus_reset before the shared brcmf_sdiod_remove()
1136+ * teardown, which the SDIO reset callback also reaches. The
1137+ * data worker can arm bus_reset via brcmf_fw_crashed(); cancel
1138+ * it first.
1139+ */
1140+ brcmf_sdio_cancel_datawork(sdiodev->bus);
1141+ brcmf_bus_cancel_reset_work(bus_if);
1142+
11331143 /* only proceed with rest of cleanup if func 1 */
11341144 brcmf_sdiod_remove(sdiodev);
11351145
@@ -1204,6 +1214,8 @@ static int brcmf_ops_sdio_suspend(struct device *dev) · 68 unmodified lines
12041214 } else {
12051215 /* power will be cut so remove device, probe again in resume */
12061216 brcmf_sdiod_intr_unregister(sdiodev);
1217+ brcmf_sdio_cancel_datawork(sdiodev->bus);
1218+ brcmf_bus_cancel_reset_work(bus_if);
12071219 ret = brcmf_sdiod_remove(sdiodev);
12081220 if (ret)
12091221 brcmf_err("Failed to remove device on suspend\n");
@@ -1229,6 +1241,8 @@ static int brcmf_ops_sdio_resume(struct device *dev) · 19 unmodified lines
12291241 ret = brcmf_sdiod_probe(sdiodev);
12301242 if (ret)
12311243 brcmf_err("Failed to probe device on resume\n");
1244+ else
1245+ brcmf_bus_allow_reset_work(bus_if);
12321246 } else {
12331247 if (sdiodev->wowl_enabled && sdiodev->settings->bus.sdio.oob_irq_supported)
12341248 disable_irq_wake(sdiodev->settings->bus.sdio.oob_irq_nr);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h+6−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include <linux/kernel.h>
1010 #include <linux/firmware.h>
1111 #include <linux/device.h>
12+#include <linux/mutex.h>
1213 #include "debug.h"
1314
1415 /* IDs of the 6 default common rings of msgbuf protocol */
@@ -179,6 +180,8 @@ struct brcmf_bus { · 164 unmodified lines
179180 enum brcmf_fwvendor fwvid;
180181 bool always_use_fws_queue;
181182 bool wowl_supported;
183+ bool removing; /* device removal in progress; quiesce async work */
184+ struct mutex bus_reset_lock;
182185
183186 const struct brcmf_bus_ops *ops;
184187 struct brcmf_bus_msgbuf *msgbuf;
@@ -186,6 +189,9 @@ struct brcmf_bus { · 1 unmodified line
186189 struct list_head list;
187190 };
188191
192+void brcmf_bus_cancel_reset_work(struct brcmf_bus *bus_if);
193+void brcmf_bus_allow_reset_work(struct brcmf_bus *bus_if);
194+
189195 /*
190196 * callback wrappers
191197 */
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c+1−1
@@ -2146,7 +2146,7 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme) · 2145 unmodified lines
21462146 sme->crypto.akm_suites[0]);
21472147 return -EINVAL;
21482148 }
2149− } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
2149+ } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED | WPA2_AUTH_1X_SHA256)) {
21502150 switch (sme->crypto.akm_suites[0]) {
21512151 case WLAN_AKM_SUITE_8021X:
21522152 val = WPA2_AUTH_UNSPECIFIED;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c+42−4
@@ -1167,6 +1167,35 @@ static int brcmf_revinfo_read(struct seq_file *s, void *data) · 1166 unmodified lines
11671167 return 0;
11681168 }
11691169
1170+/*
1171+ * Serialize arming from debugfs reset and brcmf_fw_crashed() against
1172+ * teardown. The remove path sets ->removing and drains the work while
1173+ * holding bus_reset_lock, so a racing armer is either drained or skips it.
1174+ */
1175+static void brcmf_bus_schedule_reset(struct brcmf_bus *bus_if)
1176+{
1177+ mutex_lock(&bus_if->bus_reset_lock);
1178+ if (bus_if->drvr && bus_if->drvr->bus_reset.func && !bus_if->removing)
1179+ schedule_work(&bus_if->drvr->bus_reset);
1180+ mutex_unlock(&bus_if->bus_reset_lock);
1181+}
1182+
1183+void brcmf_bus_cancel_reset_work(struct brcmf_bus *bus_if)
1184+{
1185+ mutex_lock(&bus_if->bus_reset_lock);
1186+ bus_if->removing = true;
1187+ if (bus_if->drvr)
1188+ cancel_work_sync(&bus_if->drvr->bus_reset);
1189+ mutex_unlock(&bus_if->bus_reset_lock);
1190+}
1191+
1192+void brcmf_bus_allow_reset_work(struct brcmf_bus *bus_if)
1193+{
1194+ mutex_lock(&bus_if->bus_reset_lock);
1195+ bus_if->removing = false;
1196+ mutex_unlock(&bus_if->bus_reset_lock);
1197+}
1198+
11701199 static void brcmf_core_bus_reset(struct work_struct *work)
11711200 {
11721201 struct brcmf_pub *drvr = container_of(work, struct brcmf_pub,
@@ -1187,7 +1216,7 @@ static ssize_t bus_reset_write(struct file *file, const char __user *user_buf, · 14 unmodified lines
11871216 if (value != 1)
11881217 return -EINVAL;
11891218
1190− schedule_work(&drvr->bus_reset);
1219+ brcmf_bus_schedule_reset(drvr->bus_if);
11911220
11921221 return count;
11931222 }
@@ -1417,14 +1446,23 @@ void brcmf_dev_coredump(struct device *dev) · 223 unmodified lines
14171446 void brcmf_fw_crashed(struct device *dev)
14181447 {
14191448 struct brcmf_bus *bus_if = dev_get_drvdata(dev);
1420− struct brcmf_pub *drvr = bus_if->drvr;
1449+ struct brcmf_pub *drvr;
1450+
1451+ /* May fire before brcmf_attach() wires up drvr, or after removal
1452+ * has cleared it; guard the derefs below (and the arming gate in
1453+ * brcmf_bus_schedule_reset() already checks drvr/->removing).
1454+ */
1455+ if (!bus_if)
1456+ return;
1457+ drvr = bus_if->drvr;
1458+ if (!drvr)
1459+ return;
14211460
14221461 bphy_err(drvr, "Firmware has halted or crashed\n");
14231462
14241463 brcmf_dev_coredump(dev);
14251464
1426− if (drvr->bus_reset.func)
1427− schedule_work(&drvr->bus_reset);
1465+ brcmf_bus_schedule_reset(bus_if);
14281466 }
14291467
14301468 void brcmf_detach(struct device *dev)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c+12−2
@@ -1383,16 +1383,20 @@ fail: · 1382 unmodified lines
13831383 static void
13841384 brcmf_pcie_release_scratchbuffers(struct brcmf_pciedev_info *devinfo)
13851385 {
1386− if (devinfo->shared.scratch)
1386+ if (devinfo->shared.scratch) {
13871387 dma_free_coherent(&devinfo->pdev->dev,
13881388 BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
13891389 devinfo->shared.scratch,
13901390 devinfo->shared.scratch_dmahandle);
1391− if (devinfo->shared.ringupd)
1391+ devinfo->shared.scratch = NULL;
1392+ }
1393+ if (devinfo->shared.ringupd) {
13921394 dma_free_coherent(&devinfo->pdev->dev,
13931395 BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
13941396 devinfo->shared.ringupd,
13951397 devinfo->shared.ringupd_dmahandle);
1398+ devinfo->shared.ringupd = NULL;
1399+ }
13961400 }
13971401
13981402 static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
@@ -2499,6 +2503,7 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 1100 unmodified lines
24992503 ret = -ENOMEM;
25002504 goto fail;
25012505 }
2506+ mutex_init(&bus->bus_reset_lock);
25022507 bus->msgbuf = kzalloc_obj(*bus->msgbuf);
25032508 if (!bus->msgbuf) {
25042509 ret = -ENOMEM;
@@ -2594,6 +2599,11 @@ brcmf_pcie_remove(struct pci_dev *pdev) · 89 unmodified lines
25942599 if (devinfo->ci)
25952600 brcmf_pcie_intr_disable(devinfo);
25962601
2602+ if (devinfo->irq_allocated)
2603+ synchronize_irq(pdev->irq);
2604+
2605+ brcmf_bus_cancel_reset_work(bus);
2606+
25972607 brcmf_detach(&pdev->dev);
25982608 brcmf_free(&pdev->dev);
25992609
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c+6−0
@@ -4560,6 +4560,12 @@ fail: · 4559 unmodified lines
45604560 return ret;
45614561 }
45624562
4563+void brcmf_sdio_cancel_datawork(struct brcmf_sdio *bus)
4564+{
4565+ if (bus)
4566+ cancel_work_sync(&bus->datawork);
4567+}
4568+
45634569 /* Detach and free everything */
45644570 void brcmf_sdio_remove(struct brcmf_sdio *bus)
45654571 {
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h+1−0
@@ -361,6 +361,7 @@ int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev); · 360 unmodified lines
361361 int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev);
362362 void brcmf_sdio_remove(struct brcmf_sdio *bus);
363363 void brcmf_sdio_isr(struct brcmf_sdio *bus, bool in_isr);
364+void brcmf_sdio_cancel_datawork(struct brcmf_sdio *bus);
364365
365366 void brcmf_sdio_wd_timer(struct brcmf_sdio *bus, bool active);
366367 void brcmf_sdio_wowl_config(struct device *dev, bool enabled);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c+3−0
@@ -1260,6 +1260,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo, · 1259 unmodified lines
12601260 ret = -ENOMEM;
12611261 goto fail;
12621262 }
1263+ mutex_init(&bus->bus_reset_lock);
12631264
12641265 bus->dev = dev;
12651266 bus_pub->bus = bus;
@@ -1329,6 +1330,8 @@ brcmf_usb_disconnect_cb(struct brcmf_usbdev_info *devinfo) · 63 unmodified lines
13291330 return;
13301331 brcmf_dbg(USB, "Enter, bus_pub %p\n", devinfo);
13311332
1333+ brcmf_bus_cancel_reset_work(devinfo->bus_pub.bus);
1334+
13321335 brcmf_detach(devinfo->dev);
13331336 brcmf_free(devinfo->dev);
13341337 kfree(devinfo->bus_pub.bus);
drivers/net/wireless/intel/iwlwifi/cfg/rf-pe.c+1−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 .non_shared_ant = ANT_B, \
1616 .vht_mu_mimo_supported = true, \
1717 .uhb_supported = true, \
18+ .unii9_supported = true, \
1819 .eht_supported = true, \
1920 .uhr_supported = true, \
2021 .num_rbds = IWL_NUM_RBDS_EHT, \
drivers/net/wireless/intel/iwlwifi/fw/acpi.c+5−0
@@ -865,6 +865,11 @@ int iwl_acpi_get_wgds_table(struct iwl_fw_runtime *fwrt) · 864 unmodified lines
865865 min_size, max_size,
866866 &tbl_rev);
867867 if (!IS_ERR(wifi_pkg)) {
868+ if (tbl_rev < 0 ||
869+ tbl_rev >= BITS_PER_BYTE *
870+ sizeof(rev_data[idx].revisions))
871+ continue;
872+
868873 if (!(BIT(tbl_rev) & rev_data[idx].revisions))
869874 continue;
870875
drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h+30−3
@@ -205,6 +205,7 @@ struct iwl_nvm_get_info_phy { · 204 unmodified lines
205205
206206 #define IWL_NUM_CHANNELS_V1 51
207207 #define IWL_NUM_CHANNELS_V2 110
208+#define IWL_NUM_CHANNELS_V3 115
208209
209210 /**
210211 * struct iwl_nvm_get_info_regulatory_v1 - regulatory information
@@ -219,12 +220,12 @@ struct iwl_nvm_get_info_regulatory_v1 { · 8 unmodified lines
219220 } __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */
220221
221222 /**
222− * struct iwl_nvm_get_info_regulatory - regulatory information
223+ * struct iwl_nvm_get_info_regulatory_v2 - regulatory information
223224 * @lar_enabled: is LAR enabled
224225 * @n_channels: number of valid channels in the array
225226 * @channel_profile: regulatory data of this channel
226227 */
227−struct iwl_nvm_get_info_regulatory {
228+struct iwl_nvm_get_info_regulatory_v2 {
228229 __le32 lar_enabled;
229230 __le32 n_channels;
230231 __le32 channel_profile[IWL_NUM_CHANNELS_V2];
@@ -244,6 +245,32 @@ struct iwl_nvm_get_info_rsp_v3 { · 13 unmodified lines
244245 struct iwl_nvm_get_info_regulatory_v1 regulatory;
245246 } __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_3 */
246247
248+/**
249+ * struct iwl_nvm_get_info_rsp_v4 - response to get NVM data
250+ * @general: general NVM data
251+ * @mac_sku: data relating to MAC sku
252+ * @phy_sku: data relating to PHY sku
253+ * @regulatory: regulatory data
254+ */
255+struct iwl_nvm_get_info_rsp_v4 {
256+ struct iwl_nvm_get_info_general general;
257+ struct iwl_nvm_get_info_sku mac_sku;
258+ struct iwl_nvm_get_info_phy phy_sku;
259+ struct iwl_nvm_get_info_regulatory_v2 regulatory;
260+} __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_4 */
261+
262+/**
263+ * struct iwl_nvm_get_info_regulatory - regulatory information
264+ * @lar_enabled: is LAR enabled
265+ * @n_channels: number of valid channels in the array
266+ * @channel_profile: regulatory data of this channel
267+ */
268+struct iwl_nvm_get_info_regulatory {
269+ __le32 lar_enabled;
270+ __le32 n_channels;
271+ __le32 channel_profile[IWL_NUM_CHANNELS_V3];
272+} __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_3 */
273+
247274 /**
248275 * struct iwl_nvm_get_info_rsp - response to get NVM data
249276 * @general: general NVM data
@@ -256,7 +283,7 @@ struct iwl_nvm_get_info_rsp { · 6 unmodified lines
256283 struct iwl_nvm_get_info_sku mac_sku;
257284 struct iwl_nvm_get_info_phy phy_sku;
258285 struct iwl_nvm_get_info_regulatory regulatory;
259−} __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_4 */
286+} __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_5 */
260287
261288 /**
262289 * struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed
drivers/net/wireless/intel/iwlwifi/fw/api/scan.h+2−2
@@ -1,6 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
22 /*
3− * Copyright (C) 2012-2014, 2018-2025 Intel Corporation
3+ * Copyright (C) 2012-2014, 2018-2026 Intel Corporation
44 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
55 * Copyright (C) 2016-2017 Intel Deutschland GmbH
66 */
@@ -1319,7 +1319,7 @@ struct iwl_scan_offload_match_info { · 1312 unmodified lines
13191319 u8 resume_while_scanning;
13201320 u8 self_recovery;
13211321 __le16 reserved;
1322− struct iwl_scan_offload_profile_match matches[];
1322+ struct iwl_scan_offload_profile_match matches[IWL_SCAN_MAX_PROFILES_V2];
13231323 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_3 and
13241324 * SCAN_OFFLOAD_MATCH_INFO_NOTIFICATION_S_VER_1
13251325 */
drivers/net/wireless/intel/iwlwifi/fw/pnvm.c+8−1
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22 /*
3− * Copyright(c) 2020-2025 Intel Corporation
3+ * Copyright(c) 2020-2026 Intel Corporation
44 */
55
66 #include "iwl-drv.h"
@@ -12,6 +12,7 @@ · 5 unmodified lines
1212 #include "fw/api/alive.h"
1313 #include "fw/uefi.h"
1414 #include "fw/img.h"
15+#include "fw/dbg.h"
1516
1617 #define IWL_PNVM_REDUCED_CAP_BIT BIT(25)
1718
@@ -26,6 +27,12 @@ static bool iwl_pnvm_complete_fn(struct iwl_notif_wait_data *notif_wait, · 8 unmodified lines
2627 struct iwl_trans *trans = (struct iwl_trans *)data;
2728 struct iwl_pnvm_init_complete_ntfy *pnvm_ntf = (void *)pkt->data;
2829
30+ if (IWL_FW_CHECK(trans,
31+ iwl_rx_packet_payload_len(pkt) < sizeof(*pnvm_ntf),
32+ "Bad notif len: %d\n",
33+ iwl_rx_packet_payload_len(pkt)))
34+ return true;
35+
2936 IWL_DEBUG_FW(trans,
3037 "PNVM complete notification received with status 0x%0x\n",
3138 le32_to_cpu(pnvm_ntf->status));
drivers/net/wireless/intel/iwlwifi/fw/regulatory.c+1−1
@@ -389,7 +389,7 @@ bool iwl_add_mcc_to_tas_block_list(u16 *list, u8 *size, u16 mcc) · 388 unmodified lines
389389 if (*size >= IWL_WTAS_BLACK_LIST_MAX)
390390 return false;
391391
392− list[*size++] = mcc;
392+ list[(*size)++] = mcc;
393393 return true;
394394 }
395395 IWL_EXPORT_SYMBOL(iwl_add_mcc_to_tas_block_list);
drivers/net/wireless/intel/iwlwifi/fw/smem.c+23−5
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22 /*
3− * Copyright (C) 2012-2014, 2018-2021, 2025 Intel Corporation
3+ * Copyright (C) 2012-2014, 2018-2021, 2025-2026 Intel Corporation
44 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
55 * Copyright (C) 2016-2017 Intel Deutschland GmbH
66 */
@@ -14,9 +14,17 @@ static void iwl_parse_shared_mem_22000(struct iwl_fw_runtime *fwrt, · 7 unmodified lines
1414 {
1515 struct iwl_shared_mem_cfg *mem_cfg = (void *)pkt->data;
1616 int i, lmac;
17− int lmac_num = le32_to_cpu(mem_cfg->lmac_num);
18− u8 api_ver = iwl_fw_lookup_notif_ver(fwrt->fw, SYSTEM_GROUP,
19− SHARED_MEM_CFG_CMD, 0);
17+ int lmac_num;
18+ u8 api_ver;
19+
20+ if (IWL_FW_CHECK(fwrt, iwl_rx_packet_payload_len(pkt) <
21+ offsetofend(struct iwl_shared_mem_cfg, lmac_smem[1]),
22+ "bad shared mem notification size\n"))
23+ return;
24+
25+ lmac_num = le32_to_cpu(mem_cfg->lmac_num);
26+ api_ver = iwl_fw_lookup_notif_ver(fwrt->fw, SYSTEM_GROUP,
27+ SHARED_MEM_CFG_CMD, 0);
2028
2129 /* Note: notification has 3 entries, but we only expect 2 */
2230 if (IWL_FW_CHECK(fwrt, lmac_num > ARRAY_SIZE(fwrt->smem_cfg.lmac),
@@ -30,7 +38,7 @@ static void iwl_parse_shared_mem_22000(struct iwl_fw_runtime *fwrt, · 7 unmodified lines
3038
3139 if (api_ver >= 4 &&
3240 !IWL_FW_CHECK(fwrt, iwl_rx_packet_payload_len(pkt) < sizeof(*mem_cfg),
33− "bad shared mem notification size\n")) {
41+ "bad shared mem notification size (v4)\n")) {
3442 fwrt->smem_cfg.rxfifo2_control_size =
3543 le32_to_cpu(mem_cfg->rxfifo2_control_size);
3644 }
@@ -53,6 +61,11 @@ static void iwl_parse_shared_mem(struct iwl_fw_runtime *fwrt, · 16 unmodified lines
5361 struct iwl_shared_mem_cfg_v2 *mem_cfg = (void *)pkt->data;
5462 int i;
5563
64+ if (IWL_FW_CHECK(fwrt, iwl_rx_packet_payload_len(pkt) <
65+ offsetof(struct iwl_shared_mem_cfg_v2, rxfifo_addr),
66+ "bad shared mem notification size\n"))
67+ return;
68+
5669 fwrt->smem_cfg.num_lmacs = 1;
5770
5871 fwrt->smem_cfg.num_txfifo_entries = ARRAY_SIZE(mem_cfg->txfifo_size);
@@ -67,6 +80,11 @@ static void iwl_parse_shared_mem(struct iwl_fw_runtime *fwrt, · 8 unmodified lines
6780 /* new API has more data, from rxfifo_addr field and on */
6881 if (fw_has_capa(&fwrt->fw->ucode_capa,
6982 IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG)) {
83+ if (IWL_FW_CHECK(fwrt, iwl_rx_packet_payload_len(pkt) <
84+ sizeof(*mem_cfg),
85+ "bad shared mem notification size (extend)\n"))
86+ return;
87+
7088 BUILD_BUG_ON(sizeof(fwrt->smem_cfg.internal_txfifo_size) !=
7189 sizeof(mem_cfg->internal_txfifo_size));
7290
drivers/net/wireless/intel/iwlwifi/fw/uefi.c+1−1
@@ -700,7 +700,7 @@ int iwl_uefi_get_ppag_table(struct iwl_fw_runtime *fwrt) · 699 unmodified lines
700700 return -EINVAL;
701701
702702 parse_table:
703− if (!(BIT(data->revision) & valid_rev)) {
703+ if (data->revision >= 32 || !(BIT(data->revision) & valid_rev)) {
704704 ret = -EINVAL;
705705 IWL_DEBUG_RADIO(fwrt,
706706 "Unsupported UEFI PPAG revision:%d\n",
drivers/net/wireless/intel/iwlwifi/iwl-config.h+2−0
@@ -415,6 +415,7 @@ struct iwl_mac_cfg { · 414 unmodified lines
415415 * @vht_mu_mimo_supported: VHT MU-MIMO support
416416 * @nvm_type: see &enum iwl_nvm_type
417417 * @uhb_supported: ultra high band channels supported
418+ * @unii9_supported: UNII-9 channels supported
418419 * @eht_supported: EHT supported
419420 * @uhr_supported: UHR supported
420421 * @num_rbds: number of receive buffer descriptors to use
@@ -450,6 +451,7 @@ struct iwl_rf_cfg { · 29 unmodified lines
450451 lp_xtal_workaround:1,
451452 vht_mu_mimo_supported:1,
452453 uhb_supported:1,
454+ unii9_supported:1,
453455 eht_supported:1,
454456 uhr_supported:1;
455457 u8 valid_tx_ant;
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c+11−2
@@ -475,6 +475,7 @@ static int iwl_dbg_tlv_parse_bin(struct iwl_trans *trans, const u8 *data, · 474 unmodified lines
475475 {
476476 const struct iwl_ucode_tlv *tlv;
477477 u32 tlv_len;
478+ size_t aligned_tlv_len;
478479
479480 while (len >= sizeof(*tlv)) {
480481 len -= sizeof(*tlv);
@@ -487,8 +488,16 @@ static int iwl_dbg_tlv_parse_bin(struct iwl_trans *trans, const u8 *data, · 6 unmodified lines
487488 len, tlv_len);
488489 return -EINVAL;
489490 }
490− len -= ALIGN(tlv_len, 4);
491− data += sizeof(*tlv) + ALIGN(tlv_len, 4);
491+
492+ aligned_tlv_len = ALIGN(tlv_len, 4);
493+ if (len < aligned_tlv_len) {
494+ IWL_ERR(trans, "invalid aligned TLV len: %zd/%zu\n",
495+ len, aligned_tlv_len);
496+ return -EINVAL;
497+ }
498+
499+ len -= aligned_tlv_len;
500+ data += sizeof(*tlv) + aligned_tlv_len;
492501
493502 iwl_dbg_tlv_alloc(trans, tlv, true);
494503 }
drivers/net/wireless/intel/iwlwifi/iwl-drv.c+15−3
@@ -492,7 +492,7 @@ static void set_sec_offset(struct iwl_firmware_pieces *pieces, · 491 unmodified lines
492492 * Gets uCode section from tlv.
493493 */
494494 static int iwl_store_ucode_sec(struct fw_img_parsing *img,
495− const void *data, int size)
495+ const void *data, size_t size)
496496 {
497497 struct fw_sec *sec;
498498 const struct fw_sec_parsing *sec_parse;
@@ -501,6 +501,9 @@ static int iwl_store_ucode_sec(struct fw_img_parsing *img, · 2 unmodified lines
501501 if (WARN_ON(!img || !data))
502502 return -EINVAL;
503503
504+ if (size < sizeof(sec_parse->offset))
505+ return -EINVAL;
506+
504507 sec_parse = (const struct fw_sec_parsing *)data;
505508
506509 alloc_size = sizeof(*img->sec) * (img->sec_counter + 1);
@@ -804,6 +807,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, · 297 unmodified lines
804807 u32 build, paging_mem_size;
805808 int num_of_cpus;
806809 bool usniffer_req = false;
810+ size_t aligned_tlv_len;
807811
808812 if (len < sizeof(*ucode)) {
809813 IWL_ERR(drv, "uCode has invalid length: %zd\n", len);
@@ -852,8 +856,16 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, · 42 unmodified lines
852856 len, tlv_len);
853857 return -EINVAL;
854858 }
855− len -= ALIGN(tlv_len, 4);
856− data += sizeof(*tlv) + ALIGN(tlv_len, 4);
859+
860+ aligned_tlv_len = ALIGN(tlv_len, 4);
861+ if (len < aligned_tlv_len) {
862+ IWL_ERR(drv, "invalid aligned TLV len: %zd/%zu\n",
863+ len, aligned_tlv_len);
864+ return -EINVAL;
865+ }
866+
867+ len -= aligned_tlv_len;
868+ data += sizeof(*tlv) + aligned_tlv_len;
857869
858870 switch (tlv_type) {
859871 case IWL_UCODE_TLV_INST:
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c+41−23
@@ -85,16 +85,7 @@ static const u16 iwl_nvm_channels[] = { · 84 unmodified lines
8585 149, 153, 157, 161, 165
8686 };
8787
88−static const u16 iwl_ext_nvm_channels[] = {
89− /* 2.4 GHz */
90− 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
91− /* 5 GHz */
92− 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92,
93− 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144,
94− 149, 153, 157, 161, 165, 169, 173, 177, 181
95−};
96−
97−static const u16 iwl_uhb_nvm_channels[] = {
88+static const u16 iwl_unii9_nvm_channels[] = {
9889 /* 2.4 GHz */
9990 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
10091 /* 5 GHz */
@@ -105,12 +96,16 @@ static const u16 iwl_uhb_nvm_channels[] = { · 4 unmodified lines
10596 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69,
10697 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129,
10798 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185,
108− 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233
99+ 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233,
100+
101+ /* UNII-9 */
102+ 237, 241, 245, 249, 253
109103 };
110104
111105 #define IWL_NVM_NUM_CHANNELS ARRAY_SIZE(iwl_nvm_channels)
112−#define IWL_NVM_NUM_CHANNELS_EXT ARRAY_SIZE(iwl_ext_nvm_channels)
113−#define IWL_NVM_NUM_CHANNELS_UHB ARRAY_SIZE(iwl_uhb_nvm_channels)
106+#define IWL_NVM_NUM_CHANNELS_EXT 51
107+#define IWL_NVM_NUM_CHANNELS_UHB 110
108+#define IWL_NVM_NUM_CHANNELS_UNII9 ARRAY_SIZE(iwl_unii9_nvm_channels)
114109 #define NUM_2GHZ_CHANNELS 14
115110 #define NUM_5GHZ_CHANNELS 37
116111 #define FIRST_2GHZ_HT_MINUS 5
@@ -351,12 +346,15 @@ static int iwl_init_channel_map(struct iwl_trans *trans, · 234 unmodified lines
351346 int num_of_ch;
352347 const u16 *nvm_chan;
353348
354− if (cfg->uhb_supported) {
349+ if (cfg->unii9_supported) {
350+ num_of_ch = IWL_NVM_NUM_CHANNELS_UNII9;
351+ nvm_chan = iwl_unii9_nvm_channels;
352+ } else if (cfg->uhb_supported) {
355353 num_of_ch = IWL_NVM_NUM_CHANNELS_UHB;
356− nvm_chan = iwl_uhb_nvm_channels;
354+ nvm_chan = iwl_unii9_nvm_channels;
357355 } else if (cfg->nvm_type == IWL_NVM_EXT) {
358356 num_of_ch = IWL_NVM_NUM_CHANNELS_EXT;
359− nvm_chan = iwl_ext_nvm_channels;
357+ nvm_chan = iwl_unii9_nvm_channels;
360358 } else {
361359 num_of_ch = IWL_NVM_NUM_CHANNELS;
362360 nvm_chan = iwl_nvm_channels;
@@ -1441,7 +1439,9 @@ iwl_parse_mei_nvm_data(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg, · 1078 unmodified lines
14411439 u8 rx_chains = fw->valid_rx_ant;
14421440 u8 tx_chains = fw->valid_rx_ant;
14431441
1444− if (cfg->uhb_supported)
1442+ if (cfg->unii9_supported)
1443+ data = kzalloc_flex(*data, channels, IWL_NVM_NUM_CHANNELS_UNII9);
1444+ else if (cfg->uhb_supported)
14451445 data = kzalloc_flex(*data, channels, IWL_NVM_NUM_CHANNELS_UHB);
14461446 else
14471447 data = kzalloc_flex(*data, channels, IWL_NVM_NUM_CHANNELS_EXT);
@@ -1506,7 +1506,9 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg, · 58 unmodified lines
15061506 u16 lar_config;
15071507 const __le16 *ch_section;
15081508
1509− if (cfg->uhb_supported)
1509+ if (cfg->unii9_supported)
1510+ data = kzalloc_flex(*data, channels, IWL_NVM_NUM_CHANNELS_UNII9);
1511+ else if (cfg->uhb_supported)
15101512 data = kzalloc_flex(*data, channels, IWL_NVM_NUM_CHANNELS_UHB);
15111513 else if (cfg->nvm_type != IWL_NVM_EXT)
15121514 data = kzalloc_flex(*data, channels, IWL_NVM_NUM_CHANNELS);
@@ -1727,12 +1729,15 @@ iwl_parse_nvm_mcc_info(struct iwl_trans *trans, · 214 unmodified lines
17271729 int max_num_ch;
17281730 struct iwl_reg_capa reg_capa;
17291731
1730− if (cfg->uhb_supported) {
1732+ if (cfg->unii9_supported) {
1733+ max_num_ch = IWL_NVM_NUM_CHANNELS_UNII9;
1734+ nvm_chan = iwl_unii9_nvm_channels;
1735+ } else if (cfg->uhb_supported) {
17311736 max_num_ch = IWL_NVM_NUM_CHANNELS_UHB;
1732− nvm_chan = iwl_uhb_nvm_channels;
1737+ nvm_chan = iwl_unii9_nvm_channels;
17331738 } else if (cfg->nvm_type == IWL_NVM_EXT) {
17341739 max_num_ch = IWL_NVM_NUM_CHANNELS_EXT;
1735− nvm_chan = iwl_ext_nvm_channels;
1740+ nvm_chan = iwl_unii9_nvm_channels;
17361741 } else {
17371742 max_num_ch = IWL_NVM_NUM_CHANNELS;
17381743 nvm_chan = iwl_nvm_channels;
@@ -2087,13 +2092,26 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans, · 348 unmodified lines
20872092 struct iwl_nvm_get_info_rsp_v3 *rsp_v3;
20882093 bool v4 = fw_has_api(&fw->ucode_capa,
20892094 IWL_UCODE_TLV_API_REGULATORY_NVM_INFO);
2090− size_t rsp_size = v4 ? sizeof(*rsp) : sizeof(*rsp_v3);
2095+ size_t rsp_size;
20912096 void *channel_profile;
20922097
20932098 ret = iwl_trans_send_cmd(trans, &hcmd);
20942099 if (ret)
20952100 return ERR_PTR(ret);
20962101
2102+ switch (iwl_fw_lookup_notif_ver(fw, REGULATORY_AND_NVM_GROUP,
2103+ NVM_GET_INFO, 0)) {
2104+ case 5:
2105+ rsp_size = sizeof(struct iwl_nvm_get_info_rsp);
2106+ break;
2107+ case 4:
2108+ rsp_size = sizeof(struct iwl_nvm_get_info_rsp_v4);
2109+ break;
2110+ default:
2111+ rsp_size = sizeof(struct iwl_nvm_get_info_rsp_v3);
2112+ break;
2113+ }
2114+
20972115 if (WARN(iwl_rx_packet_payload_len(hcmd.resp_pkt) != rsp_size,
20982116 "Invalid payload len in NVM response from FW %d",
20992117 iwl_rx_packet_payload_len(hcmd.resp_pkt))) {
@@ -2107,7 +2125,7 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans, · 7 unmodified lines
21072125 if (empty_otp)
21082126 IWL_INFO(trans, "OTP is empty\n");
21092127
2110− nvm = kzalloc_flex(*nvm, channels, IWL_NUM_CHANNELS_V2);
2128+ nvm = kzalloc_flex(*nvm, channels, IWL_NUM_CHANNELS_V3);
21112129 if (!nvm) {
21122130 ret = -ENOMEM;
21132131 goto out;
drivers/net/wireless/intel/iwlwifi/mld/agg.c+6−1
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22 /*
3− * Copyright (C) 2024-2025 Intel Corporation
3+ * Copyright (C) 2024-2026 Intel Corporation
44 */
55 #include "agg.h"
66 #include "sta.h"
@@ -222,6 +222,11 @@ iwl_mld_reorder(struct iwl_mld *mld, struct napi_struct *napi, · 215 unmodified lines
222222 if (baid == IWL_RX_REORDER_DATA_INVALID_BAID)
223223 return IWL_MLD_PASS_SKB;
224224
225+ if (IWL_FW_CHECK(mld, baid >= ARRAY_SIZE(mld->fw_id_to_ba),
226+ "Got out-of-range BAID %u in reorder_data=0x%x\n",
227+ baid, reorder))
228+ return IWL_MLD_PASS_SKB;
229+
225230 /* no sta yet */
226231 if (WARN_ONCE(!sta,
227232 "Got valid BAID without a valid station assigned\n"))
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c+1−1
@@ -1708,7 +1708,7 @@ static void iwl_mld_check_he_obss_narrow_bw_ru_iter(struct wiphy *wiphy, · 1707 unmodified lines
17081708 elem = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, ies->data,
17091709 ies->len);
17101710
1711− if (!elem || elem->datalen < 10 ||
1711+ if (!elem || elem->datalen < 11 ||
17121712 !(elem->data[10] &
17131713 WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT)) {
17141714 *tolerated = false;
drivers/net/wireless/intel/iwlwifi/mld/mcc.c+8−2
@@ -18,9 +18,15 @@ static struct iwl_mcc_update_resp_v8 * · 17 unmodified lines
1818 iwl_mld_copy_mcc_resp(const struct iwl_rx_packet *pkt)
1919 {
2020 const struct iwl_mcc_update_resp_v8 *mcc_resp_v8 = (const void *)pkt->data;
21− int n_channels = __le32_to_cpu(mcc_resp_v8->n_channels);
2221 struct iwl_mcc_update_resp_v8 *resp_cp;
23− int notif_len = struct_size(resp_cp, channels, n_channels);
22+ int n_channels;
23+ int notif_len;
24+
25+ if (iwl_rx_packet_payload_len(pkt) < sizeof(*mcc_resp_v8))
26+ return ERR_PTR(-EINVAL);
27+
28+ n_channels = __le32_to_cpu(mcc_resp_v8->n_channels);
29+ notif_len = struct_size(resp_cp, channels, n_channels);
2430
2531 if (iwl_rx_packet_payload_len(pkt) != notif_len)
2632 return ERR_PTR(-EINVAL);
drivers/net/wireless/intel/iwlwifi/mld/thermal.c+4−5
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22 /*
3− * Copyright (C) 2024-2025 Intel Corporation
3+ * Copyright (C) 2024-2026 Intel Corporation
44 */
55 #ifdef CONFIG_THERMAL
66 #include <linux/sort.h>
@@ -272,6 +272,7 @@ static void iwl_mld_thermal_zone_register(struct iwl_mld *mld) · 265 unmodified lines
272272 if (ret) {
273273 IWL_DEBUG_TEMP(mld, "Failed to enable thermal zone\n");
274274 thermal_zone_device_unregister(mld->tzone);
275+ mld->tzone = NULL;
275276 }
276277 }
277278
@@ -385,10 +386,8 @@ static void iwl_mld_thermal_zone_unregister(struct iwl_mld *mld) · 107 unmodified lines
385386 return;
386387
387388 IWL_DEBUG_TEMP(mld, "Thermal zone device unregister\n");
388− if (mld->tzone) {
389− thermal_zone_device_unregister(mld->tzone);
390− mld->tzone = NULL;
391− }
389+ thermal_zone_device_unregister(mld->tzone);
390+ mld->tzone = NULL;
392391 }
393392
394393 static void iwl_mld_cooling_device_unregister(struct iwl_mld *mld)
drivers/net/wireless/intel/iwlwifi/mld/tx.c+4−0
@@ -1120,6 +1120,10 @@ void iwl_mld_handle_tx_resp_notif(struct iwl_mld *mld, · 1119 unmodified lines
11201120 ssn = le32_to_cpup((__le32 *)agg_status +
11211121 tx_resp->frame_count) & 0xFFFF;
11221122
1123+ if (IWL_FW_CHECK(mld, txq_id >= ARRAY_SIZE(mld->fw_id_to_txq),
1124+ "Invalid txq id %d\n", txq_id))
1125+ return;
1126+
11231127 __skb_queue_head_init(&skbs);
11241128
11251129 /* we can free until ssn % q.n_bd not inclusive */
drivers/net/wireless/intel/iwlwifi/mvm/d3.c+33−13
@@ -1509,6 +1509,10 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm, · 1508 unmodified lines
15091509 if (WARN_ON_ONCE(truncated < 0))
15101510 truncated = 0;
15111511
1512+ /* this would be a firmware bug */
1513+ if (WARN_ON_ONCE(pktsize < sizeof(*hdr)))
1514+ return;
1515+
15121516 if (ieee80211_is_data(hdr->frame_control)) {
15131517 int hdrlen = ieee80211_hdrlen(hdr->frame_control);
15141518 int ivlen = 0, icvlen = 4; /* also FCS */
@@ -1517,10 +1521,6 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm, · 2 unmodified lines
15171521 if (!pkt)
15181522 goto report;
15191523
1520− skb_put_data(pkt, pktdata, hdrlen);
1521− pktdata += hdrlen;
1522− pktsize -= hdrlen;
1523−
15241524 if (ieee80211_has_protected(hdr->frame_control)) {
15251525 /*
15261526 * This is unlocked and using gtk_i(c)vlen,
@@ -1539,13 +1539,24 @@ static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm, · 12 unmodified lines
15391539
15401540 /* if truncated, FCS/ICV is (partially) gone */
15411541 if (truncated >= icvlen) {
1542− icvlen = 0;
15431542 truncated -= icvlen;
1543+ icvlen = 0;
15441544 } else {
15451545 icvlen -= truncated;
15461546 truncated = 0;
15471547 }
15481548
1549+ if (IWL_FW_CHECK(mvm,
1550+ pktsize <= hdrlen + ivlen + icvlen,
1551+ "pktsize is too small %d\n",
1552+ pktsize)) {
1553+ kfree_skb(pkt);
1554+ return;
1555+ }
1556+
1557+ skb_put_data(pkt, pktdata, hdrlen);
1558+ pktdata += hdrlen;
1559+ pktsize -= hdrlen;
15491560 pktsize -= ivlen + icvlen;
15501561 pktdata += ivlen;
15511562
@@ -2123,16 +2134,16 @@ static void iwl_mvm_parse_wowlan_info_notif(struct iwl_mvm *mvm, · 571 unmodified lines
21232134 struct iwl_wowlan_status_data *status,
21242135 u32 len)
21252136 {
2126− if (IWL_FW_CHECK(mvm, data->num_mlo_link_keys,
2127− "MLO is not supported, shouldn't receive MLO keys\n"))
2128− return;
2129−
21302137 if (len < sizeof(*data)) {
21312138 IWL_ERR(mvm, "Invalid WoWLAN info notification!\n");
21322139 status = NULL;
21332140 return;
21342141 }
21352142
2143+ if (IWL_FW_CHECK(mvm, data->num_mlo_link_keys,
2144+ "MLO is not supported, shouldn't receive MLO keys\n"))
2145+ return;
2146+
21362147 if (mvm->fast_resume)
21372148 return;
21382149
@@ -2448,13 +2459,15 @@ iwl_mvm_netdetect_query_results(struct iwl_mvm *mvm, · 309 unmodified lines
24482459
24492460 if (fw_has_api(&mvm->fw->ucode_capa,
24502461 IWL_UCODE_TLV_API_SCAN_OFFLOAD_CHANS)) {
2451− query_len = sizeof(struct iwl_scan_offload_match_info);
24522462 matches_len = sizeof(struct iwl_scan_offload_profile_match) *
24532463 max_profiles;
2464+ query_len = offsetof(struct iwl_scan_offload_match_info,
2465+ matches) + matches_len;
24542466 } else {
2455− query_len = sizeof(struct iwl_scan_offload_profiles_query_v1);
24562467 matches_len = sizeof(struct iwl_scan_offload_profile_match_v1) *
24572468 max_profiles;
2469+ query_len = sizeof(struct iwl_scan_offload_profiles_query_v1) +
2470+ matches_len;
24582471 }
24592472
24602473 len = iwl_rx_packet_payload_len(cmd.resp_pkt);
@@ -2756,7 +2769,7 @@ static int iwl_mvm_wowlan_store_wake_pkt(struct iwl_mvm *mvm, · 295 unmodified lines
27562769 struct iwl_wowlan_status_data *status,
27572770 u32 len)
27582771 {
2759− u32 data_size, packet_len = le32_to_cpu(notif->wake_packet_length);
2772+ u32 data_size, packet_len;
27602773
27612774 if (len < sizeof(*notif)) {
27622775 IWL_ERR(mvm, "Invalid WoWLAN wake packet notification!\n");
@@ -2775,6 +2788,7 @@ static int iwl_mvm_wowlan_store_wake_pkt(struct iwl_mvm *mvm, · 12 unmodified lines
27752788 return -EIO;
27762789 }
27772790
2791+ packet_len = le32_to_cpu(notif->wake_packet_length);
27782792 data_size = len - offsetof(struct iwl_wowlan_wake_pkt_notif, wake_packet);
27792793
27802794 /* data_size got the padding from the notification, remove it. */
@@ -2807,7 +2821,8 @@ static void iwl_mvm_nd_match_info_handler(struct iwl_mvm *mvm, · 26 unmodified lines
28072821 if (IS_ERR_OR_NULL(vif))
28082822 return;
28092823
2810− if (len < sizeof(struct iwl_scan_offload_match_info) + matches_len) {
2824+ if (len < offsetof(struct iwl_scan_offload_match_info, matches) +
2825+ matches_len) {
28112826 IWL_ERR(mvm, "Invalid scan match info notification\n");
28122827 return;
28132828 }
@@ -2942,6 +2957,11 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait, · 128 unmodified lines
29422957 case WIDE_ID(PROT_OFFLOAD_GROUP, D3_END_NOTIFICATION): {
29432958 struct iwl_d3_end_notif *notif = (void *)pkt->data;
29442959
2960+ if (len < sizeof(*notif)) {
2961+ IWL_ERR(mvm, "Invalid D3 end notification size\n");
2962+ break;
2963+ }
2964+
29452965 d3_data->d3_end_flags = __le32_to_cpu(notif->flags);
29462966 d3_data->notif_received |= IWL_D3_NOTIF_D3_END_NOTIF;
29472967
drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c+38−17
@@ -646,7 +646,8 @@ static void iter(struct ieee80211_hw *hw, · 645 unmodified lines
646646 WARN_ON(*target->cipher == IWL_LOCATION_CIPHER_INVALID);
647647 }
648648
649−static void
649+/* The tk buffer is assumed to be exactly TK_11AZ_LEN bytes */
650+static int
650651 iwl_mvm_ftm_set_secured_ranging(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
651652 u8 *bssid, u8 *cipher, u8 *hltk, u8 *tk,
652653 u8 *rx_pn, u8 *tx_pn, __le32 *flags)
@@ -656,12 +657,12 @@ iwl_mvm_ftm_set_secured_ranging(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 3 unmodified lines
656657 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
657658
658659 if (mvmvif->ftm_unprotected)
659− return;
660+ return 0;
660661 #endif
661662
662663 if (!(le32_to_cpu(*flags) & (IWL_INITIATOR_AP_FLAGS_NON_TB |
663664 IWL_INITIATOR_AP_FLAGS_TB)))
664− return;
665+ return 0;
665666
666667 lockdep_assert_held(&mvm->mutex);
667668
@@ -679,14 +680,31 @@ iwl_mvm_ftm_set_secured_ranging(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 11 unmodified lines
679680 if (vif->cfg.assoc &&
680681 !memcmp(vif->bss_conf.bssid, bssid, ETH_ALEN)) {
681682 struct iwl_mvm_ftm_iter_data target;
683+ u32 key_len;
682684
683685 target.bssid = bssid;
684686 target.cipher = cipher;
685687 target.tk = NULL;
686688 ieee80211_iter_keys(mvm->hw, vif, iter, &target);
687689
688− if (!WARN_ON(!target.tk))
689− memcpy(tk, target.tk, TK_11AZ_LEN);
690+ if (WARN_ON(!target.tk))
691+ return -EINVAL;
692+
693+ switch (*target.cipher) {
694+ case IWL_LOCATION_CIPHER_CCMP_128:
695+ case IWL_LOCATION_CIPHER_GCMP_128:
696+ key_len = WLAN_KEY_LEN_CCMP;
697+ break;
698+ case IWL_LOCATION_CIPHER_GCMP_256:
699+ key_len = WLAN_KEY_LEN_GCMP_256;
700+ break;
701+ default:
702+ WARN_ON(1);
703+ return -EINVAL;
704+ }
705+
706+ memset(tk, 0, TK_11AZ_LEN);
707+ memcpy(tk, target.tk, key_len);
690708 } else {
691709 memcpy(tk, entry->tk, sizeof(entry->tk));
692710 }
@@ -695,8 +713,10 @@ iwl_mvm_ftm_set_secured_ranging(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 2 unmodified lines
695713 memcpy(tx_pn, entry->tx_pn, sizeof(entry->tx_pn));
696714
697715 FTM_SET_FLAG(SECURED);
698− return;
716+ return 0;
699717 }
718+
719+ return 0;
700720 }
701721
702722 static int
@@ -708,12 +728,11 @@ iwl_mvm_ftm_put_target_v7(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 5 unmodified lines
708728 if (err)
709729 return err;
710730
711− iwl_mvm_ftm_set_secured_ranging(mvm, vif, target->bssid,
712− &target->cipher, target->hltk,
713− target->tk, target->rx_pn,
714− target->tx_pn,
715− &target->initiator_ap_flags);
716− return err;
731+ return iwl_mvm_ftm_set_secured_ranging(mvm, vif, target->bssid,
732+ &target->cipher, target->hltk,
733+ target->tk, target->rx_pn,
734+ target->tx_pn,
735+ &target->initiator_ap_flags);
717736 }
718737
719738 static int iwl_mvm_ftm_start_v11(struct iwl_mvm *mvm,
@@ -881,11 +900,13 @@ iwl_mvm_ftm_put_target_v10(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 161 unmodified lines
881900 iwl_mvm_ftm_set_target_flags(mvm, peer, &target->initiator_ap_flags);
882901 iwl_mvm_ftm_set_sta(mvm, vif, peer, &target->sta_id,
883902 &target->initiator_ap_flags);
884− iwl_mvm_ftm_set_secured_ranging(mvm, vif, target->bssid,
885− &target->cipher, target->hltk,
886− target->tk, target->rx_pn,
887− target->tx_pn,
888− &target->initiator_ap_flags);
903+ ret = iwl_mvm_ftm_set_secured_ranging(mvm, vif, target->bssid,
904+ &target->cipher, target->hltk,
905+ target->tk, target->rx_pn,
906+ target->tx_pn,
907+ &target->initiator_ap_flags);
908+ if (ret)
909+ return ret;
889910
890911 i2r_max_sts = IWL_MVM_FTM_I2R_MAX_STS > 1 ? 1 :
891912 IWL_MVM_FTM_I2R_MAX_STS;
drivers/net/wireless/intel/iwlwifi/mvm/fw.c+10−0
@@ -964,12 +964,22 @@ int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) · 963 unmodified lines
964964 return ret;
965965 }
966966
967+ if (IWL_FW_CHECK(mvm,
968+ iwl_rx_packet_payload_len(cmd.resp_pkt) !=
969+ sizeof(*resp),
970+ "Wrong size for iwl_geo_tx_power_profiles_resp: %d\n",
971+ iwl_rx_packet_payload_len(cmd.resp_pkt))) {
972+ ret = -EIO;
973+ goto out;
974+ }
975+
967976 resp = (void *)cmd.resp_pkt->data;
968977 ret = le32_to_cpu(resp->profile_idx);
969978
970979 if (WARN_ON(ret > BIOS_GEO_MAX_PROFILE_NUM))
971980 ret = -EIO;
972981
982+out:
973983 iwl_free_resp(&cmd);
974984 return ret;
975985 }
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c+15−10
@@ -1493,49 +1493,54 @@ void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm, · 1492 unmodified lines
14931493 {
14941494 struct iwl_rx_packet *pkt = rxb_addr(rxb);
14951495 unsigned int pkt_len = iwl_rx_packet_payload_len(pkt);
1496− struct iwl_extended_beacon_notif *beacon = (void *)pkt->data;
1497− struct iwl_extended_beacon_notif_v5 *beacon_v5 = (void *)pkt->data;
14981496 struct ieee80211_vif *csa_vif;
14991497 struct ieee80211_vif *tx_blocked_vif;
15001498 struct agg_tx_status *agg_status;
1499+ u32 beacon_gp2;
15011500 u16 status;
15021501
15031502 lockdep_assert_held(&mvm->mutex);
15041503
1505− mvm->ap_last_beacon_gp2 = le32_to_cpu(beacon->gp2);
1506−
15071504 if (!iwl_mvm_is_short_beacon_notif_supported(mvm)) {
1505+ struct iwl_extended_beacon_notif_v5 *beacon = (void *)pkt->data;
15081506 struct iwl_tx_resp *beacon_notify_hdr =
1509− &beacon_v5->beacon_notify_hdr;
1507+ &beacon->beacon_notify_hdr;
15101508
1511− if (unlikely(pkt_len < sizeof(*beacon_v5)))
1509+ if (unlikely(pkt_len < sizeof(*beacon)))
15121510 return;
15131511
1514− mvm->ibss_manager = beacon_v5->ibss_mgr_status != 0;
1512+ beacon_gp2 = le32_to_cpu(beacon->gp2);
1513+
1514+ mvm->ibss_manager = beacon->ibss_mgr_status != 0;
15151515 agg_status = iwl_mvm_get_agg_status(mvm, beacon_notify_hdr);
15161516 status = le16_to_cpu(agg_status->status) & TX_STATUS_MSK;
15171517 IWL_DEBUG_RX(mvm,
15181518 "beacon status %#x retries:%d tsf:0x%016llX gp2:0x%X rate:%d\n",
15191519 status, beacon_notify_hdr->failure_frame,
15201520 le64_to_cpu(beacon->tsf),
1521− mvm->ap_last_beacon_gp2,
1521+ beacon_gp2,
15221522 le32_to_cpu(beacon_notify_hdr->initial_rate));
15231523 } else {
1524+ const struct iwl_extended_beacon_notif *beacon =
1525+ (void *)pkt->data;
1526+
15241527 if (unlikely(pkt_len < sizeof(*beacon)))
15251528 return;
15261529
1530+ beacon_gp2 = le32_to_cpu(beacon->gp2);
1531+
15271532 mvm->ibss_manager = beacon->ibss_mgr_status != 0;
15281533 status = le32_to_cpu(beacon->status) & TX_STATUS_MSK;
15291534 IWL_DEBUG_RX(mvm,
15301535 "beacon status %#x tsf:0x%016llX gp2:0x%X\n",
15311536 status, le64_to_cpu(beacon->tsf),
1532− mvm->ap_last_beacon_gp2);
1537+ beacon_gp2);
15331538 }
15341539
15351540 csa_vif = rcu_dereference_protected(mvm->csa_vif,
15361541 lockdep_is_held(&mvm->mutex));
15371542 if (unlikely(csa_vif && csa_vif->bss_conf.csa_active))
1538− iwl_mvm_csa_count_down(mvm, csa_vif, mvm->ap_last_beacon_gp2,
1543+ iwl_mvm_csa_count_down(mvm, csa_vif, beacon_gp2,
15391544 (status == TX_STATUS_SUCCESS));
15401545
15411546 tx_blocked_vif = rcu_dereference_protected(mvm->csa_tx_blocked_vif,
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c+2−5
@@ -625,9 +625,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) · 624 unmodified lines
625625 hw->wiphy->max_sched_scan_reqs = 1;
626626 hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX;
627627 hw->wiphy->max_match_sets = iwl_umac_scan_get_max_profiles(mvm->fw);
628− /* we create the 802.11 header and zero length SSID IE. */
629− hw->wiphy->max_sched_scan_ie_len =
630− SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2;
628+ hw->wiphy->max_sched_scan_ie_len = iwl_mvm_max_scan_ie_len(mvm);
631629 hw->wiphy->max_sched_scan_plans = IWL_MAX_SCHED_SCAN_PLANS;
632630 hw->wiphy->max_sched_scan_plan_interval = U16_MAX;
633631
@@ -3061,7 +3059,6 @@ void iwl_mvm_stop_ap_ibss_common(struct iwl_mvm *mvm, · 2427 unmodified lines
30613059 }
30623060
30633061 mvmvif->ap_ibss_active = false;
3064− mvm->ap_last_beacon_gp2 = 0;
30653062
30663063 if (vif->type == NL80211_IFTYPE_AP && !vif->p2p) {
30673064 iwl_mvm_vif_set_low_latency(mvmvif, false,
@@ -3490,7 +3487,7 @@ static void iwl_mvm_check_he_obss_narrow_bw_ru_iter(struct wiphy *wiphy, · 422 unmodified lines
34903487 elem = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, ies->data,
34913488 ies->len);
34923489
3493− if (!elem || elem->datalen < 10 ||
3490+ if (!elem || elem->datalen < 11 ||
34943491 !(elem->data[10] &
34953492 WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT)) {
34963493 data->tolerated = false;
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h+0−3
@@ -1168,9 +1168,6 @@ struct iwl_mvm { · 1167 unmodified lines
11681168 struct ieee80211_vif __rcu *csa_tx_blocked_vif;
11691169 u8 csa_tx_block_bcn_timeout;
11701170
1171− /* system time of last beacon (for AP/GO interface) */
1172− u32 ap_last_beacon_gp2;
1173−
11741171 /* indicates that we transmitted the last beacon */
11751172 bool ibss_manager;
11761173
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c+36−7
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22 /*
3− * Copyright (C) 2012-2014, 2018-2019, 2021-2025 Intel Corporation
3+ * Copyright (C) 2012-2014, 2018-2019, 2021-2026 Intel Corporation
44 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
55 * Copyright (C) 2016-2017 Intel Deutschland GmbH
66 */
@@ -416,6 +416,7 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2, · 409 unmodified lines
416416 int ret, resp_ver;
417417 u32 status;
418418 int resp_len, n_channels;
419+ unsigned int pkt_len;
419420 u16 mcc;
420421
421422 if (WARN_ON_ONCE(!iwl_mvm_is_lar_supported(mvm)))
@@ -431,6 +432,7 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2, · 9 unmodified lines
431432 return ERR_PTR(ret);
432433
433434 pkt = cmd.resp_pkt;
435+ pkt_len = iwl_rx_packet_payload_len(pkt);
434436
435437 resp_ver = iwl_fw_lookup_notif_ver(mvm->fw, IWL_ALWAYS_LONG_GROUP,
436438 MCC_UPDATE_CMD, 0);
@@ -439,9 +441,18 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2, · 2 unmodified lines
439441 if (resp_ver >= 8) {
440442 struct iwl_mcc_update_resp_v8 *mcc_resp_v8 = (void *)pkt->data;
441443
444+ if (IWL_FW_CHECK(mvm, pkt_len < sizeof(*mcc_resp_v8),
445+ "MCC v8 response too short: %u\n", pkt_len)) {
446+ resp_cp = ERR_PTR(-EINVAL);
447+ goto exit;
448+ }
449+
442450 n_channels = __le32_to_cpu(mcc_resp_v8->n_channels);
443− if (iwl_rx_packet_payload_len(pkt) !=
444− struct_size(mcc_resp_v8, channels, n_channels)) {
451+ if (IWL_FW_CHECK(mvm,
452+ pkt_len !=
453+ struct_size(mcc_resp_v8, channels, n_channels),
454+ "invalid MCC v8 response size: %u (n_channels=%d)\n",
455+ pkt_len, n_channels)) {
445456 resp_cp = ERR_PTR(-EINVAL);
446457 goto exit;
447458 }
@@ -464,9 +475,18 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2, · 16 unmodified lines
464475 IWL_UCODE_TLV_CAPA_MCC_UPDATE_11AX_SUPPORT)) {
465476 struct iwl_mcc_update_resp_v4 *mcc_resp_v4 = (void *)pkt->data;
466477
478+ if (IWL_FW_CHECK(mvm, pkt_len < sizeof(*mcc_resp_v4),
479+ "MCC v4 response too short: %u\n", pkt_len)) {
480+ resp_cp = ERR_PTR(-EINVAL);
481+ goto exit;
482+ }
483+
467484 n_channels = __le32_to_cpu(mcc_resp_v4->n_channels);
468− if (iwl_rx_packet_payload_len(pkt) !=
469− struct_size(mcc_resp_v4, channels, n_channels)) {
485+ if (IWL_FW_CHECK(mvm,
486+ pkt_len !=
487+ struct_size(mcc_resp_v4, channels, n_channels),
488+ "invalid MCC v4 response size: %u (n_channels=%d)\n",
489+ pkt_len, n_channels)) {
470490 resp_cp = ERR_PTR(-EINVAL);
471491 goto exit;
472492 }
@@ -489,9 +509,18 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2, · 16 unmodified lines
489509 } else {
490510 struct iwl_mcc_update_resp_v3 *mcc_resp_v3 = (void *)pkt->data;
491511
512+ if (IWL_FW_CHECK(mvm, pkt_len < sizeof(*mcc_resp_v3),
513+ "MCC v3 response too short: %u\n", pkt_len)) {
514+ resp_cp = ERR_PTR(-EINVAL);
515+ goto exit;
516+ }
517+
492518 n_channels = __le32_to_cpu(mcc_resp_v3->n_channels);
493− if (iwl_rx_packet_payload_len(pkt) !=
494− struct_size(mcc_resp_v3, channels, n_channels)) {
519+ if (IWL_FW_CHECK(mvm,
520+ pkt_len !=
521+ struct_size(mcc_resp_v3, channels, n_channels),
522+ "invalid MCC v3 response size: %u (n_channels=%d)\n",
523+ pkt_len, n_channels)) {
495524 resp_cp = ERR_PTR(-EINVAL);
496525 goto exit;
497526 }
drivers/net/wireless/intel/iwlwifi/mvm/ptp.c+3−1
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22 /*
3− * Copyright (C) 2021 - 2023, 2025 Intel Corporation
3+ * Copyright (C) 2021 - 2023, 2025-2026 Intel Corporation
44 */
55
66 #include "mvm.h"
@@ -121,6 +121,8 @@ iwl_mvm_get_crosstimestamp_fw(struct iwl_mvm *mvm, u32 *gp2, u64 *sys_time) · 114 unmodified lines
121121 *sys_time = (u64)le32_to_cpu(resp->platform_timestamp_hi) << 32 |
122122 le32_to_cpu(resp->platform_timestamp_lo);
123123
124+ iwl_free_resp(&cmd);
125+
124126 return ret;
125127 }
126128
drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c+7−2
@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22 /*
33 * Copyright (C) 2017 Intel Deutschland GmbH
4− * Copyright (C) 2018-2025 Intel Corporation
4+ * Copyright (C) 2018-2026 Intel Corporation
55 */
66 #include "rs.h"
77 #include "fw-api.h"
@@ -423,9 +423,14 @@ void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm, · 415 unmodified lines
423423 struct iwl_lq_sta_rs_fw *lq_sta;
424424 u32 flags;
425425
426+ notif = (void *)pkt->data;
427+ if (IWL_FW_CHECK(mvm, notif->sta_id >= mvm->fw->ucode_capa.num_stations,
428+ "Invalid sta id (%d) in TLC notification\n",
429+ notif->sta_id))
430+ return;
431+
426432 rcu_read_lock();
427433
428− notif = (void *)pkt->data;
429434 link_sta = rcu_dereference(mvm->fw_id_to_link_sta[notif->sta_id]);
430435 sta = rcu_dereference(mvm->fw_id_to_mac_id[notif->sta_id]);
431436 if (IS_ERR_OR_NULL(sta) || !link_sta) {
drivers/net/wireless/intel/iwlwifi/mvm/rx.c+5−0
@@ -1227,6 +1227,11 @@ void iwl_mvm_window_status_notif(struct iwl_mvm *mvm, · 1226 unmodified lines
12271227 /* get the station */
12281228 sta_id = (ratid & BA_WINDOW_STATUS_STA_ID_MSK)
12291229 >> BA_WINDOW_STATUS_STA_ID_POS;
1230+ if (IWL_FW_CHECK(mvm,
1231+ sta_id >= mvm->fw->ucode_capa.num_stations,
1232+ "Invalid sta id (%d) in BA window status notification\n",
1233+ sta_id))
1234+ continue;
12301235 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
12311236 if (IS_ERR_OR_NULL(sta))
12321237 continue;
drivers/net/wireless/intel/iwlwifi/mvm/scan.c+7−3
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22 /*
3− * Copyright (C) 2012-2014, 2018-2025 Intel Corporation
3+ * Copyright (C) 2012-2014, 2018-2026 Intel Corporation
44 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
55 * Copyright (C) 2016-2017 Intel Deutschland GmbH
66 */
@@ -3144,8 +3144,6 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, · 3137 unmodified lines
31443144 if (ret)
31453145 return ret;
31463146
3147− iwl_mvm_build_scan_probe(mvm, vif, ies, &params);
3148−
31493147 /* for 6 GHZ band only PSC channels need to be added */
31503148 for (i = 0; i < params.n_channels; i++) {
31513149 struct ieee80211_channel *channel = params.channels[i];
@@ -3179,6 +3177,8 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, · 27 unmodified lines
31793177 goto out;
31803178 }
31813179
3180+ iwl_mvm_build_scan_probe(mvm, vif, ies, &params);
3181+
31823182 uid = iwl_mvm_build_scan_cmd(mvm, vif, &hcmd, &params, type);
31833183 if (uid < 0) {
31843184 ret = uid;
@@ -3217,6 +3217,10 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, · 32 unmodified lines
32173217
32183218 mvm->mei_scan_filter.is_mei_limited_scan = false;
32193219
3220+ if (IWL_FW_CHECK(mvm, uid >= ARRAY_SIZE(mvm->scan_uid_status),
3221+ "FW reports out-of-range scan UID %d\n", uid))
3222+ return;
3223+
32203224 IWL_DEBUG_SCAN(mvm,
32213225 "Scan completed: uid=%u type=%u, status=%s, EBS=%s\n",
32223226 uid, mvm->scan_uid_status[uid],
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c+5−0
@@ -951,6 +951,11 @@ void iwl_mvm_rx_session_protect_notif(struct iwl_mvm *mvm, · 950 unmodified lines
951951 struct ieee80211_vif *vif;
952952 struct iwl_mvm_vif *mvmvif;
953953
954+ if (IWL_FW_CHECK(mvm, id >= ARRAY_SIZE(mvm->vif_id_to_mac),
955+ "Invalid mac_link_id (%d) in session protect notif\n",
956+ id))
957+ return;
958+
954959 rcu_read_lock();
955960
956961 /* note we use link ID == MAC ID */
drivers/net/wireless/intel/iwlwifi/mvm/tx.c+44−1
@@ -1544,6 +1544,17 @@ static inline u32 iwl_mvm_get_scd_ssn(struct iwl_mvm *mvm, · 1543 unmodified lines
15441544 return val & 0xFFF;
15451545 }
15461546
1547+static inline size_t iwl_mvm_tx_resp_min_len(struct iwl_mvm *mvm,
1548+ struct iwl_tx_resp *tx_resp)
1549+{
1550+ struct agg_tx_status *agg_status =
1551+ iwl_mvm_get_agg_status(mvm, tx_resp);
1552+
1553+ /* The aggregate response ends with a trailing SCD SSN __le32 word. */
1554+ return (u8 *)(agg_status + tx_resp->frame_count) - (u8 *)tx_resp +
1555+ sizeof(__le32);
1556+}
1557+
15471558 static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
15481559 struct iwl_rx_packet *pkt)
15491560 {
@@ -1847,6 +1858,9 @@ static void iwl_mvm_rx_tx_cmd_agg(struct iwl_mvm *mvm, · 297 unmodified lines
18471858 int queue = SEQ_TO_QUEUE(sequence);
18481859 struct ieee80211_sta *sta;
18491860
1861+ if (WARN_ON_ONCE(iwl_mvm_has_new_tx_api(mvm)))
1862+ return;
1863+
18501864 if (WARN_ON_ONCE(queue < IWL_MVM_DQA_MIN_DATA_QUEUE &&
18511865 (queue != IWL_MVM_DQA_BSS_CLIENT_QUEUE)))
18521866 return;
@@ -1881,6 +1895,26 @@ void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) · 28 unmodified lines
18811895 {
18821896 struct iwl_rx_packet *pkt = rxb_addr(rxb);
18831897 struct iwl_tx_resp *tx_resp = (void *)pkt->data;
1898+ size_t min_len;
1899+
1900+ if (IWL_FW_CHECK(mvm, !tx_resp->frame_count,
1901+ "invalid TX_CMD frame_count %u\n",
1902+ tx_resp->frame_count))
1903+ return;
1904+
1905+ if (IWL_FW_CHECK(mvm,
1906+ iwl_mvm_has_new_tx_api(mvm) &&
1907+ tx_resp->frame_count != 1,
1908+ "invalid TX_CMD frame_count %u for new TX API\n",
1909+ tx_resp->frame_count))
1910+ return;
1911+
1912+ min_len = iwl_mvm_tx_resp_min_len(mvm, tx_resp);
1913+ if (IWL_FW_CHECK(mvm, iwl_rx_packet_payload_len(pkt) < min_len,
1914+ "invalid TX_CMD len %u (frame_count %u, min %zu)\n",
1915+ iwl_rx_packet_payload_len(pkt), tx_resp->frame_count,
1916+ min_len))
1917+ return;
18841918
18851919 if (tx_resp->frame_count == 1)
18861920 iwl_mvm_rx_tx_cmd_single(mvm, pkt);
@@ -2100,8 +2134,14 @@ void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) · 213 unmodified lines
21002134 if (tid == IWL_MGMT_TID)
21012135 tid = IWL_MAX_TID_COUNT;
21022136
2137+ if (IWL_FW_CHECK(mvm, tid >=
2138+ ARRAY_SIZE(mvmsta->tid_data),
2139+ "invalid TID %d in compressed BA\n",
2140+ tid))
2141+ continue;
2142+
21032143 if (mvmsta)
2104− mvmsta->tid_data[i].lq_color = lq_color;
2144+ mvmsta->tid_data[tid].lq_color = lq_color;
21052145
21062146 iwl_mvm_tx_reclaim(mvm, sta_id, tid,
21072147 (int)(le16_to_cpu(ba_tfd->q_num)),
@@ -2121,6 +2161,9 @@ void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) · 13 unmodified lines
21212161 ba_notif = (void *)pkt->data;
21222162 sta_id = ba_notif->sta_id;
21232163 tid = ba_notif->tid;
2164+ if (IWL_FW_CHECK(mvm, tid >= ARRAY_SIZE(mvmsta->tid_data),
2165+ "invalid TID %d in BA notif\n", tid))
2166+ return;
21242167 /* "flow" corresponds to Tx queue */
21252168 txq = le16_to_cpu(ba_notif->scd_flow);
21262169 /* "ssn" is start of block-ack Tx window, corresponds to index
drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c+6−1
@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22 /*
33 * Copyright (C) 2017 Intel Deutschland GmbH
4− * Copyright (C) 2018-2025 Intel Corporation
4+ * Copyright (C) 2018-2026 Intel Corporation
55 */
66 #include "iwl-trans.h"
77 #include "iwl-fh.h"
@@ -99,6 +99,11 @@ int iwl_pcie_init_fw_sec(struct iwl_trans *trans, · 91 unmodified lines
9999 /* add 2 due to separators */
100100 paging_cnt = iwl_pcie_get_num_sections(fw, lmac_cnt + umac_cnt + 2);
101101
102+ if (WARN_ON(lmac_cnt > ARRAY_SIZE(ctxt_dram->lmac_img) ||
103+ umac_cnt > ARRAY_SIZE(ctxt_dram->umac_img) ||
104+ paging_cnt > ARRAY_SIZE(ctxt_dram->virtual_img)))
105+ return -EINVAL;
106+
102107 dram->fw = kzalloc_objs(*dram->fw, umac_cnt + lmac_cnt);
103108 if (!dram->fw)
104109 return -ENOMEM;
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/rx.c+7−2
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22 /*
3− * Copyright (C) 2003-2014, 2018-2024 Intel Corporation
3+ * Copyright (C) 2003-2014, 2018-2024, 2026 Intel Corporation
44 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
55 * Copyright (C) 2016-2017 Intel Deutschland GmbH
66 */
@@ -1238,11 +1238,16 @@ void iwl_pcie_rx_free(struct iwl_trans *trans) · 1231 unmodified lines
12381238 }
12391239 }
12401240 kfree(trans_pcie->rx_pool);
1241+ trans_pcie->rx_pool = NULL;
12411242 kfree(trans_pcie->global_table);
1243+ trans_pcie->global_table = NULL;
12421244 kfree(trans_pcie->rxq);
1245+ trans_pcie->rxq = NULL;
12431246
1244− if (trans_pcie->alloc_page)
1247+ if (trans_pcie->alloc_page) {
12451248 __free_pages(trans_pcie->alloc_page, trans_pcie->rx_page_order);
1249+ trans_pcie->alloc_page = NULL;
1250+ }
12461251 }
12471252
12481253 static void iwl_pcie_rx_move_to_allocator(struct iwl_rxq *rxq,
drivers/net/wireless/marvell/mwifiex/fw.h+9−9
@@ -823,7 +823,7 @@ struct chan_band_param_set { · 822 unmodified lines
823823
824824 struct mwifiex_ie_types_chan_band_list_param_set {
825825 struct mwifiex_ie_types_header header;
826− struct chan_band_param_set chan_band_param[1];
826+ struct chan_band_param_set chan_band_param[];
827827 } __packed;
828828
829829 struct mwifiex_ie_types_rates_param_set {
@@ -886,7 +886,7 @@ struct mwifiex_ie_types_wildcard_ssid_params { · 56 unmodified lines
886886 #define TSF_DATA_SIZE 8
887887 struct mwifiex_ie_types_tsf_timestamp {
888888 struct mwifiex_ie_types_header header;
889− u8 tsf_data[1];
889+ u8 tsf_data[];
890890 } __packed;
891891
892892 struct mwifiex_cf_param_set {
@@ -903,8 +903,8 @@ struct mwifiex_ibss_param_set { · 10 unmodified lines
903903 struct mwifiex_ie_types_ss_param_set {
904904 struct mwifiex_ie_types_header header;
905905 union {
906− struct mwifiex_cf_param_set cf_param_set[1];
907− struct mwifiex_ibss_param_set ibss_param_set[1];
906+ DECLARE_FLEX_ARRAY(struct mwifiex_cf_param_set, cf_param_set);
907+ DECLARE_FLEX_ARRAY(struct mwifiex_ibss_param_set, ibss_param_set);
908908 } cf_ibss;
909909 } __packed;
910910
@@ -922,8 +922,8 @@ struct mwifiex_ds_param_set { · 11 unmodified lines
922922 struct mwifiex_ie_types_phy_param_set {
923923 struct mwifiex_ie_types_header header;
924924 union {
925− struct mwifiex_fh_param_set fh_param_set[1];
926− struct mwifiex_ds_param_set ds_param_set[1];
925+ DECLARE_FLEX_ARRAY(struct mwifiex_fh_param_set, fh_param_set);
926+ DECLARE_FLEX_ARRAY(struct mwifiex_ds_param_set, ds_param_set);
927927 } fh_ds;
928928 } __packed;
929929
@@ -1383,7 +1383,7 @@ struct host_cmd_ds_802_11_snmp_mib { · 453 unmodified lines
13831383 __le16 query_type;
13841384 __le16 oid;
13851385 __le16 buf_size;
1386− u8 value[1];
1386+ u8 value[];
13871387 } __packed;
13881388
13891389 struct mwifiex_rate_scope {
@@ -1551,7 +1551,7 @@ struct mwifiex_scan_cmd_config { · 161 unmodified lines
15511551 * TLV_TYPE_CHANLIST, mwifiex_ie_types_chan_list_param_set
15521552 * WLAN_EID_SSID, mwifiex_ie_types_ssid_param_set
15531553 */
1554− u8 tlv_buf[1]; /* SSID TLV(s) and ChanList TLVs are stored
1554+ u8 tlv_buf[]; /* SSID TLV(s) and ChanList TLVs are stored
15551555 here */
15561556 } __packed;
15571557
@@ -1683,7 +1683,7 @@ struct host_cmd_ds_802_11_bg_scan_query_rsp { · 125 unmodified lines
16831683 struct mwifiex_ietypes_domain_param_set {
16841684 struct mwifiex_ie_types_header header;
16851685 u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
1686− struct ieee80211_country_ie_triplet triplet[1];
1686+ struct ieee80211_country_ie_triplet triplet[];
16871687 } __packed;
16881688
16891689 struct host_cmd_ds_802_11d_domain_info {
drivers/net/wireless/marvell/mwifiex/join.c+4−4
@@ -421,15 +421,15 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, · 420 unmodified lines
421421
422422 phy_tlv = (struct mwifiex_ie_types_phy_param_set *) pos;
423423 phy_tlv->header.type = cpu_to_le16(WLAN_EID_DS_PARAMS);
424− phy_tlv->header.len = cpu_to_le16(sizeof(phy_tlv->fh_ds.ds_param_set));
425− memcpy(&phy_tlv->fh_ds.ds_param_set,
424+ phy_tlv->header.len = cpu_to_le16(sizeof(*phy_tlv->fh_ds.ds_param_set));
425+ memcpy(phy_tlv->fh_ds.ds_param_set,
426426 &bss_desc->phy_param_set.ds_param_set.current_chan,
427− sizeof(phy_tlv->fh_ds.ds_param_set));
427+ sizeof(*phy_tlv->fh_ds.ds_param_set));
428428 pos += sizeof(phy_tlv->header) + le16_to_cpu(phy_tlv->header.len);
429429
430430 ss_tlv = (struct mwifiex_ie_types_ss_param_set *) pos;
431431 ss_tlv->header.type = cpu_to_le16(WLAN_EID_CF_PARAMS);
432− ss_tlv->header.len = cpu_to_le16(sizeof(ss_tlv->cf_ibss.cf_param_set));
432+ ss_tlv->header.len = cpu_to_le16(sizeof(*ss_tlv->cf_ibss.cf_param_set));
433433 pos += sizeof(ss_tlv->header) + le16_to_cpu(ss_tlv->header.len);
434434
435435 /* Get the common rates supported between the driver and the BSS Desc */
drivers/net/wireless/marvell/mwifiex/sta_cmd.c+1−1
@@ -108,7 +108,7 @@ static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv, · 107 unmodified lines
108108 "cmd: SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid);
109109 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_SNMP_MIB);
110110 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_snmp_mib)
111− - 1 + S_DS_GEN);
111+ + S_DS_GEN);
112112
113113 snmp_mib->oid = cpu_to_le16((u16)cmd_oid);
114114 if (cmd_action == HostCmd_ACT_GEN_GET) {
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c+8−6
@@ -196,6 +196,7 @@ static int mwifiex_request_rgpower_table(struct mwifiex_private *priv) · 195 unmodified lines
196196 struct mwifiex_adapter *adapter = priv->adapter;
197197 char rgpower_table_name[30];
198198 char country_code[3];
199+ int ret;
199200
200201 strscpy(country_code, domain_info->country_code, sizeof(country_code));
201202
@@ -214,16 +215,17 @@ static int mwifiex_request_rgpower_table(struct mwifiex_private *priv) · 12 unmodified lines
214215 adapter->rgpower_data = NULL;
215216 }
216217
217− if ((request_firmware(&adapter->rgpower_data, rgpower_table_name,
218− adapter->dev))) {
218+ ret = request_firmware_direct(&adapter->rgpower_data, rgpower_table_name,
219+ adapter->dev);
220+
221+ if (ret) {
219222 mwifiex_dbg(
220223 adapter, INFO,
221− "info: %s: failed to request regulatory power table\n",
222− __func__);
223− return -EIO;
224+ "info: %s: failed to request regulatory power table: %d\n",
225+ __func__, ret);
224226 }
225227
226− return 0;
228+ return ret;
227229 }
228230
229231 static int mwifiex_dnld_rgpower_table(struct mwifiex_private *priv)
drivers/net/wireless/marvell/mwifiex/tdls.c+1−1
@@ -215,7 +215,7 @@ mwifiex_tdls_add_ht_oper(struct mwifiex_private *priv, const u8 *mac, · 214 unmodified lines
215215
216216 /* follow AP's channel bandwidth */
217217 if (ISSUPP_CHANWIDTH40(priv->adapter->hw_dot_11n_dev_cap) &&
218− bss_desc->bcn_ht_cap &&
218+ bss_desc->bcn_ht_oper &&
219219 ISALLOWED_CHANWIDTH40(bss_desc->bcn_ht_oper->ht_param))
220220 ht_oper->ht_param = bss_desc->bcn_ht_oper->ht_param;
221221
drivers/net/wireless/marvell/mwifiex/uap_event.c+22−2
@@ -123,11 +123,31 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv) · 122 unmodified lines
123123 len = ETH_ALEN;
124124
125125 if (len != -1) {
126+ u16 evt_len = le16_to_cpu(event->len);
127+
126128 sinfo->assoc_req_ies = &event->data[len];
127129 len = (u8 *)sinfo->assoc_req_ies -
128130 (u8 *)&event->frame_control;
129− sinfo->assoc_req_ies_len =
130− le16_to_cpu(event->len) - (u16)len;
131+
132+ /*
133+ * event->len is reported by the device firmware
134+ * and is not otherwise validated. Reject a
135+ * length that underflows the header, or that
136+ * would place the association request IEs
137+ * outside the fixed-size event_body[] buffer the
138+ * event was copied into; otherwise the IE walk
139+ * in mwifiex_set_sta_ht_cap() reads past
140+ * event_body and out of the adapter slab object.
141+ */
142+ if (evt_len < len ||
143+ (u8 *)&event->frame_control + evt_len >
144+ adapter->event_body + MAX_EVENT_SIZE) {
145+ mwifiex_dbg(adapter, ERROR,
146+ "invalid STA assoc event length\n");
147+ kfree(sinfo);
148+ return -1;
149+ }
150+ sinfo->assoc_req_ies_len = evt_len - (u16)len;
131151 }
132152 }
133153 cfg80211_new_sta(priv->netdev->ieee80211_ptr, event->sta_addr,
drivers/net/wireless/mediatek/mt76/Kconfig+2−2
@@ -38,8 +38,8 @@ config MT792x_USB · 37 unmodified lines
3838 select MT76_USB
3939
4040 config MT76_NPU
41− bool
42− depends on MT76_CORE
41+ tristate
42+ depends on NET_AIROHA_NPU=y || MT76_CORE=NET_AIROHA_NPU
4343
4444 source "drivers/net/wireless/mediatek/mt76/mt76x0/Kconfig"
4545 source "drivers/net/wireless/mediatek/mt76/mt76x2/Kconfig"
drivers/net/wireless/mediatek/mt76/Makefile+5−1
@@ -12,7 +12,11 @@ mt76-y := \ · 11 unmodified lines
1212 mmio.o util.o trace.o dma.o mac80211.o debugfs.o eeprom.o \
1313 tx.o agg-rx.o mcu.o wed.o scan.o channel.o
1414
15−mt76-$(CONFIG_MT76_NPU) += npu.o
15+ifdef CONFIG_MT76_NPU
16+# CONFIG_MT76_NPU is tristate to simplify dependency tracking,
17+# but it behaves as a bool symbol here.
18+mt76-y += npu.o
19+endif
1620 mt76-$(CONFIG_PCI) += pci.o
1721 mt76-$(CONFIG_NL80211_TESTMODE) += testmode.o
1822
drivers/net/wireless/mediatek/mt76/dma.c+4−1
@@ -1189,7 +1189,10 @@ void mt76_dma_cleanup(struct mt76_dev *dev) · 1188 unmodified lines
11891189 mt76_for_each_q_rx(dev, i) {
11901190 struct mt76_queue *q = &dev->q_rx[i];
11911191
1192− netif_napi_del(&dev->napi[i]);
1192+ if (!mt76_queue_is_wed_rro(q)) {
1193+ napi_disable(&dev->napi[i]);
1194+ netif_napi_del(&dev->napi[i]);
1195+ }
11931196 mt76_dma_rx_cleanup(dev, q);
11941197
11951198 page_pool_destroy(q->page_pool);
drivers/net/wireless/mediatek/mt76/eeprom.c+1−1
@@ -181,7 +181,7 @@ mt76_eeprom_override(struct mt76_phy *phy) · 180 unmodified lines
181181 if (err == -EPROBE_DEFER)
182182 return err;
183183
184− if (err) {
184+ if (!is_valid_ether_addr(phy->macaddr)) {
185185 eth_random_addr(phy->macaddr);
186186 dev_info(dev->dev,
187187 "Invalid MAC address, using random address %pM\n",
drivers/net/wireless/mediatek/mt76/mt76.h+3−3
@@ -1647,7 +1647,7 @@ int mt76_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb, · 1646 unmodified lines
16471647 int mt76_testmode_set_state(struct mt76_phy *phy, enum mt76_testmode_state state);
16481648 int mt76_testmode_alloc_skb(struct mt76_phy *phy, u32 len);
16491649
1650−#ifdef CONFIG_MT76_NPU
1650+#if IS_ENABLED(CONFIG_MT76_NPU)
16511651 void mt76_npu_check_ppe(struct mt76_dev *dev, struct sk_buff *skb,
16521652 u32 info);
16531653 int mt76_npu_dma_add_buf(struct mt76_phy *phy, struct mt76_queue *q,
@@ -1736,12 +1736,12 @@ static inline int mt76_npu_send_txrx_addr(struct mt76_dev *dev, int ifindex, · 82 unmodified lines
17361736
17371737 static inline bool mt76_npu_device_active(struct mt76_dev *dev)
17381738 {
1739− return !!rcu_access_pointer(dev->mmio.npu);
1739+ return mt76_is_mmio(dev) && !!rcu_access_pointer(dev->mmio.npu);
17401740 }
17411741
17421742 static inline bool mt76_ppe_device_active(struct mt76_dev *dev)
17431743 {
1744− return !!rcu_access_pointer(dev->mmio.ppe_dev);
1744+ return mt76_is_mmio(dev) && !!rcu_access_pointer(dev->mmio.ppe_dev);
17451745 }
17461746
17471747 static inline int mt76_npu_send_msg(struct airoha_npu *npu, int ifindex,
drivers/net/wireless/mediatek/mt76/mt7615/mac.c+6−0
@@ -1601,6 +1601,8 @@ bool mt7615_rx_check(struct mt76_dev *mdev, void *data, int len) · 1600 unmodified lines
16011601
16021602 switch (type) {
16031603 case PKT_TYPE_TXRX_NOTIFY:
1604+ if (!mt76_is_mmio(mdev))
1605+ return false;
16041606 mt7615_mac_tx_free(dev, data, len);
16051607 return false;
16061608 case PKT_TYPE_TXS:
@@ -1634,6 +1636,10 @@ void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, · 27 unmodified lines
16341636 dev_kfree_skb(skb);
16351637 break;
16361638 case PKT_TYPE_TXRX_NOTIFY:
1639+ if (!mt76_is_mmio(mdev)) {
1640+ dev_kfree_skb(skb);
1641+ break;
1642+ }
16371643 mt7615_mac_tx_free(dev, skb->data, skb->len);
16381644 dev_kfree_skb(skb);
16391645 break;
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c+2−0
@@ -1458,6 +1458,8 @@ mt76_connac_mcu_uni_bss_he_tlv(struct mt76_phy *phy, struct ieee80211_vif *vif, · 1457 unmodified lines
14581458 struct bss_info_uni_he *he;
14591459
14601460 cap = mt76_connac_get_he_phy_cap(phy, vif);
1461+ if (!cap)
1462+ return;
14611463
14621464 he = (struct bss_info_uni_he *)tlv;
14631465 he->he_pe_duration = vif->bss_conf.htc_trig_based_pkt_ext;
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c+13−5
@@ -595,6 +595,8 @@ mt7915_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, · 594 unmodified lines
595595 struct tlv *tlv;
596596
597597 cap = mt76_connac_get_he_phy_cap(phy->mt76, vif);
598+ if (!cap)
599+ return;
598600
599601 tlv = mt76_connac_mcu_add_tlv(skb, BSS_INFO_HE_BASIC, sizeof(*he));
600602
@@ -1177,13 +1179,12 @@ mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy, · 576 unmodified lines
11771179 }
11781180
11791181 static void
1180−mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
1181− struct mt7915_phy *phy, struct sta_rec_bf *bf)
1182+mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta,
1183+ const struct ieee80211_sta_he_cap *vc,
1184+ struct sta_rec_bf *bf)
11821185 {
11831186 struct ieee80211_sta_he_cap *pc = &sta->deflink.he_cap;
11841187 struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem;
1185− const struct ieee80211_sta_he_cap *vc =
1186− mt76_connac_get_he_phy_cap(phy->mt76, vif);
11871188 const struct ieee80211_he_cap_elem *ve = &vc->he_cap_elem;
11881189 u16 mcs_map = le16_to_cpu(pc->he_mcs_nss_supp.rx_mcs_80);
11891190 u8 nss_mcs = mt7915_mcu_get_sta_nss(mcs_map);
@@ -1242,6 +1243,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb, · 52 unmodified lines
12421243 {
12431244 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
12441245 struct mt7915_phy *phy = mvif->phy;
1246+ const struct ieee80211_sta_he_cap *vc = NULL;
12451247 int tx_ant = hweight8(phy->mt76->chainmask) - 1;
12461248 struct sta_rec_bf *bf;
12471249 struct tlv *tlv;
@@ -1260,6 +1262,12 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb, · 12 unmodified lines
12601262 if (!ebf && !dev->ibf)
12611263 return;
12621264
1265+ if (sta->deflink.he_cap.has_he && ebf) {
1266+ vc = mt76_connac_get_he_phy_cap(phy->mt76, vif);
1267+ if (!vc)
1268+ return;
1269+ }
1270+
12631271 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_BF, sizeof(*bf));
12641272 bf = (struct sta_rec_bf *)tlv;
12651273
@@ -1268,7 +1276,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb, · 2 unmodified lines
12681276 * ht: iBF only, since mac80211 lacks of eBF support
12691277 */
12701278 if (sta->deflink.he_cap.has_he && ebf)
1271− mt7915_mcu_sta_bfer_he(sta, vif, phy, bf);
1279+ mt7915_mcu_sta_bfer_he(sta, vc, bf);
12721280 else if (sta->deflink.vht_cap.vht_supported)
12731281 mt7915_mcu_sta_bfer_vht(sta, phy, bf, ebf);
12741282 else if (sta->deflink.ht_cap.ht_supported)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c+7−3
@@ -570,8 +570,9 @@ bool mt7921_rx_check(struct mt76_dev *mdev, void *data, int len) · 569 unmodified lines
570570
571571 switch (type) {
572572 case PKT_TYPE_TXRX_NOTIFY:
573− /* PKT_TYPE_TXRX_NOTIFY can be received only by mmio devices */
574− mt7921_mac_tx_free(dev, data, len); /* mmio */
573+ if (!mt76_is_mmio(mdev))
574+ return false;
575+ mt7921_mac_tx_free(dev, data, len);
575576 return false;
576577 case PKT_TYPE_TXS:
577578 for (rxd += 2; rxd + 8 <= end; rxd += 8)
@@ -600,7 +601,10 @@ void mt7921_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, · 22 unmodified lines
600601
601602 switch (type) {
602603 case PKT_TYPE_TXRX_NOTIFY:
603− /* PKT_TYPE_TXRX_NOTIFY can be received only by mmio devices */
604+ if (!mt76_is_mmio(mdev)) {
605+ napi_consume_skb(skb, 1);
606+ break;
607+ }
604608 mt7921_mac_tx_free(dev, skb->data, skb->len);
605609 napi_consume_skb(skb, 1);
606610 break;
drivers/net/wireless/mediatek/mt76/mt7925/mac.c+10−3
@@ -1203,8 +1203,9 @@ bool mt7925_rx_check(struct mt76_dev *mdev, void *data, int len) · 1202 unmodified lines
12031203
12041204 switch (type) {
12051205 case PKT_TYPE_TXRX_NOTIFY:
1206− /* PKT_TYPE_TXRX_NOTIFY can be received only by mmio devices */
1207− mt7925_mac_tx_free(dev, data, len); /* mmio */
1206+ if (!mt76_is_mmio(mdev))
1207+ return false;
1208+ mt7925_mac_tx_free(dev, data, len);
12081209 return false;
12091210 case PKT_TYPE_TXS:
12101211 for (rxd += 4; rxd + 12 <= end; rxd += 12)
@@ -1240,7 +1241,10 @@ void mt7925_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, · 29 unmodified lines
12401241
12411242 switch (type) {
12421243 case PKT_TYPE_TXRX_NOTIFY:
1243− /* PKT_TYPE_TXRX_NOTIFY can be received only by mmio devices */
1244+ if (!mt76_is_mmio(mdev)) {
1245+ napi_consume_skb(skb, 1);
1246+ break;
1247+ }
12441248 mt7925_mac_tx_free(dev, skb->data, skb->len);
12451249 napi_consume_skb(skb, 1);
12461250 break;
@@ -1284,6 +1288,9 @@ mt7925_vif_connect_iter(void *priv, u8 *mac, · 37 unmodified lines
12841288
12851289 for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) {
12861290 bss_conf = mt792x_vif_to_bss_conf(vif, i);
1291+ if (!bss_conf)
1292+ continue;
1293+
12871294 mconf = mt792x_vif_to_link(mvif, i);
12881295
12891296 mt76_connac_mcu_uni_add_dev(&dev->mphy, bss_conf, &mconf->mt76,
drivers/net/wireless/mediatek/mt76/mt7925/main.c+3−0
@@ -1713,6 +1713,9 @@ static void mt7925_sta_set_decap_offload(struct ieee80211_hw *hw, · 1712 unmodified lines
17131713 mconf = mt792x_vif_to_link(mvif, i);
17141714 mlink = mt792x_sta_to_link(msta, i);
17151715
1716+ if (!mlink)
1717+ continue;
1718+
17161719 if (enabled)
17171720 set_bit(MT_WCID_FLAG_HDR_TRANS, &mlink->wcid.flags);
17181721 else
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c+2−0
@@ -2773,6 +2773,8 @@ mt7925_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *link_conf, · 2772 unmodified lines
27732773 struct tlv *tlv;
27742774
27752775 cap = mt76_connac_get_he_phy_cap(phy->mt76, link_conf->vif);
2776+ if (!cap)
2777+ return;
27762778
27772779 tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_HE_BASIC, sizeof(*he));
27782780
drivers/net/wireless/mediatek/mt76/mt7996/Kconfig+1−1
@@ -16,6 +16,6 @@ config MT7996E · 15 unmodified lines
1616 config MT7996_NPU
1717 bool "MT7996 (PCIe) NPU support"
1818 depends on MT7996E
19− depends on NET_AIROHA_NPU=y || MT7996E=NET_AIROHA_NPU
19+ depends on NET_AIROHA_NPU=y || MT76_CORE=NET_AIROHA_NPU
2020 select MT76_NPU
2121 default n
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c+13−6
@@ -935,6 +935,8 @@ mt7996_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, · 934 unmodified lines
935935 struct tlv *tlv;
936936
937937 cap = mt76_connac_get_he_phy_cap(phy->mt76, vif);
938+ if (!cap)
939+ return;
938940
939941 tlv = mt7996_mcu_add_uni_tlv(skb, UNI_BSS_INFO_HE_BASIC, sizeof(*he));
940942
@@ -1855,17 +1857,18 @@ mt7996_mcu_sta_bfer_he(struct ieee80211_link_sta *link_sta, · 914 unmodified lines
18551857 {
18561858 struct ieee80211_sta_he_cap *pc = &link_sta->he_cap;
18571859 struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem;
1858− const struct ieee80211_sta_he_cap *vc =
1859− mt76_connac_get_he_phy_cap(phy->mt76, vif);
1860− const struct ieee80211_he_cap_elem *ve = &vc->he_cap_elem;
18611860 u16 mcs_map = le16_to_cpu(pc->he_mcs_nss_supp.rx_mcs_80);
18621861 u8 nss_mcs = mt7996_mcu_get_sta_nss(mcs_map);
1862+ const struct ieee80211_he_cap_elem *ve;
1863+ const struct ieee80211_sta_he_cap *vc;
18631864 u8 snd_dim, sts;
18641865
1866+ vc = mt76_connac_get_he_phy_cap(phy->mt76, vif);
18651867 if (!vc)
18661868 return;
18671869
18681870 bf->tx_mode = MT_PHY_TYPE_HE_SU;
1871+ ve = &vc->he_cap_elem;
18691872
18701873 mt7996_mcu_sta_sounding_rate(bf, phy);
18711874
@@ -1921,14 +1924,18 @@ mt7996_mcu_sta_bfer_eht(struct ieee80211_link_sta *link_sta, · 49 unmodified lines
19211924 struct ieee80211_sta_eht_cap *pc = &link_sta->eht_cap;
19221925 struct ieee80211_eht_cap_elem_fixed *pe = &pc->eht_cap_elem;
19231926 struct ieee80211_eht_mcs_nss_supp *eht_nss = &pc->eht_mcs_nss_supp;
1924− const struct ieee80211_sta_eht_cap *vc =
1925− mt76_connac_get_eht_phy_cap(phy->mt76, vif);
1926− const struct ieee80211_eht_cap_elem_fixed *ve = &vc->eht_cap_elem;
19271927 u8 nss_mcs = u8_get_bits(eht_nss->bw._80.rx_tx_mcs9_max_nss,
19281928 IEEE80211_EHT_MCS_NSS_RX) - 1;
1929+ const struct ieee80211_eht_cap_elem_fixed *ve;
1930+ const struct ieee80211_sta_eht_cap *vc;
19291931 u8 snd_dim, sts;
19301932
1933+ vc = mt76_connac_get_eht_phy_cap(phy->mt76, vif);
1934+ if (!vc)
1935+ return;
1936+
19311937 bf->tx_mode = MT_PHY_TYPE_EHT_MU;
1938+ ve = &vc->eht_cap_elem;
19321939
19331940 mt7996_mcu_sta_sounding_rate(bf, phy);
19341941
drivers/net/wireless/microchip/wilc1000/hif.c+5−0
@@ -600,6 +600,11 @@ static s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len, · 599 unmodified lines
600600 u16 ies_len;
601601 struct wilc_assoc_resp *res = (struct wilc_assoc_resp *)buffer;
602602
603+ if (buffer_len < sizeof(*res)) {
604+ ret_conn_info->status = WLAN_STATUS_UNSPECIFIED_FAILURE;
605+ return -EINVAL;
606+ }
607+
603608 ret_conn_info->status = le16_to_cpu(res->status_code);
604609 if (ret_conn_info->status == WLAN_STATUS_SUCCESS) {
605610 ies = &buffer[sizeof(*res)];
drivers/net/wireless/virtual/mac80211_hwsim_main.c+3−3
@@ -870,9 +870,9 @@ static const struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = { · 869 unmodified lines
870870 [HWSIM_ATTR_FLAGS] = { .type = NLA_U32 },
871871 [HWSIM_ATTR_RX_RATE] = { .type = NLA_U32 },
872872 [HWSIM_ATTR_SIGNAL] = { .type = NLA_U32 },
873− [HWSIM_ATTR_TX_INFO] = { .type = NLA_BINARY,
874− .len = IEEE80211_TX_MAX_RATES *
875− sizeof(struct hwsim_tx_rate)},
873+ [HWSIM_ATTR_TX_INFO] =
874+ NLA_POLICY_EXACT_LEN(IEEE80211_TX_MAX_RATES *
875+ sizeof(struct hwsim_tx_rate)),
876876 [HWSIM_ATTR_COOKIE] = { .type = NLA_U64 },
877877 [HWSIM_ATTR_CHANNELS] = { .type = NLA_U32 },
878878 [HWSIM_ATTR_RADIO_ID] = { .type = NLA_U32 },
drivers/platform/loongarch/loongson-laptop.c+1−3
@@ -30,7 +30,6 @@ · 29 unmodified lines
3030 #define LOONGSON_ACPI_HKEY_HID "LOON0000"
3131
3232 #define ACPI_LAPTOP_NAME "loongson-laptop"
33−#define ACPI_LAPTOP_ACPI_EVENT_PREFIX "loongson"
3433
3534 #define MAX_ACPI_ARGS 3
3635 #define GENERIC_HOTKEY_MAP_MAX 64
@@ -167,8 +166,6 @@ static int __init setup_acpi_notify(struct generic_sub_driver *sub_driver) · 130 unmodified lines
167166 }
168167
169168 sub_driver->device->driver_data = sub_driver;
170− sprintf(acpi_device_class(sub_driver->device), "%s/%s",
171− ACPI_LAPTOP_ACPI_EVENT_PREFIX, sub_driver->name);
172169
173170 status = acpi_install_notify_handler(*sub_driver->handle,
174171 sub_driver->type, dispatch_acpi_notify, sub_driver);
@@ -189,6 +186,7 @@ static int __init setup_acpi_notify(struct generic_sub_driver *sub_driver) · 14 unmodified lines
189186
190187 static int loongson_hotkey_suspend(struct device *dev)
191188 {
189+ bl_powered = false;
192190 return 0;
193191 }
194192
drivers/platform/x86/asus-wmi.c+23−3
@@ -1618,6 +1618,8 @@ static DEVICE_ATTR_RW(charge_control_end_threshold); · 1617 unmodified lines
16181618
16191619 static int asus_wmi_battery_add(struct power_supply *battery, struct acpi_battery_hook *hook)
16201620 {
1621+ int ret, rv;
1622+
16211623 /* The WMI method does not provide a way to specific a battery, so we
16221624 * just assume it is the first battery.
16231625 * Note: On some newer ASUS laptops (Zenbook UM431DA), the primary/first
@@ -1635,12 +1637,30 @@ static int asus_wmi_battery_add(struct power_supply *battery, struct acpi_batter · 11 unmodified lines
16351637
16361638 /* The charge threshold is only reset when the system is power cycled,
16371639 * and we can't read the current threshold, however the majority of
1638− * platforms retains it, therefore signal the threshold as unknown
1639− * until user explicitly sets it to a new value.
1640+ * platforms retains it.
1641+ *
1642+ * Setting a negative value would signal the threshold as unknown
1643+ * until user explicitly sets it to a new value, however to avoid
1644+ * regressing userspace, we initialize it to a value of 100.
16401645 */
1641− charge_end_threshold = -1;
1646+ charge_end_threshold = 100;
1647+ ret = asus_wmi_set_devstate(ASUS_WMI_DEVID_RSOC, charge_end_threshold, &rv);
1648+ if (ret) {
1649+ pr_err("Failed to reset battery charge threshold\n");
1650+ goto asus_wmi_battery_add_err;
1651+ }
1652+
1653+ if (rv != 1) {
1654+ pr_err("Error in battery charge threshold reset\n");
1655+ ret = -EIO;
1656+ goto asus_wmi_battery_add_err;
1657+ }
16421658
16431659 return 0;
1660+asus_wmi_battery_add_err:
1661+ device_remove_file(&battery->dev,
1662+ &dev_attr_charge_control_end_threshold);
1663+ return ret;
16441664 }
16451665
16461666 static int asus_wmi_battery_remove(struct power_supply *battery, struct acpi_battery_hook *hook)
drivers/platform/x86/intel/vsec.c+12−5
@@ -103,6 +103,12 @@ static void intel_vsec_remove_aux(void *data) · 102 unmodified lines
103103 auxiliary_device_uninit(data);
104104 }
105105
106+static void intel_vsec_dev_free(struct intel_vsec_device *intel_vsec_dev)
107+{
108+ kfree(intel_vsec_dev->acpi_disc);
109+ kfree(intel_vsec_dev);
110+}
111+
106112 static void intel_vsec_dev_release(struct device *dev)
107113 {
108114 struct intel_vsec_device *intel_vsec_dev = dev_to_ivdev(dev);
@@ -111,8 +117,7 @@ static void intel_vsec_dev_release(struct device *dev) · 2 unmodified lines
111117
112118 ida_free(intel_vsec_dev->ida, intel_vsec_dev->auxdev.id);
113119
114− kfree(intel_vsec_dev->acpi_disc);
115− kfree(intel_vsec_dev);
120+ intel_vsec_dev_free(intel_vsec_dev);
116121 }
117122
118123 static const struct vsec_feature_dependency *
@@ -218,20 +223,22 @@ int intel_vsec_add_aux(struct device *parent, · 99 unmodified lines
218223 struct auxiliary_device *auxdev = &intel_vsec_dev->auxdev;
219224 int ret, id;
220225
221− if (!parent)
226+ if (!parent) {
227+ intel_vsec_dev_free(intel_vsec_dev);
222228 return -EINVAL;
229+ }
223230
224231 ret = xa_alloc(&auxdev_array, &intel_vsec_dev->id, intel_vsec_dev,
225232 PMT_XA_LIMIT, GFP_KERNEL);
226233 if (ret < 0) {
227− kfree(intel_vsec_dev);
234+ intel_vsec_dev_free(intel_vsec_dev);
228235 return ret;
229236 }
230237
231238 id = ida_alloc(intel_vsec_dev->ida, GFP_KERNEL);
232239 if (id < 0) {
233240 xa_erase(&auxdev_array, intel_vsec_dev->id);
234− kfree(intel_vsec_dev);
241+ intel_vsec_dev_free(intel_vsec_dev);
235242 return id;
236243 }
237244
drivers/ptp/ptp_netc.c+1−0
@@ -779,6 +779,7 @@ static void netc_timer_init(struct netc_timer *priv) · 778 unmodified lines
779779 netc_timer_wr(priv, NETC_TMR_FIPER_CTRL, fiper_ctrl);
780780 netc_timer_wr(priv, NETC_TMR_ECTRL, NETC_TMR_DEFAULT_ETTF_THR);
781781
782+ netc_timer_offset_write(priv, 0);
782783 ktime_get_real_ts64(&now);
783784 ns = timespec64_to_ns(&now);
784785 netc_timer_cnt_write(priv, ns);
drivers/ptp/ptp_s390.c+5−1
@@ -107,6 +107,9 @@ static __init int ptp_s390_init(void) · 106 unmodified lines
107107 if (IS_ERR(ptp_stcke_clock))
108108 return PTR_ERR(ptp_stcke_clock);
109109
110+ if (!test_facility(28) || !ptff_query(PTFF_QPT))
111+ return 0;
112+
110113 ptp_qpt_clock = ptp_clock_register(&ptp_s390_qpt_info, NULL);
111114 if (IS_ERR(ptp_qpt_clock)) {
112115 ptp_clock_unregister(ptp_stcke_clock);
@@ -117,7 +120,8 @@ static __init int ptp_s390_init(void) · 4 unmodified lines
117120
118121 static __exit void ptp_s390_exit(void)
119122 {
120− ptp_clock_unregister(ptp_qpt_clock);
123+ if (ptp_qpt_clock)
124+ ptp_clock_unregister(ptp_qpt_clock);
121125 ptp_clock_unregister(ptp_stcke_clock);
122126 }
123127
drivers/regulator/core.c+90−73
@@ -1220,10 +1220,98 @@ static int machine_constraints_voltage(struct regulator_dev *rdev, · 1219 unmodified lines
12201220 {
12211221 const struct regulator_ops *ops = rdev->desc->ops;
12221222 int ret;
1223+ bool apply_uV;
1224+
1225+ /*
1226+ * Decide up front, from the constraints as handed to us, whether
1227+ * apply_uV needs to run below. The clamping pass right after this
1228+ * may rewrite constraints->min_uV/max_uV (e.g. the fixed-voltage
1229+ * autoconfigure case), and we don't want that to change whether
1230+ * apply_uV fires.
1231+ */
1232+ apply_uV = rdev->constraints->apply_uV &&
1233+ rdev->constraints->min_uV && rdev->constraints->max_uV;
1234+
1235+ /*
1236+ * Constrain machine-level voltage specs to fit the actual range
1237+ * supported by this regulator before apply_uV (below) tries to
1238+ * force hardware to a value from that range: otherwise apply_uV
1239+ * can target a constraint value that doesn't correspond to any
1240+ * real voltage selector and fail registration outright, even
1241+ * though the clamping pass would have narrowed it to a value
1242+ * the regulator can actually hit.
1243+ */
1244+ if (ops->list_voltage && rdev->desc->n_voltages) {
1245+ int count = rdev->desc->n_voltages;
1246+ int i;
1247+ int min_uV = INT_MAX;
1248+ int max_uV = INT_MIN;
1249+ int cmin = constraints->min_uV;
1250+ int cmax = constraints->max_uV;
1251+
1252+ /* it's safe to autoconfigure fixed-voltage supplies
1253+ * and the constraints are used by list_voltage.
1254+ */
1255+ if (count == 1 && !cmin) {
1256+ cmin = 1;
1257+ cmax = INT_MAX;
1258+ constraints->min_uV = cmin;
1259+ constraints->max_uV = cmax;
1260+ }
1261+
1262+ /* voltage constraints are optional */
1263+ if ((cmin == 0) && (cmax == 0)) {
1264+ /* nothing more to do */
1265+
1266+ /* else require explicit machine-level constraints */
1267+ } else if (cmin <= 0 || cmax <= 0 || cmax < cmin) {
1268+ rdev_err(rdev, "invalid voltage constraints\n");
1269+ return -EINVAL;
1270+
1271+ /* no need to loop voltages if range is continuous */
1272+ } else if (rdev->desc->continuous_voltage_range) {
1273+ /* nothing more to do */
1274+
1275+ } else {
1276+ /* initial: [cmin..cmax] valid, [min_uV..max_uV] not */
1277+ for (i = 0; i < count; i++) {
1278+ int value;
1279+
1280+ value = ops->list_voltage(rdev, i);
1281+ if (value <= 0)
1282+ continue;
1283+
1284+ /* maybe adjust [min_uV..max_uV] */
1285+ if (value >= cmin && value < min_uV)
1286+ min_uV = value;
1287+ if (value <= cmax && value > max_uV)
1288+ max_uV = value;
1289+ }
1290+
1291+ /* final: [min_uV..max_uV] valid iff constraints valid */
1292+ if (max_uV < min_uV) {
1293+ rdev_err(rdev,
1294+ "unsupportable voltage constraints %u-%uuV\n",
1295+ min_uV, max_uV);
1296+ return -EINVAL;
1297+ }
1298+
1299+ /* use regulator's subset of machine constraints */
1300+ if (constraints->min_uV < min_uV) {
1301+ rdev_dbg(rdev, "override min_uV, %d -> %d\n",
1302+ constraints->min_uV, min_uV);
1303+ constraints->min_uV = min_uV;
1304+ }
1305+ if (constraints->max_uV > max_uV) {
1306+ rdev_dbg(rdev, "override max_uV, %d -> %d\n",
1307+ constraints->max_uV, max_uV);
1308+ constraints->max_uV = max_uV;
1309+ }
1310+ }
1311+ }
12231312
12241313 /* do we need to apply the constraint voltage */
1225− if (rdev->constraints->apply_uV &&
1226− rdev->constraints->min_uV && rdev->constraints->max_uV) {
1314+ if (apply_uV) {
12271315 int target_min, target_max;
12281316 int current_uV = regulator_get_voltage_rdev(rdev);
12291317
@@ -1278,77 +1366,6 @@ static int machine_constraints_voltage(struct regulator_dev *rdev, · 48 unmodified lines
12781366 }
12791367 }
12801368
1281− /* constrain machine-level voltage specs to fit
1282− * the actual range supported by this regulator.
1283− */
1284− if (ops->list_voltage && rdev->desc->n_voltages) {
1285− int count = rdev->desc->n_voltages;
1286− int i;
1287− int min_uV = INT_MAX;
1288− int max_uV = INT_MIN;
1289− int cmin = constraints->min_uV;
1290− int cmax = constraints->max_uV;
1291−
1292− /* it's safe to autoconfigure fixed-voltage supplies
1293− * and the constraints are used by list_voltage.
1294− */
1295− if (count == 1 && !cmin) {
1296− cmin = 1;
1297− cmax = INT_MAX;
1298− constraints->min_uV = cmin;
1299− constraints->max_uV = cmax;
1300− }
1301−
1302− /* voltage constraints are optional */
1303− if ((cmin == 0) && (cmax == 0))
1304− return 0;
1305−
1306− /* else require explicit machine-level constraints */
1307− if (cmin <= 0 || cmax <= 0 || cmax < cmin) {
1308− rdev_err(rdev, "invalid voltage constraints\n");
1309− return -EINVAL;
1310− }
1311−
1312− /* no need to loop voltages if range is continuous */
1313− if (rdev->desc->continuous_voltage_range)
1314− return 0;
1315−
1316− /* initial: [cmin..cmax] valid, [min_uV..max_uV] not */
1317− for (i = 0; i < count; i++) {
1318− int value;
1319−
1320− value = ops->list_voltage(rdev, i);
1321− if (value <= 0)
1322− continue;
1323−
1324− /* maybe adjust [min_uV..max_uV] */
1325− if (value >= cmin && value < min_uV)
1326− min_uV = value;
1327− if (value <= cmax && value > max_uV)
1328− max_uV = value;
1329− }
1330−
1331− /* final: [min_uV..max_uV] valid iff constraints valid */
1332− if (max_uV < min_uV) {
1333− rdev_err(rdev,
1334− "unsupportable voltage constraints %u-%uuV\n",
1335− min_uV, max_uV);
1336− return -EINVAL;
1337− }
1338−
1339− /* use regulator's subset of machine constraints */
1340− if (constraints->min_uV < min_uV) {
1341− rdev_dbg(rdev, "override min_uV, %d -> %d\n",
1342− constraints->min_uV, min_uV);
1343− constraints->min_uV = min_uV;
1344− }
1345− if (constraints->max_uV > max_uV) {
1346− rdev_dbg(rdev, "override max_uV, %d -> %d\n",
1347− constraints->max_uV, max_uV);
1348− constraints->max_uV = max_uV;
1349− }
1350− }
1351−
13521369 return 0;
13531370 }
13541371
drivers/regulator/mt6358-regulator.c+1−1
@@ -492,7 +492,7 @@ static const struct regulator_ops mt6358_volt_fixed_ops = { · 491 unmodified lines
492492 .list_voltage = regulator_list_voltage_linear,
493493 .map_voltage = regulator_map_voltage_linear,
494494 .set_voltage_sel = regulator_set_voltage_sel_regmap,
495− .get_voltage_sel = mt6358_get_buck_voltage_sel,
495+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
496496 .set_voltage_time_sel = regulator_set_voltage_time_sel,
497497 .enable = regulator_enable_regmap,
498498 .disable = regulator_disable_regmap,
drivers/resctrl/mpam_devices.c+22−14
@@ -1552,12 +1552,9 @@ static u16 mpam_wa_t241_calc_min_from_max(struct mpam_props *props, · 1551 unmodified lines
15521552 static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid,
15531553 struct mpam_config *cfg)
15541554 {
1555− u32 pri_val = 0;
15561555 u16 cmax = MPAMCFG_CMAX_CMAX;
15571556 struct mpam_msc *msc = ris->vmsc->msc;
15581557 struct mpam_props *rprops = &ris->props;
1559− u16 dspri = GENMASK(rprops->dspri_wd, 0);
1560− u16 intpri = GENMASK(rprops->intpri_wd, 0);
15611558
15621559 mutex_lock(&msc->part_sel_lock);
15631560 __mpam_part_sel(ris->ris_idx, partid, msc);
@@ -1583,9 +1580,9 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid, · 19 unmodified lines
15831580
15841581 if (mpam_has_feature(mpam_feat_mbw_part, rprops)) {
15851582 if (mpam_has_feature(mpam_feat_mbw_part, cfg))
1586− mpam_reset_msc_bitmap(msc, MPAMCFG_MBW_PBM, rprops->mbw_pbm_bits);
1587− else
15881583 mpam_write_partsel_reg(msc, MBW_PBM, cfg->mbw_pbm);
1584+ else
1585+ mpam_reset_msc_bitmap(msc, MPAMCFG_MBW_PBM, rprops->mbw_pbm_bits);
15891586 }
15901587
15911588 if (mpam_has_feature(mpam_feat_mbw_min, rprops)) {
@@ -1622,16 +1619,25 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid, · 30 unmodified lines
16221619
16231620 if (mpam_has_feature(mpam_feat_intpri_part, rprops) ||
16241621 mpam_has_feature(mpam_feat_dspri_part, rprops)) {
1625− /* aces high? */
1626− if (!mpam_has_feature(mpam_feat_intpri_part_0_low, rprops))
1627− intpri = 0;
1628− if (!mpam_has_feature(mpam_feat_dspri_part_0_low, rprops))
1629− dspri = 0;
1622+ u32 pri_val = 0;
1623+
1624+ if (mpam_has_feature(mpam_feat_intpri_part, rprops)) {
1625+ u16 intpri = GENMASK(rprops->intpri_wd - 1, 0);
1626+
1627+ /* aces high? */
1628+ if (!mpam_has_feature(mpam_feat_intpri_part_0_low, rprops))
1629+ intpri = 0;
16301630
1631− if (mpam_has_feature(mpam_feat_intpri_part, rprops))
16321631 pri_val |= FIELD_PREP(MPAMCFG_PRI_INTPRI, intpri);
1633− if (mpam_has_feature(mpam_feat_dspri_part, rprops))
1632+ }
1633+ if (mpam_has_feature(mpam_feat_dspri_part, rprops)) {
1634+ u16 dspri = GENMASK(rprops->dspri_wd - 1, 0);
1635+
1636+ if (!mpam_has_feature(mpam_feat_dspri_part_0_low, rprops))
1637+ dspri = 0;
1638+
16341639 pri_val |= FIELD_PREP(MPAMCFG_PRI_DSPRI, dspri);
1640+ }
16351641
16361642 mpam_write_partsel_reg(msc, PRI, pri_val);
16371643 }
@@ -2606,8 +2612,10 @@ static void __destroy_component_cfg(struct mpam_component *comp) · 968 unmodified lines
26062612 msc = vmsc->msc;
26072613
26082614 if (mpam_mon_sel_lock(msc)) {
2609− list_for_each_entry(ris, &vmsc->ris, vmsc_list)
2610− add_to_garbage(ris->mbwu_state);
2615+ list_for_each_entry(ris, &vmsc->ris, vmsc_list) {
2616+ if (ris->mbwu_state)
2617+ add_to_garbage(ris->mbwu_state);
2618+ }
26112619 mpam_mon_sel_unlock(msc);
26122620 }
26132621 }
drivers/spi/spi-spacemit-k1.c+2−2
@@ -494,8 +494,8 @@ static bool k1_spi_write(struct k1_spi_driver_data *drv_data, u32 val) · 493 unmodified lines
494494 {
495495 unsigned int count;
496496
497− /* Get the number of open slots in the FIFO; zero means all */
498− count = FIELD_GET(SSP_STATUS_TFL, val) ? : K1_SPI_FIFO_SIZE;
497+ /* Get the number of free slots in the FIFO */
498+ count = K1_SPI_FIFO_SIZE - FIELD_GET(SSP_STATUS_TFL, val);
499499
500500 /*
501501 * Limit how much we try to send at a time, to reduce the
drivers/staging/rtl8723bs/core/rtw_ieee80211.c+8−1
@@ -670,7 +670,14 @@ u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen) · 669 unmodified lines
670670 while (cnt < in_len) {
671671 eid = in_ie[cnt];
672672
673− if ((eid == WLAN_EID_VENDOR_SPECIFIC) && (!memcmp(&in_ie[cnt + 2], wps_oui, 4))) {
673+ if (cnt + 2 > in_len)
674+ break;
675+
676+ if (in_ie[cnt + 1] + 2 > in_len - cnt)
677+ break;
678+
679+ if ((eid == WLAN_EID_VENDOR_SPECIFIC) && (in_ie[cnt + 1] >= 4) &&
680+ (!memcmp(&in_ie[cnt + 2], wps_oui, 4))) {
674681 wpsie_ptr = &in_ie[cnt];
675682
676683 if (wps_ie)
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c+1−1
@@ -1957,7 +1957,7 @@ static u8 rtw_get_chan_type(struct adapter *adapter) · 1956 unmodified lines
19571957 else
19581958 return NL80211_CHAN_NO_HT;
19591959 case CHANNEL_WIDTH_40:
1960− if (mlme_ext->cur_ch_offset == HAL_PRIME_CHNL_OFFSET_UPPER)
1960+ if (mlme_ext->cur_ch_offset == HAL_PRIME_CHNL_OFFSET_LOWER)
19611961 return NL80211_CHAN_HT40PLUS;
19621962 else
19631963 return NL80211_CHAN_HT40MINUS;
drivers/tty/serial/8250/8250_mid.c+9−5
@@ -318,9 +318,11 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 317 unmodified lines
318318 if (!uart.port.membase)
319319 return -ENOMEM;
320320
321− ret = mid->board->setup(mid, &uart.port);
322− if (ret)
323− return ret;
321+ if (mid->board->setup) {
322+ ret = mid->board->setup(mid, &uart.port);
323+ if (ret)
324+ return ret;
325+ }
324326
325327 ret = mid8250_dma_setup(mid, &uart);
326328 if (ret)
@@ -336,7 +338,8 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 9 unmodified lines
336338 return 0;
337339
338340 err:
339− mid->board->exit(mid);
341+ if (mid->board->exit)
342+ mid->board->exit(mid);
340343 return ret;
341344 }
342345
@@ -346,7 +349,8 @@ static void mid8250_remove(struct pci_dev *pdev) · 3 unmodified lines
346349
347350 serial8250_unregister_port(mid->line);
348351
349− mid->board->exit(mid);
352+ if (mid->board->exit)
353+ mid->board->exit(mid);
350354 }
351355
352356 static const struct mid8250_board pnw_board = {
drivers/tty/serial/sc16is7xx.c+12−0
@@ -1273,6 +1273,17 @@ static int sc16is7xx_gpio_set(struct gpio_chip *chip, unsigned int offset, · 1272 unmodified lines
12731273 return 0;
12741274 }
12751275
1276+static int sc16is7xx_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
1277+{
1278+ struct sc16is7xx_port *s = gpiochip_get_data(chip);
1279+ struct uart_port *port = &s->p[0].port;
1280+ unsigned int val;
1281+
1282+ val = sc16is7xx_port_read(port, SC16IS7XX_IODIR_REG);
1283+
1284+ return val & BIT(offset) ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN;
1285+}
1286+
12761287 static int sc16is7xx_gpio_direction_input(struct gpio_chip *chip,
12771288 unsigned offset)
12781289 {
@@ -1350,6 +1361,7 @@ static int sc16is7xx_setup_gpio_chip(struct sc16is7xx_port *s) · 71 unmodified lines
13501361 s->gpio.parent = dev;
13511362 s->gpio.label = dev_name(dev);
13521363 s->gpio.init_valid_mask = sc16is7xx_gpio_init_valid_mask;
1364+ s->gpio.get_direction = sc16is7xx_gpio_get_direction;
13531365 s->gpio.direction_input = sc16is7xx_gpio_direction_input;
13541366 s->gpio.get = sc16is7xx_gpio_get;
13551367 s->gpio.direction_output = sc16is7xx_gpio_direction_output;
drivers/uio/uio_hv_generic.c+7−1
@@ -396,9 +396,15 @@ hv_uio_remove(struct hv_device *dev) · 395 unmodified lines
396396 vmbus_free_ring(dev->channel);
397397 }
398398
399+static const struct hv_vmbus_device_id hv_uio_id_table[] = {
400+ { HV_FCOPY_GUID },
401+ {}
402+};
403+MODULE_DEVICE_TABLE(vmbus, hv_uio_id_table);
404+
399405 static struct hv_driver hv_uio_drv = {
400406 .name = "uio_hv_generic",
401− .id_table = NULL, /* only dynamic id's */
407+ .id_table = hv_uio_id_table,
402408 .probe = hv_uio_probe,
403409 .remove = hv_uio_remove,
404410 };
drivers/usb/atm/ueagle-atm.c+17−0
@@ -2549,6 +2549,7 @@ static struct usbatm_driver uea_usbatm_driver = { · 2548 unmodified lines
25492549 static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id)
25502550 {
25512551 struct usb_device *usb = interface_to_usbdev(intf);
2552+ bool single_iface = usb->config->desc.bNumInterfaces == 1;
25522553 int ret;
25532554
25542555 uea_dbg(usb, "ADSL device found with vid (%#X) pid (%#X) Rev (%#X): %s\n",
@@ -2557,6 +2558,22 @@ static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id) · 2 unmodified lines
25572558 le16_to_cpu(usb->descriptor.bcdDevice),
25582559 chip_name[UEA_CHIP_VERSION(id)]);
25592560
2561+ /*
2562+ * uea_probe() decides between the pre-firmware and post-firmware case
2563+ * from the USB id and stores a different object as interface data in
2564+ * each case: a struct completion for a pre-firmware device, a struct
2565+ * usbatm_data for a post-firmware one. uea_disconnect() instead tells
2566+ * the two apart by the number of interfaces (a pre-firmware device
2567+ * exposes a single interface, ADI930 has 2 and eagle has 3). A crafted
2568+ * device advertising a pre-firmware id together with a multi-interface
2569+ * descriptor (or the other way around) makes the two disagree, so that
2570+ * usbatm_usb_disconnect() treats the small completion object as a
2571+ * struct usbatm_data and reads out of bounds. Reject such inconsistent
2572+ * descriptors so both paths make the same decision.
2573+ */
2574+ if (UEA_IS_PREFIRM(id) != single_iface)
2575+ return -ENODEV;
2576+
25602577 usb_reset_device(usb);
25612578
25622579 if (UEA_IS_PREFIRM(id)) {
drivers/usb/chipidea/core.c+1−0
@@ -1250,6 +1250,7 @@ static void ci_hdrc_remove(struct platform_device *pdev) · 1249 unmodified lines
12501250 usb_role_switch_unregister(ci->role_switch);
12511251
12521252 if (ci->supports_runtime_pm) {
1253+ pm_runtime_dont_use_autosuspend(&pdev->dev);
12531254 pm_runtime_get_sync(&pdev->dev);
12541255 pm_runtime_disable(&pdev->dev);
12551256 pm_runtime_put_noidle(&pdev->dev);
drivers/usb/core/port.c+2−0
@@ -740,6 +740,8 @@ static void connector_unbind(struct device *dev, struct device *connector, void · 739 unmodified lines
740740
741741 sysfs_remove_link(&connector->kobj, dev_name(dev));
742742 sysfs_remove_link(&dev->kobj, "connector");
743+ if (port_dev->child)
744+ typec_deattach(port_dev->connector, &port_dev->child->dev);
743745 port_dev->connector = NULL;
744746 }
745747
drivers/usb/core/sysfs.c+7−1
@@ -899,10 +899,15 @@ bos_descriptors_read(struct file *filp, struct kobject *kobj, · 898 unmodified lines
899899 {
900900 struct device *dev = kobj_to_dev(kobj);
901901 struct usb_device *udev = to_usb_device(dev);
902− struct usb_host_bos *bos = udev->bos;
902+ struct usb_host_bos *bos;
903903 struct usb_bos_descriptor *desc;
904904 size_t desclen, n = 0;
905+ int rc;
905906
907+ rc = usb_lock_device_interruptible(udev);
908+ if (rc < 0)
909+ return -EINTR;
910+ bos = udev->bos;
906911 if (bos) {
907912 desc = bos->desc;
908913 desclen = le16_to_cpu(desc->wTotalLength);
@@ -911,6 +916,7 @@ bos_descriptors_read(struct file *filp, struct kobject *kobj, · 2 unmodified lines
911916 memcpy(buf, (void *) desc + off, n);
912917 }
913918 }
919+ usb_unlock_device(udev);
914920 return n;
915921 }
916922 static const BIN_ATTR_RO(bos_descriptors, 65535); /* max-size BOS */
drivers/usb/gadget/function/f_midi.c+1−0
@@ -1309,6 +1309,7 @@ static void f_midi_free(struct usb_function *f) · 1308 unmodified lines
13091309 opts = container_of(f->fi, struct f_midi_opts, func_inst);
13101310 mutex_lock(&opts->lock);
13111311 if (!--midi->free_ref) {
1312+ cancel_work_sync(&midi->work);
13121313 kfree(midi->id);
13131314 kfifo_free(&midi->in_req_fifo);
13141315 kfree(midi);
drivers/usb/gadget/function/f_ncm.c+13−4
@@ -1189,6 +1189,10 @@ static int ncm_unwrap_ntb(struct gether *port, · 1188 unmodified lines
11891189 frame_max = ncm_opts->max_segment_size;
11901190
11911191 parse_ntb:
1192+ if (to_process < (int)opts->nth_size) {
1193+ INFO(port->func.config->cdev, "Packet too small for headers\n");
1194+ goto err;
1195+ }
11921196 tmp = (__le16 *)ntb_ptr;
11931197
11941198 /* dwSignature */
@@ -1209,8 +1213,12 @@ parse_ntb: · 14 unmodified lines
12091213 tmp++; /* skip wSequence */
12101214
12111215 block_len = get_ncm(&tmp, opts->block_length);
1216+ if (block_len == 0)
1217+ block_len = to_process;
1218+
12121219 /* (d)wBlockLength */
1213− if ((block_len < opts->nth_size + opts->ndp_size) || (block_len > ntb_max)) {
1220+ if ((block_len < opts->nth_size + opts->ndp_size) || (block_len > ntb_max) ||
1221+ (block_len > to_process)) {
12141222 INFO(port->func.config->cdev, "Bad block length: %#X\n", block_len);
12151223 goto err;
12161224 }
@@ -1273,7 +1281,7 @@ parse_ntb: · 56 unmodified lines
12731281 index = index2;
12741282 /* wDatagramIndex[0] */
12751283 if ((index < opts->nth_size) ||
1276− (index > block_len - opts->dpe_size)) {
1284+ (index > block_len)) {
12771285 INFO(port->func.config->cdev,
12781286 "Bad index: %#X\n", index);
12791287 goto err;
@@ -1285,7 +1293,8 @@ parse_ntb: · 5 unmodified lines
12851293 * ethernet hdr + crc or larger than max frame size
12861294 */
12871295 if ((dg_len < 14 + crc_len) ||
1288− (dg_len > frame_max)) {
1296+ (dg_len > frame_max) ||
1297+ (dg_len > block_len - index)) {
12891298 INFO(port->func.config->cdev,
12901299 "Bad dgram length: %#X\n", dg_len);
12911300 goto err;
@@ -1310,7 +1319,7 @@ parse_ntb: · 18 unmodified lines
13101319 dg_len2 = get_ncm(&tmp, opts->dgram_item_len);
13111320
13121321 /* wDatagramIndex[1] */
1313− if (index2 > block_len - opts->dpe_size) {
1322+ if (index2 > block_len) {
13141323 INFO(port->func.config->cdev,
13151324 "Bad index: %#X\n", index2);
13161325 goto err;
drivers/usb/gadget/function/f_printer.c+18−5
@@ -431,7 +431,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) · 430 unmodified lines
431431 {
432432 struct printer_dev *dev = fd->private_data;
433433 unsigned long flags;
434− size_t size;
434+ size_t size, not_copied, copied;
435435 size_t bytes_copied;
436436 struct usb_request *req;
437437 /* This is a pointer to the current USB rx request. */
@@ -524,10 +524,12 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) · 86 unmodified lines
524524 else
525525 size = len;
526526
527− size -= copy_to_user(buf, current_rx_buf, size);
528− bytes_copied += size;
529− len -= size;
530− buf += size;
527+ not_copied = copy_to_user(buf, current_rx_buf, size);
528+ copied = size - not_copied;
529+
530+ bytes_copied += copied;
531+ len -= copied;
532+ buf += copied;
531533
532534 spin_lock_irqsave(&dev->lock, flags);
533535
@@ -542,6 +544,17 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr) · 8 unmodified lines
542544 if (dev->interface < 0)
543545 goto out_disabled;
544546
547+ if (!copied) {
548+ dev->current_rx_req = current_rx_req;
549+ dev->current_rx_bytes = current_rx_bytes;
550+ dev->current_rx_buf = current_rx_buf;
551+ spin_unlock_irqrestore(&dev->lock, flags);
552+ mutex_unlock(&dev->lock_printer_io);
553+ return bytes_copied ? bytes_copied : -EFAULT;
554+ }
555+
556+ size = copied;
557+
545558 /* If we not returning all the data left in this RX request
546559 * buffer then adjust the amount of data left in the buffer.
547560 * Othewise if we are done with this RX request buffer then
drivers/usb/gadget/function/f_tcm.c+164−28
@@ -2363,31 +2363,158 @@ ep_fail: · 2362 unmodified lines
23632363 return -ENOTSUPP;
23642364 }
23652365
2366−struct guas_setup_wq {
2367− struct work_struct work;
2368− struct f_uas *fu;
2369− unsigned int alt;
2370−};
2366+static void tcm_cleanup_old_alt(struct f_uas *fu)
2367+{
2368+ if (fu->flags & USBG_IS_UAS)
2369+ uasp_cleanup_old_alt(fu);
2370+ else if (fu->flags & USBG_IS_BOT)
2371+ bot_cleanup_old_alt(fu);
2372+ fu->flags = 0;
2373+}
2374+
2375+static void tcm_delayed_set_alt_done(struct f_uas *fu)
2376+{
2377+ unsigned long flags;
2378+
2379+ spin_lock_irqsave(&fu->delayed_set_alt_lock, flags);
2380+ fu->delayed_set_alt_state = USBG_DELAYED_SET_ALT_IDLE;
2381+ fu->delayed_set_alt_cancel = false;
2382+ spin_unlock_irqrestore(&fu->delayed_set_alt_lock, flags);
2383+}
2384+
2385+static bool tcm_delayed_set_alt_cancelled(struct f_uas *fu)
2386+{
2387+ bool cancelled;
2388+ unsigned long flags;
2389+
2390+ spin_lock_irqsave(&fu->delayed_set_alt_lock, flags);
2391+ cancelled = fu->delayed_set_alt_cancel;
2392+ spin_unlock_irqrestore(&fu->delayed_set_alt_lock, flags);
2393+
2394+ return cancelled;
2395+}
2396+
2397+static bool tcm_complete_delayed_status(struct f_uas *fu)
2398+{
2399+ struct usb_composite_dev *cdev = fu->function.config->cdev;
2400+ struct usb_request *req = cdev->req;
2401+ unsigned long cdev_flags;
2402+ bool cancelled;
2403+ int ret;
2404+
2405+ spin_lock_irqsave(&cdev->lock, cdev_flags);
2406+ spin_lock(&fu->delayed_set_alt_lock);
2407+ cancelled = fu->delayed_set_alt_cancel;
2408+ if (!cancelled) {
2409+ fu->delayed_set_alt_state = USBG_DELAYED_SET_ALT_IDLE;
2410+ fu->delayed_set_alt_cancel = false;
2411+ }
2412+ spin_unlock(&fu->delayed_set_alt_lock);
2413+
2414+ if (cancelled) {
2415+ spin_unlock_irqrestore(&cdev->lock, cdev_flags);
2416+ return false;
2417+ }
2418+
2419+ if (cdev->delayed_status == 0) {
2420+ WARN(cdev, "%s: Unexpected call\n", __func__);
2421+ } else if (--cdev->delayed_status == 0) {
2422+ req->length = 0;
2423+ req->context = cdev;
2424+ ret = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
2425+ if (ret == 0) {
2426+ cdev->setup_pending = true;
2427+ } else {
2428+ req->status = 0;
2429+ req->complete(cdev->gadget->ep0, req);
2430+ }
2431+ }
2432+
2433+ spin_unlock_irqrestore(&cdev->lock, cdev_flags);
2434+
2435+ return true;
2436+}
2437+
2438+static bool tcm_cancel_delayed_set_alt(struct f_uas *fu)
2439+{
2440+ bool cleanup = false;
2441+ bool cancel = false;
2442+ unsigned long flags;
2443+
2444+ spin_lock_irqsave(&fu->delayed_set_alt_lock, flags);
2445+ switch (fu->delayed_set_alt_state) {
2446+ case USBG_DELAYED_SET_ALT_IDLE:
2447+ cleanup = true;
2448+ break;
2449+ case USBG_DELAYED_SET_ALT_QUEUED:
2450+ case USBG_DELAYED_SET_ALT_RUNNING:
2451+ fu->delayed_set_alt_cancel = true;
2452+ cancel = true;
2453+ break;
2454+ }
2455+ spin_unlock_irqrestore(&fu->delayed_set_alt_lock, flags);
2456+
2457+ if (cancel && cancel_work(&fu->delayed_set_alt)) {
2458+ spin_lock_irqsave(&fu->delayed_set_alt_lock, flags);
2459+ if (fu->delayed_set_alt_state == USBG_DELAYED_SET_ALT_QUEUED) {
2460+ fu->delayed_set_alt_state = USBG_DELAYED_SET_ALT_IDLE;
2461+ fu->delayed_set_alt_cancel = false;
2462+ cleanup = true;
2463+ }
2464+ spin_unlock_irqrestore(&fu->delayed_set_alt_lock, flags);
2465+ }
2466+
2467+ return cleanup;
2468+}
2469+
2470+static void tcm_cancel_delayed_set_alt_sync(struct f_uas *fu)
2471+{
2472+ unsigned long flags;
2473+
2474+ spin_lock_irqsave(&fu->delayed_set_alt_lock, flags);
2475+ if (fu->delayed_set_alt_state != USBG_DELAYED_SET_ALT_IDLE)
2476+ fu->delayed_set_alt_cancel = true;
2477+ spin_unlock_irqrestore(&fu->delayed_set_alt_lock, flags);
2478+
2479+ cancel_work_sync(&fu->delayed_set_alt);
2480+
2481+ spin_lock_irqsave(&fu->delayed_set_alt_lock, flags);
2482+ fu->delayed_set_alt_state = USBG_DELAYED_SET_ALT_IDLE;
2483+ fu->delayed_set_alt_cancel = false;
2484+ spin_unlock_irqrestore(&fu->delayed_set_alt_lock, flags);
2485+}
23712486
23722487 static void tcm_delayed_set_alt(struct work_struct *wq)
23732488 {
2374− struct guas_setup_wq *work = container_of(wq, struct guas_setup_wq,
2375− work);
2376− struct f_uas *fu = work->fu;
2377− int alt = work->alt;
2489+ struct f_uas *fu = container_of(wq, struct f_uas, delayed_set_alt);
2490+ unsigned long flags;
2491+ unsigned int alt;
23782492
2379− kfree(work);
2493+ spin_lock_irqsave(&fu->delayed_set_alt_lock, flags);
2494+ if (fu->delayed_set_alt_state != USBG_DELAYED_SET_ALT_QUEUED) {
2495+ spin_unlock_irqrestore(&fu->delayed_set_alt_lock, flags);
2496+ return;
2497+ }
2498+ fu->delayed_set_alt_state = USBG_DELAYED_SET_ALT_RUNNING;
2499+ alt = fu->delayed_alt;
2500+ spin_unlock_irqrestore(&fu->delayed_set_alt_lock, flags);
23802501
2381− if (fu->flags & USBG_IS_BOT)
2382− bot_cleanup_old_alt(fu);
2383− if (fu->flags & USBG_IS_UAS)
2384− uasp_cleanup_old_alt(fu);
2502+ tcm_cleanup_old_alt(fu);
2503+
2504+ if (tcm_delayed_set_alt_cancelled(fu))
2505+ goto out_done;
23852506
23862507 if (alt == USB_G_ALT_INT_BBB)
23872508 bot_set_alt(fu);
23882509 else if (alt == USB_G_ALT_INT_UAS)
23892510 uasp_set_alt(fu);
2390− usb_composite_setup_continue(fu->function.config->cdev);
2511+
2512+ if (tcm_complete_delayed_status(fu))
2513+ return;
2514+
2515+ tcm_cleanup_old_alt(fu);
2516+out_done:
2517+ tcm_delayed_set_alt_done(fu);
23912518 }
23922519
23932520 static int tcm_get_alt(struct usb_function *f, unsigned intf)
@@ -2413,15 +2540,20 @@ static int tcm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) · 19 unmodified lines
24132540 return -EOPNOTSUPP;
24142541
24152542 if ((alt == USB_G_ALT_INT_BBB) || (alt == USB_G_ALT_INT_UAS)) {
2416− struct guas_setup_wq *work;
2543+ unsigned long flags;
24172544
2418− work = kmalloc_obj(*work, GFP_ATOMIC);
2419− if (!work)
2420− return -ENOMEM;
2421− INIT_WORK(&work->work, tcm_delayed_set_alt);
2422− work->fu = fu;
2423− work->alt = alt;
2424− schedule_work(&work->work);
2545+ spin_lock_irqsave(&fu->delayed_set_alt_lock, flags);
2546+ if (fu->delayed_set_alt_state != USBG_DELAYED_SET_ALT_IDLE) {
2547+ spin_unlock_irqrestore(&fu->delayed_set_alt_lock,
2548+ flags);
2549+ return -EBUSY;
2550+ }
2551+ fu->delayed_alt = alt;
2552+ fu->delayed_set_alt_cancel = false;
2553+ fu->delayed_set_alt_state = USBG_DELAYED_SET_ALT_QUEUED;
2554+ spin_unlock_irqrestore(&fu->delayed_set_alt_lock, flags);
2555+
2556+ schedule_work(&fu->delayed_set_alt);
24252557 return USB_GADGET_DELAYED_STATUS;
24262558 }
24272559 return -EOPNOTSUPP;
@@ -2431,11 +2563,8 @@ static void tcm_disable(struct usb_function *f) · 3 unmodified lines
24312563 {
24322564 struct f_uas *fu = to_f_uas(f);
24332565
2434− if (fu->flags & USBG_IS_UAS)
2435− uasp_cleanup_old_alt(fu);
2436− else if (fu->flags & USBG_IS_BOT)
2437− bot_cleanup_old_alt(fu);
2438− fu->flags = 0;
2566+ if (tcm_cancel_delayed_set_alt(fu))
2567+ tcm_cleanup_old_alt(fu);
24392568 }
24402569
24412570 static int tcm_setup(struct usb_function *f,
@@ -2583,11 +2712,16 @@ static void tcm_free(struct usb_function *f) · 141 unmodified lines
25832712 {
25842713 struct f_uas *tcm = to_f_uas(f);
25852714
2715+ tcm_cancel_delayed_set_alt_sync(tcm);
25862716 kfree(tcm);
25872717 }
25882718
25892719 static void tcm_unbind(struct usb_configuration *c, struct usb_function *f)
25902720 {
2721+ struct f_uas *fu = to_f_uas(f);
2722+
2723+ tcm_cancel_delayed_set_alt_sync(fu);
2724+ tcm_cleanup_old_alt(fu);
25912725 usb_free_all_descriptors(f);
25922726 }
25932727
@@ -2620,6 +2754,8 @@ static struct usb_function *tcm_alloc(struct usb_function_instance *fi) · 26 unmodified lines
26202754 fu->function.disable = tcm_disable;
26212755 fu->function.free_func = tcm_free;
26222756 fu->tpg = tpg_instances[i].tpg;
2757+ INIT_WORK(&fu->delayed_set_alt, tcm_delayed_set_alt);
2758+ spin_lock_init(&fu->delayed_set_alt_lock);
26232759
26242760 hash_init(fu->stream_hash);
26252761 mutex_unlock(&tpg_instances_lock);
drivers/usb/gadget/function/tcm.h+13−0
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #define __TARGET_USB_GADGET_H__
44
55 #include <linux/kref.h>
6+#include <linux/spinlock.h>
67 /* #include <linux/usb/uas.h> */
78 #include <linux/hashtable.h>
89 #include <linux/usb/composite.h>
@@ -29,6 +30,12 @@ enum { · 20 unmodified lines
2930
3031 #define USB_G_DEFAULT_SESSION_TAGS USBG_NUM_CMDS
3132
33+enum {
34+ USBG_DELAYED_SET_ALT_IDLE = 0,
35+ USBG_DELAYED_SET_ALT_QUEUED,
36+ USBG_DELAYED_SET_ALT_RUNNING,
37+};
38+
3239 struct tcm_usbg_nexus {
3340 struct se_session *tvn_se_sess;
3441 };
@@ -132,6 +139,12 @@ struct f_uas { · 97 unmodified lines
132139 #define USBG_BOT_CMD_PEND (1 << 4)
133140 #define USBG_BOT_WEDGED (1 << 5)
134141
142+ struct work_struct delayed_set_alt;
143+ spinlock_t delayed_set_alt_lock; /* protects delayed_set_alt_* */
144+ unsigned int delayed_alt;
145+ unsigned int delayed_set_alt_state;
146+ bool delayed_set_alt_cancel;
147+
135148 struct usbg_cdb cmd[USBG_NUM_CMDS];
136149 struct usb_ep *ep_in;
137150 struct usb_ep *ep_out;
drivers/usb/gadget/function/uvc_v4l2.c+2−0
@@ -200,6 +200,8 @@ uvc_send_response(struct uvc_device *uvc, struct uvc_request_data *data) · 199 unmodified lines
200200 return usb_ep_set_halt(cdev->gadget->ep0);
201201
202202 req->length = min_t(unsigned int, uvc->event_length, data->length);
203+ if (req->length > sizeof(data->data))
204+ req->length = sizeof(data->data);
203205 req->zero = data->length < uvc->event_length;
204206
205207 memcpy(req->buf, data->data, req->length);
drivers/usb/gadget/udc/bdc/bdc_core.c+20−0
@@ -585,9 +585,29 @@ disable_clk: · 584 unmodified lines
585585 static void bdc_remove(struct platform_device *pdev)
586586 {
587587 struct bdc *bdc;
588+ unsigned long flags;
589+ u32 temp;
588590
589591 bdc = platform_get_drvdata(pdev);
590592 dev_dbg(bdc->dev, "%s ()\n", __func__);
593+ /*
594+ * Disable the device interrupt source before freeing the IRQ:
595+ * clear BDC_GIE so the controller stops asserting interrupts,
596+ * then free_irq drains any in-flight handler.
597+ */
598+ spin_lock_irqsave(&bdc->lock, flags);
599+ temp = bdc_readl(bdc->regs, BDC_BDCSC);
600+ temp &= ~BDC_GIE;
601+ bdc_writel(bdc->regs, BDC_BDCSC, temp);
602+ spin_unlock_irqrestore(&bdc->lock, flags);
603+ free_irq(bdc->irq, bdc);
604+ /*
605+ * Drain func_wake_notify after free_irq: the IRQ handler arms this
606+ * delayed_work via bdc_sr_uspc -> handle_link_state_change ->
607+ * schedule_delayed_work (self-rearmed in bdc_func_wake_timer), so
608+ * the IRQ must be released first to prevent re-arm after cancel.
609+ */
610+ cancel_delayed_work_sync(&bdc->func_wake_notify);
591611 bdc_udc_exit(bdc);
592612 bdc_hw_exit(bdc);
593613 bdc_phy_exit(bdc);
drivers/usb/gadget/udc/bdc/bdc_udc.c+4−3
@@ -530,8 +530,8 @@ int bdc_udc_init(struct bdc *bdc) · 529 unmodified lines
530530
531531
532532 bdc->gadget.name = BRCM_BDC_NAME;
533− ret = devm_request_irq(bdc->dev, bdc->irq, bdc_udc_interrupt,
534− IRQF_SHARED, BRCM_BDC_NAME, bdc);
533+ ret = request_irq(bdc->irq, bdc_udc_interrupt, IRQF_SHARED,
534+ BRCM_BDC_NAME, bdc);
535535 if (ret) {
536536 dev_err(bdc->dev,
537537 "failed to request irq #%d %d\n",
@@ -542,7 +542,7 @@ int bdc_udc_init(struct bdc *bdc) · 4 unmodified lines
542542 ret = bdc_init_ep(bdc);
543543 if (ret) {
544544 dev_err(bdc->dev, "bdc init ep fail: %d\n", ret);
545− return ret;
545+ goto err0;
546546 }
547547
548548 ret = usb_add_gadget_udc(bdc->dev, &bdc->gadget);
@@ -571,6 +571,7 @@ int bdc_udc_init(struct bdc *bdc) · 22 unmodified lines
571571 err1:
572572 usb_del_gadget_udc(&bdc->gadget);
573573 err0:
574+ free_irq(bdc->irq, bdc);
574575 bdc_free_ep(bdc);
575576
576577 return ret;
drivers/usb/gadget/udc/dummy_hcd.c+27−13
@@ -278,6 +278,7 @@ struct dummy { · 277 unmodified lines
278278 unsigned ints_enabled:1;
279279 unsigned udc_suspended:1;
280280 unsigned pullup:1;
281+ unsigned fifo_req_busy:1;
281282
282283 /*
283284 * HOST side support
@@ -329,6 +330,26 @@ static inline struct dummy *gadget_dev_to_dummy(struct device *dev) · 45 unmodified lines
329330
330331 /* DEVICE/GADGET SIDE UTILITY ROUTINES */
331332
333+/*
334+ * Give back a gadget request with dum->lock dropped around the callback.
335+ * If @req is the shared fifo_req, clear fifo_req_busy afterward: the flag
336+ * was set in dummy_queue() when the shared request was taken and must stay
337+ * set until its completion callback has returned; list_del_init() alone
338+ * makes the request look idle while the callback is still running.
339+ * Caller holds dum->lock and has already done list_del_init() + status.
340+ */
341+static void dummy_giveback(struct dummy *dum, struct usb_ep *_ep,
342+ struct dummy_request *req)
343+{
344+ bool fifo = req == &dum->fifo_req;
345+
346+ spin_unlock(&dum->lock);
347+ usb_gadget_giveback_request(_ep, &req->req);
348+ spin_lock(&dum->lock);
349+ if (fifo)
350+ dum->fifo_req_busy = 0;
351+}
352+
332353 /* called with spinlock held */
333354 static void nuke(struct dummy *dum, struct dummy_ep *ep)
334355 {
@@ -339,9 +360,7 @@ static void nuke(struct dummy *dum, struct dummy_ep *ep) · 4 unmodified lines
339360 list_del_init(&req->queue);
340361 req->req.status = -ESHUTDOWN;
341362
342− spin_unlock(&dum->lock);
343− usb_gadget_giveback_request(&ep->ep, &req->req);
344− spin_lock(&dum->lock);
363+ dummy_giveback(dum, &ep->ep, req);
345364 }
346365 }
347366
@@ -728,10 +747,11 @@ static int dummy_queue(struct usb_ep *_ep, struct usb_request *_req, · 380 unmodified lines
728747
729748 /* implement an emulated single-request FIFO */
730749 if (ep->desc && (ep->desc->bEndpointAddress & USB_DIR_IN) &&
731− list_empty(&dum->fifo_req.queue) &&
750+ !dum->fifo_req_busy &&
732751 list_empty(&ep->queue) &&
733752 _req->length <= FIFO_SIZE) {
734753 req = &dum->fifo_req;
754+ dum->fifo_req_busy = 1;
735755 req->req = *_req;
736756 req->req.buf = dum->fifo_buf;
737757 memcpy(dum->fifo_buf, _req->buf, _req->length);
@@ -785,9 +805,7 @@ static int dummy_dequeue(struct usb_ep *_ep, struct usb_request *_req) · 47 unmodified lines
785805 dev_dbg(udc_dev(dum),
786806 "dequeued req %p from %s, len %d buf %p\n",
787807 req, _ep->name, _req->length, _req->buf);
788− spin_unlock(&dum->lock);
789− usb_gadget_giveback_request(_ep, _req);
790− spin_lock(&dum->lock);
808+ dummy_giveback(dum, _ep, req);
791809 }
792810 spin_unlock_irqrestore(&dum->lock, flags);
793811 return retval;
@@ -1523,9 +1541,7 @@ top: · 729 unmodified lines
15231541 if (req->req.status != -EINPROGRESS) {
15241542 list_del_init(&req->queue);
15251543
1526− spin_unlock(&dum->lock);
1527− usb_gadget_giveback_request(&ep->ep, &req->req);
1528− spin_lock(&dum->lock);
1544+ dummy_giveback(dum, &ep->ep, req);
15291545
15301546 /* requests might have been unlinked... */
15311547 rescan = 1;
@@ -1910,9 +1926,7 @@ restart: · 378 unmodified lines
19101926 dev_dbg(udc_dev(dum), "stale req = %p\n",
19111927 req);
19121928
1913− spin_unlock(&dum->lock);
1914− usb_gadget_giveback_request(&ep->ep, &req->req);
1915− spin_lock(&dum->lock);
1929+ dummy_giveback(dum, &ep->ep, req);
19161930 ep->already_seen = 0;
19171931 goto restart;
19181932 }
drivers/usb/gadget/udc/fsl_udc_core.c+42−57
@@ -184,7 +184,7 @@ __acquires(ep->udc->lock) · 183 unmodified lines
184184 usb_gadget_unmap_request(&ep->udc->gadget, &req->req, ep_is_in(ep));
185185
186186 if (status && (status != -ESHUTDOWN))
187− dev_vdbg(&udc->gadget.dev, "complete %s req %p stat %d len %u/%u\n",
187+ dev_vdbg(udc->dev, "complete %s req %p stat %d len %u/%u\n",
188188 ep->ep.name, &req->req, status,
189189 req->req.actual, req->req.length);
190190
@@ -286,7 +286,7 @@ static int dr_controller_setup(struct fsl_udc *udc) · 95 unmodified lines
286286 timeout = jiffies + FSL_UDC_RESET_TIMEOUT;
287287 while (fsl_readl(&dr_regs->usbcmd) & USB_CMD_CTRL_RESET) {
288288 if (time_after(jiffies, timeout)) {
289− dev_err(&udc->gadget.dev, "udc reset timeout!\n");
289+ dev_err(udc->dev, "udc reset timeout!\n");
290290 return -ETIMEDOUT;
291291 }
292292 cpu_relax();
@@ -309,7 +309,7 @@ static int dr_controller_setup(struct fsl_udc *udc) · 16 unmodified lines
309309 tmp &= USB_EP_LIST_ADDRESS_MASK;
310310 fsl_writel(tmp, &dr_regs->endpointlistaddr);
311311
312− dev_vdbg(&udc->gadget.dev,
312+ dev_vdbg(udc->dev,
313313 "vir[qh_base] is %p phy[qh_base] is 0x%8x reg is 0x%8x\n",
314314 udc->ep_qh, (int)tmp,
315315 fsl_readl(&dr_regs->endpointlistaddr));
@@ -500,7 +500,7 @@ static void struct_ep_qh_setup(struct fsl_udc *udc, unsigned char ep_num, · 184 unmodified lines
500500 tmp = max_pkt_len << EP_QUEUE_HEAD_MAX_PKT_LEN_POS;
501501 break;
502502 default:
503− dev_vdbg(&udc->gadget.dev, "error ep type is %d\n", ep_type);
503+ dev_vdbg(udc->dev, "error ep type is %d\n", ep_type);
504504 return;
505505 }
506506 if (zlt)
@@ -613,7 +613,7 @@ static int fsl_ep_enable(struct usb_ep *_ep, · 106 unmodified lines
613613 spin_unlock_irqrestore(&udc->lock, flags);
614614 retval = 0;
615615
616− dev_vdbg(&udc->gadget.dev, "enabled %s (ep%d%s) maxpacket %d\n",
616+ dev_vdbg(udc->dev, "enabled %s (ep%d%s) maxpacket %d\n",
617617 ep->ep.name, ep->ep.desc->bEndpointAddress & 0x0f,
618618 (desc->bEndpointAddress & USB_DIR_IN) ? "in" : "out",
619619 max);
@@ -634,13 +634,8 @@ static int fsl_ep_disable(struct usb_ep *_ep) · 14 unmodified lines
634634 int ep_num;
635635
636636 ep = container_of(_ep, struct fsl_ep, ep);
637− if (!_ep || !ep->ep.desc) {
638− /*
639− * dev_vdbg(&udc->gadget.dev, "%s not enabled\n",
640− * _ep ? ep->ep.name : NULL);
641− */
637+ if (!_ep || !ep->ep.desc)
642638 return -EINVAL;
643− }
644639
645640 /* disable ep on controller */
646641 ep_num = ep_index(ep);
@@ -664,7 +659,7 @@ static int fsl_ep_disable(struct usb_ep *_ep) · 17 unmodified lines
664659 ep->stopped = 1;
665660 spin_unlock_irqrestore(&udc->lock, flags);
666661
667− dev_vdbg(&udc->gadget.dev, "disabled %s OK\n", _ep->name);
662+ dev_vdbg(udc->dev, "disabled %s OK\n", _ep->name);
668663 return 0;
669664 }
670665
@@ -724,9 +719,6 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) · 53 unmodified lines
724719 {
725720 u32 temp, bitmask, tmp_stat;
726721
727− /* dev_vdbg(&udc->gadget.dev, "QH addr Register 0x%8x\n", dr_regs->endpointlistaddr);
728− dev_vdbg(&udc->gadget.dev, "ep_qh[%d] addr is 0x%8x\n", i, (u32)&(ep->udc->ep_qh[i])); */
729−
730722 bitmask = ep_is_in(ep)
731723 ? (1 << (ep_index(ep) + 16))
732724 : (1 << (ep_index(ep)));
@@ -813,7 +805,7 @@ static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length, · 80 unmodified lines
813805 *is_last = 0;
814806
815807 if ((*is_last) == 0)
816− dev_vdbg(&udc_controller->gadget.dev, "multi-dtd request!\n");
808+ dev_vdbg(udc_controller->dev, "multi-dtd request!\n");
817809 /* Fill in the transfer size; set active bit */
818810 swap_temp = ((*length << DTD_LENGTH_BIT_POS) | DTD_STATUS_ACTIVE);
819811
@@ -825,7 +817,7 @@ static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length, · 5 unmodified lines
825817
826818 mb();
827819
828− dev_vdbg(&udc_controller->gadget.dev, "length = %d address= 0x%x\n", *length, (int)*dma);
820+ dev_vdbg(udc_controller->dev, "length = %d address= 0x%x\n", *length, (int)*dma);
829821
830822 return dtd;
831823 }
@@ -876,11 +868,11 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) · 44 unmodified lines
876868 /* catch various bogus parameters */
877869 if (!_req || !req->req.complete || !req->req.buf
878870 || !list_empty(&req->queue)) {
879− dev_vdbg(&udc->gadget.dev, "%s, bad params\n", __func__);
871+ dev_vdbg(udc->dev, "%s, bad params\n", __func__);
880872 return -EINVAL;
881873 }
882874 if (unlikely(!ep->ep.desc)) {
883− dev_vdbg(&udc->gadget.dev, "%s, bad ep\n", __func__);
875+ dev_vdbg(udc->dev, "%s, bad ep\n", __func__);
884876 return -EINVAL;
885877 }
886878 if (usb_endpoint_xfer_isoc(ep->ep.desc)) {
@@ -1040,7 +1032,7 @@ static int fsl_ep_set_halt(struct usb_ep *_ep, int value) · 153 unmodified lines
10401032 udc->ep0_dir = 0;
10411033 }
10421034 out:
1043− dev_vdbg(&udc->gadget.dev, "%s %s halt stat %d\n", ep->ep.name,
1035+ dev_vdbg(udc->dev, "%s %s halt stat %d\n", ep->ep.name,
10441036 value ? "set" : "clear", status);
10451037
10461038 return status;
@@ -1109,7 +1101,7 @@ static void fsl_ep_fifo_flush(struct usb_ep *_ep) · 62 unmodified lines
11091101 /* Wait until flush complete */
11101102 while (fsl_readl(&dr_regs->endptflush)) {
11111103 if (time_after(jiffies, timeout)) {
1112− dev_err(&udc_controller->gadget.dev,
1104+ dev_err(udc_controller->dev,
11131105 "ep flush timeout\n");
11141106 return;
11151107 }
@@ -1182,7 +1174,7 @@ static int fsl_vbus_session(struct usb_gadget *gadget, int is_active) · 66 unmodified lines
11821174
11831175 udc = container_of(gadget, struct fsl_udc, gadget);
11841176 spin_lock_irqsave(&udc->lock, flags);
1185− dev_vdbg(&gadget->dev, "VBUS %s\n", str_on_off(is_active));
1177+ dev_vdbg(udc->dev, "VBUS %s\n", str_on_off(is_active));
11861178 udc->vbus_active = (is_active != 0);
11871179 if (can_pullup(udc))
11881180 fsl_writel((fsl_readl(&dr_regs->usbcmd) | USB_CMD_RUN_STOP),
@@ -1548,7 +1540,7 @@ static void ep0_req_complete(struct fsl_udc *udc, struct fsl_ep *ep0, · 359 unmodified lines
15481540 udc->ep0_state = WAIT_FOR_SETUP;
15491541 break;
15501542 case WAIT_FOR_SETUP:
1551− dev_err(&udc->gadget.dev, "Unexpected ep0 packets\n");
1543+ dev_err(udc->dev, "Unexpected ep0 packets\n");
15521544 break;
15531545 default:
15541546 ep0stall(udc);
@@ -1617,7 +1609,7 @@ static int process_ep_req(struct fsl_udc *udc, int pipe, · 62 unmodified lines
16171609 errors = hc32_to_cpu(curr_td->size_ioc_sts);
16181610 if (errors & DTD_ERROR_MASK) {
16191611 if (errors & DTD_STATUS_HALTED) {
1620− dev_err(&udc->gadget.dev, "dTD error %08x QH=%d\n", errors, pipe);
1612+ dev_err(udc->dev, "dTD error %08x QH=%d\n", errors, pipe);
16211613 /* Clear the errors and Halt condition */
16221614 tmp = hc32_to_cpu(curr_qh->size_ioc_int_sts);
16231615 tmp &= ~errors;
@@ -1628,26 +1620,26 @@ static int process_ep_req(struct fsl_udc *udc, int pipe, · 4 unmodified lines
16281620 break;
16291621 }
16301622 if (errors & DTD_STATUS_DATA_BUFF_ERR) {
1631− dev_vdbg(&udc->gadget.dev, "Transfer overflow\n");
1623+ dev_vdbg(udc->dev, "Transfer overflow\n");
16321624 status = -EPROTO;
16331625 break;
16341626 } else if (errors & DTD_STATUS_TRANSACTION_ERR) {
1635− dev_vdbg(&udc->gadget.dev, "ISO error\n");
1627+ dev_vdbg(udc->dev, "ISO error\n");
16361628 status = -EILSEQ;
16371629 break;
16381630 } else
1639− dev_err(&udc->gadget.dev,
1631+ dev_err(udc->dev,
16401632 "Unknown error has occurred (0x%x)!\n",
16411633 errors);
16421634
16431635 } else if (hc32_to_cpu(curr_td->size_ioc_sts)
16441636 & DTD_STATUS_ACTIVE) {
1645− dev_vdbg(&udc->gadget.dev, "Request not complete\n");
1637+ dev_vdbg(udc->dev, "Request not complete\n");
16461638 status = REQ_UNCOMPLETE;
16471639 return status;
16481640 } else if (remaining_length) {
16491641 if (direction) {
1650− dev_vdbg(&udc->gadget.dev,
1642+ dev_vdbg(udc->dev,
16511643 "Transmit dTD remaining length not zero\n");
16521644 status = -EPROTO;
16531645 break;
@@ -1655,8 +1647,7 @@ static int process_ep_req(struct fsl_udc *udc, int pipe, · 1 unmodified line
16551647 break;
16561648 }
16571649 } else {
1658− dev_vdbg(&udc->gadget.dev,
1659− "dTD transmitted successful\n");
1650+ dev_vdbg(udc->dev, "dTD transmitted successful\n");
16601651 }
16611652
16621653 if (j != curr_req->dtd_count - 1)
@@ -1699,7 +1690,7 @@ static void dtd_complete_irq(struct fsl_udc *udc) · 36 unmodified lines
16991690
17001691 /* If the ep is configured */
17011692 if (!curr_ep->ep.name) {
1702− dev_warn(&udc->gadget.dev, "Invalid EP?\n");
1693+ dev_warn(udc->dev, "Invalid EP?\n");
17031694 continue;
17041695 }
17051696
@@ -1708,7 +1699,7 @@ static void dtd_complete_irq(struct fsl_udc *udc) · 2 unmodified lines
17081699 queue) {
17091700 status = process_ep_req(udc, i, curr_req);
17101701
1711− dev_vdbg(&udc->gadget.dev,
1702+ dev_vdbg(udc->dev,
17121703 "status of process_ep_req= %d, ep = %d\n",
17131704 status, ep_num);
17141705 if (status == REQ_UNCOMPLETE)
@@ -1829,7 +1820,7 @@ static void reset_irq(struct fsl_udc *udc) · 114 unmodified lines
18291820 while (fsl_readl(&dr_regs->endpointprime)) {
18301821 /* Wait until all endptprime bits cleared */
18311822 if (time_after(jiffies, timeout)) {
1832− dev_err(&udc->gadget.dev, "Timeout for reset\n");
1823+ dev_err(udc->dev, "Timeout for reset\n");
18331824 break;
18341825 }
18351826 cpu_relax();
@@ -1839,7 +1830,7 @@ static void reset_irq(struct fsl_udc *udc) · 3 unmodified lines
18391830 fsl_writel(0xffffffff, &dr_regs->endptflush);
18401831
18411832 if (fsl_readl(&dr_regs->portsc1) & PORTSCX_PORT_RESET) {
1842− dev_vdbg(&udc->gadget.dev, "Bus reset\n");
1833+ dev_vdbg(udc->dev, "Bus reset\n");
18431834 /* Bus is reseting */
18441835 udc->bus_reset = 1;
18451836 /* Reset all the queues, include XD, dTD, EP queue
@@ -1847,7 +1838,7 @@ static void reset_irq(struct fsl_udc *udc) · 1 unmodified line
18471838 reset_queues(udc, true);
18481839 udc->usb_state = USB_STATE_DEFAULT;
18491840 } else {
1850− dev_vdbg(&udc->gadget.dev, "Controller reset\n");
1841+ dev_vdbg(udc->dev, "Controller reset\n");
18511842 /* initialize usb hw reg except for regs for EP, not
18521843 * touch usbintr reg */
18531844 dr_controller_setup(udc);
@@ -1881,7 +1872,7 @@ static irqreturn_t fsl_udc_irq(int irq, void *_udc) · 27 unmodified lines
18811872 /* Clear notification bits */
18821873 fsl_writel(irq_src, &dr_regs->usbsts);
18831874
1884− /* dev_vdbg(&udc->gadget.dev, "irq_src [0x%8x]", irq_src); */
1875+ /* dev_vdbg(udc->dev, "irq_src [0x%8x]", irq_src); */
18851876
18861877 /* Need to resume? */
18871878 if (udc->usb_state == USB_STATE_SUSPENDED)
@@ -1890,7 +1881,7 @@ static irqreturn_t fsl_udc_irq(int irq, void *_udc) · 2 unmodified lines
18901881
18911882 /* USB Interrupt */
18921883 if (irq_src & USB_STS_INT) {
1893− dev_vdbg(&udc->gadget.dev, "Packet int\n");
1884+ dev_vdbg(udc->dev, "Packet int\n");
18941885 /* Setup package, we only support ep0 as control ep */
18951886 if (fsl_readl(&dr_regs->endptsetupstat) & EP_SETUP_STATUS_EP0) {
18961887 tripwire_handler(udc, 0,
@@ -1919,7 +1910,7 @@ static irqreturn_t fsl_udc_irq(int irq, void *_udc) · 22 unmodified lines
19191910
19201911 /* Reset Received */
19211912 if (irq_src & USB_STS_RESET) {
1922− dev_vdbg(&udc->gadget.dev, "reset int\n");
1913+ dev_vdbg(udc->dev, "reset int\n");
19231914 reset_irq(udc);
19241915 status = IRQ_HANDLED;
19251916 }
@@ -1931,7 +1922,7 @@ static irqreturn_t fsl_udc_irq(int irq, void *_udc) · 5 unmodified lines
19311922 }
19321923
19331924 if (irq_src & (USB_STS_ERR | USB_STS_SYS_ERR)) {
1934− dev_vdbg(&udc->gadget.dev, "Error IRQ %x\n", irq_src);
1925+ dev_vdbg(udc->dev, "Error IRQ %x\n", irq_src);
19351926 }
19361927
19371928 spin_unlock_irqrestore(&udc->lock, flags);
@@ -1967,7 +1958,7 @@ static int fsl_udc_start(struct usb_gadget *g, · 29 unmodified lines
19671958 udc_controller->transceiver->otg,
19681959 &udc_controller->gadget);
19691960 if (retval < 0) {
1970− dev_err(&udc_controller->gadget.dev, "can't bind to transceiver\n");
1961+ dev_err(udc_controller->dev, "can't bind to transceiver\n");
19711962 udc_controller->driver = NULL;
19721963 return retval;
19731964 }
@@ -2252,7 +2243,7 @@ static int struct_udc_setup(struct fsl_udc *udc, · 278 unmodified lines
22522243
22532244 udc->eps = kzalloc_objs(struct fsl_ep, udc->max_ep);
22542245 if (!udc->eps) {
2255− dev_err(&udc->gadget.dev, "kmalloc udc endpoint status failed\n");
2246+ dev_err(udc->dev, "kmalloc udc endpoint status failed\n");
22562247 goto eps_alloc_failed;
22572248 }
22582249
@@ -2267,7 +2258,7 @@ static int struct_udc_setup(struct fsl_udc *udc, · 8 unmodified lines
22672258 udc->ep_qh = dma_alloc_coherent(&pdev->dev, size,
22682259 &udc->ep_qh_dma, GFP_KERNEL);
22692260 if (!udc->ep_qh) {
2270− dev_err(&udc->gadget.dev, "malloc QHs for udc failed\n");
2261+ dev_err(udc->dev, "malloc QHs for udc failed\n");
22712262 goto ep_queue_alloc_failed;
22722263 }
22732264
@@ -2278,14 +2269,14 @@ static int struct_udc_setup(struct fsl_udc *udc, · 4 unmodified lines
22782269 udc->status_req = container_of(fsl_alloc_request(NULL, GFP_KERNEL),
22792270 struct fsl_req, req);
22802271 if (!udc->status_req) {
2281− dev_err(&udc->gadget.dev, "kzalloc for udc status request failed\n");
2272+ dev_err(udc->dev, "kzalloc for udc status request failed\n");
22822273 goto udc_status_alloc_failed;
22832274 }
22842275
22852276 /* allocate a small amount of memory to get valid address */
22862277 udc->status_req->req.buf = kmalloc(8, GFP_KERNEL);
22872278 if (!udc->status_req->req.buf) {
2288− dev_err(&udc->gadget.dev, "kzalloc for udc request buffer failed\n");
2279+ dev_err(udc->dev, "kzalloc for udc request buffer failed\n");
22892280 goto udc_req_buf_alloc_failed;
22902281 }
22912282
@@ -2373,6 +2364,7 @@ static int fsl_udc_probe(struct platform_device *pdev) · 81 unmodified lines
23732364 if (udc_controller == NULL)
23742365 return -ENOMEM;
23752366
2367+ udc_controller->dev = &pdev->dev;
23762368 pdata = dev_get_platdata(&pdev->dev);
23772369 udc_controller->pdata = pdata;
23782370 spin_lock_init(&udc_controller->lock);
@@ -2382,7 +2374,7 @@ static int fsl_udc_probe(struct platform_device *pdev) · 3 unmodified lines
23822374 if (pdata->operating_mode == FSL_USB2_DR_OTG) {
23832375 udc_controller->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
23842376 if (IS_ERR_OR_NULL(udc_controller->transceiver)) {
2385− dev_err(&udc_controller->gadget.dev, "Can't find OTG driver!\n");
2377+ dev_err(&pdev->dev, "Can't find OTG driver!\n");
23862378 ret = -ENODEV;
23872379 goto err_kfree;
23882380 }
@@ -2398,7 +2390,7 @@ static int fsl_udc_probe(struct platform_device *pdev) · 9 unmodified lines
23982390 if (pdata->operating_mode == FSL_USB2_DR_DEVICE) {
23992391 if (!request_mem_region(res->start, resource_size(res),
24002392 driver_name)) {
2401− dev_err(&udc_controller->gadget.dev, "request mem region for %s failed\n", pdev->name);
2393+ dev_err(&pdev->dev, "failed to request mem region\n");
24022394 ret = -EBUSY;
24032395 goto err_kfree;
24042396 }
@@ -2429,7 +2421,7 @@ static int fsl_udc_probe(struct platform_device *pdev) · 24 unmodified lines
24292421 /* Read Device Controller Capability Parameters register */
24302422 dccparams = fsl_readl(&dr_regs->dccparams);
24312423 if (!(dccparams & DCCPARAMS_DC)) {
2432− dev_err(&udc_controller->gadget.dev, "This SOC doesn't support device role\n");
2424+ dev_err(&pdev->dev, "This SOC doesn't support device role\n");
24332425 ret = -ENODEV;
24342426 goto err_exit;
24352427 }
@@ -2447,14 +2439,14 @@ static int fsl_udc_probe(struct platform_device *pdev) · 11 unmodified lines
24472439 ret = request_irq(udc_controller->irq, fsl_udc_irq, IRQF_SHARED,
24482440 driver_name, udc_controller);
24492441 if (ret != 0) {
2450− dev_err(&udc_controller->gadget.dev, "cannot request irq %d err %d\n",
2442+ dev_err(&pdev->dev, "cannot request irq %d err %d\n",
24512443 udc_controller->irq, ret);
24522444 goto err_exit;
24532445 }
24542446
24552447 /* Initialize the udc structure including QH member and other member */
24562448 if (struct_udc_setup(udc_controller, pdev)) {
2457− dev_err(&udc_controller->gadget.dev, "Can't initialize udc data structure\n");
2449+ dev_err(&pdev->dev, "Can't initialize udc data structure\n");
24582450 ret = -ENOMEM;
24592451 goto err_free_irq;
24602452 }
@@ -2474,7 +2466,6 @@ static int fsl_udc_probe(struct platform_device *pdev) · 13 unmodified lines
24742466 udc_controller->gadget.name = driver_name;
24752467
24762468 /* Setup gadget.dev and register with kernel */
2477− dev_set_name(&udc_controller->gadget.dev, "gadget");
24782469 udc_controller->gadget.dev.of_node = pdev->dev.of_node;
24792470
24802471 if (!IS_ERR_OR_NULL(udc_controller->transceiver))
@@ -2548,12 +2539,6 @@ static void fsl_udc_remove(struct platform_device *pdev) · 67 unmodified lines
25482539
25492540 DECLARE_COMPLETION_ONSTACK(done);
25502541
2551− if (!udc_controller) {
2552− dev_err(&pdev->dev,
2553− "Driver still in use but removing anyhow\n");
2554− return;
2555− }
2556−
25572542 udc_controller->done = &done;
25582543 usb_del_gadget_udc(&udc_controller->gadget);
25592544
drivers/usb/gadget/udc/fsl_usb2_udc.h+1−0
@@ -470,6 +470,7 @@ struct fsl_ep { · 469 unmodified lines
470470 #define EP_DIR_OUT 0
471471
472472 struct fsl_udc {
473+ struct device *dev;
473474 struct usb_gadget gadget;
474475 struct usb_gadget_driver *driver;
475476 struct fsl_usb2_platform_data *pdata;
drivers/usb/gadget/udc/pxa27x_udc.c+3−7
@@ -2374,9 +2374,10 @@ static int pxa_udc_probe(struct platform_device *pdev) · 2373 unmodified lines
23742374 struct pxa_udc *udc = &memory;
23752375 int retval = 0;
23762376
2377− udc->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS);
2377+ udc->gpiod = devm_gpiod_get_optional(&pdev->dev, NULL, GPIOD_ASIS);
23782378 if (IS_ERR(udc->gpiod))
2379− return PTR_ERR(udc->gpiod);
2379+ return dev_err_probe(&pdev->dev, PTR_ERR(udc->gpiod),
2380+ "Couldn't find or request D+ gpio\n");
23802381
23812382 udc->regs = devm_platform_ioremap_resource(pdev, 0);
23822383 if (IS_ERR(udc->regs))
@@ -2395,11 +2396,6 @@ static int pxa_udc_probe(struct platform_device *pdev) · 12 unmodified lines
23952396 udc->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
23962397 }
23972398
2398− if (IS_ERR(udc->gpiod)) {
2399− dev_err(&pdev->dev, "Couldn't find or request D+ gpio : %ld\n",
2400− PTR_ERR(udc->gpiod));
2401− return PTR_ERR(udc->gpiod);
2402− }
24032399 if (udc->gpiod)
24042400 gpiod_direction_output(udc->gpiod, 0);
24052401
drivers/usb/gadget/udc/snps_udc_core.c+0−1
@@ -3133,7 +3133,6 @@ int udc_probe(struct udc *dev) · 3132 unmodified lines
31333133 /* device struct setup */
31343134 dev->gadget.ops = &udc_ops;
31353135
3136− dev_set_name(&dev->gadget.dev, "gadget");
31373136 dev->gadget.name = name;
31383137 dev->gadget.max_speed = USB_SPEED_HIGH;
31393138
drivers/usb/host/xhci-pci.c+1−0
@@ -448,6 +448,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 447 unmodified lines
448448 if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == PCI_DEVICE_ID_VIA_VL805) {
449449 xhci->quirks |= XHCI_LPM_SUPPORT;
450450 xhci->quirks |= XHCI_TRB_OVERFETCH;
451+ xhci->dma_mask_bits = 36;
451452 }
452453
453454 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
drivers/usb/host/xhci.c+10−5
@@ -5466,6 +5466,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) · 5465 unmodified lines
54665466 if (xhci->hci_version > 0x100)
54675467 xhci->hcc_params2 = readl(&xhci->cap_regs->hcc_params2);
54685468
5469+ xhci->dma_mask_bits = 64;
54695470 xhci->max_slots = min(HCS_MAX_SLOTS(hcs_params1), MAX_HC_SLOTS);
54705471 xhci->max_ports = min(HCS_MAX_PORTS(hcs_params1), MAX_HC_PORTS);
54715472 /* xhci-plat or xhci-pci might have set max_interrupters already */
@@ -5515,12 +5516,16 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) · 43 unmodified lines
55155516 if (xhci->quirks & XHCI_NO_64BIT_SUPPORT)
55165517 xhci->hcc_params &= ~BIT(0);
55175518
5518− /* Set dma_mask and coherent_dma_mask to 64-bits,
5519− * if xHC supports 64-bit addressing */
5519+ /*
5520+ * Set dma_mask and coherent_dma_mask to 64-bits if xHC supports
5521+ * 64-bit addressing, unless a controller-specific quirk callback
5522+ * limits the usable address width.
5523+ */
55205524 if ((xhci->hcc_params & HCC_64BIT_ADDR) &&
5521− !dma_set_mask(dev, DMA_BIT_MASK(64))) {
5522− xhci_dbg(xhci, "Enabling 64-bit DMA addresses.\n");
5523− dma_set_coherent_mask(dev, DMA_BIT_MASK(64));
5525+ !dma_set_mask(dev, DMA_BIT_MASK(xhci->dma_mask_bits))) {
5526+ xhci_dbg(xhci, "Enabling %u-bit DMA addresses.\n",
5527+ xhci->dma_mask_bits);
5528+ dma_set_coherent_mask(dev, DMA_BIT_MASK(xhci->dma_mask_bits));
55245529 } else {
55255530 /*
55265531 * This is to avoid error in cases where a 32-bit USB
drivers/usb/host/xhci.h+1−0
@@ -1526,6 +1526,7 @@ struct xhci_hcd { · 1525 unmodified lines
15261526 /* imod_interval in ns (I * 250ns) */
15271527 u32 imod_interval;
15281528 u32 page_size;
1529+ unsigned int dma_mask_bits;
15291530 /* MSI-X/MSI vectors */
15301531 int nvecs;
15311532 /* optional clocks */
drivers/usb/musb/omap2430.c+0−2
@@ -454,7 +454,6 @@ static int omap2430_probe(struct platform_device *pdev) · 453 unmodified lines
454454 dev_err(&pdev->dev, "failed to register musb device\n");
455455 goto err_disable_rpm;
456456 }
457− of_node_put(np);
458457
459458 return 0;
460459
@@ -464,7 +463,6 @@ err_put_control_otghs: · 3 unmodified lines
464463 if (!IS_ERR(glue->control_otghs))
465464 put_device(glue->control_otghs);
466465 err_put_musb:
467− of_node_put(np);
468466 platform_device_put(musb);
469467
470468 return ret;
drivers/usb/serial/ftdi_sio.c+2−0
@@ -1072,6 +1072,8 @@ static const struct usb_device_id id_table_combined[] = { · 1071 unmodified lines
10721072 { USB_DEVICE_INTERFACE_NUMBER(ALTERA_VID, ALTERA_UB3_602E_PID, 3) },
10731073 /* Abacus Electrics */
10741074 { USB_DEVICE(FTDI_VID, ABACUS_OPTICAL_PROBE_PID) },
1075+ /* Endress+Hauser AG devices */
1076+ { USB_DEVICE(FTDI_VID, FTDI_EH_FXA291_PID) },
10751077 { } /* Terminating entry */
10761078 };
10771079
drivers/usb/serial/ftdi_sio_ids.h+5−0
@@ -313,6 +313,11 @@ · 312 unmodified lines
313313 #define FTDI_ELV_UDF77_PID 0xFB5E /* USB DCF Funkuhr (UDF 77) */
314314 #define FTDI_ELV_UIO88_PID 0xFB5F /* USB-I/O Interface (UIO 88) */
315315
316+/*
317+ * Endress+Hauser AG product ids (FTDI_VID)
318+ */
319+#define FTDI_EH_FXA291_PID 0xE510
320+
316321 /*
317322 * EVER Eco Pro UPS (http://www.ever.com.pl/)
318323 */
drivers/usb/serial/io_edgeport.c+2−1
@@ -646,7 +646,8 @@ static void edge_interrupt_callback(struct urb *urb) · 645 unmodified lines
646646 if (edge_port && edge_port->open) {
647647 spin_lock_irqsave(&edge_port->ep_lock,
648648 flags);
649− edge_port->txCredits += txCredits;
649+ edge_port->txCredits = min(edge_port->txCredits + txCredits,
650+ edge_port->maxTxCredits);
650651 spin_unlock_irqrestore(&edge_port->ep_lock,
651652 flags);
652653 dev_dbg(dev, "%s - txcredits for port%d = %d\n",
drivers/usb/serial/io_ti.c+6−0
@@ -1464,6 +1464,12 @@ static int do_boot_mode(struct edgeport_serial *serial, · 1463 unmodified lines
14641464 /* Allocate a 15.5k buffer + 3 byte header */
14651465 buffer_size = (((1024 * 16) - 512) +
14661466 sizeof(struct ti_i2c_image_header));
1467+ if (fw->size - 4 > buffer_size) {
1468+ dev_err(dev, "%s - firmware image is too large\n",
1469+ __func__);
1470+ return -EINVAL;
1471+ }
1472+
14671473 buffer = kmalloc(buffer_size, GFP_KERNEL);
14681474 if (!buffer)
14691475 return -ENOMEM;
drivers/usb/serial/keyspan_pda.c+35−9
@@ -33,6 +33,8 @@ struct keyspan_pda_private { · 32 unmodified lines
3333 struct work_struct unthrottle_work;
3434 struct usb_serial *serial;
3535 struct usb_serial_port *port;
36+ bool throttled;
37+ bool throttle_req;
3638 };
3739
3840 static int keyspan_pda_write_start(struct usb_serial_port *port);
@@ -148,6 +150,7 @@ static void keyspan_pda_rx_interrupt(struct urb *urb) · 109 unmodified lines
148150 int retval;
149151 int status = urb->status;
150152 struct keyspan_pda_private *priv;
153+ bool throttled = false;
151154 unsigned long flags;
152155
153156 priv = usb_get_serial_port_data(port);
@@ -209,16 +212,24 @@ static void keyspan_pda_rx_interrupt(struct urb *urb) · 55 unmodified lines
209212 }
210213
211214 exit:
212− retval = usb_submit_urb(urb, GFP_ATOMIC);
213− if (retval)
214− dev_err(&port->dev,
215− "%s - usb_submit_urb failed with result %d\n",
216− __func__, retval);
215+ spin_lock_irqsave(&port->lock, flags);
216+ if (priv->throttle_req) {
217+ priv->throttled = true;
218+ throttled = true;
219+ }
220+ spin_unlock_irqrestore(&port->lock, flags);
221+
222+ if (!throttled) {
223+ retval = usb_submit_urb(urb, GFP_ATOMIC);
224+ if (retval)
225+ dev_err(&port->dev, "failed to resubmit in urb: %d\n", retval);
226+ }
217227 }
218228
219229 static void keyspan_pda_rx_throttle(struct tty_struct *tty)
220230 {
221231 struct usb_serial_port *port = tty->driver_data;
232+ struct keyspan_pda_private *priv = usb_get_serial_port_data(port);
222233
223234 /*
224235 * Stop receiving characters. We just turn off the URB request, and
@@ -228,16 +239,29 @@ static void keyspan_pda_rx_throttle(struct tty_struct *tty) · 3 unmodified lines
228239 * send an XOFF, although it might make sense to foist that off upon
229240 * the device too.
230241 */
231− usb_kill_urb(port->interrupt_in_urb);
242+ spin_lock_irq(&port->lock);
243+ priv->throttle_req = true;
244+ spin_unlock_irq(&port->lock);
232245 }
233246
234247 static void keyspan_pda_rx_unthrottle(struct tty_struct *tty)
235248 {
236249 struct usb_serial_port *port = tty->driver_data;
250+ struct keyspan_pda_private *priv = usb_get_serial_port_data(port);
251+ bool throttled;
252+ int ret;
237253
238− /* just restart the receive interrupt URB */
239− if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL))
240− dev_dbg(&port->dev, "usb_submit_urb(read urb) failed\n");
254+ spin_lock_irq(&port->lock);
255+ throttled = priv->throttled;
256+ priv->throttled = false;
257+ priv->throttle_req = false;
258+ spin_unlock_irq(&port->lock);
259+
260+ if (throttled) {
261+ ret = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
262+ if (ret)
263+ dev_err(&port->dev, "failed to submit in urb: %d\n", ret);
264+ }
241265 }
242266
243267 static speed_t keyspan_pda_setbaud(struct usb_serial *serial, speed_t baud)
@@ -577,6 +601,8 @@ static int keyspan_pda_open(struct tty_struct *tty, · 333 unmodified lines
577601
578602 spin_lock_irq(&port->lock);
579603 priv->tx_room = rc;
604+ priv->throttled = false;
605+ priv->throttle_req = false;
580606 spin_unlock_irq(&port->lock);
581607
582608 rc = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
drivers/usb/serial/mxuport.c+7−0
@@ -1080,6 +1080,13 @@ static int mxuport_probe(struct usb_serial *serial, · 1079 unmodified lines
10801080 /* Use the firmware already in the device */
10811081 err = 0;
10821082 } else {
1083+ if (fw_p->size <= VER_ADDR_3) {
1084+ dev_err(&serial->interface->dev,
1085+ "Firmware %s is too short\n", buf);
1086+ err = -EINVAL;
1087+ goto out;
1088+ }
1089+
10831090 local_ver = ((fw_p->data[VER_ADDR_1] << 16) |
10841091 (fw_p->data[VER_ADDR_2] << 8) |
10851092 fw_p->data[VER_ADDR_3]);
drivers/usb/serial/option.c+1−0
@@ -2496,6 +2496,7 @@ static const struct usb_device_id option_ids[] = { · 2495 unmodified lines
24962496 .driver_info = RSVD(5) },
24972497 { USB_DEVICE_INTERFACE_CLASS(0x33f8, 0x1003, 0xff), /* Rolling RW135R-GL (laptop MBIM) */
24982498 .driver_info = RSVD(5) },
2499+ { USB_DEVICE_INTERFACE_CLASS(0x3466, 0x3301, 0xff) }, /* TDTECH MT5710-CN */
24992500 { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0100, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WWD for Global */
25002501 { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0100, 0xff, 0x00, 0x40) },
25012502 { USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0100, 0xff, 0xff, 0x40) },
drivers/usb/storage/unusual_devs.h+7−0
@@ -395,6 +395,13 @@ UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110, · 394 unmodified lines
395395 USB_SC_DEVICE, USB_PR_CB, NULL,
396396 US_FL_MAX_SECTORS_MIN),
397397
398+/* Reported by Ai Chao <aichao@kylinos.cn> */
399+UNUSUAL_DEV( 0x04b4, 0xb708, 0x0000, 0xffff,
400+ "Longmai Technologies",
401+ "USB Key",
402+ USB_SC_SCSI, USB_PR_BULK, NULL,
403+ US_FL_NO_ATA_1X),
404+
398405 /*
399406 * Reported by Simon Levitt <simon@whattf.com>
400407 * This entry needs Sub and Proto fields
drivers/usb/typec/ucsi/ucsi.c+187−53
@@ -529,6 +529,129 @@ err: · 528 unmodified lines
529529 return ret;
530530 }
531531
532+static void ucsi_dump_duplicate_altmode(struct ucsi_connector *con,
533+ u8 recipient, u16 svid,
534+ u32 existing_vdo, u32 new_vdo,
535+ int offset)
536+{
537+ static const char * const recipient_names[] = {
538+ [UCSI_RECIPIENT_CON] = "port",
539+ [UCSI_RECIPIENT_SOP] = "partner",
540+ [UCSI_RECIPIENT_SOP_P] = "plug",
541+ [UCSI_RECIPIENT_SOP_PP] = "cable plug prime",
542+ };
543+
544+ dev_warn(con->ucsi->dev,
545+ "con%d: Firmware bug: duplicate %s altmode SVID 0x%04x at offset %d, ignoring but please contact the BIOS vendor to fix this issue.\n",
546+ con->num, recipient_names[recipient], svid, offset);
547+
548+ if (existing_vdo != new_vdo)
549+ dev_warn(con->ucsi->dev,
550+ "con%d: VDO mismatch: 0x%08x vs 0x%08x\n",
551+ con->num, existing_vdo, new_vdo);
552+}
553+
554+/* Count altmodes in @altmodes that advertise @svid. */
555+static int ucsi_altmode_count_svid(struct typec_altmode **altmodes, u16 svid)
556+{
557+ int count = 0;
558+ int k;
559+
560+ for (k = 0; k < UCSI_MAX_ALTMODES; k++) {
561+ if (!altmodes[k])
562+ break;
563+ if (altmodes[k]->svid == svid)
564+ count++;
565+ }
566+
567+ return count;
568+}
569+
570+/*
571+ * Check if an altmode is a duplicate. Some firmware implementations
572+ * incorrectly return the same altmode multiple times, causing sysfs errors.
573+ * Returns true if the altmode should be skipped.
574+ *
575+ * The matching rules differ by recipient:
576+ *
577+ * - UCSI_RECIPIENT_CON (port) and UCSI_RECIPIENT_SOP_P (plug):
578+ * Two altmodes with identical SVID and VDO are byte-for-byte duplicates
579+ * and the second has no observable function. Drop them.
580+ *
581+ * - UCSI_RECIPIENT_SOP (partner):
582+ * The typec class binds each partner altmode to a port altmode of the
583+ * same SVID via altmode_match()/device_find_child(), which returns the
584+ * first port altmode with a matching SVID. If the partner advertises
585+ * more altmodes for SVID X than the port advertises, the surplus
586+ * partner altmode(s) collapse onto an already-paired port altmode and
587+ * trigger a "duplicate filename .../partner" sysfs error during
588+ * typec_altmode_create_links(). Use the port-side altmode count for
589+ * SVID X as the authoritative cap and reject any partner altmode that
590+ * would exceed it. This preserves legitimate multi-Mode partner
591+ * altmodes (e.g. vendor SVIDs that the port really does advertise
592+ * twice) while filtering the firmware-generated duplicates that have
593+ * no port counterpart.
594+ */
595+static bool ucsi_altmode_is_duplicate(struct ucsi_connector *con, u8 recipient,
596+ const struct ucsi_altmode *alt_batch, int batch_idx,
597+ u16 svid, u32 vdo, int offset)
598+{
599+ struct typec_altmode **altmodes;
600+ int port_count, partner_count;
601+ int k;
602+
603+ /* Check for duplicates within the current batch first */
604+ for (k = 0; k < batch_idx; k++) {
605+ if (alt_batch[k].svid == svid && alt_batch[k].mid == vdo) {
606+ ucsi_dump_duplicate_altmode(con, recipient, svid,
607+ vdo, vdo, offset);
608+ return true;
609+ }
610+ }
611+
612+ switch (recipient) {
613+ case UCSI_RECIPIENT_SOP:
614+ /*
615+ * Cap partner altmodes per SVID by the port-side count:
616+ * any further partner altmode for that SVID would alias an
617+ * already-paired port altmode and break typec sysfs.
618+ */
619+ port_count = ucsi_altmode_count_svid(con->port_altmode, svid);
620+ partner_count = ucsi_altmode_count_svid(con->partner_altmode,
621+ svid);
622+ if (port_count && partner_count >= port_count) {
623+ ucsi_dump_duplicate_altmode(con, recipient, svid,
624+ con->partner_altmode[partner_count - 1]->vdo,
625+ vdo, offset);
626+ return true;
627+ }
628+ return false;
629+ case UCSI_RECIPIENT_CON:
630+ altmodes = con->port_altmode;
631+ break;
632+ case UCSI_RECIPIENT_SOP_P:
633+ altmodes = con->plug_altmode;
634+ break;
635+ default:
636+ return false;
637+ }
638+
639+ /* CON and SOP_P: drop only exact SVID+VDO duplicates. */
640+ for (k = 0; k < UCSI_MAX_ALTMODES; k++) {
641+ if (!altmodes[k])
642+ break;
643+
644+ if (altmodes[k]->svid != svid || altmodes[k]->vdo != vdo)
645+ continue;
646+
647+ ucsi_dump_duplicate_altmode(con, recipient, svid,
648+ altmodes[k]->vdo, vdo, offset);
649+ return true;
650+ }
651+
652+ return false;
653+}
654+
532655 static int
533656 ucsi_register_altmodes_nvidia(struct ucsi_connector *con, u8 recipient)
534657 {
@@ -583,19 +706,25 @@ ucsi_register_altmodes_nvidia(struct ucsi_connector *con, u8 recipient) · 48 unmodified lines
583706
584707 /* now register altmodes */
585708 for (i = 0; i < max_altmodes; i++) {
586− memset(&desc, 0, sizeof(desc));
587− if (multi_dp) {
588− desc.svid = updated[i].svid;
589− desc.vdo = updated[i].mid;
590− } else {
591− desc.svid = orig[i].svid;
592− desc.vdo = orig[i].mid;
593− }
594− desc.roles = TYPEC_PORT_DRD;
709+ struct ucsi_altmode *altmode_array = multi_dp ? updated : orig;
595710
596− if (!desc.svid)
711+ if (!altmode_array[i].svid)
597712 return 0;
598713
714+ /*
715+ * Check for duplicates in current array and already
716+ * registered altmodes. Skip if duplicate found.
717+ */
718+ if (ucsi_altmode_is_duplicate(con, recipient, altmode_array, i,
719+ altmode_array[i].svid,
720+ altmode_array[i].mid, i))
721+ continue;
722+
723+ memset(&desc, 0, sizeof(desc));
724+ desc.svid = altmode_array[i].svid;
725+ desc.vdo = altmode_array[i].mid;
726+ desc.roles = TYPEC_PORT_DRD;
727+
599728 ret = ucsi_register_altmode(con, &desc, recipient);
600729 if (ret)
601730 return ret;
@@ -653,6 +782,15 @@ static int ucsi_register_altmodes(struct ucsi_connector *con, u8 recipient) · 51 unmodified lines
653782 if (!alt[j].svid)
654783 return 0;
655784
785+ /*
786+ * Check for duplicates in current batch and already
787+ * registered altmodes. Skip if duplicate found.
788+ */
789+ if (ucsi_altmode_is_duplicate(con, recipient, alt, j,
790+ alt[j].svid, alt[j].mid,
791+ i - num + j))
792+ continue;
793+
656794 memset(&desc, 0, sizeof(desc));
657795 desc.vdo = alt[j].mid;
658796 desc.svid = alt[j].svid;
@@ -1845,6 +1983,42 @@ out_unlock: · 1186 unmodified lines
18451983 return ret;
18461984 }
18471985
1986+static void ucsi_unregister_port(struct ucsi_connector *con)
1987+{
1988+ struct ucsi_work *uwork;
1989+
1990+ if (con->wq) {
1991+ mutex_lock(&con->lock);
1992+ ucsi_unregister_partner(con);
1993+ /*
1994+ * queue delayed items immediately so they can execute
1995+ * and free themselves before the wq is destroyed
1996+ */
1997+ list_for_each_entry(uwork, &con->partner_tasks, node) {
1998+ if (cancel_delayed_work(&uwork->work))
1999+ queue_delayed_work(con->wq, &uwork->work, 0);
2000+ }
2001+ mutex_unlock(&con->lock);
2002+
2003+ destroy_workqueue(con->wq);
2004+ con->wq = NULL;
2005+ } else {
2006+ ucsi_unregister_partner(con);
2007+ }
2008+
2009+ ucsi_unregister_altmodes(con, UCSI_RECIPIENT_CON);
2010+ ucsi_unregister_port_psy(con);
2011+
2012+ usb_power_delivery_unregister_capabilities(con->port_sink_caps);
2013+ con->port_sink_caps = NULL;
2014+ usb_power_delivery_unregister_capabilities(con->port_source_caps);
2015+ con->port_source_caps = NULL;
2016+ usb_power_delivery_unregister(con->pd);
2017+ con->pd = NULL;
2018+ typec_unregister_port(con->port);
2019+ con->port = NULL;
2020+}
2021+
18482022 static u64 ucsi_get_supported_notifications(struct ucsi *ucsi)
18492023 {
18502024 u16 features = ucsi->cap.features;
@@ -1968,25 +2142,11 @@ static int ucsi_init(struct ucsi *ucsi) · 117 unmodified lines
19682142 return 0;
19692143
19702144 err_unregister:
2145+ for (con = connector; con->port; con++)
2146+ ucsi_unregister_port(con);
19712147 for (i = 0; i < ucsi->cap.num_connectors; i++)
19722148 lockdep_unregister_key(&connector[i].lock_key);
19732149
1974− for (con = connector; con->port; con++) {
1975− if (con->wq)
1976− destroy_workqueue(con->wq);
1977− ucsi_unregister_partner(con);
1978− ucsi_unregister_altmodes(con, UCSI_RECIPIENT_CON);
1979− ucsi_unregister_port_psy(con);
1980−
1981− usb_power_delivery_unregister_capabilities(con->port_sink_caps);
1982− con->port_sink_caps = NULL;
1983− usb_power_delivery_unregister_capabilities(con->port_source_caps);
1984− con->port_source_caps = NULL;
1985− usb_power_delivery_unregister(con->pd);
1986− con->pd = NULL;
1987− typec_unregister_port(con->port);
1988− con->port = NULL;
1989− }
19902150 kfree(connector);
19912151 err_reset:
19922152 memset(&ucsi->cap, 0, sizeof(ucsi->cap));
@@ -2214,33 +2374,7 @@ void ucsi_unregister(struct ucsi *ucsi) · 221 unmodified lines
22142374
22152375 for (i = 0; i < ucsi->cap.num_connectors; i++) {
22162376 cancel_work_sync(&ucsi->connector[i].work);
2217−
2218− if (ucsi->connector[i].wq) {
2219− struct ucsi_work *uwork;
2220−
2221− mutex_lock(&ucsi->connector[i].lock);
2222− /*
2223− * queue delayed items immediately so they can execute
2224− * and free themselves before the wq is destroyed
2225− */
2226− list_for_each_entry(uwork, &ucsi->connector[i].partner_tasks, node)
2227− mod_delayed_work(ucsi->connector[i].wq, &uwork->work, 0);
2228− mutex_unlock(&ucsi->connector[i].lock);
2229− destroy_workqueue(ucsi->connector[i].wq);
2230− }
2231−
2232− ucsi_unregister_partner(&ucsi->connector[i]);
2233− ucsi_unregister_altmodes(&ucsi->connector[i],
2234− UCSI_RECIPIENT_CON);
2235− ucsi_unregister_port_psy(&ucsi->connector[i]);
2236−
2237− usb_power_delivery_unregister_capabilities(ucsi->connector[i].port_sink_caps);
2238− ucsi->connector[i].port_sink_caps = NULL;
2239− usb_power_delivery_unregister_capabilities(ucsi->connector[i].port_source_caps);
2240− ucsi->connector[i].port_source_caps = NULL;
2241− usb_power_delivery_unregister(ucsi->connector[i].pd);
2242− ucsi->connector[i].pd = NULL;
2243− typec_unregister_port(ucsi->connector[i].port);
2377+ ucsi_unregister_port(&ucsi->connector[i]);
22442378 lockdep_unregister_key(&ucsi->connector[i].lock_key);
22452379 }
22462380
drivers/usb/typec/ucsi/ucsi_yoga_c630.c+0−23
@@ -139,28 +139,6 @@ static int yoga_c630_ucsi_sync_control(struct ucsi *ucsi, · 138 unmodified lines
139139 return ret;
140140 }
141141
142−static bool yoga_c630_ucsi_update_altmodes(struct ucsi *ucsi,
143− u8 recipient,
144− struct ucsi_altmode *orig,
145− struct ucsi_altmode *updated)
146−{
147− int i;
148−
149− if (orig[0].svid == 0 || recipient != UCSI_RECIPIENT_SOP)
150− return false;
151−
152− /* EC is nice and repeats altmodes again and again. Ignore copies. */
153− for (i = 1; i < UCSI_MAX_ALTMODES; i++) {
154− if (orig[i].svid == orig[0].svid) {
155− dev_dbg(ucsi->dev, "Found duplicate altmodes, starting from %d\n", i);
156− memset(&orig[i], 0, (UCSI_MAX_ALTMODES - i) * sizeof(*orig));
157− break;
158− }
159− }
160−
161− return false;
162−}
163−
164142 static void yoga_c630_ucsi_update_connector(struct ucsi_connector *con)
165143 {
166144 if (con->num == 1)
@@ -174,7 +152,6 @@ static const struct ucsi_operations yoga_c630_ucsi_ops = { · 7 unmodified lines
174152 .read_message_in = yoga_c630_ucsi_read_message_in,
175153 .sync_control = yoga_c630_ucsi_sync_control,
176154 .async_control = yoga_c630_ucsi_async_control,
177− .update_altmodes = yoga_c630_ucsi_update_altmodes,
178155 .update_connector = yoga_c630_ucsi_update_connector,
179156 };
180157
drivers/vhost/net.c+5−3
@@ -731,10 +731,12 @@ static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq, · 730 unmodified lines
731731 goto err;
732732 }
733733
734− gso = buf + pad - sock_hlen;
735−
736− if (!sock_hlen)
734+ if (!sock_hlen) {
737735 memset(buf, 0, pad);
736+ gso = buf;
737+ } else {
738+ gso = buf + pad - sock_hlen;
739+ }
738740
739741 if ((gso->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) &&
740742 vhost16_to_cpu(vq, gso->csum_start) +
drivers/virt/coco/pkvm-guest/arm-pkvm-guest.c+1−1
@@ -82,8 +82,8 @@ static int mmio_guard_ioremap_hook(phys_addr_t phys, size_t size, · 81 unmodified lines
8282 if (protval != PROT_DEVICE_nGnRE && protval != PROT_DEVICE_nGnRnE)
8383 return 0;
8484
85+ end = PAGE_ALIGN(phys + size);
8586 phys = PAGE_ALIGN_DOWN(phys);
86− end = phys + PAGE_ALIGN(size);
8787
8888 while (phys < end) {
8989 const int func_id = ARM_SMCCC_VENDOR_HYP_KVM_MMIO_GUARD_FUNC_ID;
drivers/virtio/virtio_balloon.c+1−4
@@ -1017,10 +1017,6 @@ static int virtballoon_probe(struct virtio_device *vdev) · 1016 unmodified lines
10171017 unsigned int capacity;
10181018
10191019 capacity = virtqueue_get_vring_size(vb->reporting_vq);
1020− if (capacity < PAGE_REPORTING_CAPACITY) {
1021− err = -ENOSPC;
1022− goto out_unregister_oom;
1023− }
10241020
10251021 vb->pr_dev_info.order = PAGE_REPORTING_ORDER_UNSPECIFIED;
10261022
@@ -1041,6 +1037,7 @@ static int virtballoon_probe(struct virtio_device *vdev) · 14 unmodified lines
10411037 vb->pr_dev_info.order = 5;
10421038 #endif
10431039
1040+ vb->pr_dev_info.capacity = capacity;
10441041 err = page_reporting_register(&vb->pr_dev_info);
10451042 if (err)
10461043 goto out_unregister_oom;
drivers/watchdog/airoha_wdt.c+3−0
@@ -147,6 +147,9 @@ static int airoha_wdt_probe(struct platform_device *pdev) · 146 unmodified lines
147147
148148 /* Watchdog ticks at half the bus rate */
149149 airoha_wdt->wdt_freq = clk_get_rate(bus_clk) / 2;
150+ if (!airoha_wdt->wdt_freq)
151+ return dev_err_probe(dev, -EINVAL,
152+ "invalid clock frequency\n");
150153
151154 /* Initialize struct watchdog device */
152155 wdog_dev = &airoha_wdt->wdog_dev;
drivers/watchdog/ni903x_wdt.c+6−1
@@ -183,9 +183,14 @@ static int ni903x_acpi_probe(struct platform_device *pdev) · 182 unmodified lines
183183 struct device *dev = &pdev->dev;
184184 struct watchdog_device *wdd;
185185 struct ni903x_wdt *wdt;
186+ acpi_handle handle;
186187 acpi_status status;
187188 int ret;
188189
190+ handle = ACPI_HANDLE(dev);
191+ if (!handle)
192+ return -ENODEV;
193+
189194 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
190195 if (!wdt)
191196 return -ENOMEM;
@@ -193,7 +198,7 @@ static int ni903x_acpi_probe(struct platform_device *pdev) · 1 unmodified line
193198 platform_set_drvdata(pdev, wdt);
194199 wdt->dev = dev;
195200
196− status = acpi_walk_resources(ACPI_HANDLE(dev), METHOD_NAME__CRS,
201+ status = acpi_walk_resources(handle, METHOD_NAME__CRS,
197202 ni903x_resources, wdt);
198203 if (ACPI_FAILURE(status) || wdt->io_base == 0) {
199204 dev_err(dev, "failed to get resources\n");
drivers/watchdog/s32g_wdt.c+1−2
@@ -56,8 +56,7 @@ MODULE_PARM_DESC(early_enable, · 55 unmodified lines
5656
5757 static const struct watchdog_info s32g_wdt_info = {
5858 .identity = "s32g watchdog",
59− .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE |
60− WDIOC_GETTIMEOUT | WDIOC_GETTIMELEFT,
59+ .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
6160 };
6261
6362 static struct s32g_wdt_device *wdd_to_s32g_wdt(struct watchdog_device *wdd)
drivers/watchdog/watchdog_pretimeout.c+2−0
@@ -167,6 +167,8 @@ void watchdog_unregister_governor(struct watchdog_governor *gov) · 166 unmodified lines
167167 }
168168
169169 spin_lock_irq(&pretimeout_lock);
170+ if (default_gov == gov)
171+ default_gov = NULL;
170172 list_for_each_entry(p, &pretimeout_list, entry)
171173 if (p->wdd->gov == gov)
172174 p->wdd->gov = default_gov;
fs/afs/dir_edit.c+1−1
@@ -415,7 +415,7 @@ void afs_edit_dir_remove(struct afs_vnode *vnode, · 414 unmodified lines
415415 if (!afs_dir_init_iter(&iter, name))
416416 return;
417417
418− meta = afs_dir_find_block(&iter, 0);
418+ meta = afs_dir_get_block(&iter, 0);
419419 if (!meta)
420420 return;
421421
fs/binfmt_elf_fdpic.c+4−0
@@ -231,6 +231,10 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm) · 230 unmodified lines
231231 for (i = 0; i < exec_params.hdr.e_phnum; i++, phdr++) {
232232 switch (phdr->p_type) {
233233 case PT_INTERP:
234+ /* elf ABI allows only one interpreter */
235+ if (interpreter_name)
236+ continue;
237+
234238 retval = -ENOMEM;
235239 if (phdr->p_filesz > PATH_MAX)
236240 goto error;
fs/binfmt_misc.c+2−3
@@ -228,9 +228,6 @@ static int load_misc_binary(struct linux_binprm *bprm) · 227 unmodified lines
228228 goto ret;
229229 }
230230
231− if (fmt->flags & MISC_FMT_OPEN_BINARY)
232− bprm->have_execfd = 1;
233−
234231 /* make argv[1] be the path to the binary */
235232 retval = copy_string_kernel(bprm->interp, bprm);
236233 if (retval < 0)
@@ -260,6 +257,8 @@ static int load_misc_binary(struct linux_binprm *bprm) · 23 unmodified lines
260257 goto ret;
261258
262259 bprm->interpreter = interp_file;
260+ if (fmt->flags & MISC_FMT_OPEN_BINARY)
261+ bprm->have_execfd = 1;
263262 if (fmt->flags & MISC_FMT_CREDENTIALS)
264263 bprm->execfd_creds = 1;
265264
fs/btrfs/backref.c+4−1
@@ -3054,7 +3054,10 @@ void btrfs_backref_free_node(struct btrfs_backref_cache *cache, · 3053 unmodified lines
30543054 if (node) {
30553055 ASSERT(list_empty(&node->list));
30563056 ASSERT(list_empty(&node->lower));
3057− ASSERT(node->eb == NULL, "node->eb->start=%llu", node->eb->start);
3057+ ASSERT(node->eb == NULL, "node->eb->start=%llu level=%d owner=%llu",
3058+ node->eb ? node->eb->start : 0,
3059+ node->eb ? btrfs_header_level(node->eb) : 0,
3060+ node->eb ? btrfs_header_owner(node->eb) : 0);
30583061 cache->nr_nodes--;
30593062 btrfs_put_root(node->root);
30603063 kfree(node);
fs/btrfs/btrfs_inode.h+2−0
@@ -476,6 +476,8 @@ static inline bool btrfs_inode_can_compress(const struct btrfs_inode *inode) · 475 unmodified lines
476476 if (inode->flags & BTRFS_INODE_NODATACOW ||
477477 inode->flags & BTRFS_INODE_NODATASUM)
478478 return false;
479+ if (btrfs_is_data_reloc_root(inode->root))
480+ return false;
479481 return true;
480482 }
481483
fs/btrfs/extent_io.c+2−2
@@ -2004,7 +2004,7 @@ static noinline_for_stack bool lock_extent_buffer_for_io(struct extent_buffer *e · 2003 unmodified lines
20042004
20052005 btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
20062006 percpu_counter_add_batch(&fs_info->dirty_metadata_bytes,
2007− -eb->len,
2007+ -(s64)eb->len,
20082008 fs_info->dirty_metadata_batch);
20092009 ret = true;
20102010 } else {
@@ -3774,7 +3774,7 @@ void btrfs_clear_buffer_dirty(struct btrfs_trans_handle *trans, · 1763 unmodified lines
37743774 return;
37753775
37763776 buffer_tree_clear_mark(eb, PAGECACHE_TAG_DIRTY);
3777− percpu_counter_add_batch(&fs_info->dirty_metadata_bytes, -eb->len,
3777+ percpu_counter_add_batch(&fs_info->dirty_metadata_bytes, -(s64)eb->len,
37783778 fs_info->dirty_metadata_batch);
37793779
37803780 for (int i = 0; i < num_extent_folios(eb); i++) {
fs/btrfs/extent_map.c+2−2
@@ -866,13 +866,13 @@ void btrfs_drop_extent_map_range(struct btrfs_inode *inode, u64 start, u64 end, · 865 unmodified lines
866866 goto next;
867867 }
868868
869− flags = em->flags;
870869 /*
871870 * In case we split the extent map, we want to preserve the
872871 * EXTENT_FLAG_LOGGING flag on our extent map, but we don't want
873872 * it on the new extent maps.
874873 */
875− em->flags &= ~(EXTENT_FLAG_PINNED | EXTENT_FLAG_LOGGING);
874+ flags = em->flags & ~EXTENT_FLAG_LOGGING;
875+ em->flags &= ~EXTENT_FLAG_PINNED;
876876 modified = !list_empty(&em->list);
877877
878878 /*
fs/btrfs/inode.c+2−1
@@ -8068,7 +8068,8 @@ static int btrfs_getattr(struct mnt_idmap *idmap, · 8067 unmodified lines
80688068 stat->result_mask |= STATX_SUBVOL;
80698069
80708070 spin_lock(&BTRFS_I(inode)->lock);
8071− delalloc_bytes = BTRFS_I(inode)->new_delalloc_bytes;
8071+ delalloc_bytes = S_ISREG(inode->i_mode) ?
8072+ BTRFS_I(inode)->new_delalloc_bytes : 0;
80728073 inode_bytes = inode_get_bytes(inode);
80738074 spin_unlock(&BTRFS_I(inode)->lock);
80748075 stat->blocks = (ALIGN(inode_bytes, blocksize) +
fs/btrfs/ioctl.c+1−0
@@ -2048,6 +2048,7 @@ static int _btrfs_ioctl_get_subvol_info(struct inode *inode, · 2047 unmodified lines
20482048 ret = -ENOENT;
20492049 goto out;
20502050 }
2051+ ret = 0;
20512052 }
20522053
20532054 out:
fs/btrfs/relocation.c+43−12
@@ -588,6 +588,7 @@ static int __add_reloc_root(struct btrfs_root *root, struct reloc_control *rc) · 587 unmodified lines
588588 btrfs_err(fs_info,
589589 "Duplicate root found for start=%llu while inserting into relocation tree",
590590 node->bytenr);
591+ kfree(node);
591592 return -EEXIST;
592593 }
593594
@@ -890,6 +891,13 @@ static int get_new_location(struct inode *reloc_inode, u64 *new_bytenr, · 296 unmodified lines
890891 leaf = path->nodes[0];
891892 fi = btrfs_item_ptr(leaf, path->slots[0],
892893 struct btrfs_file_extent_item);
894+ if (unlikely(btrfs_file_extent_type(leaf, fi) == BTRFS_FILE_EXTENT_INLINE)) {
895+ btrfs_print_leaf(leaf);
896+ btrfs_err(fs_info,
897+ "unexpected inline file extent item for data reloc inode %llu key offset %llu",
898+ btrfs_ino(BTRFS_I(reloc_inode)), bytenr);
899+ return -EUCLEAN;
900+ }
893901
894902 /*
895903 * The cluster-boundary key searched above is always written by
@@ -1518,6 +1526,17 @@ static int insert_dirty_subvol(struct btrfs_trans_handle *trans, · 622 unmodified lines
15181526 return 0;
15191527 }
15201528
1529+static void clear_reloc_root(struct btrfs_root *root)
1530+{
1531+ root->reloc_root = NULL;
1532+ /*
1533+ * Need barrier to ensure clear_bit() only happens after
1534+ * root->reloc_root = NULL. Pairs with have_reloc_root().
1535+ */
1536+ smp_wmb();
1537+ clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state);
1538+}
1539+
15211540 static int clean_dirty_subvols(struct reloc_control *rc)
15221541 {
15231542 struct btrfs_root *root;
@@ -1532,13 +1551,7 @@ static int clean_dirty_subvols(struct reloc_control *rc) · 8 unmodified lines
15321551 struct btrfs_root *reloc_root = root->reloc_root;
15331552
15341553 list_del_init(&root->reloc_dirty_list);
1535− root->reloc_root = NULL;
1536− /*
1537− * Need barrier to ensure clear_bit() only happens after
1538− * root->reloc_root = NULL. Pairs with have_reloc_root.
1539− */
1540− smp_wmb();
1541− clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state);
1554+ clear_reloc_root(root);
15421555 if (reloc_root) {
15431556 /*
15441557 * btrfs_drop_snapshot drops our ref we hold for
@@ -1914,21 +1927,39 @@ again: · 369 unmodified lines
19141927 goto out;
19151928 }
19161929 ret = merge_reloc_root(rc, root);
1917− btrfs_put_root(root);
19181930 if (ret) {
1919− if (list_empty(&reloc_root->root_list))
1931+ /*
1932+ * Clear the reloc root since below we will call
1933+ * free_reloc_roots(), otherwise we leave
1934+ * root->reloc_root pointing to a freed reloc
1935+ * root and trigger a use-after-free during
1936+ * unmount or elsewhere.
1937+ */
1938+ clear_reloc_root(root);
1939+ btrfs_put_root(root);
1940+ /*
1941+ * We are adding the reloc_root to the local
1942+ * reloc_roots list, so we add a ref for this
1943+ * list which will be dropped below by the call
1944+ * to free_reloc_roots().
1945+ */
1946+ if (list_empty(&reloc_root->root_list)) {
19201947 list_add_tail(&reloc_root->root_list,
19211948 &reloc_roots);
1949+ btrfs_grab_root(reloc_root);
1950+ }
1951+ /* Now drop the ref for root->reloc_root. */
1952+ btrfs_put_root(reloc_root);
19221953 goto out;
19231954 }
1955+ btrfs_put_root(root);
19241956 } else {
19251957 if (!IS_ERR(root)) {
19261958 if (root->reloc_root == reloc_root) {
1927− root->reloc_root = NULL;
1959+ clear_reloc_root(root);
1960+ /* Drop the ref for root->reloc_root. */
19281961 btrfs_put_root(reloc_root);
19291962 }
1930− clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE,
1931− &root->state);
19321963 btrfs_put_root(root);
19331964 }
19341965
fs/btrfs/subpage.c+23−3
@@ -359,6 +359,23 @@ void btrfs_subpage_set_dirty(const struct btrfs_fs_info *fs_info, · 358 unmodified lines
359359 folio_mark_dirty(folio);
360360 }
361361
362+static void folio_clear_tags(struct folio *folio)
363+{
364+ struct address_space *mapping = folio_mapping(folio);
365+ XA_STATE(xas, &mapping->i_pages, folio->index);
366+ unsigned long flags;
367+
368+ ASSERT(folio_test_locked(folio));
369+ ASSERT(mapping);
370+ ASSERT(mapping_use_writeback_tags(mapping));
371+
372+ xas_lock_irqsave(&xas, flags);
373+ xas_load(&xas);
374+ xas_clear_mark(&xas, PAGECACHE_TAG_DIRTY);
375+ xas_clear_mark(&xas, PAGECACHE_TAG_TOWRITE);
376+ xas_unlock_irqrestore(&xas, flags);
377+}
378+
362379 /*
363380 * Extra clear_and_test function for subpage dirty bitmap.
364381 *
@@ -403,7 +420,6 @@ void btrfs_subpage_set_writeback(const struct btrfs_fs_info *fs_info, · 38 unmodified lines
403420 unsigned int start_bit = subpage_calc_start_bit(fs_info, folio,
404421 writeback, start, len);
405422 unsigned long flags;
406− bool keep_write;
407423
408424 spin_lock_irqsave(&bfs->lock, flags);
409425 bitmap_set(bfs->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
@@ -413,10 +429,14 @@ void btrfs_subpage_set_writeback(const struct btrfs_fs_info *fs_info, · 3 unmodified lines
413429 * folio. Doing so can cause WB_SYNC_ALL writepages() to overlook it,
414430 * assume writeback is complete, and exit too early — violating sync
415431 * ordering guarantees.
432+ *
433+ * Instead we manually clear the DIRTY and TOWRITE tags after the folio
434+ * is no longer dirty.
416435 */
417− keep_write = folio_test_dirty(folio);
418436 if (!folio_test_writeback(folio))
419− __folio_start_writeback(folio, keep_write);
437+ __folio_start_writeback(folio, true);
438+ if (!folio_test_dirty(folio))
439+ folio_clear_tags(folio);
420440 spin_unlock_irqrestore(&bfs->lock, flags);
421441 }
422442
fs/btrfs/super.c+10−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <linux/namei.h>
2323 #include <linux/miscdevice.h>
2424 #include <linux/magic.h>
25+#include <linux/memcontrol.h>
2526 #include <linux/slab.h>
2627 #include <linux/ratelimit.h>
2728 #include <linux/crc32c.h>
@@ -2434,6 +2435,15 @@ static long btrfs_nr_cached_objects(struct super_block *sb, struct shrink_contro · 2406 unmodified lines
24342435 struct btrfs_fs_info *fs_info = btrfs_sb(sb);
24352436 const s64 nr = percpu_counter_read_positive(&fs_info->evictable_extent_maps);
24362437
2438+ /*
2439+ * The evictable extent map counter is filesystem-global and does not
2440+ * honour sc->memcg, so it is only meaningful on the global (kswapd or
2441+ * root direct reclaim) shrink path. Skip the per-memcg iterations of
2442+ * shrink_slab_memcg() to avoid queueing duplicate global work.
2443+ */
2444+ if (!mem_cgroup_shrink_is_root(sc))
2445+ return 0;
2446+
24372447 trace_btrfs_extent_map_shrinker_count(fs_info, nr);
24382448
24392449 return nr;
fs/ceph/addr.c+9−0
@@ -790,6 +790,9 @@ static int write_folio_nounlock(struct folio *folio, · 789 unmodified lines
790790 ceph_wbc.truncate_size, true);
791791 if (IS_ERR(req)) {
792792 folio_redirty_for_writepage(wbc, folio);
793+ if (atomic_long_dec_return(&fsc->writeback_count) <
794+ CONGESTION_OFF_THRESH(fsc->mount_options->congestion_kb))
795+ fsc->write_congested = false;
793796 return PTR_ERR(req);
794797 }
795798
@@ -809,6 +812,9 @@ static int write_folio_nounlock(struct folio *folio, · 13 unmodified lines
809812 folio_redirty_for_writepage(wbc, folio);
810813 folio_end_writeback(folio);
811814 ceph_osdc_put_request(req);
815+ if (atomic_long_dec_return(&fsc->writeback_count) <
816+ CONGESTION_OFF_THRESH(fsc->mount_options->congestion_kb))
817+ fsc->write_congested = false;
812818 return PTR_ERR(bounce_page);
813819 }
814820 }
@@ -847,6 +853,9 @@ static int write_folio_nounlock(struct folio *folio, · 32 unmodified lines
847853 ceph_vinop(inode), folio);
848854 folio_redirty_for_writepage(wbc, folio);
849855 folio_end_writeback(folio);
856+ if (atomic_long_dec_return(&fsc->writeback_count) <
857+ CONGESTION_OFF_THRESH(fsc->mount_options->congestion_kb))
858+ fsc->write_congested = false;
850859 return err;
851860 }
852861 if (err == -EBLOCKLISTED)
fs/ceph/caps.c+16−2
@@ -3094,7 +3094,19 @@ int __ceph_get_caps(struct inode *inode, struct ceph_file_info *fi, int need, · 3093 unmodified lines
30943094 ret = -ERESTARTSYS;
30953095 break;
30963096 }
3097− wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
3097+
3098+ /*
3099+ * If a cap update is lost after
3100+ * mds_wanted was raised, waiting
3101+ * forever will never make progress.
3102+ * Retry the renew path periodically
3103+ * so we can resend synchronously.
3104+ */
3105+ if (!wait_woken(&wait, TASK_INTERRUPTIBLE,
3106+ CEPH_GET_CAPS_WAIT_TIMEOUT)) {
3107+ ret = -EUCLEAN;
3108+ break;
3109+ }
30983110 }
30993111
31003112 remove_wait_queue(&ci->i_cap_wq, &wait);
@@ -3128,7 +3140,8 @@ int __ceph_get_caps(struct inode *inode, struct ceph_file_info *fi, int need, · 27 unmodified lines
31283140 continue;
31293141 }
31303142 if (ret == -EUCLEAN) {
3131− /* session was killed, try renew caps */
3143+ /* session was killed or a waited cap
3144+ * request needs a retry */
31323145 ret = ceph_renew_caps(inode, flags);
31333146 if (ret == 0)
31343147 continue;
@@ -4375,6 +4388,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, · 1240 unmodified lines
43754388
43764389 snaptrace = h + 1;
43774390 snaptrace_len = le32_to_cpu(h->snap_trace_len);
4391+ ceph_decode_need(&snaptrace, end, snaptrace_len, bad);
43784392 p = snaptrace + snaptrace_len;
43794393
43804394 if (msg_version >= 2) {
fs/ceph/dir.c+6−1
@@ -546,11 +546,16 @@ more: · 545 unmodified lines
546546 pr_warn_client(cl,
547547 "%p %llx.%llx rde->offset 0x%llx ctx->pos 0x%llx\n",
548548 inode, ceph_vinop(inode), rde->offset, ctx->pos);
549+ ceph_mdsc_put_request(dfi->last_readdir);
550+ dfi->last_readdir = NULL;
549551 return -EIO;
550552 }
551553
552− if (WARN_ON_ONCE(!rde->inode.in))
554+ if (WARN_ON_ONCE(!rde->inode.in)) {
555+ ceph_mdsc_put_request(dfi->last_readdir);
556+ dfi->last_readdir = NULL;
553557 return -EIO;
558+ }
554559
555560 ctx->pos = rde->offset;
556561 doutc(cl, "%p %llx.%llx (%d/%d) -> %llx '%.*s' %p\n", inode,
fs/ceph/file.c+5−4
@@ -314,7 +314,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode) · 313 unmodified lines
314314 }
315315
316316 /*
317− * try renew caps after session gets killed.
317+ * Retry cap acquisition after a stale session or a lost cap update.
318318 */
319319 int ceph_renew_caps(struct inode *inode, int fmode)
320320 {
@@ -322,14 +322,15 @@ int ceph_renew_caps(struct inode *inode, int fmode) · 1 unmodified line
322322 struct ceph_client *cl = mdsc->fsc->client;
323323 struct ceph_inode_info *ci = ceph_inode(inode);
324324 struct ceph_mds_request *req;
325− int err, flags, wanted;
325+ int err, flags, wanted, issued;
326326
327327 spin_lock(&ci->i_ceph_lock);
328328 __ceph_touch_fmode(ci, mdsc, fmode);
329329 wanted = __ceph_caps_file_wanted(ci);
330+ issued = __ceph_caps_issued(ci, NULL);
330331 if (__ceph_is_any_real_caps(ci) &&
331− (!(wanted & CEPH_CAP_ANY_WR) || ci->i_auth_cap)) {
332− int issued = __ceph_caps_issued(ci, NULL);
332+ (!(wanted & CEPH_CAP_ANY_WR) || ci->i_auth_cap) &&
333+ (issued & wanted) == wanted) {
333334 spin_unlock(&ci->i_ceph_lock);
334335 doutc(cl, "%p %llx.%llx want %s issued %s updating mds_wanted\n",
335336 inode, ceph_vinop(inode), ceph_cap_string(wanted),
fs/ceph/ioctl.c+6−0
@@ -72,6 +72,9 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg) · 71 unmodified lines
7272 struct ceph_ioctl_layout nl;
7373 int err;
7474
75+ if (!inode_owner_or_capable(&nop_mnt_idmap, inode))
76+ return -EACCES;
77+
7578 if (copy_from_user(&l, arg, sizeof(l)))
7679 return -EFAULT;
7780
@@ -142,6 +145,9 @@ static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg) · 64 unmodified lines
142145 int err;
143146 struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
144147
148+ if (!inode_owner_or_capable(&nop_mnt_idmap, inode))
149+ return -EACCES;
150+
145151 /* copy and validate */
146152 if (copy_from_user(&l, arg, sizeof(l)))
147153 return -EFAULT;
fs/ceph/mds_client.c+11−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #include <linux/slab.h>
77 #include <linux/gfp.h>
88 #include <linux/sched.h>
9+#include <linux/sched/mm.h>
910 #include <linux/delay.h>
1011 #include <linux/debugfs.h>
1112 #include <linux/seq_file.h>
@@ -4015,6 +4016,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg) · 4003 unmodified lines
40154016 struct ceph_mds_reply_head *head = msg->front.iov_base;
40164017 struct ceph_mds_reply_info_parsed *rinfo; /* parsed reply info */
40174018 struct ceph_snap_realm *realm;
4019+ unsigned int nofs_flags;
40184020 u64 tid;
40194021 int err, result;
40204022 int mds = session->s_mds;
@@ -4158,6 +4160,14 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg) · 137 unmodified lines
41584160
41594161 /* insert trace into our cache */
41604162 mutex_lock(&req->r_fill_mutex);
4163+
4164+ /* disable fs reclaim while we are using current->journal_info
4165+ * for our own purposes, or else shrinkers of other
4166+ * filesystems might dereference this pointer as a different
4167+ * type
4168+ */
4169+ nofs_flags = memalloc_nofs_save();
4170+
41614171 current->journal_info = req;
41624172 err = ceph_fill_trace(mdsc->fsc->sb, req);
41634173 if (err == 0) {
@@ -4166,6 +4176,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg) · 2 unmodified lines
41664176 err = ceph_readdir_prepopulate(req, req->r_session);
41674177 }
41684178 current->journal_info = NULL;
4179+ memalloc_nofs_restore(nofs_flags);
41694180 mutex_unlock(&req->r_fill_mutex);
41704181
41714182 up_read(&mdsc->snap_rwsem);
fs/ceph/mds_client.h+1−0
@@ -77,6 +77,7 @@ struct ceph_fs_client; · 76 unmodified lines
7777 struct ceph_cap;
7878
7979 #define MDS_AUTH_UID_ANY -1
80+#define CEPH_GET_CAPS_WAIT_TIMEOUT (5 * HZ)
8081 #define CEPH_CAP_FLUSH_WAIT_TIMEOUT_SEC 60
8182 #define CEPH_CAP_FLUSH_MAX_DUMP_ENTRIES 5
8283 #define CEPH_CAP_FLUSH_MAX_DUMP_ITERS 5
fs/crypto/inline_crypt.c+20−37
@@ -22,22 +22,14 @@ · 21 unmodified lines
2222
2323 #include "fscrypt_private.h"
2424
25−static struct block_device **fscrypt_get_devices(struct super_block *sb,
26− unsigned int *num_devs)
25+static unsigned int
26+fscrypt_get_devices(struct super_block *sb,
27+ struct block_device *devs[FSCRYPT_MAX_DEVICES])
2728 {
28− struct block_device **devs;
29−
30− if (sb->s_cop->get_devices) {
31− devs = sb->s_cop->get_devices(sb, num_devs);
32− if (devs)
33− return devs;
34− }
35− devs = kmalloc_obj(*devs);
36− if (!devs)
37− return ERR_PTR(-ENOMEM);
29+ if (sb->s_cop->get_devices)
30+ return sb->s_cop->get_devices(sb, devs);
3831 devs[0] = sb->s_bdev;
39− *num_devs = 1;
40− return devs;
32+ return 1;
4133 }
4234
4335 static unsigned int fscrypt_get_dun_bytes(const struct fscrypt_inode_info *ci)
@@ -96,7 +88,7 @@ int fscrypt_select_encryption_impl(struct fscrypt_inode_info *ci, · 52 unmodified lines
9688 const struct inode *inode = ci->ci_inode;
9789 struct super_block *sb = inode->i_sb;
9890 struct blk_crypto_config crypto_cfg;
99− struct block_device **devs;
91+ struct block_device *devs[FSCRYPT_MAX_DEVICES];
10092 unsigned int num_devs;
10193 unsigned int i;
10294
@@ -135,20 +127,15 @@ int fscrypt_select_encryption_impl(struct fscrypt_inode_info *ci, · 32 unmodified lines
135127 crypto_cfg.key_type = is_hw_wrapped_key ?
136128 BLK_CRYPTO_KEY_TYPE_HW_WRAPPED : BLK_CRYPTO_KEY_TYPE_RAW;
137129
138− devs = fscrypt_get_devices(sb, &num_devs);
139− if (IS_ERR(devs))
140− return PTR_ERR(devs);
141−
130+ num_devs = fscrypt_get_devices(sb, devs);
142131 for (i = 0; i < num_devs; i++) {
143132 if (!blk_crypto_config_supported(devs[i], &crypto_cfg))
144− goto out_free_devs;
133+ return 0;
145134 }
146135
147136 fscrypt_log_blk_crypto_impl(ci->ci_mode, devs, num_devs, &crypto_cfg);
148137
149138 ci->ci_inlinecrypt = true;
150−out_free_devs:
151− kfree(devs);
152139
153140 return 0;
154141 }
@@ -164,7 +151,7 @@ int fscrypt_prepare_inline_crypt_key(struct fscrypt_prepared_key *prep_key, · 9 unmodified lines
164151 enum blk_crypto_key_type key_type = is_hw_wrapped ?
165152 BLK_CRYPTO_KEY_TYPE_HW_WRAPPED : BLK_CRYPTO_KEY_TYPE_RAW;
166153 struct blk_crypto_key *blk_key;
167− struct block_device **devs;
154+ struct block_device *devs[FSCRYPT_MAX_DEVICES];
168155 unsigned int num_devs;
169156 unsigned int i;
170157 int err;
@@ -182,17 +169,12 @@ int fscrypt_prepare_inline_crypt_key(struct fscrypt_prepared_key *prep_key, · 11 unmodified lines
182169 }
183170
184171 /* Start using blk-crypto on all the filesystem's block devices. */
185− devs = fscrypt_get_devices(sb, &num_devs);
186− if (IS_ERR(devs)) {
187− err = PTR_ERR(devs);
188− goto fail;
189− }
172+ num_devs = fscrypt_get_devices(sb, devs);
190173 for (i = 0; i < num_devs; i++) {
191174 err = blk_crypto_start_using_key(devs[i], blk_key);
192175 if (err)
193176 break;
194177 }
195− kfree(devs);
196178 if (err) {
197179 fscrypt_err(inode, "error %d starting to use blk-crypto", err);
198180 goto fail;
@@ -210,20 +192,21 @@ void fscrypt_destroy_inline_crypt_key(struct super_block *sb, · 11 unmodified lines
210192 struct fscrypt_prepared_key *prep_key)
211193 {
212194 struct blk_crypto_key *blk_key = prep_key->blk_key;
213− struct block_device **devs;
195+ struct block_device *devs[FSCRYPT_MAX_DEVICES];
214196 unsigned int num_devs;
215197 unsigned int i;
216198
217199 if (!blk_key)
218200 return;
219201
220− /* Evict the key from all the filesystem's block devices. */
221− devs = fscrypt_get_devices(sb, &num_devs);
222− if (!IS_ERR(devs)) {
223− for (i = 0; i < num_devs; i++)
224− blk_crypto_evict_key(devs[i], blk_key);
225− kfree(devs);
226− }
202+ /*
203+ * Evict the key from all the filesystem's block devices.
204+ * This *must* be done before the key is freed.
205+ */
206+ num_devs = fscrypt_get_devices(sb, devs);
207+ for (i = 0; i < num_devs; i++)
208+ blk_crypto_evict_key(devs[i], blk_key);
209+
227210 kfree_sensitive(blk_key);
228211 }
229212
fs/crypto/keysetup_v1.c+7−1
@@ -147,13 +147,19 @@ find_or_insert_direct_key(struct fscrypt_direct_key *to_insert, · 146 unmodified lines
147147 if (memcmp(ci->ci_policy.v1.master_key_descriptor,
148148 dk->dk_descriptor, FSCRYPT_KEY_DESCRIPTOR_SIZE) != 0)
149149 continue;
150+ /* The sb is used at eviction time, so it must be the same. */
151+ if (ci->ci_inode->i_sb != dk->dk_sb)
152+ continue;
150153 if (ci->ci_mode != dk->dk_mode)
151154 continue;
152155 if (!fscrypt_is_key_prepared(&dk->dk_key, ci))
153156 continue;
154157 if (crypto_memneq(raw_key, dk->dk_raw, ci->ci_mode->keysize))
155158 continue;
156− /* using existing tfm with same (descriptor, mode, raw_key) */
159+ /*
160+ * Use an existing prepared key with the same (descriptor, sb,
161+ * mode, inlinecrypt, raw_key) combination.
162+ */
157163 refcount_inc(&dk->dk_refcount);
158164 spin_unlock(&fscrypt_direct_keys_lock);
159165 free_direct_key(to_insert);
fs/eventpoll.c+17−1
@@ -459,11 +459,14 @@ static struct kmem_cache *pwq_cache __ro_after_init; · 458 unmodified lines
459459 * Wrapper anchor for file->f_ep when the watched file is not itself an
460460 * eventpoll; for the epoll-watches-epoll case, file->f_ep points at
461461 * &watched_ep->refs directly. The ->next field threads
462− * ctx->tfile_check_list during one EPOLL_CTL_ADD path check.
462+ * ctx->tfile_check_list during one EPOLL_CTL_ADD path check. The ->file
463+ * field holds a reference to the associated file while the head is on
464+ * the list.
463465 */
464466 struct epitems_head {
465467 struct hlist_head epitems;
466468 struct epitems_head *next;
469+ struct file *file;
467470 };
468471
469472 static struct kmem_cache *ephead_cache __ro_after_init;
@@ -480,6 +483,16 @@ static void list_file(struct file *file, struct ep_ctl_ctx *ctx) · 10 unmodified lines
480483
481484 head = container_of(file->f_ep, struct epitems_head, epitems);
482485 if (!head->next) {
486+ /*
487+ * The caller owns a reference to @file or holds the ep->mtx for the
488+ * epitem that led here. The latter blocks eventpoll_release_file()
489+ * before the file allocation can be freed and reused. A dying leaf
490+ * can be skipped since removing links cannot increase the reverse
491+ * path count.
492+ */
493+ if (!file_ref_get(&file->f_ref))
494+ return;
495+ head->file = file;
483496 head->next = ctx->tfile_check_list;
484497 ctx->tfile_check_list = head;
485498 }
@@ -489,15 +502,18 @@ static void unlist_file(struct epitems_head *head) · 3 unmodified lines
489502 {
490503 struct epitems_head *to_free = head;
491504 struct hlist_node *p = rcu_dereference(hlist_first_rcu(&head->epitems));
505+ struct file *file = head->file;
492506 if (p) {
493507 struct epitem *epi= container_of(p, struct epitem, fllink);
494508 spin_lock(&epi->ffd.file->f_lock);
495509 if (!hlist_empty(&head->epitems))
496510 to_free = NULL;
497511 head->next = NULL;
512+ head->file = NULL;
498513 spin_unlock(&epi->ffd.file->f_lock);
499514 }
500515 free_ephead(to_free);
516+ fput(file);
501517 }
502518
503519 #ifdef CONFIG_SYSCTL
fs/exec.c+1−1
@@ -740,7 +740,7 @@ int transfer_args_to_stack(struct linux_binprm *bprm, · 739 unmodified lines
740740 stop = bprm->p >> PAGE_SHIFT;
741741 sp = *sp_location;
742742
743− for (index = MAX_ARG_PAGES - 1; index >= stop; index--) {
743+ for (index = MAX_ARG_PAGES; index-- > stop; ) {
744744 unsigned int offset = index == stop ? bprm->p & ~PAGE_MASK : 0;
745745 char *src = kmap_local_page(bprm->page[index]) + offset;
746746 sp -= PAGE_SIZE - offset;
fs/f2fs/super.c+14−11
@@ -3749,24 +3749,27 @@ static bool f2fs_has_stable_inodes(struct super_block *sb) · 3748 unmodified lines
37493749 return true;
37503750 }
37513751
3752−static struct block_device **f2fs_get_devices(struct super_block *sb,
3753− unsigned int *num_devs)
3752+static unsigned int
3753+f2fs_get_devices(struct super_block *sb,
3754+ struct block_device *devs[FSCRYPT_MAX_DEVICES])
37543755 {
37553756 struct f2fs_sb_info *sbi = F2FS_SB(sb);
3756− struct block_device **devs;
3757+ int ndevs;
37573758 int i;
37583759
3759− if (!f2fs_is_multi_device(sbi))
3760− return NULL;
3760+ static_assert(MAX_DEVICES <= FSCRYPT_MAX_DEVICES);
37613761
3762− devs = kmalloc_objs(*devs, sbi->s_ndevs);
3763− if (!devs)
3764− return ERR_PTR(-ENOMEM);
3762+ if (!f2fs_is_multi_device(sbi)) {
3763+ devs[0] = sb->s_bdev;
3764+ return 1;
3765+ }
3766+ ndevs = sbi->s_ndevs;
3767+ if (WARN_ON_ONCE(ndevs > FSCRYPT_MAX_DEVICES))
3768+ ndevs = FSCRYPT_MAX_DEVICES;
37653769
3766− for (i = 0; i < sbi->s_ndevs; i++)
3770+ for (i = 0; i < ndevs; i++)
37673771 devs[i] = FDEV(i).bdev;
3768− *num_devs = sbi->s_ndevs;
3769− return devs;
3772+ return ndevs;
37703773 }
37713774
37723775 static const struct fscrypt_operations f2fs_cryptops = {
fs/fat/fat.h+2−2
@@ -249,13 +249,13 @@ static inline unsigned char fat_checksum(const __u8 *name) · 248 unmodified lines
249249 return s;
250250 }
251251
252−static inline sector_t fat_clus_to_blknr(struct msdos_sb_info *sbi, int clus)
252+static inline sector_t fat_clus_to_blknr(const struct msdos_sb_info *sbi, int clus)
253253 {
254254 return ((sector_t)clus - FAT_START_ENT) * sbi->sec_per_clus
255255 + sbi->data_start;
256256 }
257257
258−static inline void fat_get_blknr_offset(struct msdos_sb_info *sbi,
258+static inline void fat_get_blknr_offset(const struct msdos_sb_info *sbi,
259259 loff_t i_pos, sector_t *blknr, int *offset)
260260 {
261261 *blknr = i_pos >> sbi->dir_per_block_bits;
fs/fat/fat_test.c+2−2
@@ -22,7 +22,7 @@ static void fat_checksum_test(struct kunit *test) · 21 unmodified lines
2222
2323 static void fat_clus_to_blknr_test(struct kunit *test)
2424 {
25− struct msdos_sb_info sbi = {
25+ static const struct msdos_sb_info sbi = {
2626 .sec_per_clus = 4,
2727 .data_start = 100,
2828 };
@@ -34,7 +34,7 @@ static void fat_clus_to_blknr_test(struct kunit *test) · 5 unmodified lines
3434
3535 static void fat_get_blknr_offset_test(struct kunit *test)
3636 {
37− struct msdos_sb_info sbi = {
37+ static const struct msdos_sb_info sbi = {
3838 .dir_per_block = 16,
3939 .dir_per_block_bits = 4,
4040 };
fs/iomap/buffered-io.c+44−14
@@ -68,11 +68,13 @@ static bool ifs_set_range_uptodate(struct folio *folio, · 67 unmodified lines
6868 struct iomap_folio_state *ifs, size_t off, size_t len)
6969 {
7070 struct inode *inode = folio->mapping->host;
71− unsigned int first_blk = off >> inode->i_blkbits;
72− unsigned int last_blk = (off + len - 1) >> inode->i_blkbits;
73− unsigned int nr_blks = last_blk - first_blk + 1;
71+ unsigned int first_blk, last_blk;
7472
75− bitmap_set(ifs->state, first_blk, nr_blks);
73+ if (len) {
74+ first_blk = off >> inode->i_blkbits;
75+ last_blk = (off + len - 1) >> inode->i_blkbits;
76+ bitmap_set(ifs->state, first_blk, last_blk - first_blk + 1);
77+ }
7678 return ifs_is_fully_uptodate(folio, ifs);
7779 }
7880
@@ -172,18 +174,29 @@ static unsigned iomap_find_dirty_range(struct folio *folio, u64 *range_start, · 93 unmodified lines
172174 return range_end - *range_start;
173175 }
174176
177+/*
178+ * Clear the per-block dirty bits for the range [@off, @off + @len) within a
179+ * folio. The range is rounded inwards so that only blocks fully covered by
180+ * the range are cleared. This is required for operations like folio
181+ * invalidation, where we must ensure a block is fully clean before discarding
182+ * it.
183+ */
175184 static void ifs_clear_range_dirty(struct folio *folio,
176185 struct iomap_folio_state *ifs, size_t off, size_t len)
177186 {
178187 struct inode *inode = folio->mapping->host;
179188 unsigned int blks_per_folio = i_blocks_per_folio(inode, folio);
180− unsigned int first_blk = (off >> inode->i_blkbits);
181− unsigned int last_blk = (off + len - 1) >> inode->i_blkbits;
182− unsigned int nr_blks = last_blk - first_blk + 1;
189+ unsigned int first_blk = round_up(off, i_blocksize(inode)) >>
190+ inode->i_blkbits;
191+ unsigned int last_blk = (off + len) >> inode->i_blkbits;
183192 unsigned long flags;
184193
194+ if (first_blk >= last_blk)
195+ return;
196+
185197 spin_lock_irqsave(&ifs->state_lock, flags);
186− bitmap_clear(ifs->state, first_blk + blks_per_folio, nr_blks);
198+ bitmap_clear(ifs->state, first_blk + blks_per_folio,
199+ last_blk - first_blk);
187200 spin_unlock_irqrestore(&ifs->state_lock, flags);
188201 }
189202
@@ -195,18 +208,29 @@ static void iomap_clear_range_dirty(struct folio *folio, size_t off, size_t len) · 5 unmodified lines
195208 ifs_clear_range_dirty(folio, ifs, off, len);
196209 }
197210
211+/*
212+ * Set the per-block dirty bits for the range [@off, @off + @len) within a
213+ * folio. The range is rounded outwards so that any block partially touched
214+ * by the range is marked dirty. This ensures blocks containing even a
215+ * single dirty byte will be included in subsequent writeback, preventing
216+ * data loss when partial blocks are written.
217+ */
198218 static void ifs_set_range_dirty(struct folio *folio,
199219 struct iomap_folio_state *ifs, size_t off, size_t len)
200220 {
201221 struct inode *inode = folio->mapping->host;
202222 unsigned int blks_per_folio = i_blocks_per_folio(inode, folio);
203− unsigned int first_blk = (off >> inode->i_blkbits);
204− unsigned int last_blk = (off + len - 1) >> inode->i_blkbits;
205− unsigned int nr_blks = last_blk - first_blk + 1;
223+ unsigned int first_blk, last_blk;
206224 unsigned long flags;
207225
226+ if (!len)
227+ return;
228+
229+ first_blk = off >> inode->i_blkbits;
230+ last_blk = (off + len - 1) >> inode->i_blkbits;
208231 spin_lock_irqsave(&ifs->state_lock, flags);
209− bitmap_set(ifs->state, first_blk + blks_per_folio, nr_blks);
232+ bitmap_set(ifs->state, first_blk + blks_per_folio,
233+ last_blk - first_blk + 1);
210234 spin_unlock_irqrestore(&ifs->state_lock, flags);
211235 }
212236
@@ -811,6 +835,8 @@ void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len) · 598 unmodified lines
811835 WARN_ON_ONCE(folio_test_writeback(folio));
812836 folio_cancel_dirty(folio);
813837 ifs_free(folio);
838+ } else {
839+ iomap_clear_range_dirty(folio, offset, len);
814840 }
815841 }
816842 EXPORT_SYMBOL_GPL(iomap_invalidate_folio);
@@ -1619,6 +1645,7 @@ static int iomap_zero_iter(struct iomap_iter *iter, bool *did_zero, · 802 unmodified lines
16191645 const struct iomap_write_ops *write_ops)
16201646 {
16211647 u64 bytes = iomap_length(iter);
1648+ bool zeroed = false;
16221649 int status;
16231650
16241651 do {
@@ -1639,6 +1666,8 @@ static int iomap_zero_iter(struct iomap_iter *iter, bool *did_zero, · 14 unmodified lines
16391666 /* a NULL folio means we're done with a folio batch */
16401667 if (!folio) {
16411668 status = iomap_iter_advance_full(iter);
1669+ if (status)
1670+ return status;
16421671 break;
16431672 }
16441673
@@ -1649,6 +1678,7 @@ static int iomap_zero_iter(struct iomap_iter *iter, bool *did_zero, · 4 unmodified lines
16491678 bytes);
16501679
16511680 folio_zero_range(folio, offset, bytes);
1681+ zeroed = true;
16521682 folio_mark_accessed(folio);
16531683
16541684 ret = iomap_write_end(iter, bytes, bytes, folio);
@@ -1658,10 +1688,10 @@ static int iomap_zero_iter(struct iomap_iter *iter, bool *did_zero, · 3 unmodified lines
16581688
16591689 status = iomap_iter_advance(iter, bytes);
16601690 if (status)
1661− break;
1691+ return status;
16621692 } while ((bytes = iomap_length(iter)) > 0);
16631693
1664− if (did_zero)
1694+ if (did_zero && zeroed)
16651695 *did_zero = true;
16661696 return status;
16671697 }
fs/iomap/ioend.c+2−0
@@ -385,6 +385,8 @@ static bool iomap_ioend_can_merge(struct iomap_ioend *ioend, · 384 unmodified lines
385385
386386 if (ioend->io_bio.bi_status != next->io_bio.bi_status)
387387 return false;
388+ if (ioend->io_private != next->io_private)
389+ return false;
388390 if (next->io_flags & IOMAP_IOEND_BOUNDARY)
389391 return false;
390392 if ((ioend->io_flags & IOMAP_IOEND_NOMERGE_FLAGS) !=
fs/lockd/svcproc.c+2−1
@@ -901,7 +901,8 @@ static __be32 nlmsvc_proc_granted_msg(struct svc_rqst *rqstp) · 900 unmodified lines
901901 if (argp->xdrgen.cookie.len > NLM_MAXCOOKIELEN)
902902 return rpc_garbage_args;
903903
904− host = nlm3svc_lookup_host(rqstp, argp->xdrgen.alock.caller_name, false);
904+ host = nlmsvc_lookup_host(rqstp, argp->xdrgen.alock.caller_name.data,
905+ argp->xdrgen.alock.caller_name.len);
905906 if (!host)
906907 return rpc_system_err;
907908
fs/overlayfs/file.c+15−1
@@ -528,6 +528,7 @@ static loff_t ovl_copyfile(struct file *file_in, loff_t pos_in, · 527 unmodified lines
528528 struct file *file_out, loff_t pos_out,
529529 loff_t len, unsigned int flags, enum ovl_copyop op)
530530 {
531+ struct inode *inode_in = file_inode(file_in);
531532 struct inode *inode_out = file_inode(file_out);
532533 struct file *realfile_in, *realfile_out;
533534 loff_t ret;
@@ -551,7 +552,20 @@ static loff_t ovl_copyfile(struct file *file_in, loff_t pos_in, · 17 unmodified lines
551552 if (IS_ERR(realfile_in))
552553 goto out_unlock;
553554
554− with_ovl_creds(file_inode(file_out)->i_sb) {
555+ /*
556+ * For cross-sb copy, vfs_copy_file_range() will verify read access with
557+ * the mounter creds of the dest fs mounter, so we need to explicitly
558+ * verify read access with the source mounter creds.
559+ */
560+ if (unlikely(inode_in->i_sb != inode_out->i_sb)) {
561+ with_ovl_creds(inode_in->i_sb) {
562+ ret = rw_verify_area(READ, realfile_in, &pos_in, len);
563+ if (unlikely(ret))
564+ goto out_unlock;
565+ }
566+ }
567+
568+ with_ovl_creds(inode_out->i_sb) {
555569 switch (op) {
556570 case OVL_COPY:
557571 ret = vfs_copy_file_range(realfile_in, pos_in,
fs/overlayfs/xattrs.c+1−1
@@ -13,7 +13,7 @@ static bool ovl_is_escaped_xattr(struct super_block *sb, const char *name) · 12 unmodified lines
1313 OVL_XATTR_ESCAPE_USER_PREFIX_LEN) == 0;
1414 else
1515 return strncmp(name, OVL_XATTR_ESCAPE_TRUSTED_PREFIX,
16− OVL_XATTR_ESCAPE_TRUSTED_PREFIX_LEN - 1) == 0;
16+ OVL_XATTR_ESCAPE_TRUSTED_PREFIX_LEN) == 0;
1717 }
1818
1919 static bool ovl_is_own_xattr(struct super_block *sb, const char *name)
fs/pidfs.c+37−17
@@ -1,5 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 #include <linux/anon_inodes.h>
3+#include <linux/compat.h>
34 #include <linux/exportfs.h>
45 #include <linux/file.h>
56 #include <linux/fs.h>
@@ -107,7 +108,7 @@ struct pidfs_attr { · 101 unmodified lines
107108
108109 #if BITS_PER_LONG == 32
109110
110−DEFINE_SPINLOCK(pidfs_ino_lock);
111+static DEFINE_SPINLOCK(pidfs_ino_lock);
111112 static u64 pidfs_ino_nr = 1;
112113
113114 static inline unsigned long pidfs_ino(u64 ino)
@@ -659,6 +660,17 @@ static long pidfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 545 unmodified lines
659660 return open_namespace(ns_common);
660661 }
661662
663+#ifdef CONFIG_COMPAT
664+static long pidfd_compat_ioctl(struct file *file, unsigned int cmd,
665+ unsigned long arg)
666+{
667+ if (cmd == FS_IOC32_GETVERSION)
668+ cmd = FS_IOC_GETVERSION;
669+
670+ return pidfd_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
671+}
672+#endif
673+
662674 static int pidfs_file_release(struct inode *inode, struct file *file)
663675 {
664676 struct pid *pid = inode->i_private;
@@ -686,7 +698,9 @@ static const struct file_operations pidfs_file_operations = { · 21 unmodified lines
686698 .show_fdinfo = pidfd_show_fdinfo,
687699 #endif
688700 .unlocked_ioctl = pidfd_ioctl,
689− .compat_ioctl = compat_ptr_ioctl,
701+#ifdef CONFIG_COMPAT
702+ .compat_ioctl = pidfd_compat_ioctl,
703+#endif
690704 };
691705
692706 struct pid *pidfd_pid(const struct file *file)
@@ -915,6 +929,20 @@ static struct dentry *pidfs_fh_to_dentry(struct super_block *sb, · 222 unmodified lines
915929 return path.dentry;
916930 }
917931
932+static struct file *pidfs_dentry_open(const struct path *path,
933+ unsigned int flags,
934+ const struct cred *cred)
935+{
936+ struct file *file;
937+
938+ /* pidfds are always O_RDWR. */
939+ file = dentry_open(path, flags | O_RDWR, cred);
940+ /* do_dentry_open() strips O_EXCL and O_TRUNC. */
941+ if (!IS_ERR(file))
942+ file->f_flags |= flags & (PIDFD_THREAD | PIDFD_AUTOKILL);
943+ return file;
944+}
945+
918946 /*
919947 * Make sure that we reject any nonsensical flags that users pass via
920948 * open_by_handle_at(). Note that PIDFD_THREAD is defined as O_EXCL, and
@@ -940,11 +968,13 @@ static int pidfs_export_permission(struct handle_to_path_ctx *ctx, · 19 unmodified lines
940968 static struct file *pidfs_export_open(const struct path *path, unsigned int oflags)
941969 {
942970 /*
943− * Clear O_LARGEFILE as open_by_handle_at() forces it and raise
944− * O_RDWR as pidfds always are.
971+ * Opening via file handle may never raise PIDFD_AUTOKILL. That can
972+ * only be done at task creation!
945973 */
946− oflags &= ~O_LARGEFILE;
947− return dentry_open(path, oflags | O_RDWR, current_cred());
974+ if (WARN_ON_ONCE(oflags & PIDFD_AUTOKILL))
975+ return ERR_PTR(-EINVAL);
976+ /* Clear O_LARGEFILE as open_by_handle_at() forces it. */
977+ return pidfs_dentry_open(path, oflags & ~O_LARGEFILE, current_cred());
948978 }
949979
950980 static const struct export_operations pidfs_export_operations = {
@@ -1108,7 +1138,6 @@ static struct file_system_type pidfs_type = { · 157 unmodified lines
11081138
11091139 struct file *pidfs_alloc_file(struct pid *pid, unsigned int flags)
11101140 {
1111− struct file *pidfd_file;
11121141 struct path path __free(path_put) = {};
11131142 int ret;
11141143
@@ -1126,16 +1155,7 @@ struct file *pidfs_alloc_file(struct pid *pid, unsigned int flags) · 11 unmodified lines
11261155 VFS_WARN_ON_ONCE(!pid->attr);
11271156
11281157 flags &= ~PIDFD_STALE;
1129− flags |= O_RDWR;
1130− pidfd_file = dentry_open(&path, flags, current_cred());
1131− /*
1132− * Raise PIDFD_THREAD and PIDFD_AUTOKILL explicitly as
1133− * do_dentry_open() strips O_EXCL and O_TRUNC.
1134− */
1135− if (!IS_ERR(pidfd_file))
1136− pidfd_file->f_flags |= (flags & (PIDFD_THREAD | PIDFD_AUTOKILL));
1137−
1138− return pidfd_file;
1158+ return pidfs_dentry_open(&path, flags, current_cred());
11391159 }
11401160
11411161 void __init pidfs_init(void)
fs/posix_acl.c+7−0
@@ -93,6 +93,13 @@ static void __forget_cached_acl(struct posix_acl **p) · 92 unmodified lines
9393 {
9494 struct posix_acl *old;
9595
96+ /*
97+ * ACL_DONT_CACHE is expected to be a "const" value and xchg it with
98+ * ACL_NOT_CACHED would enable acl caching for the inode -
99+ * clearly not what the caller has intended.
100+ */
101+ if (READ_ONCE(*p) == ACL_DONT_CACHE)
102+ return;
96103 old = xchg(p, ACL_NOT_CACHED);
97104 if (!is_uncached_acl(old))
98105 posix_acl_release(old);
fs/proc/namespaces.c+3−1
@@ -46,7 +46,7 @@ static const char *proc_ns_get_link(struct dentry *dentry, · 45 unmodified lines
4646 const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops;
4747 struct task_struct *task;
4848 struct path ns_path;
49− int error = -EACCES;
49+ int error;
5050
5151 if (!dentry)
5252 return ERR_PTR(-ECHILD);
@@ -59,6 +59,7 @@ static const char *proc_ns_get_link(struct dentry *dentry, · 6 unmodified lines
5959 if (error)
6060 goto out_put_task;
6161
62+ error = -EACCES;
6263 if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS))
6364 goto out;
6465
@@ -90,6 +91,7 @@ static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int bufl · 25 unmodified lines
9091 if (res)
9192 goto out_put_task;
9293
94+ res = -EACCES;
9395 if (ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) {
9496 res = ns_get_name(name, sizeof(name), task, ns_ops);
9597 if (res >= 0)
fs/smb/client/cifsfs.c+1−0
@@ -440,6 +440,7 @@ cifs_alloc_inode(struct super_block *sb) · 439 unmodified lines
440440 return NULL;
441441 cifs_inode->cifsAttrs = ATTR_ARCHIVE; /* default */
442442 cifs_inode->time = 0;
443+ cifs_inode->time_last_write = 0;
443444 /*
444445 * Until the file is open and we have gotten oplock info back from the
445446 * server, can not assume caching of file data or metadata.
fs/smb/client/cifsglob.h+1−0
@@ -1566,6 +1566,7 @@ struct cifsInodeInfo { · 1565 unmodified lines
15661566 spinlock_t writers_lock;
15671567 unsigned int writers; /* Number of writers on this inode */
15681568 unsigned long time; /* jiffies of last update of inode */
1569+ unsigned long time_last_write; /* jiffies of last writable close or truncate */
15691570 u64 uniqueid; /* server inode number */
15701571 u64 createtime; /* creation time on server */
15711572 __u8 lease_key[SMB2_LEASE_KEY_SIZE]; /* lease key for this inode */
fs/smb/client/file.c+64−5
@@ -1423,11 +1423,21 @@ void smb2_deferred_work_close(struct work_struct *work) · 1422 unmodified lines
14231423 {
14241424 struct cifsFileInfo *cfile = container_of(work,
14251425 struct cifsFileInfo, deferred.work);
1426+ struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
14261427
1427− spin_lock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock);
1428+ spin_lock(&cinode->deferred_lock);
14281429 cifs_del_deferred_close(cfile);
14291430 cfile->deferred_close_scheduled = false;
1430− spin_unlock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock);
1431+ spin_unlock(&cinode->deferred_lock);
1432+ /*
1433+ * Refresh time_last_write immediately before the actual server close
1434+ * so the protection window is anchored to the real close time, not
1435+ * the earlier userspace close time stored by cifs_close().
1436+ */
1437+ if (OPEN_FMODE(cfile->f_flags) & FMODE_WRITE) {
1438+ /* Pairs with smp_load_acquire() in is_size_safe_to_change(). */
1439+ smp_store_release(&cinode->time_last_write, jiffies);
1440+ }
14311441 _cifsFileInfo_put(cfile, true, false);
14321442 }
14331443
@@ -1457,6 +1467,10 @@ int cifs_close(struct inode *inode, struct file *file) · 23 unmodified lines
14571467 if (file->private_data != NULL) {
14581468 cfile = file->private_data;
14591469 file->private_data = NULL;
1470+ if (file->f_mode & FMODE_WRITE) {
1471+ /* Pairs with smp_load_acquire() in is_size_safe_to_change(). */
1472+ smp_store_release(&cinode->time_last_write, jiffies);
1473+ }
14601474 dclose = kmalloc_obj(struct cifs_deferred_close);
14611475 if ((cfile->status_file_deleted == false) &&
14621476 (smb2_can_defer_close(inode, dclose))) {
@@ -3225,13 +3239,26 @@ static int is_inode_writable(struct cifsInodeInfo *cifs_inode) · 1762 unmodified lines
32253239 bool is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file,
32263240 bool from_readdir)
32273241 {
3242+ struct cifs_sb_info *cifs_sb;
3243+ unsigned long tlw;
3244+
32283245 if (!cifsInode)
32293246 return true;
32303247
3248+ cifs_sb = CIFS_SB(cifsInode);
3249+
32313250 if (is_inode_writable(cifsInode) ||
32323251 ((cifsInode->oplock & CIFS_CACHE_RW_FLG) != 0 && from_readdir)) {
32333252 /* This inode is open for write at least once */
3234− struct cifs_sb_info *cifs_sb = CIFS_SB(cifsInode);
3253+
3254+ /*
3255+ * Readdir data is unreliable when we have writable handles or
3256+ * an exclusive lease -- never allow it to change i_size, even
3257+ * on direct-IO mounts where the server's directory metadata
3258+ * can still lag behind the actual file state.
3259+ */
3260+ if (from_readdir)
3261+ return false;
32353262
32363263 if (cifs_sb_flags(cifs_sb) & CIFS_MOUNT_DIRECT_IO) {
32373264 /* since no page cache to corrupt on directio
@@ -3243,8 +3270,40 @@ bool is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file, · 5 unmodified lines
32433270 return true;
32443271
32453272 return false;
3246− } else
3247− return true;
3273+ }
3274+
3275+ /*
3276+ * No writable handles open. Check whether we are within the attribute
3277+ * cache validity window of a recent local modification.
3278+ *
3279+ * For the close() path: cifs_close() calls smp_store_release() on
3280+ * time_last_write before _cifsFileInfo_put() removes the handle under
3281+ * open_file_lock. That spin_unlock() is a store-release that pairs
3282+ * with the spin_lock() (load-acquire) in is_inode_writable() above,
3283+ * so if is_inode_writable() returned false the smp_load_acquire()
3284+ * below is guaranteed to observe any time_last_write update from a
3285+ * concurrent close().
3286+ *
3287+ * For the setattr/truncate paths: those callers use smp_store_release()
3288+ * directly; the smp_load_acquire() below pairs with that store. There
3289+ * is no shared lock between setattr and readdir, so this relies on
3290+ * acquire-release semantics alone. The store propagation latency on
3291+ * weakly-ordered architectures (nanoseconds) is negligible relative to
3292+ * the acregmax window (seconds) and the readdir RPC round-trip
3293+ * (milliseconds), making this a sound design choice in practice.
3294+ *
3295+ * time_last_write == 0 means the inode has never been written locally;
3296+ * skip the window check to avoid false positives near boot time when
3297+ * jiffies is still close to INITIAL_JIFFIES on 32-bit systems.
3298+ */
3299+ if (from_readdir) {
3300+ /* Pairs with smp_store_release() at close and truncate sites. */
3301+ tlw = smp_load_acquire(&cifsInode->time_last_write);
3302+ if (tlw && time_before(jiffies, tlw + cifs_sb->ctx->acregmax))
3303+ return false;
3304+ }
3305+
3306+ return true;
32483307 }
32493308
32503309 void cifs_oplock_break(struct work_struct *work)
fs/smb/client/inode.c+6−0
@@ -237,6 +237,8 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr, · 236 unmodified lines
237237 if (is_size_safe_to_change(cifs_i, fattr->cf_eof, from_readdir)) {
238238 i_size_write(inode, fattr->cf_eof);
239239 inode->i_blocks = CIFS_INO_BLOCKS(fattr->cf_bytes);
240+ } else if (from_readdir && i_size_read(inode) != fattr->cf_eof) {
241+ cifs_i->time = 0;
240242 }
241243
242244 if (S_ISLNK(fattr->cf_mode) && fattr->cf_symlink_target) {
@@ -3277,6 +3279,8 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) · 3034 unmodified lines
32773279
32783280 if ((attrs->ia_valid & ATTR_SIZE) &&
32793281 attrs->ia_size != i_size_read(inode)) {
3282+ /* Pairs with smp_load_acquire() in is_size_safe_to_change(). */
3283+ smp_store_release(&cifsInode->time_last_write, jiffies);
32803284 truncate_setsize(inode, attrs->ia_size);
32813285 netfs_resize_file(&cifsInode->netfs, attrs->ia_size, true);
32823286 fscache_resize_cookie(cifs_inode_cookie(inode), attrs->ia_size);
@@ -3478,6 +3482,8 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) · 195 unmodified lines
34783482
34793483 if ((attrs->ia_valid & ATTR_SIZE) &&
34803484 attrs->ia_size != i_size_read(inode)) {
3485+ /* Pairs with smp_load_acquire() in is_size_safe_to_change(). */
3486+ smp_store_release(&cifsInode->time_last_write, jiffies);
34813487 truncate_setsize(inode, attrs->ia_size);
34823488 netfs_resize_file(&cifsInode->netfs, attrs->ia_size, true);
34833489 fscache_resize_cookie(cifs_inode_cookie(inode), attrs->ia_size);
fs/smb/client/misc.c+88−18
@@ -497,7 +497,7 @@ cifs_del_deferred_close(struct cifsFileInfo *cfile) · 496 unmodified lines
497497 void
498498 cifs_close_deferred_file(struct cifsInodeInfo *cifs_inode)
499499 {
500− struct cifsFileInfo *cfile = NULL;
500+ struct cifsFileInfo *cfile = NULL, *failed_cfile = NULL;
501501 struct file_list *tmp_list, *tmp_next_list;
502502 LIST_HEAD(file_head);
503503
@@ -514,8 +514,10 @@ cifs_close_deferred_file(struct cifsInodeInfo *cifs_inode) · 10 unmodified lines
514514
515515 tmp_list = kmalloc_obj(struct file_list,
516516 GFP_ATOMIC);
517− if (tmp_list == NULL)
517+ if (tmp_list == NULL) {
518+ failed_cfile = cfile;
518519 break;
520+ }
519521 tmp_list->cfile = cfile;
520522 list_add_tail(&tmp_list->list, &file_head);
521523 }
@@ -523,8 +525,24 @@ cifs_close_deferred_file(struct cifsInodeInfo *cifs_inode) · 1 unmodified line
523525 }
524526 spin_unlock(&cifs_inode->open_file_lock);
525527
528+ if (failed_cfile) {
529+ if (OPEN_FMODE(failed_cfile->f_flags) & FMODE_WRITE) {
530+ /* Pairs with smp_load_acquire() in is_size_safe_to_change(). */
531+ smp_store_release(&CIFS_I(d_inode(failed_cfile->dentry))->time_last_write,
532+ jiffies);
533+ }
534+ _cifsFileInfo_put(failed_cfile, false, false);
535+ }
536+
526537 list_for_each_entry_safe(tmp_list, tmp_next_list, &file_head, list) {
527− _cifsFileInfo_put(tmp_list->cfile, false, false);
538+ struct cifsFileInfo *cfile = tmp_list->cfile;
539+
540+ if (OPEN_FMODE(cfile->f_flags) & FMODE_WRITE) {
541+ /* Pairs with smp_load_acquire() in is_size_safe_to_change(). */
542+ smp_store_release(&CIFS_I(d_inode(cfile->dentry))->time_last_write,
543+ jiffies);
544+ }
545+ _cifsFileInfo_put(cfile, false, false);
528546 list_del(&tmp_list->list);
529547 kfree(tmp_list);
530548 }
@@ -533,7 +551,7 @@ cifs_close_deferred_file(struct cifsInodeInfo *cifs_inode) · 2 unmodified lines
533551 void
534552 cifs_close_all_deferred_files(struct cifs_tcon *tcon)
535553 {
536− struct cifsFileInfo *cfile;
554+ struct cifsFileInfo *cfile, *failed_cfile = NULL;
537555 struct file_list *tmp_list, *tmp_next_list;
538556 LIST_HEAD(file_head);
539557
@@ -547,8 +565,10 @@ cifs_close_all_deferred_files(struct cifs_tcon *tcon) · 7 unmodified lines
547565
548566 tmp_list = kmalloc_obj(struct file_list,
549567 GFP_ATOMIC);
550− if (tmp_list == NULL)
568+ if (tmp_list == NULL) {
569+ failed_cfile = cfile;
551570 break;
571+ }
552572 tmp_list->cfile = cfile;
553573 list_add_tail(&tmp_list->list, &file_head);
554574 }
@@ -556,8 +576,24 @@ cifs_close_all_deferred_files(struct cifs_tcon *tcon) · 1 unmodified line
556576 }
557577 spin_unlock(&tcon->open_file_lock);
558578
579+ if (failed_cfile) {
580+ if (OPEN_FMODE(failed_cfile->f_flags) & FMODE_WRITE) {
581+ /* Pairs with smp_load_acquire() in is_size_safe_to_change(). */
582+ smp_store_release(&CIFS_I(d_inode(failed_cfile->dentry))->time_last_write,
583+ jiffies);
584+ }
585+ _cifsFileInfo_put(failed_cfile, true, false);
586+ }
587+
559588 list_for_each_entry_safe(tmp_list, tmp_next_list, &file_head, list) {
560− _cifsFileInfo_put(tmp_list->cfile, true, false);
589+ struct cifsFileInfo *cfile = tmp_list->cfile;
590+
591+ if (OPEN_FMODE(cfile->f_flags) & FMODE_WRITE) {
592+ /* Pairs with smp_load_acquire() in is_size_safe_to_change(). */
593+ smp_store_release(&CIFS_I(d_inode(cfile->dentry))->time_last_write,
594+ jiffies);
595+ }
596+ _cifsFileInfo_put(cfile, true, false);
561597 list_del(&tmp_list->list);
562598 kfree(tmp_list);
563599 }
@@ -604,7 +640,7 @@ void cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, · 40 unmodified lines
604640 struct dentry *dentry)
605641 {
606642 struct file_list *tmp_list, *tmp_next_list;
607− struct cifsFileInfo *cfile;
643+ struct cifsFileInfo *cfile, *failed_cfile = NULL;
608644 LIST_HEAD(file_head);
609645
610646 spin_lock(&tcon->open_file_lock);
@@ -617,16 +653,34 @@ void cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, · 6 unmodified lines
617653 spin_unlock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock);
618654
619655 tmp_list = kmalloc_obj(struct file_list, GFP_ATOMIC);
620− if (tmp_list == NULL)
656+ if (tmp_list == NULL) {
657+ failed_cfile = cfile;
621658 break;
659+ }
622660 tmp_list->cfile = cfile;
623661 list_add_tail(&tmp_list->list, &file_head);
624662 }
625663 }
626664 spin_unlock(&tcon->open_file_lock);
627665
666+ if (failed_cfile) {
667+ if (OPEN_FMODE(failed_cfile->f_flags) & FMODE_WRITE) {
668+ /* Pairs with smp_load_acquire() in is_size_safe_to_change(). */
669+ smp_store_release(&CIFS_I(d_inode(failed_cfile->dentry))->time_last_write,
670+ jiffies);
671+ }
672+ _cifsFileInfo_put(failed_cfile, true, false);
673+ }
674+
628675 list_for_each_entry_safe(tmp_list, tmp_next_list, &file_head, list) {
629− _cifsFileInfo_put(tmp_list->cfile, true, false);
676+ struct cifsFileInfo *cfile = tmp_list->cfile;
677+
678+ if (OPEN_FMODE(cfile->f_flags) & FMODE_WRITE) {
679+ /* Pairs with smp_load_acquire() in is_size_safe_to_change(). */
680+ smp_store_release(&CIFS_I(d_inode(cfile->dentry))->time_last_write,
681+ jiffies);
682+ }
683+ _cifsFileInfo_put(cfile, true, false);
630684 list_del(&tmp_list->list);
631685 kfree(tmp_list);
632686 }
@@ -682,6 +736,8 @@ parse_dfs_referrals(struct get_dfs_referral_rsp *rsp, u32 rsp_size, · 49 unmodified lines
682736 int i, rc = 0;
683737 char *data_end;
684738 struct dfs_referral_level_3 *ref;
739+ unsigned int path_consumed;
740+ size_t search_name_len;
685741
686742 if (rsp_size < sizeof(*rsp)) {
687743 cifs_dbg(VFS | ONCE,
@@ -728,6 +784,7 @@ parse_dfs_referrals(struct get_dfs_referral_rsp *rsp, u32 rsp_size, · 40 unmodified lines
728784 rc = -ENOMEM;
729785 goto parse_DFS_referrals_exit;
730786 }
787+ search_name_len = strlen(searchName);
731788
732789 /* collect necessary data from referrals */
733790 for (i = 0; i < *num_of_nodes; i++) {
@@ -736,21 +793,34 @@ parse_dfs_referrals(struct get_dfs_referral_rsp *rsp, u32 rsp_size, · 2 unmodified lines
736793 struct dfs_info3_param *node = (*target_nodes)+i;
737794
738795 node->flags = le32_to_cpu(rsp->DFSFlags);
796+ path_consumed = le16_to_cpu(rsp->PathConsumed);
739797 if (is_unicode) {
740− __le16 *tmp = kmalloc(strlen(searchName)*2 + 2,
741− GFP_KERNEL);
742− if (tmp == NULL) {
798+ size_t search_name_utf16_len = search_name_len * 2 + 2;
799+ __le16 *tmp;
800+
801+ if (path_consumed > search_name_utf16_len) {
802+ rc = -EINVAL;
803+ goto parse_DFS_referrals_exit;
804+ }
805+
806+ tmp = kmalloc(search_name_utf16_len, GFP_KERNEL);
807+ if (!tmp) {
743808 rc = -ENOMEM;
744809 goto parse_DFS_referrals_exit;
745810 }
746− cifsConvertToUTF16((__le16 *) tmp, searchName,
811+ cifsConvertToUTF16((__le16 *)tmp, searchName,
747812 PATH_MAX, nls_codepage, remap);
748− node->path_consumed = cifs_utf16_bytes(tmp,
749− le16_to_cpu(rsp->PathConsumed),
750− nls_codepage);
813+ node->path_consumed = cifs_utf16_bytes(tmp, path_consumed,
814+ nls_codepage);
751815 kfree(tmp);
752− } else
753− node->path_consumed = le16_to_cpu(rsp->PathConsumed);
816+ } else {
817+ if (path_consumed > search_name_len) {
818+ rc = -EINVAL;
819+ goto parse_DFS_referrals_exit;
820+ }
821+
822+ node->path_consumed = path_consumed;
823+ }
754824
755825 node->server_type = le16_to_cpu(ref->ServerType);
756826 node->ref_flag = le16_to_cpu(ref->ReferralEntryFlags);
fs/smb/client/readdir.c+7−2
@@ -952,7 +952,7 @@ static bool cifs_dir_emit(struct dir_context *ctx, · 951 unmodified lines
952952 static int cifs_filldir(char *find_entry, struct file *file,
953953 struct dir_context *ctx,
954954 char *scratch_buf, unsigned int max_len,
955− struct cached_fid *cfid)
955+ char *end_of_smb, struct cached_fid *cfid)
956956 {
957957 struct cifsFileInfo *file_info = file->private_data;
958958 struct super_block *sb = file_inode(file)->i_sb;
@@ -974,6 +974,11 @@ static int cifs_filldir(char *find_entry, struct file *file, · 15 unmodified lines
974974 return -EINVAL;
975975 }
976976
977+ if (de.name + de.namelen > end_of_smb) {
978+ cifs_dbg(VFS, "search entry name extends past end of SMB\n");
979+ return -EINVAL;
980+ }
981+
977982 /* skip . and .. since we added them first */
978983 if (cifs_entry_is_dot(&de, file_info->srch_inf.unicode))
979984 return 0;
@@ -1194,7 +1199,7 @@ int cifs_readdir(struct file *file, struct dir_context *ctx) · 214 unmodified lines
11941199 */
11951200 *tmp_buf = 0;
11961201 rc = cifs_filldir(current_entry, file, ctx,
1197− tmp_buf, max_len, cfid);
1202+ tmp_buf, max_len, end_of_smb, cfid);
11981203 if (rc) {
11991204 if (rc > 0)
12001205 rc = 0;
fs/smb/client/smb2file.c+21−0
@@ -30,6 +30,19 @@ static struct smb2_symlink_err_rsp *symlink_data(const struct kvec *iov) · 29 unmodified lines
3030 u8 *end = (u8 *)err + iov->iov_len;
3131 u32 len;
3232
33+ /*
34+ * Per [MS-SMB2] section 2.2.2, a STATUS_STOPPED_ON_SYMLINK response has to
35+ * carry a Symbolic Link Error Response, so ByteCount cannot be zero. Some
36+ * servers (e.g. the macOS built-in SMB server) violate this and return an
37+ * empty error response, with both ErrorContextCount and ByteCount set to
38+ * zero, i.e. without the symlink target. Detect this and return -ENODATA
39+ * so that callers can tell "server did not send the target" apart from a
40+ * malformed response, and retrieve the target with FSCTL_GET_REPARSE_POINT
41+ * instead.
42+ */
43+ if (!err->ErrorContextCount && !le32_to_cpu(err->ByteCount))
44+ return ERR_PTR(-ENODATA);
45+
3346 if (err->ErrorContextCount) {
3447 struct smb2_error_context_rsp *p;
3548
@@ -199,6 +212,14 @@ int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, · 163 unmodified lines
199212 rc = smb2_parse_symlink_response(oparms->cifs_sb, &err_iov,
200213 oparms->path,
201214 &data->symlink_target);
215+ /*
216+ * If smb2_parse_symlink_response returned -ENODATA then the
217+ * symlink_target was not sent. Treat this as if the SMB2_open()
218+ * failed with STATUS_IO_REPARSE_TAG_NOT_HANDLED status, which is
219+ * indicated by the -EIO errno.
220+ */
221+ if (rc == -ENODATA)
222+ rc = -EIO;
202223 if (!rc) {
203224 memset(&data->fi, 0, sizeof(data->fi));
204225 oparms->create_options |= OPEN_REPARSE_POINT;
fs/smb/client/smb2inode.c+20−3
@@ -792,9 +792,19 @@ static int parse_create_response(struct cifs_open_info_data *data, · 791 unmodified lines
792792 rc = smb2_parse_symlink_response(cifs_sb, iov,
793793 full_path,
794794 &data->symlink_target);
795− if (rc)
795+ if (rc != 0 && rc != -ENODATA)
796796 return rc;
797− tag = IO_REPARSE_TAG_SYMLINK;
797+ /*
798+ * -ENODATA means that the response was parsed but did not contain
799+ * the symlink target at all (see symlink_data()). Treat it like
800+ * STATUS_IO_REPARSE_TAG_NOT_HANDLED, which does not contain it
801+ * either: leave the tag unset and clear rc, so that the caller
802+ * retrieves the target with SMB2_OP_GET_REPARSE.
803+ */
804+ if (rc == -ENODATA)
805+ rc = 0;
806+ else
807+ tag = IO_REPARSE_TAG_SYMLINK;
798808 reparse_point = true;
799809 break;
800810 case STATUS_SUCCESS:
@@ -987,7 +997,14 @@ int smb2_query_path_info(const unsigned int xid, · 186 unmodified lines
987997 rc = -EOPNOTSUPP;
988998 }
989999
990− if (data->reparse.tag == IO_REPARSE_TAG_SYMLINK && !rc) {
1000+ /*
1001+ * If the symlink was already parsed in create response then it is needed to fix
1002+ * its type now (after the second call with OPEN_REPARSE_POINT which filled the
1003+ * data->fi.Attributes). If the symlink was not parsed in create response then
1004+ * the data->symlink_target was not filled yet and then the type will be fixed
1005+ * later after data->symlink_target is filled.
1006+ */
1007+ if (data->reparse.tag == IO_REPARSE_TAG_SYMLINK && !rc && data->symlink_target) {
9911008 bool directory = le32_to_cpu(data->fi.Attributes) & ATTR_DIRECTORY;
9921009 rc = smb2_fix_symlink_target_type(&data->symlink_target, directory, cifs_sb);
9931010 }
fs/smb/server/compress.c+2−1
@@ -56,7 +56,8 @@ int ksmbd_decompress_request(struct ksmbd_conn *conn) · 55 unmodified lines
5656 }
5757
5858 max_allowed_pdu_size = SMB3_MAX_MSGSIZE + conn->vals->max_write_size;
59− if (out_size > max_allowed_pdu_size ||
59+ if (out_size < sizeof(struct smb2_pdu) ||
60+ out_size > max_allowed_pdu_size ||
6061 out_size > MAX_STREAM_PROT_LEN)
6162 return -EINVAL;
6263
fs/smb/server/connection.c+11−5
@@ -441,6 +441,8 @@ bool ksmbd_conn_alive(struct ksmbd_conn *conn) · 440 unmodified lines
441441 /* "+2" for BCC field (ByteCount, 2 bytes) */
442442 #define SMB1_MIN_SUPPORTED_PDU_SIZE (sizeof(struct smb_hdr) + 2)
443443 #define SMB2_MIN_SUPPORTED_PDU_SIZE (sizeof(struct smb2_pdu))
444+#define SMB2_TRANSFORM_MIN_SUPPORTED_PDU_SIZE \
445+ (sizeof(struct smb2_transform_hdr) + sizeof(struct smb2_hdr))
444446
445447 /**
446448 * ksmbd_conn_handler_loop() - session thread to listen on new smb requests
@@ -455,6 +457,7 @@ int ksmbd_conn_handler_loop(void *p) · 8 unmodified lines
455457 struct ksmbd_conn *conn = (struct ksmbd_conn *)p;
456458 struct ksmbd_transport *t = conn->transport;
457459 unsigned int pdu_size, max_allowed_pdu_size, max_req;
460+ __le32 proto;
458461 char hdr_buf[4] = {0,};
459462 int size;
460463
@@ -546,11 +549,14 @@ recheck: · 85 unmodified lines
546549 if (!ksmbd_smb_request(conn))
547550 break;
548551
549− if (((struct smb2_hdr *)smb_get_msg(conn->request_buf))->ProtocolId ==
550− SMB2_PROTO_NUMBER) {
551− if (pdu_size < SMB2_MIN_SUPPORTED_PDU_SIZE)
552− break;
553− }
552+ proto = *(__le32 *)smb_get_msg(conn->request_buf);
553+ if (proto == SMB2_PROTO_NUMBER &&
554+ pdu_size < SMB2_MIN_SUPPORTED_PDU_SIZE)
555+ break;
556+
557+ if (proto == SMB2_TRANSFORM_PROTO_NUM &&
558+ pdu_size < SMB2_TRANSFORM_MIN_SUPPORTED_PDU_SIZE)
559+ break;
554560
555561 if (!default_conn_ops.process_fn) {
556562 pr_err("No connection request callback\n");
fs/smb/server/server.c+9−1
@@ -112,6 +112,7 @@ static int __process_request(struct ksmbd_work *work, struct ksmbd_conn *conn, · 111 unmodified lines
112112 {
113113 struct smb_version_cmds *cmds;
114114 u16 command;
115+ bool signed_req;
115116 int ret;
116117
117118 if (check_conn_state(work))
@@ -138,7 +139,14 @@ andx_again: · 20 unmodified lines
138139 return SERVER_HANDLER_ABORT;
139140 }
140141
141− if (work->sess && conn->ops->is_sign_req(work, command)) {
142+ signed_req = conn->ops->is_sign_req && conn->ops->is_sign_req(work, command);
143+ if (work->sess && work->sess->sign && !work->encrypted &&
144+ !signed_req) {
145+ conn->ops->set_rsp_status(work, STATUS_ACCESS_DENIED);
146+ return SERVER_HANDLER_ABORT;
147+ }
148+
149+ if (work->sess && signed_req) {
142150 ret = conn->ops->check_sign_req(work);
143151 if (!ret) {
144152 conn->ops->set_rsp_status(work, STATUS_ACCESS_DENIED);
fs/smb/server/smb2pdu.c+5−7
@@ -1717,11 +1717,6 @@ static int ntlm_authenticate(struct ksmbd_work *work, · 1716 unmodified lines
17171717 return -EPERM;
17181718 }
17191719
1720− /* Check for previous session */
1721− prev_id = le64_to_cpu(req->PreviousSessionId);
1722− if (prev_id && prev_id != sess->id)
1723− destroy_previous_session(conn, user, prev_id);
1724−
17251720 if (sess->state == SMB2_SESSION_VALID) {
17261721 /*
17271722 * Reuse session if anonymous try to connect
@@ -1761,6 +1756,10 @@ static int ntlm_authenticate(struct ksmbd_work *work, · 33 unmodified lines
17611756 }
17621757 }
17631758
1759+ prev_id = le64_to_cpu(req->PreviousSessionId);
1760+ if (prev_id && prev_id != sess->id)
1761+ destroy_previous_session(conn, sess->user, prev_id);
1762+
17641763 /*
17651764 * If session state is SMB2_SESSION_VALID, We can assume
17661765 * that it is reauthentication. And the user/password
@@ -9596,8 +9595,7 @@ bool smb2_is_sign_req(struct ksmbd_work *work, unsigned int command) · 7829 unmodified lines
95969595 struct smb2_hdr *rcv_hdr2 = smb_get_msg(work->request_buf);
95979596
95989597 if ((rcv_hdr2->Flags & SMB2_FLAGS_SIGNED) &&
9599− command != SMB2_NEGOTIATE_HE &&
9600− command != SMB2_OPLOCK_BREAK_HE)
9598+ command != SMB2_NEGOTIATE_HE)
96019599 return true;
96029600
96039601 return false;
fs/smb/server/smbacl.c+26−10
@@ -608,7 +608,8 @@ static void parse_dacl(struct mnt_idmap *idmap, · 607 unmodified lines
608608 static void set_posix_acl_entries_dacl(struct mnt_idmap *idmap,
609609 struct smb_ace *pndace,
610610 struct smb_fattr *fattr, u16 *num_aces,
611− u16 *size, u32 nt_aces_num)
611+ u16 *size, u16 existing_nt_aces,
612+ bool had_nt_aces)
612613 {
613614 struct posix_acl_entry *pace;
614615 struct smb_sid *sid;
@@ -640,14 +641,14 @@ static void set_posix_acl_entries_dacl(struct mnt_idmap *idmap, · 25 unmodified lines
640641
641642 gid = posix_acl_gid_translate(idmap, pace);
642643 id_to_sid(gid, SIDUNIX_GROUP, sid);
643− } else if (pace->e_tag == ACL_OTHER && !nt_aces_num) {
644+ } else if (pace->e_tag == ACL_OTHER && !had_nt_aces) {
644645 smb_copy_sid(sid, &sid_everyone);
645646 } else {
646647 kfree(sid);
647648 continue;
648649 }
649650 ntace = pndace;
650− for (j = 0; j < nt_aces_num; j++) {
651+ for (j = 0; j < existing_nt_aces; j++) {
651652 if (ntace->sid.sub_auth[ntace->sid.num_subauth - 1] ==
652653 sid->sub_auth[sid->num_subauth - 1])
653654 goto pass_same_sid;
@@ -662,6 +663,7 @@ static void set_posix_acl_entries_dacl(struct mnt_idmap *idmap, · 8 unmodified lines
662663 ace_sz = fill_ace_for_sid(ntace, sid, ACCESS_ALLOWED, flags,
663664 pace->e_perm, 0777);
664665 if (check_add_overflow(*size, ace_sz, size)) {
666+ *size -= ace_sz;
665667 kfree(sid);
666668 break;
667669 }
@@ -676,6 +678,7 @@ static void set_posix_acl_entries_dacl(struct mnt_idmap *idmap, · 8 unmodified lines
676678 ace_sz = fill_ace_for_sid(ntace, sid, ACCESS_ALLOWED,
677679 0x03, pace->e_perm, 0777);
678680 if (check_add_overflow(*size, ace_sz, size)) {
681+ *size -= ace_sz;
679682 kfree(sid);
680683 break;
681684 }
@@ -689,7 +692,7 @@ pass_same_sid: · 7 unmodified lines
689692 kfree(sid);
690693 }
691694
692− if (nt_aces_num)
695+ if (had_nt_aces)
693696 return;
694697
695698 posix_default_acl:
@@ -721,6 +724,7 @@ posix_default_acl: · 25 unmodified lines
721724 ace_sz = fill_ace_for_sid(ntace, sid, ACCESS_ALLOWED, 0x0b,
722725 pace->e_perm, 0777);
723726 if (check_add_overflow(*size, ace_sz, size)) {
727+ *size -= ace_sz;
724728 kfree(sid);
725729 break;
726730 }
@@ -742,6 +746,7 @@ static void set_ntacl_dacl(struct mnt_idmap *idmap, · 15 unmodified lines
742746 {
743747 struct smb_ace *ntace, *pndace;
744748 u16 nt_num_aces = le16_to_cpu(nt_dacl->num_aces), num_aces = 0;
749+ u16 copied_nt_aces;
745750 unsigned short size = 0;
746751 int i;
747752
@@ -751,20 +756,29 @@ static void set_ntacl_dacl(struct mnt_idmap *idmap, · 3 unmodified lines
751756 for (i = 0; i < nt_num_aces; i++) {
752757 unsigned short nt_ace_size;
753758
754− if (offsetof(struct smb_ace, access_req) > aces_size)
759+ if (aces_size < offsetof(struct smb_ace, sid) +
760+ CIFS_SID_BASE_SIZE)
755761 break;
756762
757763 nt_ace_size = le16_to_cpu(ntace->size);
758− if (nt_ace_size > aces_size)
764+ if (nt_ace_size > aces_size ||
765+ nt_ace_size < offsetof(struct smb_ace, sid) +
766+ CIFS_SID_BASE_SIZE)
759767 break;
760768
761769 if (ntace->sid.num_subauth == 0 ||
762− ntace->sid.num_subauth > SID_MAX_SUB_AUTHORITIES)
770+ ntace->sid.num_subauth > SID_MAX_SUB_AUTHORITIES ||
771+ nt_ace_size < offsetof(struct smb_ace, sid) +
772+ CIFS_SID_BASE_SIZE +
773+ sizeof(__le32) *
774+ ntace->sid.num_subauth)
763775 goto next_ace;
764776
765777 memcpy((char *)pndace + size, ntace, nt_ace_size);
766− if (check_add_overflow(size, nt_ace_size, &size))
778+ if (check_add_overflow(size, nt_ace_size, &size)) {
779+ size -= nt_ace_size;
767780 break;
781+ }
768782 num_aces++;
769783
770784 next_ace:
@@ -773,8 +787,10 @@ next_ace: · 2 unmodified lines
773787 }
774788 }
775789
790+ copied_nt_aces = num_aces;
776791 set_posix_acl_entries_dacl(idmap, pndace, fattr,
777− &num_aces, &size, nt_num_aces);
792+ &num_aces, &size, copied_nt_aces,
793+ nt_num_aces != 0);
778794 pndacl->num_aces = cpu_to_le16(num_aces);
779795 pndacl->size = cpu_to_le16(le16_to_cpu(pndacl->size) + size);
780796 }
@@ -792,7 +808,7 @@ static void set_mode_dacl(struct mnt_idmap *idmap, · 11 unmodified lines
792808
793809 if (fattr->cf_acls) {
794810 set_posix_acl_entries_dacl(idmap, pndace, fattr,
795− &num_aces, &size, num_aces);
811+ &num_aces, &size, num_aces, false);
796812 goto out;
797813 }
798814
fs/smb/server/vfs.c+1−25
@@ -1886,10 +1886,6 @@ int ksmbd_vfs_inherit_posix_acl(struct mnt_idmap *idmap, · 1885 unmodified lines
18861886 const struct path *path, struct inode *parent_inode)
18871887 {
18881888 struct posix_acl *acls;
1889− struct posix_acl_entry *pace;
1890− struct dentry *dentry = path->dentry;
1891− struct inode *inode = d_inode(dentry);
1892− int rc, i;
18931889
18941890 if (!IS_ENABLED(CONFIG_FS_POSIX_ACL))
18951891 return -EOPNOTSUPP;
@@ -1897,29 +1893,9 @@ int ksmbd_vfs_inherit_posix_acl(struct mnt_idmap *idmap, · 1 unmodified line
18971893 acls = get_inode_acl(parent_inode, ACL_TYPE_DEFAULT);
18981894 if (IS_ERR_OR_NULL(acls))
18991895 return -ENOENT;
1900− pace = acls->a_entries;
1901−
1902− for (i = 0; i < acls->a_count; i++, pace++) {
1903− if (pace->e_tag == ACL_MASK) {
1904− pace->e_perm = 0x07;
1905− break;
1906− }
1907− }
1908−
1909− rc = set_posix_acl(idmap, dentry, ACL_TYPE_ACCESS, acls);
1910− if (rc < 0)
1911− ksmbd_debug(SMB, "Set posix acl(ACL_TYPE_ACCESS) failed, rc : %d\n",
1912− rc);
1913− if (S_ISDIR(inode->i_mode)) {
1914− rc = set_posix_acl(idmap, dentry, ACL_TYPE_DEFAULT,
1915− acls);
1916− if (rc < 0)
1917− ksmbd_debug(SMB, "Set posix acl(ACL_TYPE_DEFAULT) failed, rc : %d\n",
1918− rc);
1919− }
19201896
19211897 posix_acl_release(acls);
1922− return rc;
1898+ return 0;
19231899 }
19241900
19251901 void ksmbd_vfs_update_compressed_fattr(struct dentry *dentry, __le32 *fattr)
fs/super.c+20−14
@@ -1082,18 +1082,35 @@ void emergency_remount(void) · 1081 unmodified lines
10821082 }
10831083 }
10841084
1085+static inline bool get_active_super(struct super_block *sb)
1086+{
1087+ bool active = false;
1088+
1089+ if (super_lock_excl(sb)) {
1090+ active = atomic_inc_not_zero(&sb->s_active);
1091+ super_unlock_excl(sb);
1092+ }
1093+ return active;
1094+}
1095+
10851096 static void do_thaw_all_callback(struct super_block *sb, void *unused)
10861097 {
1098+ if (!get_active_super(sb))
1099+ return;
1100+
1101+ /* fs_bdev_thaw() acquires s_umount so it must not be held here */
10871102 if (IS_ENABLED(CONFIG_BLOCK))
10881103 while (sb->s_bdev && !bdev_thaw(sb->s_bdev))
10891104 pr_warn("Emergency Thaw on %pg\n", sb->s_bdev);
1090− thaw_super_locked(sb, FREEZE_HOLDER_USERSPACE, NULL);
1091− return;
1105+
1106+ if (super_lock_excl(sb))
1107+ thaw_super_locked(sb, FREEZE_HOLDER_USERSPACE, NULL);
1108+ deactivate_super(sb);
10921109 }
10931110
10941111 static void do_thaw_all(struct work_struct *work)
10951112 {
1096− __iterate_supers(do_thaw_all_callback, NULL, SUPER_ITER_EXCL);
1113+ __iterate_supers(do_thaw_all_callback, NULL, SUPER_ITER_UNLOCKED);
10971114 kfree(work);
10981115 printk(KERN_WARNING "Emergency Thaw complete\n");
10991116 }
@@ -1114,17 +1131,6 @@ void emergency_thaw_all(void) · 14 unmodified lines
11141131 }
11151132 }
11161133
1117−static inline bool get_active_super(struct super_block *sb)
1118−{
1119− bool active = false;
1120−
1121− if (super_lock_excl(sb)) {
1122− active = atomic_inc_not_zero(&sb->s_active);
1123− super_unlock_excl(sb);
1124− }
1125− return active;
1126−}
1127−
11281134 static const char *filesystems_freeze_ptr = "filesystems_freeze";
11291135
11301136 static void filesystems_freeze_callback(struct super_block *sb, void *freeze_all_ptr)
include/drm/ttm/ttm_backup.h+6−6
@@ -13,9 +13,8 @@ · 12 unmodified lines
1313 * ttm_backup_handle_to_page_ptr() - Convert handle to struct page pointer
1414 * @handle: The handle to convert.
1515 *
16− * Converts an opaque handle received from the
17− * ttm_backup_backup_page() function to an (invalid)
18− * struct page pointer suitable for a struct page array.
16+ * Converts an opaque handle received from a ttm_backup_backup_*()
17+ * function to an (invalid) struct page pointer suitable for a struct page array.
1918 *
2019 * Return: An (invalid) struct page pointer.
2120 */
@@ -59,9 +58,10 @@ int ttm_backup_copy_page(struct file *backup, struct page *dst, · 37 unmodified lines
5958 pgoff_t handle, bool intr, gfp_t additional_gfp);
6059
6160 s64
62−ttm_backup_backup_page(struct file *backup, struct page *page,
63− bool writeback, pgoff_t idx, gfp_t page_gfp,
64− gfp_t alloc_gfp);
61+ttm_backup_backup_folio(struct file *backup, struct folio *folio,
62+ unsigned int order, bool writeback, pgoff_t idx,
63+ gfp_t folio_gfp, gfp_t alloc_gfp,
64+ pgoff_t *nr_pages_backed);
6565
6666 void ttm_backup_fini(struct file *backup);
6767
include/linux/alloc_tag.h+3−0
@@ -134,6 +134,8 @@ static inline bool mem_alloc_profiling_enabled(void) · 133 unmodified lines
134134 &mem_alloc_profiling_key);
135135 }
136136
137+bool mem_alloc_profiling_permanently_disabled(void);
138+
137139 static inline struct alloc_tag_counters alloc_tag_read(struct alloc_tag *tag)
138140 {
139141 struct alloc_tag_counters v = { 0, 0 };
@@ -239,6 +241,7 @@ static inline bool alloc_tag_is_inaccurate(struct alloc_tag *tag) · 99 unmodified lines
239241
240242 #define DEFINE_ALLOC_TAG(_alloc_tag)
241243 static inline bool mem_alloc_profiling_enabled(void) { return false; }
244+static inline bool mem_alloc_profiling_permanently_disabled(void) { return true; }
242245 static inline void alloc_tag_add(union codetag_ref *ref, struct alloc_tag *tag,
243246 size_t bytes) {}
244247 static inline void alloc_tag_sub(union codetag_ref *ref, size_t bytes) {}
include/linux/bnge/hsi.h+3−4
@@ -8317,8 +8317,7 @@ struct hwrm_ring_alloc_output { · 8316 unmodified lines
83178317 __le16 req_type;
83188318 __le16 seq_id;
83198319 __le16 resp_len;
8320− __le16 ring_id;
8321− __le16 logical_ring_id;
8320+ __le32 ring_id;
83228321 u8 push_buffer_index;
83238322 #define RING_ALLOC_RESP_PUSH_BUFFER_INDEX_PING_BUFFER 0x0UL
83248323 #define RING_ALLOC_RESP_PUSH_BUFFER_INDEX_PONG_BUFFER 0x1UL
@@ -8345,10 +8344,10 @@ struct hwrm_ring_free_input { · 20 unmodified lines
83458344 u8 flags;
83468345 #define RING_FREE_REQ_FLAGS_VIRTIO_RING_VALID 0x1UL
83478346 #define RING_FREE_REQ_FLAGS_LAST RING_FREE_REQ_FLAGS_VIRTIO_RING_VALID
8348− __le16 ring_id;
8347+ __le16 unused_1;
83498348 __le32 prod_idx;
83508349 __le32 opaque;
8351− __le32 unused_1;
8350+ __le32 ring_id;
83528351 };
83538352
83548353 /* hwrm_ring_free_output (size:128b/16B) */
include/linux/damon.h+0−2
@@ -1,8 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * DAMON api
4− *
5− * Author: SeongJae Park <sj@kernel.org>
64 */
75
86 #ifndef _DAMON_H_
include/linux/firmware/intel/stratix10-smc.h+11−5
@@ -67,6 +67,9 @@ · 66 unmodified lines
6767 * INTEL_SIP_SMC_STATUS_REJECTED:
6868 * Secure monitor software reject the service client's request.
6969 *
70+ * INTEL_SIP_SMC_STATUS_NO_RESPONSE:
71+ * Secure monitor software has no response for the request yet.
72+ *
7073 * INTEL_SIP_SMC_STATUS_ERROR:
7174 * There is error during the process of service request.
7275 *
@@ -77,6 +80,7 @@ · 4 unmodified lines
7780 #define INTEL_SIP_SMC_STATUS_OK 0x0
7881 #define INTEL_SIP_SMC_STATUS_BUSY 0x1
7982 #define INTEL_SIP_SMC_STATUS_REJECTED 0x2
83+#define INTEL_SIP_SMC_STATUS_NO_RESPONSE 0x3
8084 #define INTEL_SIP_SMC_STATUS_ERROR 0x4
8185 #define INTEL_SIP_SMC_RSU_ERROR 0x7
8286
@@ -606,7 +610,7 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE) · 523 unmodified lines
606610
607611 /**
608612 * Request INTEL_SIP_SMC_FUNCID_FCS_SEND_CERTIFICATE
609− * Sync call to send a signed certificate
613+ * Async call to send a signed certificate
610614 *
611615 * Call register usage:
612616 * a0 INTEL_SIP_SMC_FCS_SEND_CERTIFICATE
@@ -615,7 +619,7 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE) · 2 unmodified lines
615619 * a3-a7 not used
616620 *
617621 * Return status:
618− * a0 INTEL_SIP_SMC_STATUS_OK or INTEL_SIP_SMC_FCS_REJECTED
622+ * a0 INTEL_SIP_SMC_STATUS_OK or INTEL_SIP_SMC_REJECTED
619623 * a1-a3 not used
620624 */
621625 #define INTEL_SIP_SMC_FUNCID_FCS_SEND_CERTIFICATE 93
@@ -631,9 +635,11 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE) · 9 unmodified lines
631635 * a1-a7 not used
632636 *
633637 * Return status:
634− * a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_FCS_ERROR or
635− * INTEL_SIP_SMC_FCS_REJECTED
636− * a1-a3 not used
638+ * a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_STATUS_ERROR or
639+ * INTEL_SIP_SMC_STATUS_REJECTED
640+ * a1 mailbox error if a0 is INTEL_SIP_SMC_STATUS_ERROR
641+ * a2 physical address for the structure of fuse and key hashes
642+ * a3 the size of structure
637643 *
638644 */
639645 #define INTEL_SIP_SMC_FUNCID_FCS_GET_PROVISION_DATA 94
include/linux/fscrypt.h+10−8
@@ -57,6 +57,9 @@ struct fscrypt_name { · 56 unmodified lines
5757 /* Maximum value for the third parameter of fscrypt_operations.set_context(). */
5858 #define FSCRYPT_SET_CONTEXT_MAX_SIZE 40
5959
60+/* Maximum supported number of block devices per filesystem */
61+#define FSCRYPT_MAX_DEVICES 8
62+
6063 #ifdef CONFIG_FS_ENCRYPTION
6164
6265 /* Crypto operations for filesystems */
@@ -181,21 +184,20 @@ struct fscrypt_operations { · 118 unmodified lines
181184 bool (*has_stable_inodes)(struct super_block *sb);
182185
183186 /*
184− * Return an array of pointers to the block devices to which the
185− * filesystem may write encrypted file contents, NULL if the filesystem
186− * only has a single such block device, or an ERR_PTR() on error.
187+ * Retrieve the list of block devices to which the filesystem may write
188+ * encrypted file contents.
187189 *
188− * On successful non-NULL return, *num_devs is set to the number of
189− * devices in the returned array. The caller must free the returned
190− * array using kfree().
190+ * This writes the block_device pointers to @devs and returns the count
191+ * (between 1 and FSCRYPT_MAX_DEVICES inclusively).
191192 *
192193 * If the filesystem can use multiple block devices (other than block
193194 * devices that aren't used for encrypted file contents, such as
194195 * external journal devices), and wants to support inline encryption,
195196 * then it must implement this function. Otherwise it's not needed.
196197 */
197− struct block_device **(*get_devices)(struct super_block *sb,
198− unsigned int *num_devs);
198+ unsigned int (*get_devices)(
199+ struct super_block *sb,
200+ struct block_device *devs[FSCRYPT_MAX_DEVICES]);
199201 };
200202
201203 int fscrypt_d_revalidate(struct inode *dir, const struct qstr *name,
include/linux/memcontrol.h+21−0
@@ -520,6 +520,22 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg) · 519 unmodified lines
520520 return (memcg == root_mem_cgroup);
521521 }
522522
523+/**
524+ * mem_cgroup_shrink_is_root - is this a global or root-memcg shrink invocation?
525+ * @sc: shrink_control describing the current shrinker call
526+ *
527+ * Returns true when @sc represents a global reclaim shrink (sc->memcg == NULL)
528+ * or a root-memcg shrink, i.e. not a per-memcg iteration of
529+ * shrink_slab_memcg(). Filesystems whose ->nr_cached_objects()/
530+ * ->free_cached_objects() implementations operate on filesystem-global state
531+ * and do not honour sc->memcg can use this to early-return 0 in per-memcg
532+ * contexts.
533+ */
534+static inline bool mem_cgroup_shrink_is_root(struct shrink_control *sc)
535+{
536+ return !sc->memcg || mem_cgroup_is_root(sc->memcg);
537+}
538+
523539 static inline bool obj_cgroup_is_root(const struct obj_cgroup *objcg)
524540 {
525541 return objcg->is_root;
@@ -1071,6 +1087,11 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg) · 545 unmodified lines
10711087 return true;
10721088 }
10731089
1090+static inline bool mem_cgroup_shrink_is_root(struct shrink_control *sc)
1091+{
1092+ return true;
1093+}
1094+
10741095 static inline bool obj_cgroup_is_root(const struct obj_cgroup *objcg)
10751096 {
10761097 return true;
include/linux/mlx5/mlx5_ifc.h+1−12
@@ -12215,18 +12215,7 @@ struct mlx5_ifc_mcia_reg_bits { · 12214 unmodified lines
1221512215
1221612216 u8 reserved_at_60[0x20];
1221712217
12218− u8 dword_0[0x20];
12219− u8 dword_1[0x20];
12220− u8 dword_2[0x20];
12221− u8 dword_3[0x20];
12222− u8 dword_4[0x20];
12223− u8 dword_5[0x20];
12224− u8 dword_6[0x20];
12225− u8 dword_7[0x20];
12226− u8 dword_8[0x20];
12227− u8 dword_9[0x20];
12228− u8 dword_10[0x20];
12229− u8 dword_11[0x20];
12218+ u8 dwords[0x400];
1223012219 };
1223112220
1223212221 struct mlx5_ifc_dcbx_param_bits {
include/linux/page_reporting.h+3−1
@@ -5,7 +5,6 @@ · 4 unmodified lines
55 #include <linux/mmzone.h>
66 #include <linux/scatterlist.h>
77
8−/* This value should always be a power of 2, see page_reporting_cycle() */
98 #define PAGE_REPORTING_CAPACITY 32
109 #define PAGE_REPORTING_ORDER_UNSPECIFIED -1
1110
@@ -22,6 +21,9 @@ struct page_reporting_dev_info { · 10 unmodified lines
2221
2322 /* Minimal order of page reporting */
2423 unsigned int order;
24+
25+ /* Max pages per report batch; 0 (default) means PAGE_REPORTING_CAPACITY */
26+ unsigned int capacity;
2527 };
2628
2729 /* Tear-down and bring-up for page reporting devices */
include/linux/slab.h+22−3
@@ -58,10 +58,13 @@ enum _slab_flag_bits { · 57 unmodified lines
5858 #endif
5959 _SLAB_OBJECT_POISON,
6060 _SLAB_CMPXCHG_DOUBLE,
61+#ifdef CONFIG_SLAB_OBJ_EXT
6162 _SLAB_NO_OBJ_EXT,
62−#if defined(CONFIG_SLAB_OBJ_EXT) && defined(CONFIG_64BIT)
63+#ifdef CONFIG_64BIT
6364 _SLAB_OBJ_EXT_IN_OBJ,
6465 #endif
66+#endif
67+ _SLAB_NO_SHEAVES,
6568 _SLAB_FLAGS_LAST_BIT
6669 };
6770
@@ -239,8 +242,14 @@ enum _slab_flag_bits { · 171 unmodified lines
239242 #endif
240243 #define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */
241244
242−/* Slab created using create_boot_cache */
245+/* Slab caches without obj_exts array */
246+#ifdef CONFIG_SLAB_OBJ_EXT
243247 #define SLAB_NO_OBJ_EXT __SLAB_FLAG_BIT(_SLAB_NO_OBJ_EXT)
248+#else
249+#define SLAB_NO_OBJ_EXT __SLAB_FLAG_UNUSED
250+#endif
251+
252+#define SLAB_NO_SHEAVES __SLAB_FLAG_BIT(_SLAB_NO_SHEAVES)
244253
245254 #if defined(CONFIG_SLAB_OBJ_EXT) && defined(CONFIG_64BIT)
246255 #define SLAB_OBJ_EXT_IN_OBJ __SLAB_FLAG_BIT(_SLAB_OBJ_EXT_IN_OBJ)
@@ -505,8 +514,12 @@ typedef struct { unsigned long v; } kmalloc_token_t; · 258 unmodified lines
505514 extern unsigned long random_kmalloc_seed;
506515 #define __kmalloc_token(...) ((kmalloc_token_t){ .v = _CODE_LOCATION_ })
507516 #elif defined(CONFIG_KMALLOC_PARTITION_TYPED)
517+#ifdef __CHECKER__
518+#define __kmalloc_token(...) ((kmalloc_token_t){ .v = 0 })
519+#else /* !__CHECKER__ */
508520 #define __kmalloc_token(...) ((kmalloc_token_t){ .v = __builtin_infer_alloc_token(__VA_ARGS__) })
509−#endif
521+#endif /* __CHECKER__ */
522+#endif /* CONFIG_KMALLOC_PARTITION_TYPED */
510523 #define DECL_TOKEN_PARAM(_token) , kmalloc_token_t (_token)
511524 #define _PASS_TOKEN_PARAM(_token) , (_token)
512525 #define PASS_TOKEN_PARAM(_token) (_token)
@@ -699,6 +712,9 @@ enum kmalloc_cache_type { · 186 unmodified lines
699712 #endif
700713 #ifndef CONFIG_MEMCG
701714 KMALLOC_CGROUP = KMALLOC_NORMAL,
715+#endif
716+#ifndef CONFIG_SLAB_OBJ_EXT
717+ KMALLOC_NO_OBJ_EXT = KMALLOC_NORMAL,
702718 #endif
703719 KMALLOC_PARTITION_START = KMALLOC_NORMAL,
704720 KMALLOC_PARTITION_END = KMALLOC_PARTITION_START + KMALLOC_PARTITION_CACHES_NR,
@@ -712,6 +728,9 @@ enum kmalloc_cache_type { · 7 unmodified lines
712728 #endif
713729 #ifdef CONFIG_MEMCG
714730 KMALLOC_CGROUP,
731+#endif
732+#ifdef CONFIG_SLAB_OBJ_EXT
733+ KMALLOC_NO_OBJ_EXT,
715734 #endif
716735 NR_KMALLOC_TYPES
717736 };
include/net/bluetooth/rfcomm.h+3−0
@@ -226,6 +226,9 @@ int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, · 225 unmodified lines
226226 u8 bit_rate, u8 data_bits, u8 stop_bits,
227227 u8 parity, u8 flow_ctrl_settings,
228228 u8 xon_char, u8 xoff_char, u16 param_mask);
229+int rfcomm_dlc_send_rpn(struct rfcomm_dlc *d, u8 bit_rate, u8 data_bits,
230+ u8 stop_bits, u8 parity, u8 flow_ctrl_settings,
231+ u8 xon_char, u8 xoff_char, u16 param_mask);
229232
230233 /* ---- RFCOMM DLCs (channels) ---- */
231234 struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio);
include/net/pkt_cls.h+13−1
@@ -156,8 +156,20 @@ static inline int tcf_classify(struct sk_buff *skb, · 155 unmodified lines
156156 {
157157 return TC_ACT_UNSPEC;
158158 }
159−
160159 #endif
160+static inline int tcf_classify_qdisc(struct sk_buff *skb,
161+ const struct tcf_proto *tp,
162+ struct tcf_result *res, bool compat_mode)
163+{
164+ int ret = tcf_classify(skb, NULL, tp, res, compat_mode);
165+
166+ /* TC_ACT_REDIRECT from qdisc filter chains is not supported.
167+ * Use BPF via tcx or mirred redirect instead.
168+ */
169+ if (unlikely(ret == TC_ACT_REDIRECT))
170+ ret = TC_ACT_SHOT;
171+ return ret;
172+}
161173
162174 static inline unsigned long
163175 __cls_set_class(unsigned long *clp, unsigned long cl)
include/net/tcp.h+2−0
@@ -1974,6 +1974,8 @@ static inline void tcp_fast_path_check(struct sock *sk) · 1973 unmodified lines
19741974
19751975 bool tcp_oow_rate_limited(struct net *net, const struct sk_buff *skb,
19761976 int mib_idx, u32 *last_oow_ack_time);
1977+void tcp_reqsk_send_challenge_ack(struct sock *sk, struct sk_buff *skb,
1978+ struct request_sock *req);
19771979
19781980 static inline void tcp_mib_init(struct net *net)
19791981 {
include/sound/sdca_fdl.h+2−0
@@ -67,6 +67,8 @@ struct fdl_state { · 66 unmodified lines
6767 #if IS_ENABLED(CONFIG_SND_SOC_SDCA_FDL)
6868
6969 int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt);
70+void sdca_fdl_free_state(struct sdca_interrupt *interrupt);
71+
7072 int sdca_fdl_process(struct sdca_interrupt *interrupt);
7173 int sdca_fdl_sync(struct device *dev, struct sdca_function_data *function,
7274 struct sdca_interrupt_info *info);
include/sound/sdca_interrupts.h+12−2
@@ -30,9 +30,12 @@ struct sdca_function_data; · 29 unmodified lines
3030 * @function: Pointer to the Function that the interrupt is associated with.
3131 * @entity: Pointer to the Entity that the interrupt is associated with.
3232 * @control: Pointer to the Control that the interrupt is associated with.
33+ * @handler: Handler function to be called for the IRQ.
3334 * @priv: Pointer to private data for use by the handler.
35+ * @free_priv: Pointer to a function that can be used to free the priv data.
3436 * @irq: IRQ number allocated to this interrupt, also used internally to track
3537 * the IRQ being assigned.
38+ * @early_request: Flag to indicate this IRQ was requested at bus probe time.
3639 */
3740 struct sdca_interrupt {
3841 const char *name;
@@ -44,10 +47,13 @@ struct sdca_interrupt { · 5 unmodified lines
4447 struct sdca_function_data *function;
4548 struct sdca_entity *entity;
4649 struct sdca_control *control;
50+ irq_handler_t handler;
4751
4852 void *priv;
53+ void (*free_priv)(struct sdca_interrupt *interrupt);
4954
5055 int irq;
56+ bool early_request;
5157 };
5258
5359 /**
@@ -86,8 +92,12 @@ int sdca_irq_populate(struct sdca_function_data *function, · 32 unmodified lines
8692 void sdca_irq_cleanup(struct device *dev,
8793 struct sdca_function_data *function,
8894 struct sdca_interrupt_info *info);
89−struct sdca_interrupt_info *sdca_irq_allocate(struct device *dev,
90− struct regmap *regmap, int irq);
95+void sdca_irq_cleanup_late(struct device *dev,
96+ struct sdca_function_data *function,
97+ struct sdca_interrupt_info *info);
98+
99+struct sdca_interrupt_info *devm_sdca_irq_allocate(struct device *dev,
100+ struct regmap *regmap, int irq);
91101
92102 void sdca_irq_enable_early(struct sdca_function_data *function,
93103 struct sdca_interrupt_info *info);
include/sound/sdca_jack.h+3−0
@@ -28,6 +28,9 @@ struct jack_state { · 27 unmodified lines
2828 };
2929
3030 int sdca_jack_alloc_state(struct sdca_interrupt *interrupt);
31+int sdca_jack_init_state(struct sdca_interrupt *interrupt);
32+void sdca_jack_free_state(struct sdca_interrupt *interrupt);
33+
3134 int sdca_jack_process(struct sdca_interrupt *interrupt);
3235 int sdca_jack_set_jack(struct sdca_interrupt_info *info, struct snd_soc_jack *jack);
3336 int sdca_jack_report(struct sdca_interrupt *interrupt);
include/sound/soc-component.h+2−0
@@ -78,6 +78,7 @@ struct snd_soc_component_driver { · 77 unmodified lines
7878 unsigned int num_dapm_routes;
7979
8080 int (*probe)(struct snd_soc_component *component);
81+ int (*fixup_controls)(struct snd_soc_component *component);
8182 void (*remove)(struct snd_soc_component *component);
8283 int (*suspend)(struct snd_soc_component *component);
8384 int (*resume)(struct snd_soc_component *component);
@@ -380,6 +381,7 @@ void snd_soc_component_suspend(struct snd_soc_component *component); · 296 unmodified lines
380381 void snd_soc_component_resume(struct snd_soc_component *component);
381382 int snd_soc_component_is_suspended(struct snd_soc_component *component);
382383 int snd_soc_component_probe(struct snd_soc_component *component);
384+int snd_soc_component_fixup_controls(struct snd_soc_component *component);
383385 void snd_soc_component_remove(struct snd_soc_component *component);
384386 int snd_soc_component_of_xlate_dai_id(struct snd_soc_component *component,
385387 struct device_node *ep);
include/trace/events/memory-failure.h+5−1
@@ -1,6 +1,10 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 #undef TRACE_SYSTEM
3−#define TRACE_SYSTEM memory_failure
3+/*
4+ * For historical versions, memory_failure_event is in ras subsystem,
5+ * some user programs depend on it.
6+ */
7+#define TRACE_SYSTEM ras
48 #define TRACE_INCLUDE_FILE memory-failure
59
610 #if !defined(_TRACE_MEMORY_FAILURE_H) || defined(TRACE_HEADER_MULTI_READ)
include/uapi/linux/btrfs.h+1−1
@@ -598,7 +598,7 @@ struct btrfs_ioctl_search_args_v2 { · 597 unmodified lines
598598 __u64 buf_size; /* in - size of buffer
599599 * out - on EOVERFLOW: needed size
600600 * to store item */
601− __u64 buf[]; /* out - found items */
601+ __u8 buf[]; /* out - found items */
602602 };
603603
604604 /* With a @src_length of zero, the range from @src_offset->EOF is cloned! */
include/uapi/linux/io_uring/query.h+7−7
@@ -23,7 +23,7 @@ enum { · 22 unmodified lines
2323 IO_URING_QUERY_OPCODES = 0,
2424 IO_URING_QUERY_ZCRX = 1,
2525 IO_URING_QUERY_SCQ = 2,
26− IO_URING_QUERY_ZCRX_NOTIF = 3,
26+ IO_URING_QUERY_ZCRX_EVENT = 3,
2727
2828 __IO_URING_QUERY_MAX,
2929 };
@@ -63,13 +63,13 @@ struct io_uring_query_zcrx { · 33 unmodified lines
6363 __u64 __resv2;
6464 };
6565
66−struct io_uring_query_zcrx_notif {
67− /* Bitmask of supported ZCRX_NOTIF_* flags */
68− __u32 notif_flags;
69− /* Size of io_uring_zcrx_notif_stats */
70− __u32 notif_stats_size;
66+struct io_uring_query_zcrx_event {
67+ /* Bitmask of supported ZCRX_EVENT_* flags */
68+ __u32 event_flags;
69+ /* Size of zcrx_stats */
70+ __u32 stats_size;
7171 /* Required alignment for the stats struct within the region (ie stats_offset) */
72− __u32 notif_stats_off_alignment;
72+ __u32 stats_off_alignment;
7373 __u32 __resv1;
7474 __u64 __resv2[4];
7575 };
include/uapi/linux/io_uring/zcrx.h+16−16
@@ -65,30 +65,30 @@ enum zcrx_features { · 64 unmodified lines
6565 * value in struct io_uring_zcrx_ifq_reg::rx_buf_len.
6666 */
6767 ZCRX_FEATURE_RX_PAGE_SIZE = 1 << 0,
68− ZCRX_FEATURE_NOTIFICATION = 1 << 1,
68+ ZCRX_FEATURE_EVENT = 1 << 1,
6969 };
7070
71−enum zcrx_notification_type {
72− ZCRX_NOTIF_NO_BUFFERS,
73− ZCRX_NOTIF_COPY,
71+enum zcrx_event_type {
72+ ZCRX_EVENT_ALLOC_FAIL,
73+ ZCRX_EVENT_COPY,
7474
75− __ZCRX_NOTIF_TYPE_LAST,
75+ __ZCRX_EVENT_TYPE_LAST,
7676 };
7777
78−enum zcrx_notification_desc_flags {
79− /* If set, stats_offset holds a valid offset to a notif_stats struct */
80− ZCRX_NOTIF_DESC_FLAG_STATS = 1 << 0,
78+enum zcrx_event_desc_flags {
79+ /* If set, stats_offset holds a valid offset to a zcrx_stats struct */
80+ ZCRX_EVENT_DESC_FLAG_STATS = 1 << 0,
8181 };
8282
83−struct zcrx_notif_stats {
83+struct zcrx_stats {
8484 __u64 copy_count; /* cumulative copy-fallback CQEs */
8585 __u64 copy_bytes; /* cumulative bytes copied */
8686 };
8787
88−struct zcrx_notification_desc {
88+struct zcrx_event_desc {
8989 __u64 user_data;
9090 __u32 type_mask;
91− __u32 flags; /* see enum zcrx_notification_desc_flags */
91+ __u32 flags; /* see enum zcrx_event_desc_flags */
9292 __u64 stats_offset; /* offset from the beginning of refill ring region for stats */
9393 __u64 __resv2[9];
9494 };
@@ -108,14 +108,14 @@ struct io_uring_zcrx_ifq_reg { · 13 unmodified lines
108108 struct io_uring_zcrx_offsets offsets;
109109 __u32 zcrx_id;
110110 __u32 rx_buf_len;
111− __u64 notif_desc; /* see struct zcrx_notification_desc */
111+ __u64 event_desc; /* see struct zcrx_event_desc */
112112 __u64 __resv[2];
113113 };
114114
115115 enum zcrx_ctrl_op {
116116 ZCRX_CTRL_FLUSH_RQ,
117117 ZCRX_CTRL_EXPORT,
118− ZCRX_CTRL_ARM_NOTIFICATION,
118+ ZCRX_CTRL_ARM_EVENT,
119119
120120 __ZCRX_CTRL_LAST,
121121 };
@@ -129,8 +129,8 @@ struct zcrx_ctrl_export { · 7 unmodified lines
129129 __u32 __resv1[11];
130130 };
131131
132−struct zcrx_ctrl_arm_notif {
133− __u32 notif_type;
132+struct zcrx_ctrl_arm_event {
133+ __u32 event_type; /* see enum zcrx_event_type */
134134 __u32 __resv[11];
135135 };
136136
@@ -142,7 +142,7 @@ struct zcrx_ctrl { · 5 unmodified lines
142142 union {
143143 struct zcrx_ctrl_export zc_export;
144144 struct zcrx_ctrl_flush_rq zc_flush;
145− struct zcrx_ctrl_arm_notif zc_arm_notif;
145+ struct zcrx_ctrl_arm_event zc_arm_event;
146146 };
147147 };
148148
init/Kconfig+3−0
@@ -190,6 +190,9 @@ config RUSTC_HAS_FILE_WITH_NUL · 189 unmodified lines
190190 config RUSTC_HAS_FILE_AS_C_STR
191191 def_bool RUSTC_VERSION >= 109100
192192
193+config RUSTC_HAS_SUSPICIOUS_RUNTIME_SYMBOL_DEFINITIONS
194+ def_bool RUSTC_VERSION >= 109800
195+
193196 config PAHOLE_VERSION
194197 int
195198 default "$(PAHOLE_VERSION)"
io_uring/query.c+6−6
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 union io_query_data {
1010 struct io_uring_query_opcode opcodes;
1111 struct io_uring_query_zcrx zcrx;
12− struct io_uring_query_zcrx_notif zcrx_notif;
12+ struct io_uring_query_zcrx_event zcrx_notif;
1313 struct io_uring_query_scq scq;
1414 };
1515
@@ -47,11 +47,11 @@ static ssize_t io_query_zcrx(union io_query_data *data) · 31 unmodified lines
4747
4848 static ssize_t io_query_zcrx_notif(union io_query_data *data)
4949 {
50− struct io_uring_query_zcrx_notif *e = &data->zcrx_notif;
50+ struct io_uring_query_zcrx_event *e = &data->zcrx_notif;
5151
52− e->notif_flags = ZCRX_NOTIF_TYPE_MASK;
53− e->notif_stats_size = sizeof(struct zcrx_notif_stats);
54− e->notif_stats_off_alignment = __alignof__(struct zcrx_notif_stats);
52+ e->event_flags = ZCRX_EVENT_TYPE_MASK;
53+ e->stats_size = sizeof(struct zcrx_stats);
54+ e->stats_off_alignment = __alignof__(struct zcrx_stats);
5555 e->__resv1 = 0;
5656 memset(&e->__resv2, 0, sizeof(e->__resv2));
5757 return sizeof(*e);
@@ -96,7 +96,7 @@ static int io_handle_query_entry(union io_query_data *data, void __user *uhdr, · 38 unmodified lines
9696 case IO_URING_QUERY_ZCRX:
9797 ret = io_query_zcrx(data);
9898 break;
99− case IO_URING_QUERY_ZCRX_NOTIF:
99+ case IO_URING_QUERY_ZCRX_EVENT:
100100 ret = io_query_zcrx_notif(data);
101101 break;
102102 case IO_URING_QUERY_SCQ:
io_uring/rw.c+25−17
@@ -615,6 +615,24 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res) · 614 unmodified lines
615615 smp_store_release(&req->iopoll_completed, 1);
616616 }
617617
618+static inline ssize_t io_fixup_restart_res(ssize_t ret)
619+{
620+ switch (ret) {
621+ case -ERESTARTSYS:
622+ case -ERESTARTNOINTR:
623+ case -ERESTARTNOHAND:
624+ case -ERESTART_RESTARTBLOCK:
625+ /*
626+ * We can't just restart the syscall, since previously
627+ * submitted sqes may already be in progress. Just fail
628+ * this IO with EINTR.
629+ */
630+ return -EINTR;
631+ default:
632+ return ret;
633+ }
634+}
635+
618636 static inline void io_rw_done(struct io_kiocb *req, ssize_t ret)
619637 {
620638 struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
@@ -624,21 +642,8 @@ static inline void io_rw_done(struct io_kiocb *req, ssize_t ret) · 3 unmodified lines
624642 return;
625643
626644 /* transform internal restart error codes */
627− if (unlikely(ret < 0)) {
628− switch (ret) {
629− case -ERESTARTSYS:
630− case -ERESTARTNOINTR:
631− case -ERESTARTNOHAND:
632− case -ERESTART_RESTARTBLOCK:
633− /*
634− * We can't just restart the syscall, since previously
635− * submitted sqes may already be in progress. Just fail
636− * this IO with EINTR.
637− */
638− ret = -EINTR;
639− break;
640− }
641− }
645+ if (unlikely(ret < 0))
646+ ret = io_fixup_restart_res(ret);
642647
643648 if (req->flags & REQ_F_IOPOLL)
644649 io_complete_rw_iopoll(&rw->kiocb, ret);
@@ -1034,7 +1039,8 @@ int io_read(struct io_kiocb *req, unsigned int issue_flags) · 389 unmodified lines
10341039
10351040 if (req->flags & REQ_F_BUFFERS_COMMIT)
10361041 io_kbuf_recycle(req, sel.buf_list, issue_flags);
1037− return ret;
1042+
1043+ return io_fixup_restart_res(ret);
10381044 }
10391045
10401046 int io_read_mshot(struct io_kiocb *req, unsigned int issue_flags)
@@ -1068,8 +1074,10 @@ int io_read_mshot(struct io_kiocb *req, unsigned int issue_flags) · 27 unmodified lines
10681074 return IOU_RETRY;
10691075 } else if (ret <= 0) {
10701076 io_kbuf_recycle(req, sel.buf_list, issue_flags);
1071− if (ret < 0)
1077+ if (ret < 0) {
1078+ ret = io_fixup_restart_res(ret);
10721079 req_set_fail(req);
1080+ }
10731081 } else if (!(req->flags & REQ_F_APOLL_MULTISHOT)) {
10741082 cflags = io_put_kbuf(req, ret, sel.buf_list);
10751083 } else {
io_uring/zcrx.c+17−17
@@ -766,7 +766,7 @@ static int import_zcrx(struct io_ring_ctx *ctx, · 765 unmodified lines
766766 return -EINVAL;
767767 if (reg->if_rxq || reg->rq_entries || reg->area_ptr || reg->region_ptr)
768768 return -EINVAL;
769− if (reg->notif_desc)
769+ if (reg->event_desc)
770770 return -EINVAL;
771771 if (reg->flags & ~ZCRX_REG_IMPORT)
772772 return -EINVAL;
@@ -855,7 +855,7 @@ netdev_put_unlock: · 82 unmodified lines
855855
856856 static int zcrx_validate_notif_stats(struct io_zcrx_ifq *ifq,
857857 const struct io_uring_zcrx_ifq_reg *reg,
858− const struct zcrx_notification_desc *notif)
858+ const struct zcrx_event_desc *notif)
859859 {
860860 size_t stats_off = notif->stats_offset;
861861 size_t used, end;
@@ -863,12 +863,12 @@ static int zcrx_validate_notif_stats(struct io_zcrx_ifq *ifq, · 1 unmodified line
863863 used = reg->offsets.rqes +
864864 sizeof(struct io_uring_zcrx_rqe) * reg->rq_entries;
865865
866− if (!IS_ALIGNED(stats_off, __alignof__(struct zcrx_notif_stats)))
866+ if (!IS_ALIGNED(stats_off, __alignof__(struct zcrx_stats)))
867867 return -EINVAL;
868868 if (stats_off < used)
869869 return -ERANGE;
870870 if (check_add_overflow(stats_off,
871− sizeof(struct zcrx_notif_stats),
871+ sizeof(struct zcrx_stats),
872872 &end))
873873 return -ERANGE;
874874 if (end > io_region_size(&ifq->rq_region))
@@ -883,7 +883,7 @@ static int zcrx_validate_notif_stats(struct io_zcrx_ifq *ifq, · 8 unmodified lines
883883 int io_register_zcrx(struct io_ring_ctx *ctx,
884884 struct io_uring_zcrx_ifq_reg __user *arg)
885885 {
886− struct zcrx_notification_desc notif;
886+ struct zcrx_event_desc notif;
887887 struct io_uring_zcrx_area_reg area;
888888 struct io_uring_zcrx_ifq_reg reg;
889889 struct io_uring_region_desc rd;
@@ -928,14 +928,14 @@ int io_register_zcrx(struct io_ring_ctx *ctx, · 38 unmodified lines
928928 return -EFAULT;
929929
930930 memset(&notif, 0, sizeof(notif));
931− if (reg.notif_desc && copy_from_user(&notif, u64_to_user_ptr(reg.notif_desc),
931+ if (reg.event_desc && copy_from_user(&notif, u64_to_user_ptr(reg.event_desc),
932932 sizeof(notif)))
933933 return -EFAULT;
934− if (notif.type_mask & ~ZCRX_NOTIF_TYPE_MASK)
934+ if (notif.type_mask & ~ZCRX_EVENT_TYPE_MASK)
935935 return -EINVAL;
936− if (notif.flags & ~ZCRX_NOTIF_DESC_FLAG_STATS)
936+ if (notif.flags & ~ZCRX_EVENT_DESC_FLAG_STATS)
937937 return -EINVAL;
938− if (!(notif.flags & ZCRX_NOTIF_DESC_FLAG_STATS)) {
938+ if (!(notif.flags & ZCRX_EVENT_DESC_FLAG_STATS)) {
939939 if (notif.stats_offset)
940940 return -EINVAL;
941941 }
@@ -970,7 +970,7 @@ int io_register_zcrx(struct io_ring_ctx *ctx, · 28 unmodified lines
970970 if (ret)
971971 goto err;
972972
973− if (notif.flags & ZCRX_NOTIF_DESC_FLAG_STATS) {
973+ if (notif.flags & ZCRX_EVENT_DESC_FLAG_STATS) {
974974 ret = zcrx_validate_notif_stats(ifq, &reg, &notif);
975975 if (ret)
976976 goto err;
@@ -1244,7 +1244,7 @@ static netmem_ref io_pp_zc_alloc_netmems(struct page_pool *pp, gfp_t gfp) · 267 unmodified lines
12441244
12451245 allocated = io_zcrx_refill_slow(pp, ifq, netmems, to_alloc);
12461246 if (!allocated) {
1247− zcrx_send_notif(ifq, ZCRX_NOTIF_NO_BUFFERS);
1247+ zcrx_send_notif(ifq, ZCRX_EVENT_ALLOC_FAIL);
12481248 return 0;
12491249 }
12501250 out_return:
@@ -1406,16 +1406,16 @@ static int zcrx_flush_rq(struct io_ring_ctx *ctx, struct io_zcrx_ifq *zcrx, · 155 unmodified lines
14061406 static int zcrx_arm_notif(struct io_ring_ctx *ctx, struct io_zcrx_ifq *zcrx,
14071407 struct zcrx_ctrl *ctrl)
14081408 {
1409− const struct zcrx_ctrl_arm_notif *an = &ctrl->zc_arm_notif;
1409+ const struct zcrx_ctrl_arm_event *an = &ctrl->zc_arm_event;
14101410 unsigned type_mask;
14111411
1412− if (an->notif_type >= __ZCRX_NOTIF_TYPE_LAST)
1412+ if (an->event_type >= __ZCRX_EVENT_TYPE_LAST)
14131413 return -EINVAL;
14141414 if (!mem_is_zero(&an->__resv, sizeof(an->__resv)))
14151415 return -EINVAL;
14161416
14171417 guard(spinlock_bh)(&zcrx->ctx_lock);
1418− type_mask = 1U << an->notif_type;
1418+ type_mask = 1U << an->event_type;
14191419 if (type_mask & ~zcrx->fired_notifs)
14201420 return -EINVAL;
14211421 zcrx->fired_notifs &= ~type_mask;
@@ -1428,7 +1428,7 @@ int io_zcrx_ctrl(struct io_ring_ctx *ctx, void __user *arg, unsigned nr_args) · 6 unmodified lines
14281428 struct io_zcrx_ifq *zcrx;
14291429
14301430 BUILD_BUG_ON(sizeof(ctrl.zc_export) != sizeof(ctrl.zc_flush));
1431− BUILD_BUG_ON(sizeof(ctrl.zc_export) != sizeof(ctrl.zc_arm_notif));
1431+ BUILD_BUG_ON(sizeof(ctrl.zc_export) != sizeof(ctrl.zc_arm_event));
14321432
14331433 if (nr_args)
14341434 return -EINVAL;
@@ -1446,7 +1446,7 @@ int io_zcrx_ctrl(struct io_ring_ctx *ctx, void __user *arg, unsigned nr_args) · 11 unmodified lines
14461446 return zcrx_flush_rq(ctx, zcrx, &ctrl);
14471447 case ZCRX_CTRL_EXPORT:
14481448 return zcrx_export(ctx, zcrx, &ctrl, arg);
1449− case ZCRX_CTRL_ARM_NOTIFICATION:
1449+ case ZCRX_CTRL_ARM_EVENT:
14501450 return zcrx_arm_notif(ctx, zcrx, &ctrl);
14511451 }
14521452
@@ -1592,7 +1592,7 @@ static int io_zcrx_copy_frag(struct io_kiocb *req, struct io_zcrx_ifq *ifq, · 139 unmodified lines
15921592 zcrx_stat_add(&ifq->notif_stats->copy_count, 1);
15931593 zcrx_stat_add(&ifq->notif_stats->copy_bytes, ret);
15941594 }
1595− zcrx_send_notif(ifq, ZCRX_NOTIF_COPY);
1595+ zcrx_send_notif(ifq, ZCRX_EVENT_COPY);
15961596 }
15971597
15981598 return ret;
io_uring/zcrx.h+4−3
@@ -10,8 +10,9 @@ · 9 unmodified lines
1010
1111 #define ZCRX_SUPPORTED_REG_FLAGS (ZCRX_REG_IMPORT | ZCRX_REG_NODEV)
1212 #define ZCRX_FEATURES (ZCRX_FEATURE_RX_PAGE_SIZE |\
13− ZCRX_FEATURE_NOTIFICATION)
14−#define ZCRX_NOTIF_TYPE_MASK ((1U << ZCRX_NOTIF_NO_BUFFERS) | (1U << ZCRX_NOTIF_COPY))
13+ ZCRX_FEATURE_EVENT)
14+#define ZCRX_EVENT_TYPE_MASK ((1U << ZCRX_EVENT_ALLOC_FAIL) |\
15+ (1U << ZCRX_EVENT_COPY))
1516
1617 struct io_zcrx_mem {
1718 unsigned long size;
@@ -80,7 +81,7 @@ struct io_zcrx_ifq { · 62 unmodified lines
8081 u32 allowed_notif_mask;
8182 u32 fired_notifs;
8283 u64 notif_data;
83− struct zcrx_notif_stats *notif_stats;
84+ struct zcrx_stats *notif_stats;
8485 };
8586
8687 #if defined(CONFIG_IO_URING_ZCRX)
kernel/bpf/verifier.c+2−1
@@ -9189,7 +9189,8 @@ static int btf_check_func_arg_match(struct bpf_verifier_env *env, int subprog, · 9188 unmodified lines
91899189 return ret;
91909190 if (check_mem_reg(env, reg, argno, arg->mem_size))
91919191 return -EINVAL;
9192− if (!(arg->arg_type & PTR_MAYBE_NULL) && (reg->type & PTR_MAYBE_NULL)) {
9192+ if (!(arg->arg_type & PTR_MAYBE_NULL) &&
9193+ (type_may_be_null(reg->type) || bpf_register_is_null(reg))) {
91939194 bpf_log(log, "%s is expected to be non-NULL\n",
91949195 reg_arg_name(env, argno));
91959196 return -EINVAL;
kernel/liveupdate/luo_session.c+1−1
@@ -378,7 +378,7 @@ static const struct luo_ioctl_op luo_session_ioctl_ops[] = { · 377 unmodified lines
378378 IOCTL_OP(LIVEUPDATE_SESSION_RETRIEVE_FD, luo_session_retrieve_fd,
379379 struct liveupdate_session_retrieve_fd, token, LUO_IOCTL_INCOMING),
380380 IOCTL_OP(LIVEUPDATE_SESSION_GET_NAME, luo_session_get_name,
381− struct liveupdate_session_retrieve_fd, token, LUO_IOCTL_ALL),
381+ struct liveupdate_session_get_name, name, LUO_IOCTL_ALL),
382382 };
383383
384384 static bool luo_ioctl_type_valid(struct luo_session *session,
kernel/smp.c+25−5
@@ -137,10 +137,10 @@ csd_do_func(smp_call_func_t func, void *info, call_single_data_t *csd) · 136 unmodified lines
137137 trace_csd_function_exit(func, csd);
138138 }
139139
140−#ifdef CONFIG_CSD_LOCK_WAIT_DEBUG
141−
142140 static DEFINE_STATIC_KEY_MAYBE(CONFIG_CSD_LOCK_WAIT_DEBUG_DEFAULT, csdlock_debug_enabled);
143141
142+#ifdef CONFIG_CSD_LOCK_WAIT_DEBUG
143+
144144 /*
145145 * Parse the csdlock_debug= kernel boot parameter.
146146 *
@@ -342,6 +342,10 @@ static __always_inline void csd_lock_wait(call_single_data_t *csd) · 195 unmodified lines
342342 smp_cond_load_acquire(&csd->node.u_flags, !(VAL & CSD_FLAG_LOCK));
343343 }
344344 #else
345+static __always_inline void __csd_lock_wait(call_single_data_t *csd)
346+{
347+}
348+
345349 static void csd_lock_record(call_single_data_t *csd)
346350 {
347351 }
@@ -354,8 +358,23 @@ static __always_inline void csd_lock_wait(call_single_data_t *csd) · 6 unmodified lines
354358
355359 static __always_inline void csd_lock(call_single_data_t *csd)
356360 {
357− csd_lock_wait(csd);
358− csd->node.u_flags |= CSD_FLAG_LOCK;
361+ if (IS_ENABLED(CONFIG_CSD_LOCK_WAIT_DEBUG) &&
362+ static_branch_unlikely(&csdlock_debug_enabled)) {
363+
364+ for (;;) {
365+ unsigned int flags;
366+
367+ __csd_lock_wait(csd);
368+ flags = READ_ONCE(csd->node.u_flags);
369+
370+ if (!(flags & CSD_FLAG_LOCK) &&
371+ try_cmpxchg_acquire(&csd->node.u_flags, &flags, flags | CSD_FLAG_LOCK))
372+ break;
373+ }
374+ } else {
375+ csd_lock_wait(csd);
376+ csd->node.u_flags |= CSD_FLAG_LOCK;
377+ }
359378
360379 /*
361380 * prevent CPU from reordering the above assignment
@@ -380,7 +399,8 @@ static DEFINE_PER_CPU_SHARED_ALIGNED(call_single_data_t, csd_data); · 18 unmodified lines
380399 #ifdef CONFIG_CSD_LOCK_WAIT_DEBUG
381400 static call_single_data_t *get_single_csd_data(int cpu)
382401 {
383− if (static_branch_unlikely(&csdlock_debug_enabled))
402+ if (static_branch_unlikely(&csdlock_debug_enabled) &&
403+ (unsigned int)cpu < nr_cpu_ids)
384404 return per_cpu_ptr(&csd_data, cpu);
385405 return this_cpu_ptr(&csd_data);
386406 }
kernel/trace/ftrace.c+13−0
@@ -1097,6 +1097,12 @@ struct ftrace_ops global_ops = { · 1096 unmodified lines
10971097 FTRACE_OPS_FL_PID,
10981098 };
10991099
1100+/*
1101+ * parser_lock - Protects trace_parser state against concurrent operations.
1102+ * Held across trace_get_user() and subsequent buffer parsing to prevent races.
1103+ */
1104+static DEFINE_MUTEX(parser_lock);
1105+
11001106 /*
11011107 * Used by the stack unwinder to know about dynamic ftrace trampolines.
11021108 */
@@ -5842,6 +5848,8 @@ ftrace_regex_write(struct file *file, const char __user *ubuf, · 4739 unmodified lines
58425848 /* iter->hash is a local copy, so we don't need regex_lock */
58435849
58445850 parser = &iter->parser;
5851+
5852+ guard(mutex)(&parser_lock);
58455853 read = trace_get_user(parser, ubuf, cnt, ppos);
58465854
58475855 if (read >= 0 && trace_parser_loaded(parser) &&
@@ -6984,12 +6992,14 @@ int ftrace_regex_release(struct inode *inode, struct file *file) · 1136 unmodified lines
69846992 iter = file->private_data;
69856993
69866994 parser = &iter->parser;
6995+ mutex_lock(&parser_lock);
69876996 if (trace_parser_loaded(parser)) {
69886997 int enable = !(iter->flags & FTRACE_ITER_NOTRACE);
69896998
69906999 ftrace_process_regex(iter, parser->buffer,
69917000 parser->idx, enable);
69927001 }
7002+ mutex_unlock(&parser_lock);
69937003
69947004 trace_parser_put(parser);
69957005
@@ -7321,10 +7331,12 @@ ftrace_graph_release(struct inode *inode, struct file *file) · 325 unmodified lines
73217331
73227332 parser = &fgd->parser;
73237333
7334+ mutex_lock(&parser_lock);
73247335 if (trace_parser_loaded((parser))) {
73257336 ret = ftrace_graph_set_hash(fgd->new_hash,
73267337 parser->buffer);
73277338 }
7339+ mutex_unlock(&parser_lock);
73287340
73297341 trace_parser_put(parser);
73307342
@@ -7437,6 +7449,7 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, · 106 unmodified lines
74377449
74387450 parser = &fgd->parser;
74397451
7452+ guard(mutex)(&parser_lock);
74407453 read = trace_get_user(parser, ubuf, cnt, ppos);
74417454
74427455 if (read >= 0 && trace_parser_loaded(parser) &&
kernel/trace/trace.c+1−1
@@ -6187,7 +6187,7 @@ char *trace_user_fault_read(struct trace_user_buf_info *tinfo, · 6186 unmodified lines
61876187 {
61886188 int cpu = smp_processor_id();
61896189 char *buffer = per_cpu_ptr(tinfo->tbuf, cpu)->buf;
6190− unsigned int cnt;
6190+ unsigned long long cnt;
61916191 int trys = 0;
61926192 int ret;
61936193
kernel/trace/trace.h+1−0
@@ -1941,6 +1941,7 @@ struct event_trigger_data { · 1940 unmodified lines
19411941 struct list_head named_list;
19421942 struct event_trigger_data *named_data;
19431943 struct llist_node llist;
1944+ void (*private_data_free)(struct event_trigger_data *data);
19441945 };
19451946
19461947 /* Avoid typos */
kernel/trace/trace_eprobe.c+2−1
@@ -172,7 +172,8 @@ static bool eprobe_dyn_event_match(const char *system, const char *event, · 171 unmodified lines
172172 if (!slash)
173173 return false;
174174
175− if (strncmp(ep->event_system, argv[0], slash - argv[0]))
175+ if (strncmp(ep->event_system, argv[0], slash - argv[0]) ||
176+ ep->event_system[slash - argv[0]] != '\0')
176177 return false;
177178 if (strcmp(ep->event_name, slash + 1))
178179 return false;
kernel/trace/trace_events.c+3−1
@@ -1350,7 +1350,9 @@ __ftrace_set_clr_event_nolock(struct trace_array *tr, const char *match, · 1349 unmodified lines
13501350 call = file->event_call;
13511351
13521352 /* If a module is specified, skip events that are not that module */
1353− if (module && (!call->module || strcmp(module_name(call->module), module)))
1353+ if (module &&
1354+ ((call->flags & TRACE_EVENT_FL_DYNAMIC) ||
1355+ !call->module || strcmp(module_name(call->module), module)))
13541356 continue;
13551357
13561358 name = trace_event_name(call);
kernel/trace/trace_events_hist.c+2−0
@@ -6349,6 +6349,7 @@ static void event_hist_trigger_free(struct event_trigger_data *data) · 6348 unmodified lines
63496349
63506350 trigger_data_free(data);
63516351
6352+ tracepoint_synchronize_unregister();
63526353 remove_hist_vars(hist_data);
63536354
63546355 unregister_field_var_hists(hist_data);
@@ -6388,6 +6389,7 @@ static void event_hist_trigger_named_free(struct event_trigger_data *data) · 33 unmodified lines
63886389
63896390 del_named_trigger(data);
63906391 trigger_data_free(data);
6392+ tracepoint_synchronize_unregister();
63916393 kfree(cmd_ops);
63926394 }
63936395 }
kernel/trace/trace_events_trigger.c+18−4
@@ -38,6 +38,13 @@ static void trigger_create_kthread_locked(void) · 37 unmodified lines
3838 }
3939 }
4040
41+static void trigger_data_free_one(struct event_trigger_data *data)
42+{
43+ if (data->private_data_free)
44+ data->private_data_free(data);
45+ kfree(data);
46+}
47+
4148 static void trigger_data_free_queued_locked(void)
4249 {
4350 struct event_trigger_data *data, *tmp;
@@ -52,7 +59,7 @@ static void trigger_data_free_queued_locked(void) · 8 unmodified lines
5259 tracepoint_synchronize_unregister();
5360
5461 llist_for_each_entry_safe(data, tmp, llnodes, llist)
55− kfree(data);
62+ trigger_data_free_one(data);
5663 }
5764
5865 /* Bulk garbage collection of event_trigger_data elements */
@@ -75,7 +82,7 @@ static int trigger_kthread_fn(void *ignore) · 16 unmodified lines
7582 tracepoint_synchronize_unregister();
7683
7784 llist_for_each_entry_safe(data, tmp, llnodes, llist)
78− kfree(data);
85+ trigger_data_free_one(data);
7986 }
8087
8188 return 0;
@@ -1717,6 +1724,14 @@ int event_enable_trigger_print(struct seq_file *m, · 1635 unmodified lines
17171724 return 0;
17181725 }
17191726
1727+static void enable_trigger_private_data_free(struct event_trigger_data *data)
1728+{
1729+ struct enable_trigger_data *enable_data = data->private_data;
1730+
1731+ trace_event_put_ref(enable_data->file->event_call);
1732+ kfree(enable_data);
1733+}
1734+
17201735 void event_enable_trigger_free(struct event_trigger_data *data)
17211736 {
17221737 struct enable_trigger_data *enable_data = data->private_data;
@@ -1728,9 +1743,8 @@ void event_enable_trigger_free(struct event_trigger_data *data) · 5 unmodified lines
17281743 if (!data->ref) {
17291744 /* Remove the SOFT_MODE flag */
17301745 trace_event_enable_disable(enable_data->file, 0, 1);
1731− trace_event_put_ref(enable_data->file->event_call);
1746+ data->private_data_free = enable_trigger_private_data_free;
17321747 trigger_data_free(data);
1733− kfree(enable_data);
17341748 }
17351749 }
17361750
kernel/trace/trace_mmiotrace.c+2−2
@@ -109,7 +109,6 @@ static void mmio_pipe_open(struct trace_iterator *iter) · 108 unmodified lines
109109 iter->private = hiter;
110110 }
111111
112−/* XXX: This is not called when the pipe is closed! */
113112 static void mmio_close(struct trace_iterator *iter)
114113 {
115114 struct header_iter *hiter = iter->private;
@@ -146,7 +145,7 @@ static ssize_t mmio_read(struct trace_iterator *iter, struct file *filp, · 30 unmodified lines
146145 goto print_out;
147146 }
148147
149− if (!hiter)
148+ if (!hiter || !hiter->dev)
150149 return 0;
151150
152151 mmio_print_pcidev(s, hiter->dev);
@@ -279,6 +278,7 @@ static struct tracer mmio_tracer __read_mostly = · 126 unmodified lines
279278 .start = mmio_trace_start,
280279 .pipe_open = mmio_pipe_open,
281280 .close = mmio_close,
281+ .pipe_close = mmio_close,
282282 .read = mmio_read,
283283 .print_line = mmio_print_line,
284284 .noboot = true,
kernel/trace/trace_probe.c+7−6
@@ -188,7 +188,7 @@ void __trace_probe_log_err(int offset, int err_type) · 187 unmodified lines
188188
189189 lockdep_assert_held(&dyn_event_ops_mutex);
190190
191− if (!trace_probe_log.argv)
191+ if (!trace_probe_log.argv || !trace_probe_log.argc)
192192 return;
193193
194194 /* Recalculate the length and allocate buffer */
@@ -2013,7 +2013,7 @@ int traceprobe_update_arg(struct probe_arg *arg) · 1818 unmodified lines
20132013 }
20142014
20152015 /* When len=0, we just calculate the needed length */
2016−#define LEN_OR_ZERO (len ? len - pos : 0)
2016+#define LEN_OR_ZERO (len > pos ? len - pos : 0)
20172017 static int __set_print_fmt(struct trace_probe *tp, char *buf, int len,
20182018 enum probe_print_type ptype)
20192019 {
@@ -2338,16 +2338,17 @@ int trace_probe_compare_arg_type(struct trace_probe *a, struct trace_probe *b) · 318 unmodified lines
23382338 bool trace_probe_match_command_args(struct trace_probe *tp,
23392339 int argc, const char **argv)
23402340 {
2341− char buf[MAX_ARGSTR_LEN + 1];
23422341 int i;
23432342
23442343 if (tp->nr_args < argc)
23452344 return false;
23462345
23472346 for (i = 0; i < argc; i++) {
2348− snprintf(buf, sizeof(buf), "%s=%s",
2349− tp->args[i].name, tp->args[i].comm);
2350− if (strcmp(buf, argv[i]))
2347+ int len = strlen(tp->args[i].name);
2348+
2349+ if (strncmp(argv[i], tp->args[i].name, len) ||
2350+ argv[i][len] != '=' ||
2351+ strcmp(argv[i] + len + 1, tp->args[i].comm))
23512352 return false;
23522353 }
23532354 return true;
kernel/trace/trace_remote.c+13−3
@@ -1004,11 +1004,10 @@ int trace_remote_alloc_buffer(struct trace_buffer_desc *desc, size_t desc_size, · 1003 unmodified lines
10041004 desc->nr_cpus++;
10051005
10061006 for (id = 0; id < nr_pages; id++) {
1007+ rb_desc->nr_page_va++;
10071008 rb_desc->page_va[id] = (unsigned long)__get_free_page(GFP_KERNEL);
10081009 if (!rb_desc->page_va[id])
10091010 goto err;
1010−
1011− rb_desc->nr_page_va++;
10121011 }
10131012 rb_desc = __next_ring_buffer_desc(rb_desc);
10141013 }
@@ -1150,10 +1149,21 @@ static ssize_t remote_events_dir_enable_write(struct file *filp, const char __us · 135 unmodified lines
11501149
11511150 for (i = 0; i < remote->nr_events; i++) {
11521151 struct remote_event *evt = &remote->events[i];
1152+ int eret;
11531153
1154− trace_remote_enable_event(remote, evt, enable);
1154+ eret = trace_remote_enable_event(remote, evt, enable);
1155+ /*
1156+ * Save the first error and return that. Some events
1157+ * may still have been enabled, but let the user
1158+ * know that something went wrong.
1159+ */
1160+ if (!ret && eret)
1161+ ret = eret;
11551162 }
11561163
1164+ if (ret)
1165+ return ret;
1166+
11571167 return count;
11581168 }
11591169
kernel/trace/trace_syscalls.c+5−0
@@ -1451,6 +1451,11 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) · 1450 unmodified lines
14511451 if (syscall_get_data(sys_data, args, &user_ptr,
14521452 &size, user_sizes, &uargs, buf_size) < 0)
14531453 return;
1454+
1455+ /* The above may have caused a migration */
1456+ head = this_cpu_ptr(sys_data->enter_event->perf_events);
1457+ if (hlist_empty(head))
1458+ return;
14541459 }
14551460
14561461 /* get the size after alignment with the u32 buffer size field */
lib/alloc_tag.c+9−0
@@ -26,6 +26,15 @@ static bool mem_profiling_support = true; · 25 unmodified lines
2626 static bool mem_profiling_support;
2727 #endif
2828
29+/*
30+ * Memory allocation profiling is permanently disabled and cannot be enabled.
31+ * Must be called after setup_early_mem_profiling().
32+ */
33+bool mem_alloc_profiling_permanently_disabled(void)
34+{
35+ return !mem_profiling_support;
36+}
37+
2938 static struct codetag_type *alloc_tag_cttype;
3039
3140 #ifdef CONFIG_ARCH_MODULE_NEEDS_WEAK_PER_CPU
lib/rhashtable.c+1−0
@@ -878,6 +878,7 @@ int rhashtable_walk_start_check(struct rhashtable_iter *iter) · 877 unmodified lines
878878 iter->walker.tbl = rht_dereference_rcu(ht->tbl, ht);
879879 iter->slot = 0;
880880 iter->skip = 0;
881+ iter->p = NULL;
881882 return -EAGAIN;
882883 }
883884
mm/damon/core.c+13−2
@@ -1,8 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
33 * Data Access Monitor
4− *
5− * Author: SeongJae Park <sj@kernel.org>
64 */
75
86 #define pr_fmt(fmt) "damon: " fmt
@@ -356,8 +354,21 @@ int damon_set_regions(struct damon_target *t, struct damon_addr_range *ranges, · 347 unmodified lines
356354 {
357355 struct damon_region *r, *next;
358356 unsigned int i;
357+ unsigned long last_end;
359358 int err;
360359
360+ for (i = 0; i < nr_ranges; i++) {
361+ unsigned long start, end;
362+
363+ start = ALIGN_DOWN(ranges[i].start, min_region_sz);
364+ end = ALIGN(ranges[i].end, min_region_sz);
365+ if (start >= end)
366+ return -EINVAL;
367+ if (i > 0 && last_end > start)
368+ return -EINVAL;
369+ last_end = end;
370+ }
371+
361372 /* Remove regions which are not in the new ranges */
362373 damon_for_each_region_safe(r, next, t) {
363374 for (i = 0; i < nr_ranges; i++) {
mm/damon/lru_sort.c+0−2
@@ -1,8 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
33 * DAMON-based LRU-lists Sorting
4− *
5− * Author: SeongJae Park <sj@kernel.org>
64 */
75
86 #define pr_fmt(fmt) "damon-lru-sort: " fmt
mm/damon/modules-common.c+0−2
@@ -1,8 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
33 * Common Code for DAMON Modules
4− *
5− * Author: SeongJae Park <sj@kernel.org>
64 */
75
86 #include <linux/damon.h>
mm/damon/modules-common.h+0−2
@@ -1,8 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * Common Code for DAMON Modules
4− *
5− * Author: SeongJae Park <sj@kernel.org>
64 */
75
86 #include <linux/moduleparam.h>
mm/damon/ops-common.c+0−2
@@ -1,8 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
33 * Common Code for Data Access Monitoring
4− *
5− * Author: SeongJae Park <sj@kernel.org>
64 */
75
86 #include <linux/migrate.h>
mm/damon/ops-common.h+0−2
@@ -1,8 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * Common Code for Data Access Monitoring
4− *
5− * Author: SeongJae Park <sj@kernel.org>
64 */
75
86 #include <linux/damon.h>
mm/damon/paddr.c+0−2
@@ -1,8 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
33 * DAMON Code for The Physical Address Space
4− *
5− * Author: SeongJae Park <sj@kernel.org>
64 */
75
86 #define pr_fmt(fmt) "damon-pa: " fmt
mm/damon/reclaim.c+0−2
@@ -1,8 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
33 * DAMON-based page reclamation
4− *
5− * Author: SeongJae Park <sj@kernel.org>
64 */
75
86 #define pr_fmt(fmt) "damon-reclaim: " fmt
mm/damon/sysfs-common.c+0−2
@@ -1,8 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
33 * Common Code for DAMON Sysfs Interface
4− *
5− * Author: SeongJae Park <sj@kernel.org>
64 */
75
86 #include <linux/slab.h>
mm/damon/sysfs-common.h+0−2
@@ -1,8 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * Common Code for DAMON Sysfs Interface
4− *
5− * Author: SeongJae Park <sj@kernel.org>
64 */
75
86 #include <linux/damon.h>
mm/damon/sysfs-schemes.c+0−2
@@ -1,8 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
33 * DAMON sysfs Interface
4− *
5− * Copyright (c) 2022 SeongJae Park <sj@kernel.org>
64 */
75
86 #include <linux/slab.h>
mm/damon/sysfs.c+0−2
@@ -1,8 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
33 * DAMON sysfs Interface
4− *
5− * Copyright (c) 2022 SeongJae Park <sj@kernel.org>
64 */
75
86 #include <linux/pid.h>
mm/damon/tests/core-kunit.h+0−4
@@ -1,10 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * Data Access Monitor Unit Tests
4− *
5− * Copyright 2019 Amazon.com, Inc. or its affiliates. All rights reserved.
6− *
7− * Author: SeongJae Park <sj@kernel.org>
84 */
95
106 #ifdef CONFIG_DAMON_KUNIT_TEST
mm/damon/tests/sysfs-kunit.h+0−2
@@ -1,8 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * Data Access Monitor Unit Tests
4− *
5− * Author: SeongJae Park <sj@kernel.org>
64 */
75
86 #ifdef CONFIG_DAMON_SYSFS_KUNIT_TEST
mm/damon/tests/vaddr-kunit.h+0−4
@@ -1,10 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * Data Access Monitor Unit Tests
4− *
5− * Copyright 2019 Amazon.com, Inc. or its affiliates. All rights reserved.
6− *
7− * Author: SeongJae Park <sj@kernel.org>
84 */
95
106 #ifdef CONFIG_DAMON_VADDR_KUNIT_TEST
mm/damon/vaddr.c+0−2
@@ -1,8 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
33 * DAMON Code for Virtual Address Spaces
4− *
5− * Author: SeongJae Park <sj@kernel.org>
64 */
75
86 #define pr_fmt(fmt) "damon-va: " fmt
mm/huge_memory.c+8−4
@@ -3587,10 +3587,6 @@ static void __split_folio_to_order(struct folio *folio, int old_order, · 3586 unmodified lines
35873587 (1L << PG_dropbehind) |
35883588 LRU_GEN_MASK | LRU_REFS_MASK));
35893589
3590− if (handle_hwpoison &&
3591− page_range_has_hwpoisoned(new_head, new_nr_pages))
3592− folio_set_has_hwpoisoned(new_folio);
3593−
35943590 new_folio->mapping = folio->mapping;
35953591 new_folio->index = folio->index + i;
35963592
@@ -3612,6 +3608,14 @@ static void __split_folio_to_order(struct folio *folio, int old_order, · 15 unmodified lines
36123608 folio_set_large_rmappable(new_folio);
36133609 }
36143610
3611+ /*
3612+ * PG_has_hwpoisoned is on the 2nd page, so set it after
3613+ * the compound head is prepped.
3614+ */
3615+ if (handle_hwpoison &&
3616+ page_range_has_hwpoisoned(new_head, new_nr_pages))
3617+ folio_set_has_hwpoisoned(new_folio);
3618+
36153619 if (folio_test_young(folio))
36163620 folio_set_young(new_folio);
36173621 if (folio_test_idle(folio))
mm/kmemleak.c+4−3
@@ -687,7 +687,7 @@ static struct kmemleak_object *__alloc_object(gfp_t gfp) · 686 unmodified lines
687687 atomic_set(&object->use_count, 1);
688688 object->excess_ref = 0;
689689 object->count = 0; /* white color initially */
690− object->checksum = 0;
690+ object->checksum = ~0;
691691 object->del_state = 0;
692692
693693 /* task information */
@@ -981,7 +981,7 @@ static void reset_checksum(unsigned long ptr) · 287 unmodified lines
981981 }
982982
983983 raw_spin_lock_irqsave(&object->lock, flags);
984− object->checksum = 0;
984+ object->checksum = ~0;
985985 raw_spin_unlock_irqrestore(&object->lock, flags);
986986 put_object(object);
987987 }
@@ -1410,7 +1410,8 @@ static bool update_checksum(struct kmemleak_object *object) · 422 unmodified lines
14101410 for_each_possible_cpu(cpu) {
14111411 void *ptr = per_cpu_ptr((void __percpu *)object->pointer, cpu);
14121412
1413− object->checksum ^= crc32(0, kasan_reset_tag((void *)ptr), object->size);
1413+ object->checksum = crc32(object->checksum,
1414+ kasan_reset_tag((void *)ptr), object->size);
14141415 }
14151416 } else {
14161417 object->checksum = crc32(0, kasan_reset_tag((void *)object->pointer), object->size);
mm/page_reporting.c+12−12
@@ -173,11 +173,8 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, · 172 unmodified lines
173173 * any pages that may have already been present from the previous
174174 * list processed. This should result in us reporting all pages on
175175 * an idle system in about 30 seconds.
176− *
177− * The division here should be cheap since PAGE_REPORTING_CAPACITY
178− * should always be a power of 2.
179176 */
180− budget = DIV_ROUND_UP(area->nr_free, PAGE_REPORTING_CAPACITY * 16);
177+ budget = DIV_ROUND_UP(area->nr_free, prdev->capacity * 16);
181178
182179 /* loop through free list adding unreported pages to sg list */
183180 list_for_each_entry_safe(page, next, list, lru) {
@@ -222,10 +219,10 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, · 38 unmodified lines
222219 spin_unlock_irq(&zone->lock);
223220
224221 /* begin processing pages in local list */
225− err = prdev->report(prdev, sgl, PAGE_REPORTING_CAPACITY);
222+ err = prdev->report(prdev, sgl, prdev->capacity);
226223
227224 /* reset offset since the full list was reported */
228− *offset = PAGE_REPORTING_CAPACITY;
225+ *offset = prdev->capacity;
229226
230227 /* update budget to reflect call to report function */
231228 budget--;
@@ -234,7 +231,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, · 2 unmodified lines
234231 spin_lock_irq(&zone->lock);
235232
236233 /* flush reported pages from the sg list */
237− page_reporting_drain(prdev, sgl, PAGE_REPORTING_CAPACITY, !err);
234+ page_reporting_drain(prdev, sgl, prdev->capacity, !err);
238235
239236 /*
240237 * Reset next to first entry, the old next isn't valid
@@ -260,13 +257,13 @@ static int · 19 unmodified lines
260257 page_reporting_process_zone(struct page_reporting_dev_info *prdev,
261258 struct scatterlist *sgl, struct zone *zone)
262259 {
263− unsigned int order, mt, leftover, offset = PAGE_REPORTING_CAPACITY;
260+ unsigned int order, mt, leftover, offset = prdev->capacity;
264261 unsigned long watermark;
265262 int err = 0;
266263
267264 /* Generate minimum watermark to be able to guarantee progress */
268265 watermark = low_wmark_pages(zone) +
269− (PAGE_REPORTING_CAPACITY << page_reporting_order);
266+ (prdev->capacity << page_reporting_order);
270267
271268 /*
272269 * Cancel request if insufficient free memory or if we failed
@@ -290,7 +287,7 @@ page_reporting_process_zone(struct page_reporting_dev_info *prdev, · 17 unmodified lines
290287 }
291288
292289 /* report the leftover pages before going idle */
293− leftover = PAGE_REPORTING_CAPACITY - offset;
290+ leftover = prdev->capacity - offset;
294291 if (leftover) {
295292 sgl = &sgl[offset];
296293 err = prdev->report(prdev, sgl, leftover);
@@ -322,11 +319,11 @@ static void page_reporting_process(struct work_struct *work) · 25 unmodified lines
322319 atomic_set(&prdev->state, state);
323320
324321 /* allocate scatterlist to store pages being reported on */
325− sgl = kmalloc_objs(*sgl, PAGE_REPORTING_CAPACITY);
322+ sgl = kmalloc_objs(*sgl, prdev->capacity);
326323 if (!sgl)
327324 goto err_out;
328325
329− sg_init_table(sgl, PAGE_REPORTING_CAPACITY);
326+ sg_init_table(sgl, prdev->capacity);
330327
331328 for_each_zone(zone) {
332329 err = page_reporting_process_zone(prdev, sgl, zone);
@@ -377,6 +374,9 @@ int page_reporting_register(struct page_reporting_dev_info *prdev) · 44 unmodified lines
377374 page_reporting_order = pageblock_order;
378375 }
379376
377+ if (!prdev->capacity || prdev->capacity > PAGE_REPORTING_CAPACITY)
378+ prdev->capacity = PAGE_REPORTING_CAPACITY;
379+
380380 /* initialize state and work structures */
381381 atomic_set(&prdev->state, PAGE_REPORTING_IDLE);
382382 INIT_DELAYED_WORK(&prdev->work, &page_reporting_process);
mm/page_vma_mapped.c+17−14
@@ -243,21 +243,31 @@ restart: · 242 unmodified lines
243243 */
244244 pmde = pmdp_get_lockless(pvmw->pmd);
245245
246− if (pmd_trans_huge(pmde) || pmd_is_migration_entry(pmde)) {
246+ if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) &&
247+ (pmd_trans_huge(pmde) || pmd_is_migration_entry(pmde) ||
248+ pmd_is_device_private_entry(pmde))) {
247249 pvmw->ptl = pmd_lock(mm, pvmw->pmd);
248250 pmde = *pvmw->pmd;
249− if (!pmd_present(pmde)) {
251+ if (pmd_is_migration_entry(pmde)) {
250252 softleaf_t entry;
251253
252− if (!thp_migration_supported() ||
253− !(pvmw->flags & PVMW_MIGRATION))
254+ if (!(pvmw->flags & PVMW_MIGRATION))
254255 return not_found(pvmw);
255256 entry = softleaf_from_pmd(pmde);
257+ if (!check_pmd(softleaf_to_pfn(entry), pvmw))
258+ return not_found(pvmw);
259+ return true;
260+ } else if (pmd_is_device_private_entry(pmde)) {
261+ softleaf_t entry;
256262
257− if (!softleaf_is_migration(entry) ||
258− !check_pmd(softleaf_to_pfn(entry), pvmw))
263+ if (pvmw->flags & PVMW_MIGRATION)
264+ return not_found(pvmw);
265+ entry = softleaf_from_pmd(pmde);
266+ if (!check_pmd(softleaf_to_pfn(entry), pvmw))
259267 return not_found(pvmw);
260268 return true;
269+ } else if (!pmd_present(pmde)) {
270+ return not_found(pvmw);
261271 }
262272 if (likely(pmd_trans_huge(pmde))) {
263273 if (pvmw->flags & PVMW_MIGRATION)
@@ -266,17 +276,10 @@ restart: · 2 unmodified lines
266276 return not_found(pvmw);
267277 return true;
268278 }
269− /* THP pmd was split under us: handle on pte level */
279+ /* THP/device-private pmd was split under us: handle on pte level */
270280 spin_unlock(pvmw->ptl);
271281 pvmw->ptl = NULL;
272282 } else if (!pmd_present(pmde)) {
273− const softleaf_t entry = softleaf_from_pmd(pmde);
274−
275− if (softleaf_is_device_private(entry)) {
276− pvmw->ptl = pmd_lock(mm, pvmw->pmd);
277− return true;
278− }
279−
280283 if ((pvmw->flags & PVMW_SYNC) &&
281284 thp_vma_suitable_order(vma, pvmw->address,
282285 PMD_ORDER) &&
mm/shmem.c+10−0
@@ -846,6 +846,16 @@ static long shmem_unused_huge_count(struct super_block *sb, · 845 unmodified lines
846846 struct shrink_control *sc)
847847 {
848848 struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
849+
850+ /*
851+ * The per-superblock shrinklist is filesystem-global and does not
852+ * honour sc->memcg, so it is only meaningful on the global (kswapd or
853+ * root direct reclaim) shrink path. Skip the per-memcg iterations of
854+ * shrink_slab_memcg() to avoid queueing duplicate global work.
855+ */
856+ if (!mem_cgroup_shrink_is_root(sc))
857+ return 0;
858+
849859 return READ_ONCE(sbinfo->shrinklist_len);
850860 }
851861 #else /* !CONFIG_TRANSPARENT_HUGEPAGE */
mm/slab.h+29−3
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #define SLAB_ALLOC_NOLOCK 0x01 /* a kmalloc_nolock() allocation */
2323 #define SLAB_ALLOC_NEW_SLAB 0x02 /* a flag for alloc_slab_obj_exts() */
2424 #define SLAB_ALLOC_NO_RECURSE 0x04 /* prevent kmalloc() recursion */
25+#define SLAB_ALLOC_NO_OBJ_EXT 0x08 /* prevent obj_exts array allocation */
2526
2627 static inline bool alloc_flags_allow_spinning(const unsigned int alloc_flags)
2728 {
@@ -386,12 +387,17 @@ static inline unsigned int size_index_elem(unsigned int bytes) · 358 unmodified lines
386387 * KMALLOC_MAX_CACHE_SIZE and the caller must check that.
387388 */
388389 static inline struct kmem_cache *
389−kmalloc_slab(size_t size, kmem_buckets *b, gfp_t flags, kmalloc_token_t token)
390+kmalloc_slab(size_t size, kmem_buckets *b, gfp_t flags, kmalloc_token_t token,
391+ unsigned int alloc_flags)
390392 {
391393 unsigned int index;
394+ enum kmalloc_cache_type type = kmalloc_type(flags, token);
395+
396+ if (alloc_flags & SLAB_ALLOC_NO_OBJ_EXT)
397+ type = KMALLOC_NO_OBJ_EXT;
392398
393399 if (!b)
394− b = &kmalloc_caches[kmalloc_type(flags, token)];
400+ b = &kmalloc_caches[type];
395401 if (size <= 192)
396402 index = kmalloc_size_index[size_index_elem(size)];
397403 else
@@ -426,7 +432,8 @@ static inline bool is_kmalloc_normal(struct kmem_cache *s) · 28 unmodified lines
426432 {
427433 if (!is_kmalloc_cache(s))
428434 return false;
429− return !(s->flags & (SLAB_CACHE_DMA|SLAB_ACCOUNT|SLAB_RECLAIM_ACCOUNT));
435+
436+ return !(s->flags & (SLAB_CACHE_DMA|SLAB_ACCOUNT|SLAB_RECLAIM_ACCOUNT|SLAB_NO_OBJ_EXT));
430437 }
431438
432439 bool __kfree_rcu_sheaf(struct kmem_cache *s, void *obj);
@@ -529,6 +536,25 @@ static inline void metadata_access_disable(void) · 96 unmodified lines
529536 kasan_enable_current();
530537 }
531538
539+/*
540+ * Return true if KMALLOC_NORMAL caches may need obj_exts arrays.
541+ *
542+ * Memory allocation profiling requires obj_exts for all caches.
543+ * Memcg usually doesn't need them for normal kmalloc caches, but kmalloc types
544+ * with a priority higher than KMALLOC_CGROUP can be aliased with KMALLOC_NORMAL.
545+ */
546+static inline bool need_kmalloc_no_objext(void)
547+{
548+ if (!mem_alloc_profiling_permanently_disabled())
549+ return true;
550+
551+ if (!mem_cgroup_kmem_disabled() &&
552+ (KMALLOC_NORMAL == KMALLOC_RECLAIM))
553+ return true;
554+
555+ return false;
556+}
557+
532558 #ifdef CONFIG_SLAB_OBJ_EXT
533559
534560 /*
mm/slab_common.c+18−1
@@ -783,11 +783,15 @@ u8 kmalloc_size_index[24] __ro_after_init = { · 782 unmodified lines
783783 size_t kmalloc_size_roundup(size_t size)
784784 {
785785 if (size && size <= KMALLOC_MAX_CACHE_SIZE) {
786+ struct kmem_cache *s;
787+
786788 /*
787789 * The flags don't matter since size_index is common to all.
788790 * Neither does the caller for just getting ->object_size.
789791 */
790− return kmalloc_slab(size, NULL, GFP_KERNEL, __kmalloc_token(0))->object_size;
792+ s = kmalloc_slab(size, NULL, GFP_KERNEL, __kmalloc_token(0),
793+ SLAB_ALLOC_DEFAULT);
794+ return s->object_size;
791795 }
792796
793797 /* Above the smaller buckets, size is a multiple of page size. */
@@ -843,6 +847,12 @@ EXPORT_SYMBOL(kmalloc_size_roundup); · 49 unmodified lines
843847 #define KMALLOC_PARTITION_NAME(N, sz)
844848 #endif
845849
850+#ifdef CONFIG_SLAB_OBJ_EXT
851+#define KMALLOC_NO_OBJ_EXT_NAME(sz) .name[KMALLOC_NO_OBJ_EXT] = "kmalloc-no-objext-" #sz,
852+#else
853+#define KMALLOC_NO_OBJ_EXT_NAME(sz)
854+#endif
855+
846856 #define INIT_KMALLOC_INFO(__size, __short_size) \
847857 { \
848858 .name[KMALLOC_NORMAL] = "kmalloc-" #__short_size, \
@@ -850,6 +860,7 @@ EXPORT_SYMBOL(kmalloc_size_roundup); · 1 unmodified line
850860 KMALLOC_CGROUP_NAME(__short_size) \
851861 KMALLOC_DMA_NAME(__short_size) \
852862 KMALLOC_PARTITION_NAME(KMALLOC_PARTITION_CACHES_NR, __short_size) \
863+ KMALLOC_NO_OBJ_EXT_NAME(__short_size) \
853864 .size = __size, \
854865 }
855866
@@ -957,6 +968,12 @@ new_kmalloc_cache(int idx, enum kmalloc_cache_type type) · 101 unmodified lines
957968 return;
958969 }
959970 flags |= SLAB_ACCOUNT;
971+ } else if (IS_ENABLED(CONFIG_SLAB_OBJ_EXT) && type == KMALLOC_NO_OBJ_EXT) {
972+ if (!need_kmalloc_no_objext()) {
973+ kmalloc_caches[type][idx] = kmalloc_caches[KMALLOC_NORMAL][idx];
974+ return;
975+ }
976+ flags |= SLAB_NO_OBJ_EXT | SLAB_NO_MERGE;
960977 } else if (IS_ENABLED(CONFIG_ZONE_DMA) && (type == KMALLOC_DMA)) {
961978 flags |= SLAB_CACHE_DMA;
962979 }
mm/slub.c+50−71
@@ -2123,42 +2123,6 @@ static inline void init_slab_obj_exts(struct slab *slab) · 2122 unmodified lines
21232123 slab->obj_exts = 0;
21242124 }
21252125
2126−/*
2127− * Calculate the allocation size for slabobj_ext array.
2128− *
2129− * When memory allocation profiling is enabled, the obj_exts array
2130− * could be allocated from the same slab cache it's being allocated for.
2131− * This would prevent the slab from ever being freed because it would
2132− * always contain at least one allocated object (its own obj_exts array).
2133− *
2134− * To avoid this, increase the allocation size when we detect the array
2135− * may come from the same cache, forcing it to use a different cache.
2136− */
2137−static inline size_t obj_exts_alloc_size(struct kmem_cache *s,
2138− struct slab *slab, gfp_t gfp)
2139−{
2140− size_t sz = sizeof(struct slabobj_ext) * slab->objects;
2141− struct kmem_cache *obj_exts_cache;
2142−
2143− if (sz > KMALLOC_MAX_CACHE_SIZE)
2144− return sz;
2145−
2146− if (!is_kmalloc_normal(s))
2147− return sz;
2148−
2149− obj_exts_cache = kmalloc_slab(sz, NULL, gfp, __kmalloc_token(0));
2150− /*
2151− * We can't simply compare s with obj_exts_cache, because partitioned kmalloc
2152− * caches have multiple caches per size, selected by caller address or type.
2153− * Since caller address or type may differ between kmalloc_slab() and actual
2154− * allocation, bump size when sizes are equal.
2155− */
2156− if (s->object_size == obj_exts_cache->object_size)
2157− return obj_exts_cache->object_size + 1;
2158−
2159− return sz;
2160−}
2161−
21622126 int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s,
21632127 gfp_t gfp, unsigned int alloc_flags)
21642128 {
@@ -2168,14 +2132,18 @@ int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s, · 3 unmodified lines
21682132 unsigned long new_exts;
21692133 unsigned long old_exts;
21702134 struct slabobj_ext *vec;
2171− size_t sz;
2135+ size_t sz = sizeof(struct slabobj_ext) * slab->objects;
21722136
21732137 gfp &= ~OBJCGS_CLEAR_MASK;
2174− /* Prevent recursive extension vector allocation */
2175− alloc_flags |= SLAB_ALLOC_NO_RECURSE;
2176− alloc_flags &= ~SLAB_ALLOC_NEW_SLAB;
2138+ /*
2139+ * In most cases, obj_exts arrays are allocated from normal kmalloc.
2140+ * However, normal kmalloc caches must allocate them from
2141+ * KMALLOC_NO_OBJ_EXT caches to prevent recursion.
2142+ */
2143+ if (is_kmalloc_normal(s))
2144+ alloc_flags |= SLAB_ALLOC_NO_OBJ_EXT;
21772145
2178− sz = obj_exts_alloc_size(s, slab, gfp);
2146+ alloc_flags &= ~SLAB_ALLOC_NEW_SLAB;
21792147
21802148 /* This will use kmalloc_nolock() if alloc_flags say so */
21812149 vec = kmalloc_flags(sz, gfp | __GFP_ZERO, alloc_flags, slab_nid(slab));
@@ -2193,8 +2161,21 @@ int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s, · 11 unmodified lines
21932161 return -ENOMEM;
21942162 }
21952163
2196− VM_WARN_ON_ONCE(virt_to_slab(vec) != NULL &&
2197− virt_to_slab(vec)->slab_cache == s);
2164+ if (IS_ENABLED(CONFIG_DEBUG_VM)) {
2165+ struct kmem_cache *exts_cache;
2166+ struct slab *exts_slab;
2167+
2168+ exts_slab = virt_to_slab(vec);
2169+ if (exts_slab) {
2170+ /*
2171+ * The vector must be allocated from either normal or
2172+ * KMALLOC_NO_OBJ_EXT kmalloc caches to avoid cycles.
2173+ */
2174+ exts_cache = exts_slab->slab_cache;
2175+ WARN_ON_ONCE(!is_kmalloc_normal(exts_cache) &&
2176+ !(exts_cache->flags & SLAB_NO_OBJ_EXT));
2177+ }
2178+ }
21982179
21992180 new_exts = (unsigned long)vec;
22002181 #ifdef CONFIG_MEMCG
@@ -2217,7 +2198,6 @@ retry: · 16 unmodified lines
22172198 * assign slabobj_exts in parallel. In this case the existing
22182199 * objcg vector should be reused.
22192200 */
2220− mark_obj_codetag_empty(vec);
22212201 if (unlikely(!allow_spin))
22222202 kfree_nolock(vec);
22232203 else
@@ -2253,14 +2233,6 @@ static inline void free_slab_obj_exts(struct slab *slab, bool allow_spin) · 29 unmodified lines
22532233 return;
22542234 }
22552235
2256− /*
2257− * obj_exts was created with SLAB_ALLOC_NO_RECURSE flag, therefore its
2258− * corresponding extension will be NULL. alloc_tag_sub() will throw a
2259− * warning if slab has extensions but the extension of an object is
2260− * NULL, therefore replace NULL with CODETAG_EMPTY to indicate that
2261− * the extension for obj_exts is expected to be NULL.
2262− */
2263− mark_obj_codetag_empty(obj_exts);
22642236 if (allow_spin)
22652237 kfree(obj_exts);
22662238 else
@@ -5356,7 +5328,7 @@ void *__do_kmalloc_node(kmem_buckets *b, gfp_t flags, int node, · 3089 unmodified lines
53565328 if (unlikely(!size))
53575329 return ZERO_SIZE_PTR;
53585330
5359− s = kmalloc_slab(size, b, flags, token);
5331+ s = kmalloc_slab(size, b, flags, token, ac->alloc_flags);
53605332
53615333 ret = slab_alloc_node(s, flags, node, ac);
53625334 ret = kasan_kmalloc(s, ret, size, flags);
@@ -5419,7 +5391,9 @@ static void *__kmalloc_nolock_noprof(DECL_TOKEN_PARAMS(size, token), gfp_t gfp_f · 56 unmodified lines
54195391 retry:
54205392 if (unlikely(size > KMALLOC_MAX_CACHE_SIZE))
54215393 return NULL;
5422− s = kmalloc_slab(size, NULL, gfp_flags, PASS_TOKEN_PARAM(token));
5394+
5395+ s = kmalloc_slab(size, NULL, gfp_flags, PASS_TOKEN_PARAM(token),
5396+ ac->alloc_flags);
54235397
54245398 if (!(s->flags & __CMPXCHG_DOUBLE) && !kmem_cache_debug(s))
54255399 /*
@@ -6217,7 +6191,6 @@ static void free_to_pcs_bulk(struct kmem_cache *s, size_t size, void **p) · 791 unmodified lines
62176191 void *remote_objects[PCS_BATCH_MAX];
62186192 unsigned int remote_nr = 0;
62196193
6220−next_remote_batch:
62216194 while (i < size) {
62226195 struct slab *slab = virt_to_slab(p[i]);
62236196
@@ -6232,8 +6205,11 @@ next_remote_batch: · 8 unmodified lines
62326205 if (unlikely(!can_free_to_pcs(slab))) {
62336206 remote_objects[remote_nr] = p[i];
62346207 p[i] = p[--size];
6235− if (++remote_nr >= PCS_BATCH_MAX)
6236− goto flush_remote;
6208+ if (++remote_nr >= PCS_BATCH_MAX) {
6209+ __kmem_cache_free_bulk(s, remote_nr, &remote_objects[0]);
6210+ stat_add(s, FREE_SLOWPATH, remote_nr);
6211+ remote_nr = 0;
6212+ }
62376213 continue;
62386214 }
62396215
@@ -6317,10 +6293,6 @@ flush_remote: · 77 unmodified lines
63176293 if (remote_nr) {
63186294 __kmem_cache_free_bulk(s, remote_nr, &remote_objects[0]);
63196295 stat_add(s, FREE_SLOWPATH, remote_nr);
6320− if (i < size) {
6321− remote_nr = 0;
6322− goto next_remote_batch;
6323− }
63246296 }
63256297 }
63266298
@@ -7801,12 +7773,12 @@ static unsigned int calculate_sheaf_capacity(struct kmem_cache *s, · 1474 unmodified lines
78017773 return 0;
78027774
78037775 /*
7804− * Bootstrap caches can't have sheaves for now (SLAB_NO_OBJ_EXT).
7776+ * Bootstrap caches can't have sheaves for now (SLAB_NO_SHEAVES).
78057777 * SLAB_NOLEAKTRACE caches (e.g., kmemleak's object_cache) must not
78067778 * have sheaves to avoid recursion when sheaf allocation triggers
78077779 * kmemleak tracking.
78087780 */
7809− if (s->flags & (SLAB_NO_OBJ_EXT | SLAB_NOLEAKTRACE))
7781+ if (s->flags & (SLAB_NO_SHEAVES | SLAB_NOLEAKTRACE))
78107782 return 0;
78117783
78127784 /*
@@ -7981,10 +7953,10 @@ static int calculate_sizes(struct kmem_cache_args *args, struct kmem_cache *s) · 168 unmodified lines
79817953 s->allocflags |= __GFP_RECLAIMABLE;
79827954
79837955 /*
7984− * For KMALLOC_NORMAL caches we enable sheaves later by
7985− * bootstrap_kmalloc_sheaves() to avoid recursion
7956+ * For kmalloc caches we enable sheaves later by
7957+ * bootstrap_kmalloc_sheaves() to avoid recursion.
79867958 */
7987− if (!is_kmalloc_normal(s))
7959+ if (!is_kmalloc_cache(s))
79887960 s->sheaf_capacity = calculate_sheaf_capacity(s, args);
79897961
79907962 /*
@@ -8499,6 +8471,8 @@ static void __init bootstrap_cache_sheaves(struct kmem_cache *s) · 508 unmodified lines
84998471 bool failed = false;
85008472 int node, cpu;
85018473
8474+ VM_WARN_ON_ONCE(cache_has_sheaves(s));
8475+
85028476 capacity = calculate_sheaf_capacity(s, &empty_args);
85038477
85048478 /* capacity can be 0 due to debugging or SLUB_TINY */
@@ -8548,10 +8522,13 @@ static void __init bootstrap_kmalloc_sheaves(void) · 43 unmodified lines
85488522 {
85498523 enum kmalloc_cache_type type;
85508524
8551− for (type = KMALLOC_NORMAL; type <= KMALLOC_PARTITION_END; type++) {
8525+ for (type = KMALLOC_NORMAL; type < NR_KMALLOC_TYPES; type++) {
85528526 for (int idx = 0; idx < KMALLOC_SHIFT_HIGH + 1; idx++) {
8553− if (kmalloc_caches[type][idx])
8554− bootstrap_cache_sheaves(kmalloc_caches[type][idx]);
8527+ struct kmem_cache *s = kmalloc_caches[type][idx];
8528+
8529+ /* Do not bootstrap twice when caches are aliased */
8530+ if (s && !cache_has_sheaves(s))
8531+ bootstrap_cache_sheaves(s);
85558532 }
85568533 }
85578534 }
@@ -8583,7 +8560,8 @@ void __init kmem_cache_init(void) · 25 unmodified lines
85838560
85848561 create_boot_cache(kmem_cache_node, "kmem_cache_node",
85858562 sizeof(struct kmem_cache_node),
8586− SLAB_HWCACHE_ALIGN | SLAB_NO_OBJ_EXT, 0, 0);
8563+ SLAB_HWCACHE_ALIGN | SLAB_NO_SHEAVES | SLAB_NO_OBJ_EXT,
8564+ 0, 0);
85878565
85888566 hotplug_node_notifier(slab_memory_callback, SLAB_CALLBACK_PRI);
85898567
@@ -8593,7 +8571,8 @@ void __init kmem_cache_init(void) · 3 unmodified lines
85938571 create_boot_cache(kmem_cache, "kmem_cache",
85948572 offsetof(struct kmem_cache, per_node) +
85958573 nr_node_ids * sizeof(struct kmem_cache_per_node_ptrs),
8596− SLAB_HWCACHE_ALIGN | SLAB_NO_OBJ_EXT, 0, 0);
8574+ SLAB_HWCACHE_ALIGN | SLAB_NO_SHEAVES | SLAB_NO_OBJ_EXT,
8575+ 0, 0);
85978576
85988577 kmem_cache = bootstrap(&boot_kmem_cache);
85998578 kmem_cache_node = bootstrap(&boot_kmem_cache_node);
mm/userfaultfd.c+4−1
@@ -2111,7 +2111,10 @@ static bool vma_can_userfault(struct vm_area_struct *vma, vm_flags_t vm_flags, · 2110 unmodified lines
21112111 {
21122112 const struct vm_uffd_ops *ops = vma_uffd_ops(vma);
21132113
2114− if (vma->vm_flags & VM_DROPPABLE)
2114+ if (vma->vm_flags & (VM_DROPPABLE | VM_SHADOW_STACK))
2115+ return false;
2116+
2117+ if (!is_vm_hugetlb_page(vma) && (vma->vm_flags & VM_SPECIAL))
21152118 return false;
21162119
21172120 vm_flags &= __VM_UFFD_FLAGS;
net/bluetooth/hci_sync.c+11−2
@@ -929,12 +929,16 @@ int hci_update_eir_sync(struct hci_dev *hdev) · 928 unmodified lines
929929
930930 memset(&cp, 0, sizeof(cp));
931931
932+ hci_dev_lock(hdev);
932933 eir_create(hdev, cp.data);
933934
934− if (memcmp(cp.data, hdev->eir, sizeof(cp.data)) == 0)
935+ if (memcmp(cp.data, hdev->eir, sizeof(cp.data)) == 0) {
936+ hci_dev_unlock(hdev);
935937 return 0;
938+ }
936939
937940 memcpy(hdev->eir, cp.data, sizeof(cp.data));
941+ hci_dev_unlock(hdev);
938942
939943 return __hci_cmd_sync_status(hdev, HCI_OP_WRITE_EIR, sizeof(cp), &cp,
940944 HCI_CMD_TIMEOUT);
@@ -966,6 +970,7 @@ int hci_update_class_sync(struct hci_dev *hdev) · 25 unmodified lines
966970 if (hci_dev_test_flag(hdev, HCI_SERVICE_CACHE))
967971 return 0;
968972
973+ hci_dev_lock(hdev);
969974 cod[0] = hdev->minor_class;
970975 cod[1] = hdev->major_class;
971976 cod[2] = get_service_classes(hdev);
@@ -973,8 +978,12 @@ int hci_update_class_sync(struct hci_dev *hdev) · 1 unmodified line
973978 if (hci_dev_test_flag(hdev, HCI_LIMITED_DISCOVERABLE))
974979 cod[1] |= 0x20;
975980
976− if (memcmp(cod, hdev->dev_class, 3) == 0)
981+ if (memcmp(cod, hdev->dev_class, 3) == 0) {
982+ hci_dev_unlock(hdev);
977983 return 0;
984+ }
985+
986+ hci_dev_unlock(hdev);
978987
979988 return __hci_cmd_sync_status(hdev, HCI_OP_WRITE_CLASS_OF_DEV,
980989 sizeof(cod), cod, HCI_CMD_TIMEOUT);
net/bluetooth/rfcomm/core.c+17−0
@@ -1028,6 +1028,23 @@ int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, · 1027 unmodified lines
10281028 return rfcomm_send_frame(s, buf, ptr - buf);
10291029 }
10301030
1031+int rfcomm_dlc_send_rpn(struct rfcomm_dlc *d, u8 bit_rate, u8 data_bits,
1032+ u8 stop_bits, u8 parity, u8 flow_ctrl_settings,
1033+ u8 xon_char, u8 xoff_char, u16 param_mask)
1034+{
1035+ int err = -ENOTCONN;
1036+
1037+ rfcomm_lock();
1038+ if (d->session)
1039+ err = rfcomm_send_rpn(d->session, 1, d->dlci, bit_rate,
1040+ data_bits, stop_bits, parity,
1041+ flow_ctrl_settings, xon_char, xoff_char,
1042+ param_mask);
1043+ rfcomm_unlock();
1044+
1045+ return err;
1046+}
1047+
10311048 static int rfcomm_send_rls(struct rfcomm_session *s, int cr, u8 dlci, u8 status)
10321049 {
10331050 struct rfcomm_hdr *hdr;
net/bluetooth/rfcomm/tty.c+3−4
@@ -858,7 +858,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, · 857 unmodified lines
858858
859859 BT_DBG("tty %p termios %p", tty, old);
860860
861− if (!dev || !dev->dlc || !dev->dlc->session)
861+ if (!dev || !dev->dlc)
862862 return;
863863
864864 /* Handle turning off CRTSCTS */
@@ -979,9 +979,8 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, · 114 unmodified lines
979979 }
980980
981981 if (changes)
982− rfcomm_send_rpn(dev->dlc->session, 1, dev->dlc->dlci, baud,
983− data_bits, stop_bits, parity,
984− RFCOMM_RPN_FLOW_NONE, x_on, x_off, changes);
982+ rfcomm_dlc_send_rpn(dev->dlc, baud, data_bits, stop_bits, parity,
983+ RFCOMM_RPN_FLOW_NONE, x_on, x_off, changes);
985984 }
986985
987986 static void rfcomm_tty_throttle(struct tty_struct *tty)
net/bridge/br_netlink_tunnel.c+2−1
@@ -271,7 +271,8 @@ static void __vlan_tunnel_handle_range(const struct net_bridge_port *p, · 270 unmodified lines
271271 if (!*v_start)
272272 goto out_init;
273273
274− if (v && curr_change && br_vlan_can_enter_range(v, *v_end)) {
274+ if (v && curr_change &&
275+ br_vlan_can_enter_range(v, *v_end, br_get_pvid(vg))) {
275276 *v_end = v;
276277 return;
277278 }
net/bridge/br_private.h+4−2
@@ -1627,7 +1627,8 @@ void br_vlan_notify(const struct net_bridge *br, · 1626 unmodified lines
16271627 u16 vid, u16 vid_range,
16281628 int cmd);
16291629 bool br_vlan_can_enter_range(const struct net_bridge_vlan *v_curr,
1630− const struct net_bridge_vlan *range_end);
1630+ const struct net_bridge_vlan *range_end,
1631+ u16 pvid);
16311632
16321633 void br_vlan_fill_forward_path_pvid(struct net_bridge *br,
16331634 struct net_device_path_ctx *ctx,
@@ -1874,7 +1875,8 @@ static inline void br_vlan_notify(const struct net_bridge *br, · 240 unmodified lines
18741875 }
18751876
18761877 static inline bool br_vlan_can_enter_range(const struct net_bridge_vlan *v_curr,
1877− const struct net_bridge_vlan *range_end)
1878+ const struct net_bridge_vlan *range_end,
1879+ u16 pvid)
18781880 {
18791881 return true;
18801882 }
net/bridge/br_vlan.c+6−4
@@ -1982,9 +1982,11 @@ out_kfree: · 1981 unmodified lines
19821982
19831983 /* check if v_curr can enter a range ending in range_end */
19841984 bool br_vlan_can_enter_range(const struct net_bridge_vlan *v_curr,
1985− const struct net_bridge_vlan *range_end)
1985+ const struct net_bridge_vlan *range_end,
1986+ u16 pvid)
19861987 {
1987− return v_curr->vid - range_end->vid == 1 &&
1988+ return v_curr->vid != pvid && range_end->vid != pvid &&
1989+ v_curr->vid - range_end->vid == 1 &&
19881990 range_end->flags == v_curr->flags &&
19891991 br_vlan_opts_eq_range(v_curr, range_end);
19901992 }
@@ -2066,8 +2068,8 @@ static int br_vlan_dump_dev(const struct net_device *dev, · 75 unmodified lines
20662068 idx += range_end->vid - range_start->vid + 1;
20672069
20682070 range_start = v;
2069− } else if (dump_stats || v->vid == pvid ||
2070− !br_vlan_can_enter_range(v, range_end)) {
2071+ } else if (dump_stats ||
2072+ !br_vlan_can_enter_range(v, range_end, pvid)) {
20712073 u16 vlan_flags = br_vlan_flags(range_start, pvid);
20722074
20732075 if (!br_vlan_fill_vids(skb, range_start->vid,
net/bridge/br_vlan_options.c+1−2
@@ -350,8 +350,7 @@ int br_vlan_process_options(const struct net_bridge *br, · 349 unmodified lines
350350 continue;
351351 }
352352
353− if (v->vid == pvid ||
354− !br_vlan_can_enter_range(v, curr_end)) {
353+ if (!br_vlan_can_enter_range(v, curr_end, pvid)) {
355354 br_vlan_notify(br, p, curr_start->vid,
356355 curr_end->vid, RTM_NEWVLAN);
357356 curr_start = v;
net/ceph/auth_x.c+8−1
@@ -849,9 +849,16 @@ static int ceph_x_update_authorizer( · 848 unmodified lines
849849
850850 au = (struct ceph_x_authorizer *)auth->authorizer;
851851 if (au->secret_id < th->secret_id) {
852+ int ret;
853+
852854 dout("ceph_x_update_authorizer service %u secret %llu < %llu\n",
853855 au->service, au->secret_id, th->secret_id);
854− return ceph_x_build_authorizer(ac, th, au);
856+ ret = ceph_x_build_authorizer(ac, th, au);
857+ if (ret)
858+ return ret;
859+
860+ auth->authorizer_buf = au->buf->vec.iov_base;
861+ auth->authorizer_buf_len = au->buf->vec.iov_len;
855862 }
856863 return 0;
857864 }
net/ceph/ceph_common.c+2−2
@@ -762,13 +762,13 @@ void ceph_destroy_client(struct ceph_client *client) · 761 unmodified lines
762762
763763 atomic_set(&client->msgr.stopping, 1);
764764
765+ ceph_debugfs_client_cleanup(client);
766+
765767 /* unmount */
766768 ceph_osdc_stop(&client->osdc);
767769 ceph_monc_stop(&client->monc);
768770 ceph_messenger_fini(&client->msgr);
769771
770− ceph_debugfs_client_cleanup(client);
771−
772772 ceph_destroy_options(client->options);
773773
774774 kfree(client);
net/ceph/cls_lock_client.c+6−2
@@ -299,7 +299,7 @@ static int decode_lockers(void **p, void *end, u8 *type, char **tag, · 298 unmodified lines
299299 if (ret)
300300 return ret;
301301
302− *num_lockers = ceph_decode_32(p);
302+ ceph_decode_32_safe(p, end, *num_lockers, err_inval);
303303 *lockers = kzalloc_objs(**lockers, *num_lockers, GFP_NOIO);
304304 if (!*lockers)
305305 return -ENOMEM;
@@ -310,7 +310,8 @@ static int decode_lockers(void **p, void *end, u8 *type, char **tag, · 4 unmodified lines
310310 goto err_free_lockers;
311311 }
312312
313− *type = ceph_decode_8(p);
313+ ret = -EINVAL;
314+ ceph_decode_8_safe(p, end, *type, err_free_lockers);
314315 s = ceph_extract_encoded_string(p, end, NULL, GFP_NOIO);
315316 if (IS_ERR(s)) {
316317 ret = PTR_ERR(s);
@@ -320,6 +321,9 @@ static int decode_lockers(void **p, void *end, u8 *type, char **tag, · 3 unmodified lines
320321 *tag = s;
321322 return 0;
322323
324+err_inval:
325+ return -EINVAL;
326+
323327 err_free_lockers:
324328 ceph_free_lockers(*lockers, *num_lockers);
325329 return ret;
net/ceph/mon_client.c+2−2
@@ -114,7 +114,7 @@ static struct ceph_monmap *ceph_monmap_decode(void **p, void *end, bool msgr2) · 113 unmodified lines
114114
115115 dout("%s fsid %pU epoch %u num_mon %u\n", __func__, &fsid, epoch,
116116 num_mon);
117− if (num_mon > CEPH_MAX_MON)
117+ if (num_mon == 0 || num_mon > CEPH_MAX_MON)
118118 goto e_inval;
119119
120120 monmap = kmalloc_flex(*monmap, mon_inst, num_mon, GFP_NOIO);
@@ -821,7 +821,7 @@ static void handle_get_version_reply(struct ceph_mon_client *monc, · 700 unmodified lines
821821 struct ceph_mon_generic_request *req;
822822 u64 tid = le64_to_cpu(msg->hdr.tid);
823823 void *p = msg->front.iov_base;
824− void *end = p + msg->front_alloc_len;
824+ void *const end = p + msg->front.iov_len;
825825 u64 handle;
826826
827827 dout("%s msg %p tid %llu\n", __func__, msg, tid);
net/ceph/osdmap.c+12−4
@@ -518,6 +518,8 @@ static struct crush_map *crush_decode(void *pbyval, void *end) · 517 unmodified lines
518518 ceph_decode_need(p, end, 4*sizeof(u32), bad);
519519 b->id = ceph_decode_32(p);
520520 b->type = ceph_decode_16(p);
521+ if (b->type == 0)
522+ goto bad;
521523 b->alg = ceph_decode_8(p);
522524 if (b->alg != alg) {
523525 b->alg = 0;
@@ -1436,7 +1438,7 @@ static struct ceph_pg_mapping *__decode_pg_temp(void **p, void *end, · 912 unmodified lines
14361438 ceph_decode_32_safe(p, end, len, e_inval);
14371439 if (len == 0 && incremental)
14381440 return NULL; /* new_pg_temp: [] to remove */
1439− if ((size_t)len > (SIZE_MAX - sizeof(*pg)) / sizeof(u32))
1441+ if (len > CEPH_PG_MAX_SIZE)
14401442 return ERR_PTR(-EINVAL);
14411443
14421444 ceph_decode_need(p, end, len * sizeof(u32), e_inval);
@@ -1617,7 +1619,7 @@ static struct ceph_pg_mapping *__decode_pg_upmap_items(void **p, void *end, · 174 unmodified lines
16171619 u32 len, i;
16181620
16191621 ceph_decode_32_safe(p, end, len, e_inval);
1620− if ((size_t)len > (SIZE_MAX - sizeof(*pg)) / (2 * sizeof(u32)))
1622+ if (len > CEPH_PG_MAX_SIZE)
16211623 return ERR_PTR(-EINVAL);
16221624
16231625 ceph_decode_need(p, end, 2 * len * sizeof(u32), e_inval);
@@ -1842,6 +1844,8 @@ static int decode_new_up_state_weight(void **p, void *end, u8 struct_v, · 218 unmodified lines
18421844 void *new_up_client;
18431845 void *new_state;
18441846 void *new_weight_end;
1847+ const u32 new_state_item_size =
1848+ sizeof(u32) + (struct_v >= 5 ? sizeof(u32) : sizeof(u8));
18451849 u32 len;
18461850 int ret;
18471851 int i;
@@ -1862,7 +1866,8 @@ static int decode_new_up_state_weight(void **p, void *end, u8 struct_v, · 14 unmodified lines
18621866
18631867 new_state = *p;
18641868 ceph_decode_32_safe(p, end, len, e_inval);
1865− len *= sizeof(u32) + (struct_v >= 5 ? sizeof(u32) : sizeof(u8));
1869+ if (check_mul_overflow(len, new_state_item_size, &len))
1870+ goto e_inval;
18661871 ceph_decode_need(p, end, len, e_inval);
18671872 *p += len;
18681873
@@ -3055,8 +3060,11 @@ static int get_immediate_parent(struct crush_map *c, int id, · 1186 unmodified lines
30553060 if (b->items[j] != id)
30563061 continue;
30573062
3058− *parent_type_id = b->type;
30593063 type_cn = lookup_crush_name(&c->type_names, b->type);
3064+ if (WARN_ON_ONCE(!type_cn))
3065+ continue;
3066+
3067+ *parent_type_id = b->type;
30603068 parent_loc->cl_type_name = type_cn->cn_name;
30613069 parent_loc->cl_name = cn->cn_name;
30623070 return b->id;
net/core/drop_monitor.c+7−11
@@ -530,10 +530,10 @@ static void net_dm_packet_trace_kfree_skb_hit(void *ignore, · 529 unmodified lines
530530 return;
531531
532532 unlock_free:
533− spin_unlock_irqrestore(&data->drop_queue.lock, flags);
534533 u64_stats_update_begin(&data->stats.syncp);
535534 u64_stats_inc(&data->stats.dropped);
536535 u64_stats_update_end(&data->stats.syncp);
536+ spin_unlock_irqrestore(&data->drop_queue.lock, flags);
537537 consume_skb(nskb);
538538 }
539539
@@ -566,13 +566,13 @@ static size_t net_dm_packet_report_size(size_t payload_len) · 26 unmodified lines
566566 /* NET_DM_ATTR_ORIGIN */
567567 nla_total_size(sizeof(u16)) +
568568 /* NET_DM_ATTR_PC */
569− nla_total_size(sizeof(u64)) +
569+ nla_total_size_64bit(sizeof(u64)) +
570570 /* NET_DM_ATTR_SYMBOL */
571571 nla_total_size(NET_DM_MAX_SYMBOL_LEN + 1) +
572572 /* NET_DM_ATTR_IN_PORT */
573573 net_dm_in_port_size() +
574574 /* NET_DM_ATTR_TIMESTAMP */
575− nla_total_size(sizeof(u64)) +
575+ nla_total_size_64bit(sizeof(u64)) +
576576 /* NET_DM_ATTR_ORIG_LEN */
577577 nla_total_size(sizeof(u32)) +
578578 /* NET_DM_ATTR_PROTO */
@@ -671,9 +671,7 @@ static int net_dm_packet_report_fill(struct sk_buff *msg, struct sk_buff *skb, · 92 unmodified lines
671671 if (nla_put_u16(msg, NET_DM_ATTR_PROTO, be16_to_cpu(skb->protocol)))
672672 goto nla_put_failure;
673673
674− attr = skb_put(msg, nla_total_size(payload_len));
675− attr->nla_type = NET_DM_ATTR_PAYLOAD;
676− attr->nla_len = nla_attr_size(payload_len);
674+ attr = __nla_reserve(msg, NET_DM_ATTR_PAYLOAD, payload_len);
677675 if (skb_copy_bits(skb, 0, nla_data(attr), payload_len))
678676 goto nla_put_failure;
679677
@@ -768,7 +766,7 @@ net_dm_hw_packet_report_size(size_t payload_len, · 88 unmodified lines
768766 /* NET_DM_ATTR_FLOW_ACTION_COOKIE */
769767 net_dm_flow_action_cookie_size(hw_metadata) +
770768 /* NET_DM_ATTR_TIMESTAMP */
771− nla_total_size(sizeof(u64)) +
769+ nla_total_size_64bit(sizeof(u64)) +
772770 /* NET_DM_ATTR_ORIG_LEN */
773771 nla_total_size(sizeof(u32)) +
774772 /* NET_DM_ATTR_PROTO */
@@ -831,9 +829,7 @@ static int net_dm_hw_packet_report_fill(struct sk_buff *msg, · 56 unmodified lines
831829 if (nla_put_u16(msg, NET_DM_ATTR_PROTO, be16_to_cpu(skb->protocol)))
832830 goto nla_put_failure;
833831
834− attr = skb_put(msg, nla_total_size(payload_len));
835− attr->nla_type = NET_DM_ATTR_PAYLOAD;
836− attr->nla_len = nla_attr_size(payload_len);
832+ attr = __nla_reserve(msg, NET_DM_ATTR_PAYLOAD, payload_len);
837833 if (skb_copy_bits(skb, 0, nla_data(attr), payload_len))
838834 goto nla_put_failure;
839835
@@ -1001,10 +997,10 @@ net_dm_hw_trap_packet_probe(void *ignore, const struct devlink *devlink, · 161 unmodified lines
1001997 return;
1002998
1003999 unlock_free:
1004− spin_unlock_irqrestore(&hw_data->drop_queue.lock, flags);
10051000 u64_stats_update_begin(&hw_data->stats.syncp);
10061001 u64_stats_inc(&hw_data->stats.dropped);
10071002 u64_stats_update_end(&hw_data->stats.syncp);
1003+ spin_unlock_irqrestore(&hw_data->drop_queue.lock, flags);
10081004 net_dm_hw_metadata_free(n_hw_metadata);
10091005 free:
10101006 consume_skb(nskb);
net/core/filter.c+11−6
@@ -2552,11 +2552,13 @@ out_drop: · 2551 unmodified lines
25522552
25532553 BPF_CALL_2(bpf_redirect, u32, ifindex, u64, flags)
25542554 {
2555− struct bpf_redirect_info *ri = bpf_net_ctx_get_ri();
2555+ struct bpf_redirect_info *ri;
25562556
2557− if (unlikely(flags & (~(BPF_F_INGRESS) | BPF_F_REDIRECT_INTERNAL)))
2557+ if (unlikely(!bpf_net_ctx_get() ||
2558+ (flags & (~(BPF_F_INGRESS) | BPF_F_REDIRECT_INTERNAL))))
25582559 return TC_ACT_SHOT;
25592560
2561+ ri = bpf_net_ctx_get_ri();
25602562 ri->flags = flags;
25612563 ri->tgt_index = ifindex;
25622564
@@ -2573,11 +2575,12 @@ static const struct bpf_func_proto bpf_redirect_proto = { · 10 unmodified lines
25732575
25742576 BPF_CALL_2(bpf_redirect_peer, u32, ifindex, u64, flags)
25752577 {
2576− struct bpf_redirect_info *ri = bpf_net_ctx_get_ri();
2578+ struct bpf_redirect_info *ri;
25772579
2578− if (unlikely(flags))
2580+ if (unlikely(!bpf_net_ctx_get() || flags))
25792581 return TC_ACT_SHOT;
25802582
2583+ ri = bpf_net_ctx_get_ri();
25812584 ri->flags = BPF_F_PEER;
25822585 ri->tgt_index = ifindex;
25832586
@@ -2595,11 +2598,13 @@ static const struct bpf_func_proto bpf_redirect_peer_proto = { · 11 unmodified lines
25952598 BPF_CALL_4(bpf_redirect_neigh, u32, ifindex, struct bpf_redir_neigh *, params,
25962599 int, plen, u64, flags)
25972600 {
2598− struct bpf_redirect_info *ri = bpf_net_ctx_get_ri();
2601+ struct bpf_redirect_info *ri;
25992602
2600− if (unlikely((plen && plen < sizeof(*params)) || flags))
2603+ if (unlikely((plen && plen < sizeof(*params)) ||
2604+ !bpf_net_ctx_get() || flags))
26012605 return TC_ACT_SHOT;
26022606
2607+ ri = bpf_net_ctx_get_ri();
26032608 ri->flags = BPF_F_NEIGH | (plen ? BPF_F_NEXTHOP : 0);
26042609 ri->tgt_index = ifindex;
26052610
net/core/gro.c+3−1
@@ -229,7 +229,9 @@ done: · 228 unmodified lines
229229
230230 int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb)
231231 {
232− if (unlikely(p->len + skb->len >= 65536))
232+ /* make sure to check flush flag and to not merge */
233+ if (unlikely(p->len + skb->len >= 65536 ||
234+ NAPI_GRO_CB(skb)->flush))
233235 return -E2BIG;
234236
235237 if (!pskb_may_pull(skb, skb_gro_offset(skb))) {
net/core/sock.c+5−5
@@ -2547,6 +2547,11 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority, · 2546 unmodified lines
25472547
25482548 cgroup_sk_clone(&newsk->sk_cgrp_data);
25492549
2550+ RCU_INIT_POINTER(newsk->sk_reuseport_cb, NULL);
2551+
2552+ if (sock_needs_netstamp(sk) && newsk->sk_flags & SK_FLAGS_TIMESTAMP)
2553+ net_enable_timestamp();
2554+
25502555 rcu_read_lock();
25512556 filter = rcu_dereference(sk->sk_filter);
25522557 if (filter != NULL)
@@ -2569,8 +2574,6 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority, · 16 unmodified lines
25692574 goto free;
25702575 }
25712576
2572− RCU_INIT_POINTER(newsk->sk_reuseport_cb, NULL);
2573−
25742577 if (bpf_sk_storage_clone(sk, newsk))
25752578 goto free;
25762579
@@ -2598,9 +2601,6 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority, · 21 unmodified lines
25982601
25992602 if (newsk->sk_prot->sockets_allocated)
26002603 sk_sockets_allocated_inc(newsk);
2601−
2602− if (sock_needs_netstamp(sk) && newsk->sk_flags & SK_FLAGS_TIMESTAMP)
2603− net_enable_timestamp();
26042604 out:
26052605 return newsk;
26062606 free:
net/hsr/hsr_slave.c+2−0
@@ -242,6 +242,8 @@ void hsr_del_port(struct hsr_port *port) · 241 unmodified lines
242242 netdev_rx_handler_unregister(port->dev);
243243 if (!port->hsr->fwd_offloaded)
244244 dev_set_promiscuity(port->dev, -1);
245+ if (port->type == HSR_PT_SLAVE_A || port->type == HSR_PT_SLAVE_B)
246+ vlan_vids_del_by_dev(port->dev, master->dev);
245247 netdev_upper_dev_unlink(port->dev, master->dev);
246248 if (hsr->prot_version == PRP_V1 &&
247249 port->type == HSR_PT_SLAVE_B) {
net/ipv4/datagram.c+2−2
@@ -63,12 +63,12 @@ int __ip4_datagram_connect(struct sock *sk, struct sockaddr_unsized *uaddr, int · 62 unmodified lines
6363 }
6464
6565 /* Update addresses before rehashing */
66− inet->inet_daddr = fl4->daddr;
66+ WRITE_ONCE(inet->inet_daddr, fl4->daddr);
6767 inet->inet_dport = usin->sin_port;
6868 if (!inet->inet_saddr)
6969 inet->inet_saddr = fl4->saddr;
7070 if (!inet->inet_rcv_saddr) {
71− inet->inet_rcv_saddr = fl4->saddr;
71+ WRITE_ONCE(inet->inet_rcv_saddr, fl4->saddr);
7272 if (sk->sk_prot->rehash)
7373 sk->sk_prot->rehash(sk);
7474 }
net/ipv4/icmp.c+15−3
@@ -548,11 +548,23 @@ static struct rtable *icmp_route_lookup(struct net *net, struct flowi4 *fl4, · 547 unmodified lines
548548 if (IS_ERR(rt2))
549549 err = PTR_ERR(rt2);
550550 } else {
551− struct flowi4 fl4_2 = {};
551+ struct flowi4 fl4_2 = fl4_dec;
552552 unsigned long orefdst;
553553
554− fl4_2.daddr = fl4_dec.saddr;
555− rt2 = ip_route_output_key(net, &fl4_2);
554+ swap(fl4_2.daddr, fl4_2.saddr);
555+ switch (fl4_2.flowi4_proto) {
556+ case IPPROTO_TCP:
557+ case IPPROTO_UDP:
558+ case IPPROTO_SCTP:
559+ case IPPROTO_DCCP:
560+ swap(fl4_2.fl4_sport, fl4_2.fl4_dport);
561+ break;
562+ }
563+
564+ fl4_2.flowi4_oif = l3mdev_master_ifindex(route_lookup_dev);
565+ fl4_2.flowi4_flags |= FLOWI_FLAG_ANYSRC;
566+
567+ rt2 = __ip_route_output_key(net, &fl4_2);
556568 if (IS_ERR(rt2)) {
557569 err = PTR_ERR(rt2);
558570 goto relookup_failed;
net/ipv4/ip_gre.c+2−2
@@ -1018,6 +1018,8 @@ static void __gre_tunnel_init(struct net_device *dev) · 1017 unmodified lines
10181018 dev->features |= GRE_FEATURES;
10191019 dev->hw_features |= GRE_FEATURES;
10201020
1021+ dev->lltx = true;
1022+
10211023 /* TCP offload with GRE SEQ is not supported, nor can we support 2
10221024 * levels of outer headers requiring an update.
10231025 */
@@ -1029,8 +1031,6 @@ static void __gre_tunnel_init(struct net_device *dev) · 5 unmodified lines
10291031
10301032 dev->features |= NETIF_F_GSO_SOFTWARE;
10311033 dev->hw_features |= NETIF_F_GSO_SOFTWARE;
1032−
1033− dev->lltx = true;
10341034 }
10351035
10361036 static int ipgre_tunnel_init(struct net_device *dev)
net/ipv4/nexthop.c+1−1
@@ -1788,8 +1788,8 @@ static bool nh_res_bucket_migrate(struct nh_res_table *res_table, · 1787 unmodified lines
17881788 bool notify_nl, bool force)
17891789 {
17901790 struct nh_res_bucket *bucket = &res_table->nh_buckets[bucket_index];
1791+ struct netlink_ext_ack extack = {};
17911792 struct nh_grp_entry *new_nhge;
1792− struct netlink_ext_ack extack;
17931793 int err;
17941794
17951795 new_nhge = list_first_entry_or_null(&res_table->uw_nh_entries,
net/ipv4/raw.c+16−7
@@ -118,13 +118,21 @@ bool raw_v4_match(struct net *net, const struct sock *sk, unsigned short num, · 117 unmodified lines
118118 __be32 raddr, __be32 laddr, int dif, int sdif)
119119 {
120120 const struct inet_sock *inet = inet_sk(sk);
121+ __be32 daddr, rcv_saddr;
121122
122− if (net_eq(sock_net(sk), net) && inet->inet_num == num &&
123− !(inet->inet_daddr && inet->inet_daddr != raddr) &&
124− !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) &&
125− raw_sk_bound_dev_eq(net, sk->sk_bound_dev_if, dif, sdif))
126− return true;
127− return false;
123+ if (!net_eq(sock_net(sk), net) || inet->inet_num != num)
124+ return false;
125+
126+ daddr = READ_ONCE(inet->inet_daddr);
127+ if (daddr && daddr != raddr)
128+ return false;
129+
130+ rcv_saddr = READ_ONCE(inet->inet_rcv_saddr);
131+ if (rcv_saddr && rcv_saddr != laddr)
132+ return false;
133+
134+ return raw_sk_bound_dev_eq(net, READ_ONCE(sk->sk_bound_dev_if),
135+ dif, sdif);
128136 }
129137 EXPORT_SYMBOL_GPL(raw_v4_match);
130138
@@ -722,7 +730,8 @@ static int raw_bind(struct sock *sk, struct sockaddr_unsized *uaddr, · 591 unmodified lines
722730 chk_addr_ret))
723731 goto out;
724732
725− inet->inet_rcv_saddr = inet->inet_saddr = addr->sin_addr.s_addr;
733+ inet->inet_saddr = addr->sin_addr.s_addr;
734+ WRITE_ONCE(inet->inet_rcv_saddr, addr->sin_addr.s_addr);
726735 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
727736 inet->inet_saddr = 0; /* Use device */
728737 sk_dst_reset(sk);
net/ipv4/tcp_bpf.c+1−1
@@ -604,7 +604,7 @@ wait_for_sndbuf: · 603 unmodified lines
604604 wait_for_memory:
605605 err = sk_stream_wait_memory(sk, &timeo);
606606 if (err) {
607− if (msg_tx && msg_tx != psock->cork)
607+ if (msg_tx == &tmp)
608608 sk_msg_free(sk, msg_tx);
609609 goto out_err;
610610 }
net/ipv4/tcp_input.c+43−13
@@ -4038,24 +4038,17 @@ static void tcp_send_ack_reflect_ect(struct sock *sk, bool accecn_reflector) · 4037 unmodified lines
40384038 __tcp_send_ack(sk, tp->rcv_nxt, flags);
40394039 }
40404040
4041−/* RFC 5961 7 [ACK Throttling] */
4042−static void tcp_send_challenge_ack(struct sock *sk, bool accecn_reflector)
4041+/* Consume one slot from the per-netns RFC 5961 challenge ACK quota.
4042+ * Returns true if a challenge ACK may be sent.
4043+ */
4044+static bool tcp_challenge_ack_allowed(struct net *net)
40434045 {
4044− struct tcp_sock *tp = tcp_sk(sk);
4045− struct net *net = sock_net(sk);
40464046 u32 count, now, ack_limit;
40474047
4048− /* First check our per-socket dupack rate limit. */
4049− if (__tcp_oow_rate_limited(net,
4050− LINUX_MIB_TCPACKSKIPPEDCHALLENGE,
4051− &tp->last_oow_ack_time))
4052− return;
4053−
40544048 ack_limit = READ_ONCE(net->ipv4.sysctl_tcp_challenge_ack_limit);
40554049 if (ack_limit == INT_MAX)
4056− goto send_ack;
4050+ return true;
40574051
4058− /* Then check host-wide RFC 5961 rate limit. */
40594052 now = jiffies / HZ;
40604053 if (now != READ_ONCE(net->ipv4.tcp_challenge_timestamp)) {
40614054 u32 half = (ack_limit + 1) >> 1;
@@ -4067,12 +4060,49 @@ static void tcp_send_challenge_ack(struct sock *sk, bool accecn_reflector) · 5 unmodified lines
40674060 count = READ_ONCE(net->ipv4.tcp_challenge_count);
40684061 if (count > 0) {
40694062 WRITE_ONCE(net->ipv4.tcp_challenge_count, count - 1);
4070−send_ack:
4063+ return true;
4064+ }
4065+ return false;
4066+}
4067+
4068+/* RFC 5961 7 [ACK Throttling] */
4069+static void tcp_send_challenge_ack(struct sock *sk, bool accecn_reflector)
4070+{
4071+ struct tcp_sock *tp = tcp_sk(sk);
4072+ struct net *net = sock_net(sk);
4073+
4074+ /* First check our per-socket dupack rate limit. */
4075+ if (__tcp_oow_rate_limited(net,
4076+ LINUX_MIB_TCPACKSKIPPEDCHALLENGE,
4077+ &tp->last_oow_ack_time))
4078+ return;
4079+
4080+ /* Then check the per-netns RFC 5961 rate limit. */
4081+ if (tcp_challenge_ack_allowed(net)) {
40714082 NET_INC_STATS(net, LINUX_MIB_TCPCHALLENGEACK);
40724083 tcp_send_ack_reflect_ect(sk, accecn_reflector);
40734084 }
40744085 }
40754086
4087+/* Send a challenge ACK from a SYN-RECEIVED request socket. Uses
4088+ * __tcp_oow_rate_limited() directly so that an RST carrying payload
4089+ * cannot bypass the per-request rate limit.
4090+ */
4091+void tcp_reqsk_send_challenge_ack(struct sock *sk, struct sk_buff *skb,
4092+ struct request_sock *req)
4093+{
4094+ struct net *net = sock_net(sk);
4095+
4096+ if (__tcp_oow_rate_limited(net, LINUX_MIB_TCPACKSKIPPEDCHALLENGE,
4097+ &tcp_rsk(req)->last_oow_ack_time))
4098+ return;
4099+
4100+ if (tcp_challenge_ack_allowed(net)) {
4101+ NET_INC_STATS(net, LINUX_MIB_TCPCHALLENGEACK);
4102+ req->rsk_ops->send_ack(sk, skb, req);
4103+ }
4104+}
4105+
40764106 static void tcp_store_ts_recent(struct tcp_sock *tp)
40774107 {
40784108 tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval;
net/ipv4/tcp_ipv4.c+7−1
@@ -971,6 +971,9 @@ static void tcp_v4_send_ack(const struct sock *sk, · 970 unmodified lines
971971 key->rcv_next);
972972 arg.iov[0].iov_len += tcp_ao_len_aligned(key->ao_key);
973973 rep.th.doff = arg.iov[0].iov_len / 4;
974+ memset((u8 *)&rep.opt[offset] + tcp_ao_maclen(key->ao_key),
975+ TCPOPT_NOP, tcp_ao_len_aligned(key->ao_key) -
976+ tcp_ao_len(key->ao_key));
974977
975978 tcp_ao_hash_hdr(AF_INET, (char *)&rep.opt[offset],
976979 key->ao_key, key->traffic_key,
@@ -3143,8 +3146,11 @@ static struct sock *bpf_iter_tcp_batch(struct seq_file *seq) · 2166 unmodified lines
31433146 bpf_iter_tcp_put_batch(iter);
31443147 err = bpf_iter_tcp_realloc_batch(iter, expected * 3 / 2,
31453148 GFP_USER);
3146− if (err)
3149+ if (err) {
3150+ iter->cur_sk = 0;
3151+ iter->end_sk = 0;
31473152 return ERR_PTR(err);
3153+ }
31483154
31493155 sk = bpf_iter_tcp_resume(seq);
31503156 if (!sk)
net/ipv4/tcp_minisocks.c+11−1
@@ -833,7 +833,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, · 832 unmodified lines
833833 * elsewhere and is checked directly against the child socket rather
834834 * than req because user data may have been sent out.
835835 */
836− if ((flg & TCP_FLAG_ACK) && !fastopen &&
836+ if ((flg & TCP_FLAG_ACK) && !(flg & TCP_FLAG_RST) && !fastopen &&
837837 (TCP_SKB_CB(skb)->ack_seq !=
838838 tcp_rsk(req)->snt_isn + 1))
839839 return sk;
@@ -872,6 +872,16 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, · 32 unmodified lines
872872 flg &= ~TCP_FLAG_SYN;
873873 }
874874
875+ /* RFC 5961 section 3.2, as clarified by RFC 9293 section
876+ * 3.10.7.4, requires a challenge ACK for a non-exact
877+ * in-window RST in SYN-RECEIVED.
878+ */
879+ if ((flg & TCP_FLAG_RST) &&
880+ TCP_SKB_CB(skb)->seq != tcp_rsk(req)->rcv_nxt) {
881+ tcp_reqsk_send_challenge_ack(sk, skb, req);
882+ return NULL;
883+ }
884+
875885 /* RFC793: "second check the RST bit" and
876886 * "fourth, check the SYN bit"
877887 */
net/ipv6/ila/ila_common.c+12−0
@@ -85,6 +85,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb, · 84 unmodified lines
8585 struct tcphdr *th = (struct tcphdr *)
8686 (skb_network_header(skb) + nhoff);
8787
88+ ip6h = ipv6_hdr(skb);
8889 diff = get_csum_diff(ip6h, p);
8990 inet_proto_csum_replace_by_diff(&th->check, skb,
9091 diff, true, true);
@@ -96,6 +97,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb, · 5 unmodified lines
9697 (skb_network_header(skb) + nhoff);
9798
9899 if (uh->check || skb->ip_summed == CHECKSUM_PARTIAL) {
100+ ip6h = ipv6_hdr(skb);
99101 diff = get_csum_diff(ip6h, p);
100102 inet_proto_csum_replace_by_diff(&uh->check, skb,
101103 diff, true, true);
@@ -110,6 +112,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb, · 8 unmodified lines
110112 struct icmp6hdr *ih = (struct icmp6hdr *)
111113 (skb_network_header(skb) + nhoff);
112114
115+ ip6h = ipv6_hdr(skb);
113116 diff = get_csum_diff(ip6h, p);
114117 inet_proto_csum_replace_by_diff(&ih->icmp6_cksum, skb,
115118 diff, true, true);
@@ -127,6 +130,15 @@ void ila_update_ipv6_locator(struct sk_buff *skb, struct ila_params *p, · 11 unmodified lines
127130 switch (p->csum_mode) {
128131 case ILA_CSUM_ADJUST_TRANSPORT:
129132 ila_csum_adjust_transport(skb, p);
133+ /*
134+ * ila_csum_adjust_transport() calls pskb_may_pull(), which can
135+ * reallocate the skb head and leave ip6h (and the iaddr derived
136+ * from it) dangling; reload both before the write below. The
137+ * other csum modes do not pull, so their cached pointers stay
138+ * valid.
139+ */
140+ ip6h = ipv6_hdr(skb);
141+ iaddr = ila_a2i(&ip6h->daddr);
130142 break;
131143 case ILA_CSUM_NEUTRAL_MAP:
132144 if (sir2ila) {
net/ipv6/ip6_gre.c+2−2
@@ -1455,6 +1455,8 @@ static void ip6gre_tnl_init_features(struct net_device *dev) · 1454 unmodified lines
14551455 dev->features |= GRE6_FEATURES;
14561456 dev->hw_features |= GRE6_FEATURES;
14571457
1458+ dev->lltx = true;
1459+
14581460 /* TCP offload with GRE SEQ is not supported, nor can we support 2
14591461 * levels of outer headers requiring an update.
14601462 */
@@ -1466,8 +1468,6 @@ static void ip6gre_tnl_init_features(struct net_device *dev) · 5 unmodified lines
14661468
14671469 dev->features |= NETIF_F_GSO_SOFTWARE;
14681470 dev->hw_features |= NETIF_F_GSO_SOFTWARE;
1469−
1470− dev->lltx = true;
14711471 }
14721472
14731473 static int ip6gre_tunnel_init_common(struct net_device *dev)
net/ipv6/raw.c+1−1
@@ -349,7 +349,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr, · 348 unmodified lines
349349 const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data;
350350
351351 if (!raw_v6_match(net, sk, nexthdr, &ip6h->saddr, &ip6h->daddr,
352− inet6_iif(skb), inet6_iif(skb)))
352+ inet6_iif(skb), inet6_sdif(skb)))
353353 continue;
354354 rawv6_err(sk, skb, type, code, inner_offset, info);
355355 }
net/ipv6/route.c+2−2
@@ -4022,7 +4022,7 @@ static int __ip6_del_rt_siblings(struct fib6_info *rt, struct fib6_config *cfg) · 4021 unmodified lines
40224022 struct fib6_node *fn;
40234023
40244024 /* prefer to send a single notification with all hops */
4025− skb = nlmsg_new(rt6_nlmsg_size(rt), gfp_any());
4025+ skb = nlmsg_new(rt6_nlmsg_size(rt), GFP_ATOMIC);
40264026 if (skb) {
40274027 u32 seq = info->nlh ? info->nlh->nlmsg_seq : 0;
40284028
@@ -4078,7 +4078,7 @@ out_put: · 49 unmodified lines
40784078
40794079 if (skb) {
40804080 rtnl_notify(skb, net, info->portid, RTNLGRP_IPV6_ROUTE,
4081− info->nlh, gfp_any());
4081+ info->nlh, GFP_ATOMIC);
40824082 }
40834083 return err;
40844084 }
net/ipv6/tcp_ipv6.c+2−0
@@ -923,6 +923,8 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32 · 922 unmodified lines
923923 (tcp_ao_len(key->ao_key) << 16) |
924924 (key->ao_key->sndid << 8) |
925925 (key->rcv_next));
926+ memset((u8 *)topt + tcp_ao_maclen(key->ao_key), TCPOPT_NOP,
927+ tcp_ao_len_aligned(key->ao_key) - tcp_ao_len(key->ao_key));
926928
927929 tcp_ao_hash_hdr(AF_INET6, (char *)topt, key->ao_key,
928930 key->traffic_key,
net/iucv/af_iucv.c+16−1
@@ -337,6 +337,7 @@ static void iucv_sever_path(struct sock *sk, int with_user_data) · 336 unmodified lines
337337 unsigned char user_data[16];
338338 struct iucv_sock *iucv = iucv_sk(sk);
339339 struct iucv_path *path = iucv->path;
340+ struct sock_msg_q *p, *n;
340341
341342 /* Whoever resets the path pointer, must sever and free it. */
342343 if (xchg(&iucv->path, NULL)) {
@@ -348,6 +349,19 @@ static void iucv_sever_path(struct sock *sk, int with_user_data) · 5 unmodified lines
348349 } else
349350 pr_iucv->path_sever(path, NULL);
350351 iucv_path_free(path);
352+
353+ /*
354+ * Message notifications queued on message_q still reference
355+ * the now freed path; drop them, otherwise a later recvmsg()
356+ * would pass the freed iucv_path to message_receive() via
357+ * iucv_process_message_q().
358+ */
359+ spin_lock_bh(&iucv->message_q.lock);
360+ list_for_each_entry_safe(p, n, &iucv->message_q.list, list) {
361+ list_del(&p->list);
362+ kfree(p);
363+ }
364+ spin_unlock_bh(&iucv->message_q.lock);
351365 }
352366 }
353367
@@ -1872,7 +1886,8 @@ static int afiucv_hs_callback_syn(struct sock *sk, struct sk_buff *skb) · 1518 unmodified lines
18721886 afiucv_swap_src_dest(skb);
18731887 trans_hdr->flags = AF_IUCV_FLAG_SYN | AF_IUCV_FLAG_FIN;
18741888 err = dev_queue_xmit(skb);
1875− iucv_sock_kill(nsk);
1889+ if (nsk)
1890+ iucv_sock_kill(nsk);
18761891 bh_unlock_sock(sk);
18771892 goto out;
18781893 }
net/mac80211/cfg.c+3−0
@@ -2611,6 +2611,9 @@ static int sta_apply_parameters(struct ieee80211_local *local, · 2610 unmodified lines
26112611 memcpy(&sta->deflink.pub->supp_rates,
26122612 &nmi_sta->deflink.pub->supp_rates,
26132613 sizeof(sta->deflink.pub->supp_rates));
2614+
2615+ sta->deflink.pub->agg = nmi_sta->deflink.pub->agg;
2616+ __ieee80211_sta_recalc_aggregates(sta, 0);
26142617 }
26152618
26162619 /* set the STA state after all sta info from usermode has been set */
net/mac80211/link.c+4−0
@@ -399,6 +399,10 @@ static int ieee80211_vif_update_links(struct ieee80211_sub_if_data *sdata, · 398 unmodified lines
399399 memcpy(sdata->link, old_data, sizeof(old_data));
400400 memcpy(sdata->vif.link_conf, old, sizeof(old));
401401 ieee80211_set_vif_links_bitmaps(sdata, old_links, dormant_links);
402+ for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
403+ ieee80211_link_debugfs_remove(&links[link_id]->data);
404+ ieee80211_link_stop(&links[link_id]->data);
405+ }
402406 /* and free (only) the newly allocated links */
403407 memset(to_free, 0, sizeof(links));
404408 goto free;
net/mac80211/rx.c+2−0
@@ -1717,6 +1717,8 @@ static void sta_ps_start(struct sta_info *sta) · 1716 unmodified lines
17171717 else
17181718 clear_bit(tid, &sta->txq_buffered_tids);
17191719 }
1720+
1721+ sta_info_recalc_tim(sta);
17201722 }
17211723
17221724 static void sta_ps_end(struct sta_info *sta)
net/mac802154/llsec.c+5−0
@@ -891,6 +891,11 @@ llsec_do_decrypt_auth(struct sk_buff *skb, const struct mac802154_llsec *sec, · 890 unmodified lines
891891 data = skb_mac_header(skb) + skb->mac_len;
892892 datalen = skb_tail_pointer(skb) - data;
893893
894+ if (datalen < authlen) {
895+ kfree_sensitive(req);
896+ return -EBADMSG;
897+ }
898+
894899 sg_init_one(&sg, skb_mac_header(skb), assoclen + datalen);
895900
896901 if (!(hdr->sec.level & IEEE802154_SCF_SECLEVEL_ENC)) {
net/mac802154/scan.c+11−0
@@ -179,6 +179,7 @@ void mac802154_scan_worker(struct work_struct *work) · 178 unmodified lines
179179 enum nl802154_scan_types scan_req_type;
180180 struct ieee802154_sub_if_data *sdata;
181181 unsigned int scan_duration = 0;
182+ netdevice_tracker dev_tracker;
182183 struct wpan_phy *wpan_phy;
183184 u8 scan_req_duration;
184185 u8 page, channel;
@@ -209,6 +210,14 @@ void mac802154_scan_worker(struct work_struct *work) · 24 unmodified lines
209210 return;
210211 }
211212
213+ /*
214+ * sdata->dev is dereferenced below after rcu_read_unlock() and outside
215+ * the rtnl, and a concurrent DEL_INTERFACE / PHY teardown can free it
216+ * asynchronously from netdev_run_todo(). Pin it with a reference taken
217+ * while the RCU read lock is still held, and drop it at every exit.
218+ */
219+ netdev_hold(sdata->dev, &dev_tracker, GFP_ATOMIC);
220+
212221 wpan_phy = scan_req->wpan_phy;
213222 scan_req_type = scan_req->type;
214223 scan_req_duration = scan_req->duration;
@@ -262,12 +271,14 @@ void mac802154_scan_worker(struct work_struct *work) · 47 unmodified lines
262271 "Scan page %u channel %u for %ums\n",
263272 page, channel, jiffies_to_msecs(scan_duration));
264273 queue_delayed_work(local->mac_wq, &local->scan_work, scan_duration);
274+ netdev_put(sdata->dev, &dev_tracker);
265275 return;
266276
267277 end_scan:
268278 rtnl_lock();
269279 mac802154_scan_cleanup_locked(local, sdata, false);
270280 rtnl_unlock();
281+ netdev_put(sdata->dev, &dev_tracker);
271282 }
272283
273284 int mac802154_trigger_scan_locked(struct ieee802154_sub_if_data *sdata,
net/mctp/device.c+3−1
@@ -536,7 +536,9 @@ int __init mctp_device_init(void) · 535 unmodified lines
536536 {
537537 int err;
538538
539− register_netdevice_notifier(&mctp_dev_nb);
539+ err = register_netdevice_notifier(&mctp_dev_nb);
540+ if (err)
541+ return err;
540542
541543 err = rtnl_af_register(&mctp_af_ops);
542544 if (err)
net/mpls/af_mpls.c+5−3
@@ -922,8 +922,7 @@ static int mpls_nh_build_multi(struct mpls_route_config *cfg, · 921 unmodified lines
922922 struct nlattr *nla_via, *nla_newdst;
923923 int remaining = cfg->rc_mp_len;
924924 int err = 0;
925−
926− rt->rt_nhn = 0;
925+ u8 nhs = 0;
927926
928927 change_nexthops(rt) {
929928 int attrlen;
@@ -959,12 +958,15 @@ static int mpls_nh_build_multi(struct mpls_route_config *cfg, · 29 unmodified lines
959958 rt->rt_nhn_alive--;
960959
961960 rtnh = rtnh_next(rtnh, &remaining);
962− rt->rt_nhn++;
961+ nhs++;
963962 } endfor_nexthops(rt);
964963
964+ rt->rt_nhn = nhs;
965+
965966 return 0;
966967
967968 errout:
969+ rt->rt_nhn = nhs;
968970 return err;
969971 }
970972
net/mptcp/options.c+7−10
@@ -157,17 +157,11 @@ static void mptcp_parse_option(const struct sk_buff *skb, · 156 unmodified lines
157157 ptr++;
158158
159159 flags = (*ptr++) & MPTCP_DSS_FLAG_MASK;
160− mp_opt->data_fin = (flags & MPTCP_DSS_DATA_FIN) != 0;
161160 mp_opt->dsn64 = (flags & MPTCP_DSS_DSN64) != 0;
162161 mp_opt->use_map = (flags & MPTCP_DSS_HAS_MAP) != 0;
163162 mp_opt->ack64 = (flags & MPTCP_DSS_ACK64) != 0;
164163 mp_opt->use_ack = (flags & MPTCP_DSS_HAS_ACK);
165164
166− pr_debug("data_fin=%d dsn64=%d use_map=%d ack64=%d use_ack=%d\n",
167− mp_opt->data_fin, mp_opt->dsn64,
168− mp_opt->use_map, mp_opt->ack64,
169− mp_opt->use_ack);
170−
171165 expected_opsize = TCPOLEN_MPTCP_DSS_BASE;
172166
173167 if (mp_opt->use_ack) {
@@ -178,12 +172,18 @@ static void mptcp_parse_option(const struct sk_buff *skb, · 4 unmodified lines
178172 }
179173
180174 if (mp_opt->use_map) {
175+ mp_opt->data_fin = (flags & MPTCP_DSS_DATA_FIN) != 0;
181176 if (mp_opt->dsn64)
182177 expected_opsize += TCPOLEN_MPTCP_DSS_MAP64;
183178 else
184179 expected_opsize += TCPOLEN_MPTCP_DSS_MAP32;
185180 }
186181
182+ pr_debug("data_fin=%d dsn64=%d use_map=%d ack64=%d use_ack=%d\n",
183+ mp_opt->data_fin, mp_opt->dsn64,
184+ mp_opt->use_map, mp_opt->ack64,
185+ mp_opt->use_ack);
186+
187187 /* Always parse any csum presence combination, we will enforce
188188 * RFC 8684 Section 3.3.0 checks later in subflow_data_ready
189189 */
@@ -571,10 +571,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, · 381 unmodified lines
571571 bool ret = false;
572572
573573 /* Zero `use_ack` and `use_map` flags with one shot. */
574− BUILD_BUG_ON(sizeof_field(struct mptcp_ext, flags) != sizeof(u16));
575− BUILD_BUG_ON(!IS_ALIGNED(offsetof(struct mptcp_ext, flags),
576− sizeof(u16)));
577− *(u16 *)&opts->ext_copy.flags = 0;
574+ memset(&opts->ext_copy.flags, 0, sizeof(opts->ext_copy.flags));
578575 opts->csum_reqd = READ_ONCE(msk->csum_enabled);
579576 mpext = skb ? mptcp_get_ext(skb) : NULL;
580577
net/mptcp/pm_userspace.c+5−2
@@ -132,12 +132,15 @@ int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, · 131 unmodified lines
132132 __be16 msk_sport = ((struct inet_sock *)
133133 inet_sk((struct sock *)msk))->inet_sport;
134134 struct mptcp_pm_addr_entry *entry;
135+ int id;
135136
136137 spin_lock_bh(&msk->pm.lock);
137138 entry = mptcp_userspace_pm_lookup_addr(msk, &skc->addr);
139+ id = entry ? entry->addr.id : -1;
138140 spin_unlock_bh(&msk->pm.lock);
139− if (entry)
140− return entry->addr.id;
141+
142+ if (id != -1)
143+ return id;
141144
142145 if (skc->addr.port == msk_sport)
143146 skc->addr.port = 0;
net/mptcp/protocol.c+20−14
@@ -2545,6 +2545,22 @@ static void __mptcp_subflow_disconnect(struct sock *ssk, · 2544 unmodified lines
25452545 }
25462546 }
25472547
2548+static void mptcp_cleanup_ssk_backlog(struct sock *sk, struct sock *ssk)
2549+{
2550+ struct mptcp_sock *msk = mptcp_sk(sk);
2551+ struct sk_buff *skb;
2552+
2553+ mptcp_data_lock(sk);
2554+ list_for_each_entry(skb, &msk->backlog_list, list) {
2555+ if (skb->sk != ssk)
2556+ continue;
2557+
2558+ atomic_sub(skb->truesize, &skb->sk->sk_rmem_alloc);
2559+ skb->sk = NULL;
2560+ }
2561+ mptcp_data_unlock(sk);
2562+}
2563+
25482564 /* subflow sockets can be either outgoing (connect) or incoming
25492565 * (accept).
25502566 *
@@ -2568,6 +2584,9 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, · 17 unmodified lines
25682584 lock_sock_nested(ssk, SINGLE_DEPTH_NESTING);
25692585 subflow->closing = 1;
25702586
2587+ if (flags & MPTCP_CF_PUSH)
2588+ mptcp_cleanup_ssk_backlog(sk, ssk);
2589+
25712590 /* Borrow the fwd allocated page left-over; fwd memory for the subflow
25722591 * could be negative at this point, but will be reach zero soon - when
25732592 * the data allocated using such fragment will be freed.
@@ -2659,9 +2678,6 @@ out: · 85 unmodified lines
26592678 void mptcp_close_ssk(struct sock *sk, struct sock *ssk,
26602679 struct mptcp_subflow_context *subflow)
26612680 {
2662− struct mptcp_sock *msk = mptcp_sk(sk);
2663− struct sk_buff *skb;
2664−
26652681 /* The first subflow can already be closed or disconnected */
26662682 if (subflow->close_event_done || READ_ONCE(subflow->local_id) < 0)
26672683 return;
@@ -2671,17 +2687,6 @@ void mptcp_close_ssk(struct sock *sk, struct sock *ssk, · 3 unmodified lines
26712687 if (sk->sk_state == TCP_ESTABLISHED)
26722688 mptcp_event(MPTCP_EVENT_SUB_CLOSED, mptcp_sk(sk), ssk, GFP_KERNEL);
26732689
2674− /* Remove any reference from the backlog to this ssk; backlog skbs consume
2675− * space in the msk receive queue, no need to touch sk->sk_rmem_alloc
2676− */
2677− list_for_each_entry(skb, &msk->backlog_list, list) {
2678− if (skb->sk != ssk)
2679− continue;
2680−
2681− atomic_sub(skb->truesize, &skb->sk->sk_rmem_alloc);
2682− skb->sk = NULL;
2683− }
2684−
26852690 /* subflow aborted before reaching the fully_established status
26862691 * attempt the creation of the next subflow
26872692 */
@@ -3907,6 +3912,7 @@ bool mptcp_finish_join(struct sock *ssk) · 1219 unmodified lines
39073912 mptcp_data_unlock(parent);
39083913
39093914 if (!ret) {
3915+ mptcp_pm_close_subflow(msk);
39103916 err_prohibited:
39113917 subflow->reset_reason = MPTCP_RST_EPROHIBIT;
39123918 return false;
net/openvswitch/actions.c+7−12
@@ -837,12 +837,8 @@ static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port, · 836 unmodified lines
837837 u16 mru = OVS_CB(skb)->mru;
838838 u32 cutlen = OVS_CB(skb)->cutlen;
839839
840− if (unlikely(cutlen > 0)) {
841− if (skb->len - cutlen > ovs_mac_header_len(key))
842− pskb_trim(skb, skb->len - cutlen);
843− else
844− pskb_trim(skb, ovs_mac_header_len(key));
845− }
840+ if (unlikely(cutlen < skb->len))
841+ pskb_trim(skb, max(cutlen, ovs_mac_header_len(key)));
846842
847843 if (likely(!mru ||
848844 (skb->len <= mru + vport->dev->hard_header_len))) {
@@ -1234,7 +1230,7 @@ static void execute_psample(struct datapath *dp, struct sk_buff *skb, · 385 unmodified lines
12341230
12351231 psample_group.net = ovs_dp_get_net(dp);
12361232 md.in_ifindex = OVS_CB(skb)->input_vport->dev->ifindex;
1237− md.trunc_size = skb->len - OVS_CB(skb)->cutlen;
1233+ md.trunc_size = min(skb->len, OVS_CB(skb)->cutlen);
12381234 md.rate_as_probability = 1;
12391235
12401236 rate = OVS_CB(skb)->probability ? OVS_CB(skb)->probability : U32_MAX;
@@ -1284,22 +1280,21 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, · 43 unmodified lines
12841280 clone = skb_clone(skb, GFP_ATOMIC);
12851281 if (clone)
12861282 do_output(dp, clone, port, key);
1287− OVS_CB(skb)->cutlen = 0;
1283+ OVS_CB(skb)->cutlen = U32_MAX;
12881284 break;
12891285 }
12901286
12911287 case OVS_ACTION_ATTR_TRUNC: {
12921288 struct ovs_action_trunc *trunc = nla_data(a);
12931289
1294− if (skb->len > trunc->max_len)
1295− OVS_CB(skb)->cutlen = skb->len - trunc->max_len;
1290+ OVS_CB(skb)->cutlen = trunc->max_len;
12961291 break;
12971292 }
12981293
12991294 case OVS_ACTION_ATTR_USERSPACE:
13001295 output_userspace(dp, skb, key, a, attr,
13011296 len, OVS_CB(skb)->cutlen);
1302− OVS_CB(skb)->cutlen = 0;
1297+ OVS_CB(skb)->cutlen = U32_MAX;
13031298 if (nla_is_last(a, rem)) {
13041299 consume_skb(skb);
13051300 return 0;
@@ -1453,7 +1448,7 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, · 147 unmodified lines
14531448
14541449 case OVS_ACTION_ATTR_PSAMPLE:
14551450 execute_psample(dp, skb, a);
1456− OVS_CB(skb)->cutlen = 0;
1451+ OVS_CB(skb)->cutlen = U32_MAX;
14571452 if (nla_is_last(a, rem)) {
14581453 consume_skb(skb);
14591454 return 0;
net/openvswitch/datapath.c+14−11
@@ -276,7 +276,7 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) · 275 unmodified lines
276276 upcall.portid = ovs_vport_find_upcall_portid(p, skb);
277277
278278 upcall.mru = OVS_CB(skb)->mru;
279− error = ovs_dp_upcall(dp, skb, key, &upcall, 0);
279+ error = ovs_dp_upcall(dp, skb, key, &upcall, U32_MAX);
280280 switch (error) {
281281 case 0:
282282 case -EAGAIN:
@@ -457,7 +457,8 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, · 174 unmodified lines
457457 struct sk_buff *nskb = NULL;
458458 struct sk_buff *user_skb = NULL; /* to be queued to userspace */
459459 struct nlattr *nla;
460− size_t len;
460+ size_t msg_size;
461+ size_t skb_len;
461462 unsigned int hlen;
462463 int err, dp_ifindex;
463464 u64 hash;
@@ -478,7 +479,8 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, · 14 unmodified lines
478479 skb = nskb;
479480 }
480481
481− if (nla_attr_size(skb->len) > USHRT_MAX) {
482+ skb_len = min(skb->len, cutlen);
483+ if (nla_attr_size(skb_len) > USHRT_MAX) {
482484 err = -EFBIG;
483485 goto out;
484486 }
@@ -493,13 +495,13 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, · 8 unmodified lines
493495 * padding logic. Only perform zerocopy if padding is not required.
494496 */
495497 if (dp->user_features & OVS_DP_F_UNALIGNED)
496− hlen = skb_zerocopy_headlen(skb);
498+ hlen = min(skb_zerocopy_headlen(skb), cutlen);
497499 else
498− hlen = skb->len;
500+ hlen = skb_len;
499501
500− len = upcall_msg_size(upcall_info, hlen - cutlen,
501− OVS_CB(skb)->acts_origlen);
502− user_skb = genlmsg_new(len, GFP_ATOMIC);
502+ msg_size = upcall_msg_size(upcall_info, hlen,
503+ OVS_CB(skb)->acts_origlen);
504+ user_skb = genlmsg_new(msg_size, GFP_ATOMIC);
503505 if (!user_skb) {
504506 err = -ENOMEM;
505507 goto out;
@@ -560,7 +562,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, · 54 unmodified lines
560562 }
561563
562564 /* Add OVS_PACKET_ATTR_LEN when packet is truncated */
563− if (cutlen > 0 &&
565+ if (skb_len < skb->len &&
564566 nla_put_u32(user_skb, OVS_PACKET_ATTR_LEN, skb->len)) {
565567 err = -ENOBUFS;
566568 goto out;
@@ -585,9 +587,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, · 18 unmodified lines
585587 err = -ENOBUFS;
586588 goto out;
587589 }
588− nla->nla_len = nla_attr_size(skb->len - cutlen);
590+ nla->nla_len = nla_attr_size(skb_len);
589591
590− err = skb_zerocopy(user_skb, skb, skb->len - cutlen, hlen);
592+ err = skb_zerocopy(user_skb, skb, skb_len, hlen);
591593 if (err)
592594 goto out;
593595
@@ -644,6 +646,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info) · 50 unmodified lines
644646 packet->ignore_df = 1;
645647 }
646648 OVS_CB(packet)->mru = mru;
649+ OVS_CB(packet)->cutlen = U32_MAX;
647650
648651 if (a[OVS_PACKET_ATTR_HASH]) {
649652 hash = nla_get_u64(a[OVS_PACKET_ATTR_HASH]);
net/openvswitch/datapath.h+1−1
@@ -118,7 +118,7 @@ struct datapath { · 117 unmodified lines
118118 * @mru: The maximum received fragement size; 0 if the packet is not
119119 * fragmented.
120120 * @acts_origlen: The netlink size of the flow actions applied to this skb.
121− * @cutlen: The number of bytes from the packet end to be removed.
121+ * @cutlen: The number of bytes in the packet to preserve on output.
122122 * @probability: The sampling probability that was applied to this skb; 0 means
123123 * no sampling has occurred; U32_MAX means 100% probability.
124124 * @upcall_pid: Netlink socket PID to use for sending this packet to userspace;
net/openvswitch/vport.c+1−1
@@ -502,7 +502,7 @@ int ovs_vport_receive(struct vport *vport, struct sk_buff *skb, · 501 unmodified lines
502502
503503 OVS_CB(skb)->input_vport = vport;
504504 OVS_CB(skb)->mru = 0;
505− OVS_CB(skb)->cutlen = 0;
505+ OVS_CB(skb)->cutlen = U32_MAX;
506506 OVS_CB(skb)->probability = 0;
507507 OVS_CB(skb)->upcall_pid = 0;
508508 if (unlikely(dev_net(skb->dev) != ovs_dp_get_net(vport->dp))) {
net/packet/af_packet.c+5−1
@@ -4561,7 +4561,11 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, · 4560 unmodified lines
45614561
45624562 spin_lock(&po->bind_lock);
45634563 WRITE_ONCE(po->num, num);
4564− if (was_running)
4564+ /*
4565+ * NETDEV_UNREGISTER may have invalidated the binding while bind_lock
4566+ * was dropped above. Do not re-add a fanout hook to a dead device.
4567+ */
4568+ if (was_running && READ_ONCE(po->ifindex) != -1)
45654569 register_prot_hook(sk);
45664570
45674571 spin_unlock(&po->bind_lock);
net/phonet/pep.c+2−0
@@ -55,6 +55,8 @@ static unsigned char *pep_get_sb(struct sk_buff *skb, u8 *ptype, u8 *plen, · 54 unmodified lines
5555 ph = skb_header_pointer(skb, 0, 2, &h);
5656 if (ph == NULL || ph->sb_len < 2 || !pskb_may_pull(skb, ph->sb_len))
5757 return NULL;
58+ /* pskb_may_pull() may have reallocated the head; refetch ph. */
59+ ph = skb_header_pointer(skb, 0, 2, &h);
5860 ph->sb_len -= 2;
5961 *ptype = ph->sb_type;
6062 *plen = ph->sb_len;
net/phonet/pn_dev.c+24−6
@@ -350,16 +350,34 @@ static struct pernet_operations phonet_net_ops = { · 349 unmodified lines
350350 /* Initialize Phonet devices list */
351351 int __init phonet_device_init(void)
352352 {
353− int err = register_pernet_subsys(&phonet_net_ops);
353+ int err;
354+
355+ err = register_pernet_subsys(&phonet_net_ops);
354356 if (err)
355357 return err;
356358
357− proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops,
358− sizeof(struct seq_net_private));
359− register_netdevice_notifier(&phonet_device_notifier);
359+ if (!proc_create_net("pnresource", 0, init_net.proc_net,
360+ &pn_res_seq_ops, sizeof(struct seq_net_private))) {
361+ err = -ENOMEM;
362+ goto err_pernet;
363+ }
364+
365+ err = register_netdevice_notifier(&phonet_device_notifier);
366+ if (err)
367+ goto err_proc;
368+
360369 err = phonet_netlink_register();
361370 if (err)
362− phonet_device_exit();
371+ goto err_notifier;
372+
373+ return 0;
374+
375+err_notifier:
376+ unregister_netdevice_notifier(&phonet_device_notifier);
377+err_proc:
378+ remove_proc_entry("pnresource", init_net.proc_net);
379+err_pernet:
380+ unregister_pernet_subsys(&phonet_net_ops);
363381 return err;
364382 }
365383
@@ -367,8 +385,8 @@ void phonet_device_exit(void) · 1 unmodified line
367385 {
368386 rtnl_unregister_all(PF_PHONET);
369387 unregister_netdevice_notifier(&phonet_device_notifier);
370− unregister_pernet_subsys(&phonet_net_ops);
371388 remove_proc_entry("pnresource", init_net.proc_net);
389+ unregister_pernet_subsys(&phonet_net_ops);
372390 }
373391
374392 int phonet_route_add(struct net_device *dev, u8 daddr)
net/qrtr/af_qrtr.c+8−0
@@ -1263,6 +1263,14 @@ static int qrtr_create(struct net *net, struct socket *sock, · 1262 unmodified lines
12631263 if (sock->type != SOCK_DGRAM)
12641264 return -EPROTOTYPE;
12651265
1266+ /* QRTR keeps its port and node state in module-global variables that
1267+ * are not partitioned per network namespace, and the in-kernel name
1268+ * service only operates in init_net. Confine the family to init_net so
1269+ * a socket in another namespace cannot reach the global control plane.
1270+ */
1271+ if (!net_eq(net, &init_net))
1272+ return -EAFNOSUPPORT;
1273+
12661274 sk = sk_alloc(net, AF_QIPCRTR, GFP_KERNEL, &qrtr_proto, kern);
12671275 if (!sk)
12681276 return -ENOMEM;
net/qrtr/ns.c+2−2
@@ -76,11 +76,11 @@ struct qrtr_node { · 75 unmodified lines
7676 * requirements. If the requirement changes in the future, these values can be
7777 * increased.
7878 */
79−#define QRTR_NS_MAX_NODES 64
79+#define QRTR_NS_MAX_NODES 512
8080 #define QRTR_NS_MAX_SERVERS 256
8181 #define QRTR_NS_MAX_LOOKUPS 64
8282
83−static u8 node_count;
83+static u16 node_count;
8484
8585 static struct qrtr_node *node_get(unsigned int node_id)
8686 {
net/rds/ib.c+4−0
@@ -429,6 +429,10 @@ static int rds_ib_laddr_check_cm(struct net *net, const struct in6_addr *addr, · 428 unmodified lines
429429 sa = (struct sockaddr *)&sin;
430430 } else {
431431 #if IS_ENABLED(CONFIG_IPV6)
432+ if (!ipv6_mod_enabled()) {
433+ ret = -EADDRNOTAVAIL;
434+ goto out;
435+ }
432436 memset(&sin6, 0, sizeof(sin6));
433437 sin6.sin6_family = AF_INET6;
434438 sin6.sin6_addr = *addr;
net/rds/ib_cm.c+4−0
@@ -810,6 +810,10 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id, · 809 unmodified lines
810810 dp = event->param.conn.private_data;
811811 if (isv6) {
812812 #if IS_ENABLED(CONFIG_IPV6)
813+ if (!ipv6_mod_enabled()) {
814+ err = -EOPNOTSUPP;
815+ goto out;
816+ }
813817 dp_cmn = &dp->ricp_v6.dp_cmn;
814818 saddr6 = &dp->ricp_v6.dp_saddr;
815819 daddr6 = &dp->ricp_v6.dp_daddr;
net/rds/recv.c+15−0
@@ -399,6 +399,21 @@ void rds_recv_incoming(struct rds_connection *conn, struct in6_addr *saddr, · 398 unmodified lines
399399 goto out;
400400 }
401401
402+ /*
403+ * rds_find_bound() uses a global (netns-agnostic) hash table.
404+ * An RDS connection created in netns A can match a socket bound
405+ * in the init netns, delivering inc cross-netns with inc->i_conn
406+ * pointing into netns A. When cleanup_net() then frees that conn,
407+ * any subsequent dereference of inc->i_conn is a use-after-free.
408+ * Drop the inc if the receiving socket lives in a different netns.
409+ */
410+ if (!net_eq(sock_net(rds_rs_to_sk(rs)), rds_conn_net(conn))) {
411+ rds_stats_inc(s_recv_drop_no_sock);
412+ rds_sock_put(rs);
413+ rs = NULL;
414+ goto out;
415+ }
416+
402417 /* Process extension headers */
403418 rds_recv_incoming_exthdrs(inc, rs);
404419
net/rds/tcp.c+7−5
@@ -366,9 +366,11 @@ int rds_tcp_laddr_check(struct net *net, const struct in6_addr *addr, · 365 unmodified lines
366366 rcu_read_unlock();
367367 }
368368 #if IS_ENABLED(CONFIG_IPV6)
369− ret = ipv6_chk_addr(net, addr, dev, 0);
370− if (ret)
371− return 0;
369+ if (ipv6_mod_enabled()) {
370+ ret = ipv6_chk_addr(net, addr, dev, 0);
371+ if (ret)
372+ return 0;
373+ }
372374 #endif
373375 return -EADDRNOTAVAIL;
374376 }
@@ -655,13 +657,13 @@ static void __net_exit rds_tcp_exit_net(struct net *net) · 280 unmodified lines
655657 {
656658 struct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid);
657659
658− rds_tcp_kill_sock(net);
659−
660660 if (rtn->rds_tcp_sysctl)
661661 unregister_net_sysctl_table(rtn->rds_tcp_sysctl);
662662
663663 if (net != &init_net)
664664 kfree(rtn->ctl_table);
665+
666+ rds_tcp_kill_sock(net);
665667 }
666668
667669 static struct pernet_operations rds_tcp_net_ops = {
net/rxrpc/ar-internal.h+4−2
@@ -1285,9 +1285,11 @@ int rxrpc_io_thread(void *data); · 1284 unmodified lines
12851285 void rxrpc_post_response(struct rxrpc_connection *conn, struct sk_buff *skb);
12861286 static inline void rxrpc_wake_up_io_thread(struct rxrpc_local *local)
12871287 {
1288− if (!local->io_thread)
1288+ struct task_struct *io_thread = READ_ONCE(local->io_thread);
1289+
1290+ if (!io_thread)
12891291 return;
1290− wake_up_process(READ_ONCE(local->io_thread));
1292+ wake_up_process(io_thread);
12911293 }
12921294
12931295 static inline bool rxrpc_protocol_error(struct sk_buff *skb, enum rxrpc_abort_reason why)
net/sched/cls_api.c+1−5
@@ -4045,7 +4045,7 @@ struct sk_buff *tcf_qevent_handle(struct tcf_qevent *qe, struct Qdisc *sch, stru · 4044 unmodified lines
40454045
40464046 fl = rcu_dereference_bh(qe->filter_chain);
40474047
4048− switch (tcf_classify(skb, NULL, fl, &cl_res, false)) {
4048+ switch (tcf_classify_qdisc(skb, fl, &cl_res, false)) {
40494049 case TC_ACT_SHOT:
40504050 qdisc_qstats_drop(sch);
40514051 __qdisc_drop(skb, to_free);
@@ -4057,10 +4057,6 @@ struct sk_buff *tcf_qevent_handle(struct tcf_qevent *qe, struct Qdisc *sch, stru · 5 unmodified lines
40574057 __qdisc_drop(skb, to_free);
40584058 *ret = __NET_XMIT_STOLEN;
40594059 return NULL;
4060− case TC_ACT_REDIRECT:
4061− skb_do_redirect(skb);
4062− *ret = __NET_XMIT_STOLEN;
4063− return NULL;
40644060 case TC_ACT_CONSUMED:
40654061 *ret = __NET_XMIT_STOLEN;
40664062 return NULL;
net/sched/sch_api.c+19−5
@@ -415,12 +415,13 @@ static __u8 __detect_linklayer(struct tc_ratespec *r, __u32 *rtab) · 414 unmodified lines
415415 }
416416
417417 static struct qdisc_rate_table *qdisc_rtab_list;
418+static DEFINE_SPINLOCK(qdisc_rtab_lock);
418419
419420 struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
420421 struct nlattr *tab,
421422 struct netlink_ext_ack *extack)
422423 {
423− struct qdisc_rate_table *rtab;
424+ struct qdisc_rate_table *rtab, *new_rtab;
424425
425426 if (tab == NULL || r->rate == 0 ||
426427 r->cell_log == 0 || r->cell_log >= 32 ||
@@ -429,15 +430,20 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, · 2 unmodified lines
429430 return NULL;
430431 }
431432
433+ new_rtab = kmalloc_obj(*new_rtab);
434+
435+ spin_lock(&qdisc_rtab_lock);
432436 for (rtab = qdisc_rtab_list; rtab; rtab = rtab->next) {
433437 if (!memcmp(&rtab->rate, r, sizeof(struct tc_ratespec)) &&
434438 !memcmp(&rtab->data, nla_data(tab), TC_RTAB_SIZE)) {
435439 rtab->refcnt++;
440+ spin_unlock(&qdisc_rtab_lock);
441+ kfree(new_rtab);
436442 return rtab;
437443 }
438444 }
439445
440− rtab = kmalloc_obj(*rtab);
446+ rtab = new_rtab;
441447 if (rtab) {
442448 rtab->rate = *r;
443449 rtab->refcnt = 1;
@@ -449,6 +455,7 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, · 5 unmodified lines
449455 } else {
450456 NL_SET_ERR_MSG(extack, "Failed to allocate new qdisc rate table");
451457 }
458+ spin_unlock(&qdisc_rtab_lock);
452459 return rtab;
453460 }
454461 EXPORT_SYMBOL(qdisc_get_rtab);
@@ -457,18 +464,25 @@ void qdisc_put_rtab(struct qdisc_rate_table *tab) · 2 unmodified lines
457464 {
458465 struct qdisc_rate_table *rtab, **rtabp;
459466
460− if (!tab || --tab->refcnt)
467+ if (!tab)
461468 return;
462469
470+ spin_lock(&qdisc_rtab_lock);
471+ if (--tab->refcnt) {
472+ spin_unlock(&qdisc_rtab_lock);
473+ return;
474+ }
475+
463476 for (rtabp = &qdisc_rtab_list;
464477 (rtab = *rtabp) != NULL;
465478 rtabp = &rtab->next) {
466479 if (rtab == tab) {
467480 *rtabp = rtab->next;
468− kfree(rtab);
469− return;
481+ break;
470482 }
471483 }
484+ spin_unlock(&qdisc_rtab_lock);
485+ kfree(tab);
472486 }
473487 EXPORT_SYMBOL(qdisc_put_rtab);
474488
net/sched/sch_cake.c+1−1
@@ -1727,7 +1727,7 @@ static u32 cake_classify(struct Qdisc *sch, struct cake_tin_data **t, · 1726 unmodified lines
17271727 goto hash;
17281728
17291729 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
1730− result = tcf_classify(skb, NULL, filter, &res, false);
1730+ result = tcf_classify_qdisc(skb, filter, &res, false);
17311731
17321732 if (result >= 0) {
17331733 #ifdef CONFIG_NET_CLS_ACT
net/sched/sch_drr.c+1−1
@@ -312,7 +312,7 @@ static struct drr_class *drr_classify(struct sk_buff *skb, struct Qdisc *sch, · 311 unmodified lines
312312
313313 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
314314 fl = rcu_dereference_bh(q->filter_list);
315− result = tcf_classify(skb, NULL, fl, &res, false);
315+ result = tcf_classify_qdisc(skb, fl, &res, false);
316316 if (result >= 0) {
317317 #ifdef CONFIG_NET_CLS_ACT
318318 switch (result) {
net/sched/sch_dualpi2.c+1−1
@@ -364,7 +364,7 @@ static int dualpi2_skb_classify(struct dualpi2_sched_data *q, · 363 unmodified lines
364364 if (!fl)
365365 return NET_XMIT_SUCCESS;
366366
367− result = tcf_classify(skb, NULL, fl, &res, false);
367+ result = tcf_classify_qdisc(skb, fl, &res, false);
368368 if (result >= 0) {
369369 #ifdef CONFIG_NET_CLS_ACT
370370 switch (result) {
net/sched/sch_ets.c+1−1
@@ -391,7 +391,7 @@ static struct ets_class *ets_classify(struct sk_buff *skb, struct Qdisc *sch, · 390 unmodified lines
391391 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
392392 if (TC_H_MAJ(skb->priority) != sch->handle) {
393393 fl = rcu_dereference_bh(q->filter_list);
394− err = tcf_classify(skb, NULL, fl, &res, false);
394+ err = tcf_classify_qdisc(skb, fl, &res, false);
395395 #ifdef CONFIG_NET_CLS_ACT
396396 switch (err) {
397397 case TC_ACT_STOLEN:
net/sched/sch_fq_codel.c+1−1
@@ -91,7 +91,7 @@ static unsigned int fq_codel_classify(struct sk_buff *skb, struct Qdisc *sch, · 90 unmodified lines
9191 return fq_codel_hash(q, skb) + 1;
9292
9393 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
94− result = tcf_classify(skb, NULL, filter, &res, false);
94+ result = tcf_classify_qdisc(skb, filter, &res, false);
9595 if (result >= 0) {
9696 #ifdef CONFIG_NET_CLS_ACT
9797 switch (result) {
net/sched/sch_fq_pie.c+1−1
@@ -96,7 +96,7 @@ static unsigned int fq_pie_classify(struct sk_buff *skb, struct Qdisc *sch, · 95 unmodified lines
9696 return fq_pie_hash(q, skb) + 1;
9797
9898 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
99− result = tcf_classify(skb, NULL, filter, &res, false);
99+ result = tcf_classify_qdisc(skb, filter, &res, false);
100100 if (result >= 0) {
101101 #ifdef CONFIG_NET_CLS_ACT
102102 switch (result) {
net/sched/sch_hfsc.c+1−1
@@ -1143,7 +1143,7 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) · 1142 unmodified lines
11431143 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
11441144 head = &q->root;
11451145 tcf = rcu_dereference_bh(q->root.filter_list);
1146− while (tcf && (result = tcf_classify(skb, NULL, tcf, &res, false)) >= 0) {
1146+ while (tcf && (result = tcf_classify_qdisc(skb, tcf, &res, false)) >= 0) {
11471147 #ifdef CONFIG_NET_CLS_ACT
11481148 switch (result) {
11491149 case TC_ACT_QUEUED:
net/sched/sch_htb.c+1−1
@@ -243,7 +243,7 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch, · 242 unmodified lines
243243 }
244244
245245 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
246− while (tcf && (result = tcf_classify(skb, NULL, tcf, &res, false)) >= 0) {
246+ while (tcf && (result = tcf_classify_qdisc(skb, tcf, &res, false)) >= 0) {
247247 #ifdef CONFIG_NET_CLS_ACT
248248 switch (result) {
249249 case TC_ACT_QUEUED:
net/sched/sch_multiq.c+1−1
@@ -36,7 +36,7 @@ multiq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) · 35 unmodified lines
3636 int err;
3737
3838 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
39− err = tcf_classify(skb, NULL, fl, &res, false);
39+ err = tcf_classify_qdisc(skb, fl, &res, false);
4040 #ifdef CONFIG_NET_CLS_ACT
4141 switch (err) {
4242 case TC_ACT_STOLEN:
net/sched/sch_prio.c+1−1
@@ -39,7 +39,7 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) · 38 unmodified lines
3939 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
4040 if (TC_H_MAJ(skb->priority) != sch->handle) {
4141 fl = rcu_dereference_bh(q->filter_list);
42− err = tcf_classify(skb, NULL, fl, &res, false);
42+ err = tcf_classify_qdisc(skb, fl, &res, false);
4343 #ifdef CONFIG_NET_CLS_ACT
4444 switch (err) {
4545 case TC_ACT_STOLEN:
net/sched/sch_qfq.c+1−1
@@ -709,7 +709,7 @@ static struct qfq_class *qfq_classify(struct sk_buff *skb, struct Qdisc *sch, · 708 unmodified lines
709709
710710 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
711711 fl = rcu_dereference_bh(q->filter_list);
712− result = tcf_classify(skb, NULL, fl, &res, false);
712+ result = tcf_classify_qdisc(skb, fl, &res, false);
713713 if (result >= 0) {
714714 #ifdef CONFIG_NET_CLS_ACT
715715 switch (result) {
net/sched/sch_sfb.c+1−1
@@ -260,7 +260,7 @@ static bool sfb_classify(struct sk_buff *skb, struct tcf_proto *fl, · 259 unmodified lines
260260 struct tcf_result res;
261261 int result;
262262
263− result = tcf_classify(skb, NULL, fl, &res, false);
263+ result = tcf_classify_qdisc(skb, fl, &res, false);
264264 if (result >= 0) {
265265 #ifdef CONFIG_NET_CLS_ACT
266266 switch (result) {
net/sched/sch_sfq.c+1−1
@@ -171,7 +171,7 @@ static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch, · 170 unmodified lines
171171 return sfq_hash(q, skb) + 1;
172172
173173 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
174− result = tcf_classify(skb, NULL, fl, &res, false);
174+ result = tcf_classify_qdisc(skb, fl, &res, false);
175175 if (result >= 0) {
176176 #ifdef CONFIG_NET_CLS_ACT
177177 switch (result) {
net/sctp/auth.c+1−1
@@ -672,7 +672,7 @@ int sctp_auth_ep_add_chunkid(struct sctp_endpoint *ep, __u8 chunk_id) · 671 unmodified lines
672672 /* Check if we can add this chunk to the array */
673673 param_len = ntohs(p->param_hdr.length);
674674 nchunks = param_len - sizeof(struct sctp_paramhdr);
675− if (nchunks == SCTP_NUM_CHUNK_TYPES)
675+ if (nchunks == SCTP_AUTH_MAX_CHUNKS)
676676 return -EINVAL;
677677
678678 p->chunks[nchunks] = chunk_id;
net/sctp/protocol.c+13−8
@@ -1383,10 +1383,6 @@ static int __net_init sctp_defaults_init(struct net *net) · 1382 unmodified lines
13831383 net->sctp.l3mdev_accept = 1;
13841384 #endif
13851385
1386− status = sctp_sysctl_net_register(net);
1387− if (status)
1388− goto err_sysctl_register;
1389−
13901386 /* Allocate and initialise sctp mibs. */
13911387 status = init_sctp_mibs(net);
13921388 if (status)
@@ -1420,8 +1416,6 @@ err_init_proc: · 27 unmodified lines
14201416 cleanup_sctp_mibs(net);
14211417 #endif
14221418 err_init_mibs:
1423− sctp_sysctl_net_unregister(net);
1424−err_sysctl_register:
14251419 return status;
14261420 }
14271421
@@ -1436,7 +1430,6 @@ static void __net_exit sctp_defaults_exit(struct net *net) · 8 unmodified lines
14361430 net->sctp.proc_net_sctp = NULL;
14371431 #endif
14381432 cleanup_sctp_mibs(net);
1439− sctp_sysctl_net_unregister(net);
14401433 }
14411434
14421435 static struct pernet_operations sctp_defaults_ops = {
@@ -1450,16 +1443,28 @@ static int __net_init sctp_ctrlsock_init(struct net *net) · 7 unmodified lines
14501443
14511444 /* Initialize the control inode/socket for handling OOTB packets. */
14521445 status = sctp_ctl_sock_init(net);
1453− if (status)
1446+ if (status) {
14541447 pr_err("Failed to initialize the SCTP control sock\n");
1448+ return status;
1449+ }
1450+
1451+ status = sctp_sysctl_net_register(net);
1452+ if (status) {
1453+ inet_ctl_sock_destroy(net->sctp.ctl_sock);
1454+ net->sctp.ctl_sock = NULL;
1455+ }
14551456
14561457 return status;
14571458 }
14581459
14591460 static void __net_exit sctp_ctrlsock_exit(struct net *net)
14601461 {
1462+ sctp_sysctl_net_unregister(net);
1463+ sctp_udp_sock_stop(net);
1464+
14611465 /* Free the control endpoint. */
14621466 inet_ctl_sock_destroy(net->sctp.ctl_sock);
1467+ net->sctp.ctl_sock = NULL;
14631468 }
14641469
14651470 static struct pernet_operations sctp_ctrlsock_ops = {
net/sctp/sm_make_chunk.c+6−0
@@ -3153,6 +3153,12 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc, · 3152 unmodified lines
31533153 if (!peer)
31543154 return SCTP_ERROR_DNS_FAILED;
31553155
3156+ /* Don't free asconf->transport; a later wildcard DEL-IP
3157+ * parameter reuses it.
3158+ */
3159+ if (peer == asconf->transport)
3160+ return SCTP_ERROR_REQ_REFUSED;
3161+
31563162 sctp_assoc_rm_peer(asoc, peer);
31573163 break;
31583164 case SCTP_PARAM_SET_PRIMARY:
net/sctp/sm_statefuns.c+1−1
@@ -643,7 +643,7 @@ static bool sctp_auth_chunk_verify(struct net *net, struct sctp_chunk *chunk, · 642 unmodified lines
643643 struct sctp_chunk auth;
644644
645645 if (!chunk->auth_chunk)
646− return true;
646+ return !sctp_auth_recv_cid(chunk->chunk_hdr->type, asoc);
647647
648648 /* SCTP-AUTH: auth_chunk pointer is only set when the cookie-echo
649649 * is supposed to be authenticated and we have to do delayed
net/sctp/stream.c+5−1
@@ -308,7 +308,8 @@ int sctp_send_reset_streams(struct sctp_association *asoc, · 307 unmodified lines
308308 goto out;
309309
310310 param_len += str_nums * sizeof(__u16) +
311− sizeof(struct sctp_strreset_inreq);
311+ (out ? sizeof(struct sctp_strreset_inreq)
312+ : sizeof(struct sctp_strreset_outreq));
312313 }
313314
314315 if (param_len > SCTP_MAX_CHUNK_LEN -
@@ -639,6 +640,9 @@ struct sctp_chunk *sctp_process_strreset_inreq( · 324 unmodified lines
639640
640641 nums = (ntohs(param.p->length) - sizeof(*inreq)) / sizeof(__u16);
641642 str_p = inreq->list_of_streams;
643+ if (nums * sizeof(__u16) + sizeof(struct sctp_strreset_outreq) >
644+ SCTP_MAX_CHUNK_LEN - sizeof(struct sctp_reconf_chunk))
645+ goto out;
642646 for (i = 0; i < nums; i++) {
643647 if (ntohs(str_p[i]) >= stream->outcnt) {
644648 result = SCTP_STRRESET_ERR_WRONG_SSN;
net/sctp/sysctl.c+7−2
@@ -615,11 +615,16 @@ int sctp_sysctl_net_register(struct net *net) · 614 unmodified lines
615615
616616 void sctp_sysctl_net_unregister(struct net *net)
617617 {
618+ struct ctl_table_header *header = net->sctp.sysctl_header;
618619 const struct ctl_table *table;
619620
620− table = net->sctp.sysctl_header->ctl_table_arg;
621− unregister_net_sysctl_table(net->sctp.sysctl_header);
621+ if (!header)
622+ return;
623+
624+ table = header->ctl_table_arg;
625+ unregister_net_sysctl_table(header);
622626 kfree(table);
627+ net->sctp.sysctl_header = NULL;
623628 }
624629
625630 static struct ctl_table_header *sctp_sysctl_header;
net/tipc/netlink.c+5−1
@@ -113,12 +113,16 @@ const struct nla_policy tipc_nl_node_policy[TIPC_NLA_NODE_MAX + 1] = { · 112 unmodified lines
113113 };
114114
115115 /* Properties valid for media, bearer and link */
116+static const struct netlink_range_validation tipc_nl_mtu_range = {
117+ .max = U16_MAX,
118+};
119+
116120 const struct nla_policy tipc_nl_prop_policy[TIPC_NLA_PROP_MAX + 1] = {
117121 [TIPC_NLA_PROP_UNSPEC] = { .type = NLA_UNSPEC },
118122 [TIPC_NLA_PROP_PRIO] = { .type = NLA_U32 },
119123 [TIPC_NLA_PROP_TOL] = { .type = NLA_U32 },
120124 [TIPC_NLA_PROP_WIN] = { .type = NLA_U32 },
121− [TIPC_NLA_PROP_MTU] = { .type = NLA_U32 },
125+ [TIPC_NLA_PROP_MTU] = NLA_POLICY_FULL_RANGE(NLA_U32, &tipc_nl_mtu_range),
122126 [TIPC_NLA_PROP_BROADCAST] = { .type = NLA_U32 },
123127 [TIPC_NLA_PROP_BROADCAST_RATIO] = { .type = NLA_U32 }
124128 };
net/tipc/netlink_compat.c+4−0
@@ -221,6 +221,10 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd, · 220 unmodified lines
221221 int rem;
222222
223223 len = (*cmd->dumpit)(buf, &cb);
224+ if (len < 0) {
225+ err = len;
226+ goto err_out;
227+ }
224228
225229 nlmsg_for_each_msg(nlmsg, nlmsg_hdr(buf), len, rem) {
226230 err = nlmsg_parse_deprecated(nlmsg, GENL_HDRLEN,
net/tipc/socket.c+3−2
@@ -502,6 +502,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock, · 501 unmodified lines
502502 tipc_set_sk_state(sk, TIPC_OPEN);
503503 if (tipc_sk_insert(tsk)) {
504504 sk_free(sk);
505+ sock->sk = NULL;
505506 pr_warn("Socket create failed; port number exhausted\n");
506507 return -EINVAL;
507508 }
@@ -1935,7 +1936,7 @@ static int tipc_recvmsg(struct socket *sock, struct msghdr *m, · 1427 unmodified lines
19351936 if (likely(!err)) {
19361937 int offset = skb_cb->bytes_read;
19371938
1938− copy = min_t(int, dlen - offset, buflen);
1939+ copy = min_t(size_t, dlen - offset, buflen);
19391940 rc = skb_copy_datagram_msg(skb, hlen + offset, m, copy);
19401941 if (unlikely(rc))
19411942 goto exit;
@@ -2067,7 +2068,7 @@ static int tipc_recvstream(struct socket *sock, struct msghdr *m, · 125 unmodified lines
20672068 /* Copy data if msg ok, otherwise return error/partial data */
20682069 if (likely(!err)) {
20692070 offset = skb_cb->bytes_read;
2070− copy = min_t(int, dlen - offset, buflen - copied);
2071+ copy = min_t(size_t, dlen - offset, buflen - copied);
20712072 rc = skb_copy_datagram_msg(skb, hlen + offset, m, copy);
20722073 if (unlikely(rc))
20732074 break;
net/tipc/udp_media.c+27−29
@@ -94,6 +94,8 @@ struct udp_replicast { · 93 unmodified lines
9494 * @ifindex: local address scope
9595 * @work: used to schedule deferred work on a bearer
9696 * @rcast: associated udp_replicast container
97+ * @rcast_lock: serialize updates to @rcast.list against concurrent updaters
98+ * @disabled: bearer is being torn down; reject further @rcast.list additions
9799 */
98100 struct udp_bearer {
99101 struct tipc_bearer __rcu *bearer;
@@ -101,6 +103,8 @@ struct udp_bearer { · 1 unmodified line
101103 u32 ifindex;
102104 struct work_struct work;
103105 struct udp_replicast rcast;
106+ spinlock_t rcast_lock;
107+ bool disabled;
104108 };
105109
106110 static int tipc_udp_is_mcast_addr(struct udp_media_addr *addr)
@@ -278,26 +282,6 @@ out: · 171 unmodified lines
278282 return err;
279283 }
280284
281−static bool tipc_udp_is_known_peer(struct tipc_bearer *b,
282− struct udp_media_addr *addr)
283−{
284− struct udp_replicast *rcast, *tmp;
285− struct udp_bearer *ub;
286−
287− ub = rcu_dereference_rtnl(b->media_ptr);
288− if (!ub) {
289− pr_err_ratelimited("UDP bearer instance not found\n");
290− return false;
291− }
292−
293− list_for_each_entry_safe(rcast, tmp, &ub->rcast.list, list) {
294− if (!memcmp(&rcast->addr, addr, sizeof(struct udp_media_addr)))
295− return true;
296− }
297−
298− return false;
299−}
300−
301285 static int tipc_udp_rcast_add(struct tipc_bearer *b,
302286 struct udp_media_addr *addr)
303287 {
@@ -308,16 +292,34 @@ static int tipc_udp_rcast_add(struct tipc_bearer *b, · 4 unmodified lines
308292 if (!ub)
309293 return -ENODEV;
310294
295+ spin_lock_bh(&ub->rcast_lock);
296+ if (ub->disabled) {
297+ spin_unlock_bh(&ub->rcast_lock);
298+ return 0;
299+ }
300+ list_for_each_entry(rcast, &ub->rcast.list, list) {
301+ if (!memcmp(&rcast->addr, addr, sizeof(*addr))) {
302+ spin_unlock_bh(&ub->rcast_lock);
303+ return 0;
304+ }
305+ }
306+
311307 rcast = kmalloc_obj(*rcast, GFP_ATOMIC);
312− if (!rcast)
308+ if (!rcast) {
309+ spin_unlock_bh(&ub->rcast_lock);
313310 return -ENOMEM;
311+ }
314312
315313 if (dst_cache_init(&rcast->dst_cache, GFP_ATOMIC)) {
314+ spin_unlock_bh(&ub->rcast_lock);
316315 kfree(rcast);
317316 return -ENOMEM;
318317 }
319318
320319 memcpy(&rcast->addr, addr, sizeof(struct udp_media_addr));
320+ list_add_rcu(&rcast->list, &ub->rcast.list);
321+ b->bcast_addr.broadcast = TIPC_REPLICAST_SUPPORT;
322+ spin_unlock_bh(&ub->rcast_lock);
321323
322324 if (ntohs(addr->proto) == ETH_P_IP)
323325 pr_info("New replicast peer: %pI4\n", &rcast->addr.ipv4);
@@ -325,8 +327,6 @@ static int tipc_udp_rcast_add(struct tipc_bearer *b, · 1 unmodified line
325327 else if (ntohs(addr->proto) == ETH_P_IPV6)
326328 pr_info("New replicast peer: %pI6\n", &rcast->addr.ipv6);
327329 #endif
328− b->bcast_addr.broadcast = TIPC_REPLICAST_SUPPORT;
329− list_add_rcu(&rcast->list, &ub->rcast.list);
330330 return 0;
331331 }
332332
@@ -361,9 +361,6 @@ static int tipc_udp_rcast_disc(struct tipc_bearer *b, struct sk_buff *skb) · 28 unmodified lines
361361 return 0;
362362 }
363363
364− if (likely(tipc_udp_is_known_peer(b, &src)))
365− return 0;
366−
367364 return tipc_udp_rcast_add(b, &src);
368365 }
369366
@@ -644,9 +641,6 @@ int tipc_udp_nl_bearer_add(struct tipc_bearer *b, struct nlattr *attr) · 274 unmodified lines
644641 return -EINVAL;
645642 }
646643
647− if (tipc_udp_is_known_peer(b, &addr))
648− return 0;
649−
650644 return tipc_udp_rcast_add(b, &addr);
651645 }
652646
@@ -679,6 +673,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b, · 26 unmodified lines
679673 return -ENOMEM;
680674
681675 INIT_LIST_HEAD(&ub->rcast.list);
676+ spin_lock_init(&ub->rcast_lock);
682677
683678 if (!attrs[TIPC_NLA_BEARER_UDP_OPTS])
684679 goto err;
@@ -819,10 +814,13 @@ static void cleanup_bearer(struct work_struct *work) · 134 unmodified lines
819814 struct udp_replicast *rcast, *tmp;
820815 struct tipc_net *tn;
821816
817+ spin_lock_bh(&ub->rcast_lock);
822818 list_for_each_entry_safe(rcast, tmp, &ub->rcast.list, list) {
823819 list_del_rcu(&rcast->list);
824820 call_rcu_hurry(&rcast->rcu, rcast_free_rcu);
825821 }
822+ ub->disabled = true;
823+ spin_unlock_bh(&ub->rcast_lock);
826824
827825 tn = tipc_net(sock_net(ub->sk));
828826
net/tls/tls_device.c+4−2
@@ -595,13 +595,15 @@ void tls_device_splice_eof(struct socket *sock) · 594 unmodified lines
595595 struct tls_context *tls_ctx = tls_get_ctx(sk);
596596 struct iov_iter iter = {};
597597
598− if (!tls_is_partially_sent_record(tls_ctx))
598+ if (!tls_is_partially_sent_record(tls_ctx) &&
599+ !tls_is_pending_open_record(tls_ctx))
599600 return;
600601
601602 mutex_lock(&tls_ctx->tx_lock);
602603 lock_sock(sk);
603604
604− if (tls_is_partially_sent_record(tls_ctx)) {
605+ if (tls_is_partially_sent_record(tls_ctx) ||
606+ tls_is_pending_open_record(tls_ctx)) {
605607 iov_iter_bvec(&iter, ITER_SOURCE, NULL, 0, 0);
606608 tls_push_data(sk, &iter, 0, 0, TLS_RECORD_TYPE_DATA);
607609 }
net/vmw_vsock/virtio_transport_common.c+164−1
@@ -26,6 +26,13 @@ · 25 unmodified lines
2626 /* Threshold for detecting small packets to copy */
2727 #define GOOD_COPY_LEN 128
2828
29+/* Max payload that can be collapsed into a single linear skb, using the same
30+ * allocation threshold as virtio_vsock_alloc_skb() to avoid adding pressure
31+ * on the page allocator.
32+ */
33+#define MAX_COLLAPSE_LEN \
34+ SKB_MAX_ORDER(VIRTIO_VSOCK_SKB_HEADROOM, PAGE_ALLOC_COSTLY_ORDER)
35+
2936 static void virtio_transport_cancel_close_work(struct vsock_sock *vsk,
3037 bool cancel_timeout);
3138 static s64 virtio_transport_has_space(struct virtio_vsock_sock *vvs);
@@ -420,6 +427,145 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk, · 388 unmodified lines
420427 return ret;
421428 }
422429
430+static bool virtio_transport_can_collapse(struct sk_buff *skb)
431+{
432+ /* skbs that are partially consumed, mark a SEQPACKET message boundary,
433+ * or are already large enough should not be collapsed: they either
434+ * need special accounting, carry protocol state, or already have a
435+ * good data-to-overhead ratio.
436+ */
437+ if (VIRTIO_VSOCK_SKB_CB(skb)->offset)
438+ return false;
439+ if (le32_to_cpu(virtio_vsock_hdr(skb)->flags) & VIRTIO_VSOCK_SEQ_EOM)
440+ return false;
441+ if (skb->len >= MAX_COLLAPSE_LEN)
442+ return false;
443+ return true;
444+}
445+
446+/* Iterate through the packets in the queue starting from the current skb to
447+ * count the number of bytes we can collapse.
448+ */
449+static unsigned int
450+virtio_transport_collapse_size(struct sk_buff *skb, struct sk_buff_head *queue)
451+{
452+ unsigned int target = skb->len - VIRTIO_VSOCK_SKB_CB(skb)->offset;
453+
454+ while ((skb = skb_peek_next(skb, queue)) &&
455+ virtio_transport_can_collapse(skb)) {
456+ unsigned int len = skb->len - VIRTIO_VSOCK_SKB_CB(skb)->offset;
457+
458+ if (len > MAX_COLLAPSE_LEN - target)
459+ return target;
460+
461+ target += len;
462+ }
463+
464+ return target;
465+}
466+
467+/* Called under lock_sock to compact the receive queue by merging small skbs.
468+ * @min_to_free: minimum number of skbs to eliminate from the queue. May free
469+ * more to fill each collapsed skb to capacity.
470+ */
471+static void
472+virtio_transport_collapse_rx_queue(struct virtio_vsock_sock *vvs,
473+ u32 min_to_free)
474+{
475+ struct sk_buff *skb, *next_skb, *new_skb = NULL;
476+ struct sk_buff_head new_queue;
477+ u32 saved = 0;
478+
479+ __skb_queue_head_init(&new_queue);
480+
481+ skb_queue_walk_safe(&vvs->rx_queue, skb, next_skb) {
482+ struct virtio_vsock_hdr *hdr = virtio_vsock_hdr(skb);
483+ u32 src_off = VIRTIO_VSOCK_SKB_CB(skb)->offset;
484+ u32 src_len = skb->len - src_off;
485+ bool keep;
486+
487+ keep = !virtio_transport_can_collapse(skb);
488+ if (keep) {
489+ /* Finalize pending collapsed skb to preserve packet
490+ * ordering.
491+ */
492+ if (new_skb) {
493+ __skb_queue_tail(&new_queue, new_skb);
494+ new_skb = NULL;
495+ saved--;
496+ }
497+ goto next;
498+ }
499+
500+ /* Finalize if this packet won't fit in the remaining tailroom,
501+ * so we can allocate a right-sized new_skb.
502+ */
503+ if (new_skb && src_len > skb_tailroom(new_skb)) {
504+ __skb_queue_tail(&new_queue, new_skb);
505+ new_skb = NULL;
506+ saved--;
507+ }
508+
509+ if (!new_skb) {
510+ unsigned int alloc_size;
511+
512+ /* Check after finalizing to opportunistically fill
513+ * each collapsed skb to capacity, merging more skbs
514+ * than strictly required.
515+ */
516+ if (saved >= min_to_free)
517+ break;
518+
519+ alloc_size = virtio_transport_collapse_size(skb, &vvs->rx_queue);
520+
521+ /* Only this skb's data is eligible, nothing to merge
522+ * with. Keep as-is.
523+ */
524+ if (alloc_size <= src_len) {
525+ keep = true;
526+ goto next;
527+ }
528+
529+ new_skb = virtio_vsock_alloc_linear_skb(alloc_size +
530+ VIRTIO_VSOCK_SKB_HEADROOM, GFP_KERNEL);
531+ if (!new_skb)
532+ break;
533+
534+ memcpy(virtio_vsock_hdr(new_skb), hdr,
535+ sizeof(struct virtio_vsock_hdr));
536+ virtio_vsock_hdr(new_skb)->len = 0;
537+ }
538+
539+ /* Cannot fail since src_off/src_len are within bounds, but if
540+ * it does, discard new_skb to avoid queuing corrupted data.
541+ */
542+ if (WARN_ON_ONCE(skb_copy_bits(skb, src_off,
543+ skb_put(new_skb, src_len),
544+ src_len))) {
545+ kfree_skb(new_skb);
546+ new_skb = NULL;
547+ break;
548+ }
549+
550+ le32_add_cpu(&virtio_vsock_hdr(new_skb)->len, src_len);
551+ virtio_vsock_hdr(new_skb)->flags |= hdr->flags;
552+
553+next:
554+ __skb_unlink(skb, &vvs->rx_queue);
555+ if (keep) {
556+ __skb_queue_tail(&new_queue, skb);
557+ } else {
558+ consume_skb(skb);
559+ saved++;
560+ }
561+ }
562+
563+ if (new_skb)
564+ __skb_queue_tail(&new_queue, new_skb);
565+
566+ skb_queue_splice(&new_queue, &vvs->rx_queue);
567+}
568+
423569 static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs,
424570 u32 len)
425571 {
@@ -1354,12 +1500,29 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk, · 928 unmodified lines
13541500 {
13551501 struct virtio_vsock_sock *vvs = vsk->trans;
13561502 bool can_enqueue, free_pkt = false;
1503+ u32 len, queue_max, queue_len;
13571504 struct virtio_vsock_hdr *hdr;
1358− u32 len;
13591505
13601506 hdr = virtio_vsock_hdr(skb);
13611507 len = le32_to_cpu(hdr->len);
13621508
1509+ /* virtio_transport_inc_rx_pkt() rejects packets when the per-skb
1510+ * overhead (skb_queue_len * SKB_TRUESIZE(0)) exceeds buf_alloc.
1511+ * Proactively collapse the queue before that happens.
1512+ * No rx_lock needed: lock_sock is held by caller, preventing
1513+ * concurrent enqueue or dequeue.
1514+ */
1515+ queue_max = vvs->buf_alloc / SKB_TRUESIZE(0);
1516+ queue_len = skb_queue_len(&vvs->rx_queue);
1517+ if (queue_len >= queue_max) {
1518+ /* Walking a large queue may take a significant amount of time
1519+ * and cache misses, causing traffic burstiness. Limit the
1520+ * collapse to freeing room for this packet and the next one.
1521+ * It may free more to fill each collapsed skb to capacity.
1522+ */
1523+ virtio_transport_collapse_rx_queue(vvs, queue_len + 2 - queue_max);
1524+ }
1525+
13631526 spin_lock_bh(&vvs->rx_lock);
13641527
13651528 can_enqueue = virtio_transport_inc_rx_pkt(vvs, len);
net/wireless/pmsr.c+3−2
@@ -263,8 +263,9 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev, · 262 unmodified lines
263263 "FTM: nominal time is required for PD NTB ranging");
264264 return -EINVAL;
265265 }
266− out->ftm.nominal_time =
267− nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_NOMINAL_TIME]);
266+ if (tb[NL80211_PMSR_FTM_REQ_ATTR_NOMINAL_TIME])
267+ out->ftm.nominal_time =
268+ nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_NOMINAL_TIME]);
268269
269270 if (tb[NL80211_PMSR_FTM_REQ_ATTR_MIN_TIME_BETWEEN_MEASUREMENTS])
270271 out->ftm.min_time_between_measurements =
net/x25/af_x25.c+6−2
@@ -1768,15 +1768,19 @@ void x25_kill_by_neigh(struct x25_neigh *nb) · 1767 unmodified lines
17681768 {
17691769 struct sock *s;
17701770
1771+again:
17711772 write_lock_bh(&x25_list_lock);
17721773
17731774 sk_for_each(s, &x25_list) {
17741775 if (x25_sk(s)->neighbour == nb) {
1776+ sock_hold(s);
17751777 write_unlock_bh(&x25_list_lock);
17761778 lock_sock(s);
1777− x25_disconnect(s, ENETUNREACH, 0, 0);
1779+ if (x25_sk(s)->neighbour == nb)
1780+ x25_disconnect(s, ENETUNREACH, 0, 0);
17781781 release_sock(s);
1779− write_lock_bh(&x25_list_lock);
1782+ sock_put(s);
1783+ goto again;
17801784 }
17811785 }
17821786 write_unlock_bh(&x25_list_lock);
rust/Makefile+13−3
@@ -84,11 +84,15 @@ core-flags := \ · 83 unmodified lines
8484 --edition=$(core-edition) \
8585 $(call cfgs-to-flags,$(core-cfgs))
8686
87+zerocopy-cfgs := \
88+ no_fp_fmt_parse
89+
8790 zerocopy-flags := \
88− --cap-lints=allow
91+ --cap-lints=allow \
92+ $(call cfgs-to-flags,$(zerocopy-cfgs))
8993
9094 zerocopy-envs := \
91− CARGO_PKG_VERSION=0.8.50
95+ CARGO_PKG_VERSION=0.8.54
9296
9397 proc_macro2-cfgs := \
9498 feature="proc-macro" \
@@ -128,11 +132,15 @@ syn-flags := \ · 33 unmodified lines
128132 --extern quote \
129133 $(call cfgs-to-flags,$(syn-cfgs))
130134
135+zerocopy_derive-cfgs := \
136+ zerocopy_unstable_linux
137+
131138 zerocopy_derive-flags := \
132139 --cap-lints=allow \
133140 --extern proc_macro2 \
134141 --extern quote \
135− --extern syn
142+ --extern syn \
143+ $(call cfgs-to-flags,$(zerocopy_derive-cfgs))
136144
137145 pin_init_internal-cfgs := \
138146 kernel USE_RUSTC_FEATURES
@@ -644,9 +652,11 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L · 505 unmodified lines
644652 rust-analyzer:
645653 $(Q)MAKEFLAGS= $(srctree)/scripts/generate_rust_analyzer.py \
646654 --cfgs='core=$(core-cfgs)' $(core-edition) \
655+ --cfgs='zerocopy=$(zerocopy-cfgs)' \
647656 --cfgs='proc_macro2=$(proc_macro2-cfgs)' \
648657 --cfgs='quote=$(quote-cfgs)' \
649658 --cfgs='syn=$(syn-cfgs)' \
659+ --cfgs='zerocopy_derive=$(zerocopy_derive-cfgs)' \
650660 --cfgs='pin_init_internal=$(pin_init_internal-cfgs)' \
651661 --cfgs='pin_init=$(pin_init-cfgs)' \
652662 --envs='zerocopy=$(zerocopy-envs)' \
rust/bindings/lib.rs+4−0
@@ -27,6 +27,10 @@ · 26 unmodified lines
2727 #[allow(clippy::ref_as_ptr)]
2828 #[allow(clippy::undocumented_unsafe_blocks)]
2929 #[cfg_attr(CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES, allow(unnecessary_transmutes))]
30+#[cfg_attr(
31+ CONFIG_RUSTC_HAS_SUSPICIOUS_RUNTIME_SYMBOL_DEFINITIONS,
32+ allow(suspicious_runtime_symbol_definitions)
33+)]
3034 mod bindings_raw {
3135 use pin_init::{MaybeZeroable, Zeroable};
3236
rust/kernel/device.rs+9−11
@@ -708,9 +708,7 @@ macro_rules! impl_device_context_into_aref { · 707 unmodified lines
708708 #[macro_export]
709709 macro_rules! dev_printk {
710710 ($method:ident, $dev:expr, $($f:tt)*) => {
711− {
712− $crate::device::Device::$method($dev.as_ref(), $crate::prelude::fmt!($($f)*))
713− }
711+ $crate::device::Device::$method($dev.as_ref(), $crate::prelude::fmt!($($f)*))
714712 }
715713 }
716714
@@ -737,7 +735,7 @@ macro_rules! dev_printk { · 20 unmodified lines
737735 /// ```
738736 #[macro_export]
739737 macro_rules! dev_emerg {
740− ($($f:tt)*) => { $crate::dev_printk!(pr_emerg, $($f)*); }
738+ ($($f:tt)*) => { $crate::dev_printk!(pr_emerg, $($f)*) }
741739 }
742740
743741 /// Prints an alert-level message (level 1) prefixed with device information.
@@ -763,7 +761,7 @@ macro_rules! dev_emerg { · 19 unmodified lines
763761 /// ```
764762 #[macro_export]
765763 macro_rules! dev_alert {
766− ($($f:tt)*) => { $crate::dev_printk!(pr_alert, $($f)*); }
764+ ($($f:tt)*) => { $crate::dev_printk!(pr_alert, $($f)*) }
767765 }
768766
769767 /// Prints a critical-level message (level 2) prefixed with device information.
@@ -789,7 +787,7 @@ macro_rules! dev_alert { · 19 unmodified lines
789787 /// ```
790788 #[macro_export]
791789 macro_rules! dev_crit {
792− ($($f:tt)*) => { $crate::dev_printk!(pr_crit, $($f)*); }
790+ ($($f:tt)*) => { $crate::dev_printk!(pr_crit, $($f)*) }
793791 }
794792
795793 /// Prints an error-level message (level 3) prefixed with device information.
@@ -815,7 +813,7 @@ macro_rules! dev_crit { · 19 unmodified lines
815813 /// ```
816814 #[macro_export]
817815 macro_rules! dev_err {
818− ($($f:tt)*) => { $crate::dev_printk!(pr_err, $($f)*); }
816+ ($($f:tt)*) => { $crate::dev_printk!(pr_err, $($f)*) }
819817 }
820818
821819 /// Prints a warning-level message (level 4) prefixed with device information.
@@ -841,7 +839,7 @@ macro_rules! dev_err { · 19 unmodified lines
841839 /// ```
842840 #[macro_export]
843841 macro_rules! dev_warn {
844− ($($f:tt)*) => { $crate::dev_printk!(pr_warn, $($f)*); }
842+ ($($f:tt)*) => { $crate::dev_printk!(pr_warn, $($f)*) }
845843 }
846844
847845 /// Prints a notice-level message (level 5) prefixed with device information.
@@ -867,7 +865,7 @@ macro_rules! dev_warn { · 19 unmodified lines
867865 /// ```
868866 #[macro_export]
869867 macro_rules! dev_notice {
870− ($($f:tt)*) => { $crate::dev_printk!(pr_notice, $($f)*); }
868+ ($($f:tt)*) => { $crate::dev_printk!(pr_notice, $($f)*) }
871869 }
872870
873871 /// Prints an info-level message (level 6) prefixed with device information.
@@ -893,7 +891,7 @@ macro_rules! dev_notice { · 19 unmodified lines
893891 /// ```
894892 #[macro_export]
895893 macro_rules! dev_info {
896− ($($f:tt)*) => { $crate::dev_printk!(pr_info, $($f)*); }
894+ ($($f:tt)*) => { $crate::dev_printk!(pr_info, $($f)*) }
897895 }
898896
899897 /// Prints a debug-level message (level 7) prefixed with device information.
@@ -919,5 +917,5 @@ macro_rules! dev_info { · 19 unmodified lines
919917 /// ```
920918 #[macro_export]
921919 macro_rules! dev_dbg {
922− ($($f:tt)*) => { $crate::dev_printk!(pr_dbg, $($f)*); }
920+ ($($f:tt)*) => { $crate::dev_printk!(pr_dbg, $($f)*) }
923921 }
rust/kernel/time.rs+9−2
@@ -441,15 +441,22 @@ impl Delta { · 440 unmodified lines
441441 /// to the value in the [`Delta`].
442442 #[inline]
443443 pub fn as_micros_ceil(self) -> i64 {
444+ let n = self.as_nanos();
445+ let n = if n >= 0 {
446+ n.saturating_add(NSEC_PER_USEC - 1)
447+ } else {
448+ n
449+ };
450+
444451 #[cfg(CONFIG_64BIT)]
445452 {
446− self.as_nanos().saturating_add(NSEC_PER_USEC - 1) / NSEC_PER_USEC
453+ n / NSEC_PER_USEC
447454 }
448455
449456 #[cfg(not(CONFIG_64BIT))]
450457 // SAFETY: It is always safe to call `ktime_to_us()` with any value.
451458 unsafe {
452− bindings::ktime_to_us(self.as_nanos().saturating_add(NSEC_PER_USEC - 1))
459+ bindings::ktime_to_us(n)
453460 }
454461 }
455462
rust/uapi/lib.rs+4−0
@@ -24,6 +24,10 @@ · 23 unmodified lines
2424 unsafe_op_in_unsafe_fn
2525 )]
2626 #![cfg_attr(CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES, allow(unnecessary_transmutes))]
27+#![cfg_attr(
28+ CONFIG_RUSTC_HAS_SUSPICIOUS_RUNTIME_SYMBOL_DEFINITIONS,
29+ allow(suspicious_runtime_symbol_definitions)
30+)]
2731 #![feature(cfi_encoding)]
2832
2933 // Manual definition of blocklisted types.
rust/zerocopy-derive/README.md+7−7
@@ -1,14 +1,14 @@
11 # `zerocopy-derive`
22
3−These source files come from the Rust `zerocopy-derive` crate, version v0.8.50
4−(released 2026-05-31), hosted in the <https://github.com/google/zerocopy>
3+These source files come from the Rust `zerocopy-derive` crate, version v0.8.54
4+(released 2026-07-08), hosted in the <https://github.com/google/zerocopy>
55 repository, licensed under "BSD-2-Clause OR Apache-2.0 OR MIT" and only
6−modified to add the SPDX license identifiers and to remove the generation of
6+modified to tweak the SPDX license identifiers and to remove the generation of
77 non-ASCII identifiers.
88
99 For copyright details, please see:
1010
11− https://github.com/google/zerocopy/blob/v0.8.50/README.md?plain=1
12− https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-BSD
13− https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-APACHE
14− https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-MIT
11+ https://github.com/google/zerocopy/blob/v0.8.54/README.md?plain=1
12+ https://github.com/google/zerocopy/blob/v0.8.54/LICENSE-BSD
13+ https://github.com/google/zerocopy/blob/v0.8.54/LICENSE-APACHE
14+ https://github.com/google/zerocopy/blob/v0.8.54/LICENSE-MIT
rust/zerocopy-derive/derive/from_bytes.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 use proc_macro2::{Span, TokenStream};
44 use syn::{
55 parse_quote, Data, DataEnum, DataStruct, DataUnion, Error, Expr, ExprLit, ExprUnary, Lit, UnOp,
rust/zerocopy-derive/derive/into_bytes.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 use proc_macro2::{Span, TokenStream};
44 use quote::quote;
55 use syn::{Data, DataEnum, DataStruct, DataUnion, Error, Type};
rust/zerocopy-derive/derive/known_layout.rs+1−2
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 use proc_macro2::TokenStream;
44 use quote::quote;
55 use syn::{parse_quote, Data, Error, Type};
@@ -87,7 +87,6 @@ fn derive_known_layout_for_repr_c_struct<'a>( · 81 unmodified lines
8787 };
8888
8989 let inner_extras = {
90− let leading_fields_tys = leading_fields_tys.clone();
9190 let methods = make_methods(*trailing_field_ty);
9291 let (_, ty_generics, _) = ctx.ast.generics.split_for_impl();
9392
rust/zerocopy-derive/derive/mod.rs+12−8
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 pub mod from_bytes;
44 pub mod into_bytes;
55 pub mod known_layout;
@@ -15,8 +15,8 @@ use crate::{ · 9 unmodified lines
1515 util::{Ctx, DataExt, FieldBounds, ImplBlockBuilder, Trait},
1616 };
1717
18−pub(crate) fn derive_immutable(ctx: &Ctx, _top_level: Trait) -> TokenStream {
19− match &ctx.ast.data {
18+pub(crate) fn derive_immutable(ctx: &Ctx, _top_level: Trait) -> Result<TokenStream, Error> {
19+ Ok(match &ctx.ast.data {
2020 Data::Struct(strct) => {
2121 ImplBlockBuilder::new(ctx, strct, Trait::Immutable, FieldBounds::ALL_SELF).build()
2222 }
@@ -26,7 +26,7 @@ pub(crate) fn derive_immutable(ctx: &Ctx, _top_level: Trait) -> TokenStream { · 3 unmodified lines
2626 Data::Union(unn) => {
2727 ImplBlockBuilder::new(ctx, unn, Trait::Immutable, FieldBounds::ALL_SELF).build()
2828 }
29− }
29+ })
3030 }
3131
3232 pub(crate) fn derive_hash(ctx: &Ctx, _top_level: Trait) -> Result<TokenStream, Error> {
@@ -97,16 +97,20 @@ pub(crate) fn derive_split_at(ctx: &Ctx, _top_level: Trait) -> Result<TokenStrea · 64 unmodified lines
9797 match &ctx.ast.data {
9898 Data::Struct(_) => {}
9999 Data::Enum(_) | Data::Union(_) => {
100− return Err(Error::new(Span::call_site(), "can only be applied to structs"));
100+ return ctx
101+ .error_or_skip(Error::new(Span::call_site(), "can only be applied to structs"));
101102 }
102103 };
103104
104105 if repr.get_packed().is_some() {
105− return Err(Error::new(Span::call_site(), "must not have #[repr(packed)] attribute"));
106+ return ctx.error_or_skip(Error::new(
107+ Span::call_site(),
108+ "must not have #[repr(packed)] attribute",
109+ ));
106110 }
107111
108112 if !(repr.is_c() || repr.is_transparent()) {
109− return Err(Error::new(
113+ return ctx.error_or_skip(Error::new(
110114 Span::call_site(),
111115 "must have #[repr(C)] or #[repr(transparent)] in order to guarantee this type's layout is splitable",
112116 ));
@@ -116,7 +120,7 @@ pub(crate) fn derive_split_at(ctx: &Ctx, _top_level: Trait) -> Result<TokenStrea · 3 unmodified lines
116120 let trailing_field = if let Some(((_, _, trailing_field), _)) = fields.split_last() {
117121 trailing_field
118122 } else {
119− return Err(Error::new(Span::call_site(), "must at least one field"));
123+ return ctx.error_or_skip(Error::new(Span::call_site(), "must at least one field"));
120124 };
121125
122126 let zerocopy_crate = &ctx.zerocopy_crate;
rust/zerocopy-derive/derive/try_from_bytes.rs+3−3
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 use proc_macro2::TokenStream;
44 use quote::quote;
55 use syn::{
@@ -531,8 +531,8 @@ fn derive_has_field_struct_union(ctx: &Ctx, data: &dyn DataExt) -> TokenStream { · 525 unmodified lines
531531 data,
532532 Trait::ProjectField {
533533 variant_id: variant_id.clone(),
534− field: field.clone(),
535− field_id: field_id.clone(),
534+ field,
535+ field_id,
536536 invariants: parse_quote!((Aliasing, Alignment, #zerocopy_crate::invariant::Initialized)),
537537 },
538538 FieldBounds::None,
rust/zerocopy-derive/derive/unaligned.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 use proc_macro2::{Span, TokenStream};
44 use syn::{Data, DataEnum, DataStruct, DataUnion, Error};
55
rust/zerocopy-derive/lib.rs+35−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2019 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
@@ -129,6 +129,40 @@ derive!(ByteHash => derive_hash => crate::derive::derive_hash); · 123 unmodified lines
129129 derive!(ByteEq => derive_eq => crate::derive::derive_eq);
130130 derive!(SplitAt => derive_split_at => crate::derive::derive_split_at);
131131
132+#[cfg_attr(not(zerocopy_unstable_linux), doc(hidden))]
133+#[proc_macro_derive(most_traits, attributes(zerocopy))]
134+pub fn most_traits(ts: proc_macro::TokenStream) -> proc_macro::TokenStream {
135+ let ast = syn::parse_macro_input!(ts as DeriveInput);
136+ let ctx = match Ctx::try_from_derive_input(ast) {
137+ Ok(ctx) => ctx,
138+ Err(e) => return e.into_compile_error().into(),
139+ }
140+ .skip_on_error();
141+
142+ // top-level traits for which to attempt a derive
143+ let derives: [(fn(&Ctx, Trait) -> _, _); 6] = [
144+ (crate::derive::known_layout::derive, Trait::KnownLayout),
145+ (crate::derive::derive_immutable, Trait::Immutable),
146+ (crate::derive::from_bytes::derive_from_bytes, Trait::FromBytes),
147+ (crate::derive::into_bytes::derive_into_bytes, Trait::IntoBytes),
148+ (crate::derive::derive_split_at, Trait::SplitAt),
149+ (crate::derive::unaligned::derive_unaligned, Trait::Unaligned),
150+ ];
151+
152+ let mut tokens = proc_macro2::TokenStream::new();
153+ for (derive, t) in derives {
154+ tokens.extend(derive(&ctx, t))
155+ }
156+
157+ // We wrap in `const_block` as a backstop in case any derive fails
158+ // to wrap its output in `const_block` (and thus fails to annotate)
159+ // with the full set of `#[allow(...)]` attributes).
160+ let ts = const_block([Some(tokens)]);
161+ #[cfg(test)]
162+ crate::util::testutil::check_hygiene(ts.clone());
163+ ts.into()
164+}
165+
132166 /// Deprecated: prefer [`FromZeros`] instead.
133167 #[deprecated(since = "0.8.0", note = "`FromZeroes` was renamed to `FromZeros`")]
134168 #[doc(hidden)]
rust/zerocopy-derive/repr.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2019 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
rust/zerocopy-derive/util.rs+26−8
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2019 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
@@ -98,6 +98,11 @@ impl Ctx { · 92 unmodified lines
9898 }
9999 }
100100
101+ pub(crate) fn skip_on_error(mut self) -> Self {
102+ self.skip_on_error = true;
103+ self
104+ }
105+
101106 pub(crate) fn core_path(&self) -> TokenStream {
102107 let zerocopy_crate = &self.zerocopy_crate;
103108 quote!(#zerocopy_crate::util::macro_util::core_reexport)
@@ -106,20 +111,21 @@ impl Ctx { · 2 unmodified lines
106111 pub(crate) fn cfg_compile_error(&self) -> TokenStream {
107112 // By checking both during the compilation of the proc macro *and* in
108113 // the generated code, we ensure that `--cfg
109− // zerocopy_unstable_derive_on_error` need only be passed *either* when
114+ // zerocopy_unstable_linux` need only be passed *either* when
110115 // compiling this crate *or* when compiling the user's crate. The former
111116 // is preferable, but in some situations (such as when cross-compiling
112117 // using `cargo build --target`), it doesn't get propagated to this
113118 // crate's build by default.
114− if cfg!(zerocopy_unstable_derive_on_error) {
119+ if cfg!(zerocopy_unstable_linux) {
115120 quote!()
116121 } else if let Some(span) = self.on_error_span {
117122 let core = self.core_path();
118− let error_message = "`on_error` is experimental; pass '--cfg zerocopy_unstable_derive_on_error' to enable";
123+ let error_message =
124+ "`on_error` is experimental; pass '--cfg zerocopy_unstable_linux' to enable";
119125 quote::quote_spanned! {span=>
120126 #[allow(unused_attributes, unexpected_cfgs)]
121127 const _: () = {
122− #[cfg(not(zerocopy_unstable_derive_on_error))]
128+ #[cfg(not(zerocopy_unstable_linux))]
123129 #core::compile_error!(#error_message);
124130 };
125131 }
@@ -612,6 +618,20 @@ impl<'a> ImplBlockBuilder<'a> { · 486 unmodified lines
612618 }
613619 };
614620
621+ let zerocopy_bounds =
622+ field_type_bounds
623+ .into_iter()
624+ .chain(padding_check_bound)
625+ .chain(self_bounds)
626+ .map(|bound| {
627+ if self.ctx.skip_on_error {
628+ parse_quote!(for<'zc> #bound)
629+ } else {
630+ bound.clone()
631+ }
632+ })
633+ .collect::<Vec<_>>();
634+
615635 let bounds = self
616636 .ctx
617637 .ast
@@ -621,9 +641,7 @@ impl<'a> ImplBlockBuilder<'a> { · 3 unmodified lines
621641 .map(|where_clause| where_clause.predicates.iter())
622642 .into_iter()
623643 .flatten()
624− .chain(field_type_bounds.iter())
625− .chain(padding_check_bound.iter())
626− .chain(self_bounds.iter());
644+ .chain(zerocopy_bounds.iter());
627645
628646 // The parameters with trait bounds, but without type defaults.
629647 let mut params: Vec<_> = self
rust/zerocopy/README.md+7−8
@@ -1,14 +1,13 @@
11 # `zerocopy`
22
3−These source files come from the Rust `zerocopy` crate, version v0.8.50
4−(released 2026-05-31), hosted in the <https://github.com/google/zerocopy>
3+These source files come from the Rust `zerocopy` crate, version v0.8.54
4+(released 2026-07-08), hosted in the <https://github.com/google/zerocopy>
55 repository, licensed under "BSD-2-Clause OR Apache-2.0 OR MIT" and only
6−modified to add the SPDX license identifiers and to remove `Display`
7−for `f32` and `f64`.
6+modified to tweak the SPDX license identifiers.
87
98 For copyright details, please see:
109
11− https://github.com/google/zerocopy/blob/v0.8.50/README.md?plain=1
12− https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-BSD
13− https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-APACHE
14− https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-MIT
10+ https://github.com/google/zerocopy/blob/v0.8.54/README.md?plain=1
11+ https://github.com/google/zerocopy/blob/v0.8.54/LICENSE-BSD
12+ https://github.com/google/zerocopy/blob/v0.8.54/LICENSE-APACHE
13+ https://github.com/google/zerocopy/blob/v0.8.54/LICENSE-MIT
rust/zerocopy/rustdoc/style.css+0−1
@@ -1,5 +1,4 @@
11 /* SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT */
2−
32 /*
43 Copyright 2026 The Fuchsia Authors
54
rust/zerocopy/src/byte_slice.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2024 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
rust/zerocopy/src/byteorder.rs+41−9
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2019 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
@@ -100,6 +100,7 @@ mod private { · 94 unmodified lines
100100
101101 #[allow(missing_copy_implementations, missing_debug_implementations)]
102102 #[doc(hidden)]
103+#[derive(PartialEq)]
103104 pub enum Order {
104105 BigEndian,
105106 LittleEndian,
@@ -164,6 +165,42 @@ pub type BE = BigEndian; · 58 unmodified lines
164165 /// A type alias for [`LittleEndian`].
165166 pub type LE = LittleEndian;
166167
168+macro_rules! impl_dbg_trait {
169+ ($name:ident, $native:ident) => {
170+ impl<O: ByteOrder> Debug for $name<O> {
171+ #[inline]
172+ fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
173+ // This results in a format like "U16(42)".
174+ f.debug_tuple(stringify!($name)).field(&self.get()).finish()
175+ }
176+ }
177+ };
178+}
179+
180+macro_rules! impl_dbg_traits {
181+ ($name:ident, $native:ident, "floating point number") => {
182+ #[cfg(not(no_fp_fmt_parse))]
183+ impl_dbg_trait!($name, $native);
184+
185+ #[cfg(no_fp_fmt_parse)]
186+ impl<O: ByteOrder> Debug for $name<O> {
187+ #[inline]
188+ fn fmt(&self, _f: &mut Formatter<'_>) -> fmt::Result {
189+ panic!("floating point support is turned off");
190+ }
191+ }
192+ };
193+ ($name:ident, $native:ident, "unsigned integer") => {
194+ impl_dbg_traits!($name, $native, @all_types);
195+ };
196+ ($name:ident, $native:ident, "signed integer") => {
197+ impl_dbg_traits!($name, $native, @all_types);
198+ };
199+ ($name:ident, $native:ident, @all_types) => {
200+ impl_dbg_trait!($name, $native);
201+ };
202+}
203+
167204 macro_rules! impl_fmt_trait {
168205 ($name:ident, $native:ident, $trait:ident) => {
169206 impl<O: ByteOrder> $trait for $name<O> {
@@ -177,6 +214,8 @@ macro_rules! impl_fmt_trait { · 7 unmodified lines
177214
178215 macro_rules! impl_fmt_traits {
179216 ($name:ident, $native:ident, "floating point number") => {
217+ #[cfg(not(no_fp_fmt_parse))]
218+ impl_fmt_trait!($name, $native, Display);
180219 };
181220 ($name:ident, $native:ident, "unsigned integer") => {
182221 impl_fmt_traits!($name, $native, @all_types);
@@ -687,16 +726,9 @@ example of how it can be used for parsing UDP packets. · 504 unmodified lines
687726 }
688727 }
689728
729+ impl_dbg_traits!($name, $native, $number_kind);
690730 impl_fmt_traits!($name, $native, $number_kind);
691731 impl_ops_traits!($name, $native, $number_kind);
692−
693− impl<O: ByteOrder> Debug for $name<O> {
694− #[inline]
695− fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
696− // This results in a format like "U16(42)".
697− f.debug_tuple(stringify!($name)).field(&self.get()).finish()
698− }
699− }
700732 };
701733 }
702734
rust/zerocopy/src/deprecated.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2024 The Fuchsia Authors
44 //
55 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
rust/zerocopy/src/error.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2024 The Fuchsia Authors
44 //
55 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
rust/zerocopy/src/impls.rs+2−2
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2024 The Fuchsia Authors
44 //
55 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
@@ -1359,7 +1359,7 @@ mod simd { · 1353 unmodified lines
13591359 #[cfg(not(no_zerocopy_aarch64_simd_1_59_0))]
13601360 simd_arch_mod!(
13611361 #[cfg(all(
1362− target_arch = "aarch64",
1362+ target_arch = "aarch64",
13631363 any(
13641364 target_endian = "little",
13651365 not(no_zerocopy_aarch64_simd_be_1_87_0)
rust/zerocopy/src/layout.rs+3−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2024 The Fuchsia Authors
44 //
55 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
@@ -71,6 +71,8 @@ impl SizeInfo { · 65 unmodified lines
7171 /// Attempts to create a `SizeInfo` from `Self` in which `elem_size` is a
7272 /// `NonZeroUsize`. If `elem_size` is 0, returns `None`.
7373 #[allow(unused)]
74+ #[cfg_attr(not(zerocopy_inline_always), inline)]
75+ #[cfg_attr(zerocopy_inline_always, inline(always))]
7476 const fn try_to_nonzero_elem_size(&self) -> Option<SizeInfo<NonZeroUsize>> {
7577 Some(match *self {
7678 SizeInfo::Sized { size } => SizeInfo::Sized { size },
rust/zerocopy/src/lib.rs+7−5
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2018 The Fuchsia Authors
44 //
55 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
@@ -12,7 +12,7 @@ · 6 unmodified lines
1212 // After updating the following doc comment, make sure to run the following
1313 // command to update `README.md` based on its contents:
1414 //
15−// cargo -q run --manifest-path tools/Cargo.toml -p generate-readme > README.md
15+// (cd .. && cargo -q run --manifest-path tools/Cargo.toml -p generate-readme) > README.md
1616
1717 //! ***<span style="font-size: 140%">Fast, safe, <span
1818 //! style="color:red;">compile error</span>. Pick two.</span>***
@@ -174,7 +174,7 @@ · 155 unmodified lines
174174 //!
175175 //! [Miri]: https://github.com/rust-lang/miri
176176 //! [Kani]: https://github.com/model-checking/kani
177−//! [soundness policy]: https://github.com/google/zerocopy/blob/main/POLICIES.md#soundness
177+//! [soundness policy]: https://github.com/google/zerocopy/blob/main/zerocopy/POLICIES.md#soundness
178178 //!
179179 //! # Relationship to Project Safe Transmute
180180 //!
@@ -203,7 +203,7 @@ · 22 unmodified lines
203203 //!
204204 //! See our [MSRV policy].
205205 //!
206−//! [MSRV policy]: https://github.com/google/zerocopy/blob/main/POLICIES.md#msrv
206+//! [MSRV policy]: https://github.com/google/zerocopy/blob/main/zerocopy/POLICIES.md#msrv
207207 //!
208208 //! # Changelog
209209 //!
@@ -435,6 +435,8 @@ const _: () = { · 225 unmodified lines
435435 WARNING
436436 };
437437
438+#[cfg(all(any(feature = "derive", test), zerocopy_unstable_linux))]
439+pub use zerocopy_derive::most_traits;
438440 /// Implements [`KnownLayout`].
439441 ///
440442 /// This derive analyzes various aspects of a type's layout that are needed for
@@ -2832,7 +2834,7 @@ pub unsafe trait TryFromBytes { · 2391 unmodified lines
28322834 /// ```
28332835 ///
28342836 /// [`try_mut_from_bytes`]: TryFromBytes::try_mut_from_bytes
2835− ///
2837+ ///
28362838 #[doc = codegen_header!("h5", "try_mut_from_bytes_with_elems")]
28372839 ///
28382840 /// See [`TryFromBytes::try_ref_from_bytes_with_elems`](#method.try_ref_from_bytes_with_elems.codegen).
rust/zerocopy/src/macros.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2024 The Fuchsia Authors
44 //
55 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
rust/zerocopy/src/pointer/inner.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2024 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
rust/zerocopy/src/pointer/invariant.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2024 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
rust/zerocopy/src/pointer/mod.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2023 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
rust/zerocopy/src/pointer/ptr.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2023 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
rust/zerocopy/src/pointer/transmute.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2025 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
rust/zerocopy/src/ref.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2024 The Fuchsia Authors
44 //
55 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
rust/zerocopy/src/split_at.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2025 The Fuchsia Authors
44 //
55 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
rust/zerocopy/src/util/macro_util.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2022 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
rust/zerocopy/src/util/macros.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2023 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
rust/zerocopy/src/util/mod.rs+7−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2023 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
@@ -150,6 +150,8 @@ pub(crate) fn validate_aligned_to<T: AsAddress, U>(t: T) -> Result<(), Alignment · 144 unmodified lines
150150 // Ensures that we add the minimum required padding.
151151 kani::ensures(|&p| p < align.get()),
152152 )]
153+#[cfg_attr(not(zerocopy_inline_always), inline)]
154+#[cfg_attr(zerocopy_inline_always, inline(always))]
153155 pub(crate) const fn padding_needed_for(len: usize, align: NonZeroUsize) -> usize {
154156 #[cfg(kani)]
155157 #[kani::proof_for_contract(padding_needed_for)]
@@ -251,6 +253,8 @@ pub(crate) const fn round_down_to_next_multiple_of_alignment( · 95 unmodified lines
251253 n & mask
252254 }
253255
256+#[cfg_attr(not(zerocopy_inline_always), inline)]
257+#[cfg_attr(zerocopy_inline_always, inline(always))]
254258 pub(crate) const fn max(a: NonZeroUsize, b: NonZeroUsize) -> NonZeroUsize {
255259 if a.get() < b.get() {
256260 b
@@ -259,6 +263,8 @@ pub(crate) const fn max(a: NonZeroUsize, b: NonZeroUsize) -> NonZeroUsize { · 2 unmodified lines
259263 }
260264 }
261265
266+#[cfg_attr(not(zerocopy_inline_always), inline)]
267+#[cfg_attr(zerocopy_inline_always, inline(always))]
262268 pub(crate) const fn min(a: NonZeroUsize, b: NonZeroUsize) -> NonZeroUsize {
263269 if a.get() > b.get() {
264270 b
rust/zerocopy/src/wrappers.rs+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
2−
2+//
33 // Copyright 2023 The Fuchsia Authors
44 //
55 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
sound/hda/codecs/side-codecs/tas2781_hda_spi.c+2−1
@@ -343,6 +343,8 @@ static int tas2781_read_acpi(struct tas2781_hda *tas_hda, · 342 unmodified lines
343343 strscpy(p->dev_name, hid, sizeof(p->dev_name));
344344 physdev = get_device(acpi_get_first_physical_node(adev));
345345 acpi_dev_put(adev);
346+ if (!physdev)
347+ return -ENODEV;
346348
347349 property = "ti,dev-index";
348350 ret = device_property_count_u32(physdev, property);
@@ -385,7 +387,6 @@ static int tas2781_read_acpi(struct tas2781_hda *tas_hda, · 36 unmodified lines
385387 err:
386388 dev_err(p->dev, "read acpi error, ret: %d\n", ret);
387389 put_device(physdev);
388− acpi_dev_put(adev);
389390
390391 return ret;
391392 }
sound/soc/amd/acp-config.c+7−0
@@ -44,6 +44,13 @@ static const struct dmi_system_id acp70_acpi_flag_override_table[] = { · 43 unmodified lines
4444 DMI_MATCH(DMI_PRODUCT_NAME, "83W5"),
4545 },
4646 },
47+ {
48+ /* Lenovo Legion 7 15ASH11 (Strix Halo, ACP 7.0) */
49+ .matches = {
50+ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
51+ DMI_MATCH(DMI_PRODUCT_NAME, "83V9"),
52+ },
53+ },
4754 {
4855 .matches = {
4956 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC"),
sound/soc/amd/yc/acp6x-mach.c+22−0
@@ -45,6 +45,13 @@ static struct snd_soc_card acp6x_card = { · 44 unmodified lines
4545 };
4646
4747 static const struct dmi_system_id yc_acp_quirk_table[] = {
48+ {
49+ .driver_data = &acp6x_card,
50+ .matches = {
51+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
52+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire AG14-22P"),
53+ }
54+ },
4855 {
4956 .driver_data = &acp6x_card,
5057 .matches = {
@@ -521,6 +528,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { · 470 unmodified lines
521528 DMI_MATCH(DMI_PRODUCT_NAME, "Vector A16 HX A8WHG"),
522529 }
523530 },
531+ {
532+ .driver_data = &acp6x_card,
533+ .matches = {
534+ DMI_MATCH(DMI_BOARD_VENDOR, "Micro-Star International Co., Ltd."),
535+ DMI_MATCH(DMI_PRODUCT_NAME, "Crosshair A16 HX D7WFKG"),
536+ }
537+ },
524538 {
525539 .driver_data = &acp6x_card,
526540 .matches = {
@@ -829,6 +843,14 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { · 302 unmodified lines
829843 DMI_MATCH(DMI_BOARD_NAME, "PM1403CDA"),
830844 }
831845 },
846+ {
847+ .driver_data = &acp6x_card,
848+ .matches = {
849+ DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
850+ DMI_MATCH(DMI_PRODUCT_NAME, "Vivobook_ASUSLaptop M6500RE_M6500RE"),
851+ }
852+ },
853+
832854 {}
833855 };
834856
sound/soc/codecs/max98090.c+3−2
@@ -2423,8 +2423,9 @@ static int max98090_probe(struct snd_soc_component *component) · 2422 unmodified lines
24232423 dev_dbg(component->dev, "max98090_probe\n");
24242424
24252425 max98090->mclk = devm_clk_get(component->dev, "mclk");
2426− if (PTR_ERR(max98090->mclk) == -EPROBE_DEFER)
2427− return -EPROBE_DEFER;
2426+ if (IS_ERR(max98090->mclk))
2427+ if (PTR_ERR(max98090->mclk) == -EPROBE_DEFER)
2428+ return -EPROBE_DEFER;
24282429
24292430 max98090->component = component;
24302431
sound/soc/codecs/max98095.c+3−2
@@ -1987,8 +1987,9 @@ static int max98095_probe(struct snd_soc_component *component) · 1986 unmodified lines
19871987 int ret = 0;
19881988
19891989 max98095->mclk = devm_clk_get(component->dev, "mclk");
1990− if (PTR_ERR(max98095->mclk) == -EPROBE_DEFER)
1991− return -EPROBE_DEFER;
1990+ if (IS_ERR(max98095->mclk))
1991+ if (PTR_ERR(max98095->mclk) == -EPROBE_DEFER)
1992+ return -EPROBE_DEFER;
19921993
19931994 /* reset the codec, the DSP core, and disable all interrupts */
19941995 max98095_reset(component);
sound/soc/codecs/rt722-sdca-sdw.c+4−0
@@ -113,6 +113,7 @@ static int rt722_sdca_mbq_size(struct device *dev, unsigned int reg) · 112 unmodified lines
113113 case 0x2000090 ... 0x2000094:
114114 case 0x20000b1:
115115 case 0x20000b4:
116+ case 0x3010000:
116117 case 0x3110000:
117118 case 0x5300000 ... 0x5300300:
118119 case 0x5400002:
@@ -196,15 +197,18 @@ static bool rt722_sdca_volatile_register(struct device *dev, unsigned int reg) · 77 unmodified lines
196197 case 0x2000007:
197198 case 0x200000d:
198199 case 0x2000019:
200+ case 0x200001a:
199201 case 0x2000020:
200202 case 0x2000030:
201203 case 0x2000046:
202204 case 0x2000067:
203205 case 0x2000084:
204206 case 0x2000086:
207+ case 0x3010000:
205208 case 0x3110000:
206209 case 0x5800003:
207210 case 0x5810000:
211+ case 0x6100008:
208212 case 0x44011000 ... 0x440115ff:
209213 case 0x44012000:
210214 case 0x44012021:
sound/soc/codecs/rt722-sdca.c+14−0
@@ -1851,6 +1851,17 @@ static void rt722_sdca_jack_preset(struct rt722_sdca_priv *rt722) · 1850 unmodified lines
18511851 }
18521852 }
18531853
1854+static void rt722_sdca_reset(struct rt722_sdca_priv *rt722)
1855+{
1856+ rt722_sdca_index_update_bits(rt722, RT722_VENDOR_REG,
1857+ RT722_LDO1_CTL, RT722_HIDDEN_REG_SW_RESET,
1858+ RT722_HIDDEN_REG_SW_RESET);
1859+ rt722_sdca_index_update_bits(rt722, RT722_VENDOR_HDA_CTL,
1860+ RT722_HDA_LEGACY_RESET_CTL, 0x1, 0x1);
1861+ if (rt722->hw_vid == RT722_VA)
1862+ rt722_sdca_index_write(rt722, RT722_VENDOR_REG, RT722_LDO1_CTL, 0xb091);
1863+}
1864+
18541865 int rt722_sdca_io_init(struct device *dev, struct sdw_slave *slave)
18551866 {
18561867 struct rt722_sdca_priv *rt722 = dev_get_drvdata(dev);
@@ -1888,6 +1899,9 @@ int rt722_sdca_io_init(struct device *dev, struct sdw_slave *slave) · 31 unmodified lines
18881899 rt722->hw_vid = (val & 0x0f00) >> 8;
18891900 dev_dbg(&slave->dev, "%s hw_vid=0x%x\n", __func__, rt722->hw_vid);
18901901
1902+ if (!rt722->first_hw_init)
1903+ rt722_sdca_reset(rt722);
1904+
18911905 rt722_sdca_dmic_preset(rt722);
18921906 rt722_sdca_amp_preset(rt722);
18931907 rt722_sdca_jack_preset(rt722);
sound/soc/codecs/tas2562.c+32−14
@@ -32,15 +32,16 @@ · 31 unmodified lines
3232 static const unsigned int float_vol_db_lookup[] = {
3333 0x00000d43, 0x000010b2, 0x00001505, 0x00001a67, 0x00002151,
3434 0x000029f1, 0x000034cd, 0x00004279, 0x000053af, 0x0000695b,
35−0x0000695b, 0x0000a6fa, 0x0000d236, 0x000108a4, 0x00014d2a,
35+0x000084a3, 0x0000a6fa, 0x0000d236, 0x000108a4, 0x00014d2a,
3636 0x0001a36e, 0x00021008, 0x000298c0, 0x000344df, 0x00041d8f,
3737 0x00052e5a, 0x000685c8, 0x00083621, 0x000a566d, 0x000d03a7,
3838 0x0010624d, 0x0014a050, 0x0019f786, 0x0020b0bc, 0x0029279d,
3939 0x0033cf8d, 0x004139d3, 0x00521d50, 0x00676044, 0x0082248a,
4040 0x00a3d70a, 0x00ce4328, 0x0103ab3d, 0x0146e75d, 0x019b8c27,
4141 0x02061b89, 0x028c423f, 0x03352529, 0x0409c2b0, 0x05156d68,
42−0x080e9f96, 0x0a24b062, 0x0cc509ab, 0x10137987, 0x143d1362,
43−0x197a967f, 0x2013739e, 0x28619ae9, 0x32d64617, 0x40000000
42+0x06666666, 0x080e9f96, 0x0a24b062, 0x0cc509ab, 0x10137987,
43+0x143d1362, 0x197a967f, 0x2013739e, 0x28619ae9, 0x32d64617,
44+0x40000000
4445 };
4546
4647 struct tas2562_data {
@@ -471,30 +472,45 @@ static int tas2562_volume_control_put(struct snd_kcontrol *kcontrol, · 424 unmodified lines
471472 {
472473 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
473474 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component);
474− int ret;
475+ int ret, index;
475476 u32 reg_val;
476477
477− reg_val = float_vol_db_lookup[ucontrol->value.integer.value[0]/2];
478− ret = snd_soc_component_write(component, TAS2562_DVC_CFG4,
479− (reg_val & 0xff));
480− if (ret)
481− return ret;
482− ret = snd_soc_component_write(component, TAS2562_DVC_CFG3,
483− ((reg_val >> 8) & 0xff));
478+ if (tas2562->volume_lvl == ucontrol->value.integer.value[0])
479+ return 0;
480+
481+ index = ucontrol->value.integer.value[0] / 2;
482+ if (index < 0 || index >= ARRAY_SIZE(float_vol_db_lookup))
483+ return -EINVAL;
484+
485+ reg_val = float_vol_db_lookup[index];
486+
487+ /*
488+ * The device applies the 32-bit coefficient to the playback path on
489+ * the write to DVC_CFG4 (the LSB, book 0 page 2 reg 0x0F), so the
490+ * bytes must be written MSB first and DVC_CFG4 last. Writing CFG4
491+ * first latches a mix of the previous coefficient's upper bytes and
492+ * the new LSB instead of the requested value.
493+ */
494+ ret = snd_soc_component_write(component, TAS2562_DVC_CFG1,
495+ ((reg_val >> 24) & 0xff));
484496 if (ret)
485497 return ret;
486498 ret = snd_soc_component_write(component, TAS2562_DVC_CFG2,
487499 ((reg_val >> 16) & 0xff));
488500 if (ret)
489501 return ret;
490− ret = snd_soc_component_write(component, TAS2562_DVC_CFG1,
491− ((reg_val >> 24) & 0xff));
502+ ret = snd_soc_component_write(component, TAS2562_DVC_CFG3,
503+ ((reg_val >> 8) & 0xff));
504+ if (ret)
505+ return ret;
506+ ret = snd_soc_component_write(component, TAS2562_DVC_CFG4,
507+ (reg_val & 0xff));
492508 if (ret)
493509 return ret;
494510
495511 tas2562->volume_lvl = ucontrol->value.integer.value[0];
496512
497− return 0;
513+ return 1;
498514 }
499515
500516 /* Digital Volume Control. From 0 dB to -110 dB in 1 dB steps */
@@ -732,6 +748,8 @@ static int tas2562_probe(struct i2c_client *client) · 231 unmodified lines
732748 data->client = client;
733749 data->dev = &client->dev;
734750 data->model_id = (uintptr_t)i2c_get_match_data(client);
751+ /* Register default is 0x40400000, this is closest */
752+ data->volume_lvl = (ARRAY_SIZE(float_vol_db_lookup) - 1) * 2;
735753
736754 tas2562_parse_dt(data);
737755
sound/soc/codecs/tas2781-i2c.c+2−2
@@ -1310,8 +1310,8 @@ static void cali_reg_update(struct bulk_reg_val *p, · 1309 unmodified lines
13101310 t->sin_gn[2]);
13111311 break;
13121312 case TAS2781_PRM_SINEGAIN2_REG:
1313− reg = TASDEVICE_REG(t->sin_gn[0], t->sin_gn[1],
1314− t->sin_gn[2]);
1313+ reg = TASDEVICE_REG(t->sin_gn2[0], t->sin_gn2[1],
1314+ t->sin_gn2[2]);
13151315 break;
13161316 default:
13171317 reg = 0;
sound/soc/fsl/fsl_asrc.c+1−1
@@ -1419,7 +1419,7 @@ static int fsl_asrc_probe(struct platform_device *pdev) · 1418 unmodified lines
14191419 ret = fsl_asrc_m2m_init(asrc);
14201420 if (ret) {
14211421 dev_err(&pdev->dev, "failed to init m2m device %d\n", ret);
1422− return ret;
1422+ goto err_pm_get_sync;
14231423 }
14241424
14251425 return 0;
sound/soc/fsl/fsl_easrc.c+1−1
@@ -2269,7 +2269,7 @@ static int fsl_easrc_probe(struct platform_device *pdev) · 2268 unmodified lines
22692269 ret = fsl_asrc_m2m_init(easrc);
22702270 if (ret) {
22712271 dev_err(&pdev->dev, "failed to init m2m device %d\n", ret);
2272− return ret;
2272+ goto err_pm_disable;
22732273 }
22742274
22752275 return 0;
sound/soc/intel/common/soc-acpi-intel-nvl-match.c+13−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88
99 #include <sound/soc-acpi.h>
1010 #include <sound/soc-acpi-intel-match.h>
11+#include <sound/soc-acpi-intel-ssp-common.h>
1112 #include "soc-acpi-intel-sdw-mockup-match.h"
1213
1314 static const struct snd_soc_acpi_codecs nvl_essx_83x6 = {
@@ -15,6 +16,11 @@ static const struct snd_soc_acpi_codecs nvl_essx_83x6 = { · 1 unmodified line
1516 .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
1617 };
1718
19+static const struct snd_soc_acpi_codecs nvl_rt5682_rt5682s_hp = {
20+ .num_codecs = 2,
21+ .codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID},
22+};
23+
1824 struct snd_soc_acpi_mach snd_soc_acpi_intel_nvl_machines[] = {
1925 {
2026 .comp_ids = &nvl_essx_83x6,
@@ -24,6 +30,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_nvl_machines[] = { · 3 unmodified lines
2430 SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
2531 SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
2632 },
33+ {
34+ .comp_ids = &nvl_rt5682_rt5682s_hp,
35+ .drv_name = "sof_rt5682",
36+ .sof_tplg_filename = "sof-nvl-rt5682", /* the tplg suffix is added at run time */
37+ .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
38+ SND_SOC_ACPI_TPLG_INTEL_SSP_MSB,
39+ },
2740 {},
2841 };
2942 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_nvl_machines);
sound/soc/sdca/sdca_class.c+2−2
@@ -111,8 +111,8 @@ static void class_boot_work(struct work_struct *work) · 110 unmodified lines
111111
112112 regcache_cache_only(drv->dev_regmap, false);
113113
114− drv->irq_info = sdca_irq_allocate(drv->dev, drv->dev_regmap,
115− drv->sdw->irq);
114+ drv->irq_info = devm_sdca_irq_allocate(drv->dev, drv->dev_regmap,
115+ drv->sdw->irq);
116116 if (IS_ERR(drv->irq_info))
117117 goto err;
118118
sound/soc/sdca/sdca_class_function.c+3−3
@@ -191,7 +191,7 @@ static const struct snd_soc_dai_ops class_function_sdw_ops = { · 190 unmodified lines
191191 .hw_free = class_function_sdw_remove_peripheral,
192192 };
193193
194−static int class_function_component_probe(struct snd_soc_component *component)
194+static int class_function_component_fixup_controls(struct snd_soc_component *component)
195195 {
196196 struct class_function_drv *drv = snd_soc_component_get_drvdata(component);
197197 struct sdca_class_drv *core = drv->core;
@@ -217,7 +217,7 @@ static int class_function_set_jack(struct snd_soc_component *component, · 19 unmodified lines
217217 }
218218
219219 static const struct snd_soc_component_driver class_function_component_drv = {
220− .probe = class_function_component_probe,
220+ .fixup_controls = class_function_component_fixup_controls,
221221 .remove = class_function_component_remove,
222222 .endianness = 1,
223223 };
@@ -408,7 +408,7 @@ static void class_function_remove(struct auxiliary_device *auxdev) · 184 unmodified lines
408408 {
409409 struct class_function_drv *drv = auxiliary_get_drvdata(auxdev);
410410
411− sdca_irq_cleanup(drv->dev, drv->function, drv->core->irq_info);
411+ sdca_irq_cleanup_late(drv->dev, drv->function, drv->core->irq_info);
412412 }
413413
414414 static int class_function_runtime_suspend(struct device *dev)
sound/soc/sdca/sdca_device.c+1−1
@@ -43,7 +43,7 @@ void sdca_lookup_swft(struct sdw_slave *slave) · 42 unmodified lines
4343 dev_info(&slave->dev, "SWFT not available\n");
4444 else
4545 devm_add_action_or_reset(&slave->dev, devm_acpi_table_put,
46− &slave->sdca_data.swft);
46+ slave->sdca_data.swft);
4747 }
4848 EXPORT_SYMBOL_NS(sdca_lookup_swft, "SND_SOC_SDCA");
4949
sound/soc/sdca/sdca_fdl.c+15−3
@@ -258,7 +258,8 @@ static int fdl_load_file(struct sdca_interrupt *interrupt, · 257 unmodified lines
258258
259259 if (!swf) {
260260 dev_err(dev, "failed to locate SWF\n");
261− return -ENOENT;
261+ ret = -ENOENT;
262+ goto error;
262263 }
263264
264265 dev_info(dev, "loading SWF: %x-%x-%x\n",
@@ -270,6 +271,8 @@ static int fdl_load_file(struct sdca_interrupt *interrupt, · 5 unmodified lines
270271 SDCA_CTL_XU_FDL_MESSAGEOFFSET, fdl_file->fdl_offset,
271272 SDCA_CTL_XU_FDL_MESSAGELENGTH, swf->data,
272273 swf->file_length - offsetof(struct acpi_sw_file, data));
274+
275+error:
273276 release_firmware(firmware);
274277 return ret;
275278 }
@@ -481,10 +484,9 @@ EXPORT_SYMBOL_NS_GPL(sdca_fdl_process, "SND_SOC_SDCA"); · 205 unmodified lines
481484 */
482485 int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt)
483486 {
484− struct device *dev = interrupt->dev;
485487 struct fdl_state *fdl_state;
486488
487− fdl_state = devm_kzalloc(dev, sizeof(*fdl_state), GFP_KERNEL);
489+ fdl_state = kzalloc_obj(*fdl_state);
488490 if (!fdl_state)
489491 return -ENOMEM;
490492
@@ -499,3 +501,13 @@ int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt) · 8 unmodified lines
499501 return 0;
500502 }
501503 EXPORT_SYMBOL_NS_GPL(sdca_fdl_alloc_state, "SND_SOC_SDCA");
504+
505+/**
506+ * sdca_fdl_free_state - free state for an FDL interrupt
507+ * @interrupt: SDCA interrupt structure.
508+ */
509+void sdca_fdl_free_state(struct sdca_interrupt *interrupt)
510+{
511+ kfree(interrupt->priv);
512+}
513+EXPORT_SYMBOL_NS_GPL(sdca_fdl_free_state, "SND_SOC_SDCA");
sound/soc/sdca/sdca_functions.c+2−0
@@ -855,6 +855,8 @@ static int find_sdca_control_range(struct device *dev, · 854 unmodified lines
855855 return 0;
856856 else if (num_range < 0)
857857 return num_range;
858+ else if (num_range < 2 * sizeof(*limits))
859+ return -EINVAL;
858860
859861 range_list = devm_kcalloc(dev, num_range, sizeof(*range_list), GFP_KERNEL);
860862 if (!range_list)
sound/soc/sdca/sdca_interrupts.c+100−74
@@ -421,7 +421,8 @@ static struct sdca_interrupt *get_interrupt_data(struct device *dev, int irq, · 420 unmodified lines
421421 *
422422 * This is intended to be used as part of the Function boot process. It
423423 * can be called before the soundcard is registered (ie. doesn't depend
424− * on component) and will register the FDL interrupts.
424+ * on component) and will populate all the required IRQ data, as well as
425+ * registering the FDL interrupts to start booting the device.
425426 *
426427 * Return: Zero on success, and a negative error code on failure.
427428 */
@@ -448,21 +449,36 @@ int sdca_irq_populate_early(struct device *dev, struct regmap *regmap, · 20 unmodified lines
448449 else if (!interrupt)
449450 continue;
450451
452+ ret = sdca_irq_data_populate(dev, regmap, NULL, function,
453+ entity, control, interrupt);
454+ if (ret)
455+ return ret;
456+
451457 switch (SDCA_CTL_TYPE(entity->type, control->sel)) {
452− case SDCA_CTL_TYPE_S(XU, FDL_CURRENTOWNER):
453− ret = sdca_irq_data_populate(dev, regmap, NULL,
454− function, entity,
455− control, interrupt);
458+ case SDCA_CTL_TYPE_S(ENTITY_0, FUNCTION_STATUS):
459+ interrupt->handler = function_status_handler;
460+ break;
461+ case SDCA_CTL_TYPE_S(GE, DETECTED_MODE):
462+ interrupt->handler = detected_mode_handler;
463+ interrupt->free_priv = sdca_jack_free_state;
464+
465+ ret = sdca_jack_alloc_state(interrupt);
456466 if (ret)
457467 return ret;
468+ break;
469+ case SDCA_CTL_TYPE_S(XU, FDL_CURRENTOWNER):
470+ interrupt->handler = fdl_owner_handler;
471+ interrupt->free_priv = sdca_fdl_free_state;
458472
459473 ret = sdca_fdl_alloc_state(interrupt);
460474 if (ret)
461475 return ret;
462476
477+ interrupt->early_request = true;
478+
463479 ret = sdca_irq_request_locked(dev, info, irq,
464480 interrupt->name,
465− fdl_owner_handler,
481+ interrupt->handler,
466482 interrupt);
467483 if (ret) {
468484 dev_err(dev, "failed to request irq %s: %d\n",
@@ -470,7 +486,11 @@ int sdca_irq_populate_early(struct device *dev, struct regmap *regmap, · 1 unmodified line
470486 return ret;
471487 }
472488 break;
489+ case SDCA_CTL_TYPE_S(HIDE, HIDTX_CURRENTOWNER):
490+ interrupt->handler = hid_handler;
491+ break;
473492 default:
493+ interrupt->handler = base_handler;
474494 break;
475495 }
476496 }
@@ -495,66 +515,38 @@ int sdca_irq_populate(struct sdca_function_data *function, · 18 unmodified lines
495515 struct sdca_interrupt_info *info)
496516 {
497517 struct device *dev = component->dev;
498− int i, j;
518+ int i, ret;
499519
500520 guard(mutex)(&info->irq_lock);
501521
502− for (i = 0; i < function->num_entities; i++) {
503− struct sdca_entity *entity = &function->entities[i];
522+ for (i = 0; i < SDCA_MAX_INTERRUPTS; i++) {
523+ struct sdca_interrupt *interrupt = &info->irqs[i];
524+ struct sdca_control *control = interrupt->control;
525+ struct sdca_entity *entity = interrupt->entity;
526+ int irq;
504527
505− for (j = 0; j < entity->num_controls; j++) {
506− struct sdca_control *control = &entity->controls[j];
507− int irq = control->interrupt_position;
508− struct sdca_interrupt *interrupt;
509− irq_handler_t handler;
510− int ret;
528+ if (interrupt->function != function || interrupt->irq)
529+ continue;
511530
512− interrupt = get_interrupt_data(dev, irq, info);
513− if (IS_ERR(interrupt))
514− return PTR_ERR(interrupt);
515− else if (!interrupt)
516− continue;
531+ interrupt->component = component;
517532
518− ret = sdca_irq_data_populate(dev, NULL, component,
519− function, entity, control,
520− interrupt);
533+ switch (SDCA_CTL_TYPE(entity->type, control->sel)) {
534+ case SDCA_CTL_TYPE_S(GE, DETECTED_MODE):
535+ ret = sdca_jack_init_state(interrupt);
521536 if (ret)
522537 return ret;
538+ break;
539+ default:
540+ break;
541+ }
523542
524− handler = base_handler;
525−
526− switch (SDCA_CTL_TYPE(entity->type, control->sel)) {
527− case SDCA_CTL_TYPE_S(ENTITY_0, FUNCTION_STATUS):
528− handler = function_status_handler;
529− break;
530− case SDCA_CTL_TYPE_S(GE, DETECTED_MODE):
531− ret = sdca_jack_alloc_state(interrupt);
532− if (ret)
533− return ret;
534−
535− handler = detected_mode_handler;
536− break;
537− case SDCA_CTL_TYPE_S(XU, FDL_CURRENTOWNER):
538− ret = sdca_fdl_alloc_state(interrupt);
539− if (ret)
540− return ret;
541−
542− handler = fdl_owner_handler;
543− break;
544− case SDCA_CTL_TYPE_S(HIDE, HIDTX_CURRENTOWNER):
545− handler = hid_handler;
546− break;
547− default:
548− break;
549− }
550−
551− ret = sdca_irq_request_locked(dev, info, irq, interrupt->name,
552− handler, interrupt);
553− if (ret) {
554− dev_err(dev, "failed to request irq %s: %d\n",
555− interrupt->name, ret);
556− return ret;
557− }
543+ irq = interrupt->control->interrupt_position;
544+ ret = sdca_irq_request_locked(dev, info, irq, interrupt->name,
545+ interrupt->handler, interrupt);
546+ if (ret) {
547+ dev_err(dev, "failed to request irq %s: %d\n",
548+ interrupt->name, ret);
549+ return ret;
558550 }
559551 }
560552
@@ -562,17 +554,10 @@ int sdca_irq_populate(struct sdca_function_data *function, · 1 unmodified line
562554 }
563555 EXPORT_SYMBOL_NS_GPL(sdca_irq_populate, "SND_SOC_SDCA");
564556
565−/**
566− * sdca_irq_cleanup - Free all the individual IRQs for an SDCA Function
567− * @dev: Device pointer against which the sdca_interrupt_info was allocated.
568− * @function: Pointer to the SDCA Function.
569− * @info: Pointer to the SDCA interrupt info for this device.
570− *
571− * Typically this would be called from the driver for a single SDCA Function.
572− */
573−void sdca_irq_cleanup(struct device *dev,
574− struct sdca_function_data *function,
575− struct sdca_interrupt_info *info)
557+static void sdca_irq_cleanup_flags(struct device *dev,
558+ struct sdca_function_data *function,
559+ struct sdca_interrupt_info *info,
560+ bool late_cleanup)
576561 {
577562 int i;
578563
@@ -581,18 +566,59 @@ void sdca_irq_cleanup(struct device *dev, · 2 unmodified lines
581566 for (i = 0; i < SDCA_MAX_INTERRUPTS; i++) {
582567 struct sdca_interrupt *interrupt = &info->irqs[i];
583568
584− if (interrupt->function != function || !interrupt->irq)
569+ if (interrupt->function != function ||
570+ (interrupt->early_request && !late_cleanup))
571+ continue;
572+
573+ if (interrupt->irq)
574+ sdca_irq_free_locked(dev, info, i, interrupt->name, interrupt);
575+
576+ if (!late_cleanup)
585577 continue;
586578
587− sdca_irq_free_locked(dev, info, i, interrupt->name, interrupt);
579+ if (interrupt->free_priv)
580+ interrupt->free_priv(interrupt);
588581
589582 kfree(interrupt->name);
590583 }
591584 }
585+
586+/**
587+ * sdca_irq_cleanup - Free the regular IRQs for an SDCA Function
588+ * @dev: Device pointer against which the sdca_interrupt_info was allocated.
589+ * @function: Pointer to the SDCA Function.
590+ * @info: Pointer to the SDCA interrupt info for this device.
591+ *
592+ * Typically this would be called from the driver for a single SDCA Function
593+ * from component remove.
594+ */
595+void sdca_irq_cleanup(struct device *dev,
596+ struct sdca_function_data *function,
597+ struct sdca_interrupt_info *info)
598+{
599+ sdca_irq_cleanup_flags(dev, function, info, false);
600+}
592601 EXPORT_SYMBOL_NS_GPL(sdca_irq_cleanup, "SND_SOC_SDCA");
593602
594603 /**
595− * sdca_irq_allocate - allocate an SDCA interrupt structure for a device
604+ * sdca_irq_cleanup_late - Free the early IRQs for an SDCA Function
605+ * @dev: Device pointer against which the sdca_interrupt_info was allocated.
606+ * @function: Pointer to the SDCA Function.
607+ * @info: Pointer to the SDCA interrupt info for this device.
608+ *
609+ * Typically this would be called from the driver for a single SDCA Function
610+ * from bus remove.
611+ */
612+void sdca_irq_cleanup_late(struct device *dev,
613+ struct sdca_function_data *function,
614+ struct sdca_interrupt_info *info)
615+{
616+ sdca_irq_cleanup_flags(dev, function, info, true);
617+}
618+EXPORT_SYMBOL_NS_GPL(sdca_irq_cleanup_late, "SND_SOC_SDCA");
619+
620+/**
621+ * devm_sdca_irq_allocate - allocate an SDCA interrupt structure for a device
596622 * @sdev: Device pointer against which things should be allocated.
597623 * @regmap: regmap to be used for accessing the SDCA IRQ registers.
598624 * @irq: The interrupt number.
@@ -604,8 +630,8 @@ EXPORT_SYMBOL_NS_GPL(sdca_irq_cleanup, "SND_SOC_SDCA"); · 5 unmodified lines
604630 * Return: A pointer to the allocated sdca_interrupt_info struct, or an
605631 * error code.
606632 */
607−struct sdca_interrupt_info *sdca_irq_allocate(struct device *sdev,
608− struct regmap *regmap, int irq)
633+struct sdca_interrupt_info *devm_sdca_irq_allocate(struct device *sdev,
634+ struct regmap *regmap, int irq)
609635 {
610636 struct sdca_interrupt_info *info;
611637 int ret, i;
@@ -634,7 +660,7 @@ struct sdca_interrupt_info *sdca_irq_allocate(struct device *sdev, · 22 unmodified lines
634660
635661 return info;
636662 }
637−EXPORT_SYMBOL_NS_GPL(sdca_irq_allocate, "SND_SOC_SDCA");
663+EXPORT_SYMBOL_NS_GPL(devm_sdca_irq_allocate, "SND_SOC_SDCA");
638664
639665 static void irq_enable_flags(struct sdca_function_data *function,
640666 struct sdca_interrupt_info *info, bool early)
sound/soc/sdca/sdca_jack.c+50−38
@@ -41,26 +41,12 @@ int sdca_jack_process(struct sdca_interrupt *interrupt) · 40 unmodified lines
4141 struct jack_state *state = interrupt->priv;
4242 struct snd_kcontrol *kctl = state->kctl;
4343 struct snd_ctl_elem_value *ucontrol __free(kfree) = NULL;
44+ struct soc_enum *soc_enum;
4445 unsigned int reg, val;
4546 int ret;
4647
4748 guard(rwsem_write)(rwsem);
4849
49− if (!kctl) {
50− const char *name __free(kfree) = kasprintf(GFP_KERNEL, "%s %s",
51− interrupt->entity->label,
52− SDCA_CTL_SELECTED_MODE_NAME);
53−
54− if (!name)
55− return -ENOMEM;
56−
57− kctl = snd_soc_component_get_kcontrol(component, name);
58− if (!kctl)
59− dev_dbg(dev, "control not found: %s\n", name);
60− else
61− state->kctl = kctl;
62− }
63−
6450 reg = SDW_SDCA_CTL(interrupt->function->desc->adr, interrupt->entity->id,
6551 interrupt->control->sel, 0);
6652
@@ -96,30 +82,21 @@ int sdca_jack_process(struct sdca_interrupt *interrupt) · 29 unmodified lines
9682
9783 dev_dbg(dev, "%s: %#x\n", interrupt->name, val);
9884
99− if (kctl) {
100− struct soc_enum *soc_enum = (struct soc_enum *)kctl->private_value;
101−
102− ucontrol = kzalloc_obj(*ucontrol);
103− if (!ucontrol)
104− return -ENOMEM;
85+ ucontrol = kzalloc_obj(*ucontrol);
86+ if (!ucontrol)
87+ return -ENOMEM;
10588
106− ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(soc_enum, val);
89+ soc_enum = (struct soc_enum *)kctl->private_value;
90+ ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(soc_enum, val);
10791
108− ret = snd_soc_dapm_put_enum_double(kctl, ucontrol);
109− if (ret < 0) {
110− dev_err(dev, "failed to update selected mode: %d\n", ret);
111− return ret;
112− }
113−
114− snd_ctl_notify(card->snd_card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
115− } else {
116− ret = regmap_write(interrupt->function_regmap, reg, val);
117− if (ret) {
118− dev_err(dev, "failed to write selected mode: %d\n", ret);
119− return ret;
120− }
92+ ret = snd_soc_dapm_put_enum_double(kctl, ucontrol);
93+ if (ret < 0) {
94+ dev_err(dev, "failed to update selected mode: %d\n", ret);
95+ return ret;
12196 }
12297
98+ snd_ctl_notify(card->snd_card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
99+
123100 return sdca_jack_report(interrupt);
124101 }
125102 EXPORT_SYMBOL_NS_GPL(sdca_jack_process, "SND_SOC_SDCA");
@@ -132,10 +109,9 @@ EXPORT_SYMBOL_NS_GPL(sdca_jack_process, "SND_SOC_SDCA"); · 6 unmodified lines
132109 */
133110 int sdca_jack_alloc_state(struct sdca_interrupt *interrupt)
134111 {
135− struct device *dev = interrupt->dev;
136112 struct jack_state *jack_state;
137113
138− jack_state = devm_kzalloc(dev, sizeof(*jack_state), GFP_KERNEL);
114+ jack_state = kzalloc_obj(*jack_state);
139115 if (!jack_state)
140116 return -ENOMEM;
141117
@@ -145,6 +121,42 @@ int sdca_jack_alloc_state(struct sdca_interrupt *interrupt) · 3 unmodified lines
145121 }
146122 EXPORT_SYMBOL_NS_GPL(sdca_jack_alloc_state, "SND_SOC_SDCA");
147123
124+/**
125+ * sdca_jack_free_state - free state for a jack interrupt
126+ * @interrupt: SDCA interrupt structure.
127+ */
128+void sdca_jack_free_state(struct sdca_interrupt *interrupt)
129+{
130+ kfree(interrupt->priv);
131+}
132+EXPORT_SYMBOL_NS_GPL(sdca_jack_free_state, "SND_SOC_SDCA");
133+
134+/**
135+ * sdca_jack_init_state - Initialise transient state for a jack interrupt
136+ * @interrupt: SDCA interrupt structure.
137+ *
138+ * Return: Zero on success or a negative error code.
139+ */
140+int sdca_jack_init_state(struct sdca_interrupt *interrupt)
141+{
142+ struct jack_state *jack_state = interrupt->priv;
143+ const char *name __free(kfree) = kasprintf(GFP_KERNEL, "%s %s",
144+ interrupt->entity->label,
145+ SDCA_CTL_SELECTED_MODE_NAME);
146+
147+ if (!name)
148+ return -ENOMEM;
149+
150+ jack_state->kctl = snd_soc_component_get_kcontrol(interrupt->component, name);
151+ if (!jack_state->kctl) {
152+ dev_err(interrupt->dev, "control not found: %s\n", name);
153+ return -ENODEV;
154+ }
155+
156+ return 0;
157+}
158+EXPORT_SYMBOL_NS_GPL(sdca_jack_init_state, "SND_SOC_SDCA");
159+
148160 static int type_get_mask(enum sdca_terminal_type type)
149161 {
150162 switch (type) {
@@ -192,7 +204,7 @@ int sdca_jack_set_jack(struct sdca_interrupt_info *info, struct snd_soc_jack *ja · 41 unmodified lines
192204 struct sdca_control_range *range;
193205 struct jack_state *jack_state;
194206
195− if (!interrupt->irq)
207+ if (!interrupt->dev)
196208 continue;
197209
198210 switch (SDCA_CTL_TYPE(entity->type, control->sel)) {
sound/soc/sdca/sdca_ump.c+2−2
@@ -141,7 +141,7 @@ int sdca_ump_read_message(struct device *dev, · 140 unmodified lines
141141 return ret;
142142 }
143143
144− if (msg_len > buf_len - msg_offset) {
144+ if (msg_offset + msg_len > buf_len) {
145145 dev_err(dev, "%s: message too big for UMP buffer: %d\n",
146146 entity->label, msg_len);
147147 return -EINVAL;
@@ -207,7 +207,7 @@ int sdca_ump_write_message(struct device *dev, · 59 unmodified lines
207207 buf_len = sdca_range(range, SDCA_MESSAGEOFFSET_BUFFER_LENGTH, 0);
208208 ump_mode = sdca_range(range, SDCA_MESSAGEOFFSET_UMP_MODE, 0);
209209
210− if (msg_len > buf_len - msg_offset) {
210+ if (msg_offset + msg_len > buf_len) {
211211 dev_err(dev, "%s: message too big for UMP buffer: %d\n",
212212 entity->label, msg_len);
213213 return -EINVAL;
sound/soc/soc-component.c+10−0
@@ -310,6 +310,16 @@ int snd_soc_component_probe(struct snd_soc_component *component) · 309 unmodified lines
310310 return soc_component_ret(component, ret);
311311 }
312312
313+int snd_soc_component_fixup_controls(struct snd_soc_component *component)
314+{
315+ int ret = 0;
316+
317+ if (component->driver->fixup_controls)
318+ ret = component->driver->fixup_controls(component);
319+
320+ return soc_component_ret(component, ret);
321+}
322+
313323 void snd_soc_component_remove(struct snd_soc_component *component)
314324 {
315325 if (component->driver->remove)
sound/soc/soc-core.c+5−0
@@ -2162,6 +2162,11 @@ static int snd_soc_bind_card(struct snd_soc_card *card) · 2161 unmodified lines
21622162 goto probe_end;
21632163
21642164 snd_soc_dapm_new_widgets(card);
2165+ for_each_card_components(card, component) {
2166+ ret = snd_soc_component_fixup_controls(component);
2167+ if (ret < 0)
2168+ goto probe_end;
2169+ }
21652170 snd_soc_card_fixup_controls(card);
21662171
21672172 ret = snd_card_register(card->snd_card);
sound/soc/sophgo/cv1800b-sound-adc.c+8−2
@@ -251,16 +251,22 @@ static int cv1800b_adc_volume_set(struct snd_kcontrol *kcontrol, · 250 unmodified lines
251251
252252 u32 v_left = clamp_t(u32, ucontrol->value.integer.value[0], 0, 24);
253253 u32 v_right = clamp_t(u32, ucontrol->value.integer.value[1], 0, 24);
254− u32 val;
254+ u32 val, old_val;
255255
256256 val = readl(priv->regs + CV1800B_RXADC_ANA0);
257+ old_val = val;
258+
257259 val = u32_replace_bits(val, cv1800b_gains[v_left],
258260 REG_COMB_LEFT_VOLUME);
259261 val = u32_replace_bits(val, cv1800b_gains[v_right],
260262 REG_COMB_RIGHT_VOLUME);
263+
264+ if (val == old_val)
265+ return 0;
266+
261267 writel(val, priv->regs + CV1800B_RXADC_ANA0);
262268
263− return 0;
269+ return 1;
264270 }
265271
266272 static DECLARE_TLV_DB_SCALE(cv1800b_volume_tlv, 0, 200, 0);
sound/usb/quirks.c+2−0
@@ -2256,6 +2256,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { · 2255 unmodified lines
22562256 DEVICE_FLG(0x046d, 0x0a8f, /* Logitech H390 headset */
22572257 QUIRK_FLAG_CTL_MSG_DELAY_1M |
22582258 QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE),
2259+ DEVICE_FLG(0x046d, 0x0af7, /* Logitech PRO X 2 LIGHTSPEED */
2260+ QUIRK_FLAG_MIXER_GET_CUR_BROKEN),
22592261 DEVICE_FLG(0x0499, 0x1506, /* Yamaha THR5 */
22602262 QUIRK_FLAG_GENERIC_IMPLICIT_FB),
22612263 DEVICE_FLG(0x0499, 0x1509, /* Steinberg UR22 */
tools/arch/s390/include/uapi/asm/kvm.h+1−0
@@ -444,6 +444,7 @@ struct kvm_s390_vm_cpu_machine { · 443 unmodified lines
444444 #define KVM_S390_VM_CPU_FEAT_PFMFI 11
445445 #define KVM_S390_VM_CPU_FEAT_SIGPIF 12
446446 #define KVM_S390_VM_CPU_FEAT_KSS 13
447+#define KVM_S390_VM_CPU_FEAT_ASTFLEIE2 14
447448 struct kvm_s390_vm_cpu_feat {
448449 __u64 feat[16];
449450 };
tools/arch/x86/include/asm/cpufeatures.h+3−0
@@ -379,6 +379,7 @@ · 378 unmodified lines
379379 #define X86_FEATURE_AVIC (15*32+13) /* "avic" Virtual Interrupt Controller */
380380 #define X86_FEATURE_V_VMSAVE_VMLOAD (15*32+15) /* "v_vmsave_vmload" Virtual VMSAVE VMLOAD */
381381 #define X86_FEATURE_VGIF (15*32+16) /* "vgif" Virtual GIF */
382+#define X86_FEATURE_GMET (15*32+17) /* Guest Mode Execution Trap */
382383 #define X86_FEATURE_X2AVIC (15*32+18) /* "x2avic" Virtual x2apic */
383384 #define X86_FEATURE_V_SPEC_CTRL (15*32+20) /* "v_spec_ctrl" Virtual SPEC_CTRL */
384385 #define X86_FEATURE_VNMI (15*32+25) /* "vnmi" Virtual NMI */
@@ -473,6 +474,7 @@ · 88 unmodified lines
473474 #define X86_FEATURE_GP_ON_USER_CPUID (20*32+17) /* User CPUID faulting */
474475
475476 #define X86_FEATURE_PREFETCHI (20*32+20) /* Prefetch Data/Instruction to Cache Level */
477+#define X86_FEATURE_AVX512_BMM (20*32+23) /* AVX512 Bit Matrix Multiply instructions */
476478 #define X86_FEATURE_ERAPS (20*32+24) /* Enhanced Return Address Predictor Security */
477479 #define X86_FEATURE_SBPB (20*32+27) /* Selective Branch Prediction Barrier */
478480 #define X86_FEATURE_IBPB_BRTYPE (20*32+28) /* MSR_PRED_CMD[IBPB] flushes all branch type predictions */
@@ -572,4 +574,5 @@ · 93 unmodified lines
572574 #define X86_BUG_ITS_NATIVE_ONLY X86_BUG( 1*32+ 8) /* "its_native_only" CPU is affected by ITS, VMX is not affected */
573575 #define X86_BUG_TSA X86_BUG( 1*32+ 9) /* "tsa" CPU is affected by Transient Scheduler Attacks */
574576 #define X86_BUG_VMSCAPE X86_BUG( 1*32+10) /* "vmscape" CPU is affected by VMSCAPE attacks from guests */
577+#define X86_BUG_SEAMRET_INVD_VMCS X86_BUG( 1*32+11) /* "seamret_invd_vmcs" SEAMRET from P-SEAMLDR clears the current VMCS */
575578 #endif /* _ASM_X86_CPUFEATURES_H */
tools/arch/x86/include/asm/msr-index.h+11−0
@@ -674,6 +674,9 @@ · 673 unmodified lines
674674 #define MSR_AMD64_DC_CFG 0xc0011022
675675 #define MSR_AMD64_TW_CFG 0xc0011023
676676
677+#define MSR_AMD64_FP_CFG 0xc0011028
678+#define MSR_AMD64_FP_CFG_ZEN1_DENORM_FIX_BIT 9
679+
677680 #define MSR_AMD64_DE_CFG 0xc0011029
678681 #define MSR_AMD64_DE_CFG_LFENCE_SERIALIZE_BIT 1
679682 #define MSR_AMD64_DE_CFG_LFENCE_SERIALIZE BIT_ULL(MSR_AMD64_DE_CFG_LFENCE_SERIALIZE_BIT)
@@ -698,6 +701,8 @@ · 18 unmodified lines
698701 #define MSR_AMD64_IBSBRTARGET 0xc001103b
699702 #define MSR_AMD64_ICIBSEXTDCTL 0xc001103c
700703 #define MSR_AMD64_IBSOPDATA4 0xc001103d
704+#define MSR_AMD64_IBSOPCTL2 0xc001103e
705+#define MSR_AMD64_IBSFETCHCTL2 0xc001103f
701706 #define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */
702707 #define MSR_AMD64_SVM_AVIC_DOORBELL 0xc001011b
703708 #define MSR_AMD64_VM_PAGE_FLUSH 0xc001011e
@@ -765,12 +770,14 @@ · 61 unmodified lines
765770 #define MSR_AMD_CPPC_CAP2 0xc00102b2
766771 #define MSR_AMD_CPPC_REQ 0xc00102b3
767772 #define MSR_AMD_CPPC_STATUS 0xc00102b4
773+#define MSR_AMD_CPPC_REQ2 0xc00102b5
768774
769775 /* Masks for use with MSR_AMD_CPPC_CAP1 */
770776 #define AMD_CPPC_LOWEST_PERF_MASK GENMASK(7, 0)
771777 #define AMD_CPPC_LOWNONLIN_PERF_MASK GENMASK(15, 8)
772778 #define AMD_CPPC_NOMINAL_PERF_MASK GENMASK(23, 16)
773779 #define AMD_CPPC_HIGHEST_PERF_MASK GENMASK(31, 24)
780+#define AMD_CPPC_FLOOR_PERF_CNT_MASK GENMASK_ULL(39, 32)
774781
775782 /* Masks for use with MSR_AMD_CPPC_REQ */
776783 #define AMD_CPPC_MAX_PERF_MASK GENMASK(7, 0)
@@ -778,6 +785,9 @@ · 1 unmodified line
778785 #define AMD_CPPC_DES_PERF_MASK GENMASK(23, 16)
779786 #define AMD_CPPC_EPP_PERF_MASK GENMASK(31, 24)
780787
788+/* Masks for use with MSR_AMD_CPPC_REQ2 */
789+#define AMD_CPPC_FLOOR_PERF_MASK GENMASK(7, 0)
790+
781791 /* AMD Performance Counter Global Status and Control MSRs */
782792 #define MSR_AMD64_PERF_CNTR_GLOBAL_STATUS 0xc0000300
783793 #define MSR_AMD64_PERF_CNTR_GLOBAL_CTL 0xc0000301
@@ -889,6 +899,7 @@ · 105 unmodified lines
889899 #define MSR_K7_HWCR_IRPERF_EN_BIT 30
890900 #define MSR_K7_HWCR_IRPERF_EN BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT)
891901 #define MSR_K7_HWCR_CPUID_USER_DIS_BIT 35
902+#define MSR_K7_HWCR_CPUID_USER_DIS BIT_ULL(MSR_K7_HWCR_CPUID_USER_DIS_BIT)
892903 #define MSR_K7_FID_VID_CTL 0xc0010041
893904 #define MSR_K7_FID_VID_STATUS 0xc0010042
894905 #define MSR_K7_HWCR_CPB_DIS_BIT 25
tools/arch/x86/include/uapi/asm/kvm.h+8−6
@@ -197,13 +197,13 @@ struct kvm_msrs { · 196 unmodified lines
197197 __u32 nmsrs; /* number of msrs in entries */
198198 __u32 pad;
199199
200− struct kvm_msr_entry entries[];
200+ __DECLARE_FLEX_ARRAY(struct kvm_msr_entry, entries);
201201 };
202202
203203 /* for KVM_GET_MSR_INDEX_LIST */
204204 struct kvm_msr_list {
205205 __u32 nmsrs; /* number of msrs in entries */
206− __u32 indices[];
206+ __DECLARE_FLEX_ARRAY(__u32, indices);
207207 };
208208
209209 /* Maximum size of any access bitmap in bytes */
@@ -245,7 +245,7 @@ struct kvm_cpuid_entry { · 35 unmodified lines
245245 struct kvm_cpuid {
246246 __u32 nent;
247247 __u32 padding;
248− struct kvm_cpuid_entry entries[];
248+ __DECLARE_FLEX_ARRAY(struct kvm_cpuid_entry, entries);
249249 };
250250
251251 struct kvm_cpuid_entry2 {
@@ -267,7 +267,7 @@ struct kvm_cpuid_entry2 { · 15 unmodified lines
267267 struct kvm_cpuid2 {
268268 __u32 nent;
269269 __u32 padding;
270− struct kvm_cpuid_entry2 entries[];
270+ __DECLARE_FLEX_ARRAY(struct kvm_cpuid_entry2, entries);
271271 };
272272
273273 /* for KVM_GET_PIT and KVM_SET_PIT */
@@ -398,7 +398,7 @@ struct kvm_xsave { · 124 unmodified lines
398398 * the contents of CPUID leaf 0xD on the host.
399399 */
400400 __u32 region[1024];
401− __u32 extra[];
401+ __DECLARE_FLEX_ARRAY(__u32, extra);
402402 };
403403
404404 #define KVM_MAX_XCRS 16
@@ -477,6 +477,7 @@ struct kvm_sync_regs { · 72 unmodified lines
477477 #define KVM_X86_QUIRK_STUFF_FEATURE_MSRS (1 << 8)
478478 #define KVM_X86_QUIRK_IGNORE_GUEST_PAT (1 << 9)
479479 #define KVM_X86_QUIRK_VMCS12_ALLOW_FREEZE_IN_SMM (1 << 10)
480+#define KVM_X86_QUIRK_NESTED_SVM_SHARED_PAT (1 << 11)
480481
481482 #define KVM_STATE_NESTED_FORMAT_VMX 0
482483 #define KVM_STATE_NESTED_FORMAT_SVM 1
@@ -532,6 +533,7 @@ struct kvm_svm_nested_state_data { · 49 unmodified lines
532533
533534 struct kvm_svm_nested_state_hdr {
534535 __u64 vmcb_pa;
536+ __u64 gpat;
535537 };
536538
537539 /* for KVM_CAP_NESTED_STATE */
@@ -566,7 +568,7 @@ struct kvm_pmu_event_filter { · 28 unmodified lines
566568 __u32 fixed_counter_bitmap;
567569 __u32 flags;
568570 __u32 pad[4];
569− __u64 events[];
571+ __DECLARE_FLEX_ARRAY(__u64, events);
570572 };
571573
572574 #define KVM_PMU_EVENT_ALLOW 0
tools/arch/x86/include/uapi/asm/svm.h+16−16
@@ -103,38 +103,38 @@ · 102 unmodified lines
103103 #define SVM_EXIT_VMGEXIT 0x403
104104
105105 /* SEV-ES software-defined VMGEXIT events */
106−#define SVM_VMGEXIT_MMIO_READ 0x80000001
107−#define SVM_VMGEXIT_MMIO_WRITE 0x80000002
108−#define SVM_VMGEXIT_NMI_COMPLETE 0x80000003
109−#define SVM_VMGEXIT_AP_HLT_LOOP 0x80000004
110−#define SVM_VMGEXIT_AP_JUMP_TABLE 0x80000005
106+#define SVM_VMGEXIT_MMIO_READ 0x80000001ull
107+#define SVM_VMGEXIT_MMIO_WRITE 0x80000002ull
108+#define SVM_VMGEXIT_NMI_COMPLETE 0x80000003ull
109+#define SVM_VMGEXIT_AP_HLT_LOOP 0x80000004ull
110+#define SVM_VMGEXIT_AP_JUMP_TABLE 0x80000005ull
111111 #define SVM_VMGEXIT_SET_AP_JUMP_TABLE 0
112112 #define SVM_VMGEXIT_GET_AP_JUMP_TABLE 1
113−#define SVM_VMGEXIT_PSC 0x80000010
114−#define SVM_VMGEXIT_GUEST_REQUEST 0x80000011
115−#define SVM_VMGEXIT_EXT_GUEST_REQUEST 0x80000012
116−#define SVM_VMGEXIT_AP_CREATION 0x80000013
113+#define SVM_VMGEXIT_PSC 0x80000010ull
114+#define SVM_VMGEXIT_GUEST_REQUEST 0x80000011ull
115+#define SVM_VMGEXIT_EXT_GUEST_REQUEST 0x80000012ull
116+#define SVM_VMGEXIT_AP_CREATION 0x80000013ull
117117 #define SVM_VMGEXIT_AP_CREATE_ON_INIT 0
118118 #define SVM_VMGEXIT_AP_CREATE 1
119119 #define SVM_VMGEXIT_AP_DESTROY 2
120−#define SVM_VMGEXIT_SNP_RUN_VMPL 0x80000018
121−#define SVM_VMGEXIT_SAVIC 0x8000001a
120+#define SVM_VMGEXIT_SNP_RUN_VMPL 0x80000018ull
121+#define SVM_VMGEXIT_SAVIC 0x8000001aull
122122 #define SVM_VMGEXIT_SAVIC_REGISTER_GPA 0
123123 #define SVM_VMGEXIT_SAVIC_UNREGISTER_GPA 1
124124 #define SVM_VMGEXIT_SAVIC_SELF_GPA ~0ULL
125−#define SVM_VMGEXIT_HV_FEATURES 0x8000fffd
126−#define SVM_VMGEXIT_TERM_REQUEST 0x8000fffe
125+#define SVM_VMGEXIT_HV_FEATURES 0x8000fffdull
126+#define SVM_VMGEXIT_TERM_REQUEST 0x8000fffeull
127127 #define SVM_VMGEXIT_TERM_REASON(reason_set, reason_code) \
128128 /* SW_EXITINFO1[3:0] */ \
129129 (((((u64)reason_set) & 0xf)) | \
130130 /* SW_EXITINFO1[11:4] */ \
131131 ((((u64)reason_code) & 0xff) << 4))
132−#define SVM_VMGEXIT_UNSUPPORTED_EVENT 0x8000ffff
132+#define SVM_VMGEXIT_UNSUPPORTED_EVENT 0x8000ffffull
133133
134134 /* Exit code reserved for hypervisor/software use */
135−#define SVM_EXIT_SW 0xf0000000
135+#define SVM_EXIT_SW 0xf0000000ull
136136
137−#define SVM_EXIT_ERR -1
137+#define SVM_EXIT_ERR -1ull
138138
139139 #define SVM_EXIT_REASONS \
140140 { SVM_EXIT_READ_CR0, "read_cr0" }, \
tools/include/linux/gfp_types.h+8−8
@@ -273,17 +273,17 @@ enum { · 272 unmodified lines
273273 *
274274 * %__GFP_ZERO returns a zeroed page on success.
275275 *
276− * %__GFP_ZEROTAGS zeroes memory tags at allocation time if the memory itself
277− * is being zeroed (either via __GFP_ZERO or via init_on_alloc, provided that
278− * __GFP_SKIP_ZERO is not set). This flag is intended for optimization: setting
279− * memory tags at the same time as zeroing memory has minimal additional
280− * performance impact.
276+ * %__GFP_ZEROTAGS zeroes memory tags at allocation time. Setting memory tags at
277+ * the same time as zeroing memory (e.g., with __GFP_ZERO) has minimal
278+ * additional performance impact. However, __GFP_ZEROTAGS also zeroes the tags
279+ * even if memory is not getting zeroed at allocation time (e.g.,
280+ * with init_on_free).
281281 *
282282 * %__GFP_SKIP_KASAN makes KASAN skip unpoisoning on page allocation.
283283 * Used for userspace and vmalloc pages; the latter are unpoisoned by
284− * kasan_unpoison_vmalloc instead. For userspace pages, results in
285− * poisoning being skipped as well, see should_skip_kasan_poison for
286− * details. Only effective in HW_TAGS mode.
284+ * kasan_unpoison_vmalloc instead. If passed to vmalloc, kasan_unpoison_vmalloc
285+ * is skipped too. For userspace pages, results in poisoning being skipped as
286+ * well, see should_skip_kasan_poison for details. Only effective in HW_TAGS mode.
287287 */
288288 #define __GFP_NOWARN ((__force gfp_t)___GFP_NOWARN)
289289 #define __GFP_COMP ((__force gfp_t)___GFP_COMP)
tools/include/uapi/linux/const.h+18−0
@@ -50,4 +50,22 @@ · 49 unmodified lines
5050
5151 #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
5252
53+/*
54+ * Divide positive or negative dividend by positive or negative divisor
55+ * and round to closest integer. Result is undefined for negative
56+ * divisors if the dividend variable type is unsigned and for negative
57+ * dividends if the divisor variable type is unsigned.
58+ */
59+#define __KERNEL_DIV_ROUND_CLOSEST(x, divisor) \
60+({ \
61+ __typeof__(x) __x = x; \
62+ __typeof__(divisor) __d = divisor; \
63+ \
64+ (((__typeof__(x))-1) > 0 || \
65+ ((__typeof__(divisor))-1) > 0 || \
66+ (((__x) > 0) == ((__d) > 0))) ? \
67+ (((__x) + ((__d) / 2)) / (__d)) : \
68+ (((__x) - ((__d) / 2)) / (__d)); \
69+})
70+
5371 #endif /* _UAPI_LINUX_CONST_H */
tools/include/uapi/linux/kvm.h+15−5
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/const.h>
1212 #include <linux/types.h>
1313 #include <linux/compiler.h>
14+#include <linux/stddef.h>
1415 #include <linux/ioctl.h>
1516 #include <asm/kvm.h>
1617
@@ -542,7 +543,7 @@ struct kvm_coalesced_mmio { · 525 unmodified lines
542543
543544 struct kvm_coalesced_mmio_ring {
544545 __u32 first, last;
545− struct kvm_coalesced_mmio coalesced_mmio[];
546+ __DECLARE_FLEX_ARRAY(struct kvm_coalesced_mmio, coalesced_mmio);
546547 };
547548
548549 #define KVM_COALESCED_MMIO_MAX \
@@ -592,7 +593,7 @@ struct kvm_clear_dirty_log { · 43 unmodified lines
592593 /* for KVM_SET_SIGNAL_MASK */
593594 struct kvm_signal_mask {
594595 __u32 len;
595− __u8 sigset[];
596+ __DECLARE_FLEX_ARRAY(__u8, sigset);
596597 };
597598
598599 /* for KVM_TPR_ACCESS_REPORTING */
@@ -703,6 +704,11 @@ struct kvm_enable_cap { · 104 unmodified lines
703704 #define KVM_VM_TYPE_ARM_IPA_SIZE_MASK 0xffULL
704705 #define KVM_VM_TYPE_ARM_IPA_SIZE(x) \
705706 ((x) & KVM_VM_TYPE_ARM_IPA_SIZE_MASK)
707+
708+#define KVM_VM_TYPE_ARM_PROTECTED (1UL << 31)
709+#define KVM_VM_TYPE_ARM_MASK (KVM_VM_TYPE_ARM_IPA_SIZE_MASK | \
710+ KVM_VM_TYPE_ARM_PROTECTED)
711+
706712 /*
707713 * ioctls for /dev/kvm fds:
708714 */
@@ -989,6 +995,8 @@ struct kvm_enable_cap { · 280 unmodified lines
989995 #define KVM_CAP_ARM_SEA_TO_USER 245
990996 #define KVM_CAP_S390_USER_OPEREXEC 246
991997 #define KVM_CAP_S390_KEYOP 247
998+#define KVM_CAP_S390_VSIE_ESAMODE 248
999+#define KVM_CAP_S390_HPAGE_2G 249
9921000
9931001 struct kvm_irq_routing_irqchip {
9941002 __u32 irqchip;
@@ -1051,7 +1059,7 @@ struct kvm_irq_routing_entry { · 56 unmodified lines
10511059 struct kvm_irq_routing {
10521060 __u32 nr;
10531061 __u32 flags;
1054− struct kvm_irq_routing_entry entries[];
1062+ __DECLARE_FLEX_ARRAY(struct kvm_irq_routing_entry, entries);
10551063 };
10561064
10571065 #define KVM_IRQFD_FLAG_DEASSIGN (1 << 0)
@@ -1142,7 +1150,7 @@ struct kvm_dirty_tlb { · 84 unmodified lines
11421150
11431151 struct kvm_reg_list {
11441152 __u64 n; /* number of regs */
1145− __u64 reg[];
1153+ __DECLARE_FLEX_ARRAY(__u64, reg);
11461154 };
11471155
11481156 struct kvm_one_reg {
@@ -1224,6 +1232,8 @@ enum kvm_device_type { · 75 unmodified lines
12241232 #define KVM_DEV_TYPE_LOONGARCH_EIOINTC KVM_DEV_TYPE_LOONGARCH_EIOINTC
12251233 KVM_DEV_TYPE_LOONGARCH_PCHPIC,
12261234 #define KVM_DEV_TYPE_LOONGARCH_PCHPIC KVM_DEV_TYPE_LOONGARCH_PCHPIC
1235+ KVM_DEV_TYPE_LOONGARCH_DMSINTC,
1236+#define KVM_DEV_TYPE_LOONGARCH_DMSINTC KVM_DEV_TYPE_LOONGARCH_DMSINTC
12271237 KVM_DEV_TYPE_ARM_VGIC_V5,
12281238 #define KVM_DEV_TYPE_ARM_VGIC_V5 KVM_DEV_TYPE_ARM_VGIC_V5
12291239
@@ -1610,7 +1620,7 @@ struct kvm_stats_desc { · 380 unmodified lines
16101620 #ifdef __KERNEL__
16111621 char name[KVM_STATS_NAME_SIZE];
16121622 #else
1613− char name[];
1623+ __DECLARE_FLEX_ARRAY(char, name);
16141624 #endif
16151625 };
16161626
tools/include/uapi/linux/rtnetlink.h+1−0
@@ -840,6 +840,7 @@ enum { · 839 unmodified lines
840840 #define RTEXT_FILTER_CFM_CONFIG (1 << 5)
841841 #define RTEXT_FILTER_CFM_STATUS (1 << 6)
842842 #define RTEXT_FILTER_MST (1 << 7)
843+#define RTEXT_FILTER_NAME_ONLY (1 << 8)
843844
844845 /* End of information exported to user level */
845846
tools/objtool/check.c+1−0
@@ -206,6 +206,7 @@ static bool is_rust_noreturn(const struct symbol *func) · 205 unmodified lines
206206 str_ends_with(func->name, "_4core9panicking18panic_nounwind_fmt") ||
207207 str_ends_with(func->name, "_4core9panicking19assert_failed_inner") ||
208208 str_ends_with(func->name, "_4core9panicking30panic_null_pointer_dereference") ||
209+ str_ends_with(func->name, "_4core9panicking32panic_null_reference_constructed") ||
209210 str_ends_with(func->name, "_4core9panicking36panic_misaligned_pointer_dereference") ||
210211 str_ends_with(func->name, "_7___rustc17rust_begin_unwind") ||
211212 strstr(func->name, "_4core9panicking13assert_failed") ||
tools/perf/bench/bpf_skel/.gitignore+4−0
@@ -0,0 +1,4 @@
1+# SPDX-License-Identifier: GPL-2.0-only
2+.tmp
3+*.skel.h
4+vmlinux.h
tools/perf/trace/beauty/include/linux/socket.h+1−1
@@ -356,7 +356,7 @@ struct ucred { · 355 unmodified lines
356356
357357 /* Flags to be cleared on entry by sendmsg and sendmmsg syscalls */
358358 #define MSG_INTERNAL_SENDMSG_FLAGS \
359− (MSG_SPLICE_PAGES | MSG_SENDPAGE_NOPOLICY | MSG_SENDPAGE_DECRYPTED)
359+ (MSG_SPLICE_PAGES | MSG_SENDPAGE_NOPOLICY | MSG_SENDPAGE_DECRYPTED | MSG_NO_SHARED_FRAGS)
360360
361361 /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
362362 #define SOL_IP 0
tools/perf/trace/beauty/include/uapi/drm/drm.h+8−19
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: MIT */
12 /*
23 * Header for the Direct Rendering Manager
34 *
@@ -11,25 +12,6 @@ · 7 unmodified lines
1112 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
1213 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
1314 * All rights reserved.
14− *
15− * Permission is hereby granted, free of charge, to any person obtaining a
16− * copy of this software and associated documentation files (the "Software"),
17− * to deal in the Software without restriction, including without limitation
18− * the rights to use, copy, modify, merge, publish, distribute, sublicense,
19− * and/or sell copies of the Software, and to permit persons to whom the
20− * Software is furnished to do so, subject to the following conditions:
21− *
22− * The above copyright notice and this permission notice (including the next
23− * paragraph) shall be included in all copies or substantial portions of the
24− * Software.
25− *
26− * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27− * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28− * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
29− * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
30− * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31− * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
32− * OTHER DEALINGS IN THE SOFTWARE.
3315 */
3416
3517 #ifndef _DRM_H_
@@ -1323,6 +1305,13 @@ extern "C" { · 1287 unmodified lines
13231305 */
13241306 #define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
13251307
1308+/**
1309+ * DRM_IOCTL_SYNCOBJ_EVENTFD - Register an eventfd to be signalled by a syncobj.
1310+ *
1311+ * This can be used to integrate a syncobj in an event loop.
1312+ *
1313+ * The IOCTL argument is a struct drm_syncobj_eventfd.
1314+ */
13261315 #define DRM_IOCTL_SYNCOBJ_EVENTFD DRM_IOWR(0xCF, struct drm_syncobj_eventfd)
13271316
13281317 /**
tools/perf/trace/beauty/include/uapi/linux/fs.h+10−1
@@ -395,7 +395,16 @@ struct file_attr { · 394 unmodified lines
395395 #define FS_DAX_FL 0x02000000 /* Inode is DAX */
396396 #define FS_INLINE_DATA_FL 0x10000000 /* Reserved for ext4 */
397397 #define FS_PROJINHERIT_FL 0x20000000 /* Create with parents projid */
398−#define FS_CASEFOLD_FL 0x40000000 /* Folder is case insensitive */
398+/*
399+ * FS_CASEFOLD_FL indicates case-insensitive name lookup. The
400+ * bit is most often reported on directories, where it controls
401+ * lookups of entries within. Filesystems that derive
402+ * case-insensitivity from mount or volume state may also report
403+ * it on non-directory inodes; userspace must not assume the bit
404+ * is directory-only. FS_XFLAG_CASEFOLD reports the same
405+ * information read-only via FS_IOC_FSGETXATTR.
406+ */
407+#define FS_CASEFOLD_FL 0x40000000
399408 #define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
400409
401410 #define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
tools/testing/selftests/bpf/config+1−0
@@ -82,6 +82,7 @@ CONFIG_NET_SCH_BPF=y · 81 unmodified lines
8282 CONFIG_NET_SCH_FQ=y
8383 CONFIG_NET_SCH_INGRESS=y
8484 CONFIG_NET_SCH_HTB=y
85+CONFIG_NET_SCH_RED=y
8586 CONFIG_NET_SCHED=y
8687 CONFIG_NETDEVSIM=y
8788 CONFIG_NETFILTER=y
tools/testing/selftests/bpf/prog_tests/tc_qevent.c+113−0
@@ -0,0 +1,113 @@
1+// SPDX-License-Identifier: GPL-2.0
2+
3+#include <test_progs.h>
4+#include <network_helpers.h>
5+#include <sys/socket.h>
6+#include <netinet/in.h>
7+#include <arpa/inet.h>
8+#include <unistd.h>
9+#include <string.h>
10+
11+#include "test_tc_qevent.skel.h"
12+
13+#define NS_TX "tc_qevent_tx"
14+#define NS_RX "tc_qevent_rx"
15+#define IP_TX "10.255.0.1"
16+#define IP_RX "10.255.0.2"
17+#define PIN_PATH "/sys/fs/bpf/tc_qevent_redirect"
18+
19+static void blast_udp(void)
20+{
21+ struct sockaddr_in dst = {};
22+ char buf[1400] = {};
23+ int fd, i;
24+
25+ fd = socket(AF_INET, SOCK_DGRAM, 0);
26+ if (!ASSERT_GE(fd, 0, "udp socket"))
27+ return;
28+
29+ dst.sin_family = AF_INET;
30+ dst.sin_port = htons(12345);
31+ inet_pton(AF_INET, IP_RX, &dst.sin_addr);
32+
33+ /*
34+ * Push far more than the RED queue can hold. Once qavg crosses qth_min
35+ * every further packet hits the congestion_drop / early_drop qevent.
36+ */
37+ for (i = 0; i < 50000; i++)
38+ sendto(fd, buf, sizeof(buf), MSG_DONTWAIT,
39+ (struct sockaddr *)&dst, sizeof(dst));
40+
41+ close(fd);
42+}
43+
44+static void run_qevent_redirect(struct bpf_program *prog, __u64 *counter)
45+{
46+ struct nstoken *tok = NULL;
47+ int err;
48+
49+ SYS_NOFAIL("ip netns del %s", NS_TX);
50+ SYS_NOFAIL("ip netns del %s", NS_RX);
51+ unlink(PIN_PATH);
52+
53+ err = bpf_program__pin(prog, PIN_PATH);
54+ if (!ASSERT_OK(err, "pin prog"))
55+ return;
56+
57+ SYS(unpin, "ip netns add %s", NS_TX);
58+ SYS(del_tx, "ip netns add %s", NS_RX);
59+ SYS(del_rx, "ip -n %s link add veth0 type veth peer name veth1 netns %s", NS_TX, NS_RX);
60+ SYS(del_rx, "ip -n %s addr add %s/24 dev veth0", NS_TX, IP_TX);
61+ SYS(del_rx, "ip -n %s link set veth0 up", NS_TX);
62+ SYS(del_rx, "ip -n %s addr add %s/24 dev veth1", NS_RX, IP_RX);
63+ SYS(del_rx, "ip -n %s link set veth1 up", NS_RX);
64+
65+ tok = open_netns(NS_TX);
66+ if (!ASSERT_OK_PTR(tok, "open_netns"))
67+ goto del_rx;
68+
69+ SYS(close_ns, "tc qdisc add dev veth0 root handle 1: htb default 1");
70+ SYS(close_ns, "tc class add dev veth0 parent 1: classid 1:1 htb rate 1mbit ceil 1mbit");
71+
72+ if (system("tc qdisc add dev veth0 parent 1:1 handle 11: red "
73+ "limit 500000 avpkt 1000 probability 1 min 5000 max 6000 "
74+ "burst 6 qevent early_drop block 10 2>/dev/null")) {
75+ test__skip();
76+ goto close_ns;
77+ }
78+
79+ if (system("tc filter add block 10 bpf da object-pinned "
80+ PIN_PATH " 2>/dev/null")) {
81+ test__skip();
82+ goto close_ns;
83+ }
84+
85+ blast_udp();
86+ ASSERT_GT(*counter, 0, "qevent classifier ran");
87+close_ns:
88+ close_netns(tok);
89+del_rx:
90+ SYS_NOFAIL("ip netns del %s", NS_RX);
91+del_tx:
92+ SYS_NOFAIL("ip netns del %s", NS_TX);
93+unpin:
94+ bpf_program__unpin(prog, PIN_PATH);
95+}
96+
97+void test_tc_qevent(void)
98+{
99+ struct test_tc_qevent *skel;
100+
101+ skel = test_tc_qevent__open_and_load();
102+ if (!ASSERT_OK_PTR(skel, "open_and_load"))
103+ return;
104+
105+ if (test__start_subtest("redirect_verdict"))
106+ run_qevent_redirect(skel->progs.qevent_redirect_verdict,
107+ &skel->bss->verdict_calls);
108+ if (test__start_subtest("redirect_helper"))
109+ run_qevent_redirect(skel->progs.qevent_redirect_helper,
110+ &skel->bss->helper_calls);
111+
112+ test_tc_qevent__destroy(skel);
113+}
tools/testing/selftests/bpf/progs/test_tc_qevent.c+23−0
@@ -0,0 +1,23 @@
1+// SPDX-License-Identifier: GPL-2.0
2+#include "vmlinux.h"
3+#include <bpf/bpf_helpers.h>
4+
5+int redirect_ifindex = 1;
6+__u64 verdict_calls = 0;
7+__u64 helper_calls = 0;
8+
9+SEC("tc")
10+int qevent_redirect_verdict(struct __sk_buff *skb)
11+{
12+ __sync_fetch_and_add(&verdict_calls, 1);
13+ return TCX_REDIRECT;
14+}
15+
16+SEC("tc")
17+int qevent_redirect_helper(struct __sk_buff *skb)
18+{
19+ __sync_fetch_and_add(&helper_calls, 1);
20+ return bpf_redirect(redirect_ifindex, 0);
21+}
22+
23+char _license[] SEC("license") = "GPL";
tools/testing/selftests/bpf/progs/verifier_global_subprogs.c+10−0
@@ -185,6 +185,16 @@ int arg_tag_nonnull_ptr_good(void *ctx) · 184 unmodified lines
185185 return subprog_nonnull_ptr_good(&x, &y);
186186 }
187187
188+SEC("?raw_tp")
189+__failure __log_level(2)
190+__msg("R1 is expected to be non-NULL")
191+int arg_tag_nonnull_ptr_null_bad(void *ctx)
192+{
193+ int y = 74;
194+
195+ return subprog_nonnull_ptr_good(NULL, &y);
196+}
197+
188198 /* this global subprog can be now called from many types of entry progs, each
189199 * with different context type
190200 */
tools/testing/selftests/drivers/net/config+3−0
@@ -4,6 +4,8 @@ CONFIG_DEBUG_INFO_BTF_MODULES=n · 3 unmodified lines
44 CONFIG_INET_PSP=y
55 CONFIG_IPV6=y
66 CONFIG_MACSEC=m
7+CONFIG_NET_CLS_ACT=y
8+CONFIG_NET_CLS_BPF=y
79 CONFIG_NETCONSOLE=m
810 CONFIG_NETCONSOLE_DYNAMIC=y
911 CONFIG_NETCONSOLE_EXTENDED_LOG=y
@@ -11,6 +13,7 @@ CONFIG_NETDEVSIM=m · 1 unmodified line

7 more lines aren’t shown here.

tools/testing/selftests/drivers/net/netconsole/netcons_cmdline.sh+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/drivers/net/netconsole/netcons_fragmented_msg.sh+2−2

This diff is large: its 17 lines aren’t shown here.

tools/testing/selftests/drivers/net/netconsole/netcons_resume.sh+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/drivers/net/netconsole/netcons_sysdata.sh+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/drivers/net/settings+1−0

This diff is large: its 2 lines aren’t shown here.

tools/testing/selftests/drivers/ntsync/config+1−1

This diff is large: its 3 lines aren’t shown here.

tools/testing/selftests/filesystems/fuse/Makefile+10−0

This diff is large: its 21 lines aren’t shown here.

tools/testing/selftests/filesystems/fuse/fuse_acl_cache_test.c+347−0

This diff is large: its 348 lines aren’t shown here.

tools/testing/selftests/ftrace/ftracetest+1−0

This diff is large: its 8 lines aren’t shown here.

tools/testing/selftests/kvm/x86/sev_init2_tests.c+11−5

This diff is large: its 24 lines aren’t shown here.

tools/testing/selftests/kvm/x86/sev_smoke_test.c+8−1

This diff is large: its 16 lines aren’t shown here.

tools/testing/selftests/net/af_unix/config+1−0

This diff is large: its 5 lines aren’t shown here.

tools/testing/selftests/net/bridge_vlan_dump.sh+23−0

This diff is large: its 37 lines aren’t shown here.

tools/testing/selftests/net/mptcp/userspace_pm.sh+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/net/openvswitch/config+16−0

This diff is large: its 17 lines aren’t shown here.

tools/testing/selftests/net/ovpn/config+2−0

This diff is large: its 13 lines aren’t shown here.

tools/testing/selftests/net/ovpn/ovpn-cli.c+3−1

This diff is large: its 18 lines aren’t shown here.

tools/testing/selftests/net/ovpn/settings+1−0

This diff is large: its 2 lines aren’t shown here.

tools/testing/selftests/net/packetdrill/tcp_rfc5961_rst-syn-recv.pkt+61−0

This diff is large: its 62 lines aren’t shown here.

tools/testing/selftests/net/tun.c+4−4

This diff is large: its 24 lines aren’t shown here.

tools/testing/selftests/pidfd/pidfd_file_handle_test.c+1−0

This diff is large: its 8 lines aren’t shown here.

tools/testing/vsock/vsock_test.c+87−0

This diff is large: its 101 lines aren’t shown here.

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