History

Merge 4.19-rc7 into char-misc-next

We want the fixes in here as well.

Greg Kroah-Hartman committed 8 years ago

Commit ba1cb312 parents 8f523d6 0238df6314 files · +2759 −1789Browse files

Unified · Split

314 files
  1. Documentation/driver-api/fpga/fpga-mgr.rst +5 −0
  2. Documentation/fb/uvesafb.txt +3 −2
  3. Documentation/networking/ip-sysctl.txt +1 −1
  4. MAINTAINERS +6 −8
  5. Makefile +1 −1
  6. arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts +2 −0
  7. arch/arm/boot/dts/bcm63138.dtsi +8 −6
  8. arch/arm/boot/dts/stm32mp157c.dtsi +2 −2
  9. arch/arm/boot/dts/sun8i-r40.dtsi +1 −2
  10. arch/arm/mm/ioremap.c +1 −1
  11. arch/arm/tools/syscall.tbl +1 −0
  12. arch/arm64/kvm/guest.c +54 −1
  13. arch/arm64/mm/hugetlbpage.c +43 −7
  14. arch/powerpc/kernel/process.c +10 −0
  15. arch/powerpc/kvm/book3s_64_mmu_radix.c +10 −0
  16. arch/powerpc/lib/code-patching.c +12 −8
  17. arch/powerpc/mm/numa.c +3 −2
  18. arch/riscv/kernel/setup.c +1 −1
  19. arch/x86/entry/vdso/Makefile +14 −2
  20. arch/x86/entry/vdso/vclock_gettime.c +14 −12
  21. arch/x86/events/amd/uncore.c +10 −0
  22. arch/x86/events/intel/uncore_snbep.c +7 −7
  23. arch/x86/include/asm/perf_event.h +8 −0
  24. arch/x86/include/asm/uv/uv.h +6 −0
  25. arch/x86/kernel/cpu/amd.c +1 −1
  26. arch/x86/kernel/tsc.c +4 −0
  27. arch/x86/kvm/mmu.c +20 −4
  28. arch/x86/kvm/vmx.c +76 −61
  29. arch/x86/kvm/x86.c +1 −1
  30. drivers/base/firmware_loader/main.c +5 −2
  31. drivers/base/power/main.c +4 −1
  32. drivers/crypto/caam/caamalg.c +4 −4
  33. drivers/crypto/chelsio/chcr_algo.c +22 −10
  34. drivers/crypto/chelsio/chcr_crypto.h +2 −0
  35. drivers/crypto/mxs-dcp.c +30 −23
  36. drivers/crypto/qat/qat_c3xxx/adf_drv.c +3 −3
  37. drivers/crypto/qat/qat_c3xxxvf/adf_drv.c +3 −3
  38. drivers/crypto/qat/qat_c62x/adf_drv.c +3 −3
  39. drivers/crypto/qat/qat_c62xvf/adf_drv.c +3 −3
  40. drivers/crypto/qat/qat_dh895xcc/adf_drv.c +3 −3
  41. drivers/crypto/qat/qat_dh895xccvf/adf_drv.c +3 −3
  42. drivers/fpga/dfl-fme-region.c +3 −1
  43. drivers/fpga/fpga-bridge.c +1 −1
  44. drivers/fpga/of-fpga-region.c +2 −1
  45. drivers/gpio/gpiolib.c +1 −1
  46. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +29 −8
  47. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +8 −2
  48. drivers/gpu/drm/drm_client.c +26 −9
  49. drivers/gpu/drm/drm_fb_cma_helper.c +3 −1
  50. drivers/gpu/drm/drm_fb_helper.c +3 −1
  51. drivers/gpu/drm/drm_lease.c +3 −3
  52. drivers/gpu/drm/exynos/exynos_drm_iommu.h +6 −28
  53. drivers/gpu/drm/i2c/tda9950.c +3 −2
  54. drivers/gpu/drm/i915/i915_gpu_error.c +63 −25
  55. drivers/gpu/drm/i915/i915_gpu_error.h +1 −0
  56. drivers/gpu/drm/i915/i915_irq.c +12 −21
  57. drivers/gpu/drm/i915/i915_pci.c +0 −1
  58. drivers/hid/hid-ids.h +0 −1
  59. drivers/hid/i2c-hid/i2c-hid.c +10 −17
  60. drivers/hid/intel-ish-hid/ipc/hw-ish.h +1 −0
  61. drivers/hid/intel-ish-hid/ipc/pci-ish.c +1 −0
  62. drivers/hv/connection.c +5 −3
  63. drivers/i2c/busses/i2c-designware-master.c +3 −1
  64. drivers/i2c/busses/i2c-isch.c +1 −1
  65. drivers/i2c/busses/i2c-qcom-geni.c +18 −4
  66. drivers/i2c/busses/i2c-scmi.c +1 −0
  67. drivers/iommu/amd_iommu.c +1 −1
  68. drivers/md/dm-cache-metadata.c +2 −2
  69. drivers/md/dm-cache-target.c +7 −2
  70. drivers/md/dm-mpath.c +8 −6
  71. drivers/md/dm-raid.c +1 −1
  72. drivers/md/dm-thin-metadata.c +2 −4
  73. drivers/media/v4l2-core/v4l2-event.c +20 −18
  74. drivers/media/v4l2-core/v4l2-fh.c +2 −0
  75. drivers/mmc/core/host.c +1 −1
  76. drivers/mmc/core/slot-gpio.c +1 −1
  77. drivers/mmc/host/renesas_sdhi_sys_dmac.c +2 −1
  78. drivers/net/bonding/bond_main.c +37 −28
  79. drivers/net/dsa/b53/b53_common.c +2 −2
  80. drivers/net/ethernet/amazon/ena/ena_netdev.c +0 −22
  81. drivers/net/ethernet/amd/declance.c +6 −4
  82. drivers/net/ethernet/broadcom/bcmsysport.c +11 −17
  83. drivers/net/ethernet/broadcom/bnxt/bnxt.c +18 −9
  84. drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c +3 −3
  85. drivers/net/ethernet/cadence/macb_main.c +1 −0
  86. drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +17 −0
  87. drivers/net/ethernet/emulex/benet/be_main.c +1 −4
  88. drivers/net/ethernet/freescale/fec_main.c +4 −4
  89. drivers/net/ethernet/hisilicon/hns/hnae.c +1 −1
  90. drivers/net/ethernet/hisilicon/hns/hns_enet.c +19 −29
  91. drivers/net/ethernet/huawei/hinic/hinic_main.c +0 −20
  92. drivers/net/ethernet/ibm/ehea/ehea_main.c +0 −14
  93. drivers/net/ethernet/ibm/ibmvnic.c +0 −16
  94. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +7 −5
  95. drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +5 −4
  96. drivers/net/ethernet/mellanox/mlx5/core/en.h +1 −0
  97. drivers/net/ethernet/mellanox/mlx5/core/en/fs.h +2 −0
  98. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 −1
  99. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +64 −1
  100. drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +2 −2
  101. drivers/net/ethernet/mellanox/mlx5/core/transobj.c +4 −1
  102. drivers/net/ethernet/mellanox/mlxsw/pci.c +7 −4
  103. drivers/net/ethernet/mellanox/mlxsw/spectrum.c +2 −0
  104. drivers/net/ethernet/netronome/nfp/nfp_net_common.c +12 −5
  105. drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +0 −23
  106. drivers/net/ethernet/qlogic/qed/qed_hsi.h +1 −0
  107. drivers/net/ethernet/qlogic/qed/qed_iwarp.c +2 −2
  108. drivers/net/ethernet/qlogic/qed/qed_rdma.c +1 −1
  109. drivers/net/ethernet/qlogic/qed/qed_roce.c +4 −11
  110. drivers/net/ethernet/qlogic/qed/qed_sp_commands.c +1 −1
  111. drivers/net/ethernet/qlogic/qed/qed_vf.c +2 −3
  112. drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +5 −3
  113. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +2 −1
  114. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h +2 −1
  115. drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h +2 −1
  116. drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +6 −6
  117. drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +0 −45
  118. drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c +5 −2
  119. drivers/net/ethernet/realtek/r8169.c +16 −16
  120. drivers/net/ethernet/sfc/efx.c +0 −26
  121. drivers/net/ethernet/sfc/falcon/efx.c +0 −26
  122. drivers/net/hamradio/yam.c +4 −0
  123. drivers/net/ieee802154/adf7242.c +1 −2
  124. drivers/net/ieee802154/ca8210.c +2 −4
  125. drivers/net/ieee802154/mcr20a.c +4 −4
  126. drivers/net/phy/phy_device.c +9 −3
  127. drivers/net/phy/phylink.c +28 −20
  128. drivers/net/phy/sfp.c +5 −2
  129. drivers/net/team/team.c +6 −0
  130. drivers/net/tun.c +21 −16
  131. drivers/net/usb/asix_common.c +3 −0
  132. drivers/net/usb/ax88179_178a.c +3 −0
  133. drivers/net/usb/lan78xx.c +4 −13
  134. drivers/net/usb/r8152.c +3 −0
  135. drivers/net/usb/smsc75xx.c +4 −0
  136. drivers/net/usb/smsc95xx.c +3 −0
  137. drivers/net/usb/sr9800.c +3 −0
  138. drivers/net/virtio_net.c +0 −14
  139. drivers/net/vxlan.c +3 −0
  140. drivers/net/wimax/i2400m/control.c +1 −1
  141. drivers/net/wireless/broadcom/b43/dma.c +4 −2
  142. drivers/net/wireless/intel/iwlwifi/cfg/1000.c +1 −0
  143. drivers/net/wireless/mac80211_hwsim.c +17 −19
  144. drivers/net/wireless/mediatek/mt76/mt76x0/main.c +1 −2
  145. drivers/net/xen-netback/common.h +2 −1
  146. drivers/net/xen-netback/hash.c +36 −15
  147. drivers/net/xen-netback/interface.c +2 −1
  148. drivers/pci/controller/pci-mvebu.c +48 −4
  149. drivers/pci/pci.c +19 −8
  150. drivers/s390/net/qeth_core_main.c +1 −1
  151. drivers/s390/net/qeth_core_mpc.c +16 −17
  152. drivers/s390/net/qeth_core_mpc.h +2 −2
  153. drivers/scsi/qedi/qedi_main.c +1 −0
  154. drivers/soc/fsl/qbman/qman.c +3 −0
  155. drivers/soc/fsl/qe/ucc.c +1 −1
  156. drivers/thunderbolt/icm.c +20 −29
  157. drivers/thunderbolt/nhi.c +1 −1
  158. drivers/tty/serial/8250/8250_dw.c +0 −4
  159. drivers/tty/serial/sh-sci.c +41 −15
  160. drivers/usb/class/cdc-acm.c +6 −0
  161. drivers/usb/host/xhci-mtk.c +2 −2
  162. drivers/usb/host/xhci-pci.c +2 −0
  163. drivers/usb/serial/option.c +13 −2
  164. drivers/usb/serial/usb-serial-simple.c +2 −1
  165. drivers/video/fbdev/efifb.c +6 −0
  166. drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c +4 −1
  167. drivers/video/fbdev/pxa168fb.c +3 −3
  168. drivers/video/fbdev/stifb.c +1 −1
  169. fs/cifs/cifsglob.h +1 −0
  170. fs/cifs/connect.c +10 −3
  171. fs/cifs/smb2ops.c +1 −1
  172. fs/cifs/transport.c +19 −2
  173. fs/ioctl.c +1 −1
  174. fs/iomap.c +1 −1
  175. fs/nfsd/vfs.c +2 −1
  176. fs/ocfs2/dlm/dlmmaster.c +2 −2
  177. fs/ocfs2/refcounttree.c +12 −4
  178. fs/overlayfs/copy_up.c +1 −1
  179. fs/overlayfs/file.c +2 −0
  180. fs/overlayfs/inode.c +1 −1
  181. fs/overlayfs/namei.c +1 −1
  182. fs/overlayfs/overlayfs.h +2 −2
  183. fs/overlayfs/util.c +2 −1
  184. fs/proc/base.c +14 −0
  185. fs/pstore/ram.c +25 −4
  186. fs/read_write.c +15 −2
  187. fs/xattr.c +13 −11
  188. fs/xfs/libxfs/xfs_attr.c +8 −20
  189. fs/xfs/libxfs/xfs_attr_remote.c +2 −8
  190. fs/xfs/libxfs/xfs_bmap.c +13 −11
  191. fs/xfs/libxfs/xfs_format.h +2 −0
  192. fs/xfs/libxfs/xfs_inode_buf.c +30 −0
  193. fs/xfs/scrub/alloc.c +0 −1
  194. fs/xfs/scrub/inode.c +3 −1
  195. fs/xfs/xfs_bmap_util.c +7 −13
  196. fs/xfs/xfs_buf_item.c +64 −55
  197. fs/xfs/xfs_buf_item.h +1 −0
  198. fs/xfs/xfs_inode.c +1 −9
  199. fs/xfs/xfs_iops.c +11 −1
  200. fs/xfs/xfs_log_recover.c +0 −10
  201. fs/xfs/xfs_reflink.c +81 −56
  202. fs/xfs/xfs_trace.h +0 −1
  203. fs/xfs/xfs_trans.c +8 −2
  204. fs/xfs/xfs_trans_buf.c +24 −75
  205. include/drm/drm_client.h +3 −2
  206. include/linux/fpga/fpga-mgr.h +14 −6
  207. include/linux/fs.h +3 −14
  208. include/linux/hugetlb.h +14 −0
  209. include/linux/mlx5/transobj.h +2 −0
  210. include/linux/mm.h +6 −0
  211. include/linux/mmzone.h +0 −6
  212. include/linux/netdevice.h +3 −0
  213. include/linux/netfilter.h +2 −0
  214. include/linux/serial_sci.h +1 −0
  215. include/linux/virtio_net.h +18 −0
  216. include/media/v4l2-fh.h +4 −0
  217. include/net/bonding.h +1 −6
  218. include/net/cfg80211.h +0 −2
  219. include/net/inet_sock.h +0 −6
  220. include/net/netlink.h +1 −1
  221. include/trace/events/migrate.h +0 −27
  222. include/trace/events/rxrpc.h +1 −3
  223. include/uapi/asm-generic/hugetlb_encode.h +2 −0
  224. include/uapi/linux/memfd.h +2 −0
  225. include/uapi/linux/mman.h +2 −0
  226. include/uapi/linux/shm.h +2 −0
  227. ipc/shm.c +1 −1
  228. kernel/bpf/local_storage.c +4 −1
  229. kernel/bpf/verifier.c +9 −1
  230. kernel/events/core.c +4 −7
  231. kernel/locking/test-ww_mutex.c +6 −4
  232. kernel/sched/core.c +1 −1
  233. kernel/sched/deadline.c +1 −1
  234. kernel/sched/fair.c +91 −13
  235. kernel/sched/sched.h +2 −1
  236. lib/xz/xz_crc32.c +0 −1
  237. lib/xz/xz_private.h +4 −0
  238. mm/gup_benchmark.c +2 −1
  239. mm/huge_memory.c +1 −1
  240. mm/hugetlb.c +79 −11
  241. mm/madvise.c +1 −1
  242. mm/migrate.c +4 −58
  243. mm/page_alloc.c +0 −2
  244. mm/rmap.c +39 −3
  245. mm/vmscan.c +3 −4
  246. mm/vmstat.c +3 −1
  247. net/bluetooth/mgmt.c +2 −5
  248. net/bluetooth/smp.c +25 −4
  249. net/bluetooth/smp.h +2 −1
  250. net/bpfilter/bpfilter_kern.c +2 −2
  251. net/bridge/br_netfilter_hooks.c +2 −1
  252. net/core/ethtool.c +8 −1
  253. net/core/netpoll.c +3 −19
  254. net/core/rtnetlink.c +28 −13
  255. net/dccp/input.c +3 −1
  256. net/dccp/ipv4.c +3 −1
  257. net/ipv4/inet_connection_sock.c +4 −1
  258. net/ipv4/ip_sockglue.c +1 −2
  259. net/ipv4/sysctl_net_ipv4.c +4 −2
  260. net/ipv4/tcp_input.c +3 −1
  261. net/ipv4/tcp_ipv4.c +3 −1
  262. net/ipv4/xfrm4_input.c +1 −0
  263. net/ipv4/xfrm4_mode_transport.c +1 −3
  264. net/ipv6/raw.c +20 −9
  265. net/ipv6/route.c +0 −5
  266. net/ipv6/xfrm6_input.c +1 −0
  267. net/ipv6/xfrm6_mode_transport.c +1 −3
  268. net/ipv6/xfrm6_output.c +2 −0
  269. net/mac80211/cfg.c +1 −1
  270. net/mac80211/iface.c +2 −1
  271. net/mac80211/mesh.h +2 −1
  272. net/mac80211/mesh_hwmp.c +3 −6
  273. net/mac80211/status.c +5 −6
  274. net/mac80211/tdls.c +4 −4
  275. net/mac80211/tx.c +5 −1
  276. net/netfilter/nf_conntrack_proto_tcp.c +2 −2
  277. net/netfilter/nft_osf.c +1 −1
  278. net/netfilter/nft_set_rbtree.c +14 −14
  279. net/netfilter/xt_socket.c +2 −2
  280. net/openvswitch/conntrack.c +6 −4
  281. net/packet/af_packet.c +7 −4
  282. net/rxrpc/ar-internal.h +19 −17
  283. net/rxrpc/call_accept.c +14 −31
  284. net/rxrpc/call_object.c +1 −1
  285. net/rxrpc/conn_client.c +2 −2
  286. net/rxrpc/conn_object.c +8 −6
  287. net/rxrpc/input.c +64 −26
  288. net/rxrpc/local_object.c +22 −10
  289. net/rxrpc/output.c +36 −18
  290. net/rxrpc/peer_event.c +11 −35
  291. net/rxrpc/peer_object.c +11 −41
  292. net/rxrpc/protocol.h +0 −15
  293. net/sched/act_ipt.c +1 −1
  294. net/sched/sch_api.c +20 −4
  295. net/sctp/outqueue.c +1 −1
  296. net/tipc/bearer.c +7 −5
  297. net/tipc/link.c +44 −1
  298. net/tipc/link.h +3 −0
  299. net/tipc/node.c +13 −1
  300. net/tipc/socket.c +3 −1
  301. net/wireless/nl80211.c +15 −5
  302. net/wireless/reg.c +5 −3
  303. net/wireless/scan.c +49 −9
  304. net/wireless/wext-compat.c +10 −4
  305. net/xfrm/xfrm_input.c +1 −0
  306. net/xfrm/xfrm_output.c +4 −0
  307. net/xfrm/xfrm_policy.c +4 −0
  308. net/xfrm/xfrm_user.c +15 −0
  309. sound/hda/hdac_i915.c +3 −1
  310. sound/pci/hda/patch_realtek.c +1 −0
  311. tools/hv/hv_fcopy_daemon.c +1 −0
  312. tools/kvm/kvm_stat/kvm_stat +1 −1
  313. tools/testing/selftests/rseq/param_test.c +10 −9
  314. tools/testing/selftests/x86/test_vdso.c +172 −0
Documentation/driver-api/fpga/fpga-mgr.rst+5−0
@@ -184,6 +184,11 @@ API for implementing a new FPGA Manager driver · 183 unmodified lines
184184 API for programming an FPGA
185185 ---------------------------
186186
187+FPGA Manager flags
188+
189+.. kernel-doc:: include/linux/fpga/fpga-mgr.h
190+ :doc: FPGA Manager flags
191+
187192 .. kernel-doc:: include/linux/fpga/fpga-mgr.h
188193 :functions: fpga_image_info
189194
Documentation/fb/uvesafb.txt+3−2
@@ -15,7 +15,8 @@ than x86. Check the v86d documentation for a list of currently supported · 14 unmodified lines
1515 arches.
1616
1717 v86d source code can be downloaded from the following website:
18− http://dev.gentoo.org/~spock/projects/uvesafb
18+
19+ https://github.com/mjanusz/v86d
1920
2021 Please refer to the v86d documentation for detailed configuration and
2122 installation instructions.
@@ -177,7 +178,7 @@ from the Video BIOS if you set pixclock to 0 in fb_var_screeninfo. · 155 unmodified lines
177178
178179 --
179180 Michal Januszewski <spock@gentoo.org>
180− Last updated: 2009-03-30
181+ Last updated: 2017-10-10
181182
182183 Documentation of the uvesafb options is loosely based on vesafb.txt.
183184
Documentation/networking/ip-sysctl.txt+1−1
@@ -425,7 +425,7 @@ tcp_mtu_probing - INTEGER · 424 unmodified lines
425425 1 - Disabled by default, enabled when an ICMP black hole detected
426426 2 - Always enabled, use initial MSS of tcp_base_mss.
427427
428−tcp_probe_interval - INTEGER
428+tcp_probe_interval - UNSIGNED INTEGER
429429 Controls how often to start TCP Packetization-Layer Path MTU
430430 Discovery reprobe. The default is reprobing every 10 minutes as
431431 per RFC4821.
MAINTAINERS+6−8
@@ -324,7 +324,6 @@ F: Documentation/ABI/testing/sysfs-bus-acpi · 323 unmodified lines
324324 F: Documentation/ABI/testing/configfs-acpi
325325 F: drivers/pci/*acpi*
326326 F: drivers/pci/*/*acpi*
327−F: drivers/pci/*/*/*acpi*
328327 F: tools/power/acpi/
329328
330329 ACPI APEI
@@ -1251,7 +1250,7 @@ N: meson · 920 unmodified lines
12511250
12521251 ARM/Annapurna Labs ALPINE ARCHITECTURE
12531252 M: Tsahee Zidenberg <tsahee@annapurnalabs.com>
1254−M: Antoine Tenart <antoine.tenart@free-electrons.com>
1253+M: Antoine Tenart <antoine.tenart@bootlin.com>
12551254 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
12561255 S: Maintained
12571256 F: arch/arm/mach-alpine/
@@ -2956,7 +2955,6 @@ F: include/linux/bcm963xx_tag.h · 1698 unmodified lines
29562955
29572956 BROADCOM BNX2 GIGABIT ETHERNET DRIVER
29582957 M: Rasesh Mody <rasesh.mody@cavium.com>
2959−M: Harish Patil <harish.patil@cavium.com>
29602958 M: Dept-GELinuxNICDev@cavium.com
29612959 L: netdev@vger.kernel.org
29622960 S: Supported
@@ -2977,6 +2975,7 @@ F: drivers/scsi/bnx2i/ · 14 unmodified lines
29772975
29782976 BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER
29792977 M: Ariel Elior <ariel.elior@cavium.com>
2978+M: Sudarsana Kalluru <sudarsana.kalluru@cavium.com>
29802979 M: everest-linux-l2@cavium.com
29812980 L: netdev@vger.kernel.org
29822981 S: Supported
@@ -5470,7 +5469,8 @@ S: Odd Fixes · 2487 unmodified lines
54705469 F: drivers/net/ethernet/agere/
54715470
54725471 ETHERNET BRIDGE
5473−M: Stephen Hemminger <stephen@networkplumber.org>
5472+M: Roopa Prabhu <roopa@cumulusnetworks.com>
5473+M: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
54745474 L: bridge@lists.linux-foundation.org (moderated for non-subscribers)
54755475 L: netdev@vger.kernel.org
54765476 W: http://www.linuxfoundation.org/en/Net:Bridge
@@ -8598,7 +8598,6 @@ F: include/linux/spinlock*.h · 3121 unmodified lines
85988598 F: arch/*/include/asm/spinlock*.h
85998599 F: include/linux/rwlock*.h
86008600 F: include/linux/mutex*.h
8601−F: arch/*/include/asm/mutex*.h
86028601 F: include/linux/rwsem*.h
86038602 F: arch/*/include/asm/rwsem.h
86048603 F: include/linux/seqlock.h
@@ -11979,7 +11978,7 @@ F: Documentation/scsi/LICENSE.qla4xxx · 3374 unmodified lines
1197911978 F: drivers/scsi/qla4xxx/
1198011979
1198111980 QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER
11982−M: Harish Patil <harish.patil@cavium.com>
11981+M: Shahed Shaikh <Shahed.Shaikh@cavium.com>
1198311982 M: Manish Chopra <manish.chopra@cavium.com>
1198411983 M: Dept-GELinuxNICDev@cavium.com
1198511984 L: netdev@vger.kernel.org
@@ -11987,7 +11986,6 @@ S: Supported · 1 unmodified line
1198711986 F: drivers/net/ethernet/qlogic/qlcnic/
1198811987
1198911988 QLOGIC QLGE 10Gb ETHERNET DRIVER
11990−M: Harish Patil <harish.patil@cavium.com>
1199111989 M: Manish Chopra <manish.chopra@cavium.com>
1199211990 M: Dept-GELinuxNICDev@cavium.com
1199311991 L: netdev@vger.kernel.org
@@ -15395,7 +15393,7 @@ S: Maintained · 3401 unmodified lines
1539515393 UVESAFB DRIVER
1539615394 M: Michal Januszewski <spock@gentoo.org>
1539715395 L: linux-fbdev@vger.kernel.org
15398−W: http://dev.gentoo.org/~spock/projects/uvesafb/
15396+W: https://github.com/mjanusz/v86d
1539915397 S: Maintained
1540015398 F: Documentation/fb/uvesafb.txt
1540115399 F: drivers/video/fbdev/uvesafb.*
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 4
33 PATCHLEVEL = 19
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc6
5+EXTRAVERSION = -rc7
66 NAME = Merciless Moray
77
88 # *DOCUMENTATION*
arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts+2−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include "sama5d2-pinfunc.h"
1212 #include <dt-bindings/mfd/atmel-flexcom.h>
1313 #include <dt-bindings/gpio/gpio.h>
14+#include <dt-bindings/pinctrl/at91.h>
1415
1516 / {
1617 model = "Atmel SAMA5D2 PTC EK";
@@ -299,6 +300,7 @@ · 282 unmodified lines
299300 <PIN_PA30__NWE_NANDWE>,
300301 <PIN_PB2__NRD_NANDOE>;
301302 bias-pull-up;
303+ atmel,drive-strength = <ATMEL_PIO_DRVSTR_ME>;
302304 };
303305
304306 ale_cle_rdy_cs {
arch/arm/boot/dts/bcm63138.dtsi+8−6
@@ -106,21 +106,23 @@ · 105 unmodified lines
106106 global_timer: timer@1e200 {
107107 compatible = "arm,cortex-a9-global-timer";
108108 reg = <0x1e200 0x20>;
109− interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
109+ interrupts = <GIC_PPI 11 IRQ_TYPE_EDGE_RISING>;
110110 clocks = <&axi_clk>;
111111 };
112112
113113 local_timer: local-timer@1e600 {
114114 compatible = "arm,cortex-a9-twd-timer";
115115 reg = <0x1e600 0x20>;
116− interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
116+ interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) |
117+ IRQ_TYPE_EDGE_RISING)>;
117118 clocks = <&axi_clk>;
118119 };
119120
120121 twd_watchdog: watchdog@1e620 {
121122 compatible = "arm,cortex-a9-twd-wdt";
122123 reg = <0x1e620 0x20>;
123− interrupts = <GIC_PPI 14 IRQ_TYPE_LEVEL_HIGH>;
124+ interrupts = <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) |
125+ IRQ_TYPE_LEVEL_HIGH)>;
124126 };
125127
126128 armpll: armpll {
@@ -158,7 +160,7 @@ · 31 unmodified lines
158160 serial0: serial@600 {
159161 compatible = "brcm,bcm6345-uart";
160162 reg = <0x600 0x1b>;
161− interrupts = <GIC_SPI 32 0>;
163+ interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
162164 clocks = <&periph_clk>;
163165 clock-names = "periph";
164166 status = "disabled";
@@ -167,7 +169,7 @@ · 2 unmodified lines
167169 serial1: serial@620 {
168170 compatible = "brcm,bcm6345-uart";
169171 reg = <0x620 0x1b>;
170− interrupts = <GIC_SPI 33 0>;
172+ interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
171173 clocks = <&periph_clk>;
172174 clock-names = "periph";
173175 status = "disabled";
@@ -180,7 +182,7 @@ · 6 unmodified lines
180182 reg = <0x2000 0x600>, <0xf0 0x10>;
181183 reg-names = "nand", "nand-int-base";
182184 status = "disabled";
183− interrupts = <GIC_SPI 38 0>;
185+ interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
184186 interrupt-names = "nand";
185187 };
186188
arch/arm/boot/dts/stm32mp157c.dtsi+2−2
@@ -1078,8 +1078,8 @@ · 1077 unmodified lines
10781078 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
10791079 clocks = <&rcc SPI6_K>;
10801080 resets = <&rcc SPI6_R>;
1081− dmas = <&mdma1 34 0x0 0x40008 0x0 0x0 0>,
1082− <&mdma1 35 0x0 0x40002 0x0 0x0 0>;
1081+ dmas = <&mdma1 34 0x0 0x40008 0x0 0x0>,
1082+ <&mdma1 35 0x0 0x40002 0x0 0x0>;
10831083 dma-names = "rx", "tx";
10841084 status = "disabled";
10851085 };
arch/arm/boot/dts/sun8i-r40.dtsi+1−2
@@ -800,8 +800,7 @@ · 799 unmodified lines
800800 };
801801
802802 hdmi_phy: hdmi-phy@1ef0000 {
803− compatible = "allwinner,sun8i-r40-hdmi-phy",
804− "allwinner,sun50i-a64-hdmi-phy";
803+ compatible = "allwinner,sun8i-r40-hdmi-phy";
805804 reg = <0x01ef0000 0x10000>;
806805 clocks = <&ccu CLK_BUS_HDMI1>, <&ccu CLK_HDMI_SLOW>,
807806 <&ccu 7>, <&ccu 16>;
arch/arm/mm/ioremap.c+1−1
@@ -473,7 +473,7 @@ void pci_ioremap_set_mem_type(int mem_type) · 472 unmodified lines
473473
474474 int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr)
475475 {
476− BUG_ON(offset + SZ_64K > IO_SPACE_LIMIT);
476+ BUG_ON(offset + SZ_64K - 1 > IO_SPACE_LIMIT);
477477
478478 return ioremap_page_range(PCI_IO_VIRT_BASE + offset,
479479 PCI_IO_VIRT_BASE + offset + SZ_64K,
arch/arm/tools/syscall.tbl+1−0
@@ -413,3 +413,4 @@ · 412 unmodified lines
413413 396 common pkey_free sys_pkey_free
414414 397 common statx sys_statx
415415 398 common rseq sys_rseq
416+399 common io_pgetevents sys_io_pgetevents
arch/arm64/kvm/guest.c+54−1
@@ -57,6 +57,45 @@ static u64 core_reg_offset_from_id(u64 id) · 56 unmodified lines
5757 return id & ~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_CORE);
5858 }
5959
60+static int validate_core_offset(const struct kvm_one_reg *reg)
61+{
62+ u64 off = core_reg_offset_from_id(reg->id);
63+ int size;
64+
65+ switch (off) {
66+ case KVM_REG_ARM_CORE_REG(regs.regs[0]) ...
67+ KVM_REG_ARM_CORE_REG(regs.regs[30]):
68+ case KVM_REG_ARM_CORE_REG(regs.sp):
69+ case KVM_REG_ARM_CORE_REG(regs.pc):
70+ case KVM_REG_ARM_CORE_REG(regs.pstate):
71+ case KVM_REG_ARM_CORE_REG(sp_el1):
72+ case KVM_REG_ARM_CORE_REG(elr_el1):
73+ case KVM_REG_ARM_CORE_REG(spsr[0]) ...
74+ KVM_REG_ARM_CORE_REG(spsr[KVM_NR_SPSR - 1]):
75+ size = sizeof(__u64);
76+ break;
77+
78+ case KVM_REG_ARM_CORE_REG(fp_regs.vregs[0]) ...
79+ KVM_REG_ARM_CORE_REG(fp_regs.vregs[31]):
80+ size = sizeof(__uint128_t);
81+ break;
82+
83+ case KVM_REG_ARM_CORE_REG(fp_regs.fpsr):
84+ case KVM_REG_ARM_CORE_REG(fp_regs.fpcr):
85+ size = sizeof(__u32);
86+ break;
87+
88+ default:
89+ return -EINVAL;
90+ }
91+
92+ if (KVM_REG_SIZE(reg->id) == size &&
93+ IS_ALIGNED(off, size / sizeof(__u32)))
94+ return 0;
95+
96+ return -EINVAL;
97+}
98+
6099 static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
61100 {
62101 /*
@@ -76,6 +115,9 @@ static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) · 13 unmodified lines
76115 (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)
77116 return -ENOENT;
78117
118+ if (validate_core_offset(reg))
119+ return -EINVAL;
120+
79121 if (copy_to_user(uaddr, ((u32 *)regs) + off, KVM_REG_SIZE(reg->id)))
80122 return -EFAULT;
81123
@@ -98,6 +140,9 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) · 16 unmodified lines
98140 (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)
99141 return -ENOENT;
100142
143+ if (validate_core_offset(reg))
144+ return -EINVAL;
145+
101146 if (KVM_REG_SIZE(reg->id) > sizeof(tmp))
102147 return -EINVAL;
103148
@@ -107,17 +152,25 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) · 3 unmodified lines
107152 }
108153
109154 if (off == KVM_REG_ARM_CORE_REG(regs.pstate)) {
110− u32 mode = (*(u32 *)valp) & PSR_AA32_MODE_MASK;
155+ u64 mode = (*(u64 *)valp) & PSR_AA32_MODE_MASK;
111156 switch (mode) {
112157 case PSR_AA32_MODE_USR:
158+ if (!system_supports_32bit_el0())
159+ return -EINVAL;
160+ break;
113161 case PSR_AA32_MODE_FIQ:
114162 case PSR_AA32_MODE_IRQ:
115163 case PSR_AA32_MODE_SVC:
116164 case PSR_AA32_MODE_ABT:
117165 case PSR_AA32_MODE_UND:
166+ if (!vcpu_el1_is_32bit(vcpu))
167+ return -EINVAL;
168+ break;
118169 case PSR_MODE_EL0t:
119170 case PSR_MODE_EL1t:
120171 case PSR_MODE_EL1h:
172+ if (vcpu_el1_is_32bit(vcpu))
173+ return -EINVAL;
121174 break;
122175 default:
123176 err = -EINVAL;
arch/arm64/mm/hugetlbpage.c+43−7
@@ -117,11 +117,14 @@ static pte_t get_clear_flush(struct mm_struct *mm, · 116 unmodified lines
117117
118118 /*
119119 * If HW_AFDBM is enabled, then the HW could turn on
120− * the dirty bit for any page in the set, so check
121− * them all. All hugetlb entries are already young.
120+ * the dirty or accessed bit for any page in the set,
121+ * so check them all.
122122 */
123123 if (pte_dirty(pte))
124124 orig_pte = pte_mkdirty(orig_pte);
125+
126+ if (pte_young(pte))
127+ orig_pte = pte_mkyoung(orig_pte);
125128 }
126129
127130 if (valid) {
@@ -320,11 +323,40 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, · 192 unmodified lines
320323 return get_clear_flush(mm, addr, ptep, pgsize, ncontig);
321324 }
322325
326+/*
327+ * huge_ptep_set_access_flags will update access flags (dirty, accesssed)
328+ * and write permission.
329+ *
330+ * For a contiguous huge pte range we need to check whether or not write
331+ * permission has to change only on the first pte in the set. Then for
332+ * all the contiguous ptes we need to check whether or not there is a
333+ * discrepancy between dirty or young.
334+ */
335+static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig)
336+{
337+ int i;
338+
339+ if (pte_write(pte) != pte_write(huge_ptep_get(ptep)))
340+ return 1;
341+
342+ for (i = 0; i < ncontig; i++) {
343+ pte_t orig_pte = huge_ptep_get(ptep + i);
344+
345+ if (pte_dirty(pte) != pte_dirty(orig_pte))
346+ return 1;
347+
348+ if (pte_young(pte) != pte_young(orig_pte))
349+ return 1;
350+ }
351+
352+ return 0;
353+}
354+
323355 int huge_ptep_set_access_flags(struct vm_area_struct *vma,
324356 unsigned long addr, pte_t *ptep,
325357 pte_t pte, int dirty)
326358 {
327− int ncontig, i, changed = 0;
359+ int ncontig, i;
328360 size_t pgsize = 0;
329361 unsigned long pfn = pte_pfn(pte), dpfn;
330362 pgprot_t hugeprot;
@@ -336,19 +368,23 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma, · 5 unmodified lines
336368 ncontig = find_num_contig(vma->vm_mm, addr, ptep, &pgsize);
337369 dpfn = pgsize >> PAGE_SHIFT;
338370
371+ if (!__cont_access_flags_changed(ptep, pte, ncontig))
372+ return 0;
373+
339374 orig_pte = get_clear_flush(vma->vm_mm, addr, ptep, pgsize, ncontig);
340− if (!pte_same(orig_pte, pte))
341− changed = 1;
342375
343− /* Make sure we don't lose the dirty state */
376+ /* Make sure we don't lose the dirty or young state */
344377 if (pte_dirty(orig_pte))
345378 pte = pte_mkdirty(pte);
346379
380+ if (pte_young(orig_pte))
381+ pte = pte_mkyoung(pte);
382+
347383 hugeprot = pte_pgprot(pte);
348384 for (i = 0; i < ncontig; i++, ptep++, addr += pgsize, pfn += dpfn)
349385 set_pte_at(vma->vm_mm, addr, ptep, pfn_pte(pfn, hugeprot));
350386
351− return changed;
387+ return 1;
352388 }
353389
354390 void huge_ptep_set_wrprotect(struct mm_struct *mm,
arch/powerpc/kernel/process.c+10−0
@@ -1306,6 +1306,16 @@ void show_user_instructions(struct pt_regs *regs) · 1305 unmodified lines
13061306
13071307 pc = regs->nip - (instructions_to_print * 3 / 4 * sizeof(int));
13081308
1309+ /*
1310+ * Make sure the NIP points at userspace, not kernel text/data or
1311+ * elsewhere.
1312+ */
1313+ if (!__access_ok(pc, instructions_to_print * sizeof(int), USER_DS)) {
1314+ pr_info("%s[%d]: Bad NIP, not dumping instructions.\n",
1315+ current->comm, current->pid);
1316+ return;
1317+ }
1318+
13091319 pr_info("%s[%d]: code: ", current->comm, current->pid);
13101320
13111321 for (i = 0; i < instructions_to_print; i++) {
arch/powerpc/kvm/book3s_64_mmu_radix.c+10−0
@@ -646,6 +646,16 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, · 645 unmodified lines
646646 */
647647 local_irq_disable();
648648 ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift);
649+ /*
650+ * If the PTE disappeared temporarily due to a THP
651+ * collapse, just return and let the guest try again.
652+ */
653+ if (!ptep) {
654+ local_irq_enable();
655+ if (page)
656+ put_page(page);
657+ return RESUME_GUEST;
658+ }
649659 pte = *ptep;
650660 local_irq_enable();
651661
arch/powerpc/lib/code-patching.c+12−8
@@ -28,12 +28,6 @@ static int __patch_instruction(unsigned int *exec_addr, unsigned int instr, · 27 unmodified lines
2828 {
2929 int err;
3030
31− /* Make sure we aren't patching a freed init section */
32− if (init_mem_is_free && init_section_contains(exec_addr, 4)) {
33− pr_debug("Skipping init section patching addr: 0x%px\n", exec_addr);
34− return 0;
35− }
36−
3731 __put_user_size(instr, patch_addr, 4, err);
3832 if (err)
3933 return err;
@@ -148,7 +142,7 @@ static inline int unmap_patch_area(unsigned long addr) · 108 unmodified lines
148142 return 0;
149143 }
150144
151−int patch_instruction(unsigned int *addr, unsigned int instr)
145+static int do_patch_instruction(unsigned int *addr, unsigned int instr)
152146 {
153147 int err;
154148 unsigned int *patch_addr = NULL;
@@ -188,12 +182,22 @@ out: · 33 unmodified lines
188182 }
189183 #else /* !CONFIG_STRICT_KERNEL_RWX */
190184
191−int patch_instruction(unsigned int *addr, unsigned int instr)
185+static int do_patch_instruction(unsigned int *addr, unsigned int instr)
192186 {
193187 return raw_patch_instruction(addr, instr);
194188 }
195189
196190 #endif /* CONFIG_STRICT_KERNEL_RWX */
191+
192+int patch_instruction(unsigned int *addr, unsigned int instr)
193+{
194+ /* Make sure we aren't patching a freed init section */
195+ if (init_mem_is_free && init_section_contains(addr, 4)) {
196+ pr_debug("Skipping init section patching addr: 0x%px\n", addr);
197+ return 0;
198+ }
199+ return do_patch_instruction(addr, instr);
200+}
197201 NOKPROBE_SYMBOL(patch_instruction);
198202
199203 int patch_branch(unsigned int *addr, unsigned long target, int flags)
arch/powerpc/mm/numa.c+3−2
@@ -1217,9 +1217,10 @@ int find_and_online_cpu_nid(int cpu) · 1216 unmodified lines
12171217 * Need to ensure that NODE_DATA is initialized for a node from
12181218 * available memory (see memblock_alloc_try_nid). If unable to
12191219 * init the node, then default to nearest node that has memory
1220− * installed.
1220+ * installed. Skip onlining a node if the subsystems are not
1221+ * yet initialized.
12211222 */
1222− if (try_online_node(new_nid))
1223+ if (!topology_inited || try_online_node(new_nid))
12231224 new_nid = first_online_node;
12241225 #else
12251226 /*
arch/riscv/kernel/setup.c+1−1
@@ -186,7 +186,7 @@ static void __init setup_bootmem(void) · 185 unmodified lines
186186 BUG_ON(mem_size == 0);
187187
188188 set_max_mapnr(PFN_DOWN(mem_size));
189− max_low_pfn = pfn_base + PFN_DOWN(mem_size);
189+ max_low_pfn = memblock_end_of_DRAM();
190190
191191 #ifdef CONFIG_BLK_DEV_INITRD
192192 setup_initrd();
arch/x86/entry/vdso/Makefile+14−2
@@ -68,7 +68,13 @@ $(obj)/vdso-image-%.c: $(obj)/vdso%.so.dbg $(obj)/vdso%.so $(obj)/vdso2c FORCE · 67 unmodified lines
6868 CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \
6969 $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \
7070 -fno-omit-frame-pointer -foptimize-sibling-calls \
71− -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO $(RETPOLINE_VDSO_CFLAGS)
71+ -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO
72+
73+ifdef CONFIG_RETPOLINE
74+ifneq ($(RETPOLINE_VDSO_CFLAGS),)
75+ CFL += $(RETPOLINE_VDSO_CFLAGS)
76+endif
77+endif
7278
7379 $(vobjs): KBUILD_CFLAGS := $(filter-out $(GCC_PLUGINS_CFLAGS) $(RETPOLINE_CFLAGS),$(KBUILD_CFLAGS)) $(CFL)
7480
@@ -138,7 +144,13 @@ KBUILD_CFLAGS_32 += $(call cc-option, -fno-stack-protector) · 63 unmodified lines
138144 KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls)
139145 KBUILD_CFLAGS_32 += -fno-omit-frame-pointer
140146 KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING
141−KBUILD_CFLAGS_32 += $(RETPOLINE_VDSO_CFLAGS)
147+
148+ifdef CONFIG_RETPOLINE
149+ifneq ($(RETPOLINE_VDSO_CFLAGS),)
150+ KBUILD_CFLAGS_32 += $(RETPOLINE_VDSO_CFLAGS)
151+endif
152+endif
153+
142154 $(obj)/vdso32.so.dbg: KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
143155
144156 $(obj)/vdso32.so.dbg: FORCE \
arch/x86/entry/vdso/vclock_gettime.c+14−12
@@ -43,8 +43,9 @@ extern u8 hvclock_page · 42 unmodified lines
4343 notrace static long vdso_fallback_gettime(long clock, struct timespec *ts)
4444 {
4545 long ret;
46− asm("syscall" : "=a" (ret) :
47− "0" (__NR_clock_gettime), "D" (clock), "S" (ts) : "memory");
46+ asm ("syscall" : "=a" (ret), "=m" (*ts) :
47+ "0" (__NR_clock_gettime), "D" (clock), "S" (ts) :
48+ "memory", "rcx", "r11");
4849 return ret;
4950 }
5051
@@ -52,8 +53,9 @@ notrace static long vdso_fallback_gtod(struct timeval *tv, struct timezone *tz) · 1 unmodified line
5253 {
5354 long ret;
5455
55− asm("syscall" : "=a" (ret) :
56− "0" (__NR_gettimeofday), "D" (tv), "S" (tz) : "memory");
56+ asm ("syscall" : "=a" (ret), "=m" (*tv), "=m" (*tz) :
57+ "0" (__NR_gettimeofday), "D" (tv), "S" (tz) :
58+ "memory", "rcx", "r11");
5759 return ret;
5860 }
5961
@@ -64,13 +66,13 @@ notrace static long vdso_fallback_gettime(long clock, struct timespec *ts) · 4 unmodified lines
6466 {
6567 long ret;
6668
67− asm(
69+ asm (
6870 "mov %%ebx, %%edx \n"
69− "mov %2, %%ebx \n"
71+ "mov %[clock], %%ebx \n"
7072 "call __kernel_vsyscall \n"
7173 "mov %%edx, %%ebx \n"
72− : "=a" (ret)
73− : "0" (__NR_clock_gettime), "g" (clock), "c" (ts)
74+ : "=a" (ret), "=m" (*ts)
75+ : "0" (__NR_clock_gettime), [clock] "g" (clock), "c" (ts)
7476 : "memory", "edx");
7577 return ret;
7678 }
@@ -79,13 +81,13 @@ notrace static long vdso_fallback_gtod(struct timeval *tv, struct timezone *tz) · 2 unmodified lines
7981 {
8082 long ret;
8183
82− asm(
84+ asm (
8385 "mov %%ebx, %%edx \n"
84− "mov %2, %%ebx \n"
86+ "mov %[tv], %%ebx \n"
8587 "call __kernel_vsyscall \n"
8688 "mov %%edx, %%ebx \n"
87− : "=a" (ret)
88− : "0" (__NR_gettimeofday), "g" (tv), "c" (tz)
89+ : "=a" (ret), "=m" (*tv), "=m" (*tz)
90+ : "0" (__NR_gettimeofday), [tv] "g" (tv), "c" (tz)
8991 : "memory", "edx");
9092 return ret;
9193 }
arch/x86/events/amd/uncore.c+10−0
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636
3737 static int num_counters_llc;
3838 static int num_counters_nb;
39+static bool l3_mask;
3940
4041 static HLIST_HEAD(uncore_unused_list);
4142
@@ -209,6 +210,13 @@ static int amd_uncore_event_init(struct perf_event *event) · 167 unmodified lines
209210 hwc->config = event->attr.config & AMD64_RAW_EVENT_MASK_NB;
210211 hwc->idx = -1;
211212
213+ /*
214+ * SliceMask and ThreadMask need to be set for certain L3 events in
215+ * Family 17h. For other events, the two fields do not affect the count.
216+ */
217+ if (l3_mask)
218+ hwc->config |= (AMD64_L3_SLICE_MASK | AMD64_L3_THREAD_MASK);
219+
212220 if (event->cpu < 0)
213221 return -EINVAL;
214222
@@ -525,6 +533,7 @@ static int __init amd_uncore_init(void) · 310 unmodified lines
525533 amd_llc_pmu.name = "amd_l3";
526534 format_attr_event_df.show = &event_show_df;
527535 format_attr_event_l3.show = &event_show_l3;
536+ l3_mask = true;
528537 } else {
529538 num_counters_nb = NUM_COUNTERS_NB;
530539 num_counters_llc = NUM_COUNTERS_L2;
@@ -532,6 +541,7 @@ static int __init amd_uncore_init(void) · 1 unmodified line
532541 amd_llc_pmu.name = "amd_l2";
533542 format_attr_event_df = format_attr_event;
534543 format_attr_event_l3 = format_attr_event;
544+ l3_mask = false;
535545 }
536546
537547 amd_nb_pmu.attr_groups = amd_uncore_attr_groups_df;
arch/x86/events/intel/uncore_snbep.c+7−7
@@ -3061,7 +3061,7 @@ static struct event_constraint bdx_uncore_pcu_constraints[] = { · 3060 unmodified lines
30613061
30623062 void bdx_uncore_cpu_init(void)
30633063 {
3064− int pkg = topology_phys_to_logical_pkg(0);
3064+ int pkg = topology_phys_to_logical_pkg(boot_cpu_data.phys_proc_id);
30653065
30663066 if (bdx_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
30673067 bdx_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
@@ -3931,16 +3931,16 @@ static const struct pci_device_id skx_uncore_pci_ids[] = { · 863 unmodified lines
39313931 .driver_data = UNCORE_PCI_DEV_FULL_DATA(21, 5, SKX_PCI_UNCORE_M2PCIE, 3),
39323932 },
39333933 { /* M3UPI0 Link 0 */
3934− PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204C),
3935− .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 0, SKX_PCI_UNCORE_M3UPI, 0),
3934+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D),
3935+ .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 1, SKX_PCI_UNCORE_M3UPI, 0),
39363936 },
39373937 { /* M3UPI0 Link 1 */
3938− PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D),
3939− .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 1, SKX_PCI_UNCORE_M3UPI, 1),
3938+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204E),
3939+ .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 2, SKX_PCI_UNCORE_M3UPI, 1),
39403940 },
39413941 { /* M3UPI1 Link 2 */
3942− PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204C),
3943− .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 4, SKX_PCI_UNCORE_M3UPI, 2),
3942+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D),
3943+ .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 5, SKX_PCI_UNCORE_M3UPI, 2),
39443944 },
39453945 { /* end: all zeroes */ }
39463946 };
arch/x86/include/asm/perf_event.h+8−0
@@ -46,6 +46,14 @@ · 45 unmodified lines
4646 #define INTEL_ARCH_EVENT_MASK \
4747 (ARCH_PERFMON_EVENTSEL_UMASK | ARCH_PERFMON_EVENTSEL_EVENT)
4848
49+#define AMD64_L3_SLICE_SHIFT 48
50+#define AMD64_L3_SLICE_MASK \
51+ ((0xFULL) << AMD64_L3_SLICE_SHIFT)
52+
53+#define AMD64_L3_THREAD_SHIFT 56
54+#define AMD64_L3_THREAD_MASK \
55+ ((0xFFULL) << AMD64_L3_THREAD_SHIFT)
56+
4957 #define X86_RAW_EVENT_MASK \
5058 (ARCH_PERFMON_EVENTSEL_EVENT | \
5159 ARCH_PERFMON_EVENTSEL_UMASK | \
arch/x86/include/asm/uv/uv.h+6−0
@@ -10,8 +10,13 @@ struct cpumask; · 9 unmodified lines
1010 struct mm_struct;
1111
1212 #ifdef CONFIG_X86_UV
13+#include <linux/efi.h>
1314
1415 extern enum uv_system_type get_uv_system_type(void);
16+static inline bool is_early_uv_system(void)
17+{
18+ return !((efi.uv_systab == EFI_INVALID_TABLE_ADDR) || !efi.uv_systab);
19+}
1520 extern int is_uv_system(void);
1621 extern int is_uv_hubless(void);
1722 extern void uv_cpu_init(void);
@@ -23,6 +28,7 @@ extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, · 5 unmodified lines
2328 #else /* X86_UV */
2429
2530 static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; }
31+static inline bool is_early_uv_system(void) { return 0; }
2632 static inline int is_uv_system(void) { return 0; }
2733 static inline int is_uv_hubless(void) { return 0; }
2834 static inline void uv_cpu_init(void) { }
arch/x86/kernel/cpu/amd.c+1−1
@@ -922,7 +922,7 @@ static void init_amd(struct cpuinfo_x86 *c) · 921 unmodified lines
922922 static unsigned int amd_size_cache(struct cpuinfo_x86 *c, unsigned int size)
923923 {
924924 /* AMD errata T13 (order #21922) */
925− if ((c->x86 == 6)) {
925+ if (c->x86 == 6) {
926926 /* Duron Rev A0 */
927927 if (c->x86_model == 3 && c->x86_stepping == 0)
928928 size = 64;
arch/x86/kernel/tsc.c+4−0
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <asm/apic.h>
2727 #include <asm/intel-family.h>
2828 #include <asm/i8259.h>
29+#include <asm/uv/uv.h>
2930
3031 unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */
3132 EXPORT_SYMBOL(cpu_khz);
@@ -1433,6 +1434,9 @@ void __init tsc_early_init(void) · 1401 unmodified lines
14331434 {
14341435 if (!boot_cpu_has(X86_FEATURE_TSC))
14351436 return;
1437+ /* Don't change UV TSC multi-chassis synchronization */
1438+ if (is_early_uv_system())
1439+ return;
14361440 if (!determine_cpu_tsc_frequencies(true))
14371441 return;
14381442 loops_per_jiffy = get_loops_per_jiffy();
arch/x86/kvm/mmu.c+20−4
@@ -249,6 +249,17 @@ static u64 __read_mostly shadow_nonpresent_or_rsvd_mask; · 248 unmodified lines
249249 */
250250 static const u64 shadow_nonpresent_or_rsvd_mask_len = 5;
251251
252+/*
253+ * In some cases, we need to preserve the GFN of a non-present or reserved
254+ * SPTE when we usurp the upper five bits of the physical address space to
255+ * defend against L1TF, e.g. for MMIO SPTEs. To preserve the GFN, we'll
256+ * shift bits of the GFN that overlap with shadow_nonpresent_or_rsvd_mask
257+ * left into the reserved bits, i.e. the GFN in the SPTE will be split into
258+ * high and low parts. This mask covers the lower bits of the GFN.
259+ */
260+static u64 __read_mostly shadow_nonpresent_or_rsvd_lower_gfn_mask;
261+
262+
252263 static void mmu_spte_set(u64 *sptep, u64 spte);
253264 static union kvm_mmu_page_role
254265 kvm_mmu_calc_root_page_role(struct kvm_vcpu *vcpu);
@@ -357,9 +368,7 @@ static bool is_mmio_spte(u64 spte) · 102 unmodified lines
357368
358369 static gfn_t get_mmio_spte_gfn(u64 spte)
359370 {
360− u64 mask = generation_mmio_spte_mask(MMIO_GEN_MASK) | shadow_mmio_mask |
361− shadow_nonpresent_or_rsvd_mask;
362− u64 gpa = spte & ~mask;
371+ u64 gpa = spte & shadow_nonpresent_or_rsvd_lower_gfn_mask;
363372
364373 gpa |= (spte >> shadow_nonpresent_or_rsvd_mask_len)
365374 & shadow_nonpresent_or_rsvd_mask;
@@ -423,6 +432,8 @@ EXPORT_SYMBOL_GPL(kvm_mmu_set_mask_ptes); · 57 unmodified lines
423432
424433 static void kvm_mmu_reset_all_pte_masks(void)
425434 {
435+ u8 low_phys_bits;
436+
426437 shadow_user_mask = 0;
427438 shadow_accessed_mask = 0;
428439 shadow_dirty_mask = 0;
@@ -437,12 +448,17 @@ static void kvm_mmu_reset_all_pte_masks(void) · 8 unmodified lines
437448 * appropriate mask to guard against L1TF attacks. Otherwise, it is
438449 * assumed that the CPU is not vulnerable to L1TF.
439450 */
451+ low_phys_bits = boot_cpu_data.x86_phys_bits;
440452 if (boot_cpu_data.x86_phys_bits <
441− 52 - shadow_nonpresent_or_rsvd_mask_len)
453+ 52 - shadow_nonpresent_or_rsvd_mask_len) {
442454 shadow_nonpresent_or_rsvd_mask =
443455 rsvd_bits(boot_cpu_data.x86_phys_bits -
444456 shadow_nonpresent_or_rsvd_mask_len,
445457 boot_cpu_data.x86_phys_bits - 1);
458+ low_phys_bits -= shadow_nonpresent_or_rsvd_mask_len;
459+ }
460+ shadow_nonpresent_or_rsvd_lower_gfn_mask =
461+ GENMASK_ULL(low_phys_bits - 1, PAGE_SHIFT);
446462 }
447463
448464 static int is_cpuid_PSE36(void)
arch/x86/kvm/vmx.c+76−61
@@ -121,7 +121,6 @@ module_param_named(pml, enable_pml, bool, S_IRUGO); · 120 unmodified lines
121121
122122 #define MSR_BITMAP_MODE_X2APIC 1
123123 #define MSR_BITMAP_MODE_X2APIC_APICV 2
124−#define MSR_BITMAP_MODE_LM 4
125124
126125 #define KVM_VMX_TSC_MULTIPLIER_MAX 0xffffffffffffffffULL
127126
@@ -857,6 +856,7 @@ struct nested_vmx { · 729 unmodified lines
857856
858857 /* to migrate it to L2 if VM_ENTRY_LOAD_DEBUG_CONTROLS is off */
859858 u64 vmcs01_debugctl;
859+ u64 vmcs01_guest_bndcfgs;
860860
861861 u16 vpid02;
862862 u16 last_vpid;
@@ -2899,8 +2899,7 @@ static void vmx_prepare_switch_to_guest(struct kvm_vcpu *vcpu) · 2036 unmodified lines
28992899 vmx->msr_host_kernel_gs_base = read_msr(MSR_KERNEL_GS_BASE);
29002900 }
29012901
2902− if (is_long_mode(&vmx->vcpu))
2903− wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);
2902+ wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);
29042903 #else
29052904 savesegment(fs, fs_sel);
29062905 savesegment(gs, gs_sel);
@@ -2951,8 +2950,7 @@ static void vmx_prepare_switch_to_host(struct vcpu_vmx *vmx) · 44 unmodified lines
29512950 vmx->loaded_cpu_state = NULL;
29522951
29532952 #ifdef CONFIG_X86_64
2954− if (is_long_mode(&vmx->vcpu))
2955− rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);
2953+ rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);
29562954 #endif
29572955 if (host_state->ldt_sel || (host_state->gs_sel & 7)) {
29582956 kvm_load_ldt(host_state->ldt_sel);
@@ -2980,24 +2978,19 @@ static void vmx_prepare_switch_to_host(struct vcpu_vmx *vmx) · 21 unmodified lines
29802978 #ifdef CONFIG_X86_64
29812979 static u64 vmx_read_guest_kernel_gs_base(struct vcpu_vmx *vmx)
29822980 {
2983− if (is_long_mode(&vmx->vcpu)) {
2984− preempt_disable();
2985− if (vmx->loaded_cpu_state)
2986− rdmsrl(MSR_KERNEL_GS_BASE,
2987− vmx->msr_guest_kernel_gs_base);
2988− preempt_enable();
2989− }
2981+ preempt_disable();
2982+ if (vmx->loaded_cpu_state)
2983+ rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);
2984+ preempt_enable();
29902985 return vmx->msr_guest_kernel_gs_base;
29912986 }
29922987
29932988 static void vmx_write_guest_kernel_gs_base(struct vcpu_vmx *vmx, u64 data)
29942989 {
2995− if (is_long_mode(&vmx->vcpu)) {
2996− preempt_disable();
2997− if (vmx->loaded_cpu_state)
2998− wrmsrl(MSR_KERNEL_GS_BASE, data);
2999− preempt_enable();
3000− }
2990+ preempt_disable();
2991+ if (vmx->loaded_cpu_state)
2992+ wrmsrl(MSR_KERNEL_GS_BASE, data);
2993+ preempt_enable();
30012994 vmx->msr_guest_kernel_gs_base = data;
30022995 }
30032996 #endif
@@ -3533,9 +3526,6 @@ static void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, bool apicv) · 529 unmodified lines
35333526 VM_EXIT_LOAD_IA32_EFER | VM_EXIT_SAVE_IA32_EFER |
35343527 VM_EXIT_SAVE_VMX_PREEMPTION_TIMER | VM_EXIT_ACK_INTR_ON_EXIT;
35353528
3536− if (kvm_mpx_supported())
3537− msrs->exit_ctls_high |= VM_EXIT_CLEAR_BNDCFGS;
3538−
35393529 /* We support free control of debug control saving. */
35403530 msrs->exit_ctls_low &= ~VM_EXIT_SAVE_DEBUG_CONTROLS;
35413531
@@ -3552,8 +3542,6 @@ static void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, bool apicv) · 10 unmodified lines
35523542 VM_ENTRY_LOAD_IA32_PAT;
35533543 msrs->entry_ctls_high |=
35543544 (VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR | VM_ENTRY_LOAD_IA32_EFER);
3555− if (kvm_mpx_supported())
3556− msrs->entry_ctls_high |= VM_ENTRY_LOAD_BNDCFGS;
35573545
35583546 /* We support free control of debug control loading. */
35593547 msrs->entry_ctls_low &= ~VM_ENTRY_LOAD_DEBUG_CONTROLS;
@@ -3601,12 +3589,12 @@ static void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, bool apicv) · 41 unmodified lines
36013589 msrs->secondary_ctls_high);
36023590 msrs->secondary_ctls_low = 0;
36033591 msrs->secondary_ctls_high &=
3604− SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
36053592 SECONDARY_EXEC_DESC |
36063593 SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE |
36073594 SECONDARY_EXEC_APIC_REGISTER_VIRT |
36083595 SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
36093596 SECONDARY_EXEC_WBINVD_EXITING;
3597+
36103598 /*
36113599 * We can emulate "VMCS shadowing," even if the hardware
36123600 * doesn't support it.
@@ -3663,6 +3651,10 @@ static void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, bool apicv) · 50 unmodified lines
36633651 msrs->secondary_ctls_high |=
36643652 SECONDARY_EXEC_UNRESTRICTED_GUEST;
36653653
3654+ if (flexpriority_enabled)
3655+ msrs->secondary_ctls_high |=
3656+ SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
3657+
36663658 /* miscellaneous data */
36673659 rdmsr(MSR_IA32_VMX_MISC,
36683660 msrs->misc_low,
@@ -5073,19 +5065,6 @@ static void vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer) · 1404 unmodified lines
50735065 if (!msr)
50745066 return;
50755067
5076− /*
5077− * MSR_KERNEL_GS_BASE is not intercepted when the guest is in
5078− * 64-bit mode as a 64-bit kernel may frequently access the
5079− * MSR. This means we need to manually save/restore the MSR
5080− * when switching between guest and host state, but only if
5081− * the guest is in 64-bit mode. Sync our cached value if the
5082− * guest is transitioning to 32-bit mode and the CPU contains
5083− * guest state, i.e. the cache is stale.
5084− */
5085−#ifdef CONFIG_X86_64
5086− if (!(efer & EFER_LMA))
5087− (void)vmx_read_guest_kernel_gs_base(vmx);
5088−#endif
50895068 vcpu->arch.efer = efer;
50905069 if (efer & EFER_LMA) {
50915070 vm_entry_controls_setbit(to_vmx(vcpu), VM_ENTRY_IA32E_MODE);
@@ -6078,9 +6057,6 @@ static u8 vmx_msr_bitmap_mode(struct kvm_vcpu *vcpu) · 986 unmodified lines
60786057 mode |= MSR_BITMAP_MODE_X2APIC_APICV;
60796058 }
60806059
6081− if (is_long_mode(vcpu))
6082− mode |= MSR_BITMAP_MODE_LM;
6083−
60846060 return mode;
60856061 }
60866062
@@ -6121,9 +6097,6 @@ static void vmx_update_msr_bitmap(struct kvm_vcpu *vcpu) · 34 unmodified lines
61216097 if (!changed)
61226098 return;
61236099
6124− vmx_set_intercept_for_msr(msr_bitmap, MSR_KERNEL_GS_BASE, MSR_TYPE_RW,
6125− !(mode & MSR_BITMAP_MODE_LM));
6126−
61276100 if (changed & (MSR_BITMAP_MODE_X2APIC | MSR_BITMAP_MODE_X2APIC_APICV))
61286101 vmx_update_msr_bitmap_x2apic(msr_bitmap, mode);
61296102
@@ -6189,6 +6162,11 @@ static void vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu) · 59 unmodified lines
61896162 nested_mark_vmcs12_pages_dirty(vcpu);
61906163 }
61916164
6165+static u8 vmx_get_rvi(void)
6166+{
6167+ return vmcs_read16(GUEST_INTR_STATUS) & 0xff;
6168+}
6169+
61926170 static bool vmx_guest_apic_has_interrupt(struct kvm_vcpu *vcpu)
61936171 {
61946172 struct vcpu_vmx *vmx = to_vmx(vcpu);
@@ -6201,7 +6179,7 @@ static bool vmx_guest_apic_has_interrupt(struct kvm_vcpu *vcpu) · 6 unmodified lines
62016179 WARN_ON_ONCE(!vmx->nested.virtual_apic_page))
62026180 return false;
62036181
6204− rvi = vmcs_read16(GUEST_INTR_STATUS) & 0xff;
6182+ rvi = vmx_get_rvi();
62056183
62066184 vapic_page = kmap(vmx->nested.virtual_apic_page);
62076185 vppr = *((u32 *)(vapic_page + APIC_PROCPRI));
@@ -10245,15 +10223,16 @@ static void vmx_set_virtual_apic_mode(struct kvm_vcpu *vcpu) · 4037 unmodified lines
1024510223 if (!lapic_in_kernel(vcpu))
1024610224 return;
1024710225
10226+ if (!flexpriority_enabled &&
10227+ !cpu_has_vmx_virtualize_x2apic_mode())
10228+ return;
10229+
1024810230 /* Postpone execution until vmcs01 is the current VMCS. */
1024910231 if (is_guest_mode(vcpu)) {
1025010232 to_vmx(vcpu)->nested.change_vmcs01_virtual_apic_mode = true;
1025110233 return;
1025210234 }
1025310235
10254− if (!cpu_need_tpr_shadow(vcpu))
10255− return;
10256−
1025710236 sec_exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
1025810237 sec_exec_control &= ~(SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
1025910238 SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE);
@@ -10375,6 +10354,14 @@ static int vmx_sync_pir_to_irr(struct kvm_vcpu *vcpu) · 115 unmodified lines
1037510354 return max_irr;
1037610355 }
1037710356
10357+static u8 vmx_has_apicv_interrupt(struct kvm_vcpu *vcpu)
10358+{
10359+ u8 rvi = vmx_get_rvi();
10360+ u8 vppr = kvm_lapic_get_reg(vcpu->arch.apic, APIC_PROCPRI);
10361+
10362+ return ((rvi & 0xf0) > (vppr & 0xf0));
10363+}
10364+
1037810365 static void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap)
1037910366 {
1038010367 if (!kvm_vcpu_apicv_active(vcpu))
@@ -11264,6 +11251,23 @@ static void nested_vmx_cr_fixed1_bits_update(struct kvm_vcpu *vcpu) · 883 unmodified lines
1126411251 #undef cr4_fixed1_update
1126511252 }
1126611253
11254+static void nested_vmx_entry_exit_ctls_update(struct kvm_vcpu *vcpu)
11255+{
11256+ struct vcpu_vmx *vmx = to_vmx(vcpu);
11257+
11258+ if (kvm_mpx_supported()) {
11259+ bool mpx_enabled = guest_cpuid_has(vcpu, X86_FEATURE_MPX);
11260+
11261+ if (mpx_enabled) {
11262+ vmx->nested.msrs.entry_ctls_high |= VM_ENTRY_LOAD_BNDCFGS;
11263+ vmx->nested.msrs.exit_ctls_high |= VM_EXIT_CLEAR_BNDCFGS;
11264+ } else {
11265+ vmx->nested.msrs.entry_ctls_high &= ~VM_ENTRY_LOAD_BNDCFGS;
11266+ vmx->nested.msrs.exit_ctls_high &= ~VM_EXIT_CLEAR_BNDCFGS;
11267+ }
11268+ }
11269+}
11270+
1126711271 static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
1126811272 {
1126911273 struct vcpu_vmx *vmx = to_vmx(vcpu);
@@ -11280,8 +11284,10 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu) · 10 unmodified lines
1128011284 to_vmx(vcpu)->msr_ia32_feature_control_valid_bits &=
1128111285 ~FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX;
1128211286
11283− if (nested_vmx_allowed(vcpu))
11287+ if (nested_vmx_allowed(vcpu)) {
1128411288 nested_vmx_cr_fixed1_bits_update(vcpu);
11289+ nested_vmx_entry_exit_ctls_update(vcpu);
11290+ }
1128511291 }
1128611292
1128711293 static void vmx_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
@@ -12049,8 +12055,13 @@ static void prepare_vmcs02_full(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) · 761 unmodified lines
1204912055
1205012056 set_cr4_guest_host_mask(vmx);
1205112057
12052− if (vmx_mpx_supported())
12053− vmcs_write64(GUEST_BNDCFGS, vmcs12->guest_bndcfgs);
12058+ if (kvm_mpx_supported()) {
12059+ if (vmx->nested.nested_run_pending &&
12060+ (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS))
12061+ vmcs_write64(GUEST_BNDCFGS, vmcs12->guest_bndcfgs);
12062+ else
12063+ vmcs_write64(GUEST_BNDCFGS, vmx->nested.vmcs01_guest_bndcfgs);
12064+ }
1205412065
1205512066 if (enable_vpid) {
1205612067 if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02)
@@ -12595,15 +12606,21 @@ static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu, u32 *exit_qual) · 538 unmodified lines
1259512606 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
1259612607 bool from_vmentry = !!exit_qual;
1259712608 u32 dummy_exit_qual;
12598− u32 vmcs01_cpu_exec_ctrl;
12609+ bool evaluate_pending_interrupts;
1259912610 int r = 0;
1260012611
12601− vmcs01_cpu_exec_ctrl = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
12612+ evaluate_pending_interrupts = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL) &
12613+ (CPU_BASED_VIRTUAL_INTR_PENDING | CPU_BASED_VIRTUAL_NMI_PENDING);
12614+ if (likely(!evaluate_pending_interrupts) && kvm_vcpu_apicv_active(vcpu))
12615+ evaluate_pending_interrupts |= vmx_has_apicv_interrupt(vcpu);
1260212616
1260312617 enter_guest_mode(vcpu);
1260412618
1260512619 if (!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS))
1260612620 vmx->nested.vmcs01_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL);
12621+ if (kvm_mpx_supported() &&
12622+ !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS))
12623+ vmx->nested.vmcs01_guest_bndcfgs = vmcs_read64(GUEST_BNDCFGS);
1260712624
1260812625 vmx_switch_vmcs(vcpu, &vmx->nested.vmcs02);
1260912626 vmx_segment_cache_clear(vmx);
@@ -12643,16 +12660,14 @@ static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu, u32 *exit_qual) · 33 unmodified lines
1264312660 * to L1 or delivered directly to L2 (e.g. In case L1 don't
1264412661 * intercept EXTERNAL_INTERRUPT).
1264512662 *
12646− * Usually this would be handled by L0 requesting a
12647− * IRQ/NMI window by setting VMCS accordingly. However,
12648− * this setting was done on VMCS01 and now VMCS02 is active
12649− * instead. Thus, we force L0 to perform pending event
12650− * evaluation by requesting a KVM_REQ_EVENT.
12651− */
12652− if (vmcs01_cpu_exec_ctrl &
12653− (CPU_BASED_VIRTUAL_INTR_PENDING | CPU_BASED_VIRTUAL_NMI_PENDING)) {
12663+ * Usually this would be handled by the processor noticing an
12664+ * IRQ/NMI window request, or checking RVI during evaluation of
12665+ * pending virtual interrupts. However, this setting was done
12666+ * on VMCS01 and now VMCS02 is active instead. Thus, we force L0
12667+ * to perform pending event evaluation by requesting a KVM_REQ_EVENT.
12668+ */
12669+ if (unlikely(evaluate_pending_interrupts))
1265412670 kvm_make_request(KVM_REQ_EVENT, vcpu);
12655− }
1265612671
1265712672 /*
1265812673 * Note no nested_vmx_succeed or nested_vmx_fail here. At this point
arch/x86/kvm/x86.c+1−1
@@ -4698,7 +4698,7 @@ static void kvm_init_msr_list(void) · 4697 unmodified lines
46984698 */
46994699 switch (msrs_to_save[i]) {
47004700 case MSR_IA32_BNDCFGS:
4701− if (!kvm_x86_ops->mpx_supported())
4701+ if (!kvm_mpx_supported())
47024702 continue;
47034703 break;
47044704 case MSR_TSC_AUX:
drivers/base/firmware_loader/main.c+5−2
@@ -226,8 +226,11 @@ static int alloc_lookup_fw_priv(const char *fw_name, · 225 unmodified lines
226226 }
227227
228228 tmp = __allocate_fw_priv(fw_name, fwc, dbuf, size);
229− if (tmp && !(opt_flags & FW_OPT_NOCACHE))
230− list_add(&tmp->list, &fwc->head);
229+ if (tmp) {
230+ INIT_LIST_HEAD(&tmp->list);
231+ if (!(opt_flags & FW_OPT_NOCACHE))
232+ list_add(&tmp->list, &fwc->head);
233+ }
231234 spin_unlock(&fwc->lock);
232235
233236 *fw_priv = tmp;
drivers/base/power/main.c+4−1
@@ -1713,8 +1713,10 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) · 1712 unmodified lines
17131713
17141714 dpm_wait_for_subordinate(dev, async);
17151715
1716− if (async_error)
1716+ if (async_error) {
1717+ dev->power.direct_complete = false;
17171718 goto Complete;
1719+ }
17181720
17191721 /*
17201722 * If a device configured to wake up the system from sleep states
@@ -1726,6 +1728,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) · 5 unmodified lines
17261728 pm_wakeup_event(dev, 0);
17271729
17281730 if (pm_wakeup_pending()) {
1731+ dev->power.direct_complete = false;
17291732 async_error = -EBUSY;
17301733 goto Complete;
17311734 }
drivers/crypto/caam/caamalg.c+4−4
@@ -1553,8 +1553,8 @@ static struct ablkcipher_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request · 1552 unmodified lines
15531553 edesc->src_nents = src_nents;
15541554 edesc->dst_nents = dst_nents;
15551555 edesc->sec4_sg_bytes = sec4_sg_bytes;
1556− edesc->sec4_sg = (void *)edesc + sizeof(struct ablkcipher_edesc) +
1557− desc_bytes;
1556+ edesc->sec4_sg = (struct sec4_sg_entry *)((u8 *)edesc->hw_desc +
1557+ desc_bytes);
15581558 edesc->iv_dir = DMA_TO_DEVICE;
15591559
15601560 /* Make sure IV is located in a DMAable area */
@@ -1757,8 +1757,8 @@ static struct ablkcipher_edesc *ablkcipher_giv_edesc_alloc( · 196 unmodified lines
17571757 edesc->src_nents = src_nents;
17581758 edesc->dst_nents = dst_nents;
17591759 edesc->sec4_sg_bytes = sec4_sg_bytes;
1760− edesc->sec4_sg = (void *)edesc + sizeof(struct ablkcipher_edesc) +
1761− desc_bytes;
1760+ edesc->sec4_sg = (struct sec4_sg_entry *)((u8 *)edesc->hw_desc +
1761+ desc_bytes);
17621762 edesc->iv_dir = DMA_FROM_DEVICE;
17631763
17641764 /* Make sure IV is located in a DMAable area */
drivers/crypto/chelsio/chcr_algo.c+22−10
@@ -367,7 +367,8 @@ static inline void dsgl_walk_init(struct dsgl_walk *walk, · 366 unmodified lines
367367 walk->to = (struct phys_sge_pairs *)(dsgl + 1);
368368 }
369369
370−static inline void dsgl_walk_end(struct dsgl_walk *walk, unsigned short qid)
370+static inline void dsgl_walk_end(struct dsgl_walk *walk, unsigned short qid,
371+ int pci_chan_id)
371372 {
372373 struct cpl_rx_phys_dsgl *phys_cpl;
373374
@@ -385,6 +386,7 @@ static inline void dsgl_walk_end(struct dsgl_walk *walk, unsigned short qid) · 11 unmodified lines
385386 phys_cpl->rss_hdr_int.opcode = CPL_RX_PHYS_ADDR;
386387 phys_cpl->rss_hdr_int.qid = htons(qid);
387388 phys_cpl->rss_hdr_int.hash_val = 0;
389+ phys_cpl->rss_hdr_int.channel = pci_chan_id;
388390 }
389391
390392 static inline void dsgl_walk_add_page(struct dsgl_walk *walk,
@@ -718,7 +720,7 @@ static inline void create_wreq(struct chcr_context *ctx, · 327 unmodified lines
718720 FILL_WR_RX_Q_ID(ctx->dev->rx_channel_id, qid,
719721 !!lcb, ctx->tx_qidx);
720722
721− chcr_req->ulptx.cmd_dest = FILL_ULPTX_CMD_DEST(ctx->dev->tx_channel_id,
723+ chcr_req->ulptx.cmd_dest = FILL_ULPTX_CMD_DEST(ctx->tx_chan_id,
722724 qid);
723725 chcr_req->ulptx.len = htonl((DIV_ROUND_UP(len16, 16) -
724726 ((sizeof(chcr_req->wreq)) >> 4)));
@@ -1339,16 +1341,23 @@ static int chcr_device_init(struct chcr_context *ctx) · 614 unmodified lines
13391341 adap->vres.ncrypto_fc);
13401342 rxq_perchan = u_ctx->lldi.nrxq / u_ctx->lldi.nchan;
13411343 txq_perchan = ntxq / u_ctx->lldi.nchan;
1342− rxq_idx = ctx->dev->tx_channel_id * rxq_perchan;
1343− rxq_idx += id % rxq_perchan;
1344− txq_idx = ctx->dev->tx_channel_id * txq_perchan;
1345− txq_idx += id % txq_perchan;
13461344 spin_lock(&ctx->dev->lock_chcr_dev);
1347− ctx->rx_qidx = rxq_idx;
1348− ctx->tx_qidx = txq_idx;
1345+ ctx->tx_chan_id = ctx->dev->tx_channel_id;
13491346 ctx->dev->tx_channel_id = !ctx->dev->tx_channel_id;
13501347 ctx->dev->rx_channel_id = 0;
13511348 spin_unlock(&ctx->dev->lock_chcr_dev);
1349+ rxq_idx = ctx->tx_chan_id * rxq_perchan;
1350+ rxq_idx += id % rxq_perchan;
1351+ txq_idx = ctx->tx_chan_id * txq_perchan;
1352+ txq_idx += id % txq_perchan;
1353+ ctx->rx_qidx = rxq_idx;
1354+ ctx->tx_qidx = txq_idx;
1355+ /* Channel Id used by SGE to forward packet to Host.
1356+ * Same value should be used in cpl_fw6_pld RSS_CH field
1357+ * by FW. Driver programs PCI channel ID to be used in fw
1358+ * at the time of queue allocation with value "pi->tx_chan"
1359+ */
1360+ ctx->pci_chan_id = txq_idx / txq_perchan;
13521361 }
13531362 out:
13541363 return err;
@@ -2503,6 +2512,7 @@ void chcr_add_aead_dst_ent(struct aead_request *req, · 1148 unmodified lines
25032512 struct crypto_aead *tfm = crypto_aead_reqtfm(req);
25042513 struct dsgl_walk dsgl_walk;
25052514 unsigned int authsize = crypto_aead_authsize(tfm);
2515+ struct chcr_context *ctx = a_ctx(tfm);
25062516 u32 temp;
25072517
25082518 dsgl_walk_init(&dsgl_walk, phys_cpl);
@@ -2512,7 +2522,7 @@ void chcr_add_aead_dst_ent(struct aead_request *req, · 3 unmodified lines
25122522 dsgl_walk_add_page(&dsgl_walk, IV, &reqctx->iv_dma);
25132523 temp = req->cryptlen + (reqctx->op ? -authsize : authsize);
25142524 dsgl_walk_add_sg(&dsgl_walk, req->dst, temp, req->assoclen);
2515− dsgl_walk_end(&dsgl_walk, qid);
2525+ dsgl_walk_end(&dsgl_walk, qid, ctx->pci_chan_id);
25162526 }
25172527
25182528 void chcr_add_cipher_src_ent(struct ablkcipher_request *req,
@@ -2544,6 +2554,8 @@ void chcr_add_cipher_dst_ent(struct ablkcipher_request *req, · 25 unmodified lines
25442554 unsigned short qid)
25452555 {
25462556 struct chcr_blkcipher_req_ctx *reqctx = ablkcipher_request_ctx(req);
2557+ struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(wrparam->req);
2558+ struct chcr_context *ctx = c_ctx(tfm);
25472559 struct dsgl_walk dsgl_walk;
25482560
25492561 dsgl_walk_init(&dsgl_walk, phys_cpl);
@@ -2552,7 +2564,7 @@ void chcr_add_cipher_dst_ent(struct ablkcipher_request *req, · 2 unmodified lines
25522564 reqctx->dstsg = dsgl_walk.last_sg;
25532565 reqctx->dst_ofst = dsgl_walk.last_sg_len;
25542566
2555− dsgl_walk_end(&dsgl_walk, qid);
2567+ dsgl_walk_end(&dsgl_walk, qid, ctx->pci_chan_id);
25562568 }
25572569
25582570 void chcr_add_hash_src_ent(struct ahash_request *req,
drivers/crypto/chelsio/chcr_crypto.h+2−0
@@ -255,6 +255,8 @@ struct chcr_context { · 254 unmodified lines
255255 struct chcr_dev *dev;
256256 unsigned char tx_qidx;
257257 unsigned char rx_qidx;
258+ unsigned char tx_chan_id;
259+ unsigned char pci_chan_id;
258260 struct __crypto_ctx crypto_ctx[0];
259261 };
260262
drivers/crypto/mxs-dcp.c+30−23
@@ -63,7 +63,7 @@ struct dcp { · 62 unmodified lines
6363 struct dcp_coherent_block *coh;
6464
6565 struct completion completion[DCP_MAX_CHANS];
66− struct mutex mutex[DCP_MAX_CHANS];
66+ spinlock_t lock[DCP_MAX_CHANS];
6767 struct task_struct *thread[DCP_MAX_CHANS];
6868 struct crypto_queue queue[DCP_MAX_CHANS];
6969 };
@@ -349,13 +349,20 @@ static int dcp_chan_thread_aes(void *data) · 279 unmodified lines
349349
350350 int ret;
351351
352− do {
353− __set_current_state(TASK_INTERRUPTIBLE);
352+ while (!kthread_should_stop()) {
353+ set_current_state(TASK_INTERRUPTIBLE);
354354
355− mutex_lock(&sdcp->mutex[chan]);
355+ spin_lock(&sdcp->lock[chan]);
356356 backlog = crypto_get_backlog(&sdcp->queue[chan]);
357357 arq = crypto_dequeue_request(&sdcp->queue[chan]);
358− mutex_unlock(&sdcp->mutex[chan]);
358+ spin_unlock(&sdcp->lock[chan]);
359+
360+ if (!backlog && !arq) {
361+ schedule();
362+ continue;
363+ }
364+
365+ set_current_state(TASK_RUNNING);
359366
360367 if (backlog)
361368 backlog->complete(backlog, -EINPROGRESS);
@@ -363,11 +370,8 @@ static int dcp_chan_thread_aes(void *data) · 1 unmodified line
363370 if (arq) {
364371 ret = mxs_dcp_aes_block_crypt(arq);
365372 arq->complete(arq, ret);
366− continue;
367373 }
368−
369− schedule();
370− } while (!kthread_should_stop());
374+ }
371375
372376 return 0;
373377 }
@@ -409,9 +413,9 @@ static int mxs_dcp_aes_enqueue(struct ablkcipher_request *req, int enc, int ecb) · 35 unmodified lines
409413 rctx->ecb = ecb;
410414 actx->chan = DCP_CHAN_CRYPTO;
411415
412− mutex_lock(&sdcp->mutex[actx->chan]);
416+ spin_lock(&sdcp->lock[actx->chan]);
413417 ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base);
414− mutex_unlock(&sdcp->mutex[actx->chan]);
418+ spin_unlock(&sdcp->lock[actx->chan]);
415419
416420 wake_up_process(sdcp->thread[actx->chan]);
417421
@@ -640,13 +644,20 @@ static int dcp_chan_thread_sha(void *data) · 222 unmodified lines
640644 struct ahash_request *req;
641645 int ret, fini;
642646
643− do {
644− __set_current_state(TASK_INTERRUPTIBLE);
647+ while (!kthread_should_stop()) {
648+ set_current_state(TASK_INTERRUPTIBLE);
645649
646− mutex_lock(&sdcp->mutex[chan]);
650+ spin_lock(&sdcp->lock[chan]);
647651 backlog = crypto_get_backlog(&sdcp->queue[chan]);
648652 arq = crypto_dequeue_request(&sdcp->queue[chan]);
649− mutex_unlock(&sdcp->mutex[chan]);
653+ spin_unlock(&sdcp->lock[chan]);
654+
655+ if (!backlog && !arq) {
656+ schedule();
657+ continue;
658+ }
659+
660+ set_current_state(TASK_RUNNING);
650661
651662 if (backlog)
652663 backlog->complete(backlog, -EINPROGRESS);
@@ -658,12 +669,8 @@ static int dcp_chan_thread_sha(void *data) · 5 unmodified lines
658669 ret = dcp_sha_req_to_buf(arq);
659670 fini = rctx->fini;
660671 arq->complete(arq, ret);
661− if (!fini)
662− continue;
663672 }
664−
665− schedule();
666− } while (!kthread_should_stop());
673+ }
667674
668675 return 0;
669676 }
@@ -721,9 +728,9 @@ static int dcp_sha_update_fx(struct ahash_request *req, int fini) · 51 unmodified lines
721728 rctx->init = 1;
722729 }
723730
724− mutex_lock(&sdcp->mutex[actx->chan]);
731+ spin_lock(&sdcp->lock[actx->chan]);
725732 ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base);
726− mutex_unlock(&sdcp->mutex[actx->chan]);
733+ spin_unlock(&sdcp->lock[actx->chan]);
727734
728735 wake_up_process(sdcp->thread[actx->chan]);
729736 mutex_unlock(&actx->mutex);
@@ -997,7 +1004,7 @@ static int mxs_dcp_probe(struct platform_device *pdev) · 267 unmodified lines
9971004 platform_set_drvdata(pdev, sdcp);
9981005
9991006 for (i = 0; i < DCP_MAX_CHANS; i++) {
1000− mutex_init(&sdcp->mutex[i]);
1007+ spin_lock_init(&sdcp->lock[i]);
10011008 init_completion(&sdcp->completion[i]);
10021009 crypto_init_queue(&sdcp->queue[i], 50);
10031010 }
drivers/crypto/qat/qat_c3xxx/adf_drv.c+3−3
@@ -123,7 +123,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 122 unmodified lines
123123 struct adf_hw_device_data *hw_data;
124124 char name[ADF_DEVICE_NAME_LENGTH];
125125 unsigned int i, bar_nr;
126− int ret, bar_mask;
126+ unsigned long bar_mask;
127+ int ret;
127128
128129 switch (ent->device) {
129130 case ADF_C3XXX_PCI_DEVICE_ID:
@@ -235,8 +236,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 105 unmodified lines
235236 /* Find and map all the device's BARS */
236237 i = 0;
237238 bar_mask = pci_select_bars(pdev, IORESOURCE_MEM);
238− for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask,
239− ADF_PCI_MAX_BARS * 2) {
239+ for_each_set_bit(bar_nr, &bar_mask, ADF_PCI_MAX_BARS * 2) {
240240 struct adf_bar *bar = &accel_pci_dev->pci_bars[i++];
241241
242242 bar->base_addr = pci_resource_start(pdev, bar_nr);
drivers/crypto/qat/qat_c3xxxvf/adf_drv.c+3−3
@@ -125,7 +125,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 124 unmodified lines
125125 struct adf_hw_device_data *hw_data;
126126 char name[ADF_DEVICE_NAME_LENGTH];
127127 unsigned int i, bar_nr;
128− int ret, bar_mask;
128+ unsigned long bar_mask;
129+ int ret;
129130
130131 switch (ent->device) {
131132 case ADF_C3XXXIOV_PCI_DEVICE_ID:
@@ -215,8 +216,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 83 unmodified lines
215216 /* Find and map all the device's BARS */
216217 i = 0;
217218 bar_mask = pci_select_bars(pdev, IORESOURCE_MEM);
218− for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask,
219− ADF_PCI_MAX_BARS * 2) {
219+ for_each_set_bit(bar_nr, &bar_mask, ADF_PCI_MAX_BARS * 2) {
220220 struct adf_bar *bar = &accel_pci_dev->pci_bars[i++];
221221
222222 bar->base_addr = pci_resource_start(pdev, bar_nr);
drivers/crypto/qat/qat_c62x/adf_drv.c+3−3
@@ -123,7 +123,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 122 unmodified lines
123123 struct adf_hw_device_data *hw_data;
124124 char name[ADF_DEVICE_NAME_LENGTH];
125125 unsigned int i, bar_nr;
126− int ret, bar_mask;
126+ unsigned long bar_mask;
127+ int ret;
127128
128129 switch (ent->device) {
129130 case ADF_C62X_PCI_DEVICE_ID:
@@ -235,8 +236,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 105 unmodified lines
235236 /* Find and map all the device's BARS */
236237 i = (hw_data->fuses & ADF_DEVICE_FUSECTL_MASK) ? 1 : 0;
237238 bar_mask = pci_select_bars(pdev, IORESOURCE_MEM);
238− for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask,
239− ADF_PCI_MAX_BARS * 2) {
239+ for_each_set_bit(bar_nr, &bar_mask, ADF_PCI_MAX_BARS * 2) {
240240 struct adf_bar *bar = &accel_pci_dev->pci_bars[i++];
241241
242242 bar->base_addr = pci_resource_start(pdev, bar_nr);
drivers/crypto/qat/qat_c62xvf/adf_drv.c+3−3
@@ -125,7 +125,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 124 unmodified lines
125125 struct adf_hw_device_data *hw_data;
126126 char name[ADF_DEVICE_NAME_LENGTH];
127127 unsigned int i, bar_nr;
128− int ret, bar_mask;
128+ unsigned long bar_mask;
129+ int ret;
129130
130131 switch (ent->device) {
131132 case ADF_C62XIOV_PCI_DEVICE_ID:
@@ -215,8 +216,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 83 unmodified lines
215216 /* Find and map all the device's BARS */
216217 i = 0;
217218 bar_mask = pci_select_bars(pdev, IORESOURCE_MEM);
218− for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask,
219− ADF_PCI_MAX_BARS * 2) {
219+ for_each_set_bit(bar_nr, &bar_mask, ADF_PCI_MAX_BARS * 2) {
220220 struct adf_bar *bar = &accel_pci_dev->pci_bars[i++];
221221
222222 bar->base_addr = pci_resource_start(pdev, bar_nr);
drivers/crypto/qat/qat_dh895xcc/adf_drv.c+3−3
@@ -123,7 +123,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 122 unmodified lines
123123 struct adf_hw_device_data *hw_data;
124124 char name[ADF_DEVICE_NAME_LENGTH];
125125 unsigned int i, bar_nr;
126− int ret, bar_mask;
126+ unsigned long bar_mask;
127+ int ret;
127128
128129 switch (ent->device) {
129130 case ADF_DH895XCC_PCI_DEVICE_ID:
@@ -237,8 +238,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 107 unmodified lines
237238 /* Find and map all the device's BARS */
238239 i = 0;
239240 bar_mask = pci_select_bars(pdev, IORESOURCE_MEM);
240− for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask,
241− ADF_PCI_MAX_BARS * 2) {
241+ for_each_set_bit(bar_nr, &bar_mask, ADF_PCI_MAX_BARS * 2) {
242242 struct adf_bar *bar = &accel_pci_dev->pci_bars[i++];
243243
244244 bar->base_addr = pci_resource_start(pdev, bar_nr);
drivers/crypto/qat/qat_dh895xccvf/adf_drv.c+3−3
@@ -125,7 +125,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 124 unmodified lines
125125 struct adf_hw_device_data *hw_data;
126126 char name[ADF_DEVICE_NAME_LENGTH];
127127 unsigned int i, bar_nr;
128− int ret, bar_mask;
128+ unsigned long bar_mask;
129+ int ret;
129130
130131 switch (ent->device) {
131132 case ADF_DH895XCCIOV_PCI_DEVICE_ID:
@@ -215,8 +216,7 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 83 unmodified lines
215216 /* Find and map all the device's BARS */
216217 i = 0;
217218 bar_mask = pci_select_bars(pdev, IORESOURCE_MEM);
218− for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask,
219− ADF_PCI_MAX_BARS * 2) {
219+ for_each_set_bit(bar_nr, &bar_mask, ADF_PCI_MAX_BARS * 2) {
220220 struct adf_bar *bar = &accel_pci_dev->pci_bars[i++];
221221
222222 bar->base_addr = pci_resource_start(pdev, bar_nr);
drivers/fpga/dfl-fme-region.c+3−1
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 */
1515
1616 #include <linux/module.h>
17+#include <linux/fpga/fpga-mgr.h>
1718 #include <linux/fpga/fpga-region.h>
1819
1920 #include "dfl-fme-pr.h"
@@ -66,9 +67,10 @@ eprobe_mgr_put: · 46 unmodified lines
6667 static int fme_region_remove(struct platform_device *pdev)
6768 {
6869 struct fpga_region *region = dev_get_drvdata(&pdev->dev);
70+ struct fpga_manager *mgr = region->mgr;
6971
7072 fpga_region_unregister(region);
71− fpga_mgr_put(region->mgr);
73+ fpga_mgr_put(mgr);
7274
7375 return 0;
7476 }
drivers/fpga/fpga-bridge.c+1−1
@@ -125,7 +125,7 @@ static int fpga_bridge_dev_match(struct device *dev, const void *data) · 124 unmodified lines
125125 *
126126 * Given a device, get an exclusive reference to a fpga bridge.
127127 *
128− * Return: fpga manager struct or IS_ERR() condition containing error code.
128+ * Return: fpga bridge struct or IS_ERR() condition containing error code.
129129 */
130130 struct fpga_bridge *fpga_bridge_get(struct device *dev,
131131 struct fpga_image_info *info)
drivers/fpga/of-fpga-region.c+2−1
@@ -437,9 +437,10 @@ eprobe_mgr_put: · 436 unmodified lines
437437 static int of_fpga_region_remove(struct platform_device *pdev)
438438 {
439439 struct fpga_region *region = platform_get_drvdata(pdev);
440+ struct fpga_manager *mgr = region->mgr;
440441
441442 fpga_region_unregister(region);
442− fpga_mgr_put(region->mgr);
443+ fpga_mgr_put(mgr);
443444
444445 return 0;
445446 }
drivers/gpio/gpiolib.c+1−1
@@ -571,7 +571,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip) · 570 unmodified lines
571571 if (ret)
572572 goto out_free_descs;
573573 lh->descs[i] = desc;
574− count = i;
574+ count = i + 1;
575575
576576 if (lflags & GPIOHANDLE_REQUEST_ACTIVE_LOW)
577577 set_bit(FLAG_ACTIVE_LOW, &desc->flags);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c+29−8
@@ -358,8 +358,8 @@ static int create_compute_queue_nocpsch(struct device_queue_manager *dqm, · 357 unmodified lines
358358 struct queue *q,
359359 struct qcm_process_device *qpd)
360360 {
361− int retval;
362361 struct mqd_manager *mqd_mgr;
362+ int retval;
363363
364364 mqd_mgr = dqm->ops.get_mqd_manager(dqm, KFD_MQD_TYPE_COMPUTE);
365365 if (!mqd_mgr)
@@ -387,8 +387,12 @@ static int create_compute_queue_nocpsch(struct device_queue_manager *dqm, · 21 unmodified lines
387387 if (!q->properties.is_active)
388388 return 0;
389389
390− retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe, q->queue,
391− &q->properties, q->process->mm);
390+ if (WARN(q->process->mm != current->mm,
391+ "should only run in user thread"))
392+ retval = -EFAULT;
393+ else
394+ retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe, q->queue,
395+ &q->properties, current->mm);
392396 if (retval)
393397 goto out_uninit_mqd;
394398
@@ -545,9 +549,15 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q) · 150 unmodified lines
545549 retval = map_queues_cpsch(dqm);
546550 else if (q->properties.is_active &&
547551 (q->properties.type == KFD_QUEUE_TYPE_COMPUTE ||
548− q->properties.type == KFD_QUEUE_TYPE_SDMA))
549− retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe, q->queue,
550− &q->properties, q->process->mm);
552+ q->properties.type == KFD_QUEUE_TYPE_SDMA)) {
553+ if (WARN(q->process->mm != current->mm,
554+ "should only run in user thread"))
555+ retval = -EFAULT;
556+ else
557+ retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd,
558+ q->pipe, q->queue,
559+ &q->properties, current->mm);
560+ }
551561
552562 out_unlock:
553563 dqm_unlock(dqm);
@@ -653,6 +663,7 @@ out: · 99 unmodified lines
653663 static int restore_process_queues_nocpsch(struct device_queue_manager *dqm,
654664 struct qcm_process_device *qpd)
655665 {
666+ struct mm_struct *mm = NULL;
656667 struct queue *q;
657668 struct mqd_manager *mqd_mgr;
658669 struct kfd_process_device *pdd;
@@ -686,6 +697,15 @@ static int restore_process_queues_nocpsch(struct device_queue_manager *dqm, · 27 unmodified lines
686697 kfd_flush_tlb(pdd);
687698 }
688699
700+ /* Take a safe reference to the mm_struct, which may otherwise
701+ * disappear even while the kfd_process is still referenced.
702+ */
703+ mm = get_task_mm(pdd->process->lead_thread);
704+ if (!mm) {
705+ retval = -EFAULT;
706+ goto out;
707+ }
708+
689709 /* activate all active queues on the qpd */
690710 list_for_each_entry(q, &qpd->queues_list, list) {
691711 if (!q->properties.is_evicted)
@@ -700,14 +720,15 @@ static int restore_process_queues_nocpsch(struct device_queue_manager *dqm, · 8 unmodified lines
700720 q->properties.is_evicted = false;
701721 q->properties.is_active = true;
702722 retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe,
703− q->queue, &q->properties,
704− q->process->mm);
723+ q->queue, &q->properties, mm);
705724 if (retval)
706725 goto out;
707726 dqm->queue_count++;
708727 }
709728 qpd->evicted = 0;
710729 out:
730+ if (mm)
731+ mmput(mm);
711732 dqm_unlock(dqm);
712733 return retval;
713734 }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+8−2
@@ -4633,12 +4633,18 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) · 4632 unmodified lines
46334633 }
46344634 spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
46354635
4636− /* Signal HW programming completion */
4637− drm_atomic_helper_commit_hw_done(state);
46384636
46394637 if (wait_for_vblank)
46404638 drm_atomic_helper_wait_for_flip_done(dev, state);
46414639
4640+ /*
4641+ * FIXME:
4642+ * Delay hw_done() until flip_done() is signaled. This is to block
4643+ * another commit from freeing the CRTC state while we're still
4644+ * waiting on flip_done.
4645+ */
4646+ drm_atomic_helper_commit_hw_done(state);
4647+
46424648 drm_atomic_helper_cleanup_planes(dev, state);
46434649
46444650 /* Finally, drop a runtime PM reference for each newly disabled CRTC,
drivers/gpu/drm/drm_client.c+26−9
@@ -63,20 +63,21 @@ static void drm_client_close(struct drm_client_dev *client) · 62 unmodified lines
6363 EXPORT_SYMBOL(drm_client_close);
6464
6565 /**
66− * drm_client_new - Create a DRM client
66+ * drm_client_init - Initialise a DRM client
6767 * @dev: DRM device
6868 * @client: DRM client
6969 * @name: Client name
7070 * @funcs: DRM client functions (optional)
7171 *
72+ * This initialises the client and opens a &drm_file. Use drm_client_add() to complete the process.
7273 * The caller needs to hold a reference on @dev before calling this function.
7374 * The client is freed when the &drm_device is unregistered. See drm_client_release().
7475 *
7576 * Returns:
7677 * Zero on success or negative error code on failure.
7778 */
78−int drm_client_new(struct drm_device *dev, struct drm_client_dev *client,
79− const char *name, const struct drm_client_funcs *funcs)
79+int drm_client_init(struct drm_device *dev, struct drm_client_dev *client,
80+ const char *name, const struct drm_client_funcs *funcs)
8081 {
8182 int ret;
8283
@@ -95,10 +96,6 @@ int drm_client_new(struct drm_device *dev, struct drm_client_dev *client, · 12 unmodified lines
9596 if (ret)
9697 goto err_put_module;
9798
98− mutex_lock(&dev->clientlist_mutex);
99− list_add(&client->list, &dev->clientlist);
100− mutex_unlock(&dev->clientlist_mutex);
101−
10299 drm_dev_get(dev);
103100
104101 return 0;
@@ -109,13 +106,33 @@ err_put_module: · 4 unmodified lines
109106
110107 return ret;
111108 }
112−EXPORT_SYMBOL(drm_client_new);
109+EXPORT_SYMBOL(drm_client_init);
110+
111+/**
112+ * drm_client_add - Add client to the device list
113+ * @client: DRM client
114+ *
115+ * Add the client to the &drm_device client list to activate its callbacks.
116+ * @client must be initialized by a call to drm_client_init(). After
117+ * drm_client_add() it is no longer permissible to call drm_client_release()
118+ * directly (outside the unregister callback), instead cleanup will happen
119+ * automatically on driver unload.
120+ */
121+void drm_client_add(struct drm_client_dev *client)
122+{
123+ struct drm_device *dev = client->dev;
124+
125+ mutex_lock(&dev->clientlist_mutex);
126+ list_add(&client->list, &dev->clientlist);
127+ mutex_unlock(&dev->clientlist_mutex);
128+}
129+EXPORT_SYMBOL(drm_client_add);
113130
114131 /**
115132 * drm_client_release - Release DRM client resources
116133 * @client: DRM client
117134 *
118− * Releases resources by closing the &drm_file that was opened by drm_client_new().
135+ * Releases resources by closing the &drm_file that was opened by drm_client_init().
119136 * It is called automatically if the &drm_client_funcs.unregister callback is _not_ set.
120137 *
121138 * This function should only be called from the unregister callback. An exception
drivers/gpu/drm/drm_fb_cma_helper.c+3−1
@@ -160,7 +160,7 @@ struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev, · 159 unmodified lines
160160
161161 fb_helper = &fbdev_cma->fb_helper;
162162
163− ret = drm_client_new(dev, &fb_helper->client, "fbdev", NULL);
163+ ret = drm_client_init(dev, &fb_helper->client, "fbdev", NULL);
164164 if (ret)
165165 goto err_free;
166166
@@ -169,6 +169,8 @@ struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev, · 2 unmodified lines
169169 if (ret)
170170 goto err_client_put;
171171
172+ drm_client_add(&fb_helper->client);
173+
172174 return fbdev_cma;
173175
174176 err_client_put:
drivers/gpu/drm/drm_fb_helper.c+3−1
@@ -3218,12 +3218,14 @@ int drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp) · 3217 unmodified lines
32183218 if (!fb_helper)
32193219 return -ENOMEM;
32203220
3221− ret = drm_client_new(dev, &fb_helper->client, "fbdev", &drm_fbdev_client_funcs);
3221+ ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_client_funcs);
32223222 if (ret) {
32233223 kfree(fb_helper);
32243224 return ret;
32253225 }
32263226
3227+ drm_client_add(&fb_helper->client);
3228+
32273229 fb_helper->preferred_bpp = preferred_bpp;
32283230
32293231 drm_fbdev_client_hotplug(&fb_helper->client);
drivers/gpu/drm/drm_lease.c+3−3
@@ -566,14 +566,14 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev, · 565 unmodified lines
566566 lessee_priv->is_master = 1;
567567 lessee_priv->authenticated = 1;
568568
569− /* Hook up the fd */
570− fd_install(fd, lessee_file);
571−
572569 /* Pass fd back to userspace */
573570 DRM_DEBUG_LEASE("Returning fd %d id %d\n", fd, lessee->lessee_id);
574571 cl->fd = fd;
575572 cl->lessee_id = lessee->lessee_id;
576573
574+ /* Hook up the fd */
575+ fd_install(fd, lessee_file);
576+
577577 DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl succeeded\n");
578578 return 0;
579579
drivers/gpu/drm/exynos/exynos_drm_iommu.h+6−28
@@ -55,37 +55,12 @@ static inline void __exynos_iommu_detach(struct exynos_drm_private *priv, · 54 unmodified lines
5555 static inline int __exynos_iommu_create_mapping(struct exynos_drm_private *priv,
5656 unsigned long start, unsigned long size)
5757 {
58− struct iommu_domain *domain;
59− int ret;
60−
61− domain = iommu_domain_alloc(priv->dma_dev->bus);
62− if (!domain)
63− return -ENOMEM;
64−
65− ret = iommu_get_dma_cookie(domain);
66− if (ret)
67− goto free_domain;
68−
69− ret = iommu_dma_init_domain(domain, start, size, NULL);
70− if (ret)
71− goto put_cookie;
72−
73− priv->mapping = domain;
58+ priv->mapping = iommu_get_domain_for_dev(priv->dma_dev);
7459 return 0;
75−
76−put_cookie:
77− iommu_put_dma_cookie(domain);
78−free_domain:
79− iommu_domain_free(domain);
80− return ret;
8160 }
8261
8362 static inline void __exynos_iommu_release_mapping(struct exynos_drm_private *priv)
8463 {
85− struct iommu_domain *domain = priv->mapping;
86−
87− iommu_put_dma_cookie(domain);
88− iommu_domain_free(domain);
8964 priv->mapping = NULL;
9065 }
9166
@@ -94,7 +69,9 @@ static inline int __exynos_iommu_attach(struct exynos_drm_private *priv, · 2 unmodified lines
9469 {
9570 struct iommu_domain *domain = priv->mapping;
9671
97− return iommu_attach_device(domain, dev);
72+ if (dev != priv->dma_dev)
73+ return iommu_attach_device(domain, dev);
74+ return 0;
9875 }
9976
10077 static inline void __exynos_iommu_detach(struct exynos_drm_private *priv,
@@ -102,7 +79,8 @@ static inline void __exynos_iommu_detach(struct exynos_drm_private *priv, · 1 unmodified line
10279 {
10380 struct iommu_domain *domain = priv->mapping;
10481
105− iommu_detach_device(domain, dev);
82+ if (dev != priv->dma_dev)
83+ iommu_detach_device(domain, dev);
10684 }
10785 #else
10886 #error Unsupported architecture and IOMMU/DMA-mapping glue code
drivers/gpu/drm/i2c/tda9950.c+3−2
@@ -191,7 +191,8 @@ static irqreturn_t tda9950_irq(int irq, void *data) · 190 unmodified lines
191191 break;
192192 }
193193 /* TDA9950 executes all retries for us */
194− tx_status |= CEC_TX_STATUS_MAX_RETRIES;
194+ if (tx_status != CEC_TX_STATUS_OK)
195+ tx_status |= CEC_TX_STATUS_MAX_RETRIES;
195196 cec_transmit_done(priv->adap, tx_status, arb_lost_cnt,
196197 nack_cnt, 0, err_cnt);
197198 break;
@@ -310,7 +311,7 @@ static void tda9950_release(struct tda9950_priv *priv) · 112 unmodified lines
310311 /* Wait up to .5s for it to signal non-busy */
311312 do {
312313 csr = tda9950_read(client, REG_CSR);
313− if (!(csr & CSR_BUSY) || --timeout)
314+ if (!(csr & CSR_BUSY) || !--timeout)
314315 break;
315316 msleep(10);
316317 } while (1);
drivers/gpu/drm/i915/i915_gpu_error.c+63−25
@@ -232,6 +232,20 @@ static bool compress_init(struct compress *c) · 231 unmodified lines
232232 return true;
233233 }
234234
235+static void *compress_next_page(struct drm_i915_error_object *dst)
236+{
237+ unsigned long page;
238+
239+ if (dst->page_count >= dst->num_pages)
240+ return ERR_PTR(-ENOSPC);
241+
242+ page = __get_free_page(GFP_ATOMIC | __GFP_NOWARN);
243+ if (!page)
244+ return ERR_PTR(-ENOMEM);
245+
246+ return dst->pages[dst->page_count++] = (void *)page;
247+}
248+
235249 static int compress_page(struct compress *c,
236250 void *src,
237251 struct drm_i915_error_object *dst)
@@ -245,19 +259,14 @@ static int compress_page(struct compress *c, · 7 unmodified lines
245259
246260 do {
247261 if (zstream->avail_out == 0) {
248− unsigned long page;
249−
250− page = __get_free_page(GFP_ATOMIC | __GFP_NOWARN);
251− if (!page)
252− return -ENOMEM;
262+ zstream->next_out = compress_next_page(dst);
263+ if (IS_ERR(zstream->next_out))
264+ return PTR_ERR(zstream->next_out);
253265
254− dst->pages[dst->page_count++] = (void *)page;
255−
256− zstream->next_out = (void *)page;
257266 zstream->avail_out = PAGE_SIZE;
258267 }
259268
260− if (zlib_deflate(zstream, Z_SYNC_FLUSH) != Z_OK)
269+ if (zlib_deflate(zstream, Z_NO_FLUSH) != Z_OK)
261270 return -EIO;
262271 } while (zstream->avail_in);
263272
@@ -268,19 +277,42 @@ static int compress_page(struct compress *c, · 4 unmodified lines
268277 return 0;
269278 }
270279
271−static void compress_fini(struct compress *c,
280+static int compress_flush(struct compress *c,
272281 struct drm_i915_error_object *dst)
273282 {
274283 struct z_stream_s *zstream = &c->zstream;
275284
276− if (dst) {
277− zlib_deflate(zstream, Z_FINISH);
278− dst->unused = zstream->avail_out;
279− }
285+ do {
286+ switch (zlib_deflate(zstream, Z_FINISH)) {
287+ case Z_OK: /* more space requested */
288+ zstream->next_out = compress_next_page(dst);
289+ if (IS_ERR(zstream->next_out))
290+ return PTR_ERR(zstream->next_out);
291+
292+ zstream->avail_out = PAGE_SIZE;
293+ break;
294+
295+ case Z_STREAM_END:
296+ goto end;
297+
298+ default: /* any error */
299+ return -EIO;
300+ }
301+ } while (1);
302+
303+end:
304+ memset(zstream->next_out, 0, zstream->avail_out);
305+ dst->unused = zstream->avail_out;
306+ return 0;
307+}
308+
309+static void compress_fini(struct compress *c,
310+ struct drm_i915_error_object *dst)
311+{
312+ struct z_stream_s *zstream = &c->zstream;
280313
281314 zlib_deflateEnd(zstream);
282315 kfree(zstream->workspace);
283−
284316 if (c->tmp)
285317 free_page((unsigned long)c->tmp);
286318 }
@@ -319,6 +351,12 @@ static int compress_page(struct compress *c, · 32 unmodified lines
319351 return 0;
320352 }
321353
354+static int compress_flush(struct compress *c,
355+ struct drm_i915_error_object *dst)
356+{
357+ return 0;
358+}
359+
322360 static void compress_fini(struct compress *c,
323361 struct drm_i915_error_object *dst)
324362 {
@@ -917,6 +955,7 @@ i915_error_object_create(struct drm_i915_private *i915, · 592 unmodified lines
917955 unsigned long num_pages;
918956 struct sgt_iter iter;
919957 dma_addr_t dma;
958+ int ret;
920959
921960 if (!vma)
922961 return NULL;
@@ -930,6 +969,7 @@ i915_error_object_create(struct drm_i915_private *i915, · 7 unmodified lines
930969
931970 dst->gtt_offset = vma->node.start;
932971 dst->gtt_size = vma->node.size;
972+ dst->num_pages = num_pages;
933973 dst->page_count = 0;
934974 dst->unused = 0;
935975
@@ -938,28 +978,26 @@ i915_error_object_create(struct drm_i915_private *i915, · 2 unmodified lines
938978 return NULL;
939979 }
940980
981+ ret = -EINVAL;
941982 for_each_sgt_dma(dma, iter, vma->pages) {
942983 void __iomem *s;
943− int ret;
944984
945985 ggtt->vm.insert_page(&ggtt->vm, dma, slot, I915_CACHE_NONE, 0);
946986
947987 s = io_mapping_map_atomic_wc(&ggtt->iomap, slot);
948988 ret = compress_page(&compress, (void __force *)s, dst);
949989 io_mapping_unmap_atomic(s);
950−
951990 if (ret)
952− goto unwind;
991+ break;
953992 }
954− goto out;
955993
956−unwind:
957− while (dst->page_count--)
958− free_page((unsigned long)dst->pages[dst->page_count]);
959− kfree(dst);
960− dst = NULL;
994+ if (ret || compress_flush(&compress, dst)) {
995+ while (dst->page_count--)
996+ free_page((unsigned long)dst->pages[dst->page_count]);
997+ kfree(dst);
998+ dst = NULL;
999+ }
9611000
962−out:
9631001 compress_fini(&compress, dst);
9641002 ggtt->vm.clear_range(&ggtt->vm, slot, PAGE_SIZE);
9651003 return dst;
drivers/gpu/drm/i915/i915_gpu_error.h+1−0
@@ -135,6 +135,7 @@ struct i915_gpu_state { · 134 unmodified lines
135135 struct drm_i915_error_object {
136136 u64 gtt_offset;
137137 u64 gtt_size;
138+ int num_pages;
138139 int page_count;
139140 int unused;
140141 u32 *pages[0];
drivers/gpu/drm/i915/i915_irq.c+12−21
@@ -3091,36 +3091,27 @@ gen11_gt_irq_handler(struct drm_i915_private * const i915, · 3090 unmodified lines
30913091 spin_unlock(&i915->irq_lock);
30923092 }
30933093
3094−static void
3095−gen11_gu_misc_irq_ack(struct drm_i915_private *dev_priv, const u32 master_ctl,
3096− u32 *iir)
3094+static u32
3095+gen11_gu_misc_irq_ack(struct drm_i915_private *dev_priv, const u32 master_ctl)
30973096 {
30983097 void __iomem * const regs = dev_priv->regs;
3098+ u32 iir;
30993099
31003100 if (!(master_ctl & GEN11_GU_MISC_IRQ))
3101− return;
3101+ return 0;
3102+
3103+ iir = raw_reg_read(regs, GEN11_GU_MISC_IIR);
3104+ if (likely(iir))
3105+ raw_reg_write(regs, GEN11_GU_MISC_IIR, iir);
31023106
3103− *iir = raw_reg_read(regs, GEN11_GU_MISC_IIR);
3104− if (likely(*iir))
3105− raw_reg_write(regs, GEN11_GU_MISC_IIR, *iir);
3107+ return iir;
31063108 }
31073109
31083110 static void
3109−gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv,
3110− const u32 master_ctl, const u32 iir)
3111+gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv, const u32 iir)
31113112 {
3112− if (!(master_ctl & GEN11_GU_MISC_IRQ))
3113− return;
3114−
3115− if (unlikely(!iir)) {
3116− DRM_ERROR("GU_MISC iir blank!\n");
3117− return;
3118− }
3119−
31203113 if (iir & GEN11_GU_MISC_GSE)
31213114 intel_opregion_asle_intr(dev_priv);
3122− else
3123− DRM_ERROR("Unexpected GU_MISC interrupt 0x%x\n", iir);
31243115 }
31253116
31263117 static irqreturn_t gen11_irq_handler(int irq, void *arg)
@@ -3157,12 +3148,12 @@ static irqreturn_t gen11_irq_handler(int irq, void *arg) · 30 unmodified lines
31573148 enable_rpm_wakeref_asserts(i915);
31583149 }
31593150
3160− gen11_gu_misc_irq_ack(i915, master_ctl, &gu_misc_iir);
3151+ gu_misc_iir = gen11_gu_misc_irq_ack(i915, master_ctl);
31613152
31623153 /* Acknowledge and enable interrupts. */
31633154 raw_reg_write(regs, GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ | master_ctl);
31643155
3165− gen11_gu_misc_irq_handler(i915, master_ctl, gu_misc_iir);
3156+ gen11_gu_misc_irq_handler(i915, gu_misc_iir);
31663157
31673158 return IRQ_HANDLED;
31683159 }
drivers/gpu/drm/i915/i915_pci.c+0−1
@@ -592,7 +592,6 @@ static const struct intel_device_info intel_cannonlake_info = { · 591 unmodified lines
592592 GEN10_FEATURES, \
593593 GEN(11), \
594594 .ddb_size = 2048, \
595− .has_csr = 0, \
596595 .has_logical_ring_elsq = 1
597596
598597 static const struct intel_device_info intel_icelake_11_info = {
drivers/hid/hid-ids.h+0−1
@@ -976,7 +976,6 @@ · 975 unmodified lines
976976 #define USB_DEVICE_ID_SIS817_TOUCH 0x0817
977977 #define USB_DEVICE_ID_SIS_TS 0x1013
978978 #define USB_DEVICE_ID_SIS1030_TOUCH 0x1030
979−#define USB_DEVICE_ID_SIS10FB_TOUCH 0x10fb
980979
981980 #define USB_VENDOR_ID_SKYCABLE 0x1223
982981 #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07
drivers/hid/i2c-hid/i2c-hid.c+10−17
@@ -47,7 +47,7 @@ · 46 unmodified lines
4747 /* quirks to control the device */
4848 #define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0)
4949 #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1)
50−#define I2C_HID_QUIRK_RESEND_REPORT_DESCR BIT(2)
50+#define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2)
5151
5252 /* flags */
5353 #define I2C_HID_STARTED 0
@@ -169,9 +169,8 @@ static const struct i2c_hid_quirks { · 115 unmodified lines
169169 { USB_VENDOR_ID_WEIDA, USB_DEVICE_ID_WEIDA_8755,
170170 I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },
171171 { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,
172− I2C_HID_QUIRK_NO_IRQ_AFTER_RESET },
173− { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS10FB_TOUCH,
174− I2C_HID_QUIRK_RESEND_REPORT_DESCR },
172+ I2C_HID_QUIRK_NO_IRQ_AFTER_RESET |
173+ I2C_HID_QUIRK_NO_RUNTIME_PM },
175174 { 0, 0 }
176175 };
177176
@@ -1105,7 +1104,9 @@ static int i2c_hid_probe(struct i2c_client *client, · 927 unmodified lines
11051104 goto err_mem_free;
11061105 }
11071106
1108− pm_runtime_put(&client->dev);
1107+ if (!(ihid->quirks & I2C_HID_QUIRK_NO_RUNTIME_PM))
1108+ pm_runtime_put(&client->dev);
1109+
11091110 return 0;
11101111
11111112 err_mem_free:
@@ -1130,7 +1131,8 @@ static int i2c_hid_remove(struct i2c_client *client) · 18 unmodified lines
11301131 struct i2c_hid *ihid = i2c_get_clientdata(client);
11311132 struct hid_device *hid;
11321133
1133− pm_runtime_get_sync(&client->dev);
1134+ if (!(ihid->quirks & I2C_HID_QUIRK_NO_RUNTIME_PM))
1135+ pm_runtime_get_sync(&client->dev);
11341136 pm_runtime_disable(&client->dev);
11351137 pm_runtime_set_suspended(&client->dev);
11361138 pm_runtime_put_noidle(&client->dev);
@@ -1236,22 +1238,13 @@ static int i2c_hid_resume(struct device *dev) · 99 unmodified lines
12361238
12371239 /* Instead of resetting device, simply powers the device on. This
12381240 * solves "incomplete reports" on Raydium devices 2386:3118 and
1239− * 2386:4B33
1241+ * 2386:4B33 and fixes various SIS touchscreens no longer sending
1242+ * data after a suspend/resume.
12401243 */
12411244 ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
12421245 if (ret)
12431246 return ret;
12441247
1245− /* Some devices need to re-send report descr cmd
1246− * after resume, after this it will be back normal.
1247− * otherwise it issues too many incomplete reports.
1248− */
1249− if (ihid->quirks & I2C_HID_QUIRK_RESEND_REPORT_DESCR) {
1250− ret = i2c_hid_command(client, &hid_report_descr_cmd, NULL, 0);
1251− if (ret)
1252− return ret;
1253− }
1254−
12551248 if (hid->driver && hid->driver->reset_resume) {
12561249 ret = hid->driver->reset_resume(hid);
12571250 return ret;
drivers/hid/intel-ish-hid/ipc/hw-ish.h+1−0
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #define CNL_Ax_DEVICE_ID 0x9DFC
3030 #define GLK_Ax_DEVICE_ID 0x31A2
3131 #define CNL_H_DEVICE_ID 0xA37C
32+#define ICL_MOBILE_DEVICE_ID 0x34FC
3233 #define SPT_H_DEVICE_ID 0xA135
3334
3435 #define REVISION_ID_CHT_A0 0x6
drivers/hid/intel-ish-hid/ipc/pci-ish.c+1−0
@@ -38,6 +38,7 @@ static const struct pci_device_id ish_pci_tbl[] = { · 37 unmodified lines
3838 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CNL_Ax_DEVICE_ID)},
3939 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, GLK_Ax_DEVICE_ID)},
4040 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CNL_H_DEVICE_ID)},
41+ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, ICL_MOBILE_DEVICE_ID)},
4142 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, SPT_H_DEVICE_ID)},
4243 {0, }
4344 };
drivers/hv/connection.c+5−3
@@ -76,6 +76,7 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, · 75 unmodified lines
7676 __u32 version)
7777 {
7878 int ret = 0;
79+ unsigned int cur_cpu;
7980 struct vmbus_channel_initiate_contact *msg;
8081 unsigned long flags;
8182
@@ -118,9 +119,10 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, · 36 unmodified lines
118119 * the CPU attempting to connect may not be CPU 0.
119120 */
120121 if (version >= VERSION_WIN8_1) {
121− msg->target_vcpu =
122− hv_cpu_number_to_vp_number(smp_processor_id());
123− vmbus_connection.connect_cpu = smp_processor_id();
122+ cur_cpu = get_cpu();
123+ msg->target_vcpu = hv_cpu_number_to_vp_number(cur_cpu);
124+ vmbus_connection.connect_cpu = cur_cpu;
125+ put_cpu();
124126 } else {
125127 msg->target_vcpu = 0;
126128 vmbus_connection.connect_cpu = 0;
drivers/i2c/busses/i2c-designware-master.c+3−1
@@ -34,11 +34,11 @@ static void i2c_dw_configure_fifo_master(struct dw_i2c_dev *dev) · 33 unmodified lines
3434
3535 static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev)
3636 {
37− u32 ic_clk = i2c_dw_clk_rate(dev);
3837 const char *mode_str, *fp_str = "";
3938 u32 comp_param1;
4039 u32 sda_falling_time, scl_falling_time;
4140 struct i2c_timings *t = &dev->timings;
41+ u32 ic_clk;
4242 int ret;
4343
4444 ret = i2c_dw_acquire_lock(dev);
@@ -53,6 +53,7 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) · 8 unmodified lines
5353
5454 /* Calculate SCL timing parameters for standard mode if not set */
5555 if (!dev->ss_hcnt || !dev->ss_lcnt) {
56+ ic_clk = i2c_dw_clk_rate(dev);
5657 dev->ss_hcnt =
5758 i2c_dw_scl_hcnt(ic_clk,
5859 4000, /* tHD;STA = tHIGH = 4.0 us */
@@ -89,6 +90,7 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) · 30 unmodified lines
8990 * needed also in high speed mode.
9091 */
9192 if (!dev->fs_hcnt || !dev->fs_lcnt) {
93+ ic_clk = i2c_dw_clk_rate(dev);
9294 dev->fs_hcnt =
9395 i2c_dw_scl_hcnt(ic_clk,
9496 600, /* tHD;STA = tHIGH = 0.6 us */
drivers/i2c/busses/i2c-isch.c+1−1
@@ -164,7 +164,7 @@ static s32 sch_access(struct i2c_adapter *adap, u16 addr, · 163 unmodified lines
164164 * run ~75 kHz instead which should do no harm.
165165 */
166166 dev_notice(&sch_adapter.dev,
167− "Clock divider unitialized. Setting defaults\n");
167+ "Clock divider uninitialized. Setting defaults\n");
168168 outw(backbone_speed / (4 * 100), SMBHSTCLK);
169169 }
170170
drivers/i2c/busses/i2c-qcom-geni.c+18−4
@@ -367,20 +367,26 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, · 366 unmodified lines
367367 dma_addr_t rx_dma;
368368 enum geni_se_xfer_mode mode;
369369 unsigned long time_left = XFER_TIMEOUT;
370+ void *dma_buf;
370371
371372 gi2c->cur = msg;
372− mode = msg->len > 32 ? GENI_SE_DMA : GENI_SE_FIFO;
373+ mode = GENI_SE_FIFO;
374+ dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
375+ if (dma_buf)
376+ mode = GENI_SE_DMA;
377+
373378 geni_se_select_mode(&gi2c->se, mode);
374379 writel_relaxed(msg->len, gi2c->se.base + SE_I2C_RX_TRANS_LEN);
375380 geni_se_setup_m_cmd(&gi2c->se, I2C_READ, m_param);
376381 if (mode == GENI_SE_DMA) {
377382 int ret;
378383
379− ret = geni_se_rx_dma_prep(&gi2c->se, msg->buf, msg->len,
384+ ret = geni_se_rx_dma_prep(&gi2c->se, dma_buf, msg->len,
380385 &rx_dma);
381386 if (ret) {
382387 mode = GENI_SE_FIFO;
383388 geni_se_select_mode(&gi2c->se, mode);
389+ i2c_put_dma_safe_msg_buf(dma_buf, msg, false);
384390 }
385391 }
386392
@@ -393,6 +399,7 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, · 6 unmodified lines
393399 if (gi2c->err)
394400 geni_i2c_rx_fsm_rst(gi2c);
395401 geni_se_rx_dma_unprep(&gi2c->se, rx_dma, msg->len);
402+ i2c_put_dma_safe_msg_buf(dma_buf, msg, !gi2c->err);
396403 }
397404 return gi2c->err;
398405 }
@@ -403,20 +410,26 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, · 4 unmodified lines
403410 dma_addr_t tx_dma;
404411 enum geni_se_xfer_mode mode;
405412 unsigned long time_left;
413+ void *dma_buf;
406414
407415 gi2c->cur = msg;
408− mode = msg->len > 32 ? GENI_SE_DMA : GENI_SE_FIFO;
416+ mode = GENI_SE_FIFO;
417+ dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
418+ if (dma_buf)
419+ mode = GENI_SE_DMA;
420+
409421 geni_se_select_mode(&gi2c->se, mode);
410422 writel_relaxed(msg->len, gi2c->se.base + SE_I2C_TX_TRANS_LEN);
411423 geni_se_setup_m_cmd(&gi2c->se, I2C_WRITE, m_param);
412424 if (mode == GENI_SE_DMA) {
413425 int ret;
414426
415− ret = geni_se_tx_dma_prep(&gi2c->se, msg->buf, msg->len,
427+ ret = geni_se_tx_dma_prep(&gi2c->se, dma_buf, msg->len,
416428 &tx_dma);
417429 if (ret) {
418430 mode = GENI_SE_FIFO;
419431 geni_se_select_mode(&gi2c->se, mode);
432+ i2c_put_dma_safe_msg_buf(dma_buf, msg, false);
420433 }
421434 }
422435
@@ -432,6 +445,7 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, · 9 unmodified lines
432445 if (gi2c->err)
433446 geni_i2c_tx_fsm_rst(gi2c);
434447 geni_se_tx_dma_unprep(&gi2c->se, tx_dma, msg->len);
448+ i2c_put_dma_safe_msg_buf(dma_buf, msg, !gi2c->err);
435449 }
436450 return gi2c->err;
437451 }
drivers/i2c/busses/i2c-scmi.c+1−0
@@ -152,6 +152,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags, · 151 unmodified lines
152152 mt_params[3].type = ACPI_TYPE_INTEGER;
153153 mt_params[3].integer.value = len;
154154 mt_params[4].type = ACPI_TYPE_BUFFER;
155+ mt_params[4].buffer.length = len;
155156 mt_params[4].buffer.pointer = data->block + 1;
156157 }
157158 break;
drivers/iommu/amd_iommu.c+1−1
@@ -3069,7 +3069,7 @@ static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom, · 3068 unmodified lines
30693069 return 0;
30703070
30713071 offset_mask = pte_pgsize - 1;
3072− __pte = *pte & PM_ADDR_MASK;
3072+ __pte = __sme_clr(*pte & PM_ADDR_MASK);
30733073
30743074 return (__pte & ~offset_mask) | (iova & offset_mask);
30753075 }
drivers/md/dm-cache-metadata.c+2−2
@@ -1455,8 +1455,8 @@ static int __load_mappings(struct dm_cache_metadata *cmd, · 1454 unmodified lines
14551455 if (hints_valid) {
14561456 r = dm_array_cursor_next(&cmd->hint_cursor);
14571457 if (r) {
1458− DMERR("dm_array_cursor_next for hint failed");
1459− goto out;
1458+ dm_array_cursor_end(&cmd->hint_cursor);
1459+ hints_valid = false;
14601460 }
14611461 }
14621462
drivers/md/dm-cache-target.c+7−2
@@ -3009,8 +3009,13 @@ static dm_cblock_t get_cache_dev_size(struct cache *cache) · 3008 unmodified lines
30093009
30103010 static bool can_resize(struct cache *cache, dm_cblock_t new_size)
30113011 {
3012− if (from_cblock(new_size) > from_cblock(cache->cache_size))
3013− return true;
3012+ if (from_cblock(new_size) > from_cblock(cache->cache_size)) {
3013+ if (cache->sized) {
3014+ DMERR("%s: unable to extend cache due to missing cache table reload",
3015+ cache_device_name(cache));
3016+ return false;
3017+ }
3018+ }
30143019
30153020 /*
30163021 * We can't drop a dirty block when shrinking the cache.
drivers/md/dm-mpath.c+8−6
@@ -806,19 +806,19 @@ static int parse_path_selector(struct dm_arg_set *as, struct priority_group *pg, · 805 unmodified lines
806806 }
807807
808808 static int setup_scsi_dh(struct block_device *bdev, struct multipath *m,
809− const char *attached_handler_name, char **error)
809+ const char **attached_handler_name, char **error)
810810 {
811811 struct request_queue *q = bdev_get_queue(bdev);
812812 int r;
813813
814814 if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)) {
815815 retain:
816− if (attached_handler_name) {
816+ if (*attached_handler_name) {
817817 /*
818818 * Clear any hw_handler_params associated with a
819819 * handler that isn't already attached.
820820 */
821− if (m->hw_handler_name && strcmp(attached_handler_name, m->hw_handler_name)) {
821+ if (m->hw_handler_name && strcmp(*attached_handler_name, m->hw_handler_name)) {
822822 kfree(m->hw_handler_params);
823823 m->hw_handler_params = NULL;
824824 }
@@ -830,7 +830,8 @@ retain: · 5 unmodified lines
830830 * handler instead of the original table passed in.
831831 */
832832 kfree(m->hw_handler_name);
833− m->hw_handler_name = attached_handler_name;
833+ m->hw_handler_name = *attached_handler_name;
834+ *attached_handler_name = NULL;
834835 }
835836 }
836837
@@ -867,7 +868,7 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps · 30 unmodified lines
867868 struct pgpath *p;
868869 struct multipath *m = ti->private;
869870 struct request_queue *q;
870− const char *attached_handler_name;
871+ const char *attached_handler_name = NULL;
871872
872873 /* we need at least a path arg */
873874 if (as->argc < 1) {
@@ -890,7 +891,7 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps · 16 unmodified lines
890891 attached_handler_name = scsi_dh_attached_handler_name(q, GFP_KERNEL);
891892 if (attached_handler_name || m->hw_handler_name) {
892893 INIT_DELAYED_WORK(&p->activate_path, activate_path_work);
893− r = setup_scsi_dh(p->path.dev->bdev, m, attached_handler_name, &ti->error);
894+ r = setup_scsi_dh(p->path.dev->bdev, m, &attached_handler_name, &ti->error);
894895 if (r) {
895896 dm_put_device(ti, p->path.dev);
896897 goto bad;
@@ -905,6 +906,7 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps · 8 unmodified lines
905906
906907 return p;
907908 bad:
909+ kfree(attached_handler_name);
908910 free_pgpath(p);
909911 return ERR_PTR(r);
910912 }
drivers/md/dm-raid.c+1−1
@@ -3353,7 +3353,7 @@ static const char *sync_str(enum sync_state state) · 3352 unmodified lines
33533353 };
33543354
33553355 /* Return enum sync_state for @mddev derived from @recovery flags */
3356−static const enum sync_state decipher_sync_action(struct mddev *mddev, unsigned long recovery)
3356+static enum sync_state decipher_sync_action(struct mddev *mddev, unsigned long recovery)
33573357 {
33583358 if (test_bit(MD_RECOVERY_FROZEN, &recovery))
33593359 return st_frozen;
drivers/md/dm-thin-metadata.c+2−4
@@ -832,10 +832,8 @@ static void __set_metadata_reserve(struct dm_pool_metadata *pmd) · 831 unmodified lines
832832 if (r) {
833833 DMERR("could not get size of metadata device");
834834 pmd->metadata_reserve = max_blocks;
835− } else {
836− sector_div(total, 10);
837− pmd->metadata_reserve = min(max_blocks, total);
838− }
835+ } else
836+ pmd->metadata_reserve = min(max_blocks, div_u64(total, 10));
839837 }
840838
841839 struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev,
drivers/media/v4l2-core/v4l2-event.c+20−18
@@ -115,14 +115,6 @@ static void __v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *e · 114 unmodified lines
115115 if (sev == NULL)
116116 return;
117117
118− /*
119− * If the event has been added to the fh->subscribed list, but its
120− * add op has not completed yet elems will be 0, treat this as
121− * not being subscribed.
122− */
123− if (!sev->elems)
124− return;
125−
126118 /* Increase event sequence number on fh. */
127119 fh->sequence++;
128120
@@ -208,6 +200,7 @@ int v4l2_event_subscribe(struct v4l2_fh *fh, · 79 unmodified lines
208200 struct v4l2_subscribed_event *sev, *found_ev;
209201 unsigned long flags;
210202 unsigned i;
203+ int ret = 0;
211204
212205 if (sub->type == V4L2_EVENT_ALL)
213206 return -EINVAL;
@@ -225,31 +218,36 @@ int v4l2_event_subscribe(struct v4l2_fh *fh, · 11 unmodified lines
225218 sev->flags = sub->flags;
226219 sev->fh = fh;
227220 sev->ops = ops;
221+ sev->elems = elems;
222+
223+ mutex_lock(&fh->subscribe_lock);
228224
229225 spin_lock_irqsave(&fh->vdev->fh_lock, flags);
230226 found_ev = v4l2_event_subscribed(fh, sub->type, sub->id);
231− if (!found_ev)
232− list_add(&sev->list, &fh->subscribed);
233227 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
234228
235229 if (found_ev) {
230+ /* Already listening */
236231 kvfree(sev);
237− return 0; /* Already listening */
232+ goto out_unlock;
238233 }
239234
240235 if (sev->ops && sev->ops->add) {
241− int ret = sev->ops->add(sev, elems);
236+ ret = sev->ops->add(sev, elems);
242237 if (ret) {
243− sev->ops = NULL;
244− v4l2_event_unsubscribe(fh, sub);
245− return ret;
238+ kvfree(sev);
239+ goto out_unlock;
246240 }
247241 }
248242
249− /* Mark as ready for use */
250− sev->elems = elems;
243+ spin_lock_irqsave(&fh->vdev->fh_lock, flags);
244+ list_add(&sev->list, &fh->subscribed);
245+ spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
251246
252− return 0;
247+out_unlock:
248+ mutex_unlock(&fh->subscribe_lock);
249+
250+ return ret;
253251 }
254252 EXPORT_SYMBOL_GPL(v4l2_event_subscribe);
255253
@@ -288,6 +286,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh, · 32 unmodified lines
288286 return 0;
289287 }
290288
289+ mutex_lock(&fh->subscribe_lock);
290+
291291 spin_lock_irqsave(&fh->vdev->fh_lock, flags);
292292
293293 sev = v4l2_event_subscribed(fh, sub->type, sub->id);
@@ -305,6 +305,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh, · 11 unmodified lines
305305 if (sev && sev->ops && sev->ops->del)
306306 sev->ops->del(sev);
307307
308+ mutex_unlock(&fh->subscribe_lock);
309+
308310 kvfree(sev);
309311
310312 return 0;
drivers/media/v4l2-core/v4l2-fh.c+2−0
@@ -45,6 +45,7 @@ void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev) · 44 unmodified lines
4545 INIT_LIST_HEAD(&fh->available);
4646 INIT_LIST_HEAD(&fh->subscribed);
4747 fh->sequence = -1;
48+ mutex_init(&fh->subscribe_lock);
4849 }
4950 EXPORT_SYMBOL_GPL(v4l2_fh_init);
5051
@@ -90,6 +91,7 @@ void v4l2_fh_exit(struct v4l2_fh *fh) · 39 unmodified lines
9091 return;
9192 v4l_disable_media_source(fh->vdev);
9293 v4l2_event_unsubscribe_all(fh);
94+ mutex_destroy(&fh->subscribe_lock);
9395 fh->vdev = NULL;
9496 }
9597 EXPORT_SYMBOL_GPL(v4l2_fh_exit);
drivers/mmc/core/host.c+1−1
@@ -235,7 +235,7 @@ int mmc_of_parse(struct mmc_host *host) · 234 unmodified lines
235235 host->caps |= MMC_CAP_NEEDS_POLL;
236236
237237 ret = mmc_gpiod_request_cd(host, "cd", 0, true,
238− cd_debounce_delay_ms,
238+ cd_debounce_delay_ms * 1000,
239239 &cd_gpio_invert);
240240 if (!ret)
241241 dev_info(host->parent, "Got CD GPIO\n");
drivers/mmc/core/slot-gpio.c+1−1
@@ -271,7 +271,7 @@ int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id, · 270 unmodified lines
271271 if (debounce) {
272272 ret = gpiod_set_debounce(desc, debounce);
273273 if (ret < 0)
274− ctx->cd_debounce_delay_ms = debounce;
274+ ctx->cd_debounce_delay_ms = debounce / 1000;
275275 }
276276
277277 if (gpio_invert)
drivers/mmc/host/renesas_sdhi_sys_dmac.c+2−1
@@ -498,7 +498,8 @@ static const struct soc_device_attribute gen3_soc_whitelist[] = { · 497 unmodified lines
498498
499499 static int renesas_sdhi_sys_dmac_probe(struct platform_device *pdev)
500500 {
501− if (of_device_get_match_data(&pdev->dev) == &of_rcar_gen3_compatible &&
501+ if ((of_device_get_match_data(&pdev->dev) == &of_rcar_gen3_compatible ||
502+ of_device_get_match_data(&pdev->dev) == &of_rcar_r8a7795_compatible) &&
502503 !soc_device_match(gen3_soc_whitelist))
503504 return -ENODEV;
504505
drivers/net/bonding/bond_main.c+37−28
@@ -210,6 +210,7 @@ static void bond_get_stats(struct net_device *bond_dev, · 209 unmodified lines
210210 static void bond_slave_arr_handler(struct work_struct *work);
211211 static bool bond_time_in_interval(struct bonding *bond, unsigned long last_act,
212212 int mod);
213+static void bond_netdev_notify_work(struct work_struct *work);
213214
214215 /*---------------------------- General routines -----------------------------*/
215216
@@ -1170,9 +1171,27 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) · 954 unmodified lines
11701171 }
11711172 }
11721173
1173− /* don't change skb->dev for link-local packets */
1174− if (is_link_local_ether_addr(eth_hdr(skb)->h_dest))
1174+ /* Link-local multicast packets should be passed to the
1175+ * stack on the link they arrive as well as pass them to the
1176+ * bond-master device. These packets are mostly usable when
1177+ * stack receives it with the link on which they arrive
1178+ * (e.g. LLDP) they also must be available on master. Some of
1179+ * the use cases include (but are not limited to): LLDP agents
1180+ * that must be able to operate both on enslaved interfaces as
1181+ * well as on bonds themselves; linux bridges that must be able
1182+ * to process/pass BPDUs from attached bonds when any kind of
1183+ * STP version is enabled on the network.
1184+ */
1185+ if (is_link_local_ether_addr(eth_hdr(skb)->h_dest)) {
1186+ struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
1187+
1188+ if (nskb) {
1189+ nskb->dev = bond->dev;
1190+ nskb->queue_mapping = 0;
1191+ netif_rx(nskb);
1192+ }
11751193 return RX_HANDLER_PASS;
1194+ }
11761195 if (bond_should_deliver_exact_match(skb, slave, bond))
11771196 return RX_HANDLER_EXACT;
11781197
@@ -1269,6 +1288,8 @@ static struct slave *bond_alloc_slave(struct bonding *bond) · 90 unmodified lines
12691288 return NULL;
12701289 }
12711290 }
1291+ INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work);
1292+
12721293 return slave;
12731294 }
12741295
@@ -1276,6 +1297,7 @@ static void bond_free_slave(struct slave *slave) · 1 unmodified line
12761297 {
12771298 struct bonding *bond = bond_get_bond_by_slave(slave);
12781299
1300+ cancel_delayed_work_sync(&slave->notify_work);
12791301 if (BOND_MODE(bond) == BOND_MODE_8023AD)
12801302 kfree(SLAVE_AD_INFO(slave));
12811303
@@ -1297,39 +1319,26 @@ static void bond_fill_ifslave(struct slave *slave, struct ifslave *info) · 15 unmodified lines
12971319 info->link_failure_count = slave->link_failure_count;
12981320 }
12991321
1300−static void bond_netdev_notify(struct net_device *dev,
1301− struct netdev_bonding_info *info)
1302−{
1303− rtnl_lock();
1304− netdev_bonding_info_change(dev, info);
1305− rtnl_unlock();
1306−}
1307−
13081322 static void bond_netdev_notify_work(struct work_struct *_work)
13091323 {
1310− struct netdev_notify_work *w =
1311− container_of(_work, struct netdev_notify_work, work.work);
1324+ struct slave *slave = container_of(_work, struct slave,
1325+ notify_work.work);
1326+
1327+ if (rtnl_trylock()) {
1328+ struct netdev_bonding_info binfo;
13121329
1313− bond_netdev_notify(w->dev, &w->bonding_info);
1314− dev_put(w->dev);
1315− kfree(w);
1330+ bond_fill_ifslave(slave, &binfo.slave);
1331+ bond_fill_ifbond(slave->bond, &binfo.master);
1332+ netdev_bonding_info_change(slave->dev, &binfo);
1333+ rtnl_unlock();
1334+ } else {
1335+ queue_delayed_work(slave->bond->wq, &slave->notify_work, 1);
1336+ }
13161337 }
13171338
13181339 void bond_queue_slave_event(struct slave *slave)
13191340 {
1320− struct bonding *bond = slave->bond;
1321− struct netdev_notify_work *nnw = kzalloc(sizeof(*nnw), GFP_ATOMIC);
1322−
1323− if (!nnw)
1324− return;
1325−
1326− dev_hold(slave->dev);
1327− nnw->dev = slave->dev;
1328− bond_fill_ifslave(slave, &nnw->bonding_info.slave);
1329− bond_fill_ifbond(bond, &nnw->bonding_info.master);
1330− INIT_DELAYED_WORK(&nnw->work, bond_netdev_notify_work);
1331−
1332− queue_delayed_work(slave->bond->wq, &nnw->work, 0);
1341+ queue_delayed_work(slave->bond->wq, &slave->notify_work, 0);
13331342 }
13341343
13351344 void bond_lower_state_changed(struct slave *slave)
drivers/net/dsa/b53/b53_common.c+2−2
@@ -1107,7 +1107,7 @@ void b53_vlan_add(struct dsa_switch *ds, int port, · 1106 unmodified lines
11071107 b53_get_vlan_entry(dev, vid, vl);
11081108
11091109 vl->members |= BIT(port);
1110− if (untagged)
1110+ if (untagged && !dsa_is_cpu_port(ds, port))
11111111 vl->untag |= BIT(port);
11121112 else
11131113 vl->untag &= ~BIT(port);
@@ -1149,7 +1149,7 @@ int b53_vlan_del(struct dsa_switch *ds, int port, · 35 unmodified lines
11491149 pvid = 0;
11501150 }
11511151
1152− if (untagged)
1152+ if (untagged && !dsa_is_cpu_port(ds, port))
11531153 vl->untag &= ~(BIT(port));
11541154
11551155 b53_set_vlan_entry(dev, vid, vl);
drivers/net/ethernet/amazon/ena/ena_netdev.c+0−22
@@ -2185,25 +2185,6 @@ error_drop_packet: · 2184 unmodified lines
21852185 return NETDEV_TX_OK;
21862186 }
21872187
2188−#ifdef CONFIG_NET_POLL_CONTROLLER
2189−static void ena_netpoll(struct net_device *netdev)
2190−{
2191− struct ena_adapter *adapter = netdev_priv(netdev);
2192− int i;
2193−
2194− /* Dont schedule NAPI if the driver is in the middle of reset
2195− * or netdev is down.
2196− */
2197−
2198− if (!test_bit(ENA_FLAG_DEV_UP, &adapter->flags) ||
2199− test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))
2200− return;
2201−
2202− for (i = 0; i < adapter->num_queues; i++)
2203− napi_schedule(&adapter->ena_napi[i].napi);
2204−}
2205−#endif /* CONFIG_NET_POLL_CONTROLLER */
2206−
22072188 static u16 ena_select_queue(struct net_device *dev, struct sk_buff *skb,
22082189 struct net_device *sb_dev,
22092190 select_queue_fallback_t fallback)
@@ -2369,9 +2350,6 @@ static const struct net_device_ops ena_netdev_ops = { · 159 unmodified lines
23692350 .ndo_change_mtu = ena_change_mtu,
23702351 .ndo_set_mac_address = NULL,
23712352 .ndo_validate_addr = eth_validate_addr,
2372−#ifdef CONFIG_NET_POLL_CONTROLLER
2373− .ndo_poll_controller = ena_netpoll,
2374−#endif /* CONFIG_NET_POLL_CONTROLLER */
23752353 };
23762354
23772355 static int ena_device_validate_params(struct ena_adapter *adapter,
drivers/net/ethernet/amd/declance.c+6−4
@@ -1031,6 +1031,7 @@ static int dec_lance_probe(struct device *bdev, const int type) · 1030 unmodified lines
10311031 int i, ret;
10321032 unsigned long esar_base;
10331033 unsigned char *esar;
1034+ const char *desc;
10341035
10351036 if (dec_lance_debug && version_printed++ == 0)
10361037 printk(version);
@@ -1216,19 +1217,20 @@ static int dec_lance_probe(struct device *bdev, const int type) · 179 unmodified lines
12161217 */
12171218 switch (type) {
12181219 case ASIC_LANCE:
1219− printk("%s: IOASIC onboard LANCE", name);
1220+ desc = "IOASIC onboard LANCE";
12201221 break;
12211222 case PMAD_LANCE:
1222− printk("%s: PMAD-AA", name);
1223+ desc = "PMAD-AA";
12231224 break;
12241225 case PMAX_LANCE:
1225− printk("%s: PMAX onboard LANCE", name);
1226+ desc = "PMAX onboard LANCE";
12261227 break;
12271228 }
12281229 for (i = 0; i < 6; i++)
12291230 dev->dev_addr[i] = esar[i * 4];
12301231
1231− printk(", addr = %pM, irq = %d\n", dev->dev_addr, dev->irq);
1232+ printk("%s: %s, addr = %pM, irq = %d\n",
1233+ name, desc, dev->dev_addr, dev->irq);
12321234
12331235 dev->netdev_ops = &lance_netdev_ops;
12341236 dev->watchdog_timeo = 5*HZ;
drivers/net/ethernet/broadcom/bcmsysport.c+11−17
@@ -1069,9 +1069,6 @@ static void bcm_sysport_resume_from_wol(struct bcm_sysport_priv *priv) · 1068 unmodified lines
10691069 {
10701070 u32 reg;
10711071
1072− /* Stop monitoring MPD interrupt */
1073− intrl2_0_mask_set(priv, INTRL2_0_MPD | INTRL2_0_BRCM_MATCH_TAG);
1074−
10751072 /* Disable RXCHK, active filters and Broadcom tag matching */
10761073 reg = rxchk_readl(priv, RXCHK_CONTROL);
10771074 reg &= ~(RXCHK_BRCM_TAG_MATCH_MASK <<
@@ -1081,6 +1078,17 @@ static void bcm_sysport_resume_from_wol(struct bcm_sysport_priv *priv) · 3 unmodified lines
10811078 /* Clear the MagicPacket detection logic */
10821079 mpd_enable_set(priv, false);
10831080
1081+ reg = intrl2_0_readl(priv, INTRL2_CPU_STATUS);
1082+ if (reg & INTRL2_0_MPD)
1083+ netdev_info(priv->netdev, "Wake-on-LAN (MPD) interrupt!\n");
1084+
1085+ if (reg & INTRL2_0_BRCM_MATCH_TAG) {
1086+ reg = rxchk_readl(priv, RXCHK_BRCM_TAG_MATCH_STATUS) &
1087+ RXCHK_BRCM_TAG_MATCH_MASK;
1088+ netdev_info(priv->netdev,
1089+ "Wake-on-LAN (filters 0x%02x) interrupt!\n", reg);
1090+ }
1091+
10841092 netif_dbg(priv, wol, priv->netdev, "resumed from WOL\n");
10851093 }
10861094
@@ -1105,7 +1113,6 @@ static irqreturn_t bcm_sysport_rx_isr(int irq, void *dev_id) · 18 unmodified lines
11051113 struct bcm_sysport_priv *priv = netdev_priv(dev);
11061114 struct bcm_sysport_tx_ring *txr;
11071115 unsigned int ring, ring_bit;
1108− u32 reg;
11091116
11101117 priv->irq0_stat = intrl2_0_readl(priv, INTRL2_CPU_STATUS) &
11111118 ~intrl2_0_readl(priv, INTRL2_CPU_MASK_STATUS);
@@ -1131,16 +1138,6 @@ static irqreturn_t bcm_sysport_rx_isr(int irq, void *dev_id) · 19 unmodified lines
11311138 if (priv->irq0_stat & INTRL2_0_TX_RING_FULL)
11321139 bcm_sysport_tx_reclaim_all(priv);
11331140
1134− if (priv->irq0_stat & INTRL2_0_MPD)
1135− netdev_info(priv->netdev, "Wake-on-LAN (MPD) interrupt!\n");
1136−
1137− if (priv->irq0_stat & INTRL2_0_BRCM_MATCH_TAG) {
1138− reg = rxchk_readl(priv, RXCHK_BRCM_TAG_MATCH_STATUS) &
1139− RXCHK_BRCM_TAG_MATCH_MASK;
1140− netdev_info(priv->netdev,
1141− "Wake-on-LAN (filters 0x%02x) interrupt!\n", reg);
1142− }
1143−
11441141 if (!priv->is_lite)
11451142 goto out;
11461143
@@ -2641,9 +2638,6 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv) · 1494 unmodified lines
26412638 /* UniMAC receive needs to be turned on */
26422639 umac_enable_set(priv, CMD_RX_EN, 1);
26432640
2644− /* Enable the interrupt wake-up source */
2645− intrl2_0_mask_clear(priv, INTRL2_0_MPD | INTRL2_0_BRCM_MATCH_TAG);
2646−
26472641 netif_dbg(priv, wol, ndev, "entered WOL mode\n");
26482642
26492643 return 0;
drivers/net/ethernet/broadcom/bnxt/bnxt.c+18−9
@@ -1884,8 +1884,11 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) · 1883 unmodified lines
18841884 if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) {
18851885 tx_pkts++;
18861886 /* return full budget so NAPI will complete. */
1887− if (unlikely(tx_pkts > bp->tx_wake_thresh))
1887+ if (unlikely(tx_pkts > bp->tx_wake_thresh)) {
18881888 rx_pkts = budget;
1889+ raw_cons = NEXT_RAW_CMP(raw_cons);
1890+ break;
1891+ }
18891892 } else if ((TX_CMP_TYPE(txcmp) & 0x30) == 0x10) {
18901893 if (likely(budget))
18911894 rc = bnxt_rx_pkt(bp, bnapi, &raw_cons, &event);
@@ -1913,7 +1916,7 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) · 21 unmodified lines
19131916 }
19141917 raw_cons = NEXT_RAW_CMP(raw_cons);
19151918
1916− if (rx_pkts == budget)
1919+ if (rx_pkts && rx_pkts == budget)
19171920 break;
19181921 }
19191922
@@ -2027,8 +2030,12 @@ static int bnxt_poll(struct napi_struct *napi, int budget) · 107 unmodified lines
20272030 while (1) {
20282031 work_done += bnxt_poll_work(bp, bnapi, budget - work_done);
20292032
2030− if (work_done >= budget)
2033+ if (work_done >= budget) {
2034+ if (!budget)
2035+ BNXT_CP_DB_REARM(cpr->cp_doorbell,
2036+ cpr->cp_raw_cons);
20312037 break;
2038+ }
20322039
20332040 if (!bnxt_has_work(bp, cpr)) {
20342041 if (napi_complete_done(napi, work_done))
@@ -3010,10 +3017,11 @@ static void bnxt_free_hwrm_resources(struct bnxt *bp) · 975 unmodified lines
30103017 {
30113018 struct pci_dev *pdev = bp->pdev;
30123019
3013− dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr,
3014− bp->hwrm_cmd_resp_dma_addr);
3015−
3016− bp->hwrm_cmd_resp_addr = NULL;
3020+ if (bp->hwrm_cmd_resp_addr) {
3021+ dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr,
3022+ bp->hwrm_cmd_resp_dma_addr);
3023+ bp->hwrm_cmd_resp_addr = NULL;
3024+ }
30173025 }
30183026
30193027 static int bnxt_alloc_hwrm_resources(struct bnxt *bp)
@@ -4643,7 +4651,7 @@ __bnxt_hwrm_reserve_pf_rings(struct bnxt *bp, struct hwrm_func_cfg_input *req, · 1623 unmodified lines
46434651 FUNC_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0;
46444652 enables |= ring_grps ?
46454653 FUNC_CFG_REQ_ENABLES_NUM_HW_RING_GRPS : 0;
4646− enables |= vnics ? FUNC_VF_CFG_REQ_ENABLES_NUM_VNICS : 0;
4654+ enables |= vnics ? FUNC_CFG_REQ_ENABLES_NUM_VNICS : 0;
46474655
46484656 req->num_rx_rings = cpu_to_le16(rx_rings);
46494657 req->num_hw_ring_grps = cpu_to_le16(ring_grps);
@@ -8614,7 +8622,7 @@ static void _bnxt_get_max_rings(struct bnxt *bp, int *max_rx, int *max_tx, · 3964 unmodified lines
86148622 *max_tx = hw_resc->max_tx_rings;
86158623 *max_rx = hw_resc->max_rx_rings;
86168624 *max_cp = min_t(int, bnxt_get_max_func_cp_rings_for_en(bp),
8617− hw_resc->max_irqs);
8625+ hw_resc->max_irqs - bnxt_get_ulp_msix_num(bp));
86188626 *max_cp = min_t(int, *max_cp, hw_resc->max_stat_ctxs);
86198627 max_ring_grps = hw_resc->max_hw_ring_grps;
86208628 if (BNXT_CHIP_TYPE_NITRO_A0(bp) && BNXT_PF(bp)) {
@@ -9050,6 +9058,7 @@ init_err_cleanup_tc: · 429 unmodified lines
90509058 bnxt_clear_int_mode(bp);
90519059
90529060 init_err_pci_clean:
9061+ bnxt_free_hwrm_resources(bp);
90539062 bnxt_cleanup_pci(bp);
90549063
90559064 init_err_free:
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c+3−3
@@ -98,13 +98,13 @@ static int bnxt_hwrm_queue_cos2bw_cfg(struct bnxt *bp, struct ieee_ets *ets, · 97 unmodified lines
9898
9999 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_QUEUE_COS2BW_CFG, -1, -1);
100100 for (i = 0; i < max_tc; i++) {
101− u8 qidx;
101+ u8 qidx = bp->tc_to_qidx[i];
102102
103103 req.enables |= cpu_to_le32(
104− QUEUE_COS2BW_CFG_REQ_ENABLES_COS_QUEUE_ID0_VALID << i);
104+ QUEUE_COS2BW_CFG_REQ_ENABLES_COS_QUEUE_ID0_VALID <<
105+ qidx);
105106
106107 memset(&cos2bw, 0, sizeof(cos2bw));
107− qidx = bp->tc_to_qidx[i];
108108 cos2bw.queue_id = bp->q_info[qidx].queue_id;
109109 if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_STRICT) {
110110 cos2bw.tsa =
drivers/net/ethernet/cadence/macb_main.c+1−0
@@ -2160,6 +2160,7 @@ static void macb_configure_dma(struct macb *bp) · 2159 unmodified lines
21602160 else
21612161 dmacfg &= ~GEM_BIT(TXCOEN);
21622162
2163+ dmacfg &= ~GEM_BIT(ADDR64);
21632164 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
21642165 if (bp->hw_dma_cap & HW_DMA_CAP_64B)
21652166 dmacfg |= GEM_BIT(ADDR64);
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c+17−0
@@ -2159,6 +2159,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) · 2158 unmodified lines
21592159 return -EPERM;
21602160 if (copy_from_user(&t, useraddr, sizeof(t)))
21612161 return -EFAULT;
2162+ if (t.cmd != CHELSIO_SET_QSET_PARAMS)
2163+ return -EINVAL;
21622164 if (t.qset_idx >= SGE_QSETS)
21632165 return -EINVAL;
21642166 if (!in_range(t.intr_lat, 0, M_NEWTIMER) ||
@@ -2258,6 +2260,9 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) · 93 unmodified lines
22582260 if (copy_from_user(&t, useraddr, sizeof(t)))
22592261 return -EFAULT;
22602262
2263+ if (t.cmd != CHELSIO_GET_QSET_PARAMS)
2264+ return -EINVAL;
2265+
22612266 /* Display qsets for all ports when offload enabled */
22622267 if (test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map)) {
22632268 q1 = 0;
@@ -2303,6 +2308,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) · 39 unmodified lines
23032308 return -EBUSY;
23042309 if (copy_from_user(&edata, useraddr, sizeof(edata)))
23052310 return -EFAULT;
2311+ if (edata.cmd != CHELSIO_SET_QSET_NUM)
2312+ return -EINVAL;
23062313 if (edata.val < 1 ||
23072314 (edata.val > 1 && !(adapter->flags & USING_MSIX)))
23082315 return -EINVAL;
@@ -2343,6 +2350,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) · 34 unmodified lines
23432350 return -EPERM;
23442351 if (copy_from_user(&t, useraddr, sizeof(t)))
23452352 return -EFAULT;
2353+ if (t.cmd != CHELSIO_LOAD_FW)
2354+ return -EINVAL;
23462355 /* Check t.len sanity ? */
23472356 fw_data = memdup_user(useraddr + sizeof(t), t.len);
23482357 if (IS_ERR(fw_data))
@@ -2366,6 +2375,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) · 17 unmodified lines
23662375 return -EBUSY;
23672376 if (copy_from_user(&m, useraddr, sizeof(m)))
23682377 return -EFAULT;
2378+ if (m.cmd != CHELSIO_SETMTUTAB)
2379+ return -EINVAL;
23692380 if (m.nmtus != NMTUS)
23702381 return -EINVAL;
23712382 if (m.mtus[0] < 81) /* accommodate SACK */
@@ -2407,6 +2418,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) · 35 unmodified lines
24072418 return -EBUSY;
24082419 if (copy_from_user(&m, useraddr, sizeof(m)))
24092420 return -EFAULT;
2421+ if (m.cmd != CHELSIO_SET_PM)
2422+ return -EINVAL;
24102423 if (!is_power_of_2(m.rx_pg_sz) ||
24112424 !is_power_of_2(m.tx_pg_sz))
24122425 return -EINVAL; /* not power of 2 */
@@ -2440,6 +2453,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) · 27 unmodified lines
24402453 return -EIO; /* need the memory controllers */
24412454 if (copy_from_user(&t, useraddr, sizeof(t)))
24422455 return -EFAULT;
2456+ if (t.cmd != CHELSIO_GET_MEM)
2457+ return -EINVAL;
24432458 if ((t.addr & 7) || (t.len & 7))
24442459 return -EINVAL;
24452460 if (t.mem_id == MEM_CM)
@@ -2492,6 +2507,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) · 46 unmodified lines
24922507 return -EAGAIN;
24932508 if (copy_from_user(&t, useraddr, sizeof(t)))
24942509 return -EFAULT;
2510+ if (t.cmd != CHELSIO_SET_TRACE_FILTER)
2511+ return -EINVAL;
24952512
24962513 tp = (const struct trace_params *)&t.sip;
24972514 if (t.config_tx)
drivers/net/ethernet/emulex/benet/be_main.c+1−4
@@ -4002,8 +4002,6 @@ static int be_enable_vxlan_offloads(struct be_adapter *adapter) · 4001 unmodified lines
40024002 netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
40034003 NETIF_F_TSO | NETIF_F_TSO6 |
40044004 NETIF_F_GSO_UDP_TUNNEL;
4005− netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
4006− netdev->features |= NETIF_F_GSO_UDP_TUNNEL;
40074005
40084006 dev_info(dev, "Enabled VxLAN offloads for UDP port %d\n",
40094007 be16_to_cpu(port));
@@ -4025,8 +4023,6 @@ static void be_disable_vxlan_offloads(struct be_adapter *adapter) · 15 unmodified lines
40254023 adapter->vxlan_port = 0;
40264024
40274025 netdev->hw_enc_features = 0;
4028− netdev->hw_features &= ~(NETIF_F_GSO_UDP_TUNNEL);
4029− netdev->features &= ~(NETIF_F_GSO_UDP_TUNNEL);
40304026 }
40314027
40324028 static void be_calculate_vf_res(struct be_adapter *adapter, u16 num_vfs,
@@ -5320,6 +5316,7 @@ static void be_netdev_init(struct net_device *netdev) · 1287 unmodified lines
53205316 struct be_adapter *adapter = netdev_priv(netdev);
53215317
53225318 netdev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 |
5319+ NETIF_F_GSO_UDP_TUNNEL |
53235320 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM |
53245321 NETIF_F_HW_VLAN_CTAG_TX;
53255322 if ((be_if_cap_flags(adapter) & BE_IF_FLAGS_RSS))
drivers/net/ethernet/freescale/fec_main.c+4−4
@@ -1158,7 +1158,7 @@ static void fec_enet_timeout_work(struct work_struct *work) · 1157 unmodified lines
11581158 napi_disable(&fep->napi);
11591159 netif_tx_lock_bh(ndev);
11601160 fec_restart(ndev);
1161− netif_wake_queue(ndev);
1161+ netif_tx_wake_all_queues(ndev);
11621162 netif_tx_unlock_bh(ndev);
11631163 napi_enable(&fep->napi);
11641164 }
@@ -1273,7 +1273,7 @@ skb_done: · 108 unmodified lines
12731273
12741274 /* Since we have freed up a buffer, the ring is no longer full
12751275 */
1276− if (netif_queue_stopped(ndev)) {
1276+ if (netif_tx_queue_stopped(nq)) {
12771277 entries_free = fec_enet_get_free_txdesc_num(txq);
12781278 if (entries_free >= txq->tx_wake_threshold)
12791279 netif_tx_wake_queue(nq);
@@ -1746,7 +1746,7 @@ static void fec_enet_adjust_link(struct net_device *ndev) · 466 unmodified lines
17461746 napi_disable(&fep->napi);
17471747 netif_tx_lock_bh(ndev);
17481748 fec_restart(ndev);
1749− netif_wake_queue(ndev);
1749+ netif_tx_wake_all_queues(ndev);
17501750 netif_tx_unlock_bh(ndev);
17511751 napi_enable(&fep->napi);
17521752 }
@@ -2247,7 +2247,7 @@ static int fec_enet_set_pauseparam(struct net_device *ndev, · 494 unmodified lines
22472247 napi_disable(&fep->napi);
22482248 netif_tx_lock_bh(ndev);
22492249 fec_restart(ndev);
2250− netif_wake_queue(ndev);
2250+ netif_tx_wake_all_queues(ndev);
22512251 netif_tx_unlock_bh(ndev);
22522252 napi_enable(&fep->napi);
22532253 }
drivers/net/ethernet/hisilicon/hns/hnae.c+1−1
@@ -84,7 +84,7 @@ static void hnae_unmap_buffer(struct hnae_ring *ring, struct hnae_desc_cb *cb) · 83 unmodified lines
8484 if (cb->type == DESC_TYPE_SKB)
8585 dma_unmap_single(ring_to_dev(ring), cb->dma, cb->length,
8686 ring_to_dma_dir(ring));
87− else
87+ else if (cb->length)
8888 dma_unmap_page(ring_to_dev(ring), cb->dma, cb->length,
8989 ring_to_dma_dir(ring));
9090 }
drivers/net/ethernet/hisilicon/hns/hns_enet.c+19−29
@@ -40,9 +40,9 @@ · 39 unmodified lines
4040 #define SKB_TMP_LEN(SKB) \
4141 (((SKB)->transport_header - (SKB)->mac_header) + tcp_hdrlen(SKB))
4242
43−static void fill_v2_desc(struct hnae_ring *ring, void *priv,
44− int size, dma_addr_t dma, int frag_end,
45− int buf_num, enum hns_desc_type type, int mtu)
43+static void fill_v2_desc_hw(struct hnae_ring *ring, void *priv, int size,
44+ int send_sz, dma_addr_t dma, int frag_end,
45+ int buf_num, enum hns_desc_type type, int mtu)
4646 {
4747 struct hnae_desc *desc = &ring->desc[ring->next_to_use];
4848 struct hnae_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use];
@@ -64,7 +64,7 @@ static void fill_v2_desc(struct hnae_ring *ring, void *priv, · 15 unmodified lines
6464 desc_cb->type = type;
6565
6666 desc->addr = cpu_to_le64(dma);
67− desc->tx.send_size = cpu_to_le16((u16)size);
67+ desc->tx.send_size = cpu_to_le16((u16)send_sz);
6868
6969 /* config bd buffer end */
7070 hnae_set_bit(rrcfv, HNSV2_TXD_VLD_B, 1);
@@ -133,6 +133,14 @@ static void fill_v2_desc(struct hnae_ring *ring, void *priv, · 62 unmodified lines
133133 ring_ptr_move_fw(ring, next_to_use);
134134 }
135135
136+static void fill_v2_desc(struct hnae_ring *ring, void *priv,
137+ int size, dma_addr_t dma, int frag_end,
138+ int buf_num, enum hns_desc_type type, int mtu)
139+{
140+ fill_v2_desc_hw(ring, priv, size, size, dma, frag_end,
141+ buf_num, type, mtu);
142+}
143+
136144 static const struct acpi_device_id hns_enet_acpi_match[] = {
137145 { "HISI00C1", 0 },
138146 { "HISI00C2", 0 },
@@ -289,15 +297,15 @@ static void fill_tso_desc(struct hnae_ring *ring, void *priv, · 150 unmodified lines
289297
290298 /* when the frag size is bigger than hardware, split this frag */
291299 for (k = 0; k < frag_buf_num; k++)
292− fill_v2_desc(ring, priv,
293− (k == frag_buf_num - 1) ?
300+ fill_v2_desc_hw(ring, priv, k == 0 ? size : 0,
301+ (k == frag_buf_num - 1) ?
294302 sizeoflast : BD_MAX_SEND_SIZE,
295− dma + BD_MAX_SEND_SIZE * k,
296− frag_end && (k == frag_buf_num - 1) ? 1 : 0,
297− buf_num,
298− (type == DESC_TYPE_SKB && !k) ?
303+ dma + BD_MAX_SEND_SIZE * k,
304+ frag_end && (k == frag_buf_num - 1) ? 1 : 0,
305+ buf_num,
306+ (type == DESC_TYPE_SKB && !k) ?
299307 DESC_TYPE_SKB : DESC_TYPE_PAGE,
300− mtu);
308+ mtu);
301309 }
302310
303311 netdev_tx_t hns_nic_net_xmit_hw(struct net_device *ndev,
@@ -1495,21 +1503,6 @@ static int hns_nic_do_ioctl(struct net_device *netdev, struct ifreq *ifr, · 1191 unmodified lines
14951503 return phy_mii_ioctl(phy_dev, ifr, cmd);
14961504 }
14971505
1498−/* use only for netconsole to poll with the device without interrupt */
1499−#ifdef CONFIG_NET_POLL_CONTROLLER
1500−static void hns_nic_poll_controller(struct net_device *ndev)
1501−{
1502− struct hns_nic_priv *priv = netdev_priv(ndev);
1503− unsigned long flags;
1504− int i;
1505−
1506− local_irq_save(flags);
1507− for (i = 0; i < priv->ae_handle->q_num * 2; i++)
1508− napi_schedule(&priv->ring_data[i].napi);
1509− local_irq_restore(flags);
1510−}
1511−#endif
1512−
15131506 static netdev_tx_t hns_nic_net_xmit(struct sk_buff *skb,
15141507 struct net_device *ndev)
15151508 {
@@ -1962,9 +1955,6 @@ static const struct net_device_ops hns_nic_netdev_ops = { · 446 unmodified lines
19621955 .ndo_set_features = hns_nic_set_features,
19631956 .ndo_fix_features = hns_nic_fix_features,
19641957 .ndo_get_stats64 = hns_nic_get_stats64,
1965−#ifdef CONFIG_NET_POLL_CONTROLLER
1966− .ndo_poll_controller = hns_nic_poll_controller,
1967−#endif
19681958 .ndo_set_rx_mode = hns_nic_set_rx_mode,
19691959 .ndo_select_queue = hns_nic_select_queue,
19701960 };
drivers/net/ethernet/huawei/hinic/hinic_main.c+0−20
@@ -789,23 +789,6 @@ static void hinic_get_stats64(struct net_device *netdev, · 788 unmodified lines
789789 stats->tx_errors = nic_tx_stats->tx_dropped;
790790 }
791791
792−#ifdef CONFIG_NET_POLL_CONTROLLER
793−static void hinic_netpoll(struct net_device *netdev)
794−{
795− struct hinic_dev *nic_dev = netdev_priv(netdev);
796− int i, num_qps;
797−
798− num_qps = hinic_hwdev_num_qps(nic_dev->hwdev);
799− for (i = 0; i < num_qps; i++) {
800− struct hinic_txq *txq = &nic_dev->txqs[i];
801− struct hinic_rxq *rxq = &nic_dev->rxqs[i];
802−
803− napi_schedule(&txq->napi);
804− napi_schedule(&rxq->napi);
805− }
806−}
807−#endif
808−
809792 static const struct net_device_ops hinic_netdev_ops = {
810793 .ndo_open = hinic_open,
811794 .ndo_stop = hinic_close,
@@ -818,9 +801,6 @@ static const struct net_device_ops hinic_netdev_ops = { · 6 unmodified lines
818801 .ndo_start_xmit = hinic_xmit_frame,
819802 .ndo_tx_timeout = hinic_tx_timeout,
820803 .ndo_get_stats64 = hinic_get_stats64,
821−#ifdef CONFIG_NET_POLL_CONTROLLER
822− .ndo_poll_controller = hinic_netpoll,
823−#endif
824804 };
825805
826806 static void netdev_features_init(struct net_device *netdev)
drivers/net/ethernet/ibm/ehea/ehea_main.c+0−14
@@ -921,17 +921,6 @@ static int ehea_poll(struct napi_struct *napi, int budget) · 920 unmodified lines
921921 return rx;
922922 }
923923
924−#ifdef CONFIG_NET_POLL_CONTROLLER
925−static void ehea_netpoll(struct net_device *dev)
926−{
927− struct ehea_port *port = netdev_priv(dev);
928− int i;
929−
930− for (i = 0; i < port->num_def_qps; i++)
931− napi_schedule(&port->port_res[i].napi);
932−}
933−#endif
934−
935924 static irqreturn_t ehea_recv_irq_handler(int irq, void *param)
936925 {
937926 struct ehea_port_res *pr = param;
@@ -2953,9 +2942,6 @@ static const struct net_device_ops ehea_netdev_ops = { · 2015 unmodified lines
29532942 .ndo_open = ehea_open,
29542943 .ndo_stop = ehea_stop,
29552944 .ndo_start_xmit = ehea_start_xmit,
2956−#ifdef CONFIG_NET_POLL_CONTROLLER
2957− .ndo_poll_controller = ehea_netpoll,
2958−#endif
29592945 .ndo_get_stats64 = ehea_get_stats64,
29602946 .ndo_set_mac_address = ehea_set_mac_addr,
29612947 .ndo_validate_addr = eth_validate_addr,
drivers/net/ethernet/ibm/ibmvnic.c+0−16
@@ -2207,19 +2207,6 @@ restart_poll: · 2206 unmodified lines
22072207 return frames_processed;
22082208 }
22092209
2210−#ifdef CONFIG_NET_POLL_CONTROLLER
2211−static void ibmvnic_netpoll_controller(struct net_device *dev)
2212−{
2213− struct ibmvnic_adapter *adapter = netdev_priv(dev);
2214− int i;
2215−
2216− replenish_pools(netdev_priv(dev));
2217− for (i = 0; i < adapter->req_rx_queues; i++)
2218− ibmvnic_interrupt_rx(adapter->rx_scrq[i]->irq,
2219− adapter->rx_scrq[i]);
2220−}
2221−#endif
2222−
22232210 static int wait_for_reset(struct ibmvnic_adapter *adapter)
22242211 {
22252212 int rc, ret;
@@ -2292,9 +2279,6 @@ static const struct net_device_ops ibmvnic_netdev_ops = { · 66 unmodified lines
22922279 .ndo_set_mac_address = ibmvnic_set_mac,
22932280 .ndo_validate_addr = eth_validate_addr,
22942281 .ndo_tx_timeout = ibmvnic_tx_timeout,
2295−#ifdef CONFIG_NET_POLL_CONTROLLER
2296− .ndo_poll_controller = ibmvnic_netpoll_controller,
2297−#endif
22982282 .ndo_change_mtu = ibmvnic_change_mtu,
22992283 .ndo_features_check = ibmvnic_features_check,
23002284 };
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+7−5
@@ -3196,11 +3196,13 @@ int ixgbe_poll(struct napi_struct *napi, int budget) · 3195 unmodified lines
31963196 return budget;
31973197
31983198 /* all work done, exit the polling mode */
3199− napi_complete_done(napi, work_done);
3200− if (adapter->rx_itr_setting & 1)
3201− ixgbe_set_itr(q_vector);
3202− if (!test_bit(__IXGBE_DOWN, &adapter->state))
3203− ixgbe_irq_enable_queues(adapter, BIT_ULL(q_vector->v_idx));
3199+ if (likely(napi_complete_done(napi, work_done))) {
3200+ if (adapter->rx_itr_setting & 1)
3201+ ixgbe_set_itr(q_vector);
3202+ if (!test_bit(__IXGBE_DOWN, &adapter->state))
3203+ ixgbe_irq_enable_queues(adapter,
3204+ BIT_ULL(q_vector->v_idx));
3205+ }
32043206
32053207 return min(work_done, budget - 1);
32063208 }
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c+5−4
@@ -1725,7 +1725,7 @@ static void mvpp2_txq_desc_put(struct mvpp2_tx_queue *txq) · 1724 unmodified lines
17251725 }
17261726
17271727 /* Set Tx descriptors fields relevant for CSUM calculation */
1728−static u32 mvpp2_txq_desc_csum(int l3_offs, int l3_proto,
1728+static u32 mvpp2_txq_desc_csum(int l3_offs, __be16 l3_proto,
17291729 int ip_hdr_len, int l4_proto)
17301730 {
17311731 u32 command;
@@ -2600,14 +2600,15 @@ static u32 mvpp2_skb_tx_csum(struct mvpp2_port *port, struct sk_buff *skb) · 868 unmodified lines
26002600 if (skb->ip_summed == CHECKSUM_PARTIAL) {
26012601 int ip_hdr_len = 0;
26022602 u8 l4_proto;
2603+ __be16 l3_proto = vlan_get_protocol(skb);
26032604
2604− if (skb->protocol == htons(ETH_P_IP)) {
2605+ if (l3_proto == htons(ETH_P_IP)) {
26052606 struct iphdr *ip4h = ip_hdr(skb);
26062607
26072608 /* Calculate IPv4 checksum and L4 checksum */
26082609 ip_hdr_len = ip4h->ihl;
26092610 l4_proto = ip4h->protocol;
2610− } else if (skb->protocol == htons(ETH_P_IPV6)) {
2611+ } else if (l3_proto == htons(ETH_P_IPV6)) {
26112612 struct ipv6hdr *ip6h = ipv6_hdr(skb);
26122613
26132614 /* Read l4_protocol from one of IPv6 extra headers */
@@ -2619,7 +2620,7 @@ static u32 mvpp2_skb_tx_csum(struct mvpp2_port *port, struct sk_buff *skb) · 5 unmodified lines
26192620 }
26202621
26212622 return mvpp2_txq_desc_csum(skb_network_offset(skb),
2622− skb->protocol, ip_hdr_len, l4_proto);
2623+ l3_proto, ip_hdr_len, l4_proto);
26232624 }
26242625
26252626 return MVPP2_TXD_L4_CSUM_NOT | MVPP2_TXD_IP_CSUM_DISABLE;
drivers/net/ethernet/mellanox/mlx5/core/en.h+1−0
@@ -54,6 +54,7 @@ · 53 unmodified lines
5454 #include "en_stats.h"
5555 #include "en/fs.h"
5656
57+extern const struct net_device_ops mlx5e_netdev_ops;
5758 struct page_pool;
5859
5960 #define MLX5E_METADATA_ETHER_TYPE (0x8CE4)
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h+2−0
@@ -16,6 +16,8 @@ struct mlx5e_tc_table { · 15 unmodified lines
1616
1717 DECLARE_HASHTABLE(mod_hdr_tbl, 8);
1818 DECLARE_HASHTABLE(hairpin_tbl, 8);
19+
20+ struct notifier_block netdevice_nb;
1921 };
2022
2123 struct mlx5e_flow_table {
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+1−1
@@ -4315,7 +4315,7 @@ static int mlx5e_xdp(struct net_device *dev, struct netdev_bpf *xdp) · 4314 unmodified lines
43154315 }
43164316 }
43174317
4318−static const struct net_device_ops mlx5e_netdev_ops = {
4318+const struct net_device_ops mlx5e_netdev_ops = {
43194319 .ndo_open = mlx5e_open,
43204320 .ndo_stop = mlx5e_close,
43214321 .ndo_start_xmit = mlx5e_xmit,
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+64−1
@@ -1368,6 +1368,9 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, · 1367 unmodified lines
13681368
13691369 *match_level = MLX5_MATCH_L2;
13701370 }
1371+ } else {
1372+ MLX5_SET(fte_match_set_lyr_2_4, headers_c, svlan_tag, 1);
1373+ MLX5_SET(fte_match_set_lyr_2_4, headers_c, cvlan_tag, 1);
13711374 }
13721375
13731376 if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_CVLAN)) {
@@ -2946,14 +2949,71 @@ int mlx5e_stats_flower(struct mlx5e_priv *priv, · 1572 unmodified lines
29462949 return 0;
29472950 }
29482951
2952+static void mlx5e_tc_hairpin_update_dead_peer(struct mlx5e_priv *priv,
2953+ struct mlx5e_priv *peer_priv)
2954+{
2955+ struct mlx5_core_dev *peer_mdev = peer_priv->mdev;
2956+ struct mlx5e_hairpin_entry *hpe;
2957+ u16 peer_vhca_id;
2958+ int bkt;
2959+
2960+ if (!same_hw_devs(priv, peer_priv))
2961+ return;
2962+
2963+ peer_vhca_id = MLX5_CAP_GEN(peer_mdev, vhca_id);
2964+
2965+ hash_for_each(priv->fs.tc.hairpin_tbl, bkt, hpe, hairpin_hlist) {
2966+ if (hpe->peer_vhca_id == peer_vhca_id)
2967+ hpe->hp->pair->peer_gone = true;
2968+ }
2969+}
2970+
2971+static int mlx5e_tc_netdev_event(struct notifier_block *this,
2972+ unsigned long event, void *ptr)
2973+{
2974+ struct net_device *ndev = netdev_notifier_info_to_dev(ptr);
2975+ struct mlx5e_flow_steering *fs;
2976+ struct mlx5e_priv *peer_priv;
2977+ struct mlx5e_tc_table *tc;
2978+ struct mlx5e_priv *priv;
2979+
2980+ if (ndev->netdev_ops != &mlx5e_netdev_ops ||
2981+ event != NETDEV_UNREGISTER ||
2982+ ndev->reg_state == NETREG_REGISTERED)
2983+ return NOTIFY_DONE;
2984+
2985+ tc = container_of(this, struct mlx5e_tc_table, netdevice_nb);
2986+ fs = container_of(tc, struct mlx5e_flow_steering, tc);
2987+ priv = container_of(fs, struct mlx5e_priv, fs);
2988+ peer_priv = netdev_priv(ndev);
2989+ if (priv == peer_priv ||
2990+ !(priv->netdev->features & NETIF_F_HW_TC))
2991+ return NOTIFY_DONE;
2992+
2993+ mlx5e_tc_hairpin_update_dead_peer(priv, peer_priv);
2994+
2995+ return NOTIFY_DONE;
2996+}
2997+
29492998 int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
29502999 {
29513000 struct mlx5e_tc_table *tc = &priv->fs.tc;
3001+ int err;
29523002
29533003 hash_init(tc->mod_hdr_tbl);
29543004 hash_init(tc->hairpin_tbl);
29553005
2956− return rhashtable_init(&tc->ht, &tc_ht_params);
3006+ err = rhashtable_init(&tc->ht, &tc_ht_params);
3007+ if (err)
3008+ return err;
3009+
3010+ tc->netdevice_nb.notifier_call = mlx5e_tc_netdev_event;
3011+ if (register_netdevice_notifier(&tc->netdevice_nb)) {
3012+ tc->netdevice_nb.notifier_call = NULL;
3013+ mlx5_core_warn(priv->mdev, "Failed to register netdev notifier\n");
3014+ }
3015+
3016+ return err;
29573017 }
29583018
29593019 static void _mlx5e_tc_del_flow(void *ptr, void *arg)
@@ -2969,6 +3029,9 @@ void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv) · 9 unmodified lines
29693029 {
29703030 struct mlx5e_tc_table *tc = &priv->fs.tc;
29713031
3032+ if (tc->netdevice_nb.notifier_call)
3033+ unregister_netdevice_notifier(&tc->netdevice_nb);
3034+
29723035 rhashtable_free_and_destroy(&tc->ht, _mlx5e_tc_del_flow, NULL);
29733036
29743037 if (!IS_ERR_OR_NULL(tc->t)) {
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c+2−2
@@ -2000,7 +2000,7 @@ static u32 calculate_vports_min_rate_divider(struct mlx5_eswitch *esw) · 1999 unmodified lines
20002000 u32 max_guarantee = 0;
20012001 int i;
20022002
2003− for (i = 0; i <= esw->total_vports; i++) {
2003+ for (i = 0; i < esw->total_vports; i++) {
20042004 evport = &esw->vports[i];
20052005 if (!evport->enabled || evport->info.min_rate < max_guarantee)
20062006 continue;
@@ -2020,7 +2020,7 @@ static int normalize_vports_min_rate(struct mlx5_eswitch *esw, u32 divider) · 13 unmodified lines
20202020 int err;
20212021 int i;
20222022
2023− for (i = 0; i <= esw->total_vports; i++) {
2023+ for (i = 0; i < esw->total_vports; i++) {
20242024 evport = &esw->vports[i];
20252025 if (!evport->enabled)
20262026 continue;
drivers/net/ethernet/mellanox/mlx5/core/transobj.c+4−1
@@ -475,7 +475,8 @@ static void mlx5_hairpin_destroy_queues(struct mlx5_hairpin *hp) · 474 unmodified lines
475475
476476 for (i = 0; i < hp->num_channels; i++) {
477477 mlx5_core_destroy_rq(hp->func_mdev, hp->rqn[i]);
478− mlx5_core_destroy_sq(hp->peer_mdev, hp->sqn[i]);
478+ if (!hp->peer_gone)
479+ mlx5_core_destroy_sq(hp->peer_mdev, hp->sqn[i]);
479480 }
480481 }
481482
@@ -567,6 +568,8 @@ static void mlx5_hairpin_unpair_queues(struct mlx5_hairpin *hp) · 85 unmodified lines
567568 MLX5_RQC_STATE_RST, 0, 0);
568569
569570 /* unset peer SQs */
571+ if (hp->peer_gone)
572+ return;
570573 for (i = 0; i < hp->num_channels; i++)
571574 mlx5_hairpin_modify_sq(hp->peer_mdev, hp->sqn[i], MLX5_SQC_STATE_RDY,
572575 MLX5_SQC_STATE_RST, 0, 0);
drivers/net/ethernet/mellanox/mlxsw/pci.c+7−4
@@ -718,14 +718,17 @@ static void mlxsw_pci_eq_tasklet(unsigned long data) · 717 unmodified lines
718718 memset(&active_cqns, 0, sizeof(active_cqns));
719719
720720 while ((eqe = mlxsw_pci_eq_sw_eqe_get(q))) {
721− u8 event_type = mlxsw_pci_eqe_event_type_get(eqe);
722721
723− switch (event_type) {
724− case MLXSW_PCI_EQE_EVENT_TYPE_CMD:
722+ /* Command interface completion events are always received on
723+ * queue MLXSW_PCI_EQ_ASYNC_NUM (EQ0) and completion events
724+ * are mapped to queue MLXSW_PCI_EQ_COMP_NUM (EQ1).
725+ */
726+ switch (q->num) {
727+ case MLXSW_PCI_EQ_ASYNC_NUM:
725728 mlxsw_pci_eq_cmd_event(mlxsw_pci, eqe);
726729 q->u.eq.ev_cmd_count++;
727730 break;
728− case MLXSW_PCI_EQE_EVENT_TYPE_COMP:
731+ case MLXSW_PCI_EQ_COMP_NUM:
729732 cqn = mlxsw_pci_eqe_cqn_get(eqe);
730733 set_bit(cqn, active_cqns);
731734 cq_handle = true;
drivers/net/ethernet/mellanox/mlxsw/spectrum.c+2−0
@@ -4845,6 +4845,8 @@ static int mlxsw_sp_netdevice_bridge_event(struct net_device *br_dev, · 4844 unmodified lines
48454845 upper_dev = info->upper_dev;
48464846 if (info->linking)
48474847 break;
4848+ if (is_vlan_dev(upper_dev))
4849+ mlxsw_sp_rif_destroy_by_dev(mlxsw_sp, upper_dev);
48484850 if (netif_is_macvlan(upper_dev))
48494851 mlxsw_sp_rif_macvlan_del(mlxsw_sp, upper_dev);
48504852 break;
drivers/net/ethernet/netronome/nfp/nfp_net_common.c+12−5
@@ -2077,14 +2077,17 @@ nfp_ctrl_rx_one(struct nfp_net *nn, struct nfp_net_dp *dp, · 2076 unmodified lines
20772077 return true;
20782078 }
20792079
2080−static void nfp_ctrl_rx(struct nfp_net_r_vector *r_vec)
2080+static bool nfp_ctrl_rx(struct nfp_net_r_vector *r_vec)
20812081 {
20822082 struct nfp_net_rx_ring *rx_ring = r_vec->rx_ring;
20832083 struct nfp_net *nn = r_vec->nfp_net;
20842084 struct nfp_net_dp *dp = &nn->dp;
2085+ unsigned int budget = 512;
20852086
2086− while (nfp_ctrl_rx_one(nn, dp, r_vec, rx_ring))
2087+ while (nfp_ctrl_rx_one(nn, dp, r_vec, rx_ring) && budget--)
20872088 continue;
2089+
2090+ return budget;
20882091 }
20892092
20902093 static void nfp_ctrl_poll(unsigned long arg)
@@ -2096,9 +2099,13 @@ static void nfp_ctrl_poll(unsigned long arg) · 5 unmodified lines
20962099 __nfp_ctrl_tx_queued(r_vec);
20972100 spin_unlock_bh(&r_vec->lock);
20982101
2099− nfp_ctrl_rx(r_vec);
2100−
2101− nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry);
2102+ if (nfp_ctrl_rx(r_vec)) {
2103+ nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry);
2104+ } else {
2105+ tasklet_schedule(&r_vec->tasklet);
2106+ nn_dp_warn(&r_vec->nfp_net->dp,
2107+ "control message budget exceeded!\n");
2108+ }
21022109 }
21032110
21042111 /* Setup and Configuration
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c+0−23
@@ -72,9 +72,6 @@ static void netxen_schedule_work(struct netxen_adapter *adapter, · 71 unmodified lines
7272 work_func_t func, int delay);
7373 static void netxen_cancel_fw_work(struct netxen_adapter *adapter);
7474 static int netxen_nic_poll(struct napi_struct *napi, int budget);
75−#ifdef CONFIG_NET_POLL_CONTROLLER
76−static void netxen_nic_poll_controller(struct net_device *netdev);
77−#endif
7875
7976 static void netxen_create_sysfs_entries(struct netxen_adapter *adapter);
8077 static void netxen_remove_sysfs_entries(struct netxen_adapter *adapter);
@@ -581,9 +578,6 @@ static const struct net_device_ops netxen_netdev_ops = { · 500 unmodified lines
581578 .ndo_tx_timeout = netxen_tx_timeout,
582579 .ndo_fix_features = netxen_fix_features,
583580 .ndo_set_features = netxen_set_features,
584−#ifdef CONFIG_NET_POLL_CONTROLLER
585− .ndo_poll_controller = netxen_nic_poll_controller,
586−#endif
587581 };
588582
589583 static inline bool netxen_function_zero(struct pci_dev *pdev)
@@ -2402,23 +2396,6 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget) · 1812 unmodified lines
24022396 return work_done;
24032397 }
24042398
2405−#ifdef CONFIG_NET_POLL_CONTROLLER
2406−static void netxen_nic_poll_controller(struct net_device *netdev)
2407−{
2408− int ring;
2409− struct nx_host_sds_ring *sds_ring;
2410− struct netxen_adapter *adapter = netdev_priv(netdev);
2411− struct netxen_recv_context *recv_ctx = &adapter->recv_ctx;
2412−
2413− disable_irq(adapter->irq);
2414− for (ring = 0; ring < adapter->max_sds_rings; ring++) {
2415− sds_ring = &recv_ctx->sds_rings[ring];
2416− netxen_intr(adapter->irq, sds_ring);
2417− }
2418− enable_irq(adapter->irq);
2419−}
2420−#endif
2421−
24222399 static int
24232400 nx_incr_dev_ref_cnt(struct netxen_adapter *adapter)
24242401 {
drivers/net/ethernet/qlogic/qed/qed_hsi.h+1−0
@@ -11987,6 +11987,7 @@ struct public_global { · 11986 unmodified lines
1198711987 u32 running_bundle_id;
1198811988 s32 external_temperature;
1198911989 u32 mdump_reason;
11990+ u64 reserved;
1199011991 u32 data_ptr;
1199111992 u32 data_size;
1199211993 };
drivers/net/ethernet/qlogic/qed/qed_iwarp.c+2−2
@@ -1710,7 +1710,7 @@ qed_iwarp_parse_rx_pkt(struct qed_hwfn *p_hwfn, · 1709 unmodified lines
17101710
17111711 cm_info->local_ip[0] = ntohl(iph->daddr);
17121712 cm_info->remote_ip[0] = ntohl(iph->saddr);
1713− cm_info->ip_version = TCP_IPV4;
1713+ cm_info->ip_version = QED_TCP_IPV4;
17141714
17151715 ip_hlen = (iph->ihl) * sizeof(u32);
17161716 *payload_len = ntohs(iph->tot_len) - ip_hlen;
@@ -1730,7 +1730,7 @@ qed_iwarp_parse_rx_pkt(struct qed_hwfn *p_hwfn, · 13 unmodified lines
17301730 cm_info->remote_ip[i] =
17311731 ntohl(ip6h->saddr.in6_u.u6_addr32[i]);
17321732 }
1733− cm_info->ip_version = TCP_IPV6;
1733+ cm_info->ip_version = QED_TCP_IPV6;
17341734
17351735 ip_hlen = sizeof(*ip6h);
17361736 *payload_len = ntohs(ip6h->payload_len);
drivers/net/ethernet/qlogic/qed/qed_rdma.c+1−1
@@ -228,7 +228,7 @@ static int qed_rdma_alloc(struct qed_hwfn *p_hwfn, · 227 unmodified lines
228228 num_cons, "Toggle");
229229 if (rc) {
230230 DP_VERBOSE(p_hwfn, QED_MSG_RDMA,
231− "Failed to allocate toogle bits, rc = %d\n", rc);
231+ "Failed to allocate toggle bits, rc = %d\n", rc);
232232 goto free_cq_map;
233233 }
234234
drivers/net/ethernet/qlogic/qed/qed_roce.c+4−11
@@ -140,23 +140,16 @@ static void qed_rdma_copy_gids(struct qed_rdma_qp *qp, __le32 *src_gid, · 139 unmodified lines
140140
141141 static enum roce_flavor qed_roce_mode_to_flavor(enum roce_mode roce_mode)
142142 {
143− enum roce_flavor flavor;
144−
145143 switch (roce_mode) {
146144 case ROCE_V1:
147− flavor = PLAIN_ROCE;
148− break;
145+ return PLAIN_ROCE;
149146 case ROCE_V2_IPV4:
150− flavor = RROCE_IPV4;
151− break;
147+ return RROCE_IPV4;
152148 case ROCE_V2_IPV6:
153− flavor = ROCE_V2_IPV6;
154− break;
149+ return RROCE_IPV6;
155150 default:
156− flavor = MAX_ROCE_MODE;
157− break;
151+ return MAX_ROCE_FLAVOR;
158152 }
159− return flavor;
160153 }
161154
162155 static void qed_roce_free_cid_pair(struct qed_hwfn *p_hwfn, u16 cid)
drivers/net/ethernet/qlogic/qed/qed_sp_commands.c+1−1
@@ -154,7 +154,7 @@ qed_set_pf_update_tunn_mode(struct qed_tunnel_info *p_tun, · 153 unmodified lines
154154 static void qed_set_tunn_cls_info(struct qed_tunnel_info *p_tun,
155155 struct qed_tunnel_info *p_src)
156156 {
157− enum tunnel_clss type;
157+ int type;
158158
159159 p_tun->b_update_rx_cls = p_src->b_update_rx_cls;
160160 p_tun->b_update_tx_cls = p_src->b_update_tx_cls;
drivers/net/ethernet/qlogic/qed/qed_vf.c+2−3
@@ -413,7 +413,6 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) · 412 unmodified lines
413413 }
414414
415415 if (!p_iov->b_pre_fp_hsi &&
416− ETH_HSI_VER_MINOR &&
417416 (resp->pfdev_info.minor_fp_hsi < ETH_HSI_VER_MINOR)) {
418417 DP_INFO(p_hwfn,
419418 "PF is using older fastpath HSI; %02x.%02x is configured\n",
@@ -572,7 +571,7 @@ free_p_iov: · 152 unmodified lines
572571 static void
573572 __qed_vf_prep_tunn_req_tlv(struct vfpf_update_tunn_param_tlv *p_req,
574573 struct qed_tunn_update_type *p_src,
575− enum qed_tunn_clss mask, u8 *p_cls)
574+ enum qed_tunn_mode mask, u8 *p_cls)
576575 {
577576 if (p_src->b_update_mode) {
578577 p_req->tun_mode_update_mask |= BIT(mask);
@@ -587,7 +586,7 @@ __qed_vf_prep_tunn_req_tlv(struct vfpf_update_tunn_param_tlv *p_req, · 8 unmodified lines
587586 static void
588587 qed_vf_prep_tunn_req_tlv(struct vfpf_update_tunn_param_tlv *p_req,
589588 struct qed_tunn_update_type *p_src,
590− enum qed_tunn_clss mask,
589+ enum qed_tunn_mode mask,
591590 u8 *p_cls, struct qed_tunn_update_udp_port *p_port,
592591 u8 *p_update_port, u16 *p_udp_port)
593592 {
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h+5−3
@@ -1800,7 +1800,8 @@ struct qlcnic_hardware_ops { · 1799 unmodified lines
18001800 int (*config_loopback) (struct qlcnic_adapter *, u8);
18011801 int (*clear_loopback) (struct qlcnic_adapter *, u8);
18021802 int (*config_promisc_mode) (struct qlcnic_adapter *, u32);
1803− void (*change_l2_filter) (struct qlcnic_adapter *, u64 *, u16);
1803+ void (*change_l2_filter)(struct qlcnic_adapter *adapter, u64 *addr,
1804+ u16 vlan, struct qlcnic_host_tx_ring *tx_ring);
18041805 int (*get_board_info) (struct qlcnic_adapter *);
18051806 void (*set_mac_filter_count) (struct qlcnic_adapter *);
18061807 void (*free_mac_list) (struct qlcnic_adapter *);
@@ -2064,9 +2065,10 @@ static inline int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter, · 257 unmodified lines
20642065 }
20652066
20662067 static inline void qlcnic_change_filter(struct qlcnic_adapter *adapter,
2067− u64 *addr, u16 id)
2068+ u64 *addr, u16 vlan,
2069+ struct qlcnic_host_tx_ring *tx_ring)
20682070 {
2069− adapter->ahw->hw_ops->change_l2_filter(adapter, addr, id);
2071+ adapter->ahw->hw_ops->change_l2_filter(adapter, addr, vlan, tx_ring);
20702072 }
20712073
20722074 static inline int qlcnic_get_board_info(struct qlcnic_adapter *adapter)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c+2−1
@@ -2135,7 +2135,8 @@ out: · 2134 unmodified lines
21352135 }
21362136
21372137 void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr,
2138− u16 vlan_id)
2138+ u16 vlan_id,
2139+ struct qlcnic_host_tx_ring *tx_ring)
21392140 {
21402141 u8 mac[ETH_ALEN];
21412142 memcpy(&mac, addr, ETH_ALEN);
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h+2−1
@@ -550,7 +550,8 @@ int qlcnic_83xx_wrt_reg_indirect(struct qlcnic_adapter *, ulong, u32); · 549 unmodified lines
550550 int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *, u32);
551551 int qlcnic_83xx_config_hw_lro(struct qlcnic_adapter *, int);
552552 int qlcnic_83xx_config_rss(struct qlcnic_adapter *, int);
553−void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *, u64 *, u16);
553+void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr,
554+ u16 vlan, struct qlcnic_host_tx_ring *ring);
554555 int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info *);
555556 int qlcnic_83xx_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *);
556557 void qlcnic_83xx_initialize_nic(struct qlcnic_adapter *, int);
drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h+2−1
@@ -173,7 +173,8 @@ int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter, · 172 unmodified lines
173173 struct net_device *netdev);
174174 void qlcnic_82xx_get_beacon_state(struct qlcnic_adapter *);
175175 void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter,
176− u64 *uaddr, u16 vlan_id);
176+ u64 *uaddr, u16 vlan_id,
177+ struct qlcnic_host_tx_ring *tx_ring);
177178 int qlcnic_82xx_config_intr_coalesce(struct qlcnic_adapter *,
178179 struct ethtool_coalesce *);
179180 int qlcnic_82xx_set_rx_coalesce(struct qlcnic_adapter *);
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c+6−6
@@ -268,13 +268,12 @@ static void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, · 267 unmodified lines
268268 }
269269
270270 void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr,
271− u16 vlan_id)
271+ u16 vlan_id, struct qlcnic_host_tx_ring *tx_ring)
272272 {
273273 struct cmd_desc_type0 *hwdesc;
274274 struct qlcnic_nic_req *req;
275275 struct qlcnic_mac_req *mac_req;
276276 struct qlcnic_vlan_req *vlan_req;
277− struct qlcnic_host_tx_ring *tx_ring = adapter->tx_ring;
278277 u32 producer;
279278 u64 word;
280279
@@ -301,7 +300,8 @@ void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr, · 20 unmodified lines
301300
302301 static void qlcnic_send_filter(struct qlcnic_adapter *adapter,
303302 struct cmd_desc_type0 *first_desc,
304− struct sk_buff *skb)
303+ struct sk_buff *skb,
304+ struct qlcnic_host_tx_ring *tx_ring)
305305 {
306306 struct vlan_ethhdr *vh = (struct vlan_ethhdr *)(skb->data);
307307 struct ethhdr *phdr = (struct ethhdr *)(skb->data);
@@ -335,7 +335,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, · 27 unmodified lines
335335 tmp_fil->vlan_id == vlan_id) {
336336 if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil->ftime))
337337 qlcnic_change_filter(adapter, &src_addr,
338− vlan_id);
338+ vlan_id, tx_ring);
339339 tmp_fil->ftime = jiffies;
340340 return;
341341 }
@@ -350,7 +350,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, · 8 unmodified lines
350350 if (!fil)
351351 return;
352352
353− qlcnic_change_filter(adapter, &src_addr, vlan_id);
353+ qlcnic_change_filter(adapter, &src_addr, vlan_id, tx_ring);
354354 fil->ftime = jiffies;
355355 fil->vlan_id = vlan_id;
356356 memcpy(fil->faddr, &src_addr, ETH_ALEN);
@@ -766,7 +766,7 @@ netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) · 409 unmodified lines
766766 }
767767
768768 if (adapter->drv_mac_learn)
769− qlcnic_send_filter(adapter, first_desc, skb);
769+ qlcnic_send_filter(adapter, first_desc, skb, tx_ring);
770770
771771 tx_ring->tx_stats.tx_bytes += skb->len;
772772 tx_ring->tx_stats.xmit_called++;
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c+0−45
@@ -59,9 +59,6 @@ static int qlcnic_close(struct net_device *netdev); · 58 unmodified lines
5959 static void qlcnic_tx_timeout(struct net_device *netdev);
6060 static void qlcnic_attach_work(struct work_struct *work);
6161 static void qlcnic_fwinit_work(struct work_struct *work);
62−#ifdef CONFIG_NET_POLL_CONTROLLER
63−static void qlcnic_poll_controller(struct net_device *netdev);
64−#endif
6562
6663 static void qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding);
6764 static int qlcnic_can_start_firmware(struct qlcnic_adapter *adapter);
@@ -545,9 +542,6 @@ static const struct net_device_ops qlcnic_netdev_ops = { · 477 unmodified lines
545542 .ndo_udp_tunnel_add = qlcnic_add_vxlan_port,
546543 .ndo_udp_tunnel_del = qlcnic_del_vxlan_port,
547544 .ndo_features_check = qlcnic_features_check,
548−#ifdef CONFIG_NET_POLL_CONTROLLER
549− .ndo_poll_controller = qlcnic_poll_controller,
550−#endif
551545 #ifdef CONFIG_QLCNIC_SRIOV
552546 .ndo_set_vf_mac = qlcnic_sriov_set_vf_mac,
553547 .ndo_set_vf_rate = qlcnic_sriov_set_vf_tx_rate,
@@ -3200,45 +3194,6 @@ static irqreturn_t qlcnic_msix_tx_intr(int irq, void *data) · 2646 unmodified lines
32003194 return IRQ_HANDLED;
32013195 }
32023196
3203−#ifdef CONFIG_NET_POLL_CONTROLLER
3204−static void qlcnic_poll_controller(struct net_device *netdev)
3205−{
3206− struct qlcnic_adapter *adapter = netdev_priv(netdev);
3207− struct qlcnic_host_sds_ring *sds_ring;
3208− struct qlcnic_recv_context *recv_ctx;
3209− struct qlcnic_host_tx_ring *tx_ring;
3210− int ring;
3211−
3212− if (!test_bit(__QLCNIC_DEV_UP, &adapter->state))
3213− return;
3214−
3215− recv_ctx = adapter->recv_ctx;
3216−
3217− for (ring = 0; ring < adapter->drv_sds_rings; ring++) {
3218− sds_ring = &recv_ctx->sds_rings[ring];
3219− qlcnic_disable_sds_intr(adapter, sds_ring);
3220− napi_schedule(&sds_ring->napi);
3221− }
3222−
3223− if (adapter->flags & QLCNIC_MSIX_ENABLED) {
3224− /* Only Multi-Tx queue capable devices need to
3225− * schedule NAPI for TX rings
3226− */
3227− if ((qlcnic_83xx_check(adapter) &&
3228− (adapter->flags & QLCNIC_TX_INTR_SHARED)) ||
3229− (qlcnic_82xx_check(adapter) &&
3230− !qlcnic_check_multi_tx(adapter)))
3231− return;
3232−
3233− for (ring = 0; ring < adapter->drv_tx_rings; ring++) {
3234− tx_ring = &adapter->tx_ring[ring];
3235− qlcnic_disable_tx_intr(adapter, tx_ring);
3236− napi_schedule(&tx_ring->napi);
3237− }
3238− }
3239−}
3240−#endif
3241−
32423197 static void
32433198 qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding)
32443199 {
drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c+5−2
@@ -113,7 +113,7 @@ rmnet_map_ingress_handler(struct sk_buff *skb, · 112 unmodified lines
113113 struct sk_buff *skbn;
114114
115115 if (skb->dev->type == ARPHRD_ETHER) {
116− if (pskb_expand_head(skb, ETH_HLEN, 0, GFP_KERNEL)) {
116+ if (pskb_expand_head(skb, ETH_HLEN, 0, GFP_ATOMIC)) {
117117 kfree_skb(skb);
118118 return;
119119 }
@@ -147,7 +147,7 @@ static int rmnet_map_egress_handler(struct sk_buff *skb, · 27 unmodified lines
147147 }
148148
149149 if (skb_headroom(skb) < required_headroom) {
150− if (pskb_expand_head(skb, required_headroom, 0, GFP_KERNEL))
150+ if (pskb_expand_head(skb, required_headroom, 0, GFP_ATOMIC))
151151 return -ENOMEM;
152152 }
153153
@@ -189,6 +189,9 @@ rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb) · 35 unmodified lines
189189 if (!skb)
190190 goto done;
191191
192+ if (skb->pkt_type == PACKET_LOOPBACK)
193+ return RX_HANDLER_PASS;
194+
192195 dev = skb->dev;
193196 port = rmnet_get_port(dev);
194197
drivers/net/ethernet/realtek/r8169.c+16−16
@@ -4072,13 +4072,12 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp) · 4071 unmodified lines
40724072
40734073 genphy_soft_reset(dev->phydev);
40744074
4075− /* It was reported that chip version 33 ends up with 10MBit/Half on a
4075+ /* It was reported that several chips end up with 10MBit/Half on a
40764076 * 1GBit link after resuming from S3. For whatever reason the PHY on
4077− * this chip doesn't properly start a renegotiation when soft-reset.
4077+ * these chips doesn't properly start a renegotiation when soft-reset.
40784078 * Explicitly requesting a renegotiation fixes this.
40794079 */
4080− if (tp->mac_version == RTL_GIGA_MAC_VER_33 &&
4081− dev->phydev->autoneg == AUTONEG_ENABLE)
4080+ if (dev->phydev->autoneg == AUTONEG_ENABLE)
40824081 phy_restart_aneg(dev->phydev);
40834082 }
40844083
@@ -4536,9 +4535,14 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp) · 451 unmodified lines
45364535
45374536 static void rtl_set_tx_config_registers(struct rtl8169_private *tp)
45384537 {
4539− /* Set DMA burst size and Interframe Gap Time */
4540− RTL_W32(tp, TxConfig, (TX_DMA_BURST << TxDMAShift) |
4541− (InterFrameGap << TxInterFrameGapShift));
4538+ u32 val = TX_DMA_BURST << TxDMAShift |
4539+ InterFrameGap << TxInterFrameGapShift;
4540+
4541+ if (tp->mac_version >= RTL_GIGA_MAC_VER_34 &&
4542+ tp->mac_version != RTL_GIGA_MAC_VER_39)
4543+ val |= TXCFG_AUTO_FIFO;
4544+
4545+ RTL_W32(tp, TxConfig, val);
45424546 }
45434547
45444548 static void rtl_set_rx_max_size(struct rtl8169_private *tp)
@@ -5033,7 +5037,6 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp) · 488 unmodified lines
50335037
50345038 rtl_disable_clock_request(tp);
50355039
5036− RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);
50375040 RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB);
50385041
50395042 /* Adjust EEE LED frequency */
@@ -5067,7 +5070,6 @@ static void rtl_hw_start_8168f(struct rtl8169_private *tp) · 27 unmodified lines
50675070
50685071 rtl_disable_clock_request(tp);
50695072
5070− RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);
50715073 RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB);
50725074 RTL_W8(tp, DLLPR, RTL_R8(tp, DLLPR) | PFM_EN);
50735075 RTL_W32(tp, MISC, RTL_R32(tp, MISC) | PWM_EN);
@@ -5112,8 +5114,6 @@ static void rtl_hw_start_8411(struct rtl8169_private *tp) · 38 unmodified lines
51125114
51135115 static void rtl_hw_start_8168g(struct rtl8169_private *tp)
51145116 {
5115− RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);
5116−
51175117 rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x080002, ERIAR_EXGMAC);
51185118 rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x38, ERIAR_EXGMAC);
51195119 rtl_eri_write(tp, 0xd0, ERIAR_MASK_0001, 0x48, ERIAR_EXGMAC);
@@ -5211,8 +5211,6 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private *tp) · 91 unmodified lines
52115211 rtl_hw_aspm_clkreq_enable(tp, false);
52125212 rtl_ephy_init(tp, e_info_8168h_1, ARRAY_SIZE(e_info_8168h_1));
52135213
5214− RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);
5215−
52165214 rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x00080002, ERIAR_EXGMAC);
52175215 rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x38, ERIAR_EXGMAC);
52185216 rtl_eri_write(tp, 0xd0, ERIAR_MASK_0001, 0x48, ERIAR_EXGMAC);
@@ -5295,8 +5293,6 @@ static void rtl_hw_start_8168ep(struct rtl8169_private *tp) · 76 unmodified lines
52955293 {
52965294 rtl8168ep_stop_cmac(tp);
52975295
5298− RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);
5299−
53005296 rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x00080002, ERIAR_EXGMAC);
53015297 rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x2f, ERIAR_EXGMAC);
53025298 rtl_eri_write(tp, 0xd0, ERIAR_MASK_0001, 0x5f, ERIAR_EXGMAC);
@@ -5618,7 +5614,6 @@ static void rtl_hw_start_8402(struct rtl8169_private *tp) · 315 unmodified lines
56185614 /* Force LAN exit from ASPM if Rx/Tx are not idle */
56195615 RTL_W32(tp, FuncEvent, RTL_R32(tp, FuncEvent) | 0x002800);
56205616
5621− RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO);
56225617 RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB);
56235618
56245619 rtl_ephy_init(tp, e_info_8402, ARRAY_SIZE(e_info_8402));
@@ -6869,8 +6864,10 @@ static int rtl8169_suspend(struct device *device) · 1244 unmodified lines
68696864 {
68706865 struct pci_dev *pdev = to_pci_dev(device);
68716866 struct net_device *dev = pci_get_drvdata(pdev);
6867+ struct rtl8169_private *tp = netdev_priv(dev);
68726868
68736869 rtl8169_net_suspend(dev);
6870+ clk_disable_unprepare(tp->clk);
68746871
68756872 return 0;
68766873 }
@@ -6898,6 +6895,9 @@ static int rtl8169_resume(struct device *device) · 21 unmodified lines
68986895 {
68996896 struct pci_dev *pdev = to_pci_dev(device);
69006897 struct net_device *dev = pci_get_drvdata(pdev);
6898+ struct rtl8169_private *tp = netdev_priv(dev);
6899+
6900+ clk_prepare_enable(tp->clk);
69016901
69026902 if (netif_running(dev))
69036903 __rtl8169_resume(dev);
drivers/net/ethernet/sfc/efx.c+0−26
@@ -2206,29 +2206,6 @@ static void efx_fini_napi(struct efx_nic *efx) · 2205 unmodified lines
22062206 efx_fini_napi_channel(channel);
22072207 }
22082208
2209−/**************************************************************************
2210− *
2211− * Kernel netpoll interface
2212− *
2213− *************************************************************************/
2214−
2215−#ifdef CONFIG_NET_POLL_CONTROLLER
2216−
2217−/* Although in the common case interrupts will be disabled, this is not
2218− * guaranteed. However, all our work happens inside the NAPI callback,
2219− * so no locking is required.
2220− */
2221−static void efx_netpoll(struct net_device *net_dev)
2222−{
2223− struct efx_nic *efx = netdev_priv(net_dev);
2224− struct efx_channel *channel;
2225−
2226− efx_for_each_channel(channel, efx)
2227− efx_schedule_channel(channel);
2228−}
2229−
2230−#endif
2231−
22322209 /**************************************************************************
22332210 *
22342211 * Kernel net device interface
@@ -2509,9 +2486,6 @@ static const struct net_device_ops efx_netdev_ops = { · 274 unmodified lines
25092486 #endif
25102487 .ndo_get_phys_port_id = efx_get_phys_port_id,
25112488 .ndo_get_phys_port_name = efx_get_phys_port_name,
2512−#ifdef CONFIG_NET_POLL_CONTROLLER
2513− .ndo_poll_controller = efx_netpoll,
2514−#endif
25152489 .ndo_setup_tc = efx_setup_tc,
25162490 #ifdef CONFIG_RFS_ACCEL
25172491 .ndo_rx_flow_steer = efx_filter_rfs,
drivers/net/ethernet/sfc/falcon/efx.c+0−26
@@ -2052,29 +2052,6 @@ static void ef4_fini_napi(struct ef4_nic *efx) · 2051 unmodified lines
20522052 ef4_fini_napi_channel(channel);
20532053 }
20542054
2055−/**************************************************************************
2056− *
2057− * Kernel netpoll interface
2058− *
2059− *************************************************************************/
2060−
2061−#ifdef CONFIG_NET_POLL_CONTROLLER
2062−
2063−/* Although in the common case interrupts will be disabled, this is not
2064− * guaranteed. However, all our work happens inside the NAPI callback,
2065− * so no locking is required.
2066− */
2067−static void ef4_netpoll(struct net_device *net_dev)
2068−{
2069− struct ef4_nic *efx = netdev_priv(net_dev);
2070− struct ef4_channel *channel;
2071−
2072− ef4_for_each_channel(channel, efx)
2073− ef4_schedule_channel(channel);
2074−}
2075−
2076−#endif
2077−
20782055 /**************************************************************************
20792056 *
20802057 * Kernel net device interface
@@ -2250,9 +2227,6 @@ static const struct net_device_ops ef4_netdev_ops = { · 169 unmodified lines
22502227 .ndo_set_mac_address = ef4_set_mac_address,
22512228 .ndo_set_rx_mode = ef4_set_rx_mode,
22522229 .ndo_set_features = ef4_set_features,
2253−#ifdef CONFIG_NET_POLL_CONTROLLER
2254− .ndo_poll_controller = ef4_netpoll,
2255−#endif
22562230 .ndo_setup_tc = ef4_setup_tc,
22572231 #ifdef CONFIG_RFS_ACCEL
22582232 .ndo_rx_flow_steer = ef4_filter_rfs,
drivers/net/hamradio/yam.c+4−0
@@ -966,6 +966,8 @@ static int yam_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) · 965 unmodified lines
966966 sizeof(struct yamdrv_ioctl_mcs));
967967 if (IS_ERR(ym))
968968 return PTR_ERR(ym);
969+ if (ym->cmd != SIOCYAMSMCS)
970+ return -EINVAL;
969971 if (ym->bitrate > YAM_MAXBITRATE) {
970972 kfree(ym);
971973 return -EINVAL;
@@ -981,6 +983,8 @@ static int yam_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) · 9 unmodified lines
981983 if (copy_from_user(&yi, ifr->ifr_data, sizeof(struct yamdrv_ioctl_cfg)))
982984 return -EFAULT;
983985
986+ if (yi.cmd != SIOCYAMSCFG)
987+ return -EINVAL;
984988 if ((yi.cfg.mask & YAM_IOBASE) && netif_running(dev))
985989 return -EINVAL; /* Cannot change this parameter when up */
986990 if ((yi.cfg.mask & YAM_IRQ) && netif_running(dev))
drivers/net/ieee802154/adf7242.c+1−2
@@ -1308,8 +1308,7 @@ static int adf7242_remove(struct spi_device *spi) · 1307 unmodified lines
13081308 {
13091309 struct adf7242_local *lp = spi_get_drvdata(spi);
13101310
1311− if (!IS_ERR_OR_NULL(lp->debugfs_root))
1312− debugfs_remove_recursive(lp->debugfs_root);
1311+ debugfs_remove_recursive(lp->debugfs_root);
13131312
13141313 cancel_delayed_work_sync(&lp->work);
13151314 destroy_workqueue(lp->wqueue);
drivers/net/ieee802154/ca8210.c+2−4
@@ -634,10 +634,9 @@ static int ca8210_test_int_driver_write( · 633 unmodified lines
634634 for (i = 0; i < len; i++)
635635 dev_dbg(&priv->spi->dev, "%#03x\n", buf[i]);
636636
637− fifo_buffer = kmalloc(len, GFP_KERNEL);
637+ fifo_buffer = kmemdup(buf, len, GFP_KERNEL);
638638 if (!fifo_buffer)
639639 return -ENOMEM;
640− memcpy(fifo_buffer, buf, len);
641640 kfifo_in(&test->up_fifo, &fifo_buffer, 4);
642641 wake_up_interruptible(&priv->test.readq);
643642
@@ -3044,8 +3043,7 @@ static void ca8210_test_interface_clear(struct ca8210_priv *priv) · 2400 unmodified lines
30443043 {
30453044 struct ca8210_test *test = &priv->test;
30463045
3047− if (!IS_ERR(test->ca8210_dfs_spi_int))
3048− debugfs_remove(test->ca8210_dfs_spi_int);
3046+ debugfs_remove(test->ca8210_dfs_spi_int);
30493047 kfifo_free(&test->up_fifo);
30503048 dev_info(&priv->spi->dev, "Test interface removed\n");
30513049 }
drivers/net/ieee802154/mcr20a.c+4−4
@@ -903,19 +903,19 @@ mcr20a_irq_clean_complete(void *context) · 902 unmodified lines
903903
904904 switch (seq_state) {
905905 /* TX IRQ, RX IRQ and SEQ IRQ */
906− case (0x03):
906+ case (DAR_IRQSTS1_TXIRQ | DAR_IRQSTS1_SEQIRQ):
907907 if (lp->is_tx) {
908908 lp->is_tx = 0;
909909 dev_dbg(printdev(lp), "TX is done. No ACK\n");
910910 mcr20a_handle_tx_complete(lp);
911911 }
912912 break;
913− case (0x05):
913+ case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_SEQIRQ):
914914 /* rx is starting */
915915 dev_dbg(printdev(lp), "RX is starting\n");
916916 mcr20a_handle_rx(lp);
917917 break;
918− case (0x07):
918+ case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_TXIRQ | DAR_IRQSTS1_SEQIRQ):
919919 if (lp->is_tx) {
920920 /* tx is done */
921921 lp->is_tx = 0;
@@ -927,7 +927,7 @@ mcr20a_irq_clean_complete(void *context) · 5 unmodified lines
927927 mcr20a_handle_rx(lp);
928928 }
929929 break;
930− case (0x01):
930+ case (DAR_IRQSTS1_SEQIRQ):
931931 if (lp->is_tx) {
932932 dev_dbg(printdev(lp), "TX is starting\n");
933933 mcr20a_handle_tx(lp);
drivers/net/phy/phy_device.c+9−3
@@ -93,7 +93,12 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) · 92 unmodified lines
9393 if (!netdev)
9494 return !phydev->suspended;
9595
96− /* Don't suspend PHY if the attached netdev parent may wakeup.
96+ if (netdev->wol_enabled)
97+ return false;
98+
99+ /* As long as not all affected network drivers support the
100+ * wol_enabled flag, let's check for hints that WoL is enabled.
101+ * Don't suspend PHY if the attached netdev parent may wake up.
97102 * The parent may point to a PCI device, as in tg3 driver.
98103 */
99104 if (netdev->dev.parent && device_may_wakeup(netdev->dev.parent))
@@ -1132,9 +1137,9 @@ void phy_detach(struct phy_device *phydev) · 1032 unmodified lines
11321137 sysfs_remove_link(&dev->dev.kobj, "phydev");
11331138 sysfs_remove_link(&phydev->mdio.dev.kobj, "attached_dev");
11341139 }
1140+ phy_suspend(phydev);
11351141 phydev->attached_dev->phydev = NULL;
11361142 phydev->attached_dev = NULL;
1137− phy_suspend(phydev);
11381143 phydev->phylink = NULL;
11391144
11401145 phy_led_triggers_unregister(phydev);
@@ -1168,12 +1173,13 @@ EXPORT_SYMBOL(phy_detach); · 27 unmodified lines
11681173 int phy_suspend(struct phy_device *phydev)
11691174 {
11701175 struct phy_driver *phydrv = to_phy_driver(phydev->mdio.dev.driver);
1176+ struct net_device *netdev = phydev->attached_dev;
11711177 struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
11721178 int ret = 0;
11731179
11741180 /* If the device has WOL enabled, we cannot suspend the PHY */
11751181 phy_ethtool_get_wol(phydev, &wol);
1176− if (wol.wolopts)
1182+ if (wol.wolopts || (netdev && netdev->wol_enabled))
11771183 return -EBUSY;
11781184
11791185 if (phydev->drv && phydrv->suspend)
drivers/net/phy/phylink.c+28−20
@@ -717,6 +717,30 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy) · 716 unmodified lines
717717 return 0;
718718 }
719719
720+static int __phylink_connect_phy(struct phylink *pl, struct phy_device *phy,
721+ phy_interface_t interface)
722+{
723+ int ret;
724+
725+ if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED ||
726+ (pl->link_an_mode == MLO_AN_INBAND &&
727+ phy_interface_mode_is_8023z(interface))))
728+ return -EINVAL;
729+
730+ if (pl->phydev)
731+ return -EBUSY;
732+
733+ ret = phy_attach_direct(pl->netdev, phy, 0, interface);
734+ if (ret)
735+ return ret;
736+
737+ ret = phylink_bringup_phy(pl, phy);
738+ if (ret)
739+ phy_detach(phy);
740+
741+ return ret;
742+}
743+
720744 /**
721745 * phylink_connect_phy() - connect a PHY to the phylink instance
722746 * @pl: a pointer to a &struct phylink returned from phylink_create()
@@ -734,31 +758,13 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy) · 11 unmodified lines
734758 */
735759 int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
736760 {
737− int ret;
738−
739− if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED ||
740− (pl->link_an_mode == MLO_AN_INBAND &&
741− phy_interface_mode_is_8023z(pl->link_interface))))
742− return -EINVAL;
743−
744− if (pl->phydev)
745− return -EBUSY;
746−
747761 /* Use PHY device/driver interface */
748762 if (pl->link_interface == PHY_INTERFACE_MODE_NA) {
749763 pl->link_interface = phy->interface;
750764 pl->link_config.interface = pl->link_interface;
751765 }
752766
753− ret = phy_attach_direct(pl->netdev, phy, 0, pl->link_interface);
754− if (ret)
755− return ret;
756−
757− ret = phylink_bringup_phy(pl, phy);
758− if (ret)
759− phy_detach(phy);
760−
761− return ret;
767+ return __phylink_connect_phy(pl, phy, pl->link_interface);
762768 }
763769 EXPORT_SYMBOL_GPL(phylink_connect_phy);
764770
@@ -1672,7 +1678,9 @@ static void phylink_sfp_link_up(void *upstream) · 907 unmodified lines
16721678
16731679 static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
16741680 {
1675− return phylink_connect_phy(upstream, phy);
1681+ struct phylink *pl = upstream;
1682+
1683+ return __phylink_connect_phy(upstream, phy, pl->link_config.interface);
16761684 }
16771685
16781686 static void phylink_sfp_disconnect_phy(void *upstream)
drivers/net/phy/sfp.c+5−2
@@ -1098,8 +1098,11 @@ static int sfp_hwmon_insert(struct sfp *sfp) · 1097 unmodified lines
10981098
10991099 static void sfp_hwmon_remove(struct sfp *sfp)
11001100 {
1101− hwmon_device_unregister(sfp->hwmon_dev);
1102− kfree(sfp->hwmon_name);
1101+ if (!IS_ERR_OR_NULL(sfp->hwmon_dev)) {
1102+ hwmon_device_unregister(sfp->hwmon_dev);
1103+ sfp->hwmon_dev = NULL;
1104+ kfree(sfp->hwmon_name);
1105+ }
11031106 }
11041107 #else
11051108 static int sfp_hwmon_insert(struct sfp *sfp)
drivers/net/team/team.c+6−0
@@ -1167,6 +1167,12 @@ static int team_port_add(struct team *team, struct net_device *port_dev, · 1166 unmodified lines
11671167 return -EBUSY;
11681168 }
11691169
1170+ if (dev == port_dev) {
1171+ NL_SET_ERR_MSG(extack, "Cannot enslave team device to itself");
1172+ netdev_err(dev, "Cannot enslave team device to itself\n");
1173+ return -EINVAL;
1174+ }
1175+
11701176 if (port_dev->features & NETIF_F_VLAN_CHALLENGED &&
11711177 vlan_uses_dev(dev)) {
11721178 NL_SET_ERR_MSG(extack, "Device is VLAN challenged and team device has VLAN set up");
drivers/net/tun.c+21−16
@@ -181,6 +181,7 @@ struct tun_file { · 180 unmodified lines
181181 };
182182 struct napi_struct napi;
183183 bool napi_enabled;
184+ bool napi_frags_enabled;
184185 struct mutex napi_mutex; /* Protects access to the above napi */
185186 struct list_head next;
186187 struct tun_struct *detached;
@@ -313,32 +314,32 @@ static int tun_napi_poll(struct napi_struct *napi, int budget) · 126 unmodified lines
313314 }
314315
315316 static void tun_napi_init(struct tun_struct *tun, struct tun_file *tfile,
316− bool napi_en)
317+ bool napi_en, bool napi_frags)
317318 {
318319 tfile->napi_enabled = napi_en;
320+ tfile->napi_frags_enabled = napi_en && napi_frags;
319321 if (napi_en) {
320322 netif_napi_add(tun->dev, &tfile->napi, tun_napi_poll,
321323 NAPI_POLL_WEIGHT);
322324 napi_enable(&tfile->napi);
323− mutex_init(&tfile->napi_mutex);
324325 }
325326 }
326327
327−static void tun_napi_disable(struct tun_struct *tun, struct tun_file *tfile)
328+static void tun_napi_disable(struct tun_file *tfile)
328329 {
329330 if (tfile->napi_enabled)
330331 napi_disable(&tfile->napi);
331332 }
332333
333−static void tun_napi_del(struct tun_struct *tun, struct tun_file *tfile)
334+static void tun_napi_del(struct tun_file *tfile)
334335 {
335336 if (tfile->napi_enabled)
336337 netif_napi_del(&tfile->napi);
337338 }
338339
339−static bool tun_napi_frags_enabled(const struct tun_struct *tun)
340+static bool tun_napi_frags_enabled(const struct tun_file *tfile)
340341 {
341− return READ_ONCE(tun->flags) & IFF_NAPI_FRAGS;
342+ return tfile->napi_frags_enabled;
342343 }
343344
344345 #ifdef CONFIG_TUN_VNET_CROSS_LE
@@ -690,8 +691,8 @@ static void __tun_detach(struct tun_file *tfile, bool clean) · 345 unmodified lines
690691 tun = rtnl_dereference(tfile->tun);
691692
692693 if (tun && clean) {
693− tun_napi_disable(tun, tfile);
694− tun_napi_del(tun, tfile);
694+ tun_napi_disable(tfile);
695+ tun_napi_del(tfile);
695696 }
696697
697698 if (tun && !tfile->detached) {
@@ -758,7 +759,7 @@ static void tun_detach_all(struct net_device *dev) · 60 unmodified lines
758759 for (i = 0; i < n; i++) {
759760 tfile = rtnl_dereference(tun->tfiles[i]);
760761 BUG_ON(!tfile);
761− tun_napi_disable(tun, tfile);
762+ tun_napi_disable(tfile);
762763 tfile->socket.sk->sk_shutdown = RCV_SHUTDOWN;
763764 tfile->socket.sk->sk_data_ready(tfile->socket.sk);
764765 RCU_INIT_POINTER(tfile->tun, NULL);
@@ -774,7 +775,7 @@ static void tun_detach_all(struct net_device *dev) · 9 unmodified lines
774775 synchronize_net();
775776 for (i = 0; i < n; i++) {
776777 tfile = rtnl_dereference(tun->tfiles[i]);
777− tun_napi_del(tun, tfile);
778+ tun_napi_del(tfile);
778779 /* Drop read queue */
779780 tun_queue_purge(tfile);
780781 xdp_rxq_info_unreg(&tfile->xdp_rxq);
@@ -793,7 +794,7 @@ static void tun_detach_all(struct net_device *dev) · 12 unmodified lines
793794 }
794795
795796 static int tun_attach(struct tun_struct *tun, struct file *file,
796− bool skip_filter, bool napi)
797+ bool skip_filter, bool napi, bool napi_frags)
797798 {
798799 struct tun_file *tfile = file->private_data;
799800 struct net_device *dev = tun->dev;
@@ -866,7 +867,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file, · 66 unmodified lines
866867 tun_enable_queue(tfile);
867868 } else {
868869 sock_hold(&tfile->sk);
869− tun_napi_init(tun, tfile, napi);
870+ tun_napi_init(tun, tfile, napi, napi_frags);
870871 }
871872
872873 tun_set_real_num_queues(tun);
@@ -1709,7 +1710,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, · 836 unmodified lines
17091710 int err;
17101711 u32 rxhash = 0;
17111712 int skb_xdp = 1;
1712− bool frags = tun_napi_frags_enabled(tun);
1713+ bool frags = tun_napi_frags_enabled(tfile);
17131714
17141715 if (!(tun->dev->flags & IFF_UP))
17151716 return -EIO;
@@ -2534,7 +2535,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) · 818 unmodified lines
25342535 return err;
25352536
25362537 err = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER,
2537− ifr->ifr_flags & IFF_NAPI);
2538+ ifr->ifr_flags & IFF_NAPI,
2539+ ifr->ifr_flags & IFF_NAPI_FRAGS);
25382540 if (err < 0)
25392541 return err;
25402542
@@ -2632,7 +2634,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) · 91 unmodified lines
26322634 (ifr->ifr_flags & TUN_FEATURES);
26332635
26342636 INIT_LIST_HEAD(&tun->disabled);
2635− err = tun_attach(tun, file, false, ifr->ifr_flags & IFF_NAPI);
2637+ err = tun_attach(tun, file, false, ifr->ifr_flags & IFF_NAPI,
2638+ ifr->ifr_flags & IFF_NAPI_FRAGS);
26362639 if (err < 0)
26372640 goto err_free_flow;
26382641
@@ -2781,7 +2784,8 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr) · 142 unmodified lines
27812784 ret = security_tun_dev_attach_queue(tun->security);
27822785 if (ret < 0)
27832786 goto unlock;
2784− ret = tun_attach(tun, file, false, tun->flags & IFF_NAPI);
2787+ ret = tun_attach(tun, file, false, tun->flags & IFF_NAPI,
2788+ tun->flags & IFF_NAPI_FRAGS);
27852789 } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) {
27862790 tun = rtnl_dereference(tfile->tun);
27872791 if (!tun || !(tun->flags & IFF_MULTI_QUEUE) || tfile->detached)
@@ -3199,6 +3203,7 @@ static int tun_chr_open(struct inode *inode, struct file * file) · 411 unmodified lines
31993203 return -ENOMEM;
32003204 }
32013205
3206+ mutex_init(&tfile->napi_mutex);
32023207 RCU_INIT_POINTER(tfile->tun, NULL);
32033208 tfile->flags = 0;
32043209 tfile->ifindex = 0;
drivers/net/usb/asix_common.c+3−0
@@ -607,6 +607,9 @@ int asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) · 606 unmodified lines
607607 struct usbnet *dev = netdev_priv(net);
608608 u8 opt = 0;
609609
610+ if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
611+ return -EINVAL;
612+
610613 if (wolinfo->wolopts & WAKE_PHY)
611614 opt |= AX_MONITOR_LINK;
612615 if (wolinfo->wolopts & WAKE_MAGIC)
drivers/net/usb/ax88179_178a.c+3−0
@@ -566,6 +566,9 @@ ax88179_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) · 565 unmodified lines
566566 struct usbnet *dev = netdev_priv(net);
567567 u8 opt = 0;
568568
569+ if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
570+ return -EINVAL;
571+
569572 if (wolinfo->wolopts & WAKE_PHY)
570573 opt |= AX_MONITOR_MODE_RWLC;
571574 if (wolinfo->wolopts & WAKE_MAGIC)
drivers/net/usb/lan78xx.c+4−13
@@ -1401,19 +1401,10 @@ static int lan78xx_set_wol(struct net_device *netdev, · 1400 unmodified lines
14011401 if (ret < 0)
14021402 return ret;
14031403
1404− pdata->wol = 0;
1405− if (wol->wolopts & WAKE_UCAST)
1406− pdata->wol |= WAKE_UCAST;
1407− if (wol->wolopts & WAKE_MCAST)
1408− pdata->wol |= WAKE_MCAST;
1409− if (wol->wolopts & WAKE_BCAST)
1410− pdata->wol |= WAKE_BCAST;
1411− if (wol->wolopts & WAKE_MAGIC)
1412− pdata->wol |= WAKE_MAGIC;
1413− if (wol->wolopts & WAKE_PHY)
1414− pdata->wol |= WAKE_PHY;
1415− if (wol->wolopts & WAKE_ARP)
1416− pdata->wol |= WAKE_ARP;
1404+ if (wol->wolopts & ~WAKE_ALL)
1405+ return -EINVAL;
1406+
1407+ pdata->wol = wol->wolopts;
14171408
14181409 device_set_wakeup_enable(&dev->udev->dev, (bool)wol->wolopts);
14191410
drivers/net/usb/r8152.c+3−0
@@ -4506,6 +4506,9 @@ static int rtl8152_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) · 4505 unmodified lines
45064506 if (!rtl_can_wakeup(tp))
45074507 return -EOPNOTSUPP;
45084508
4509+ if (wol->wolopts & ~WAKE_ANY)
4510+ return -EINVAL;
4511+
45094512 ret = usb_autopm_get_interface(tp->intf);
45104513 if (ret < 0)
45114514 goto out_set_wol;
drivers/net/usb/smsc75xx.c+4−0
@@ -731,6 +731,9 @@ static int smsc75xx_ethtool_set_wol(struct net_device *net, · 730 unmodified lines
731731 struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]);
732732 int ret;
733733
734+ if (wolinfo->wolopts & ~SUPPORTED_WAKE)
735+ return -EINVAL;
736+
734737 pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE;
735738
736739 ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts);
@@ -1517,6 +1520,7 @@ static void smsc75xx_unbind(struct usbnet *dev, struct usb_interface *intf) · 780 unmodified lines
15171520 {
15181521 struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]);
15191522 if (pdata) {
1523+ cancel_work_sync(&pdata->set_multicast);
15201524 netif_dbg(dev, ifdown, dev->net, "free pdata\n");
15211525 kfree(pdata);
15221526 pdata = NULL;
drivers/net/usb/smsc95xx.c+3−0
@@ -774,6 +774,9 @@ static int smsc95xx_ethtool_set_wol(struct net_device *net, · 773 unmodified lines
774774 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
775775 int ret;
776776
777+ if (wolinfo->wolopts & ~SUPPORTED_WAKE)
778+ return -EINVAL;
779+
777780 pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE;
778781
779782 ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts);
drivers/net/usb/sr9800.c+3−0
@@ -421,6 +421,9 @@ sr_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) · 420 unmodified lines
421421 struct usbnet *dev = netdev_priv(net);
422422 u8 opt = 0;
423423
424+ if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
425+ return -EINVAL;
426+
424427 if (wolinfo->wolopts & WAKE_PHY)
425428 opt |= SR_MONITOR_LINK;
426429 if (wolinfo->wolopts & WAKE_MAGIC)
drivers/net/virtio_net.c+0−14
@@ -1699,17 +1699,6 @@ static void virtnet_stats(struct net_device *dev, · 1698 unmodified lines
16991699 tot->rx_frame_errors = dev->stats.rx_frame_errors;
17001700 }
17011701
1702−#ifdef CONFIG_NET_POLL_CONTROLLER
1703−static void virtnet_netpoll(struct net_device *dev)
1704−{
1705− struct virtnet_info *vi = netdev_priv(dev);
1706− int i;
1707−
1708− for (i = 0; i < vi->curr_queue_pairs; i++)
1709− napi_schedule(&vi->rq[i].napi);
1710−}
1711−#endif
1712−
17131702 static void virtnet_ack_link_announce(struct virtnet_info *vi)
17141703 {
17151704 rtnl_lock();
@@ -2447,9 +2436,6 @@ static const struct net_device_ops virtnet_netdev = { · 731 unmodified lines
24472436 .ndo_get_stats64 = virtnet_stats,
24482437 .ndo_vlan_rx_add_vid = virtnet_vlan_rx_add_vid,
24492438 .ndo_vlan_rx_kill_vid = virtnet_vlan_rx_kill_vid,
2450−#ifdef CONFIG_NET_POLL_CONTROLLER
2451− .ndo_poll_controller = virtnet_netpoll,
2452−#endif
24532439 .ndo_bpf = virtnet_xdp,
24542440 .ndo_xdp_xmit = virtnet_xdp_xmit,
24552441 .ndo_features_check = passthru_features_check,
drivers/net/vxlan.c+3−0
@@ -3539,6 +3539,7 @@ static size_t vxlan_get_size(const struct net_device *dev) · 3538 unmodified lines
35393539 nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_LINK */
35403540 nla_total_size(sizeof(struct in6_addr)) + /* IFLA_VXLAN_LOCAL{6} */
35413541 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_TTL */
3542+ nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_TTL_INHERIT */
35423543 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_TOS */
35433544 nla_total_size(sizeof(__be32)) + /* IFLA_VXLAN_LABEL */
35443545 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_LEARNING */
@@ -3603,6 +3604,8 @@ static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev) · 58 unmodified lines
36033604 }
36043605
36053606 if (nla_put_u8(skb, IFLA_VXLAN_TTL, vxlan->cfg.ttl) ||
3607+ nla_put_u8(skb, IFLA_VXLAN_TTL_INHERIT,
3608+ !!(vxlan->cfg.flags & VXLAN_F_TTL_INHERIT)) ||
36063609 nla_put_u8(skb, IFLA_VXLAN_TOS, vxlan->cfg.tos) ||
36073610 nla_put_be32(skb, IFLA_VXLAN_LABEL, vxlan->cfg.label) ||
36083611 nla_put_u8(skb, IFLA_VXLAN_LEARNING,
drivers/net/wimax/i2400m/control.c+1−1
@@ -257,7 +257,7 @@ static const struct · 256 unmodified lines
257257 [I2400M_MS_ACCESSIBILITY_ERROR] = { "accesibility error", -EIO },
258258 [I2400M_MS_BUSY] = { "busy", -EBUSY },
259259 [I2400M_MS_CORRUPTED_TLV] = { "corrupted TLV", -EILSEQ },
260− [I2400M_MS_UNINITIALIZED] = { "not unitialized", -EILSEQ },
260+ [I2400M_MS_UNINITIALIZED] = { "uninitialized", -EILSEQ },
261261 [I2400M_MS_UNKNOWN_ERROR] = { "unknown error", -EIO },
262262 [I2400M_MS_PRODUCTION_ERROR] = { "production error", -EIO },
263263 [I2400M_MS_NO_RF] = { "no RF", -EIO },
drivers/net/wireless/broadcom/b43/dma.c+4−2
@@ -1518,13 +1518,15 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, · 1517 unmodified lines
15181518 }
15191519 } else {
15201520 /* More than a single header/data pair were missed.
1521− * Report this error, and reset the controller to
1521+ * Report this error. If running with open-source
1522+ * firmware, then reset the controller to
15221523 * revive operation.
15231524 */
15241525 b43dbg(dev->wl,
15251526 "Out of order TX status report on DMA ring %d. Expected %d, but got %d\n",
15261527 ring->index, firstused, slot);
1527− b43_controller_restart(dev, "Out of order TX");
1528+ if (dev->fw.opensource)
1529+ b43_controller_restart(dev, "Out of order TX");
15281530 return;
15291531 }
15301532 }
drivers/net/wireless/intel/iwlwifi/cfg/1000.c+1−0
@@ -51,6 +51,7 @@ · 50 unmodified lines
5151
5252 static const struct iwl_base_params iwl1000_base_params = {
5353 .num_of_queues = IWLAGN_NUM_QUEUES,
54+ .max_tfd_queue_size = 256,
5455 .eeprom_size = OTP_LOW_IMAGE_SIZE,
5556 .pll_cfg = true,
5657 .max_ll_items = OTP_MAX_LL_ITEMS_1000,
drivers/net/wireless/mac80211_hwsim.c+17−19
@@ -520,7 +520,6 @@ struct mac80211_hwsim_data { · 519 unmodified lines
520520 int channels, idx;
521521 bool use_chanctx;
522522 bool destroy_on_close;
523− struct work_struct destroy_work;
524523 u32 portid;
525524 char alpha2[2];
526525 const struct ieee80211_regdomain *regd;
@@ -2935,8 +2934,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, · 2408 unmodified lines
29352934 hwsim_radios_generation++;
29362935 spin_unlock_bh(&hwsim_radio_lock);
29372936
2938− if (idx > 0)
2939− hwsim_mcast_new_radio(idx, info, param);
2937+ hwsim_mcast_new_radio(idx, info, param);
29402938
29412939 return idx;
29422940
@@ -3565,30 +3563,27 @@ static struct genl_family hwsim_genl_family __ro_after_init = { · 622 unmodified lines
35653563 .n_mcgrps = ARRAY_SIZE(hwsim_mcgrps),
35663564 };
35673565
3568−static void destroy_radio(struct work_struct *work)
3569−{
3570− struct mac80211_hwsim_data *data =
3571− container_of(work, struct mac80211_hwsim_data, destroy_work);
3572−
3573− hwsim_radios_generation++;
3574− mac80211_hwsim_del_radio(data, wiphy_name(data->hw->wiphy), NULL);
3575−}
3576−
35773566 static void remove_user_radios(u32 portid)
35783567 {
35793568 struct mac80211_hwsim_data *entry, *tmp;
3569+ LIST_HEAD(list);
35803570
35813571 spin_lock_bh(&hwsim_radio_lock);
35823572 list_for_each_entry_safe(entry, tmp, &hwsim_radios, list) {
35833573 if (entry->destroy_on_close && entry->portid == portid) {
3584− list_del(&entry->list);
3574+ list_move(&entry->list, &list);
35853575 rhashtable_remove_fast(&hwsim_radios_rht, &entry->rht,
35863576 hwsim_rht_params);
3587− INIT_WORK(&entry->destroy_work, destroy_radio);
3588− queue_work(hwsim_wq, &entry->destroy_work);
3577+ hwsim_radios_generation++;
35893578 }
35903579 }
35913580 spin_unlock_bh(&hwsim_radio_lock);
3581+
3582+ list_for_each_entry_safe(entry, tmp, &list, list) {
3583+ list_del(&entry->list);
3584+ mac80211_hwsim_del_radio(entry, wiphy_name(entry->hw->wiphy),
3585+ NULL);
3586+ }
35923587 }
35933588
35943589 static int mac80211_hwsim_netlink_notify(struct notifier_block *nb,
@@ -3646,6 +3641,7 @@ static __net_init int hwsim_init_net(struct net *net) · 51 unmodified lines
36463641 static void __net_exit hwsim_exit_net(struct net *net)
36473642 {
36483643 struct mac80211_hwsim_data *data, *tmp;
3644+ LIST_HEAD(list);
36493645
36503646 spin_lock_bh(&hwsim_radio_lock);
36513647 list_for_each_entry_safe(data, tmp, &hwsim_radios, list) {
@@ -3656,17 +3652,19 @@ static void __net_exit hwsim_exit_net(struct net *net) · 4 unmodified lines
36563652 if (data->netgroup == hwsim_net_get_netgroup(&init_net))
36573653 continue;
36583654
3659− list_del(&data->list);
3655+ list_move(&data->list, &list);
36603656 rhashtable_remove_fast(&hwsim_radios_rht, &data->rht,
36613657 hwsim_rht_params);
36623658 hwsim_radios_generation++;
3663− spin_unlock_bh(&hwsim_radio_lock);
3659+ }
3660+ spin_unlock_bh(&hwsim_radio_lock);
3661+
3662+ list_for_each_entry_safe(data, tmp, &list, list) {
3663+ list_del(&data->list);
36643664 mac80211_hwsim_del_radio(data,
36653665 wiphy_name(data->hw->wiphy),
36663666 NULL);
3667− spin_lock_bh(&hwsim_radio_lock);
36683667 }
3669− spin_unlock_bh(&hwsim_radio_lock);
36703668
36713669 ida_simple_remove(&hwsim_netgroup_ida, hwsim_net_get_netgroup(net));
36723670 }
drivers/net/wireless/mediatek/mt76/mt76x0/main.c+1−2
@@ -77,9 +77,8 @@ static void mt76x0_remove_interface(struct ieee80211_hw *hw, · 76 unmodified lines
7777 {
7878 struct mt76x0_dev *dev = hw->priv;
7979 struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv;
80− unsigned int wcid = mvif->group_wcid.idx;
8180
82− dev->wcid_mask[wcid / BITS_PER_LONG] &= ~BIT(wcid % BITS_PER_LONG);
81+ dev->vif_mask &= ~BIT(mvif->idx);
8382 }
8483
8584 static int mt76x0_config(struct ieee80211_hw *hw, u32 changed)
drivers/net/xen-netback/common.h+2−1
@@ -241,8 +241,9 @@ struct xenvif_hash_cache { · 240 unmodified lines
241241 struct xenvif_hash {
242242 unsigned int alg;
243243 u32 flags;
244+ bool mapping_sel;
244245 u8 key[XEN_NETBK_MAX_HASH_KEY_SIZE];
245− u32 mapping[XEN_NETBK_MAX_HASH_MAPPING_SIZE];
246+ u32 mapping[2][XEN_NETBK_MAX_HASH_MAPPING_SIZE];
246247 unsigned int size;
247248 struct xenvif_hash_cache cache;
248249 };
drivers/net/xen-netback/hash.c+36−15
@@ -324,7 +324,8 @@ u32 xenvif_set_hash_mapping_size(struct xenvif *vif, u32 size) · 323 unmodified lines
324324 return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER;
325325
326326 vif->hash.size = size;
327− memset(vif->hash.mapping, 0, sizeof(u32) * size);
327+ memset(vif->hash.mapping[vif->hash.mapping_sel], 0,
328+ sizeof(u32) * size);
328329
329330 return XEN_NETIF_CTRL_STATUS_SUCCESS;
330331 }
@@ -332,31 +333,49 @@ u32 xenvif_set_hash_mapping_size(struct xenvif *vif, u32 size) · 1 unmodified line
332333 u32 xenvif_set_hash_mapping(struct xenvif *vif, u32 gref, u32 len,
333334 u32 off)
334335 {
335− u32 *mapping = &vif->hash.mapping[off];
336− struct gnttab_copy copy_op = {
336+ u32 *mapping = vif->hash.mapping[!vif->hash.mapping_sel];
337+ unsigned int nr = 1;
338+ struct gnttab_copy copy_op[2] = {{
337339 .source.u.ref = gref,
338340 .source.domid = vif->domid,
339− .dest.u.gmfn = virt_to_gfn(mapping),
340341 .dest.domid = DOMID_SELF,
341− .dest.offset = xen_offset_in_page(mapping),
342− .len = len * sizeof(u32),
342+ .len = len * sizeof(*mapping),
343343 .flags = GNTCOPY_source_gref
344− };
344+ }};
345345
346− if ((off + len > vif->hash.size) || copy_op.len > XEN_PAGE_SIZE)
346+ if ((off + len < off) || (off + len > vif->hash.size) ||
347+ len > XEN_PAGE_SIZE / sizeof(*mapping))
347348 return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER;
348349
349− while (len-- != 0)
350− if (mapping[off++] >= vif->num_queues)
351− return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER;
350+ copy_op[0].dest.u.gmfn = virt_to_gfn(mapping + off);
351+ copy_op[0].dest.offset = xen_offset_in_page(mapping + off);
352+ if (copy_op[0].dest.offset + copy_op[0].len > XEN_PAGE_SIZE) {
353+ copy_op[1] = copy_op[0];
354+ copy_op[1].source.offset = XEN_PAGE_SIZE - copy_op[0].dest.offset;
355+ copy_op[1].dest.u.gmfn = virt_to_gfn(mapping + off + len);
356+ copy_op[1].dest.offset = 0;
357+ copy_op[1].len = copy_op[0].len - copy_op[1].source.offset;
358+ copy_op[0].len = copy_op[1].source.offset;
359+ nr = 2;
360+ }
352361
353− if (copy_op.len != 0) {
354− gnttab_batch_copy(&copy_op, 1);
362+ memcpy(mapping, vif->hash.mapping[vif->hash.mapping_sel],
363+ vif->hash.size * sizeof(*mapping));
355364
356− if (copy_op.status != GNTST_okay)
365+ if (copy_op[0].len != 0) {
366+ gnttab_batch_copy(copy_op, nr);
367+
368+ if (copy_op[0].status != GNTST_okay ||
369+ copy_op[nr - 1].status != GNTST_okay)
357370 return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER;
358371 }
359372
373+ while (len-- != 0)
374+ if (mapping[off++] >= vif->num_queues)
375+ return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER;
376+
377+ vif->hash.mapping_sel = !vif->hash.mapping_sel;
378+
360379 return XEN_NETIF_CTRL_STATUS_SUCCESS;
361380 }
362381
@@ -408,6 +427,8 @@ void xenvif_dump_hash_info(struct xenvif *vif, struct seq_file *m) · 45 unmodified lines
408427 }
409428
410429 if (vif->hash.size != 0) {
430+ const u32 *mapping = vif->hash.mapping[vif->hash.mapping_sel];
431+
411432 seq_puts(m, "\nHash Mapping:\n");
412433
413434 for (i = 0; i < vif->hash.size; ) {
@@ -420,7 +441,7 @@ void xenvif_dump_hash_info(struct xenvif *vif, struct seq_file *m) · 6 unmodified lines
420441 seq_printf(m, "[%4u - %4u]: ", i, i + n - 1);
421442
422443 for (j = 0; j < n; j++, i++)
423− seq_printf(m, "%4u ", vif->hash.mapping[i]);
444+ seq_printf(m, "%4u ", mapping[i]);
424445
425446 seq_puts(m, "\n");
426447 }
drivers/net/xen-netback/interface.c+2−1
@@ -162,7 +162,8 @@ static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb, · 161 unmodified lines
162162 if (size == 0)
163163 return skb_get_hash_raw(skb) % dev->real_num_tx_queues;
164164
165− return vif->hash.mapping[skb_get_hash_raw(skb) % size];
165+ return vif->hash.mapping[vif->hash.mapping_sel]
166+ [skb_get_hash_raw(skb) % size];
166167 }
167168
168169 static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
drivers/pci/controller/pci-mvebu.c+48−4
@@ -1145,7 +1145,6 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) · 1144 unmodified lines
11451145 {
11461146 struct device *dev = &pcie->pdev->dev;
11471147 struct device_node *np = dev->of_node;
1148− unsigned int i;
11491148 int ret;
11501149
11511150 INIT_LIST_HEAD(&pcie->resources);
@@ -1179,13 +1178,58 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) · 27 unmodified lines
11791178 resource_size(&pcie->io) - 1);
11801179 pcie->realio.name = "PCI I/O";
11811180
1181+ pci_add_resource(&pcie->resources, &pcie->realio);
1182+ }
1183+
1184+ return devm_request_pci_bus_resources(dev, &pcie->resources);
1185+}
1186+
1187+/*
1188+ * This is a copy of pci_host_probe(), except that it does the I/O
1189+ * remap as the last step, once we are sure we won't fail.
1190+ *
1191+ * It should be removed once the I/O remap error handling issue has
1192+ * been sorted out.
1193+ */
1194+static int mvebu_pci_host_probe(struct pci_host_bridge *bridge)
1195+{
1196+ struct mvebu_pcie *pcie;
1197+ struct pci_bus *bus, *child;
1198+ int ret;
1199+
1200+ ret = pci_scan_root_bus_bridge(bridge);
1201+ if (ret < 0) {
1202+ dev_err(bridge->dev.parent, "Scanning root bridge failed");
1203+ return ret;
1204+ }
1205+
1206+ pcie = pci_host_bridge_priv(bridge);
1207+ if (resource_size(&pcie->io) != 0) {
1208+ unsigned int i;
1209+
11821210 for (i = 0; i < resource_size(&pcie->realio); i += SZ_64K)
11831211 pci_ioremap_io(i, pcie->io.start + i);
1212+ }
11841213
1185− pci_add_resource(&pcie->resources, &pcie->realio);
1214+ bus = bridge->bus;
1215+
1216+ /*
1217+ * We insert PCI resources into the iomem_resource and
1218+ * ioport_resource trees in either pci_bus_claim_resources()
1219+ * or pci_bus_assign_resources().
1220+ */
1221+ if (pci_has_flag(PCI_PROBE_ONLY)) {
1222+ pci_bus_claim_resources(bus);
1223+ } else {
1224+ pci_bus_size_bridges(bus);
1225+ pci_bus_assign_resources(bus);
1226+
1227+ list_for_each_entry(child, &bus->children, node)
1228+ pcie_bus_configure_settings(child);
11861229 }
11871230
1188− return devm_request_pci_bus_resources(dev, &pcie->resources);
1231+ pci_bus_add_devices(bus);
1232+ return 0;
11891233 }
11901234
11911235 static int mvebu_pcie_probe(struct platform_device *pdev)
@@ -1268,7 +1312,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev) · 76 unmodified lines
12681312 bridge->align_resource = mvebu_pcie_align_resource;
12691313 bridge->msi = pcie->msi;
12701314
1271− return pci_host_probe(bridge);
1315+ return mvebu_pci_host_probe(bridge);
12721316 }
12731317
12741318 static const struct of_device_id mvebu_pcie_of_match_table[] = {
drivers/pci/pci.c+19−8
@@ -1289,12 +1289,12 @@ int pci_save_state(struct pci_dev *dev) · 1288 unmodified lines
12891289 EXPORT_SYMBOL(pci_save_state);
12901290
12911291 static void pci_restore_config_dword(struct pci_dev *pdev, int offset,
1292− u32 saved_val, int retry)
1292+ u32 saved_val, int retry, bool force)
12931293 {
12941294 u32 val;
12951295
12961296 pci_read_config_dword(pdev, offset, &val);
1297− if (val == saved_val)
1297+ if (!force && val == saved_val)
12981298 return;
12991299
13001300 for (;;) {
@@ -1313,25 +1313,36 @@ static void pci_restore_config_dword(struct pci_dev *pdev, int offset, · 12 unmodified lines
13131313 }
13141314
13151315 static void pci_restore_config_space_range(struct pci_dev *pdev,
1316− int start, int end, int retry)
1316+ int start, int end, int retry,
1317+ bool force)
13171318 {
13181319 int index;
13191320
13201321 for (index = end; index >= start; index--)
13211322 pci_restore_config_dword(pdev, 4 * index,
13221323 pdev->saved_config_space[index],
1323− retry);
1324+ retry, force);
13241325 }
13251326
13261327 static void pci_restore_config_space(struct pci_dev *pdev)
13271328 {
13281329 if (pdev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
1329− pci_restore_config_space_range(pdev, 10, 15, 0);
1330+ pci_restore_config_space_range(pdev, 10, 15, 0, false);
13301331 /* Restore BARs before the command register. */
1331− pci_restore_config_space_range(pdev, 4, 9, 10);
1332− pci_restore_config_space_range(pdev, 0, 3, 0);
1332+ pci_restore_config_space_range(pdev, 4, 9, 10, false);
1333+ pci_restore_config_space_range(pdev, 0, 3, 0, false);
1334+ } else if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
1335+ pci_restore_config_space_range(pdev, 12, 15, 0, false);
1336+
1337+ /*
1338+ * Force rewriting of prefetch registers to avoid S3 resume
1339+ * issues on Intel PCI bridges that occur when these
1340+ * registers are not explicitly written.
1341+ */
1342+ pci_restore_config_space_range(pdev, 9, 11, 0, true);
1343+ pci_restore_config_space_range(pdev, 0, 8, 0, false);
13331344 } else {
1334− pci_restore_config_space_range(pdev, 0, 15, 0);
1345+ pci_restore_config_space_range(pdev, 0, 15, 0, false);
13351346 }
13361347 }
13371348
drivers/s390/net/qeth_core_main.c+1−1
@@ -610,7 +610,7 @@ static void qeth_put_reply(struct qeth_reply *reply) · 609 unmodified lines
610610 static void qeth_issue_ipa_msg(struct qeth_ipa_cmd *cmd, int rc,
611611 struct qeth_card *card)
612612 {
613− char *ipa_name;
613+ const char *ipa_name;
614614 int com = cmd->hdr.command;
615615 ipa_name = qeth_get_ipa_cmd_name(com);
616616 if (rc)
drivers/s390/net/qeth_core_mpc.c+16−17
@@ -148,10 +148,10 @@ EXPORT_SYMBOL_GPL(IPA_PDU_HEADER); · 147 unmodified lines
148148
149149 struct ipa_rc_msg {
150150 enum qeth_ipa_return_codes rc;
151− char *msg;
151+ const char *msg;
152152 };
153153
154−static struct ipa_rc_msg qeth_ipa_rc_msg[] = {
154+static const struct ipa_rc_msg qeth_ipa_rc_msg[] = {
155155 {IPA_RC_SUCCESS, "success"},
156156 {IPA_RC_NOTSUPP, "Command not supported"},
157157 {IPA_RC_IP_TABLE_FULL, "Add Addr IP Table Full - ipv6"},
@@ -219,23 +219,23 @@ static struct ipa_rc_msg qeth_ipa_rc_msg[] = { · 61 unmodified lines
219219
220220
221221
222−char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc)
222+const char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc)
223223 {
224− int x = 0;
225− qeth_ipa_rc_msg[sizeof(qeth_ipa_rc_msg) /
226− sizeof(struct ipa_rc_msg) - 1].rc = rc;
227− while (qeth_ipa_rc_msg[x].rc != rc)
228− x++;
224+ int x;
225+
226+ for (x = 0; x < ARRAY_SIZE(qeth_ipa_rc_msg) - 1; x++)
227+ if (qeth_ipa_rc_msg[x].rc == rc)
228+ return qeth_ipa_rc_msg[x].msg;
229229 return qeth_ipa_rc_msg[x].msg;
230230 }
231231
232232
233233 struct ipa_cmd_names {
234234 enum qeth_ipa_cmds cmd;
235− char *name;
235+ const char *name;
236236 };
237237
238−static struct ipa_cmd_names qeth_ipa_cmd_names[] = {
238+static const struct ipa_cmd_names qeth_ipa_cmd_names[] = {
239239 {IPA_CMD_STARTLAN, "startlan"},
240240 {IPA_CMD_STOPLAN, "stoplan"},
241241 {IPA_CMD_SETVMAC, "setvmac"},
@@ -267,13 +267,12 @@ static struct ipa_cmd_names qeth_ipa_cmd_names[] = { · 25 unmodified lines
267267 {IPA_CMD_UNKNOWN, "unknown"},
268268 };
269269
270−char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd)
270+const char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd)
271271 {
272− int x = 0;
273− qeth_ipa_cmd_names[
274− sizeof(qeth_ipa_cmd_names) /
275− sizeof(struct ipa_cmd_names)-1].cmd = cmd;
276− while (qeth_ipa_cmd_names[x].cmd != cmd)
277− x++;
272+ int x;
273+
274+ for (x = 0; x < ARRAY_SIZE(qeth_ipa_cmd_names) - 1; x++)
275+ if (qeth_ipa_cmd_names[x].cmd == cmd)
276+ return qeth_ipa_cmd_names[x].name;
278277 return qeth_ipa_cmd_names[x].name;
279278 }
drivers/s390/net/qeth_core_mpc.h+2−2
@@ -797,8 +797,8 @@ enum qeth_ipa_arp_return_codes { · 796 unmodified lines
797797 QETH_IPA_ARP_RC_Q_NO_DATA = 0x0008,
798798 };
799799
800−extern char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc);
801−extern char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd);
800+extern const char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc);
801+extern const char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd);
802802
803803 #define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
804804 sizeof(struct qeth_ipacmd_setassparms_hdr))
drivers/scsi/qedi/qedi_main.c+1−0
@@ -2472,6 +2472,7 @@ static int __qedi_probe(struct pci_dev *pdev, int mode) · 2471 unmodified lines
24722472 /* start qedi context */
24732473 spin_lock_init(&qedi->hba_lock);
24742474 spin_lock_init(&qedi->task_idx_lock);
2475+ mutex_init(&qedi->stats_lock);
24752476 }
24762477 qedi_ops->ll2->register_cb_ops(qedi->cdev, &qedi_ll2_cb_ops, qedi);
24772478 qedi_ops->ll2->start(qedi->cdev, &params);
drivers/soc/fsl/qbman/qman.c+3−0
@@ -2729,6 +2729,9 @@ static int qman_alloc_range(struct gen_pool *p, u32 *result, u32 cnt) · 2728 unmodified lines
27292729 {
27302730 unsigned long addr;
27312731
2732+ if (!p)
2733+ return -ENODEV;
2734+
27322735 addr = gen_pool_alloc(p, cnt);
27332736 if (!addr)
27342737 return -ENOMEM;
drivers/soc/fsl/qe/ucc.c+1−1
@@ -626,7 +626,7 @@ static u32 ucc_get_tdm_sync_shift(enum comm_dir mode, u32 tdm_num) · 625 unmodified lines
626626 {
627627 u32 shift;
628628
629− shift = (mode == COMM_DIR_RX) ? RX_SYNC_SHIFT_BASE : RX_SYNC_SHIFT_BASE;
629+ shift = (mode == COMM_DIR_RX) ? RX_SYNC_SHIFT_BASE : TX_SYNC_SHIFT_BASE;
630630 shift -= tdm_num * 2;
631631
632632 return shift;
drivers/thunderbolt/icm.c+20−29
@@ -735,14 +735,6 @@ icm_fr_xdomain_connected(struct tb *tb, const struct icm_pkg_header *hdr) · 734 unmodified lines
735735 u8 link, depth;
736736 u64 route;
737737
738− /*
739− * After NVM upgrade adding root switch device fails because we
740− * initiated reset. During that time ICM might still send
741− * XDomain connected message which we ignore here.
742− */
743− if (!tb->root_switch)
744− return;
745−
746738 link = pkg->link_info & ICM_LINK_INFO_LINK_MASK;
747739 depth = (pkg->link_info & ICM_LINK_INFO_DEPTH_MASK) >>
748740 ICM_LINK_INFO_DEPTH_SHIFT;
@@ -1034,14 +1026,6 @@ icm_tr_device_connected(struct tb *tb, const struct icm_pkg_header *hdr) · 285 unmodified lines
10341026 if (pkg->hdr.packet_id)
10351027 return;
10361028
1037− /*
1038− * After NVM upgrade adding root switch device fails because we
1039− * initiated reset. During that time ICM might still send device
1040− * connected message which we ignore here.
1041− */
1042− if (!tb->root_switch)
1043− return;
1044−
10451029 route = get_route(pkg->route_hi, pkg->route_lo);
10461030 authorized = pkg->link_info & ICM_LINK_INFO_APPROVED;
10471031 security_level = (pkg->hdr.flags & ICM_FLAGS_SLEVEL_MASK) >>
@@ -1405,19 +1389,26 @@ static void icm_handle_notification(struct work_struct *work) · 357 unmodified lines
14051389
14061390 mutex_lock(&tb->lock);
14071391
1408− switch (n->pkg->code) {
1409− case ICM_EVENT_DEVICE_CONNECTED:
1410− icm->device_connected(tb, n->pkg);
1411− break;
1412− case ICM_EVENT_DEVICE_DISCONNECTED:
1413− icm->device_disconnected(tb, n->pkg);
1414− break;
1415− case ICM_EVENT_XDOMAIN_CONNECTED:
1416− icm->xdomain_connected(tb, n->pkg);
1417− break;
1418− case ICM_EVENT_XDOMAIN_DISCONNECTED:
1419− icm->xdomain_disconnected(tb, n->pkg);
1420− break;
1392+ /*
1393+ * When the domain is stopped we flush its workqueue but before
1394+ * that the root switch is removed. In that case we should treat
1395+ * the queued events as being canceled.
1396+ */
1397+ if (tb->root_switch) {
1398+ switch (n->pkg->code) {
1399+ case ICM_EVENT_DEVICE_CONNECTED:
1400+ icm->device_connected(tb, n->pkg);
1401+ break;
1402+ case ICM_EVENT_DEVICE_DISCONNECTED:
1403+ icm->device_disconnected(tb, n->pkg);
1404+ break;
1405+ case ICM_EVENT_XDOMAIN_CONNECTED:
1406+ icm->xdomain_connected(tb, n->pkg);
1407+ break;
1408+ case ICM_EVENT_XDOMAIN_DISCONNECTED:
1409+ icm->xdomain_disconnected(tb, n->pkg);
1410+ break;
1411+ }
14211412 }
14221413
14231414 mutex_unlock(&tb->lock);
drivers/thunderbolt/nhi.c+1−1
@@ -1192,5 +1192,5 @@ static void __exit nhi_unload(void) · 1191 unmodified lines
11921192 tb_domain_exit();
11931193 }
11941194
1195−fs_initcall(nhi_init);
1195+rootfs_initcall(nhi_init);
11961196 module_exit(nhi_unload);
drivers/tty/serial/8250/8250_dw.c+0−4
@@ -630,10 +630,6 @@ static int dw8250_probe(struct platform_device *pdev) · 629 unmodified lines
630630 if (!data->skip_autocfg)
631631 dw8250_setup_port(p);
632632
633−#ifdef CONFIG_PM
634− uart.capabilities |= UART_CAP_RPM;
635−#endif
636−
637633 /* If we have a valid fifosize, try hooking up DMA */
638634 if (p->fifosize) {
639635 data->dma.rxconf.src_maxburst = p->fifosize / 4;
drivers/tty/serial/sh-sci.c+41−15
@@ -291,6 +291,33 @@ static const struct sci_port_params sci_port_params[SCIx_NR_REGTYPES] = { · 290 unmodified lines
291291 .error_clear = SCIF_ERROR_CLEAR,
292292 },
293293
294+ /*
295+ * The "SCIFA" that is in RZ/T and RZ/A2.
296+ * It looks like a normal SCIF with FIFO data, but with a
297+ * compressed address space. Also, the break out of interrupts
298+ * are different: ERI/BRI, RXI, TXI, TEI, DRI.
299+ */
300+ [SCIx_RZ_SCIFA_REGTYPE] = {
301+ .regs = {
302+ [SCSMR] = { 0x00, 16 },
303+ [SCBRR] = { 0x02, 8 },
304+ [SCSCR] = { 0x04, 16 },
305+ [SCxTDR] = { 0x06, 8 },
306+ [SCxSR] = { 0x08, 16 },
307+ [SCxRDR] = { 0x0A, 8 },
308+ [SCFCR] = { 0x0C, 16 },
309+ [SCFDR] = { 0x0E, 16 },
310+ [SCSPTR] = { 0x10, 16 },
311+ [SCLSR] = { 0x12, 16 },
312+ },
313+ .fifosize = 16,
314+ .overrun_reg = SCLSR,
315+ .overrun_mask = SCLSR_ORER,
316+ .sampling_rate_mask = SCI_SR(32),
317+ .error_mask = SCIF_DEFAULT_ERROR_MASK,
318+ .error_clear = SCIF_ERROR_CLEAR,
319+ },
320+
294321 /*
295322 * Common SH-3 SCIF definitions.
296323 */
@@ -319,15 +346,15 @@ static const struct sci_port_params sci_port_params[SCIx_NR_REGTYPES] = { · 22 unmodified lines
319346 [SCIx_SH4_SCIF_REGTYPE] = {
320347 .regs = {
321348 [SCSMR] = { 0x00, 16 },
322− [SCBRR] = { 0x02, 8 },
323− [SCSCR] = { 0x04, 16 },
324− [SCxTDR] = { 0x06, 8 },
325− [SCxSR] = { 0x08, 16 },
326− [SCxRDR] = { 0x0a, 8 },
327− [SCFCR] = { 0x0c, 16 },
328− [SCFDR] = { 0x0e, 16 },
329− [SCSPTR] = { 0x10, 16 },
330− [SCLSR] = { 0x12, 16 },
349+ [SCBRR] = { 0x04, 8 },
350+ [SCSCR] = { 0x08, 16 },
351+ [SCxTDR] = { 0x0c, 8 },
352+ [SCxSR] = { 0x10, 16 },
353+ [SCxRDR] = { 0x14, 8 },
354+ [SCFCR] = { 0x18, 16 },
355+ [SCFDR] = { 0x1c, 16 },
356+ [SCSPTR] = { 0x20, 16 },
357+ [SCLSR] = { 0x24, 16 },
331358 },
332359 .fifosize = 16,
333360 .overrun_reg = SCLSR,
@@ -2810,7 +2837,7 @@ static int sci_init_single(struct platform_device *dev, · 2476 unmodified lines
28102837 {
28112838 struct uart_port *port = &sci_port->port;
28122839 const struct resource *res;
2813− unsigned int i, regtype;
2840+ unsigned int i;
28142841 int ret;
28152842
28162843 sci_port->cfg = p;
@@ -2847,7 +2874,6 @@ static int sci_init_single(struct platform_device *dev, · 30 unmodified lines
28472874 if (unlikely(sci_port->params == NULL))
28482875 return -EINVAL;
28492876
2850− regtype = sci_port->params - sci_port_params;
28512877 switch (p->type) {
28522878 case PORT_SCIFB:
28532879 sci_port->rx_trigger = 48;
@@ -2902,10 +2928,6 @@ static int sci_init_single(struct platform_device *dev, · 48 unmodified lines
29022928 port->regshift = 1;
29032929 }
29042930
2905− if (regtype == SCIx_SH4_SCIF_REGTYPE)
2906− if (sci_port->reg_size >= 0x20)
2907− port->regshift = 1;
2908−
29092931 /*
29102932 * The UART port needs an IRQ value, so we peg this to the RX IRQ
29112933 * for the multi-IRQ ports, which is where we are primarily
@@ -3110,6 +3132,10 @@ static const struct of_device_id of_sci_match[] = { · 198 unmodified lines
31103132 .compatible = "renesas,scif-r7s72100",
31113133 .data = SCI_OF_DATA(PORT_SCIF, SCIx_SH2_SCIF_FIFODATA_REGTYPE),
31123134 },
3135+ {
3136+ .compatible = "renesas,scif-r7s9210",
3137+ .data = SCI_OF_DATA(PORT_SCIF, SCIx_RZ_SCIFA_REGTYPE),
3138+ },
31133139 /* Family-specific types */
31143140 {
31153141 .compatible = "renesas,rcar-gen1-scif",
drivers/usb/class/cdc-acm.c+6−0
@@ -1514,6 +1514,7 @@ static void acm_disconnect(struct usb_interface *intf) · 1513 unmodified lines
15141514 {
15151515 struct acm *acm = usb_get_intfdata(intf);
15161516 struct tty_struct *tty;
1517+ int i;
15171518
15181519 /* sibling interface is already cleaning up */
15191520 if (!acm)
@@ -1544,6 +1545,11 @@ static void acm_disconnect(struct usb_interface *intf) · 24 unmodified lines
15441545
15451546 tty_unregister_device(acm_tty_driver, acm->minor);
15461547
1548+ usb_free_urb(acm->ctrlurb);
1549+ for (i = 0; i < ACM_NW; i++)
1550+ usb_free_urb(acm->wb[i].urb);
1551+ for (i = 0; i < acm->rx_buflimit; i++)
1552+ usb_free_urb(acm->read_urbs[i]);
15471553 acm_write_buffers_free(acm);
15481554 usb_free_coherent(acm->dev, acm->ctrlsize, acm->ctrl_buffer, acm->ctrl_dma);
15491555 acm_read_buffers_free(acm);
drivers/usb/host/xhci-mtk.c+2−2
@@ -642,10 +642,10 @@ static int __maybe_unused xhci_mtk_resume(struct device *dev) · 641 unmodified lines
642642 xhci_mtk_host_enable(mtk);
643643
644644 xhci_dbg(xhci, "%s: restart port polling\n", __func__);
645− set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
646− usb_hcd_poll_rh_status(hcd);
647645 set_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags);
648646 usb_hcd_poll_rh_status(xhci->shared_hcd);
647+ set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
648+ usb_hcd_poll_rh_status(hcd);
649649 return 0;
650650 }
651651
drivers/usb/host/xhci-pci.c+2−0
@@ -185,6 +185,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 184 unmodified lines
185185 }
186186 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
187187 (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ||
188+ pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI ||
189+ pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI ||
188190 pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI ||
189191 pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI))
190192 xhci->quirks |= XHCI_MISSING_CAS;
drivers/usb/serial/option.c+13−2
@@ -561,6 +561,9 @@ static void option_instat_callback(struct urb *urb); · 560 unmodified lines
561561 /* Interface is reserved */
562562 #define RSVD(ifnum) ((BIT(ifnum) & 0xff) << 0)
563563
564+/* Interface must have two endpoints */
565+#define NUMEP2 BIT(16)
566+
564567
565568 static const struct usb_device_id option_ids[] = {
566569 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
@@ -1081,8 +1084,9 @@ static const struct usb_device_id option_ids[] = { · 514 unmodified lines
10811084 .driver_info = RSVD(4) },
10821085 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
10831086 .driver_info = RSVD(4) },
1084− { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06),
1085− .driver_info = RSVD(4) | RSVD(5) },
1087+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff),
1088+ .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
1089+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
10861090 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
10871091 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
10881092 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),
@@ -1999,6 +2003,13 @@ static int option_probe(struct usb_serial *serial, · 910 unmodified lines
19992003 if (device_flags & RSVD(iface_desc->bInterfaceNumber))
20002004 return -ENODEV;
20012005
2006+ /*
2007+ * Allow matching on bNumEndpoints for devices whose interface numbers
2008+ * can change (e.g. Quectel EP06).
2009+ */
2010+ if (device_flags & NUMEP2 && iface_desc->bNumEndpoints != 2)
2011+ return -ENODEV;
2012+
20022013 /* Store the device flags so we can use them during attach. */
20032014 usb_set_serial_data(serial, (void *)device_flags);
20042015
drivers/usb/serial/usb-serial-simple.c+2−1
@@ -84,7 +84,8 @@ DEVICE(moto_modem, MOTO_IDS); · 83 unmodified lines
8484
8585 /* Motorola Tetra driver */
8686 #define MOTOROLA_TETRA_IDS() \
87− { USB_DEVICE(0x0cad, 0x9011) } /* Motorola Solutions TETRA PEI */
87+ { USB_DEVICE(0x0cad, 0x9011) }, /* Motorola Solutions TETRA PEI */ \
88+ { USB_DEVICE(0x0cad, 0x9012) } /* MTP6550 */
8889 DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS);
8990
9091 /* Novatel Wireless GPS driver */
drivers/video/fbdev/efifb.c+6−0
@@ -42,6 +42,7 @@ struct bmp_dib_header { · 41 unmodified lines
4242 u32 colors_important;
4343 } __packed;
4444
45+static bool use_bgrt = true;
4546 static bool request_mem_succeeded = false;
4647 static u64 mem_flags = EFI_MEMORY_WC | EFI_MEMORY_UC;
4748
@@ -160,6 +161,9 @@ static void efifb_show_boot_graphics(struct fb_info *info) · 112 unmodified lines
160161 void *bgrt_image = NULL;
161162 u8 *dst = info->screen_base;
162163
164+ if (!use_bgrt)
165+ return;
166+
163167 if (!bgrt_tab.image_address) {
164168 pr_info("efifb: No BGRT, not showing boot graphics\n");
165169 return;
@@ -290,6 +294,8 @@ static int efifb_setup(char *options) · 124 unmodified lines
290294 screen_info.lfb_width = simple_strtoul(this_opt+6, NULL, 0);
291295 else if (!strcmp(this_opt, "nowc"))
292296 mem_flags &= ~EFI_MEMORY_WC;
297+ else if (!strcmp(this_opt, "nobgrt"))
298+ use_bgrt = false;
293299 }
294300 }
295301
drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c+4−1
@@ -496,6 +496,9 @@ static int omapfb_memory_read(struct fb_info *fbi, · 495 unmodified lines
496496 if (!access_ok(VERIFY_WRITE, mr->buffer, mr->buffer_size))
497497 return -EFAULT;
498498
499+ if (mr->w > 4096 || mr->h > 4096)
500+ return -EINVAL;
501+
499502 if (mr->w * mr->h * 3 > mr->buffer_size)
500503 return -EINVAL;
501504
@@ -509,7 +512,7 @@ static int omapfb_memory_read(struct fb_info *fbi, · 7 unmodified lines
509512 mr->x, mr->y, mr->w, mr->h);
510513
511514 if (r > 0) {
512− if (copy_to_user(mr->buffer, buf, mr->buffer_size))
515+ if (copy_to_user(mr->buffer, buf, r))
513516 r = -EFAULT;
514517 }
515518
drivers/video/fbdev/pxa168fb.c+3−3
@@ -712,7 +712,7 @@ static int pxa168fb_probe(struct platform_device *pdev) · 711 unmodified lines
712712 /*
713713 * enable controller clock
714714 */
715− clk_enable(fbi->clk);
715+ clk_prepare_enable(fbi->clk);
716716
717717 pxa168fb_set_par(info);
718718
@@ -767,7 +767,7 @@ static int pxa168fb_probe(struct platform_device *pdev) · 48 unmodified lines
767767 failed_free_cmap:
768768 fb_dealloc_cmap(&info->cmap);
769769 failed_free_clk:
770− clk_disable(fbi->clk);
770+ clk_disable_unprepare(fbi->clk);
771771 failed_free_fbmem:
772772 dma_free_coherent(fbi->dev, info->fix.smem_len,
773773 info->screen_base, fbi->fb_start_dma);
@@ -807,7 +807,7 @@ static int pxa168fb_remove(struct platform_device *pdev) · 33 unmodified lines
807807 dma_free_wc(fbi->dev, PAGE_ALIGN(info->fix.smem_len),
808808 info->screen_base, info->fix.smem_start);
809809
810− clk_disable(fbi->clk);
810+ clk_disable_unprepare(fbi->clk);
811811
812812 framebuffer_release(info);
813813
drivers/video/fbdev/stifb.c+1−1
@@ -1157,7 +1157,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) · 1156 unmodified lines
11571157 dev_name);
11581158 goto out_err0;
11591159 }
1160− /* fall though */
1160+ /* fall through */
11611161 case S9000_ID_ARTIST:
11621162 case S9000_ID_HCRX:
11631163 case S9000_ID_TIMBER:
fs/cifs/cifsglob.h+1−0
@@ -1553,6 +1553,7 @@ static inline void free_dfs_info_array(struct dfs_info3_param *param, · 1552 unmodified lines
15531553
15541554 /* Flags */
15551555 #define MID_WAIT_CANCELLED 1 /* Cancelled while waiting for response */
1556+#define MID_DELETED 2 /* Mid has been dequeued/deleted */
15561557
15571558 /* Types of response buffer returned from SendReceive2 */
15581559 #define CIFS_NO_BUFFER 0 /* Response buffer not returned */
fs/cifs/connect.c+10−3
@@ -659,7 +659,15 @@ dequeue_mid(struct mid_q_entry *mid, bool malformed) · 658 unmodified lines
659659 mid->mid_state = MID_RESPONSE_RECEIVED;
660660 else
661661 mid->mid_state = MID_RESPONSE_MALFORMED;
662− list_del_init(&mid->qhead);
662+ /*
663+ * Trying to handle/dequeue a mid after the send_recv()
664+ * function has finished processing it is a bug.
665+ */
666+ if (mid->mid_flags & MID_DELETED)
667+ printk_once(KERN_WARNING
668+ "trying to dequeue a deleted mid\n");
669+ else
670+ list_del_init(&mid->qhead);
663671 spin_unlock(&GlobalMid_Lock);
664672 }
665673
@@ -938,8 +946,7 @@ next_pdu: · 272 unmodified lines
938946 } else {
939947 mids[0] = server->ops->find_mid(server, buf);
940948 bufs[0] = buf;
941− if (mids[0])
942− num_mids = 1;
949+ num_mids = 1;
943950
944951 if (!mids[0] || !mids[0]->receive)
945952 length = standard_receive3(server, mids[0]);
fs/cifs/smb2ops.c+1−1
@@ -1477,7 +1477,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, · 1476 unmodified lines
14771477 }
14781478
14791479 srch_inf->entries_in_buffer = 0;
1480− srch_inf->index_of_last_entry = 0;
1480+ srch_inf->index_of_last_entry = 2;
14811481
14821482 rc = SMB2_query_directory(xid, tcon, fid->persistent_fid,
14831483 fid->volatile_fid, 0, srch_inf);
fs/cifs/transport.c+19−2
@@ -142,7 +142,8 @@ void · 141 unmodified lines
142142 cifs_delete_mid(struct mid_q_entry *mid)
143143 {
144144 spin_lock(&GlobalMid_Lock);
145− list_del(&mid->qhead);
145+ list_del_init(&mid->qhead);
146+ mid->mid_flags |= MID_DELETED;
146147 spin_unlock(&GlobalMid_Lock);
147148
148149 DeleteMidQEntry(mid);
@@ -772,6 +773,11 @@ cifs_setup_request(struct cifs_ses *ses, struct smb_rqst *rqst) · 623 unmodified lines
772773 return mid;
773774 }
774775
776+static void
777+cifs_noop_callback(struct mid_q_entry *mid)
778+{
779+}
780+
775781 int
776782 compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
777783 const int flags, const int num_rqst, struct smb_rqst *rqst,
@@ -826,8 +832,13 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 48 unmodified lines
826832 }
827833
828834 midQ[i]->mid_state = MID_REQUEST_SUBMITTED;
835+ /*
836+ * We don't invoke the callback compounds unless it is the last
837+ * request.
838+ */
839+ if (i < num_rqst - 1)
840+ midQ[i]->callback = cifs_noop_callback;
829841 }
830−
831842 cifs_in_send_inc(ses->server);
832843 rc = smb_send_rqst(ses->server, num_rqst, rqst, flags);
833844 cifs_in_send_dec(ses->server);
@@ -908,6 +919,12 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 74 unmodified lines
908919 midQ[i]->resp_buf = NULL;
909920 }
910921 out:
922+ /*
923+ * This will dequeue all mids. After this it is important that the
924+ * demultiplex_thread will not process any of these mids any futher.
925+ * This is prevented above by using a noop callback that will not
926+ * wake this thread except for the very last PDU.
927+ */
911928 for (i = 0; i < num_rqst; i++)
912929 cifs_delete_mid(midQ[i]);
913930 add_credits(ses->server, credits, optype);
fs/ioctl.c+1−1
@@ -230,7 +230,7 @@ static long ioctl_file_clone(struct file *dst_file, unsigned long srcfd, · 229 unmodified lines
230230 ret = -EXDEV;
231231 if (src_file.file->f_path.mnt != dst_file->f_path.mnt)
232232 goto fdput;
233− ret = do_clone_file_range(src_file.file, off, dst_file, destoff, olen);
233+ ret = vfs_clone_file_range(src_file.file, off, dst_file, destoff, olen);
234234 fdput:
235235 fdput(src_file);
236236 return ret;
fs/iomap.c+1−1
@@ -1051,6 +1051,7 @@ iomap_page_mkwrite_actor(struct inode *inode, loff_t pos, loff_t length, · 1050 unmodified lines
10511051 } else {
10521052 WARN_ON_ONCE(!PageUptodate(page));
10531053 iomap_page_create(inode, page);
1054+ set_page_dirty(page);
10541055 }
10551056
10561057 return length;
@@ -1090,7 +1091,6 @@ int iomap_page_mkwrite(struct vm_fault *vmf, const struct iomap_ops *ops) · 33 unmodified lines
10901091 length -= ret;
10911092 }
10921093
1093− set_page_dirty(page);
10941094 wait_for_stable_page(page);
10951095 return VM_FAULT_LOCKED;
10961096 out_unlock:
fs/nfsd/vfs.c+2−1
@@ -541,7 +541,8 @@ __be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp, · 540 unmodified lines
541541 __be32 nfsd4_clone_file_range(struct file *src, u64 src_pos, struct file *dst,
542542 u64 dst_pos, u64 count)
543543 {
544− return nfserrno(do_clone_file_range(src, src_pos, dst, dst_pos, count));
544+ return nfserrno(vfs_clone_file_range(src, src_pos, dst, dst_pos,
545+ count));
545546 }
546547
547548 ssize_t nfsd_copy_file_range(struct file *src, u64 src_pos, struct file *dst,
fs/ocfs2/dlm/dlmmaster.c+2−2
@@ -584,9 +584,9 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm, · 583 unmodified lines
584584
585585 res->last_used = 0;
586586
587− spin_lock(&dlm->spinlock);
587+ spin_lock(&dlm->track_lock);
588588 list_add_tail(&res->tracking, &dlm->tracking_list);
589− spin_unlock(&dlm->spinlock);
589+ spin_unlock(&dlm->track_lock);
590590
591591 memset(res->lvb, 0, DLM_LVB_LEN);
592592 memset(res->refmap, 0, sizeof(res->refmap));
fs/ocfs2/refcounttree.c+12−4
@@ -2946,6 +2946,7 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle, · 2945 unmodified lines
29462946 if (map_end & (PAGE_SIZE - 1))
29472947 to = map_end & (PAGE_SIZE - 1);
29482948
2949+retry:
29492950 page = find_or_create_page(mapping, page_index, GFP_NOFS);
29502951 if (!page) {
29512952 ret = -ENOMEM;
@@ -2954,11 +2955,18 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle, · 2 unmodified lines
29542955 }
29552956
29562957 /*
2957− * In case PAGE_SIZE <= CLUSTER_SIZE, This page
2958− * can't be dirtied before we CoW it out.
2958+ * In case PAGE_SIZE <= CLUSTER_SIZE, we do not expect a dirty
2959+ * page, so write it back.
29592960 */
2960− if (PAGE_SIZE <= OCFS2_SB(sb)->s_clustersize)
2961− BUG_ON(PageDirty(page));
2961+ if (PAGE_SIZE <= OCFS2_SB(sb)->s_clustersize) {
2962+ if (PageDirty(page)) {
2963+ /*
2964+ * write_on_page will unlock the page on return
2965+ */
2966+ ret = write_one_page(page);
2967+ goto retry;
2968+ }
2969+ }
29622970
29632971 if (!PageUptodate(page)) {
29642972 ret = block_read_full_page(page, ocfs2_get_block);
fs/overlayfs/copy_up.c+1−1
@@ -141,7 +141,7 @@ static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len) · 140 unmodified lines
141141 }
142142
143143 /* Try to use clone_file_range to clone up within the same fs */
144− error = vfs_clone_file_range(old_file, 0, new_file, 0, len);
144+ error = do_clone_file_range(old_file, 0, new_file, 0, len);
145145 if (!error)
146146 goto out;
147147 /* Couldn't clone, so now we try to copy the data */
fs/overlayfs/file.c+2−0
@@ -240,8 +240,10 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) · 239 unmodified lines
240240 goto out_unlock;
241241
242242 old_cred = ovl_override_creds(file_inode(file)->i_sb);
243+ file_start_write(real.file);
243244 ret = vfs_iter_write(real.file, iter, &iocb->ki_pos,
244245 ovl_iocb_to_rwf(iocb));
246+ file_end_write(real.file);
245247 revert_creds(old_cred);
246248
247249 /* Update size */
fs/overlayfs/inode.c+1−1
@@ -504,7 +504,7 @@ static const struct inode_operations ovl_special_inode_operations = { · 503 unmodified lines
504504 .update_time = ovl_update_time,
505505 };
506506
507−const struct address_space_operations ovl_aops = {
507+static const struct address_space_operations ovl_aops = {
508508 /* For O_DIRECT dentry_open() checks f_mapping->a_ops->direct_IO */
509509 .direct_IO = noop_direct_IO,
510510 };
fs/overlayfs/namei.c+1−1
@@ -686,7 +686,7 @@ struct dentry *ovl_lookup_index(struct ovl_fs *ofs, struct dentry *upper, · 685 unmodified lines
686686 index = NULL;
687687 goto out;
688688 }
689− pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%*s, err=%i);\n"
689+ pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%.*s, err=%i);\n"
690690 "overlayfs: mount with '-o index=off' to disable inodes index.\n",
691691 d_inode(origin)->i_ino, name.len, name.name,
692692 err);
fs/overlayfs/overlayfs.h+2−2
@@ -152,8 +152,8 @@ static inline int ovl_do_setxattr(struct dentry *dentry, const char *name, · 151 unmodified lines
152152 const void *value, size_t size, int flags)
153153 {
154154 int err = vfs_setxattr(dentry, name, value, size, flags);
155− pr_debug("setxattr(%pd2, \"%s\", \"%*s\", 0x%x) = %i\n",
156− dentry, name, (int) size, (char *) value, flags, err);
155+ pr_debug("setxattr(%pd2, \"%s\", \"%*pE\", %zu, 0x%x) = %i\n",
156+ dentry, name, min((int)size, 48), value, size, flags, err);
157157 return err;
158158 }
159159
fs/overlayfs/util.c+2−1
@@ -683,7 +683,7 @@ static void ovl_cleanup_index(struct dentry *dentry) · 682 unmodified lines
683683 struct dentry *upperdentry = ovl_dentry_upper(dentry);
684684 struct dentry *index = NULL;
685685 struct inode *inode;
686− struct qstr name;
686+ struct qstr name = { };
687687 int err;
688688
689689 err = ovl_get_index_name(lowerdentry, &name);
@@ -726,6 +726,7 @@ static void ovl_cleanup_index(struct dentry *dentry) · 36 unmodified lines
726726 goto fail;
727727
728728 out:
729+ kfree(name.name);
729730 dput(index);
730731 return;
731732
fs/proc/base.c+14−0
@@ -407,6 +407,20 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns, · 406 unmodified lines
407407 unsigned long *entries;
408408 int err;
409409
410+ /*
411+ * The ability to racily run the kernel stack unwinder on a running task
412+ * and then observe the unwinder output is scary; while it is useful for
413+ * debugging kernel issues, it can also allow an attacker to leak kernel
414+ * stack contents.
415+ * Doing this in a manner that is at least safe from races would require
416+ * some work to ensure that the remote task can not be scheduled; and
417+ * even then, this would still expose the unwinder as local attack
418+ * surface.
419+ * Therefore, this interface is restricted to root.
420+ */
421+ if (!file_ns_capable(m->file, &init_user_ns, CAP_SYS_ADMIN))
422+ return -EACCES;
423+
410424 entries = kmalloc_array(MAX_STACK_TRACE_DEPTH, sizeof(*entries),
411425 GFP_KERNEL);
412426 if (!entries)
fs/pstore/ram.c+25−4
@@ -898,8 +898,22 @@ static struct platform_driver ramoops_driver = { · 897 unmodified lines
898898 },
899899 };
900900
901−static void ramoops_register_dummy(void)
901+static inline void ramoops_unregister_dummy(void)
902902 {
903+ platform_device_unregister(dummy);
904+ dummy = NULL;
905+
906+ kfree(dummy_data);
907+ dummy_data = NULL;
908+}
909+
910+static void __init ramoops_register_dummy(void)
911+{
912+ /*
913+ * Prepare a dummy platform data structure to carry the module
914+ * parameters. If mem_size isn't set, then there are no module
915+ * parameters, and we can skip this.
916+ */
903917 if (!mem_size)
904918 return;
905919
@@ -932,21 +946,28 @@ static void ramoops_register_dummy(void) · 26 unmodified lines
932946 if (IS_ERR(dummy)) {
933947 pr_info("could not create platform device: %ld\n",
934948 PTR_ERR(dummy));
949+ dummy = NULL;
950+ ramoops_unregister_dummy();
935951 }
936952 }
937953
938954 static int __init ramoops_init(void)
939955 {
956+ int ret;
957+
940958 ramoops_register_dummy();
941− return platform_driver_register(&ramoops_driver);
959+ ret = platform_driver_register(&ramoops_driver);
960+ if (ret != 0)
961+ ramoops_unregister_dummy();
962+
963+ return ret;
942964 }
943965 late_initcall(ramoops_init);
944966
945967 static void __exit ramoops_exit(void)
946968 {
947969 platform_driver_unregister(&ramoops_driver);
948− platform_device_unregister(dummy);
949− kfree(dummy_data);
970+ ramoops_unregister_dummy();
950971 }
951972 module_exit(ramoops_exit);
952973
fs/read_write.c+15−2
@@ -1818,8 +1818,8 @@ int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in, · 1817 unmodified lines
18181818 }
18191819 EXPORT_SYMBOL(vfs_clone_file_prep_inodes);
18201820
1821−int vfs_clone_file_range(struct file *file_in, loff_t pos_in,
1822− struct file *file_out, loff_t pos_out, u64 len)
1821+int do_clone_file_range(struct file *file_in, loff_t pos_in,
1822+ struct file *file_out, loff_t pos_out, u64 len)
18231823 {
18241824 struct inode *inode_in = file_inode(file_in);
18251825 struct inode *inode_out = file_inode(file_out);
@@ -1866,6 +1866,19 @@ int vfs_clone_file_range(struct file *file_in, loff_t pos_in, · 40 unmodified lines
18661866
18671867 return ret;
18681868 }
1869+EXPORT_SYMBOL(do_clone_file_range);
1870+
1871+int vfs_clone_file_range(struct file *file_in, loff_t pos_in,
1872+ struct file *file_out, loff_t pos_out, u64 len)
1873+{
1874+ int ret;
1875+
1876+ file_start_write(file_out);
1877+ ret = do_clone_file_range(file_in, pos_in, file_out, pos_out, len);
1878+ file_end_write(file_out);
1879+
1880+ return ret;
1881+}
18691882 EXPORT_SYMBOL(vfs_clone_file_range);
18701883
18711884 /*
fs/xattr.c+13−11
@@ -948,17 +948,19 @@ ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs, · 947 unmodified lines
948948 int err = 0;
949949
950950 #ifdef CONFIG_FS_POSIX_ACL
951− if (inode->i_acl) {
952− err = xattr_list_one(&buffer, &remaining_size,
953− XATTR_NAME_POSIX_ACL_ACCESS);
954− if (err)
955− return err;
956− }
957− if (inode->i_default_acl) {
958− err = xattr_list_one(&buffer, &remaining_size,
959− XATTR_NAME_POSIX_ACL_DEFAULT);
960− if (err)
961− return err;
951+ if (IS_POSIXACL(inode)) {
952+ if (inode->i_acl) {
953+ err = xattr_list_one(&buffer, &remaining_size,
954+ XATTR_NAME_POSIX_ACL_ACCESS);
955+ if (err)
956+ return err;
957+ }
958+ if (inode->i_default_acl) {
959+ err = xattr_list_one(&buffer, &remaining_size,
960+ XATTR_NAME_POSIX_ACL_DEFAULT);
961+ if (err)
962+ return err;
963+ }
962964 }
963965 #endif
964966
fs/xfs/libxfs/xfs_attr.c+8−20
@@ -587,7 +587,7 @@ xfs_attr_leaf_addname( · 586 unmodified lines
587587 */
588588 error = xfs_attr3_leaf_to_node(args);
589589 if (error)
590− goto out_defer_cancel;
590+ return error;
591591 error = xfs_defer_finish(&args->trans);
592592 if (error)
593593 return error;
@@ -675,7 +675,7 @@ xfs_attr_leaf_addname( · 81 unmodified lines
675675 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
676676 /* bp is gone due to xfs_da_shrink_inode */
677677 if (error)
678− goto out_defer_cancel;
678+ return error;
679679 error = xfs_defer_finish(&args->trans);
680680 if (error)
681681 return error;
@@ -693,9 +693,6 @@ xfs_attr_leaf_addname( · 11 unmodified lines
693693 error = xfs_attr3_leaf_clearflag(args);
694694 }
695695 return error;
696−out_defer_cancel:
697− xfs_defer_cancel(args->trans);
698− return error;
699696 }
700697
701698 /*
@@ -738,15 +735,12 @@ xfs_attr_leaf_removename( · 36 unmodified lines
738735 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
739736 /* bp is gone due to xfs_da_shrink_inode */
740737 if (error)
741− goto out_defer_cancel;
738+ return error;
742739 error = xfs_defer_finish(&args->trans);
743740 if (error)
744741 return error;
745742 }
746743 return 0;
747−out_defer_cancel:
748− xfs_defer_cancel(args->trans);
749− return error;
750744 }
751745
752746 /*
@@ -864,7 +858,7 @@ restart: · 111 unmodified lines
864858 state = NULL;
865859 error = xfs_attr3_leaf_to_node(args);
866860 if (error)
867− goto out_defer_cancel;
861+ goto out;
868862 error = xfs_defer_finish(&args->trans);
869863 if (error)
870864 goto out;
@@ -888,7 +882,7 @@ restart: · 17 unmodified lines
888882 */
889883 error = xfs_da3_split(state);
890884 if (error)
891− goto out_defer_cancel;
885+ goto out;
892886 error = xfs_defer_finish(&args->trans);
893887 if (error)
894888 goto out;
@@ -984,7 +978,7 @@ restart: · 89 unmodified lines
984978 if (retval && (state->path.active > 1)) {
985979 error = xfs_da3_join(state);
986980 if (error)
987− goto out_defer_cancel;
981+ goto out;
988982 error = xfs_defer_finish(&args->trans);
989983 if (error)
990984 goto out;
@@ -1013,9 +1007,6 @@ out: · 22 unmodified lines
10131007 if (error)
10141008 return error;
10151009 return retval;
1016−out_defer_cancel:
1017− xfs_defer_cancel(args->trans);
1018− goto out;
10191010 }
10201011
10211012 /*
@@ -1107,7 +1098,7 @@ xfs_attr_node_removename( · 85 unmodified lines
11071098 if (retval && (state->path.active > 1)) {
11081099 error = xfs_da3_join(state);
11091100 if (error)
1110− goto out_defer_cancel;
1101+ goto out;
11111102 error = xfs_defer_finish(&args->trans);
11121103 if (error)
11131104 goto out;
@@ -1138,7 +1129,7 @@ xfs_attr_node_removename( · 24 unmodified lines
11381129 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
11391130 /* bp is gone due to xfs_da_shrink_inode */
11401131 if (error)
1141− goto out_defer_cancel;
1132+ goto out;
11421133 error = xfs_defer_finish(&args->trans);
11431134 if (error)
11441135 goto out;
@@ -1150,9 +1141,6 @@ xfs_attr_node_removename( · 5 unmodified lines
11501141 out:
11511142 xfs_da_state_free(state);
11521143 return error;
1153−out_defer_cancel:
1154− xfs_defer_cancel(args->trans);
1155− goto out;
11561144 }
11571145
11581146 /*
fs/xfs/libxfs/xfs_attr_remote.c+2−8
@@ -485,7 +485,7 @@ xfs_attr_rmtval_set( · 484 unmodified lines
485485 blkcnt, XFS_BMAPI_ATTRFORK, args->total, &map,
486486 &nmap);
487487 if (error)
488− goto out_defer_cancel;
488+ return error;
489489 error = xfs_defer_finish(&args->trans);
490490 if (error)
491491 return error;
@@ -553,9 +553,6 @@ xfs_attr_rmtval_set( · 61 unmodified lines
553553 }
554554 ASSERT(valuelen == 0);
555555 return 0;
556−out_defer_cancel:
557− xfs_defer_cancel(args->trans);
558− return error;
559556 }
560557
561558 /*
@@ -625,7 +622,7 @@ xfs_attr_rmtval_remove( · 63 unmodified lines
625622 error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
626623 XFS_BMAPI_ATTRFORK, 1, &done);
627624 if (error)
628− goto out_defer_cancel;
625+ return error;
629626 error = xfs_defer_finish(&args->trans);
630627 if (error)
631628 return error;
@@ -638,7 +635,4 @@ xfs_attr_rmtval_remove( · 6 unmodified lines
638635 return error;
639636 }
640637 return 0;
641−out_defer_cancel:
642− xfs_defer_cancel(args->trans);
643− return error;
644638 }
fs/xfs/libxfs/xfs_bmap.c+13−11
@@ -673,7 +673,8 @@ xfs_bmap_extents_to_btree( · 672 unmodified lines
673673 ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_EXTENTS);
674674
675675 /*
676− * Make space in the inode incore.
676+ * Make space in the inode incore. This needs to be undone if we fail
677+ * to expand the root.
677678 */
678679 xfs_iroot_realloc(ip, 1, whichfork);
679680 ifp->if_flags |= XFS_IFBROOT;
@@ -711,16 +712,15 @@ xfs_bmap_extents_to_btree( · 31 unmodified lines
711712 args.minlen = args.maxlen = args.prod = 1;
712713 args.wasdel = wasdel;
713714 *logflagsp = 0;
714− if ((error = xfs_alloc_vextent(&args))) {
715− ASSERT(ifp->if_broot == NULL);
716− goto err1;
717− }
715+ error = xfs_alloc_vextent(&args);
716+ if (error)
717+ goto out_root_realloc;
718718
719719 if (WARN_ON_ONCE(args.fsbno == NULLFSBLOCK)) {
720− ASSERT(ifp->if_broot == NULL);
721720 error = -ENOSPC;
722− goto err1;
721+ goto out_root_realloc;
723722 }
723+
724724 /*
725725 * Allocation can't fail, the space was reserved.
726726 */
@@ -732,9 +732,10 @@ xfs_bmap_extents_to_btree( · 5 unmodified lines
732732 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, 1L);
733733 abp = xfs_btree_get_bufl(mp, tp, args.fsbno, 0);
734734 if (!abp) {
735− error = -ENOSPC;
736− goto err2;
735+ error = -EFSCORRUPTED;
736+ goto out_unreserve_dquot;
737737 }
738+
738739 /*
739740 * Fill in the child block.
740741 */
@@ -775,11 +776,12 @@ xfs_bmap_extents_to_btree( · 34 unmodified lines
775776 *logflagsp = XFS_ILOG_CORE | xfs_ilog_fbroot(whichfork);
776777 return 0;
777778
778−err2:
779+out_unreserve_dquot:
779780 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, -1L);
780−err1:
781+out_root_realloc:
781782 xfs_iroot_realloc(ip, -1, whichfork);
782783 XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS);
784+ ASSERT(ifp->if_broot == NULL);
783785 xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
784786
785787 return error;
fs/xfs/libxfs/xfs_format.h+2−0
@@ -1016,6 +1016,8 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev) · 1015 unmodified lines
10161016 #define XFS_DIFLAG_EXTSZINHERIT_BIT 12 /* inherit inode extent size */
10171017 #define XFS_DIFLAG_NODEFRAG_BIT 13 /* do not reorganize/defragment */
10181018 #define XFS_DIFLAG_FILESTREAM_BIT 14 /* use filestream allocator */
1019+/* Do not use bit 15, di_flags is legacy and unchanging now */
1020+
10191021 #define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT)
10201022 #define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT)
10211023 #define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT)
fs/xfs/libxfs/xfs_inode_buf.c+30−0
@@ -415,6 +415,31 @@ xfs_dinode_verify_fork( · 414 unmodified lines
415415 return NULL;
416416 }
417417
418+static xfs_failaddr_t
419+xfs_dinode_verify_forkoff(
420+ struct xfs_dinode *dip,
421+ struct xfs_mount *mp)
422+{
423+ if (!XFS_DFORK_Q(dip))
424+ return NULL;
425+
426+ switch (dip->di_format) {
427+ case XFS_DINODE_FMT_DEV:
428+ if (dip->di_forkoff != (roundup(sizeof(xfs_dev_t), 8) >> 3))
429+ return __this_address;
430+ break;
431+ case XFS_DINODE_FMT_LOCAL: /* fall through ... */
432+ case XFS_DINODE_FMT_EXTENTS: /* fall through ... */
433+ case XFS_DINODE_FMT_BTREE:
434+ if (dip->di_forkoff >= (XFS_LITINO(mp, dip->di_version) >> 3))
435+ return __this_address;
436+ break;
437+ default:
438+ return __this_address;
439+ }
440+ return NULL;
441+}
442+
418443 xfs_failaddr_t
419444 xfs_dinode_verify(
420445 struct xfs_mount *mp,
@@ -470,6 +495,11 @@ xfs_dinode_verify( · 49 unmodified lines
470495 if (mode && (flags & XFS_DIFLAG_REALTIME) && !mp->m_rtdev_targp)
471496 return __this_address;
472497
498+ /* check for illegal values of forkoff */
499+ fa = xfs_dinode_verify_forkoff(dip, mp);
500+ if (fa)
501+ return fa;
502+
473503 /* Do we have appropriate data fork formats for the mode? */
474504 switch (mode & S_IFMT) {
475505 case S_IFIFO:
fs/xfs/scrub/alloc.c+0−1
@@ -17,7 +17,6 @@ · 16 unmodified lines
1717 #include "xfs_sb.h"
1818 #include "xfs_alloc.h"
1919 #include "xfs_rmap.h"
20−#include "xfs_alloc.h"
2120 #include "scrub/xfs_scrub.h"
2221 #include "scrub/scrub.h"
2322 #include "scrub/common.h"
fs/xfs/scrub/inode.c+3−1
@@ -126,6 +126,7 @@ xchk_inode_flags( · 125 unmodified lines
126126 {
127127 struct xfs_mount *mp = sc->mp;
128128
129+ /* di_flags are all taken, last bit cannot be used */
129130 if (flags & ~XFS_DIFLAG_ANY)
130131 goto bad;
131132
@@ -172,8 +173,9 @@ xchk_inode_flags2( · 40 unmodified lines
172173 {
173174 struct xfs_mount *mp = sc->mp;
174175
176+ /* Unknown di_flags2 could be from a future kernel */
175177 if (flags2 & ~XFS_DIFLAG2_ANY)
176− goto bad;
178+ xchk_ino_set_warning(sc, ino);
177179
178180 /* reflink flag requires reflink feature */
179181 if ((flags2 & XFS_DIFLAG2_REFLINK) &&
fs/xfs/xfs_bmap_util.c+7−13
@@ -702,13 +702,9 @@ xfs_bmap_punch_delalloc_range( · 701 unmodified lines
702702 struct xfs_iext_cursor icur;
703703 int error = 0;
704704
705− xfs_ilock(ip, XFS_ILOCK_EXCL);
706− if (!(ifp->if_flags & XFS_IFEXTENTS)) {
707− error = xfs_iread_extents(NULL, ip, XFS_DATA_FORK);
708− if (error)
709− goto out_unlock;
710− }
705+ ASSERT(ifp->if_flags & XFS_IFEXTENTS);
711706
707+ xfs_ilock(ip, XFS_ILOCK_EXCL);
712708 if (!xfs_iext_lookup_extent_before(ip, ifp, &end_fsb, &icur, &got))
713709 goto out_unlock;
714710
@@ -1584,7 +1580,7 @@ xfs_swap_extent_rmap( · 869 unmodified lines
15841580 tirec.br_blockcount, &irec,
15851581 &nimaps, 0);
15861582 if (error)
1587− goto out_defer;
1583+ goto out;
15881584 ASSERT(nimaps == 1);
15891585 ASSERT(tirec.br_startoff == irec.br_startoff);
15901586 trace_xfs_swap_extent_rmap_remap_piece(ip, &irec);
@@ -1599,22 +1595,22 @@ xfs_swap_extent_rmap( · 8 unmodified lines
15991595 /* Remove the mapping from the donor file. */
16001596 error = xfs_bmap_unmap_extent(tp, tip, &uirec);
16011597 if (error)
1602− goto out_defer;
1598+ goto out;
16031599
16041600 /* Remove the mapping from the source file. */
16051601 error = xfs_bmap_unmap_extent(tp, ip, &irec);
16061602 if (error)
1607− goto out_defer;
1603+ goto out;
16081604
16091605 /* Map the donor file's blocks into the source file. */
16101606 error = xfs_bmap_map_extent(tp, ip, &uirec);
16111607 if (error)
1612− goto out_defer;
1608+ goto out;
16131609
16141610 /* Map the source file's blocks into the donor file. */
16151611 error = xfs_bmap_map_extent(tp, tip, &irec);
16161612 if (error)
1617− goto out_defer;
1613+ goto out;
16181614
16191615 error = xfs_defer_finish(tpp);
16201616 tp = *tpp;
@@ -1636,8 +1632,6 @@ xfs_swap_extent_rmap( · 15 unmodified lines
16361632 tip->i_d.di_flags2 = tip_flags2;
16371633 return 0;
16381634
1639−out_defer:
1640− xfs_defer_cancel(tp);
16411635 out:
16421636 trace_xfs_swap_extent_rmap_error(ip, error, _RET_IP_);
16431637 tip->i_d.di_flags2 = tip_flags2;
fs/xfs/xfs_buf_item.c+64−55
@@ -531,6 +531,49 @@ xfs_buf_item_push( · 530 unmodified lines
531531 return rval;
532532 }
533533
534+/*
535+ * Drop the buffer log item refcount and take appropriate action. This helper
536+ * determines whether the bli must be freed or not, since a decrement to zero
537+ * does not necessarily mean the bli is unused.
538+ *
539+ * Return true if the bli is freed, false otherwise.
540+ */
541+bool
542+xfs_buf_item_put(
543+ struct xfs_buf_log_item *bip)
544+{
545+ struct xfs_log_item *lip = &bip->bli_item;
546+ bool aborted;
547+ bool dirty;
548+
549+ /* drop the bli ref and return if it wasn't the last one */
550+ if (!atomic_dec_and_test(&bip->bli_refcount))
551+ return false;
552+
553+ /*
554+ * We dropped the last ref and must free the item if clean or aborted.
555+ * If the bli is dirty and non-aborted, the buffer was clean in the
556+ * transaction but still awaiting writeback from previous changes. In
557+ * that case, the bli is freed on buffer writeback completion.
558+ */
559+ aborted = test_bit(XFS_LI_ABORTED, &lip->li_flags) ||
560+ XFS_FORCED_SHUTDOWN(lip->li_mountp);
561+ dirty = bip->bli_flags & XFS_BLI_DIRTY;
562+ if (dirty && !aborted)
563+ return false;
564+
565+ /*
566+ * The bli is aborted or clean. An aborted item may be in the AIL
567+ * regardless of dirty state. For example, consider an aborted
568+ * transaction that invalidated a dirty bli and cleared the dirty
569+ * state.
570+ */
571+ if (aborted)
572+ xfs_trans_ail_remove(lip, SHUTDOWN_LOG_IO_ERROR);
573+ xfs_buf_item_relse(bip->bli_buf);
574+ return true;
575+}
576+
534577 /*
535578 * Release the buffer associated with the buf log item. If there is no dirty
536579 * logged data associated with the buffer recorded in the buf log item, then
@@ -556,76 +599,42 @@ xfs_buf_item_unlock( · 19 unmodified lines
556599 {
557600 struct xfs_buf_log_item *bip = BUF_ITEM(lip);
558601 struct xfs_buf *bp = bip->bli_buf;
559− bool aborted;
560− bool hold = !!(bip->bli_flags & XFS_BLI_HOLD);
561− bool dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);
602+ bool released;
603+ bool hold = bip->bli_flags & XFS_BLI_HOLD;
604+ bool stale = bip->bli_flags & XFS_BLI_STALE;
562605 #if defined(DEBUG) || defined(XFS_WARN)
563− bool ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
606+ bool ordered = bip->bli_flags & XFS_BLI_ORDERED;
607+ bool dirty = bip->bli_flags & XFS_BLI_DIRTY;
564608 #endif
565609
566− aborted = test_bit(XFS_LI_ABORTED, &lip->li_flags);
567−
568− /* Clear the buffer's association with this transaction. */
569− bp->b_transp = NULL;
570−
571− /*
572− * The per-transaction state has been copied above so clear it from the
573− * bli.
574− */
575− bip->bli_flags &= ~(XFS_BLI_LOGGED | XFS_BLI_HOLD | XFS_BLI_ORDERED);
576−
577− /*
578− * If the buf item is marked stale, then don't do anything. We'll
579− * unlock the buffer and free the buf item when the buffer is unpinned
580− * for the last time.
581− */
582− if (bip->bli_flags & XFS_BLI_STALE) {
583− trace_xfs_buf_item_unlock_stale(bip);
584− ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL);
585− if (!aborted) {
586− atomic_dec(&bip->bli_refcount);
587− return;
588− }
589− }
590−
591610 trace_xfs_buf_item_unlock(bip);
592611
593612 /*
594− * If the buf item isn't tracking any data, free it, otherwise drop the
595− * reference we hold to it. If we are aborting the transaction, this may
596− * be the only reference to the buf item, so we free it anyway
597− * regardless of whether it is dirty or not. A dirty abort implies a
598− * shutdown, anyway.
599− *
600613 * The bli dirty state should match whether the blf has logged segments
601614 * except for ordered buffers, where only the bli should be dirty.
602615 */
603616 ASSERT((!ordered && dirty == xfs_buf_item_dirty_format(bip)) ||
604617 (ordered && dirty && !xfs_buf_item_dirty_format(bip)));
618+ ASSERT(!stale || (bip->__bli_format.blf_flags & XFS_BLF_CANCEL));
605619
606620 /*
607− * Clean buffers, by definition, cannot be in the AIL. However, aborted
608− * buffers may be in the AIL regardless of dirty state. An aborted
609− * transaction that invalidates a buffer already in the AIL may have
610− * marked it stale and cleared the dirty state, for example.
611− *
612− * Therefore if we are aborting a buffer and we've just taken the last
613− * reference away, we have to check if it is in the AIL before freeing
614− * it. We need to free it in this case, because an aborted transaction
615− * has already shut the filesystem down and this is the last chance we
616− * will have to do so.
621+ * Clear the buffer's association with this transaction and
622+ * per-transaction state from the bli, which has been copied above.
617623 */
618− if (atomic_dec_and_test(&bip->bli_refcount)) {
619− if (aborted) {
620− ASSERT(XFS_FORCED_SHUTDOWN(lip->li_mountp));
621− xfs_trans_ail_remove(lip, SHUTDOWN_LOG_IO_ERROR);
622− xfs_buf_item_relse(bp);
623− } else if (!dirty)
624− xfs_buf_item_relse(bp);
625− }
624+ bp->b_transp = NULL;
625+ bip->bli_flags &= ~(XFS_BLI_LOGGED | XFS_BLI_HOLD | XFS_BLI_ORDERED);
626626
627− if (!hold)
628− xfs_buf_relse(bp);
627+ /*
628+ * Unref the item and unlock the buffer unless held or stale. Stale
629+ * buffers remain locked until final unpin unless the bli is freed by
630+ * the unref call. The latter implies shutdown because buffer
631+ * invalidation dirties the bli and transaction.
632+ */
633+ released = xfs_buf_item_put(bip);
634+ if (hold || (stale && !released))
635+ return;
636+ ASSERT(!stale || test_bit(XFS_LI_ABORTED, &lip->li_flags));
637+ xfs_buf_relse(bp);
629638 }
630639
631640 /*
fs/xfs/xfs_buf_item.h+1−0
@@ -51,6 +51,7 @@ struct xfs_buf_log_item { · 50 unmodified lines
5151
5252 int xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
5353 void xfs_buf_item_relse(struct xfs_buf *);
54+bool xfs_buf_item_put(struct xfs_buf_log_item *);
5455 void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
5556 bool xfs_buf_item_dirty_format(struct xfs_buf_log_item *);
5657 void xfs_buf_attach_iodone(struct xfs_buf *,
fs/xfs/xfs_inode.c+1−9
@@ -1563,7 +1563,7 @@ xfs_itruncate_extents_flags( · 1562 unmodified lines
15631563 error = xfs_bunmapi(tp, ip, first_unmap_block, unmap_len, flags,
15641564 XFS_ITRUNC_MAX_EXTENTS, &done);
15651565 if (error)
1566− goto out_bmap_cancel;
1566+ goto out;
15671567
15681568 /*
15691569 * Duplicate the transaction that has the permanent
@@ -1599,14 +1599,6 @@ xfs_itruncate_extents_flags( · 29 unmodified lines
15991599 out:
16001600 *tpp = tp;
16011601 return error;
1602−out_bmap_cancel:
1603− /*
1604− * If the bunmapi call encounters an error, return to the caller where
1605− * the transaction can be properly aborted. We just need to make sure
1606− * we're not holding any resources that we were not when we came in.
1607− */
1608− xfs_defer_cancel(tp);
1609− goto out;
16101602 }
16111603
16121604 int
fs/xfs/xfs_iops.c+11−1
@@ -471,8 +471,18 @@ xfs_vn_get_link_inline( · 470 unmodified lines
471471 struct inode *inode,
472472 struct delayed_call *done)
473473 {
474+ char *link;
475+
474476 ASSERT(XFS_I(inode)->i_df.if_flags & XFS_IFINLINE);
475− return XFS_I(inode)->i_df.if_u1.if_data;
477+
478+ /*
479+ * The VFS crashes on a NULL pointer, so return -EFSCORRUPTED if
480+ * if_data is junk.
481+ */
482+ link = XFS_I(inode)->i_df.if_u1.if_data;
483+ if (!link)
484+ return ERR_PTR(-EFSCORRUPTED);
485+ return link;
476486 }
477487
478488 STATIC int
fs/xfs/xfs_log_recover.c+0−10
@@ -1570,16 +1570,6 @@ xlog_find_zeroed( · 1569 unmodified lines
15701570 if (last_cycle != 0) { /* log completely written to */
15711571 xlog_put_bp(bp);
15721572 return 0;
1573− } else if (first_cycle != 1) {
1574− /*
1575− * If the cycle of the last block is zero, the cycle of
1576− * the first block must be 1. If it's not, maybe we're
1577− * not looking at a log... Bail out.
1578− */
1579− xfs_warn(log->l_mp,
1580− "Log inconsistent or not a log (last==0, first!=1)");
1581− error = -EINVAL;
1582− goto bp_err;
15831573 }
15841574
15851575 /* we have a partially zeroed log */
fs/xfs/xfs_reflink.c+81−56
@@ -352,6 +352,47 @@ xfs_reflink_convert_cow( · 351 unmodified lines
352352 return error;
353353 }
354354
355+/*
356+ * Find the extent that maps the given range in the COW fork. Even if the extent
357+ * is not shared we might have a preallocation for it in the COW fork. If so we
358+ * use it that rather than trigger a new allocation.
359+ */
360+static int
361+xfs_find_trim_cow_extent(
362+ struct xfs_inode *ip,
363+ struct xfs_bmbt_irec *imap,
364+ bool *shared,
365+ bool *found)
366+{
367+ xfs_fileoff_t offset_fsb = imap->br_startoff;
368+ xfs_filblks_t count_fsb = imap->br_blockcount;
369+ struct xfs_iext_cursor icur;
370+ struct xfs_bmbt_irec got;
371+ bool trimmed;
372+
373+ *found = false;
374+
375+ /*
376+ * If we don't find an overlapping extent, trim the range we need to
377+ * allocate to fit the hole we found.
378+ */
379+ if (!xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got) ||
380+ got.br_startoff > offset_fsb)
381+ return xfs_reflink_trim_around_shared(ip, imap, shared, &trimmed);
382+
383+ *shared = true;
384+ if (isnullstartblock(got.br_startblock)) {
385+ xfs_trim_extent(imap, got.br_startoff, got.br_blockcount);
386+ return 0;
387+ }
388+
389+ /* real extent found - no need to allocate */
390+ xfs_trim_extent(&got, offset_fsb, count_fsb);
391+ *imap = got;
392+ *found = true;
393+ return 0;
394+}
395+
355396 /* Allocate all CoW reservations covering a range of blocks in a file. */
356397 int
357398 xfs_reflink_allocate_cow(
@@ -363,78 +404,64 @@ xfs_reflink_allocate_cow( · 5 unmodified lines
363404 struct xfs_mount *mp = ip->i_mount;
364405 xfs_fileoff_t offset_fsb = imap->br_startoff;
365406 xfs_filblks_t count_fsb = imap->br_blockcount;
366− struct xfs_bmbt_irec got;
367− struct xfs_trans *tp = NULL;
407+ struct xfs_trans *tp;
368408 int nimaps, error = 0;
369− bool trimmed;
409+ bool found;
370410 xfs_filblks_t resaligned;
371411 xfs_extlen_t resblks = 0;
372− struct xfs_iext_cursor icur;
373412
374−retry:
375− ASSERT(xfs_is_reflink_inode(ip));
376413 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
414+ ASSERT(xfs_is_reflink_inode(ip));
377415
378− /*
379− * Even if the extent is not shared we might have a preallocation for
380− * it in the COW fork. If so use it.
381− */
382− if (xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got) &&
383− got.br_startoff <= offset_fsb) {
384− *shared = true;
385−
386− /* If we have a real allocation in the COW fork we're done. */
387− if (!isnullstartblock(got.br_startblock)) {
388− xfs_trim_extent(&got, offset_fsb, count_fsb);
389− *imap = got;
390− goto convert;
391− }
416+ error = xfs_find_trim_cow_extent(ip, imap, shared, &found);
417+ if (error || !*shared)
418+ return error;
419+ if (found)
420+ goto convert;
392421
393− xfs_trim_extent(imap, got.br_startoff, got.br_blockcount);
394− } else {
395− error = xfs_reflink_trim_around_shared(ip, imap, shared, &trimmed);
396− if (error || !*shared)
397− goto out;
398− }
422+ resaligned = xfs_aligned_fsb_count(imap->br_startoff,
423+ imap->br_blockcount, xfs_get_cowextsz_hint(ip));
424+ resblks = XFS_DIOSTRAT_SPACE_RES(mp, resaligned);
399425
400− if (!tp) {
401− resaligned = xfs_aligned_fsb_count(imap->br_startoff,
402− imap->br_blockcount, xfs_get_cowextsz_hint(ip));
403− resblks = XFS_DIOSTRAT_SPACE_RES(mp, resaligned);
426+ xfs_iunlock(ip, *lockmode);
427+ error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, 0, 0, &tp);
428+ *lockmode = XFS_ILOCK_EXCL;
429+ xfs_ilock(ip, *lockmode);
404430
405− xfs_iunlock(ip, *lockmode);
406− error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, 0, 0, &tp);
407− *lockmode = XFS_ILOCK_EXCL;
408− xfs_ilock(ip, *lockmode);
431+ if (error)
432+ return error;
409433
410− if (error)
411− return error;
434+ error = xfs_qm_dqattach_locked(ip, false);
435+ if (error)
436+ goto out_trans_cancel;
412437
413− error = xfs_qm_dqattach_locked(ip, false);
414− if (error)
415− goto out;
416− goto retry;
438+ /*
439+ * Check for an overlapping extent again now that we dropped the ilock.
440+ */
441+ error = xfs_find_trim_cow_extent(ip, imap, shared, &found);
442+ if (error || !*shared)
443+ goto out_trans_cancel;
444+ if (found) {
445+ xfs_trans_cancel(tp);
446+ goto convert;
417447 }
418448
419449 error = xfs_trans_reserve_quota_nblks(tp, ip, resblks, 0,
420450 XFS_QMOPT_RES_REGBLKS);
421451 if (error)
422− goto out;
452+ goto out_trans_cancel;
423453
424454 xfs_trans_ijoin(tp, ip, 0);
425455
426− nimaps = 1;
427−
428456 /* Allocate the entire reservation as unwritten blocks. */
457+ nimaps = 1;
429458 error = xfs_bmapi_write(tp, ip, imap->br_startoff, imap->br_blockcount,
430459 XFS_BMAPI_COWFORK | XFS_BMAPI_PREALLOC,
431460 resblks, imap, &nimaps);
432461 if (error)
433− goto out_trans_cancel;
462+ goto out_unreserve;
434463
435464 xfs_inode_set_cowblocks_tag(ip);
436−
437− /* Finish up. */
438465 error = xfs_trans_commit(tp);
439466 if (error)
440467 return error;
@@ -447,12 +474,12 @@ retry: · 6 unmodified lines
447474 return -ENOSPC;
448475 convert:
449476 return xfs_reflink_convert_cow_extent(ip, imap, offset_fsb, count_fsb);
450−out_trans_cancel:
477+
478+out_unreserve:
451479 xfs_trans_unreserve_quota_nblks(tp, ip, (long)resblks, 0,
452480 XFS_QMOPT_RES_REGBLKS);
453−out:
454− if (tp)
455− xfs_trans_cancel(tp);
481+out_trans_cancel:
482+ xfs_trans_cancel(tp);
456483 return error;
457484 }
458485
@@ -666,14 +693,12 @@ xfs_reflink_end_cow( · 207 unmodified lines
666693 if (!del.br_blockcount)
667694 goto prev_extent;
668695
669− ASSERT(!isnullstartblock(got.br_startblock));
670−
671696 /*
672− * Don't remap unwritten extents; these are
673− * speculatively preallocated CoW extents that have been
674− * allocated but have not yet been involved in a write.
697+ * Only remap real extent that contain data. With AIO
698+ * speculatively preallocations can leak into the range we
699+ * are called upon, and we need to skip them.
675700 */
676− if (got.br_state == XFS_EXT_UNWRITTEN)
701+ if (!xfs_bmap_is_real_extent(&got))
677702 goto prev_extent;
678703
679704 /* Unmap the old blocks in the data fork. */
fs/xfs/xfs_trace.h+0−1
@@ -473,7 +473,6 @@ DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin); · 472 unmodified lines
473473 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
474474 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
475475 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
476−DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
477476 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
478477 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
479478 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
fs/xfs/xfs_trans.c+8−2
@@ -259,6 +259,14 @@ xfs_trans_alloc( · 258 unmodified lines
259259 struct xfs_trans *tp;
260260 int error;
261261
262+ /*
263+ * Allocate the handle before we do our freeze accounting and setting up
264+ * GFP_NOFS allocation context so that we avoid lockdep false positives
265+ * by doing GFP_KERNEL allocations inside sb_start_intwrite().
266+ */
267+ tp = kmem_zone_zalloc(xfs_trans_zone,
268+ (flags & XFS_TRANS_NOFS) ? KM_NOFS : KM_SLEEP);
269+
262270 if (!(flags & XFS_TRANS_NO_WRITECOUNT))
263271 sb_start_intwrite(mp->m_super);
264272
@@ -270,8 +278,6 @@ xfs_trans_alloc( · 5 unmodified lines
270278 mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE);
271279 atomic_inc(&mp->m_active_trans);
272280
273− tp = kmem_zone_zalloc(xfs_trans_zone,
274− (flags & XFS_TRANS_NOFS) ? KM_NOFS : KM_SLEEP);
275281 tp->t_magic = XFS_TRANS_HEADER_MAGIC;
276282 tp->t_flags = flags;
277283 tp->t_mountp = mp;
fs/xfs/xfs_trans_buf.c+24−75
@@ -322,49 +322,38 @@ xfs_trans_read_buf_map( · 321 unmodified lines
322322 }
323323
324324 /*
325− * Release the buffer bp which was previously acquired with one of the
326− * xfs_trans_... buffer allocation routines if the buffer has not
327− * been modified within this transaction. If the buffer is modified
328− * within this transaction, do decrement the recursion count but do
329− * not release the buffer even if the count goes to 0. If the buffer is not
330− * modified within the transaction, decrement the recursion count and
331− * release the buffer if the recursion count goes to 0.
325+ * Release a buffer previously joined to the transaction. If the buffer is
326+ * modified within this transaction, decrement the recursion count but do not
327+ * release the buffer even if the count goes to 0. If the buffer is not modified
328+ * within the transaction, decrement the recursion count and release the buffer
329+ * if the recursion count goes to 0.
332330 *
333− * If the buffer is to be released and it was not modified before
334− * this transaction began, then free the buf_log_item associated with it.
331+ * If the buffer is to be released and it was not already dirty before this
332+ * transaction began, then also free the buf_log_item associated with it.
335333 *
336− * If the transaction pointer is NULL, make this just a normal
337− * brelse() call.
334+ * If the transaction pointer is NULL, this is a normal xfs_buf_relse() call.
338335 */
339336 void
340337 xfs_trans_brelse(
341− xfs_trans_t *tp,
342− xfs_buf_t *bp)
338+ struct xfs_trans *tp,
339+ struct xfs_buf *bp)
343340 {
344− struct xfs_buf_log_item *bip;
345− int freed;
341+ struct xfs_buf_log_item *bip = bp->b_log_item;
346342
347− /*
348− * Default to a normal brelse() call if the tp is NULL.
349− */
350− if (tp == NULL) {
351− ASSERT(bp->b_transp == NULL);
343+ ASSERT(bp->b_transp == tp);
344+
345+ if (!tp) {
352346 xfs_buf_relse(bp);
353347 return;
354348 }
355349
356− ASSERT(bp->b_transp == tp);
357− bip = bp->b_log_item;
350+ trace_xfs_trans_brelse(bip);
358351 ASSERT(bip->bli_item.li_type == XFS_LI_BUF);
359− ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
360− ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL));
361352 ASSERT(atomic_read(&bip->bli_refcount) > 0);
362353
363− trace_xfs_trans_brelse(bip);
364−
365354 /*
366− * If the release is just for a recursive lock,
367− * then decrement the count and return.
355+ * If the release is for a recursive lookup, then decrement the count
356+ * and return.
368357 */
369358 if (bip->bli_recur > 0) {
370359 bip->bli_recur--;
@@ -372,64 +361,24 @@ xfs_trans_brelse( · 1 unmodified line
372361 }
373362
374363 /*
375− * If the buffer is dirty within this transaction, we can't
364+ * If the buffer is invalidated or dirty in this transaction, we can't
376365 * release it until we commit.
377366 */
378367 if (test_bit(XFS_LI_DIRTY, &bip->bli_item.li_flags))
379368 return;
380−
381− /*
382− * If the buffer has been invalidated, then we can't release
383− * it until the transaction commits to disk unless it is re-dirtied
384− * as part of this transaction. This prevents us from pulling
385− * the item from the AIL before we should.
386− */
387369 if (bip->bli_flags & XFS_BLI_STALE)
388370 return;
389371
390− ASSERT(!(bip->bli_flags & XFS_BLI_LOGGED));
391−
392372 /*
393− * Free up the log item descriptor tracking the released item.
373+ * Unlink the log item from the transaction and clear the hold flag, if
374+ * set. We wouldn't want the next user of the buffer to get confused.
394375 */
376+ ASSERT(!(bip->bli_flags & XFS_BLI_LOGGED));
395377 xfs_trans_del_item(&bip->bli_item);
378+ bip->bli_flags &= ~XFS_BLI_HOLD;
396379
397− /*
398− * Clear the hold flag in the buf log item if it is set.
399− * We wouldn't want the next user of the buffer to
400− * get confused.
401− */
402− if (bip->bli_flags & XFS_BLI_HOLD) {
403− bip->bli_flags &= ~XFS_BLI_HOLD;
404− }
405−
406− /*
407− * Drop our reference to the buf log item.
408− */
409− freed = atomic_dec_and_test(&bip->bli_refcount);
410−
411− /*
412− * If the buf item is not tracking data in the log, then we must free it
413− * before releasing the buffer back to the free pool.
414− *
415− * If the fs has shutdown and we dropped the last reference, it may fall
416− * on us to release a (possibly dirty) bli if it never made it to the
417− * AIL (e.g., the aborted unpin already happened and didn't release it
418− * due to our reference). Since we're already shutdown and need
419− * ail_lock, just force remove from the AIL and release the bli here.
420− */
421− if (XFS_FORCED_SHUTDOWN(tp->t_mountp) && freed) {
422− xfs_trans_ail_remove(&bip->bli_item, SHUTDOWN_LOG_IO_ERROR);
423− xfs_buf_item_relse(bp);
424− } else if (!(bip->bli_flags & XFS_BLI_DIRTY)) {
425−/***
426− ASSERT(bp->b_pincount == 0);
427−***/
428− ASSERT(atomic_read(&bip->bli_refcount) == 0);
429− ASSERT(!test_bit(XFS_LI_IN_AIL, &bip->bli_item.li_flags));
430− ASSERT(!(bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF));
431− xfs_buf_item_relse(bp);
432− }
380+ /* drop the reference to the bli */
381+ xfs_buf_item_put(bip);
433382
434383 bp->b_transp = NULL;
435384 xfs_buf_relse(bp);
include/drm/drm_client.h+3−2
@@ -87,9 +87,10 @@ struct drm_client_dev { · 86 unmodified lines
8787 struct drm_file *file;
8888 };
8989
90−int drm_client_new(struct drm_device *dev, struct drm_client_dev *client,
91− const char *name, const struct drm_client_funcs *funcs);
90+int drm_client_init(struct drm_device *dev, struct drm_client_dev *client,
91+ const char *name, const struct drm_client_funcs *funcs);
9292 void drm_client_release(struct drm_client_dev *client);
93+void drm_client_add(struct drm_client_dev *client);
9394
9495 void drm_client_dev_unregister(struct drm_device *dev);
9596 void drm_client_dev_hotplug(struct drm_device *dev);
include/linux/fpga/fpga-mgr.h+14−6
@@ -53,12 +53,20 @@ enum fpga_mgr_states { · 52 unmodified lines
5353 FPGA_MGR_STATE_OPERATING,
5454 };
5555
56−/*
57− * FPGA Manager flags
58− * FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported
59− * FPGA_MGR_EXTERNAL_CONFIG: FPGA has been configured prior to Linux booting
60− * FPGA_MGR_BITSTREAM_LSB_FIRST: SPI bitstream bit order is LSB first
61− * FPGA_MGR_COMPRESSED_BITSTREAM: FPGA bitstream is compressed
56+/**
57+ * DOC: FPGA Manager flags
58+ *
59+ * Flags used in the &fpga_image_info->flags field
60+ *
61+ * %FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported
62+ *
63+ * %FPGA_MGR_EXTERNAL_CONFIG: FPGA has been configured prior to Linux booting
64+ *
65+ * %FPGA_MGR_ENCRYPTED_BITSTREAM: indicates bitstream is encrypted
66+ *
67+ * %FPGA_MGR_BITSTREAM_LSB_FIRST: SPI bitstream bit order is LSB first
68+ *
69+ * %FPGA_MGR_COMPRESSED_BITSTREAM: FPGA bitstream is compressed
6270 */
6371 #define FPGA_MGR_PARTIAL_RECONFIG BIT(0)
6472 #define FPGA_MGR_EXTERNAL_CONFIG BIT(1)
include/linux/fs.h+3−14
@@ -1828,8 +1828,10 @@ extern ssize_t vfs_copy_file_range(struct file *, loff_t , struct file *, · 1827 unmodified lines
18281828 extern int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,
18291829 struct inode *inode_out, loff_t pos_out,
18301830 u64 *len, bool is_dedupe);
1831+extern int do_clone_file_range(struct file *file_in, loff_t pos_in,
1832+ struct file *file_out, loff_t pos_out, u64 len);
18311833 extern int vfs_clone_file_range(struct file *file_in, loff_t pos_in,
1832− struct file *file_out, loff_t pos_out, u64 len);
1834+ struct file *file_out, loff_t pos_out, u64 len);
18331835 extern int vfs_dedupe_file_range_compare(struct inode *src, loff_t srcoff,
18341836 struct inode *dest, loff_t destoff,
18351837 loff_t len, bool *is_same);
@@ -2773,19 +2775,6 @@ static inline void file_end_write(struct file *file) · 937 unmodified lines
27732775 __sb_end_write(file_inode(file)->i_sb, SB_FREEZE_WRITE);
27742776 }
27752777
2776−static inline int do_clone_file_range(struct file *file_in, loff_t pos_in,
2777− struct file *file_out, loff_t pos_out,
2778− u64 len)
2779−{
2780− int ret;
2781−
2782− file_start_write(file_out);
2783− ret = vfs_clone_file_range(file_in, pos_in, file_out, pos_out, len);
2784− file_end_write(file_out);
2785−
2786− return ret;
2787−}
2788−
27892778 /*
27902779 * get_write_access() gets write permission for a file.
27912780 * put_write_access() releases this write permission.
include/linux/hugetlb.h+14−0
@@ -140,6 +140,8 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, · 139 unmodified lines
140140 pte_t *huge_pte_offset(struct mm_struct *mm,
141141 unsigned long addr, unsigned long sz);
142142 int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep);
143+void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,
144+ unsigned long *start, unsigned long *end);
143145 struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
144146 int write);
145147 struct page *follow_huge_pd(struct vm_area_struct *vma,
@@ -170,6 +172,18 @@ static inline unsigned long hugetlb_total_pages(void) · 24 unmodified lines
170172 return 0;
171173 }
172174
175+static inline int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr,
176+ pte_t *ptep)
177+{
178+ return 0;
179+}
180+
181+static inline void adjust_range_if_pmd_sharing_possible(
182+ struct vm_area_struct *vma,
183+ unsigned long *start, unsigned long *end)
184+{
185+}
186+
173187 #define follow_hugetlb_page(m,v,p,vs,a,b,i,w,n) ({ BUG(); 0; })
174188 #define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL)
175189 #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; })
include/linux/mlx5/transobj.h+2−0
@@ -90,6 +90,8 @@ struct mlx5_hairpin { · 89 unmodified lines
9090
9191 u32 *rqn;
9292 u32 *sqn;
93+
94+ bool peer_gone;
9395 };
9496
9597 struct mlx5_hairpin *
include/linux/mm.h+6−0
@@ -2455,6 +2455,12 @@ static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm, · 2454 unmodified lines
24552455 return vma;
24562456 }
24572457
2458+static inline bool range_in_vma(struct vm_area_struct *vma,
2459+ unsigned long start, unsigned long end)
2460+{
2461+ return (vma && vma->vm_start <= start && end <= vma->vm_end);
2462+}
2463+
24582464 #ifdef CONFIG_MMU
24592465 pgprot_t vm_get_page_prot(unsigned long vm_flags);
24602466 void vma_set_page_prot(struct vm_area_struct *vma);
include/linux/mmzone.h+0−6
@@ -671,12 +671,6 @@ typedef struct pglist_data { · 670 unmodified lines
671671 #ifdef CONFIG_NUMA_BALANCING
672672 /* Lock serializing the migrate rate limiting window */
673673 spinlock_t numabalancing_migrate_lock;
674−
675− /* Rate limiting time interval */
676− unsigned long numabalancing_migrate_next_window;
677−
678− /* Number of pages migrated during the rate limiting time interval */
679− unsigned long numabalancing_migrate_nr_pages;
680674 #endif
681675 /*
682676 * This is a per-node reserve of pages that are not available
include/linux/netdevice.h+3−0
@@ -1730,6 +1730,8 @@ enum netdev_priv_flags { · 1729 unmodified lines
17301730 * switch driver and used to set the phys state of the
17311731 * switch port.
17321732 *
1733+ * @wol_enabled: Wake-on-LAN is enabled
1734+ *
17331735 * FIXME: cleanup struct net_device such that network protocol info
17341736 * moves out.
17351737 */
@@ -2014,6 +2016,7 @@ struct net_device { · 278 unmodified lines
20142016 struct lock_class_key *qdisc_tx_busylock;
20152017 struct lock_class_key *qdisc_running_key;
20162018 bool proto_down;
2019+ unsigned wol_enabled:1;
20172020 };
20182021 #define to_net_dev(d) container_of(d, struct net_device, dev)
20192022
include/linux/netfilter.h+2−0
@@ -215,6 +215,8 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net, · 214 unmodified lines
215215 break;
216216 case NFPROTO_ARP:
217217 #ifdef CONFIG_NETFILTER_FAMILY_ARP
218+ if (WARN_ON_ONCE(hook >= ARRAY_SIZE(net->nf.hooks_arp)))
219+ break;
218220 hook_head = rcu_dereference(net->nf.hooks_arp[hook]);
219221 #endif
220222 break;
include/linux/serial_sci.h+1−0
@@ -36,6 +36,7 @@ enum { · 35 unmodified lines
3636 SCIx_SH4_SCIF_FIFODATA_REGTYPE,
3737 SCIx_SH7705_SCIF_REGTYPE,
3838 SCIx_HSCIF_REGTYPE,
39+ SCIx_RZ_SCIFA_REGTYPE,
3940
4041 SCIx_NR_REGTYPES,
4142 };
include/linux/virtio_net.h+18−0
@@ -5,6 +5,24 @@ · 4 unmodified lines
55 #include <linux/if_vlan.h>
66 #include <uapi/linux/virtio_net.h>
77
8+static inline int virtio_net_hdr_set_proto(struct sk_buff *skb,
9+ const struct virtio_net_hdr *hdr)
10+{
11+ switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
12+ case VIRTIO_NET_HDR_GSO_TCPV4:
13+ case VIRTIO_NET_HDR_GSO_UDP:
14+ skb->protocol = cpu_to_be16(ETH_P_IP);
15+ break;
16+ case VIRTIO_NET_HDR_GSO_TCPV6:
17+ skb->protocol = cpu_to_be16(ETH_P_IPV6);
18+ break;
19+ default:
20+ return -EINVAL;
21+ }
22+
23+ return 0;
24+}
25+
826 static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
927 const struct virtio_net_hdr *hdr,
1028 bool little_endian)
include/media/v4l2-fh.h+4−0
@@ -38,10 +38,13 @@ struct v4l2_ctrl_handler; · 37 unmodified lines
3838 * @prio: priority of the file handler, as defined by &enum v4l2_priority
3939 *
4040 * @wait: event' s wait queue
41+ * @subscribe_lock: serialise changes to the subscribed list; guarantee that
42+ * the add and del event callbacks are orderly called
4143 * @subscribed: list of subscribed events
4244 * @available: list of events waiting to be dequeued
4345 * @navailable: number of available events at @available list
4446 * @sequence: event sequence number
47+ *
4548 * @m2m_ctx: pointer to &struct v4l2_m2m_ctx
4649 */
4750 struct v4l2_fh {
@@ -52,6 +55,7 @@ struct v4l2_fh { · 4 unmodified lines
5255
5356 /* Events */
5457 wait_queue_head_t wait;
58+ struct mutex subscribe_lock;
5559 struct list_head subscribed;
5660 struct list_head available;
5761 unsigned int navailable;
include/net/bonding.h+1−6
@@ -139,12 +139,6 @@ struct bond_parm_tbl { · 138 unmodified lines
139139 int mode;
140140 };
141141
142−struct netdev_notify_work {
143− struct delayed_work work;
144− struct net_device *dev;
145− struct netdev_bonding_info bonding_info;
146−};
147−
148142 struct slave {
149143 struct net_device *dev; /* first - useful for panic debug */
150144 struct bonding *bond; /* our master */
@@ -172,6 +166,7 @@ struct slave { · 21 unmodified lines
172166 #ifdef CONFIG_NET_POLL_CONTROLLER
173167 struct netpoll *np;
174168 #endif
169+ struct delayed_work notify_work;
175170 struct kobject kobj;
176171 struct rtnl_link_stats64 slave_stats;
177172 };
include/net/cfg80211.h+0−2
@@ -4852,8 +4852,6 @@ const char *reg_initiator_name(enum nl80211_reg_initiator initiator); · 4851 unmodified lines
48524852 *
48534853 * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
48544854 * @freq: the freqency(in MHz) to be queried.
4855− * @ptr: pointer where the regdb wmm data is to be stored (or %NULL if
4856− * irrelevant). This can be used later for deduplication.
48574855 * @rule: pointer to store the wmm rule from the regulatory db.
48584856 *
48594857 * Self-managed wireless drivers can use this function to query
include/net/inet_sock.h+0−6
@@ -130,12 +130,6 @@ static inline int inet_request_bound_dev_if(const struct sock *sk, · 129 unmodified lines
130130 return sk->sk_bound_dev_if;
131131 }
132132
133−static inline struct ip_options_rcu *ireq_opt_deref(const struct inet_request_sock *ireq)
134−{
135− return rcu_dereference_check(ireq->ireq_opt,
136− refcount_read(&ireq->req.rsk_refcnt) > 0);
137−}
138−
139133 struct inet_cork {
140134 unsigned int flags;
141135 __be32 addr;
include/net/netlink.h+1−1
@@ -153,7 +153,7 @@ · 152 unmodified lines
153153 * nla_find() find attribute in stream of attributes
154154 * nla_find_nested() find attribute in nested attributes
155155 * nla_parse() parse and validate stream of attrs
156− * nla_parse_nested() parse nested attribuets
156+ * nla_parse_nested() parse nested attributes
157157 * nla_for_each_attr() loop over all attributes
158158 * nla_for_each_nested() loop over the nested attributes
159159 *=========================================================================
include/trace/events/migrate.h+0−27
@@ -70,33 +70,6 @@ TRACE_EVENT(mm_migrate_pages, · 69 unmodified lines
7070 __print_symbolic(__entry->mode, MIGRATE_MODE),
7171 __print_symbolic(__entry->reason, MIGRATE_REASON))
7272 );
73−
74−TRACE_EVENT(mm_numa_migrate_ratelimit,
75−
76− TP_PROTO(struct task_struct *p, int dst_nid, unsigned long nr_pages),
77−
78− TP_ARGS(p, dst_nid, nr_pages),
79−
80− TP_STRUCT__entry(
81− __array( char, comm, TASK_COMM_LEN)
82− __field( pid_t, pid)
83− __field( int, dst_nid)
84− __field( unsigned long, nr_pages)
85− ),
86−
87− TP_fast_assign(
88− memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
89− __entry->pid = p->pid;
90− __entry->dst_nid = dst_nid;
91− __entry->nr_pages = nr_pages;
92− ),
93−
94− TP_printk("comm=%s pid=%d dst_nid=%d nr_pages=%lu",
95− __entry->comm,
96− __entry->pid,
97− __entry->dst_nid,
98− __entry->nr_pages)
99−);
10073 #endif /* _TRACE_MIGRATE_H */
10174
10275 /* This part must be outside protection */
include/trace/events/rxrpc.h+1−3
@@ -56,7 +56,6 @@ enum rxrpc_peer_trace { · 55 unmodified lines
5656 rxrpc_peer_new,
5757 rxrpc_peer_processing,
5858 rxrpc_peer_put,
59− rxrpc_peer_queued_error,
6059 };
6160
6261 enum rxrpc_conn_trace {
@@ -257,8 +256,7 @@ enum rxrpc_tx_point { · 194 unmodified lines
257256 EM(rxrpc_peer_got, "GOT") \
258257 EM(rxrpc_peer_new, "NEW") \
259258 EM(rxrpc_peer_processing, "PRO") \
260− EM(rxrpc_peer_put, "PUT") \
261− E_(rxrpc_peer_queued_error, "QER")
259+ E_(rxrpc_peer_put, "PUT")
262260
263261 #define rxrpc_conn_traces \
264262 EM(rxrpc_conn_got, "GOT") \
include/uapi/asm-generic/hugetlb_encode.h+2−0
@@ -26,7 +26,9 @@ · 25 unmodified lines
2626 #define HUGETLB_FLAG_ENCODE_2MB (21 << HUGETLB_FLAG_ENCODE_SHIFT)
2727 #define HUGETLB_FLAG_ENCODE_8MB (23 << HUGETLB_FLAG_ENCODE_SHIFT)
2828 #define HUGETLB_FLAG_ENCODE_16MB (24 << HUGETLB_FLAG_ENCODE_SHIFT)
29+#define HUGETLB_FLAG_ENCODE_32MB (25 << HUGETLB_FLAG_ENCODE_SHIFT)
2930 #define HUGETLB_FLAG_ENCODE_256MB (28 << HUGETLB_FLAG_ENCODE_SHIFT)
31+#define HUGETLB_FLAG_ENCODE_512MB (29 << HUGETLB_FLAG_ENCODE_SHIFT)
3032 #define HUGETLB_FLAG_ENCODE_1GB (30 << HUGETLB_FLAG_ENCODE_SHIFT)
3133 #define HUGETLB_FLAG_ENCODE_2GB (31 << HUGETLB_FLAG_ENCODE_SHIFT)
3234 #define HUGETLB_FLAG_ENCODE_16GB (34 << HUGETLB_FLAG_ENCODE_SHIFT)
include/uapi/linux/memfd.h+2−0
@@ -25,7 +25,9 @@ · 24 unmodified lines
2525 #define MFD_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB
2626 #define MFD_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB
2727 #define MFD_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB
28+#define MFD_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB
2829 #define MFD_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB
30+#define MFD_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB
2931 #define MFD_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB
3032 #define MFD_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB
3133 #define MFD_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB
include/uapi/linux/mman.h+2−0
@@ -28,7 +28,9 @@ · 27 unmodified lines
2828 #define MAP_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB
2929 #define MAP_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB
3030 #define MAP_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB
31+#define MAP_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB
3132 #define MAP_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB
33+#define MAP_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB
3234 #define MAP_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB
3335 #define MAP_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB
3436 #define MAP_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB
include/uapi/linux/shm.h+2−0
@@ -65,7 +65,9 @@ struct shmid_ds { · 64 unmodified lines
6565 #define SHM_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB
6666 #define SHM_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB
6767 #define SHM_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB
68+#define SHM_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB
6869 #define SHM_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB
70+#define SHM_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB
6971 #define SHM_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB
7072 #define SHM_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB
7173 #define SHM_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB
ipc/shm.c+1−1
@@ -206,7 +206,7 @@ err: · 205 unmodified lines
206206 * Callers of shm_lock() must validate the status of the returned ipc
207207 * object pointer and error out as appropriate.
208208 */
209− return (void *)ipcp;
209+ return ERR_CAST(ipcp);
210210 }
211211
212212 static inline void shm_lock_by_ptr(struct shmid_kernel *ipcp)
kernel/bpf/local_storage.c+4−1
@@ -129,7 +129,7 @@ static int cgroup_storage_update_elem(struct bpf_map *map, void *_key, · 128 unmodified lines
129129 struct bpf_cgroup_storage *storage;
130130 struct bpf_storage_buffer *new;
131131
132− if (flags & BPF_NOEXIST)
132+ if (flags != BPF_ANY && flags != BPF_EXIST)
133133 return -EINVAL;
134134
135135 storage = cgroup_storage_lookup((struct bpf_cgroup_storage_map *)map,
@@ -195,6 +195,9 @@ static struct bpf_map *cgroup_storage_map_alloc(union bpf_attr *attr) · 59 unmodified lines
195195 if (attr->key_size != sizeof(struct bpf_cgroup_storage_key))
196196 return ERR_PTR(-EINVAL);
197197
198+ if (attr->value_size == 0)
199+ return ERR_PTR(-EINVAL);
200+
198201 if (attr->value_size > PAGE_SIZE)
199202 return ERR_PTR(-E2BIG);
200203
kernel/bpf/verifier.c+9−1
@@ -2896,6 +2896,15 @@ static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env, · 2895 unmodified lines
28962896 u64 umin_val, umax_val;
28972897 u64 insn_bitness = (BPF_CLASS(insn->code) == BPF_ALU64) ? 64 : 32;
28982898
2899+ if (insn_bitness == 32) {
2900+ /* Relevant for 32-bit RSH: Information can propagate towards
2901+ * LSB, so it isn't sufficient to only truncate the output to
2902+ * 32 bits.
2903+ */
2904+ coerce_reg_to_size(dst_reg, 4);
2905+ coerce_reg_to_size(&src_reg, 4);
2906+ }
2907+
28992908 smin_val = src_reg.smin_value;
29002909 smax_val = src_reg.smax_value;
29012910 umin_val = src_reg.umin_value;
@@ -3131,7 +3140,6 @@ static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env, · 229 unmodified lines
31313140 if (BPF_CLASS(insn->code) != BPF_ALU64) {
31323141 /* 32-bit ALU ops are (32,32)->32 */
31333142 coerce_reg_to_size(dst_reg, 4);
3134− coerce_reg_to_size(&src_reg, 4);
31353143 }
31363144
31373145 __reg_deduce_bounds(dst_reg);
kernel/events/core.c+4−7
@@ -8314,6 +8314,8 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size, · 8313 unmodified lines
83148314 goto unlock;
83158315
83168316 list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
8317+ if (event->cpu != smp_processor_id())
8318+ continue;
83178319 if (event->attr.type != PERF_TYPE_TRACEPOINT)
83188320 continue;
83198321 if (event->attr.config != entry->type)
@@ -9431,9 +9433,7 @@ static void free_pmu_context(struct pmu *pmu) · 1111 unmodified lines
94319433 if (pmu->task_ctx_nr > perf_invalid_context)
94329434 return;
94339435
9434− mutex_lock(&pmus_lock);
94359436 free_percpu(pmu->pmu_cpu_context);
9436− mutex_unlock(&pmus_lock);
94379437 }
94389438
94399439 /*
@@ -9689,12 +9689,8 @@ EXPORT_SYMBOL_GPL(perf_pmu_register); · 249 unmodified lines
96899689
96909690 void perf_pmu_unregister(struct pmu *pmu)
96919691 {
9692− int remove_device;
9693−
96949692 mutex_lock(&pmus_lock);
9695− remove_device = pmu_bus_running;
96969693 list_del_rcu(&pmu->entry);
9697− mutex_unlock(&pmus_lock);
96989694
96999695 /*
97009696 * We dereference the pmu list under both SRCU and regular RCU, so
@@ -9706,13 +9702,14 @@ void perf_pmu_unregister(struct pmu *pmu) · 5 unmodified lines
97069702 free_percpu(pmu->pmu_disable_count);
97079703 if (pmu->type >= PERF_TYPE_MAX)
97089704 idr_remove(&pmu_idr, pmu->type);
9709− if (remove_device) {
9705+ if (pmu_bus_running) {
97109706 if (pmu->nr_addr_filters)
97119707 device_remove_file(pmu->dev, &dev_attr_nr_addr_filters);
97129708 device_del(pmu->dev);
97139709 put_device(pmu->dev);
97149710 }
97159711 free_pmu_context(pmu);
9712+ mutex_unlock(&pmus_lock);
97169713 }
97179714 EXPORT_SYMBOL_GPL(perf_pmu_unregister);
97189715
kernel/locking/test-ww_mutex.c+6−4
@@ -260,7 +260,7 @@ static void test_cycle_work(struct work_struct *work) · 259 unmodified lines
260260 {
261261 struct test_cycle *cycle = container_of(work, typeof(*cycle), work);
262262 struct ww_acquire_ctx ctx;
263− int err;
263+ int err, erra = 0;
264264
265265 ww_acquire_init(&ctx, &ww_class);
266266 ww_mutex_lock(&cycle->a_mutex, &ctx);
@@ -270,17 +270,19 @@ static void test_cycle_work(struct work_struct *work) · 3 unmodified lines
270270
271271 err = ww_mutex_lock(cycle->b_mutex, &ctx);
272272 if (err == -EDEADLK) {
273+ err = 0;
273274 ww_mutex_unlock(&cycle->a_mutex);
274275 ww_mutex_lock_slow(cycle->b_mutex, &ctx);
275− err = ww_mutex_lock(&cycle->a_mutex, &ctx);
276+ erra = ww_mutex_lock(&cycle->a_mutex, &ctx);
276277 }
277278
278279 if (!err)
279280 ww_mutex_unlock(cycle->b_mutex);
280− ww_mutex_unlock(&cycle->a_mutex);
281+ if (!erra)
282+ ww_mutex_unlock(&cycle->a_mutex);
281283 ww_acquire_fini(&ctx);
282284
283− cycle->result = err;
285+ cycle->result = err ?: erra;
284286 }
285287
286288 static int __test_cycle(unsigned int nthreads)
kernel/sched/core.c+1−1
@@ -1167,7 +1167,7 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu) · 1166 unmodified lines
11671167
11681168 if (task_cpu(p) != new_cpu) {
11691169 if (p->sched_class->migrate_task_rq)
1170− p->sched_class->migrate_task_rq(p);
1170+ p->sched_class->migrate_task_rq(p, new_cpu);
11711171 p->se.nr_migrations++;
11721172 rseq_migrate(p);
11731173 perf_event_task_migrate(p);
kernel/sched/deadline.c+1−1
@@ -1607,7 +1607,7 @@ out: · 1606 unmodified lines
16071607 return cpu;
16081608 }
16091609
1610−static void migrate_task_rq_dl(struct task_struct *p)
1610+static void migrate_task_rq_dl(struct task_struct *p, int new_cpu __maybe_unused)
16111611 {
16121612 struct rq *rq;
16131613
kernel/sched/fair.c+91−13
@@ -1392,6 +1392,17 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page, · 1391 unmodified lines
13921392 int last_cpupid, this_cpupid;
13931393
13941394 this_cpupid = cpu_pid_to_cpupid(dst_cpu, current->pid);
1395+ last_cpupid = page_cpupid_xchg_last(page, this_cpupid);
1396+
1397+ /*
1398+ * Allow first faults or private faults to migrate immediately early in
1399+ * the lifetime of a task. The magic number 4 is based on waiting for
1400+ * two full passes of the "multi-stage node selection" test that is
1401+ * executed below.
1402+ */
1403+ if ((p->numa_preferred_nid == -1 || p->numa_scan_seq <= 4) &&
1404+ (cpupid_pid_unset(last_cpupid) || cpupid_match_pid(p, last_cpupid)))
1405+ return true;
13951406
13961407 /*
13971408 * Multi-stage node selection is used in conjunction with a periodic
@@ -1410,7 +1421,6 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page, · 12 unmodified lines
14101421 * This quadric squishes small probabilities, making it less likely we
14111422 * act on an unlikely task<->page relation.
14121423 */
1413− last_cpupid = page_cpupid_xchg_last(page, this_cpupid);
14141424 if (!cpupid_pid_unset(last_cpupid) &&
14151425 cpupid_to_nid(last_cpupid) != dst_nid)
14161426 return false;
@@ -1514,6 +1524,21 @@ struct task_numa_env { · 97 unmodified lines
15141524 static void task_numa_assign(struct task_numa_env *env,
15151525 struct task_struct *p, long imp)
15161526 {
1527+ struct rq *rq = cpu_rq(env->dst_cpu);
1528+
1529+ /* Bail out if run-queue part of active NUMA balance. */
1530+ if (xchg(&rq->numa_migrate_on, 1))
1531+ return;
1532+
1533+ /*
1534+ * Clear previous best_cpu/rq numa-migrate flag, since task now
1535+ * found a better CPU to move/swap.
1536+ */
1537+ if (env->best_cpu != -1) {
1538+ rq = cpu_rq(env->best_cpu);
1539+ WRITE_ONCE(rq->numa_migrate_on, 0);
1540+ }
1541+
15171542 if (env->best_task)
15181543 put_task_struct(env->best_task);
15191544 if (p)
@@ -1552,6 +1577,13 @@ static bool load_too_imbalanced(long src_load, long dst_load, · 32 unmodified lines
15521577 return (imb > old_imb);
15531578 }
15541579
1580+/*
1581+ * Maximum NUMA importance can be 1998 (2*999);
1582+ * SMALLIMP @ 30 would be close to 1998/64.
1583+ * Used to deter task migration.
1584+ */
1585+#define SMALLIMP 30
1586+
15551587 /*
15561588 * This checks if the overall compute and NUMA accesses of the system would
15571589 * be improved if the source tasks was migrated to the target dst_cpu taking
@@ -1569,6 +1601,9 @@ static void task_numa_compare(struct task_numa_env *env, · 11 unmodified lines
15691601 long moveimp = imp;
15701602 int dist = env->dist;
15711603
1604+ if (READ_ONCE(dst_rq->numa_migrate_on))
1605+ return;
1606+
15721607 rcu_read_lock();
15731608 cur = task_rcu_dereference(&dst_rq->curr);
15741609 if (cur && ((cur->flags & PF_EXITING) || is_idle_task(cur)))
@@ -1582,7 +1617,7 @@ static void task_numa_compare(struct task_numa_env *env, · 7 unmodified lines
15821617 goto unlock;
15831618
15841619 if (!cur) {
1585− if (maymove || imp > env->best_imp)
1620+ if (maymove && moveimp >= env->best_imp)
15861621 goto assign;
15871622 else
15881623 goto unlock;
@@ -1625,15 +1660,21 @@ static void task_numa_compare(struct task_numa_env *env, · 36 unmodified lines
16251660 task_weight(cur, env->dst_nid, dist);
16261661 }
16271662
1628− if (imp <= env->best_imp)
1629− goto unlock;
1630−
16311663 if (maymove && moveimp > imp && moveimp > env->best_imp) {
1632− imp = moveimp - 1;
1664+ imp = moveimp;
16331665 cur = NULL;
16341666 goto assign;
16351667 }
16361668
1669+ /*
1670+ * If the NUMA importance is less than SMALLIMP,
1671+ * task migration might only result in ping pong
1672+ * of tasks and also hurt performance due to cache
1673+ * misses.
1674+ */
1675+ if (imp < SMALLIMP || imp <= env->best_imp + SMALLIMP / 2)
1676+ goto unlock;
1677+
16371678 /*
16381679 * In the overloaded case, try and keep the load balanced.
16391680 */
@@ -1710,6 +1751,7 @@ static int task_numa_migrate(struct task_struct *p) · 70 unmodified lines
17101751 .best_cpu = -1,
17111752 };
17121753 struct sched_domain *sd;
1754+ struct rq *best_rq;
17131755 unsigned long taskweight, groupweight;
17141756 int nid, ret, dist;
17151757 long taskimp, groupimp;
@@ -1805,20 +1847,17 @@ static int task_numa_migrate(struct task_struct *p) · 89 unmodified lines
18051847 if (env.best_cpu == -1)
18061848 return -EAGAIN;
18071849
1808− /*
1809− * Reset the scan period if the task is being rescheduled on an
1810− * alternative node to recheck if the tasks is now properly placed.
1811− */
1812− p->numa_scan_period = task_scan_start(p);
1813−
1850+ best_rq = cpu_rq(env.best_cpu);
18141851 if (env.best_task == NULL) {
18151852 ret = migrate_task_to(p, env.best_cpu);
1853+ WRITE_ONCE(best_rq->numa_migrate_on, 0);
18161854 if (ret != 0)
18171855 trace_sched_stick_numa(p, env.src_cpu, env.best_cpu);
18181856 return ret;
18191857 }
18201858
18211859 ret = migrate_swap(p, env.best_task, env.best_cpu, env.src_cpu);
1860+ WRITE_ONCE(best_rq->numa_migrate_on, 0);
18221861
18231862 if (ret != 0)
18241863 trace_sched_stick_numa(p, env.src_cpu, task_cpu(env.best_task));
@@ -2596,6 +2635,39 @@ void task_tick_numa(struct rq *rq, struct task_struct *curr) · 771 unmodified lines
25962635 }
25972636 }
25982637
2638+static void update_scan_period(struct task_struct *p, int new_cpu)
2639+{
2640+ int src_nid = cpu_to_node(task_cpu(p));
2641+ int dst_nid = cpu_to_node(new_cpu);
2642+
2643+ if (!static_branch_likely(&sched_numa_balancing))
2644+ return;
2645+
2646+ if (!p->mm || !p->numa_faults || (p->flags & PF_EXITING))
2647+ return;
2648+
2649+ if (src_nid == dst_nid)
2650+ return;
2651+
2652+ /*
2653+ * Allow resets if faults have been trapped before one scan
2654+ * has completed. This is most likely due to a new task that
2655+ * is pulled cross-node due to wakeups or load balancing.
2656+ */
2657+ if (p->numa_scan_seq) {
2658+ /*
2659+ * Avoid scan adjustments if moving to the preferred
2660+ * node or if the task was not previously running on
2661+ * the preferred node.
2662+ */
2663+ if (dst_nid == p->numa_preferred_nid ||
2664+ (p->numa_preferred_nid != -1 && src_nid != p->numa_preferred_nid))
2665+ return;
2666+ }
2667+
2668+ p->numa_scan_period = task_scan_start(p);
2669+}
2670+
25992671 #else
26002672 static void task_tick_numa(struct rq *rq, struct task_struct *curr)
26012673 {
@@ -2609,6 +2681,10 @@ static inline void account_numa_dequeue(struct rq *rq, struct task_struct *p) · 7 unmodified lines
26092681 {
26102682 }
26112683
2684+static inline void update_scan_period(struct task_struct *p, int new_cpu)
2685+{
2686+}
2687+
26122688 #endif /* CONFIG_NUMA_BALANCING */
26132689
26142690 static void
@@ -6275,7 +6351,7 @@ static void detach_entity_cfs_rq(struct sched_entity *se); · 3660 unmodified lines
62756351 * cfs_rq_of(p) references at time of call are still valid and identify the
62766352 * previous CPU. The caller guarantees p->pi_lock or task_rq(p)->lock is held.
62776353 */
6278−static void migrate_task_rq_fair(struct task_struct *p)
6354+static void migrate_task_rq_fair(struct task_struct *p, int new_cpu)
62796355 {
62806356 /*
62816357 * As blocked tasks retain absolute vruntime the migration needs to
@@ -6328,6 +6404,8 @@ static void migrate_task_rq_fair(struct task_struct *p) · 46 unmodified lines
63286404
63296405 /* We have migrated, no longer consider this task hot */
63306406 p->se.exec_start = 0;
6407+
6408+ update_scan_period(p, new_cpu);
63316409 }
63326410
63336411 static void task_dead_fair(struct task_struct *p)
kernel/sched/sched.h+2−1
@@ -783,6 +783,7 @@ struct rq { · 782 unmodified lines
783783 #ifdef CONFIG_NUMA_BALANCING
784784 unsigned int nr_numa_running;
785785 unsigned int nr_preferred_running;
786+ unsigned int numa_migrate_on;
786787 #endif
787788 #define CPU_LOAD_IDX_MAX 5
788789 unsigned long cpu_load[CPU_LOAD_IDX_MAX];
@@ -1523,7 +1524,7 @@ struct sched_class { · 734 unmodified lines
15231524
15241525 #ifdef CONFIG_SMP
15251526 int (*select_task_rq)(struct task_struct *p, int task_cpu, int sd_flag, int flags);
1526− void (*migrate_task_rq)(struct task_struct *p);
1527+ void (*migrate_task_rq)(struct task_struct *p, int new_cpu);
15271528
15281529 void (*task_woken)(struct rq *this_rq, struct task_struct *task);
15291530
lib/xz/xz_crc32.c+0−1
@@ -15,7 +15,6 @@ · 14 unmodified lines
1515 * but they are bigger and use more memory for the lookup table.
1616 */
1717
18−#include <linux/crc32poly.h>
1918 #include "xz_private.h"
2019
2120 /*
lib/xz/xz_private.h+4−0
@@ -102,6 +102,10 @@ · 101 unmodified lines
102102 # endif
103103 #endif
104104
105+#ifndef CRC32_POLY_LE
106+#define CRC32_POLY_LE 0xedb88320
107+#endif
108+
105109 /*
106110 * Allocate memory for LZMA2 decoder. xz_dec_lzma2_reset() must be used
107111 * before calling xz_dec_lzma2_run().
mm/gup_benchmark.c+2−1
@@ -19,7 +19,8 @@ static int __gup_benchmark_ioctl(unsigned int cmd, · 18 unmodified lines
1919 struct gup_benchmark *gup)
2020 {
2121 ktime_t start_time, end_time;
22− unsigned long i, nr, nr_pages, addr, next;
22+ unsigned long i, nr_pages, addr, next;
23+ int nr;
2324 struct page **pages;
2425
2526 nr_pages = gup->size / PAGE_SIZE;
mm/huge_memory.c+1−1
@@ -2931,7 +2931,7 @@ void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new) · 2930 unmodified lines
29312931 else
29322932 page_add_file_rmap(new, true);
29332933 set_pmd_at(mm, mmun_start, pvmw->pmd, pmde);
2934− if (vma->vm_flags & VM_LOCKED)
2934+ if ((vma->vm_flags & VM_LOCKED) && !PageDoubleMap(new))
29352935 mlock_vma_page(new);
29362936 update_mmu_cache_pmd(vma, address, pvmw->pmd);
29372937 }
mm/hugetlb.c+79−11
@@ -3326,8 +3326,8 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, · 3325 unmodified lines
33263326 struct page *page;
33273327 struct hstate *h = hstate_vma(vma);
33283328 unsigned long sz = huge_page_size(h);
3329− const unsigned long mmun_start = start; /* For mmu_notifiers */
3330− const unsigned long mmun_end = end; /* For mmu_notifiers */
3329+ unsigned long mmun_start = start; /* For mmu_notifiers */
3330+ unsigned long mmun_end = end; /* For mmu_notifiers */
33313331
33323332 WARN_ON(!is_vm_hugetlb_page(vma));
33333333 BUG_ON(start & ~huge_page_mask(h));
@@ -3339,6 +3339,11 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, · 5 unmodified lines
33393339 */
33403340 tlb_remove_check_page_size_change(tlb, sz);
33413341 tlb_start_vma(tlb, vma);
3342+
3343+ /*
3344+ * If sharing possible, alert mmu notifiers of worst case.
3345+ */
3346+ adjust_range_if_pmd_sharing_possible(vma, &mmun_start, &mmun_end);
33423347 mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
33433348 address = start;
33443349 for (; address < end; address += sz) {
@@ -3349,6 +3354,10 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, · 4 unmodified lines
33493354 ptl = huge_pte_lock(h, mm, ptep);
33503355 if (huge_pmd_unshare(mm, &address, ptep)) {
33513356 spin_unlock(ptl);
3357+ /*
3358+ * We just unmapped a page of PMDs by clearing a PUD.
3359+ * The caller's TLB flush range should cover this area.
3360+ */
33523361 continue;
33533362 }
33543363
@@ -3431,12 +3440,23 @@ void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, · 76 unmodified lines
34313440 {
34323441 struct mm_struct *mm;
34333442 struct mmu_gather tlb;
3443+ unsigned long tlb_start = start;
3444+ unsigned long tlb_end = end;
3445+
3446+ /*
3447+ * If shared PMDs were possibly used within this vma range, adjust
3448+ * start/end for worst case tlb flushing.
3449+ * Note that we can not be sure if PMDs are shared until we try to
3450+ * unmap pages. However, we want to make sure TLB flushing covers
3451+ * the largest possible range.
3452+ */
3453+ adjust_range_if_pmd_sharing_possible(vma, &tlb_start, &tlb_end);
34343454
34353455 mm = vma->vm_mm;
34363456
3437− tlb_gather_mmu(&tlb, mm, start, end);
3457+ tlb_gather_mmu(&tlb, mm, tlb_start, tlb_end);
34383458 __unmap_hugepage_range(&tlb, vma, start, end, ref_page);
3439− tlb_finish_mmu(&tlb, start, end);
3459+ tlb_finish_mmu(&tlb, tlb_start, tlb_end);
34403460 }
34413461
34423462 /*
@@ -4298,11 +4318,21 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma, · 855 unmodified lines
42984318 pte_t pte;
42994319 struct hstate *h = hstate_vma(vma);
43004320 unsigned long pages = 0;
4321+ unsigned long f_start = start;
4322+ unsigned long f_end = end;
4323+ bool shared_pmd = false;
4324+
4325+ /*
4326+ * In the case of shared PMDs, the area to flush could be beyond
4327+ * start/end. Set f_start/f_end to cover the maximum possible
4328+ * range if PMD sharing is possible.
4329+ */
4330+ adjust_range_if_pmd_sharing_possible(vma, &f_start, &f_end);
43014331
43024332 BUG_ON(address >= end);
4303− flush_cache_range(vma, address, end);
4333+ flush_cache_range(vma, f_start, f_end);
43044334
4305− mmu_notifier_invalidate_range_start(mm, start, end);
4335+ mmu_notifier_invalidate_range_start(mm, f_start, f_end);
43064336 i_mmap_lock_write(vma->vm_file->f_mapping);
43074337 for (; address < end; address += huge_page_size(h)) {
43084338 spinlock_t *ptl;
@@ -4313,6 +4343,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma, · 4 unmodified lines
43134343 if (huge_pmd_unshare(mm, &address, ptep)) {
43144344 pages++;
43154345 spin_unlock(ptl);
4346+ shared_pmd = true;
43164347 continue;
43174348 }
43184349 pte = huge_ptep_get(ptep);
@@ -4348,9 +4379,13 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma, · 29 unmodified lines
43484379 * Must flush TLB before releasing i_mmap_rwsem: x86's huge_pmd_unshare
43494380 * may have cleared our pud entry and done put_page on the page table:
43504381 * once we release i_mmap_rwsem, another task can do the final put_page
4351− * and that page table be reused and filled with junk.
4382+ * and that page table be reused and filled with junk. If we actually
4383+ * did unshare a page of pmds, flush the range corresponding to the pud.
43524384 */
4353− flush_hugetlb_tlb_range(vma, start, end);
4385+ if (shared_pmd)
4386+ flush_hugetlb_tlb_range(vma, f_start, f_end);
4387+ else
4388+ flush_hugetlb_tlb_range(vma, start, end);
43544389 /*
43554390 * No need to call mmu_notifier_invalidate_range() we are downgrading
43564391 * page table protection not changing it to point to a new page.
@@ -4358,7 +4393,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma, · 1 unmodified line
43584393 * See Documentation/vm/mmu_notifier.rst
43594394 */
43604395 i_mmap_unlock_write(vma->vm_file->f_mapping);
4361− mmu_notifier_invalidate_range_end(mm, start, end);
4396+ mmu_notifier_invalidate_range_end(mm, f_start, f_end);
43624397
43634398 return pages << h->order;
43644399 }
@@ -4545,12 +4580,40 @@ static bool vma_shareable(struct vm_area_struct *vma, unsigned long addr) · 180 unmodified lines
45454580 /*
45464581 * check on proper vm_flags and page table alignment
45474582 */
4548− if (vma->vm_flags & VM_MAYSHARE &&
4549− vma->vm_start <= base && end <= vma->vm_end)
4583+ if (vma->vm_flags & VM_MAYSHARE && range_in_vma(vma, base, end))
45504584 return true;
45514585 return false;
45524586 }
45534587
4588+/*
4589+ * Determine if start,end range within vma could be mapped by shared pmd.
4590+ * If yes, adjust start and end to cover range associated with possible
4591+ * shared pmd mappings.
4592+ */
4593+void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,
4594+ unsigned long *start, unsigned long *end)
4595+{
4596+ unsigned long check_addr = *start;
4597+
4598+ if (!(vma->vm_flags & VM_MAYSHARE))
4599+ return;
4600+
4601+ for (check_addr = *start; check_addr < *end; check_addr += PUD_SIZE) {
4602+ unsigned long a_start = check_addr & PUD_MASK;
4603+ unsigned long a_end = a_start + PUD_SIZE;
4604+
4605+ /*
4606+ * If sharing is possible, adjust start/end if necessary.
4607+ */
4608+ if (range_in_vma(vma, a_start, a_end)) {
4609+ if (a_start < *start)
4610+ *start = a_start;
4611+ if (a_end > *end)
4612+ *end = a_end;
4613+ }
4614+ }
4615+}
4616+
45544617 /*
45554618 * Search for a shareable pmd page for hugetlb. In any case calls pmd_alloc()
45564619 * and returns the corresponding pte. While this is not necessary for the
@@ -4648,6 +4711,11 @@ int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep) · 91 unmodified lines
46484711 {
46494712 return 0;
46504713 }
4714+
4715+void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,
4716+ unsigned long *start, unsigned long *end)
4717+{
4718+}
46514719 #define want_pmd_share() (0)
46524720 #endif /* CONFIG_ARCH_WANT_HUGE_PMD_SHARE */
46534721
mm/madvise.c+1−1
@@ -96,7 +96,7 @@ static long madvise_behavior(struct vm_area_struct *vma, · 95 unmodified lines
9696 new_flags |= VM_DONTDUMP;
9797 break;
9898 case MADV_DODUMP:
99− if (new_flags & VM_SPECIAL) {
99+ if (!is_vm_hugetlb_page(vma) && new_flags & VM_SPECIAL) {
100100 error = -EINVAL;
101101 goto out;
102102 }
mm/migrate.c+4−58
@@ -275,6 +275,9 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma, · 274 unmodified lines
275275 if (vma->vm_flags & VM_LOCKED && !PageTransCompound(new))
276276 mlock_vma_page(new);
277277
278+ if (PageTransHuge(page) && PageMlocked(page))
279+ clear_page_mlock(page);
280+
278281 /* No need to invalidate - it was non-present before */
279282 update_mmu_cache(vma, pvmw.address, pvmw.pte);
280283 }
@@ -1411,7 +1414,7 @@ retry: · 1130 unmodified lines
14111414 * we encounter them after the rest of the list
14121415 * is processed.
14131416 */
1414− if (PageTransHuge(page)) {
1417+ if (PageTransHuge(page) && !PageHuge(page)) {
14151418 lock_page(page);
14161419 rc = split_huge_page_to_list(page, from);
14171420 unlock_page(page);
@@ -1855,46 +1858,6 @@ static struct page *alloc_misplaced_dst_page(struct page *page, · 437 unmodified lines
18551858 return newpage;
18561859 }
18571860
1858−/*
1859− * page migration rate limiting control.
1860− * Do not migrate more than @pages_to_migrate in a @migrate_interval_millisecs
1861− * window of time. Default here says do not migrate more than 1280M per second.
1862− */
1863−static unsigned int migrate_interval_millisecs __read_mostly = 100;
1864−static unsigned int ratelimit_pages __read_mostly = 128 << (20 - PAGE_SHIFT);
1865−
1866−/* Returns true if the node is migrate rate-limited after the update */
1867−static bool numamigrate_update_ratelimit(pg_data_t *pgdat,
1868− unsigned long nr_pages)
1869−{
1870− /*
1871− * Rate-limit the amount of data that is being migrated to a node.
1872− * Optimal placement is no good if the memory bus is saturated and
1873− * all the time is being spent migrating!
1874− */
1875− if (time_after(jiffies, pgdat->numabalancing_migrate_next_window)) {
1876− spin_lock(&pgdat->numabalancing_migrate_lock);
1877− pgdat->numabalancing_migrate_nr_pages = 0;
1878− pgdat->numabalancing_migrate_next_window = jiffies +
1879− msecs_to_jiffies(migrate_interval_millisecs);
1880− spin_unlock(&pgdat->numabalancing_migrate_lock);
1881− }
1882− if (pgdat->numabalancing_migrate_nr_pages > ratelimit_pages) {
1883− trace_mm_numa_migrate_ratelimit(current, pgdat->node_id,
1884− nr_pages);
1885− return true;
1886− }
1887−
1888− /*
1889− * This is an unlocked non-atomic update so errors are possible.
1890− * The consequences are failing to migrate when we potentiall should
1891− * have which is not severe enough to warrant locking. If it is ever
1892− * a problem, it can be converted to a per-cpu counter.
1893− */
1894− pgdat->numabalancing_migrate_nr_pages += nr_pages;
1895− return false;
1896−}
1897−
18981861 static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
18991862 {
19001863 int page_lru;
@@ -1967,14 +1930,6 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, · 66 unmodified lines
19671930 if (page_is_file_cache(page) && PageDirty(page))
19681931 goto out;
19691932
1970− /*
1971− * Rate-limit the amount of data that is being migrated to a node.
1972− * Optimal placement is no good if the memory bus is saturated and
1973− * all the time is being spent migrating!
1974− */
1975− if (numamigrate_update_ratelimit(pgdat, 1))
1976− goto out;
1977−
19781933 isolated = numamigrate_isolate_page(pgdat, page);
19791934 if (!isolated)
19801935 goto out;
@@ -2021,14 +1976,6 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 40 unmodified lines
20211976 unsigned long mmun_start = address & HPAGE_PMD_MASK;
20221977 unsigned long mmun_end = mmun_start + HPAGE_PMD_SIZE;
20231978
2024− /*
2025− * Rate-limit the amount of data that is being migrated to a node.
2026− * Optimal placement is no good if the memory bus is saturated and
2027− * all the time is being spent migrating!
2028− */
2029− if (numamigrate_update_ratelimit(pgdat, HPAGE_PMD_NR))
2030− goto out_dropref;
2031−
20321979 new_page = alloc_pages_node(node,
20331980 (GFP_TRANSHUGE_LIGHT | __GFP_THISNODE),
20341981 HPAGE_PMD_ORDER);
@@ -2125,7 +2072,6 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 90 unmodified lines
21252072
21262073 out_fail:
21272074 count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR);
2128−out_dropref:
21292075 ptl = pmd_lock(mm, pmd);
21302076 if (pmd_same(*pmd, entry)) {
21312077 entry = pmd_modify(entry, vma->vm_page_prot);
mm/page_alloc.c+0−2
@@ -6197,8 +6197,6 @@ static unsigned long __init calc_memmap_size(unsigned long spanned_pages, · 6196 unmodified lines
61976197 static void pgdat_init_numabalancing(struct pglist_data *pgdat)
61986198 {
61996199 spin_lock_init(&pgdat->numabalancing_migrate_lock);
6200− pgdat->numabalancing_migrate_nr_pages = 0;
6201− pgdat->numabalancing_migrate_next_window = jiffies;
62026200 }
62036201 #else
62046202 static void pgdat_init_numabalancing(struct pglist_data *pgdat) {}
mm/rmap.c+39−3
@@ -1362,11 +1362,21 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, · 1361 unmodified lines
13621362 }
13631363
13641364 /*
1365− * We have to assume the worse case ie pmd for invalidation. Note that
1366− * the page can not be free in this function as call of try_to_unmap()
1367− * must hold a reference on the page.
1365+ * For THP, we have to assume the worse case ie pmd for invalidation.
1366+ * For hugetlb, it could be much worse if we need to do pud
1367+ * invalidation in the case of pmd sharing.
1368+ *
1369+ * Note that the page can not be free in this function as call of
1370+ * try_to_unmap() must hold a reference on the page.
13681371 */
13691372 end = min(vma->vm_end, start + (PAGE_SIZE << compound_order(page)));
1373+ if (PageHuge(page)) {
1374+ /*
1375+ * If sharing is possible, start and end will be adjusted
1376+ * accordingly.
1377+ */
1378+ adjust_range_if_pmd_sharing_possible(vma, &start, &end);
1379+ }
13701380 mmu_notifier_invalidate_range_start(vma->vm_mm, start, end);
13711381
13721382 while (page_vma_mapped_walk(&pvmw)) {
@@ -1409,6 +1419,32 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, · 36 unmodified lines
14091419 subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte);
14101420 address = pvmw.address;
14111421
1422+ if (PageHuge(page)) {
1423+ if (huge_pmd_unshare(mm, &address, pvmw.pte)) {
1424+ /*
1425+ * huge_pmd_unshare unmapped an entire PMD
1426+ * page. There is no way of knowing exactly
1427+ * which PMDs may be cached for this mm, so
1428+ * we must flush them all. start/end were
1429+ * already adjusted above to cover this range.
1430+ */
1431+ flush_cache_range(vma, start, end);
1432+ flush_tlb_range(vma, start, end);
1433+ mmu_notifier_invalidate_range(mm, start, end);
1434+
1435+ /*
1436+ * The ref count of the PMD page was dropped
1437+ * which is part of the way map counting
1438+ * is done for shared PMDs. Return 'true'
1439+ * here. When there is no other sharing,
1440+ * huge_pmd_unshare returns false and we will
1441+ * unmap the actual page and drop map count
1442+ * to zero.
1443+ */
1444+ page_vma_mapped_walk_done(&pvmw);
1445+ break;
1446+ }
1447+ }
14121448
14131449 if (IS_ENABLED(CONFIG_MIGRATION) &&
14141450 (flags & TTU_MIGRATION) &&
mm/vmscan.c+3−4
@@ -580,8 +580,8 @@ static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid, · 579 unmodified lines
580580 struct mem_cgroup *memcg, int priority)
581581 {
582582 struct memcg_shrinker_map *map;
583− unsigned long freed = 0;
584− int ret, i;
583+ unsigned long ret, freed = 0;
584+ int i;
585585
586586 if (!memcg_kmem_enabled() || !mem_cgroup_online(memcg))
587587 return 0;
@@ -677,9 +677,8 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid, · 89 unmodified lines
677677 struct mem_cgroup *memcg,
678678 int priority)
679679 {
680+ unsigned long ret, freed = 0;
680681 struct shrinker *shrinker;
681− unsigned long freed = 0;
682− int ret;
683682
684683 if (!mem_cgroup_is_root(memcg))
685684 return shrink_slab_memcg(gfp_mask, nid, memcg, priority);
mm/vmstat.c+3−1
@@ -1275,6 +1275,9 @@ const char * const vmstat_text[] = { · 1274 unmodified lines
12751275 #ifdef CONFIG_SMP
12761276 "nr_tlb_remote_flush",
12771277 "nr_tlb_remote_flush_received",
1278+#else
1279+ "", /* nr_tlb_remote_flush */
1280+ "", /* nr_tlb_remote_flush_received */
12781281 #endif /* CONFIG_SMP */
12791282 "nr_tlb_local_flush_all",
12801283 "nr_tlb_local_flush_one",
@@ -1283,7 +1286,6 @@ const char * const vmstat_text[] = { · 2 unmodified lines
12831286 #ifdef CONFIG_DEBUG_VM_VMACACHE
12841287 "vmacache_find_calls",
12851288 "vmacache_find_hits",
1286− "vmacache_full_flushes",
12871289 #endif
12881290 #ifdef CONFIG_SWAP
12891291 "swap_ra",
net/bluetooth/mgmt.c+2−5
@@ -2434,9 +2434,8 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data, · 2433 unmodified lines
24342434 /* LE address type */
24352435 addr_type = le_addr_type(cp->addr.type);
24362436
2437− hci_remove_irk(hdev, &cp->addr.bdaddr, addr_type);
2438−
2439− err = hci_remove_ltk(hdev, &cp->addr.bdaddr, addr_type);
2437+ /* Abort any ongoing SMP pairing. Removes ltk and irk if they exist. */
2438+ err = smp_cancel_and_remove_pairing(hdev, &cp->addr.bdaddr, addr_type);
24402439 if (err < 0) {
24412440 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE,
24422441 MGMT_STATUS_NOT_PAIRED, &rp,
@@ -2450,8 +2449,6 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data, · 7 unmodified lines
24502449 goto done;
24512450 }
24522451
2453− /* Abort any ongoing SMP pairing */
2454− smp_cancel_pairing(conn);
24552452
24562453 /* Defer clearing up the connection parameters until closing to
24572454 * give a chance of keeping them if a repairing happens.
net/bluetooth/smp.c+25−4
@@ -2422,30 +2422,51 @@ unlock: · 2421 unmodified lines
24222422 return ret;
24232423 }
24242424
2425−void smp_cancel_pairing(struct hci_conn *hcon)
2425+int smp_cancel_and_remove_pairing(struct hci_dev *hdev, bdaddr_t *bdaddr,
2426+ u8 addr_type)
24262427 {
2427− struct l2cap_conn *conn = hcon->l2cap_data;
2428+ struct hci_conn *hcon;
2429+ struct l2cap_conn *conn;
24282430 struct l2cap_chan *chan;
24292431 struct smp_chan *smp;
2432+ int err;
2433+
2434+ err = hci_remove_ltk(hdev, bdaddr, addr_type);
2435+ hci_remove_irk(hdev, bdaddr, addr_type);
2436+
2437+ hcon = hci_conn_hash_lookup_le(hdev, bdaddr, addr_type);
2438+ if (!hcon)
2439+ goto done;
24302440
2441+ conn = hcon->l2cap_data;
24312442 if (!conn)
2432− return;
2443+ goto done;
24332444
24342445 chan = conn->smp;
24352446 if (!chan)
2436− return;
2447+ goto done;
24372448
24382449 l2cap_chan_lock(chan);
24392450
24402451 smp = chan->data;
24412452 if (smp) {
2453+ /* Set keys to NULL to make sure smp_failure() does not try to
2454+ * remove and free already invalidated rcu list entries. */
2455+ smp->ltk = NULL;
2456+ smp->slave_ltk = NULL;
2457+ smp->remote_irk = NULL;
2458+
24422459 if (test_bit(SMP_FLAG_COMPLETE, &smp->flags))
24432460 smp_failure(conn, 0);
24442461 else
24452462 smp_failure(conn, SMP_UNSPECIFIED);
2463+ err = 0;
24462464 }
24472465
24482466 l2cap_chan_unlock(chan);
2467+
2468+done:
2469+ return err;
24492470 }
24502471
24512472 static int smp_cmd_encrypt_info(struct l2cap_conn *conn, struct sk_buff *skb)
net/bluetooth/smp.h+2−1
@@ -181,7 +181,8 @@ enum smp_key_pref { · 180 unmodified lines
181181 };
182182
183183 /* SMP Commands */
184−void smp_cancel_pairing(struct hci_conn *hcon);
184+int smp_cancel_and_remove_pairing(struct hci_dev *hdev, bdaddr_t *bdaddr,
185+ u8 addr_type);
185186 bool smp_sufficient_security(struct hci_conn *hcon, u8 sec_level,
186187 enum smp_key_pref key_pref);
187188 int smp_conn_security(struct hci_conn *hcon, __u8 sec_level);
net/bpfilter/bpfilter_kern.c+2−2
@@ -59,7 +59,7 @@ static int __bpfilter_process_sockopt(struct sock *sk, int optname, · 58 unmodified lines
5959 req.is_set = is_set;
6060 req.pid = current->pid;
6161 req.cmd = optname;
62− req.addr = (long)optval;
62+ req.addr = (long __force __user)optval;
6363 req.len = optlen;
6464 mutex_lock(&bpfilter_lock);
6565 if (!info.pid)
@@ -98,7 +98,7 @@ static int __init load_umh(void) · 32 unmodified lines
9898 pr_info("Loaded bpfilter_umh pid %d\n", info.pid);
9999
100100 /* health check that usermode process started correctly */
101− if (__bpfilter_process_sockopt(NULL, 0, 0, 0, 0) != 0) {
101+ if (__bpfilter_process_sockopt(NULL, 0, NULL, 0, 0) != 0) {
102102 stop_umh();
103103 return -EFAULT;
104104 }
net/bridge/br_netfilter_hooks.c+2−1
@@ -835,7 +835,8 @@ static unsigned int ip_sabotage_in(void *priv, · 834 unmodified lines
835835 struct sk_buff *skb,
836836 const struct nf_hook_state *state)
837837 {
838− if (skb->nf_bridge && !skb->nf_bridge->in_prerouting) {
838+ if (skb->nf_bridge && !skb->nf_bridge->in_prerouting &&
839+ !netif_is_l3_master(skb->dev)) {
839840 state->okfn(state->net, state->sk, skb);
840841 return NF_STOLEN;
841842 }
net/core/ethtool.c+8−1
@@ -1483,6 +1483,7 @@ static int ethtool_get_wol(struct net_device *dev, char __user *useraddr) · 1482 unmodified lines
14831483 static int ethtool_set_wol(struct net_device *dev, char __user *useraddr)
14841484 {
14851485 struct ethtool_wolinfo wol;
1486+ int ret;
14861487
14871488 if (!dev->ethtool_ops->set_wol)
14881489 return -EOPNOTSUPP;
@@ -1490,7 +1491,13 @@ static int ethtool_set_wol(struct net_device *dev, char __user *useraddr) · 1 unmodified line
14901491 if (copy_from_user(&wol, useraddr, sizeof(wol)))
14911492 return -EFAULT;
14921493
1493− return dev->ethtool_ops->set_wol(dev, &wol);
1494+ ret = dev->ethtool_ops->set_wol(dev, &wol);
1495+ if (ret)
1496+ return ret;
1497+
1498+ dev->wol_enabled = !!wol.wolopts;
1499+
1500+ return 0;
14941501 }
14951502
14961503 static int ethtool_get_eee(struct net_device *dev, char __user *useraddr)
net/core/netpoll.c+3−19
@@ -135,27 +135,9 @@ static void queue_process(struct work_struct *work) · 134 unmodified lines
135135 }
136136 }
137137
138−/*
139− * Check whether delayed processing was scheduled for our NIC. If so,
140− * we attempt to grab the poll lock and use ->poll() to pump the card.
141− * If this fails, either we've recursed in ->poll() or it's already
142− * running on another CPU.
143− *
144− * Note: we don't mask interrupts with this lock because we're using
145− * trylock here and interrupts are already disabled in the softirq
146− * case. Further, we test the poll_owner to avoid recursion on UP
147− * systems where the lock doesn't exist.
148− */
149138 static void poll_one_napi(struct napi_struct *napi)
150139 {
151− int work = 0;
152−
153− /* net_rx_action's ->poll() invocations and our's are
154− * synchronized by this test which is only made while
155− * holding the napi->poll_lock.
156− */
157− if (!test_bit(NAPI_STATE_SCHED, &napi->state))
158− return;
140+ int work;
159141
160142 /* If we set this bit but see that it has already been set,
161143 * that indicates that napi has been disabled and we need
@@ -330,6 +312,7 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, · 168 unmodified lines
330312 /* It is up to the caller to keep npinfo alive. */
331313 struct netpoll_info *npinfo;
332314
315+ rcu_read_lock_bh();
333316 lockdep_assert_irqs_disabled();
334317
335318 npinfo = rcu_dereference_bh(np->dev->npinfo);
@@ -374,6 +357,7 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, · 38 unmodified lines
374357 skb_queue_tail(&npinfo->txq, skb);
375358 schedule_delayed_work(&npinfo->tx_work,0);
376359 }
360+ rcu_read_unlock_bh();
377361 }
378362 EXPORT_SYMBOL(netpoll_send_skb_on_dev);
379363
net/core/rtnetlink.c+28−13
@@ -1898,10 +1898,8 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) · 1897 unmodified lines
18981898 if (tb[IFLA_IF_NETNSID]) {
18991899 netnsid = nla_get_s32(tb[IFLA_IF_NETNSID]);
19001900 tgt_net = get_target_net(skb->sk, netnsid);
1901− if (IS_ERR(tgt_net)) {
1902− tgt_net = net;
1903− netnsid = -1;
1904− }
1901+ if (IS_ERR(tgt_net))
1902+ return PTR_ERR(tgt_net);
19051903 }
19061904
19071905 if (tb[IFLA_EXT_MASK])
@@ -2837,6 +2835,12 @@ struct net_device *rtnl_create_link(struct net *net, · 929 unmodified lines
28372835 else if (ops->get_num_rx_queues)
28382836 num_rx_queues = ops->get_num_rx_queues();
28392837
2838+ if (num_tx_queues < 1 || num_tx_queues > 4096)
2839+ return ERR_PTR(-EINVAL);
2840+
2841+ if (num_rx_queues < 1 || num_rx_queues > 4096)
2842+ return ERR_PTR(-EINVAL);
2843+
28402844 dev = alloc_netdev_mqs(ops->priv_size, ifname, name_assign_type,
28412845 ops->setup, num_tx_queues, num_rx_queues);
28422846 if (!dev)
@@ -3744,16 +3748,27 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb) · 901 unmodified lines
37443748 int err = 0;
37453749 int fidx = 0;
37463750
3747− err = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb,
3748− IFLA_MAX, ifla_policy, NULL);
3749− if (err < 0) {
3750− return -EINVAL;
3751− } else if (err == 0) {
3752− if (tb[IFLA_MASTER])
3753− br_idx = nla_get_u32(tb[IFLA_MASTER]);
3754− }
3751+ /* A hack to preserve kernel<->userspace interface.
3752+ * Before Linux v4.12 this code accepted ndmsg since iproute2 v3.3.0.
3753+ * However, ndmsg is shorter than ifinfomsg thus nlmsg_parse() bails.
3754+ * So, check for ndmsg with an optional u32 attribute (not used here).
3755+ * Fortunately these sizes don't conflict with the size of ifinfomsg
3756+ * with an optional attribute.
3757+ */
3758+ if (nlmsg_len(cb->nlh) != sizeof(struct ndmsg) &&
3759+ (nlmsg_len(cb->nlh) != sizeof(struct ndmsg) +
3760+ nla_attr_size(sizeof(u32)))) {
3761+ err = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb,
3762+ IFLA_MAX, ifla_policy, NULL);
3763+ if (err < 0) {
3764+ return -EINVAL;
3765+ } else if (err == 0) {
3766+ if (tb[IFLA_MASTER])
3767+ br_idx = nla_get_u32(tb[IFLA_MASTER]);
3768+ }
37553769
3756− brport_idx = ifm->ifi_index;
3770+ brport_idx = ifm->ifi_index;
3771+ }
37573772
37583773 if (br_idx) {
37593774 br_dev = __dev_get_by_index(net, br_idx);
net/dccp/input.c+3−1
@@ -606,11 +606,13 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, · 605 unmodified lines
606606 if (sk->sk_state == DCCP_LISTEN) {
607607 if (dh->dccph_type == DCCP_PKT_REQUEST) {
608608 /* It is possible that we process SYN packets from backlog,
609− * so we need to make sure to disable BH right there.
609+ * so we need to make sure to disable BH and RCU right there.
610610 */
611+ rcu_read_lock();
611612 local_bh_disable();
612613 acceptable = inet_csk(sk)->icsk_af_ops->conn_request(sk, skb) >= 0;
613614 local_bh_enable();
615+ rcu_read_unlock();
614616 if (!acceptable)
615617 return 1;
616618 consume_skb(skb);
net/dccp/ipv4.c+3−1
@@ -493,9 +493,11 @@ static int dccp_v4_send_response(const struct sock *sk, struct request_sock *req · 492 unmodified lines
493493
494494 dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->ir_loc_addr,
495495 ireq->ir_rmt_addr);
496+ rcu_read_lock();
496497 err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr,
497498 ireq->ir_rmt_addr,
498− ireq_opt_deref(ireq));
499+ rcu_dereference(ireq->ireq_opt));
500+ rcu_read_unlock();
499501 err = net_xmit_eval(err);
500502 }
501503
net/ipv4/inet_connection_sock.c+4−1
@@ -544,7 +544,8 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk, · 543 unmodified lines
544544 struct ip_options_rcu *opt;
545545 struct rtable *rt;
546546
547− opt = ireq_opt_deref(ireq);
547+ rcu_read_lock();
548+ opt = rcu_dereference(ireq->ireq_opt);
548549
549550 flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark,
550551 RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE,
@@ -558,11 +559,13 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk, · 7 unmodified lines
558559 goto no_route;
559560 if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway)
560561 goto route_err;
562+ rcu_read_unlock();
561563 return &rt->dst;
562564
563565 route_err:
564566 ip_rt_put(rt);
565567 no_route:
568+ rcu_read_unlock();
566569 __IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES);
567570 return NULL;
568571 }
net/ipv4/ip_sockglue.c+1−2
@@ -149,7 +149,6 @@ static void ip_cmsg_recv_security(struct msghdr *msg, struct sk_buff *skb) · 148 unmodified lines
149149 static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb)
150150 {
151151 struct sockaddr_in sin;
152− const struct iphdr *iph = ip_hdr(skb);
153152 __be16 *ports;
154153 int end;
155154
@@ -164,7 +163,7 @@ static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb) · 8 unmodified lines
164163 ports = (__be16 *)skb_transport_header(skb);
165164
166165 sin.sin_family = AF_INET;
167− sin.sin_addr.s_addr = iph->daddr;
166+ sin.sin_addr.s_addr = ip_hdr(skb)->daddr;
168167 sin.sin_port = ports[1];
169168 memset(sin.sin_zero, 0, sizeof(sin.sin_zero));
170169
net/ipv4/sysctl_net_ipv4.c+4−2
@@ -48,6 +48,7 @@ static int tcp_syn_retries_max = MAX_TCP_SYNCNT; · 47 unmodified lines
4848 static int ip_ping_group_range_min[] = { 0, 0 };
4949 static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
5050 static int comp_sack_nr_max = 255;
51+static u32 u32_max_div_HZ = UINT_MAX / HZ;
5152
5253 /* obsolete */
5354 static int sysctl_tcp_low_latency __read_mostly;
@@ -745,9 +746,10 @@ static struct ctl_table ipv4_net_table[] = { · 691 unmodified lines
745746 {
746747 .procname = "tcp_probe_interval",
747748 .data = &init_net.ipv4.sysctl_tcp_probe_interval,
748− .maxlen = sizeof(int),
749+ .maxlen = sizeof(u32),
749750 .mode = 0644,
750− .proc_handler = proc_dointvec,
751+ .proc_handler = proc_douintvec_minmax,
752+ .extra2 = &u32_max_div_HZ,
751753 },
752754 {
753755 .procname = "igmp_link_local_mcast_reports",
net/ipv4/tcp_input.c+3−1
@@ -6009,11 +6009,13 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) · 6008 unmodified lines
60096009 if (th->fin)
60106010 goto discard;
60116011 /* It is possible that we process SYN packets from backlog,
6012− * so we need to make sure to disable BH right there.
6012+ * so we need to make sure to disable BH and RCU right there.
60136013 */
6014+ rcu_read_lock();
60146015 local_bh_disable();
60156016 acceptable = icsk->icsk_af_ops->conn_request(sk, skb) >= 0;
60166017 local_bh_enable();
6018+ rcu_read_unlock();
60176019
60186020 if (!acceptable)
60196021 return 1;
net/ipv4/tcp_ipv4.c+3−1
@@ -943,9 +943,11 @@ static int tcp_v4_send_synack(const struct sock *sk, struct dst_entry *dst, · 942 unmodified lines
943943 if (skb) {
944944 __tcp_v4_send_check(skb, ireq->ir_loc_addr, ireq->ir_rmt_addr);
945945
946+ rcu_read_lock();
946947 err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr,
947948 ireq->ir_rmt_addr,
948− ireq_opt_deref(ireq));
949+ rcu_dereference(ireq->ireq_opt));
950+ rcu_read_unlock();
949951 err = net_xmit_eval(err);
950952 }
951953
net/ipv4/xfrm4_input.c+1−0
@@ -67,6 +67,7 @@ int xfrm4_transport_finish(struct sk_buff *skb, int async) · 66 unmodified lines
6767
6868 if (xo && (xo->flags & XFRM_GRO)) {
6969 skb_mac_header_rebuild(skb);
70+ skb_reset_transport_header(skb);
7071 return 0;
7172 }
7273
net/ipv4/xfrm4_mode_transport.c+1−3
@@ -46,7 +46,6 @@ static int xfrm4_transport_output(struct xfrm_state *x, struct sk_buff *skb) · 45 unmodified lines
4646 static int xfrm4_transport_input(struct xfrm_state *x, struct sk_buff *skb)
4747 {
4848 int ihl = skb->data - skb_transport_header(skb);
49− struct xfrm_offload *xo = xfrm_offload(skb);
5049
5150 if (skb->transport_header != skb->network_header) {
5251 memmove(skb_transport_header(skb),
@@ -54,8 +53,7 @@ static int xfrm4_transport_input(struct xfrm_state *x, struct sk_buff *skb) · 1 unmodified line
5453 skb->network_header = skb->transport_header;
5554 }
5655 ip_hdr(skb)->tot_len = htons(skb->len + ihl);
57− if (!xo || !(xo->flags & XFRM_GRO))
58− skb_reset_transport_header(skb);
56+ skb_reset_transport_header(skb);
5957 return 0;
6058 }
6159
net/ipv6/raw.c+20−9
@@ -651,8 +651,6 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length, · 650 unmodified lines
651651 skb->priority = sk->sk_priority;
652652 skb->mark = sk->sk_mark;
653653 skb->tstamp = sockc->transmit_time;
654− skb_dst_set(skb, &rt->dst);
655− *dstp = NULL;
656654
657655 skb_put(skb, length);
658656 skb_reset_network_header(skb);
@@ -665,8 +663,14 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length, · 6 unmodified lines
665663
666664 skb->transport_header = skb->network_header;
667665 err = memcpy_from_msg(iph, msg, length);
668− if (err)
669− goto error_fault;
666+ if (err) {
667+ err = -EFAULT;
668+ kfree_skb(skb);
669+ goto error;
670+ }
671+
672+ skb_dst_set(skb, &rt->dst);
673+ *dstp = NULL;
670674
671675 /* if egress device is enslaved to an L3 master device pass the
672676 * skb to its handler for processing
@@ -675,21 +679,28 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length, · 2 unmodified lines
675679 if (unlikely(!skb))
676680 return 0;
677681
682+ /* Acquire rcu_read_lock() in case we need to use rt->rt6i_idev
683+ * in the error path. Since skb has been freed, the dst could
684+ * have been queued for deletion.
685+ */
686+ rcu_read_lock();
678687 IP6_UPD_PO_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len);
679688 err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, sk, skb,
680689 NULL, rt->dst.dev, dst_output);
681690 if (err > 0)
682691 err = net_xmit_errno(err);
683− if (err)
684− goto error;
692+ if (err) {
693+ IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS);
694+ rcu_read_unlock();
695+ goto error_check;
696+ }
697+ rcu_read_unlock();
685698 out:
686699 return 0;
687700
688−error_fault:
689− err = -EFAULT;
690− kfree_skb(skb);
691701 error:
692702 IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS);
703+error_check:
693704 if (err == -ENOBUFS && !np->recverr)
694705 err = 0;
695706 return err;
net/ipv6/route.c+0−5
@@ -4321,11 +4321,6 @@ static int ip6_route_info_append(struct net *net, · 4320 unmodified lines
43214321 if (!nh)
43224322 return -ENOMEM;
43234323 nh->fib6_info = rt;
4324− err = ip6_convert_metrics(net, rt, r_cfg);
4325− if (err) {
4326− kfree(nh);
4327− return err;
4328− }
43294324 memcpy(&nh->r_cfg, r_cfg, sizeof(*r_cfg));
43304325 list_add_tail(&nh->next, rt6_nh_list);
43314326
net/ipv6/xfrm6_input.c+1−0
@@ -59,6 +59,7 @@ int xfrm6_transport_finish(struct sk_buff *skb, int async) · 58 unmodified lines
5959
6060 if (xo && (xo->flags & XFRM_GRO)) {
6161 skb_mac_header_rebuild(skb);
62+ skb_reset_transport_header(skb);
6263 return -1;
6364 }
6465
net/ipv6/xfrm6_mode_transport.c+1−3
@@ -51,7 +51,6 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb) · 50 unmodified lines
5151 static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb)
5252 {
5353 int ihl = skb->data - skb_transport_header(skb);
54− struct xfrm_offload *xo = xfrm_offload(skb);
5554
5655 if (skb->transport_header != skb->network_header) {
5756 memmove(skb_transport_header(skb),
@@ -60,8 +59,7 @@ static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb) · 2 unmodified lines
6059 }
6160 ipv6_hdr(skb)->payload_len = htons(skb->len + ihl -
6261 sizeof(struct ipv6hdr));
63− if (!xo || !(xo->flags & XFRM_GRO))
64− skb_reset_transport_header(skb);
62+ skb_reset_transport_header(skb);
6563 return 0;
6664 }
6765
net/ipv6/xfrm6_output.c+2−0
@@ -170,9 +170,11 @@ static int __xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb) · 169 unmodified lines
170170
171171 if (toobig && xfrm6_local_dontfrag(skb)) {
172172 xfrm6_local_rxpmtu(skb, mtu);
173+ kfree_skb(skb);
173174 return -EMSGSIZE;
174175 } else if (!skb->ignore_df && toobig && skb->sk) {
175176 xfrm_local_error(skb, mtu);
177+ kfree_skb(skb);
176178 return -EMSGSIZE;
177179 }
178180
net/mac80211/cfg.c+1−1
@@ -427,7 +427,7 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 426 unmodified lines
427427 case NL80211_IFTYPE_AP:
428428 case NL80211_IFTYPE_AP_VLAN:
429429 /* Keys without a station are used for TX only */
430− if (key->sta && test_sta_flag(key->sta, WLAN_STA_MFP))
430+ if (sta && test_sta_flag(sta, WLAN_STA_MFP))
431431 key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT;
432432 break;
433433 case NL80211_IFTYPE_ADHOC:
net/mac80211/iface.c+2−1
@@ -1756,7 +1756,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 1755 unmodified lines
17561756
17571757 if (local->ops->wake_tx_queue &&
17581758 type != NL80211_IFTYPE_AP_VLAN &&
1759− type != NL80211_IFTYPE_MONITOR)
1759+ (type != NL80211_IFTYPE_MONITOR ||
1760+ (params->flags & MONITOR_FLAG_ACTIVE)))
17601761 txq_size += sizeof(struct txq_info) +
17611762 local->hw.txq_data_size;
17621763
net/mac80211/mesh.h+2−1
@@ -217,7 +217,8 @@ void mesh_rmc_free(struct ieee80211_sub_if_data *sdata); · 216 unmodified lines
217217 int mesh_rmc_init(struct ieee80211_sub_if_data *sdata);
218218 void ieee80211s_init(void);
219219 void ieee80211s_update_metric(struct ieee80211_local *local,
220− struct sta_info *sta, struct sk_buff *skb);
220+ struct sta_info *sta,
221+ struct ieee80211_tx_status *st);
221222 void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata);
222223 void ieee80211_mesh_teardown_sdata(struct ieee80211_sub_if_data *sdata);
223224 int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata);
net/mac80211/mesh_hwmp.c+3−6
@@ -295,15 +295,12 @@ int mesh_path_error_tx(struct ieee80211_sub_if_data *sdata, · 294 unmodified lines
295295 }
296296
297297 void ieee80211s_update_metric(struct ieee80211_local *local,
298− struct sta_info *sta, struct sk_buff *skb)
298+ struct sta_info *sta,
299+ struct ieee80211_tx_status *st)
299300 {
300− struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb);
301− struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
301+ struct ieee80211_tx_info *txinfo = st->info;
302302 int failed;
303303
304− if (!ieee80211_is_data(hdr->frame_control))
305− return;
306−
307304 failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK);
308305
309306 /* moving average, scaled to 100.
net/mac80211/status.c+5−6
@@ -479,11 +479,6 @@ static void ieee80211_report_ack_skb(struct ieee80211_local *local, · 478 unmodified lines
479479 if (!skb)
480480 return;
481481
482− if (dropped) {
483− dev_kfree_skb_any(skb);
484− return;
485− }
486−
487482 if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) {
488483 u64 cookie = IEEE80211_SKB_CB(skb)->ack.cookie;
489484 struct ieee80211_sub_if_data *sdata;
@@ -506,6 +501,8 @@ static void ieee80211_report_ack_skb(struct ieee80211_local *local, · 16 unmodified lines
506501 }
507502 rcu_read_unlock();
508503
504+ dev_kfree_skb_any(skb);
505+ } else if (dropped) {
509506 dev_kfree_skb_any(skb);
510507 } else {
511508 /* consumes skb */
@@ -811,7 +808,7 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw, · 299 unmodified lines
811808
812809 rate_control_tx_status(local, sband, status);
813810 if (ieee80211_vif_is_mesh(&sta->sdata->vif))
814− ieee80211s_update_metric(local, sta, skb);
811+ ieee80211s_update_metric(local, sta, status);
815812
816813 if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked)
817814 ieee80211_frame_acked(sta, skb);
@@ -972,6 +969,8 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw, · 154 unmodified lines
972969 }
973970
974971 rate_control_tx_status(local, sband, status);
972+ if (ieee80211_vif_is_mesh(&sta->sdata->vif))
973+ ieee80211s_update_metric(local, sta, status);
975974 }
976975
977976 if (acked || noack_success) {
net/mac80211/tdls.c+4−4
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include "ieee80211_i.h"
1717 #include "driver-ops.h"
1818 #include "rate.h"
19+#include "wme.h"
1920
2021 /* give usermode some time for retries in setting up the TDLS session */
2122 #define TDLS_PEER_SETUP_TIMEOUT (15 * HZ)
@@ -1010,14 +1011,13 @@ ieee80211_tdls_prep_mgmt_packet(struct wiphy *wiphy, struct net_device *dev, · 988 unmodified lines
10101011 switch (action_code) {
10111012 case WLAN_TDLS_SETUP_REQUEST:
10121013 case WLAN_TDLS_SETUP_RESPONSE:
1013− skb_set_queue_mapping(skb, IEEE80211_AC_BK);
1014− skb->priority = 2;
1014+ skb->priority = 256 + 2;
10151015 break;
10161016 default:
1017− skb_set_queue_mapping(skb, IEEE80211_AC_VI);
1018− skb->priority = 5;
1017+ skb->priority = 256 + 5;
10191018 break;
10201019 }
1020+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb));
10211021
10221022 /*
10231023 * Set the WLAN_TDLS_TEARDOWN flag to indicate a teardown in progress.
net/mac80211/tx.c+5−1
@@ -214,6 +214,7 @@ ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx) · 213 unmodified lines
214214 {
215215 struct ieee80211_local *local = tx->local;
216216 struct ieee80211_if_managed *ifmgd;
217+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
217218
218219 /* driver doesn't support power save */
219220 if (!ieee80211_hw_check(&local->hw, SUPPORTS_PS))
@@ -242,6 +243,9 @@ ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx) · 22 unmodified lines
242243 if (tx->sdata->vif.type != NL80211_IFTYPE_STATION)
243244 return TX_CONTINUE;
244245
246+ if (unlikely(info->flags & IEEE80211_TX_INTFL_OFFCHAN_TX_OK))
247+ return TX_CONTINUE;
248+
245249 ifmgd = &tx->sdata->u.mgd;
246250
247251 /*
@@ -1890,7 +1894,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, · 1642 unmodified lines
18901894 sdata->vif.hw_queue[skb_get_queue_mapping(skb)];
18911895
18921896 if (invoke_tx_handlers_early(&tx))
1893− return false;
1897+ return true;
18941898
18951899 if (ieee80211_queue_skb(local, sdata, tx.sta, tx.skb))
18961900 return true;
net/netfilter/nf_conntrack_proto_tcp.c+2−2
@@ -1213,8 +1213,8 @@ static const struct nla_policy tcp_nla_policy[CTA_PROTOINFO_TCP_MAX+1] = { · 1212 unmodified lines
12131213 #define TCP_NLATTR_SIZE ( \
12141214 NLA_ALIGN(NLA_HDRLEN + 1) + \
12151215 NLA_ALIGN(NLA_HDRLEN + 1) + \
1216− NLA_ALIGN(NLA_HDRLEN + sizeof(sizeof(struct nf_ct_tcp_flags))) + \
1217− NLA_ALIGN(NLA_HDRLEN + sizeof(sizeof(struct nf_ct_tcp_flags))))
1216+ NLA_ALIGN(NLA_HDRLEN + sizeof(struct nf_ct_tcp_flags)) + \
1217+ NLA_ALIGN(NLA_HDRLEN + sizeof(struct nf_ct_tcp_flags)))
12181218
12191219 static int nlattr_to_tcp(struct nlattr *cda[], struct nf_conn *ct)
12201220 {
net/netfilter/nft_osf.c+1−1
@@ -49,7 +49,7 @@ static int nft_osf_init(const struct nft_ctx *ctx, · 48 unmodified lines
4949
5050 priv->dreg = nft_parse_register(tb[NFTA_OSF_DREG]);
5151 err = nft_validate_register_store(ctx, priv->dreg, NULL,
52− NFTA_DATA_VALUE, NFT_OSF_MAXGENRELEN);
52+ NFT_DATA_VALUE, NFT_OSF_MAXGENRELEN);
5353 if (err < 0)
5454 return err;
5555
net/netfilter/nft_set_rbtree.c+14−14
@@ -355,12 +355,11 @@ cont: · 354 unmodified lines
355355
356356 static void nft_rbtree_gc(struct work_struct *work)
357357 {
358+ struct nft_rbtree_elem *rbe, *rbe_end = NULL, *rbe_prev = NULL;
358359 struct nft_set_gc_batch *gcb = NULL;
359− struct rb_node *node, *prev = NULL;
360− struct nft_rbtree_elem *rbe;
361360 struct nft_rbtree *priv;
361+ struct rb_node *node;
362362 struct nft_set *set;
363− int i;
364363
365364 priv = container_of(work, struct nft_rbtree, gc_work.work);
366365 set = nft_set_container_of(priv);
@@ -371,7 +370,7 @@ static void nft_rbtree_gc(struct work_struct *work) · 4 unmodified lines
371370 rbe = rb_entry(node, struct nft_rbtree_elem, node);
372371
373372 if (nft_rbtree_interval_end(rbe)) {
374− prev = node;
373+ rbe_end = rbe;
375374 continue;
376375 }
377376 if (!nft_set_elem_expired(&rbe->ext))
@@ -379,29 +378,30 @@ static void nft_rbtree_gc(struct work_struct *work) · 1 unmodified line
379378 if (nft_set_elem_mark_busy(&rbe->ext))
380379 continue;
381380
381+ if (rbe_prev) {
382+ rb_erase(&rbe_prev->node, &priv->root);
383+ rbe_prev = NULL;
384+ }
382385 gcb = nft_set_gc_batch_check(set, gcb, GFP_ATOMIC);
383386 if (!gcb)
384387 break;
385388
386389 atomic_dec(&set->nelems);
387390 nft_set_gc_batch_add(gcb, rbe);
391+ rbe_prev = rbe;
388392
389− if (prev) {
390− rbe = rb_entry(prev, struct nft_rbtree_elem, node);
393+ if (rbe_end) {
391394 atomic_dec(&set->nelems);
392− nft_set_gc_batch_add(gcb, rbe);
393− prev = NULL;
395+ nft_set_gc_batch_add(gcb, rbe_end);
396+ rb_erase(&rbe_end->node, &priv->root);
397+ rbe_end = NULL;
394398 }
395399 node = rb_next(node);
396400 if (!node)
397401 break;
398402 }
399− if (gcb) {
400− for (i = 0; i < gcb->head.cnt; i++) {
401− rbe = gcb->elems[i];
402− rb_erase(&rbe->node, &priv->root);
403− }
404− }
403+ if (rbe_prev)
404+ rb_erase(&rbe_prev->node, &priv->root);
405405 write_seqcount_end(&priv->count);
406406 write_unlock_bh(&priv->lock);
407407
net/netfilter/xt_socket.c+2−2
@@ -56,7 +56,7 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par, · 55 unmodified lines
5656 struct sk_buff *pskb = (struct sk_buff *)skb;
5757 struct sock *sk = skb->sk;
5858
59− if (!net_eq(xt_net(par), sock_net(sk)))
59+ if (sk && !net_eq(xt_net(par), sock_net(sk)))
6060 sk = NULL;
6161
6262 if (!sk)
@@ -117,7 +117,7 @@ socket_mt6_v1_v2_v3(const struct sk_buff *skb, struct xt_action_param *par) · 54 unmodified lines
117117 struct sk_buff *pskb = (struct sk_buff *)skb;
118118 struct sock *sk = skb->sk;
119119
120− if (!net_eq(xt_net(par), sock_net(sk)))
120+ if (sk && !net_eq(xt_net(par), sock_net(sk)))
121121 sk = NULL;
122122
123123 if (!sk)
net/openvswitch/conntrack.c+6−4
@@ -1312,6 +1312,10 @@ static int ovs_ct_add_helper(struct ovs_conntrack_info *info, const char *name, · 1311 unmodified lines
13121312
13131313 rcu_assign_pointer(help->helper, helper);
13141314 info->helper = helper;
1315+
1316+ if (info->nat)
1317+ request_module("ip_nat_%s", name);
1318+
13151319 return 0;
13161320 }
13171321
@@ -1624,10 +1628,6 @@ int ovs_ct_copy_action(struct net *net, const struct nlattr *attr, · 306 unmodified lines
16241628 OVS_NLERR(log, "Failed to allocate conntrack template");
16251629 return -ENOMEM;
16261630 }
1627−
1628− __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status);
1629− nf_conntrack_get(&ct_info.ct->ct_general);
1630−
16311631 if (helper) {
16321632 err = ovs_ct_add_helper(&ct_info, helper, key, log);
16331633 if (err)
@@ -1639,6 +1639,8 @@ int ovs_ct_copy_action(struct net *net, const struct nlattr *attr, · 5 unmodified lines
16391639 if (err)
16401640 goto err_free_ct;
16411641
1642+ __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status);
1643+ nf_conntrack_get(&ct_info.ct->ct_general);
16421644 return 0;
16431645 err_free_ct:
16441646 __ovs_ct_free_action(&ct_info);
net/packet/af_packet.c+7−4
@@ -2715,10 +2715,12 @@ tpacket_error: · 2714 unmodified lines
27152715 }
27162716 }
27172717
2718− if (po->has_vnet_hdr && virtio_net_hdr_to_skb(skb, vnet_hdr,
2719− vio_le())) {
2720− tp_len = -EINVAL;
2721− goto tpacket_error;
2718+ if (po->has_vnet_hdr) {
2719+ if (virtio_net_hdr_to_skb(skb, vnet_hdr, vio_le())) {
2720+ tp_len = -EINVAL;
2721+ goto tpacket_error;
2722+ }
2723+ virtio_net_hdr_set_proto(skb, vnet_hdr);
27222724 }
27232725
27242726 skb->destructor = tpacket_destruct_skb;
@@ -2915,6 +2917,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) · 190 unmodified lines
29152917 if (err)
29162918 goto out_free;
29172919 len += sizeof(vnet_hdr);
2920+ virtio_net_hdr_set_proto(skb, &vnet_hdr);
29182921 }
29192922
29202923 skb_probe_transport_header(skb, reserve);
net/rxrpc/ar-internal.h+19−17
@@ -40,17 +40,12 @@ struct rxrpc_crypt { · 39 unmodified lines
4040 struct rxrpc_connection;
4141
4242 /*
43− * Mark applied to socket buffers.
43+ * Mark applied to socket buffers in skb->mark. skb->priority is used
44+ * to pass supplementary information.
4445 */
4546 enum rxrpc_skb_mark {
46− RXRPC_SKB_MARK_DATA, /* data message */
47− RXRPC_SKB_MARK_FINAL_ACK, /* final ACK received message */
48− RXRPC_SKB_MARK_BUSY, /* server busy message */
49− RXRPC_SKB_MARK_REMOTE_ABORT, /* remote abort message */
50− RXRPC_SKB_MARK_LOCAL_ABORT, /* local abort message */
51− RXRPC_SKB_MARK_NET_ERROR, /* network error message */
52− RXRPC_SKB_MARK_LOCAL_ERROR, /* local error message */
53− RXRPC_SKB_MARK_NEW_CALL, /* local error message */
47+ RXRPC_SKB_MARK_REJECT_BUSY, /* Reject with BUSY */
48+ RXRPC_SKB_MARK_REJECT_ABORT, /* Reject with ABORT (code in skb->priority) */
5449 };
5550
5651 /*
@@ -293,7 +288,6 @@ struct rxrpc_peer { · 236 unmodified lines
293288 struct hlist_node hash_link;
294289 struct rxrpc_local *local;
295290 struct hlist_head error_targets; /* targets for net error distribution */
296− struct work_struct error_distributor;
297291 struct rb_root service_conns; /* Service connections */
298292 struct list_head keepalive_link; /* Link in net->peer_keepalive[] */
299293 time64_t last_tx_at; /* Last time packet sent here */
@@ -304,8 +298,6 @@ struct rxrpc_peer { · 4 unmodified lines
304298 unsigned int maxdata; /* data size (MTU - hdrsize) */
305299 unsigned short hdrsize; /* header size (IP + UDP + RxRPC) */
306300 int debug_id; /* debug ID for printks */
307− int error_report; /* Net (+0) or local (+1000000) to distribute */
308−#define RXRPC_LOCAL_ERROR_OFFSET 1000000
309301 struct sockaddr_rxrpc srx; /* remote address */
310302
311303 /* calculated RTT cache */
@@ -463,6 +455,16 @@ struct rxrpc_connection { · 151 unmodified lines
463455 u8 out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */
464456 };
465457
458+static inline bool rxrpc_to_server(const struct rxrpc_skb_priv *sp)
459+{
460+ return sp->hdr.flags & RXRPC_CLIENT_INITIATED;
461+}
462+
463+static inline bool rxrpc_to_client(const struct rxrpc_skb_priv *sp)
464+{
465+ return !rxrpc_to_server(sp);
466+}
467+
466468 /*
467469 * Flags in call->flags.
468470 */
@@ -717,6 +719,8 @@ extern struct workqueue_struct *rxrpc_workqueue; · 248 unmodified lines
717719 int rxrpc_service_prealloc(struct rxrpc_sock *, gfp_t);
718720 void rxrpc_discard_prealloc(struct rxrpc_sock *);
719721 struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *,
722+ struct rxrpc_sock *,
723+ struct rxrpc_peer *,
720724 struct rxrpc_connection *,
721725 struct sk_buff *);
722726 void rxrpc_accept_incoming_calls(struct rxrpc_local *);
@@ -908,7 +912,8 @@ extern unsigned int rxrpc_closed_conn_expiry; · 185 unmodified lines
908912
909913 struct rxrpc_connection *rxrpc_alloc_connection(gfp_t);
910914 struct rxrpc_connection *rxrpc_find_connection_rcu(struct rxrpc_local *,
911− struct sk_buff *);
915+ struct sk_buff *,
916+ struct rxrpc_peer **);
912917 void __rxrpc_disconnect_call(struct rxrpc_connection *, struct rxrpc_call *);
913918 void rxrpc_disconnect_call(struct rxrpc_call *);
914919 void rxrpc_kill_connection(struct rxrpc_connection *);
@@ -1031,7 +1036,6 @@ void rxrpc_send_keepalive(struct rxrpc_peer *); · 116 unmodified lines
10311036 * peer_event.c
10321037 */
10331038 void rxrpc_error_report(struct sock *);
1034−void rxrpc_peer_error_distributor(struct work_struct *);
10351039 void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace,
10361040 rxrpc_serial_t, rxrpc_serial_t, ktime_t, ktime_t);
10371041 void rxrpc_peer_keepalive_worker(struct work_struct *);
@@ -1044,13 +1048,11 @@ struct rxrpc_peer *rxrpc_lookup_peer_rcu(struct rxrpc_local *, · 6 unmodified lines
10441048 struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_local *,
10451049 struct sockaddr_rxrpc *, gfp_t);
10461050 struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *, gfp_t);
1047−struct rxrpc_peer *rxrpc_lookup_incoming_peer(struct rxrpc_local *,
1048− struct rxrpc_peer *);
1051+void rxrpc_new_incoming_peer(struct rxrpc_local *, struct rxrpc_peer *);
10491052 void rxrpc_destroy_all_peers(struct rxrpc_net *);
10501053 struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *);
10511054 struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *);
10521055 void rxrpc_put_peer(struct rxrpc_peer *);
1053−void __rxrpc_queue_peer_error(struct rxrpc_peer *);
10541056
10551057 /*
10561058 * proc.c
net/rxrpc/call_accept.c+14−31
@@ -249,11 +249,11 @@ void rxrpc_discard_prealloc(struct rxrpc_sock *rx) · 248 unmodified lines
249249 */
250250 static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx,
251251 struct rxrpc_local *local,
252+ struct rxrpc_peer *peer,
252253 struct rxrpc_connection *conn,
253254 struct sk_buff *skb)
254255 {
255256 struct rxrpc_backlog *b = rx->backlog;
256− struct rxrpc_peer *peer, *xpeer;
257257 struct rxrpc_call *call;
258258 unsigned short call_head, conn_head, peer_head;
259259 unsigned short call_tail, conn_tail, peer_tail;
@@ -276,21 +276,18 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx, · 16 unmodified lines
276276 return NULL;
277277
278278 if (!conn) {
279− /* No connection. We're going to need a peer to start off
280− * with. If one doesn't yet exist, use a spare from the
281− * preallocation set. We dump the address into the spare in
282− * anticipation - and to save on stack space.
283− */
284− xpeer = b->peer_backlog[peer_tail];
285− if (rxrpc_extract_addr_from_skb(local, &xpeer->srx, skb) < 0)
286− return NULL;
287−
288− peer = rxrpc_lookup_incoming_peer(local, xpeer);
289− if (peer == xpeer) {
279+ if (peer && !rxrpc_get_peer_maybe(peer))
280+ peer = NULL;
281+ if (!peer) {
282+ peer = b->peer_backlog[peer_tail];
283+ if (rxrpc_extract_addr_from_skb(local, &peer->srx, skb) < 0)
284+ return NULL;
290285 b->peer_backlog[peer_tail] = NULL;
291286 smp_store_release(&b->peer_backlog_tail,
292287 (peer_tail + 1) &
293288 (RXRPC_BACKLOG_MAX - 1));
289+
290+ rxrpc_new_incoming_peer(local, peer);
294291 }
295292
296293 /* Now allocate and set up the connection */
@@ -335,45 +332,31 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx, · 38 unmodified lines
335332 * The call is returned with the user access mutex held.
336333 */
337334 struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *local,
335+ struct rxrpc_sock *rx,
336+ struct rxrpc_peer *peer,
338337 struct rxrpc_connection *conn,
339338 struct sk_buff *skb)
340339 {
341340 struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
342− struct rxrpc_sock *rx;
343341 struct rxrpc_call *call;
344− u16 service_id = sp->hdr.serviceId;
345342
346343 _enter("");
347344
348− /* Get the socket providing the service */
349− rx = rcu_dereference(local->service);
350− if (rx && (service_id == rx->srx.srx_service ||
351− service_id == rx->second_service))
352− goto found_service;
353−
354− trace_rxrpc_abort(0, "INV", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq,
355− RX_INVALID_OPERATION, EOPNOTSUPP);
356− skb->mark = RXRPC_SKB_MARK_LOCAL_ABORT;
357− skb->priority = RX_INVALID_OPERATION;
358− _leave(" = NULL [service]");
359− return NULL;
360−
361−found_service:
362345 spin_lock(&rx->incoming_lock);
363346 if (rx->sk.sk_state == RXRPC_SERVER_LISTEN_DISABLED ||
364347 rx->sk.sk_state == RXRPC_CLOSE) {
365348 trace_rxrpc_abort(0, "CLS", sp->hdr.cid, sp->hdr.callNumber,
366349 sp->hdr.seq, RX_INVALID_OPERATION, ESHUTDOWN);
367− skb->mark = RXRPC_SKB_MARK_LOCAL_ABORT;
350+ skb->mark = RXRPC_SKB_MARK_REJECT_ABORT;
368351 skb->priority = RX_INVALID_OPERATION;
369352 _leave(" = NULL [close]");
370353 call = NULL;
371354 goto out;
372355 }
373356
374− call = rxrpc_alloc_incoming_call(rx, local, conn, skb);
357+ call = rxrpc_alloc_incoming_call(rx, local, peer, conn, skb);
375358 if (!call) {
376− skb->mark = RXRPC_SKB_MARK_BUSY;
359+ skb->mark = RXRPC_SKB_MARK_REJECT_BUSY;
377360 _leave(" = NULL [busy]");
378361 call = NULL;
379362 goto out;
net/rxrpc/call_object.c+1−1
@@ -400,7 +400,7 @@ void rxrpc_incoming_call(struct rxrpc_sock *rx, · 399 unmodified lines
400400 rcu_assign_pointer(conn->channels[chan].call, call);
401401
402402 spin_lock(&conn->params.peer->lock);
403− hlist_add_head(&call->error_link, &conn->params.peer->error_targets);
403+ hlist_add_head_rcu(&call->error_link, &conn->params.peer->error_targets);
404404 spin_unlock(&conn->params.peer->lock);
405405
406406 _net("CALL incoming %d on CONN %d", call->debug_id, call->conn->debug_id);
net/rxrpc/conn_client.c+2−2
@@ -710,8 +710,8 @@ int rxrpc_connect_call(struct rxrpc_call *call, · 709 unmodified lines
710710 }
711711
712712 spin_lock_bh(&call->conn->params.peer->lock);
713− hlist_add_head(&call->error_link,
714− &call->conn->params.peer->error_targets);
713+ hlist_add_head_rcu(&call->error_link,
714+ &call->conn->params.peer->error_targets);
715715 spin_unlock_bh(&call->conn->params.peer->lock);
716716
717717 out:
net/rxrpc/conn_object.c+8−6
@@ -69,10 +69,14 @@ struct rxrpc_connection *rxrpc_alloc_connection(gfp_t gfp) · 68 unmodified lines
6969 * If successful, a pointer to the connection is returned, but no ref is taken.
7070 * NULL is returned if there is no match.
7171 *
72+ * When searching for a service call, if we find a peer but no connection, we
73+ * return that through *_peer in case we need to create a new service call.
74+ *
7275 * The caller must be holding the RCU read lock.
7376 */
7477 struct rxrpc_connection *rxrpc_find_connection_rcu(struct rxrpc_local *local,
75− struct sk_buff *skb)
78+ struct sk_buff *skb,
79+ struct rxrpc_peer **_peer)
7680 {
7781 struct rxrpc_connection *conn;
7882 struct rxrpc_conn_proto k;
@@ -85,9 +89,6 @@ struct rxrpc_connection *rxrpc_find_connection_rcu(struct rxrpc_local *local, · 6 unmodified lines
8589 if (rxrpc_extract_addr_from_skb(local, &srx, skb) < 0)
8690 goto not_found;
8791
88− k.epoch = sp->hdr.epoch;
89− k.cid = sp->hdr.cid & RXRPC_CIDMASK;
90−
9192 /* We may have to handle mixing IPv4 and IPv6 */
9293 if (srx.transport.family != local->srx.transport.family) {
9394 pr_warn_ratelimited("AF_RXRPC: Protocol mismatch %u not %u\n",
@@ -99,7 +100,7 @@ struct rxrpc_connection *rxrpc_find_connection_rcu(struct rxrpc_local *local, · 5 unmodified lines
99100 k.epoch = sp->hdr.epoch;
100101 k.cid = sp->hdr.cid & RXRPC_CIDMASK;
101102
102− if (sp->hdr.flags & RXRPC_CLIENT_INITIATED) {
103+ if (rxrpc_to_server(sp)) {
103104 /* We need to look up service connections by the full protocol
104105 * parameter set. We look up the peer first as an intermediate
105106 * step and then the connection from the peer's tree.
@@ -107,6 +108,7 @@ struct rxrpc_connection *rxrpc_find_connection_rcu(struct rxrpc_local *local, · 1 unmodified line
107108 peer = rxrpc_lookup_peer_rcu(local, &srx);
108109 if (!peer)
109110 goto not_found;
111+ *_peer = peer;
110112 conn = rxrpc_find_service_conn_rcu(peer, skb);
111113 if (!conn || atomic_read(&conn->usage) == 0)
112114 goto not_found;
@@ -214,7 +216,7 @@ void rxrpc_disconnect_call(struct rxrpc_call *call) · 101 unmodified lines
214216 call->peer->cong_cwnd = call->cong_cwnd;
215217
216218 spin_lock_bh(&conn->params.peer->lock);
217− hlist_del_init(&call->error_link);
219+ hlist_del_rcu(&call->error_link);
218220 spin_unlock_bh(&conn->params.peer->lock);
219221
220222 if (rxrpc_is_client_call(call))
net/rxrpc/input.c+64−26
@@ -622,13 +622,14 @@ static void rxrpc_input_requested_ack(struct rxrpc_call *call, · 621 unmodified lines
622622 if (!skb)
623623 continue;
624624
625+ sent_at = skb->tstamp;
626+ smp_rmb(); /* Read timestamp before serial. */
625627 sp = rxrpc_skb(skb);
626628 if (sp->hdr.serial != orig_serial)
627629 continue;
628− smp_rmb();
629− sent_at = skb->tstamp;
630630 goto found;
631631 }
632+
632633 return;
633634
634635 found:
@@ -1124,12 +1125,14 @@ void rxrpc_data_ready(struct sock *udp_sk) · 489 unmodified lines
11241125 {
11251126 struct rxrpc_connection *conn;
11261127 struct rxrpc_channel *chan;
1127− struct rxrpc_call *call;
1128+ struct rxrpc_call *call = NULL;
11281129 struct rxrpc_skb_priv *sp;
11291130 struct rxrpc_local *local = udp_sk->sk_user_data;
1131+ struct rxrpc_peer *peer = NULL;
1132+ struct rxrpc_sock *rx = NULL;
11301133 struct sk_buff *skb;
11311134 unsigned int channel;
1132− int ret, skew;
1135+ int ret, skew = 0;
11331136
11341137 _enter("%p", udp_sk);
11351138
@@ -1143,6 +1146,9 @@ void rxrpc_data_ready(struct sock *udp_sk) · 7 unmodified lines
11431146 return;
11441147 }
11451148
1149+ if (skb->tstamp == 0)
1150+ skb->tstamp = ktime_get_real();
1151+
11461152 rxrpc_new_skb(skb, rxrpc_skb_rx_received);
11471153
11481154 _net("recv skb %p", skb);
@@ -1177,46 +1183,75 @@ void rxrpc_data_ready(struct sock *udp_sk) · 28 unmodified lines
11771183
11781184 trace_rxrpc_rx_packet(sp);
11791185
1180− _net("Rx RxRPC %s ep=%x call=%x:%x",
1181− sp->hdr.flags & RXRPC_CLIENT_INITIATED ? "ToServer" : "ToClient",
1182− sp->hdr.epoch, sp->hdr.cid, sp->hdr.callNumber);
1183−
1184− if (sp->hdr.type >= RXRPC_N_PACKET_TYPES ||
1185− !((RXRPC_SUPPORTED_PACKET_TYPES >> sp->hdr.type) & 1)) {
1186− _proto("Rx Bad Packet Type %u", sp->hdr.type);
1187− goto bad_message;
1188− }
1189−
11901186 switch (sp->hdr.type) {
11911187 case RXRPC_PACKET_TYPE_VERSION:
1192− if (!(sp->hdr.flags & RXRPC_CLIENT_INITIATED))
1188+ if (rxrpc_to_client(sp))
11931189 goto discard;
11941190 rxrpc_post_packet_to_local(local, skb);
11951191 goto out;
11961192
11971193 case RXRPC_PACKET_TYPE_BUSY:
1198− if (sp->hdr.flags & RXRPC_CLIENT_INITIATED)
1194+ if (rxrpc_to_server(sp))
11991195 goto discard;
12001196 /* Fall through */
1197+ case RXRPC_PACKET_TYPE_ACK:
1198+ case RXRPC_PACKET_TYPE_ACKALL:
1199+ if (sp->hdr.callNumber == 0)
1200+ goto bad_message;
1201+ /* Fall through */
1202+ case RXRPC_PACKET_TYPE_ABORT:
1203+ break;
12011204
12021205 case RXRPC_PACKET_TYPE_DATA:
1203− if (sp->hdr.callNumber == 0)
1206+ if (sp->hdr.callNumber == 0 ||
1207+ sp->hdr.seq == 0)
12041208 goto bad_message;
12051209 if (sp->hdr.flags & RXRPC_JUMBO_PACKET &&
12061210 !rxrpc_validate_jumbo(skb))
12071211 goto bad_message;
12081212 break;
12091213
1214+ case RXRPC_PACKET_TYPE_CHALLENGE:
1215+ if (rxrpc_to_server(sp))
1216+ goto discard;
1217+ break;
1218+ case RXRPC_PACKET_TYPE_RESPONSE:
1219+ if (rxrpc_to_client(sp))
1220+ goto discard;
1221+ break;
1222+
12101223 /* Packet types 9-11 should just be ignored. */
12111224 case RXRPC_PACKET_TYPE_PARAMS:
12121225 case RXRPC_PACKET_TYPE_10:
12131226 case RXRPC_PACKET_TYPE_11:
12141227 goto discard;
1228+
1229+ default:
1230+ _proto("Rx Bad Packet Type %u", sp->hdr.type);
1231+ goto bad_message;
12151232 }
12161233
1234+ if (sp->hdr.serviceId == 0)
1235+ goto bad_message;
1236+
12171237 rcu_read_lock();
12181238
1219− conn = rxrpc_find_connection_rcu(local, skb);
1239+ if (rxrpc_to_server(sp)) {
1240+ /* Weed out packets to services we're not offering. Packets
1241+ * that would begin a call are explicitly rejected and the rest
1242+ * are just discarded.
1243+ */
1244+ rx = rcu_dereference(local->service);
1245+ if (!rx || (sp->hdr.serviceId != rx->srx.srx_service &&
1246+ sp->hdr.serviceId != rx->second_service)) {
1247+ if (sp->hdr.type == RXRPC_PACKET_TYPE_DATA &&
1248+ sp->hdr.seq == 1)
1249+ goto unsupported_service;
1250+ goto discard_unlock;
1251+ }
1252+ }
1253+
1254+ conn = rxrpc_find_connection_rcu(local, skb, &peer);
12201255 if (conn) {
12211256 if (sp->hdr.securityIndex != conn->security_ix)
12221257 goto wrong_security;
@@ -1280,7 +1315,7 @@ void rxrpc_data_ready(struct sock *udp_sk) · 57 unmodified lines
12801315 call = rcu_dereference(chan->call);
12811316
12821317 if (sp->hdr.callNumber > chan->call_id) {
1283− if (!(sp->hdr.flags & RXRPC_CLIENT_INITIATED)) {
1318+ if (rxrpc_to_client(sp)) {
12841319 rcu_read_unlock();
12851320 goto reject_packet;
12861321 }
@@ -1297,19 +1332,15 @@ void rxrpc_data_ready(struct sock *udp_sk) · 10 unmodified lines
12971332 if (!test_bit(RXRPC_CALL_RX_HEARD, &call->flags))
12981333 set_bit(RXRPC_CALL_RX_HEARD, &call->flags);
12991334 }
1300− } else {
1301− skew = 0;
1302− call = NULL;
13031335 }
13041336
13051337 if (!call || atomic_read(&call->usage) == 0) {
1306− if (!(sp->hdr.type & RXRPC_CLIENT_INITIATED) ||
1307− sp->hdr.callNumber == 0 ||
1338+ if (rxrpc_to_client(sp) ||
13081339 sp->hdr.type != RXRPC_PACKET_TYPE_DATA)
13091340 goto bad_message_unlock;
13101341 if (sp->hdr.seq != 1)
13111342 goto discard_unlock;
1312− call = rxrpc_new_incoming_call(local, conn, skb);
1343+ call = rxrpc_new_incoming_call(local, rx, peer, conn, skb);
13131344 if (!call) {
13141345 rcu_read_unlock();
13151346 goto reject_packet;
@@ -1340,6 +1371,13 @@ wrong_security: · 24 unmodified lines
13401371 skb->priority = RXKADINCONSISTENCY;
13411372 goto post_abort;
13421373
1374+unsupported_service:
1375+ rcu_read_unlock();
1376+ trace_rxrpc_abort(0, "INV", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq,
1377+ RX_INVALID_OPERATION, EOPNOTSUPP);
1378+ skb->priority = RX_INVALID_OPERATION;
1379+ goto post_abort;
1380+
13431381 reupgrade:
13441382 rcu_read_unlock();
13451383 trace_rxrpc_abort(0, "UPG", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq,
@@ -1354,7 +1392,7 @@ bad_message: · 8 unmodified lines
13541392 protocol_error:
13551393 skb->priority = RX_PROTOCOL_ERROR;
13561394 post_abort:
1357− skb->mark = RXRPC_SKB_MARK_LOCAL_ABORT;
1395+ skb->mark = RXRPC_SKB_MARK_REJECT_ABORT;
13581396 reject_packet:
13591397 trace_rxrpc_rx_done(skb->mark, skb->priority);
13601398 rxrpc_reject_packet(local, skb);
net/rxrpc/local_object.c+22−10
@@ -135,10 +135,10 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) · 134 unmodified lines
135135 }
136136
137137 switch (local->srx.transport.family) {
138− case AF_INET:
139− /* we want to receive ICMP errors */
138+ case AF_INET6:
139+ /* we want to receive ICMPv6 errors */
140140 opt = 1;
141− ret = kernel_setsockopt(local->socket, SOL_IP, IP_RECVERR,
141+ ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_RECVERR,
142142 (char *) &opt, sizeof(opt));
143143 if (ret < 0) {
144144 _debug("setsockopt failed");
@@ -146,19 +146,22 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) · 1 unmodified line
146146 }
147147
148148 /* we want to set the don't fragment bit */
149− opt = IP_PMTUDISC_DO;
150− ret = kernel_setsockopt(local->socket, SOL_IP, IP_MTU_DISCOVER,
149+ opt = IPV6_PMTUDISC_DO;
150+ ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_MTU_DISCOVER,
151151 (char *) &opt, sizeof(opt));
152152 if (ret < 0) {
153153 _debug("setsockopt failed");
154154 goto error;
155155 }
156− break;
157156
158− case AF_INET6:
157+ /* Fall through and set IPv4 options too otherwise we don't get
158+ * errors from IPv4 packets sent through the IPv6 socket.
159+ */
160+
161+ case AF_INET:
159162 /* we want to receive ICMP errors */
160163 opt = 1;
161− ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_RECVERR,
164+ ret = kernel_setsockopt(local->socket, SOL_IP, IP_RECVERR,
162165 (char *) &opt, sizeof(opt));
163166 if (ret < 0) {
164167 _debug("setsockopt failed");
@@ -166,13 +169,22 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) · 1 unmodified line
166169 }
167170
168171 /* we want to set the don't fragment bit */
169− opt = IPV6_PMTUDISC_DO;
170− ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_MTU_DISCOVER,
172+ opt = IP_PMTUDISC_DO;
173+ ret = kernel_setsockopt(local->socket, SOL_IP, IP_MTU_DISCOVER,
171174 (char *) &opt, sizeof(opt));
172175 if (ret < 0) {
173176 _debug("setsockopt failed");
174177 goto error;
175178 }
179+
180+ /* We want receive timestamps. */
181+ opt = 1;
182+ ret = kernel_setsockopt(local->socket, SOL_SOCKET, SO_TIMESTAMPNS,
183+ (char *)&opt, sizeof(opt));
184+ if (ret < 0) {
185+ _debug("setsockopt failed");
186+ goto error;
187+ }
176188 break;
177189
178190 default:
net/rxrpc/output.c+36−18
@@ -124,7 +124,6 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, · 123 unmodified lines
124124 struct kvec iov[2];
125125 rxrpc_serial_t serial;
126126 rxrpc_seq_t hard_ack, top;
127− ktime_t now;
128127 size_t len, n;
129128 int ret;
130129 u8 reason;
@@ -196,9 +195,7 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, · 65 unmodified lines
196195 /* We need to stick a time in before we send the packet in case
197196 * the reply gets back before kernel_sendmsg() completes - but
198197 * asking UDP to send the packet can take a relatively long
199− * time, so we update the time after, on the assumption that
200− * the packet transmission is more likely to happen towards the
201− * end of the kernel_sendmsg() call.
198+ * time.
202199 */
203200 call->ping_time = ktime_get_real();
204201 set_bit(RXRPC_CALL_PINGING, &call->flags);
@@ -206,9 +203,6 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, · 1 unmodified line
206203 }
207204
208205 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len);
209− now = ktime_get_real();
210− if (ping)
211− call->ping_time = now;
212206 conn->params.peer->last_tx_at = ktime_get_seconds();
213207 if (ret < 0)
214208 trace_rxrpc_tx_fail(call->debug_id, serial, ret,
@@ -363,8 +357,14 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, · 148 unmodified lines
363357
364358 /* If our RTT cache needs working on, request an ACK. Also request
365359 * ACKs if a DATA packet appears to have been lost.
360+ *
361+ * However, we mustn't request an ACK on the last reply packet of a
362+ * service call, lest OpenAFS incorrectly send us an ACK with some
363+ * soft-ACKs in it and then never follow up with a proper hard ACK.
366364 */
367− if (!(sp->hdr.flags & RXRPC_LAST_PACKET) &&
365+ if ((!(sp->hdr.flags & RXRPC_LAST_PACKET) ||
366+ rxrpc_to_server(sp)
367+ ) &&
368368 (test_and_clear_bit(RXRPC_CALL_EV_ACK_LOST, &call->events) ||
369369 retrans ||
370370 call->cong_mode == RXRPC_CALL_SLOW_START ||
@@ -390,6 +390,11 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, · 19 unmodified lines
390390 goto send_fragmentable;
391391
392392 down_read(&conn->params.local->defrag_sem);
393+
394+ sp->hdr.serial = serial;
395+ smp_wmb(); /* Set serial before timestamp */
396+ skb->tstamp = ktime_get_real();
397+
393398 /* send the packet by UDP
394399 * - returns -EMSGSIZE if UDP would have to fragment the packet
395400 * to go out of the interface
@@ -413,12 +418,8 @@ done: · 17 unmodified lines
413418 trace_rxrpc_tx_data(call, sp->hdr.seq, serial, whdr.flags,
414419 retrans, lost);
415420 if (ret >= 0) {
416− ktime_t now = ktime_get_real();
417− skb->tstamp = now;
418− smp_wmb();
419− sp->hdr.serial = serial;
420421 if (whdr.flags & RXRPC_REQUEST_ACK) {
421− call->peer->rtt_last_req = now;
422+ call->peer->rtt_last_req = skb->tstamp;
422423 trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_data, serial);
423424 if (call->peer->rtt_usage > 1) {
424425 unsigned long nowj = jiffies, ack_lost_at;
@@ -457,6 +458,10 @@ send_fragmentable: · 32 unmodified lines
457458
458459 down_write(&conn->params.local->defrag_sem);
459460
461+ sp->hdr.serial = serial;
462+ smp_wmb(); /* Set serial before timestamp */
463+ skb->tstamp = ktime_get_real();
464+
460465 switch (conn->params.local->srx.transport.family) {
461466 case AF_INET:
462467 opt = IP_PMTUDISC_DONT;
@@ -519,7 +524,7 @@ void rxrpc_reject_packets(struct rxrpc_local *local) · 56 unmodified lines
519524 struct kvec iov[2];
520525 size_t size;
521526 __be32 code;
522− int ret;
527+ int ret, ioc;
523528
524529 _enter("%d", local->debug_id);
525530
@@ -527,7 +532,6 @@ void rxrpc_reject_packets(struct rxrpc_local *local) · 1 unmodified line
527532 iov[0].iov_len = sizeof(whdr);
528533 iov[1].iov_base = &code;
529534 iov[1].iov_len = sizeof(code);
530− size = sizeof(whdr) + sizeof(code);
531535
532536 msg.msg_name = &srx.transport;
533537 msg.msg_control = NULL;
@@ -535,17 +539,31 @@ void rxrpc_reject_packets(struct rxrpc_local *local) · 1 unmodified line
535539 msg.msg_flags = 0;
536540
537541 memset(&whdr, 0, sizeof(whdr));
538− whdr.type = RXRPC_PACKET_TYPE_ABORT;
539542
540543 while ((skb = skb_dequeue(&local->reject_queue))) {
541544 rxrpc_see_skb(skb, rxrpc_skb_rx_seen);
542545 sp = rxrpc_skb(skb);
543546
547+ switch (skb->mark) {
548+ case RXRPC_SKB_MARK_REJECT_BUSY:
549+ whdr.type = RXRPC_PACKET_TYPE_BUSY;
550+ size = sizeof(whdr);
551+ ioc = 1;
552+ break;
553+ case RXRPC_SKB_MARK_REJECT_ABORT:
554+ whdr.type = RXRPC_PACKET_TYPE_ABORT;
555+ code = htonl(skb->priority);
556+ size = sizeof(whdr) + sizeof(code);
557+ ioc = 2;
558+ break;
559+ default:
560+ rxrpc_free_skb(skb, rxrpc_skb_rx_freed);
561+ continue;
562+ }
563+
544564 if (rxrpc_extract_addr_from_skb(local, &srx, skb) == 0) {
545565 msg.msg_namelen = srx.transport_len;
546566
547− code = htonl(skb->priority);
548−
549567 whdr.epoch = htonl(sp->hdr.epoch);
550568 whdr.cid = htonl(sp->hdr.cid);
551569 whdr.callNumber = htonl(sp->hdr.callNumber);
net/rxrpc/peer_event.c+11−35
@@ -23,6 +23,8 @@ · 22 unmodified lines
2323 #include "ar-internal.h"
2424
2525 static void rxrpc_store_error(struct rxrpc_peer *, struct sock_exterr_skb *);
26+static void rxrpc_distribute_error(struct rxrpc_peer *, int,
27+ enum rxrpc_call_completion);
2628
2729 /*
2830 * Find the peer associated with an ICMP packet.
@@ -194,8 +196,6 @@ void rxrpc_error_report(struct sock *sk) · 165 unmodified lines
194196 rcu_read_unlock();
195197 rxrpc_free_skb(skb, rxrpc_skb_rx_freed);
196198
197− /* The ref we obtained is passed off to the work item */
198− __rxrpc_queue_peer_error(peer);
199199 _leave("");
200200 }
201201
@@ -205,6 +205,7 @@ void rxrpc_error_report(struct sock *sk) · 3 unmodified lines
205205 static void rxrpc_store_error(struct rxrpc_peer *peer,
206206 struct sock_exterr_skb *serr)
207207 {
208+ enum rxrpc_call_completion compl = RXRPC_CALL_NETWORK_ERROR;
208209 struct sock_extended_err *ee;
209210 int err;
210211
@@ -255,7 +256,7 @@ static void rxrpc_store_error(struct rxrpc_peer *peer, · 44 unmodified lines
255256 case SO_EE_ORIGIN_NONE:
256257 case SO_EE_ORIGIN_LOCAL:
257258 _proto("Rx Received local error { error=%d }", err);
258− err += RXRPC_LOCAL_ERROR_OFFSET;
259+ compl = RXRPC_CALL_LOCAL_ERROR;
259260 break;
260261
261262 case SO_EE_ORIGIN_ICMP6:
@@ -264,48 +265,23 @@ static void rxrpc_store_error(struct rxrpc_peer *peer, · 2 unmodified lines
264265 break;
265266 }
266267
267− peer->error_report = err;
268+ rxrpc_distribute_error(peer, err, compl);
268269 }
269270
270271 /*
271− * Distribute an error that occurred on a peer
272+ * Distribute an error that occurred on a peer.
272273 */
273−void rxrpc_peer_error_distributor(struct work_struct *work)
274+static void rxrpc_distribute_error(struct rxrpc_peer *peer, int error,
275+ enum rxrpc_call_completion compl)
274276 {
275− struct rxrpc_peer *peer =
276− container_of(work, struct rxrpc_peer, error_distributor);
277277 struct rxrpc_call *call;
278− enum rxrpc_call_completion compl;
279− int error;
280−
281− _enter("");
282−
283− error = READ_ONCE(peer->error_report);
284− if (error < RXRPC_LOCAL_ERROR_OFFSET) {
285− compl = RXRPC_CALL_NETWORK_ERROR;
286− } else {
287− compl = RXRPC_CALL_LOCAL_ERROR;
288− error -= RXRPC_LOCAL_ERROR_OFFSET;
289− }
290278
291− _debug("ISSUE ERROR %s %d", rxrpc_call_completions[compl], error);
292−
293− spin_lock_bh(&peer->lock);
294−
295− while (!hlist_empty(&peer->error_targets)) {
296− call = hlist_entry(peer->error_targets.first,
297− struct rxrpc_call, error_link);
298− hlist_del_init(&call->error_link);
279+ hlist_for_each_entry_rcu(call, &peer->error_targets, error_link) {
299280 rxrpc_see_call(call);
300−
301− if (rxrpc_set_call_completion(call, compl, 0, -error))
281+ if (call->state < RXRPC_CALL_COMPLETE &&
282+ rxrpc_set_call_completion(call, compl, 0, -error))
302283 rxrpc_notify_socket(call);
303284 }
304−
305− spin_unlock_bh(&peer->lock);
306−
307− rxrpc_put_peer(peer);
308− _leave("");
309285 }
310286
311287 /*
net/rxrpc/peer_object.c+11−41
@@ -124,11 +124,9 @@ static struct rxrpc_peer *__rxrpc_lookup_peer_rcu( · 123 unmodified lines
124124 struct rxrpc_net *rxnet = local->rxnet;
125125
126126 hash_for_each_possible_rcu(rxnet->peer_hash, peer, hash_link, hash_key) {
127− if (rxrpc_peer_cmp_key(peer, local, srx, hash_key) == 0) {
128− if (atomic_read(&peer->usage) == 0)
129− return NULL;
127+ if (rxrpc_peer_cmp_key(peer, local, srx, hash_key) == 0 &&
128+ atomic_read(&peer->usage) > 0)
130129 return peer;
131− }
132130 }
133131
134132 return NULL;
@@ -222,8 +220,6 @@ struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *local, gfp_t gfp) · 87 unmodified lines
222220 atomic_set(&peer->usage, 1);
223221 peer->local = local;
224222 INIT_HLIST_HEAD(&peer->error_targets);
225− INIT_WORK(&peer->error_distributor,
226− &rxrpc_peer_error_distributor);
227223 peer->service_conns = RB_ROOT;
228224 seqlock_init(&peer->service_conn_lock);
229225 spin_lock_init(&peer->lock);
@@ -299,34 +295,23 @@ static struct rxrpc_peer *rxrpc_create_peer(struct rxrpc_local *local, · 69 unmodified lines
299295 }
300296
301297 /*
302− * Set up a new incoming peer. The address is prestored in the preallocated
303− * peer.
298+ * Set up a new incoming peer. There shouldn't be any other matching peers
299+ * since we've already done a search in the list from the non-reentrant context
300+ * (the data_ready handler) that is the only place we can add new peers.
304301 */
305−struct rxrpc_peer *rxrpc_lookup_incoming_peer(struct rxrpc_local *local,
306− struct rxrpc_peer *prealloc)
302+void rxrpc_new_incoming_peer(struct rxrpc_local *local, struct rxrpc_peer *peer)
307303 {
308− struct rxrpc_peer *peer;
309304 struct rxrpc_net *rxnet = local->rxnet;
310305 unsigned long hash_key;
311306
312− hash_key = rxrpc_peer_hash_key(local, &prealloc->srx);
313− prealloc->local = local;
314− rxrpc_init_peer(prealloc, hash_key);
307+ hash_key = rxrpc_peer_hash_key(local, &peer->srx);
308+ peer->local = local;
309+ rxrpc_init_peer(peer, hash_key);
315310
316311 spin_lock(&rxnet->peer_hash_lock);
317−
318− /* Need to check that we aren't racing with someone else */
319− peer = __rxrpc_lookup_peer_rcu(local, &prealloc->srx, hash_key);
320− if (peer && !rxrpc_get_peer_maybe(peer))
321− peer = NULL;
322− if (!peer) {
323− peer = prealloc;
324− hash_add_rcu(rxnet->peer_hash, &peer->hash_link, hash_key);
325− list_add_tail(&peer->keepalive_link, &rxnet->peer_keepalive_new);
326− }
327−
312+ hash_add_rcu(rxnet->peer_hash, &peer->hash_link, hash_key);
313+ list_add_tail(&peer->keepalive_link, &rxnet->peer_keepalive_new);
328314 spin_unlock(&rxnet->peer_hash_lock);
329− return peer;
330315 }
331316
332317 /*
@@ -415,21 +400,6 @@ struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *peer) · 82 unmodified lines
415400 return peer;
416401 }
417402
418−/*
419− * Queue a peer record. This passes the caller's ref to the workqueue.
420− */
421−void __rxrpc_queue_peer_error(struct rxrpc_peer *peer)
422−{
423− const void *here = __builtin_return_address(0);
424− int n;
425−
426− n = atomic_read(&peer->usage);
427− if (rxrpc_queue_work(&peer->error_distributor))
428− trace_rxrpc_peer(peer, rxrpc_peer_queued_error, n, here);
429− else
430− rxrpc_put_peer(peer);
431−}
432−
433403 /*
434404 * Discard a peer record.
435405 */
net/rxrpc/protocol.h+0−15
@@ -50,7 +50,6 @@ struct rxrpc_wire_header { · 49 unmodified lines
5050 #define RXRPC_PACKET_TYPE_10 10 /* Ignored */
5151 #define RXRPC_PACKET_TYPE_11 11 /* Ignored */
5252 #define RXRPC_PACKET_TYPE_VERSION 13 /* version string request */
53−#define RXRPC_N_PACKET_TYPES 14 /* number of packet types (incl type 0) */
5453
5554 uint8_t flags; /* packet flags */
5655 #define RXRPC_CLIENT_INITIATED 0x01 /* signifies a packet generated by a client */
@@ -72,20 +71,6 @@ struct rxrpc_wire_header { · 15 unmodified lines
7271
7372 } __packed;
7473
75−#define RXRPC_SUPPORTED_PACKET_TYPES ( \
76− (1 << RXRPC_PACKET_TYPE_DATA) | \
77− (1 << RXRPC_PACKET_TYPE_ACK) | \
78− (1 << RXRPC_PACKET_TYPE_BUSY) | \
79− (1 << RXRPC_PACKET_TYPE_ABORT) | \
80− (1 << RXRPC_PACKET_TYPE_ACKALL) | \
81− (1 << RXRPC_PACKET_TYPE_CHALLENGE) | \
82− (1 << RXRPC_PACKET_TYPE_RESPONSE) | \
83− /*(1 << RXRPC_PACKET_TYPE_DEBUG) | */ \
84− (1 << RXRPC_PACKET_TYPE_PARAMS) | \
85− (1 << RXRPC_PACKET_TYPE_10) | \
86− (1 << RXRPC_PACKET_TYPE_11) | \
87− (1 << RXRPC_PACKET_TYPE_VERSION))
88−
8974 /*****************************************************************************/
9075 /*
9176 * jumbo packet secondary header
net/sched/act_ipt.c+1−1
@@ -135,7 +135,7 @@ static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla, · 134 unmodified lines
135135 }
136136
137137 td = (struct xt_entry_target *)nla_data(tb[TCA_IPT_TARG]);
138− if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size) {
138+ if (nla_len(tb[TCA_IPT_TARG]) != td->u.target_size) {
139139 if (exists)
140140 tcf_idr_release(*a, bind);
141141 else
net/sched/sch_api.c+20−4
@@ -1311,6 +1311,18 @@ check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w) · 1310 unmodified lines
13111311 * Delete/get qdisc.
13121312 */
13131313
1314+const struct nla_policy rtm_tca_policy[TCA_MAX + 1] = {
1315+ [TCA_KIND] = { .type = NLA_STRING },
1316+ [TCA_OPTIONS] = { .type = NLA_NESTED },
1317+ [TCA_RATE] = { .type = NLA_BINARY,
1318+ .len = sizeof(struct tc_estimator) },
1319+ [TCA_STAB] = { .type = NLA_NESTED },
1320+ [TCA_DUMP_INVISIBLE] = { .type = NLA_FLAG },
1321+ [TCA_CHAIN] = { .type = NLA_U32 },
1322+ [TCA_INGRESS_BLOCK] = { .type = NLA_U32 },
1323+ [TCA_EGRESS_BLOCK] = { .type = NLA_U32 },
1324+};
1325+
13141326 static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
13151327 struct netlink_ext_ack *extack)
13161328 {
@@ -1327,7 +1339,8 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, · 10 unmodified lines
13271339 !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
13281340 return -EPERM;
13291341
1330− err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack);
1342+ err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy,
1343+ extack);
13311344 if (err < 0)
13321345 return err;
13331346
@@ -1411,7 +1424,8 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, · 77 unmodified lines
14111424
14121425 replay:
14131426 /* Reinit, just in case something touches this. */
1414− err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack);
1427+ err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy,
1428+ extack);
14151429 if (err < 0)
14161430 return err;
14171431
@@ -1645,7 +1659,8 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) · 227 unmodified lines
16451659 idx = 0;
16461660 ASSERT_RTNL();
16471661
1648− err = nlmsg_parse(nlh, sizeof(struct tcmsg), tca, TCA_MAX, NULL, NULL);
1662+ err = nlmsg_parse(nlh, sizeof(struct tcmsg), tca, TCA_MAX,
1663+ rtm_tca_policy, NULL);
16491664 if (err < 0)
16501665 return err;
16511666
@@ -1864,7 +1879,8 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, · 212 unmodified lines
18641879 !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
18651880 return -EPERM;
18661881
1867− err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack);
1882+ err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy,
1883+ extack);
18681884 if (err < 0)
18691885 return err;
18701886
net/sctp/outqueue.c+1−1
@@ -1048,7 +1048,7 @@ static void sctp_outq_flush_data(struct sctp_flush_ctx *ctx, · 1047 unmodified lines
10481048 if (!ctx->packet || !ctx->packet->has_cookie_echo)
10491049 return;
10501050
1051− /* fallthru */
1051+ /* fall through */
10521052 case SCTP_STATE_ESTABLISHED:
10531053 case SCTP_STATE_SHUTDOWN_PENDING:
10541054 case SCTP_STATE_SHUTDOWN_RECEIVED:
net/tipc/bearer.c+7−5
@@ -609,16 +609,18 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt, · 608 unmodified lines
609609
610610 switch (evt) {
611611 case NETDEV_CHANGE:
612− if (netif_carrier_ok(dev))
612+ if (netif_carrier_ok(dev) && netif_oper_up(dev)) {
613+ test_and_set_bit_lock(0, &b->up);
613614 break;
614− /* else: fall through */
615− case NETDEV_UP:
616− test_and_set_bit_lock(0, &b->up);
617− break;
615+ }
616+ /* fall through */
618617 case NETDEV_GOING_DOWN:
619618 clear_bit_unlock(0, &b->up);
620619 tipc_reset_bearer(net, b);
621620 break;
621+ case NETDEV_UP:
622+ test_and_set_bit_lock(0, &b->up);
623+ break;
622624 case NETDEV_CHANGEMTU:
623625 if (tipc_mtu_bad(dev, 0)) {
624626 bearer_disable(net, b);
net/tipc/link.c+44−1
@@ -410,6 +410,11 @@ char *tipc_link_name(struct tipc_link *l) · 409 unmodified lines
410410 return l->name;
411411 }
412412
413+u32 tipc_link_state(struct tipc_link *l)
414+{
415+ return l->state;
416+}
417+
413418 /**
414419 * tipc_link_create - create a new link
415420 * @n: pointer to associated node
@@ -841,9 +846,14 @@ void tipc_link_reset(struct tipc_link *l) · 425 unmodified lines
841846 l->in_session = false;
842847 l->session++;
843848 l->mtu = l->advertised_mtu;
849+ spin_lock_bh(&l->wakeupq.lock);
850+ spin_lock_bh(&l->inputq->lock);
851+ skb_queue_splice_init(&l->wakeupq, l->inputq);
852+ spin_unlock_bh(&l->inputq->lock);
853+ spin_unlock_bh(&l->wakeupq.lock);
854+
844855 __skb_queue_purge(&l->transmq);
845856 __skb_queue_purge(&l->deferdq);
846− skb_queue_splice_init(&l->wakeupq, l->inputq);
847857 __skb_queue_purge(&l->backlogq);
848858 l->backlog[TIPC_LOW_IMPORTANCE].len = 0;
849859 l->backlog[TIPC_MEDIUM_IMPORTANCE].len = 0;
@@ -1380,6 +1390,36 @@ static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe, · 530 unmodified lines
13801390 __skb_queue_tail(xmitq, skb);
13811391 }
13821392
1393+void tipc_link_create_dummy_tnl_msg(struct tipc_link *l,
1394+ struct sk_buff_head *xmitq)
1395+{
1396+ u32 onode = tipc_own_addr(l->net);
1397+ struct tipc_msg *hdr, *ihdr;
1398+ struct sk_buff_head tnlq;
1399+ struct sk_buff *skb;
1400+ u32 dnode = l->addr;
1401+
1402+ skb_queue_head_init(&tnlq);
1403+ skb = tipc_msg_create(TUNNEL_PROTOCOL, FAILOVER_MSG,
1404+ INT_H_SIZE, BASIC_H_SIZE,
1405+ dnode, onode, 0, 0, 0);
1406+ if (!skb) {
1407+ pr_warn("%sunable to create tunnel packet\n", link_co_err);
1408+ return;
1409+ }
1410+
1411+ hdr = buf_msg(skb);
1412+ msg_set_msgcnt(hdr, 1);
1413+ msg_set_bearer_id(hdr, l->peer_bearer_id);
1414+
1415+ ihdr = (struct tipc_msg *)msg_data(hdr);
1416+ tipc_msg_init(onode, ihdr, TIPC_LOW_IMPORTANCE, TIPC_DIRECT_MSG,
1417+ BASIC_H_SIZE, dnode);
1418+ msg_set_errcode(ihdr, TIPC_ERR_NO_PORT);
1419+ __skb_queue_tail(&tnlq, skb);
1420+ tipc_link_xmit(l, &tnlq, xmitq);
1421+}
1422+
13831423 /* tipc_link_tnl_prepare(): prepare and return a list of tunnel packets
13841424 * with contents of the link's transmit and backlog queues.
13851425 */
@@ -1476,6 +1516,9 @@ bool tipc_link_validate_msg(struct tipc_link *l, struct tipc_msg *hdr) · 90 unmodified lines
14761516 return false;
14771517 if (session != curr_session)
14781518 return false;
1519+ /* Extra sanity check */
1520+ if (!link_is_up(l) && msg_ack(hdr))
1521+ return false;
14791522 if (!(l->peer_caps & TIPC_LINK_PROTO_SEQNO))
14801523 return true;
14811524 /* Accept only STATE with new sequence number */
net/tipc/link.h+3−0
@@ -88,6 +88,8 @@ bool tipc_link_bc_create(struct net *net, u32 ownnode, u32 peer, · 87 unmodified lines
8888 struct tipc_link **link);
8989 void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl,
9090 int mtyp, struct sk_buff_head *xmitq);
91+void tipc_link_create_dummy_tnl_msg(struct tipc_link *tnl,
92+ struct sk_buff_head *xmitq);
9193 void tipc_link_build_reset_msg(struct tipc_link *l, struct sk_buff_head *xmitq);
9294 int tipc_link_fsm_evt(struct tipc_link *l, int evt);
9395 bool tipc_link_is_up(struct tipc_link *l);
@@ -107,6 +109,7 @@ u16 tipc_link_rcv_nxt(struct tipc_link *l); · 13 unmodified lines
107109 u16 tipc_link_acked(struct tipc_link *l);
108110 u32 tipc_link_id(struct tipc_link *l);
109111 char *tipc_link_name(struct tipc_link *l);
112+u32 tipc_link_state(struct tipc_link *l);
110113 char tipc_link_plane(struct tipc_link *l);
111114 int tipc_link_prio(struct tipc_link *l);
112115 int tipc_link_window(struct tipc_link *l);
net/tipc/node.c+13−1
@@ -111,6 +111,7 @@ struct tipc_node { · 110 unmodified lines
111111 int action_flags;
112112 struct list_head list;
113113 int state;
114+ bool failover_sent;
114115 u16 sync_point;
115116 int link_cnt;
116117 u16 working_links;
@@ -680,6 +681,7 @@ static void __tipc_node_link_up(struct tipc_node *n, int bearer_id, · 563 unmodified lines
680681 *slot0 = bearer_id;
681682 *slot1 = bearer_id;
682683 tipc_node_fsm_evt(n, SELF_ESTABL_CONTACT_EVT);
684+ n->failover_sent = false;
683685 n->action_flags |= TIPC_NOTIFY_NODE_UP;
684686 tipc_link_set_active(nl, true);
685687 tipc_bcast_add_peer(n->net, nl, xmitq);
@@ -911,6 +913,7 @@ void tipc_node_check_dest(struct net *net, u32 addr, · 225 unmodified lines
911913 bool reset = true;
912914 char *if_name;
913915 unsigned long intv;
916+ u16 session;
914917
915918 *dupl_addr = false;
916919 *respond = false;
@@ -997,9 +1000,10 @@ void tipc_node_check_dest(struct net *net, u32 addr, · 80 unmodified lines
9971000 goto exit;
9981001
9991002 if_name = strchr(b->name, ':') + 1;
1003+ get_random_bytes(&session, sizeof(u16));
10001004 if (!tipc_link_create(net, if_name, b->identity, b->tolerance,
10011005 b->net_plane, b->mtu, b->priority,
1002− b->window, mod(tipc_net(net)->random),
1006+ b->window, session,
10031007 tipc_own_addr(net), addr, peer_id,
10041008 n->capabilities,
10051009 tipc_bc_sndlink(n->net), n->bc_entry.link,
@@ -1615,6 +1619,14 @@ static bool tipc_node_check_state(struct tipc_node *n, struct sk_buff *skb, · 609 unmodified lines
16151619 tipc_skb_queue_splice_tail_init(tipc_link_inputq(pl),
16161620 tipc_link_inputq(l));
16171621 }
1622+ /* If parallel link was already down, and this happened before
1623+ * the tunnel link came up, FAILOVER was never sent. Ensure that
1624+ * FAILOVER is sent to get peer out of NODE_FAILINGOVER state.
1625+ */
1626+ if (n->state != NODE_FAILINGOVER && !n->failover_sent) {
1627+ tipc_link_create_dummy_tnl_msg(l, xmitq);
1628+ n->failover_sent = true;
1629+ }
16181630 /* If pkts arrive out of order, use lowest calculated syncpt */
16191631 if (less(syncpt, n->sync_point))
16201632 n->sync_point = syncpt;
net/tipc/socket.c+3−1
@@ -1419,8 +1419,10 @@ static int __tipc_sendstream(struct socket *sock, struct msghdr *m, size_t dlen) · 1418 unmodified lines
14191419 /* Handle implicit connection setup */
14201420 if (unlikely(dest)) {
14211421 rc = __tipc_sendmsg(sock, m, dlen);
1422− if (dlen && (dlen == rc))
1422+ if (dlen && dlen == rc) {
1423+ tsk->peer_caps = tipc_node_get_capabilities(net, dnode);
14231424 tsk->snt_unacked = tsk_inc(tsk, dlen + msg_hdr_sz(hdr));
1425+ }
14241426 return rc;
14251427 }
14261428
net/wireless/nl80211.c+15−5
@@ -3756,6 +3756,7 @@ static bool ht_rateset_to_mask(struct ieee80211_supported_band *sband, · 3755 unmodified lines
37563756 return false;
37573757
37583758 /* check availability */
3759+ ridx = array_index_nospec(ridx, IEEE80211_HT_MCS_MASK_LEN);
37593760 if (sband->ht_cap.mcs.rx_mask[ridx] & rbit)
37603761 mcs[ridx] |= rbit;
37613762 else
@@ -10230,7 +10231,7 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev, · 6468 unmodified lines
1023010231 struct wireless_dev *wdev = dev->ieee80211_ptr;
1023110232 s32 last, low, high;
1023210233 u32 hyst;
10233− int i, n;
10234+ int i, n, low_index;
1023410235 int err;
1023510236
1023610237 /* RSSI reporting disabled? */
@@ -10267,10 +10268,19 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev, · 30 unmodified lines
1026710268 if (last < wdev->cqm_config->rssi_thresholds[i])
1026810269 break;
1026910270
10270− low = i > 0 ?
10271− (wdev->cqm_config->rssi_thresholds[i - 1] - hyst) : S32_MIN;
10272− high = i < n ?
10273− (wdev->cqm_config->rssi_thresholds[i] + hyst - 1) : S32_MAX;
10271+ low_index = i - 1;
10272+ if (low_index >= 0) {
10273+ low_index = array_index_nospec(low_index, n);
10274+ low = wdev->cqm_config->rssi_thresholds[low_index] - hyst;
10275+ } else {
10276+ low = S32_MIN;
10277+ }
10278+ if (i < n) {
10279+ i = array_index_nospec(i, n);
10280+ high = wdev->cqm_config->rssi_thresholds[i] + hyst - 1;
10281+ } else {
10282+ high = S32_MAX;
10283+ }
1027410284
1027510285 return rdev_set_cqm_rssi_range_config(rdev, dev, low, high);
1027610286 }
net/wireless/reg.c+5−3
@@ -2661,11 +2661,12 @@ static void reg_process_hint(struct regulatory_request *reg_request) · 2660 unmodified lines
26612661 {
26622662 struct wiphy *wiphy = NULL;
26632663 enum reg_request_treatment treatment;
2664+ enum nl80211_reg_initiator initiator = reg_request->initiator;
26642665
26652666 if (reg_request->wiphy_idx != WIPHY_IDX_INVALID)
26662667 wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx);
26672668
2668− switch (reg_request->initiator) {
2669+ switch (initiator) {
26692670 case NL80211_REGDOM_SET_BY_CORE:
26702671 treatment = reg_process_hint_core(reg_request);
26712672 break;
@@ -2683,7 +2684,7 @@ static void reg_process_hint(struct regulatory_request *reg_request) · 11 unmodified lines
26832684 treatment = reg_process_hint_country_ie(wiphy, reg_request);
26842685 break;
26852686 default:
2686− WARN(1, "invalid initiator %d\n", reg_request->initiator);
2687+ WARN(1, "invalid initiator %d\n", initiator);
26872688 goto out_free;
26882689 }
26892690
@@ -2698,7 +2699,7 @@ static void reg_process_hint(struct regulatory_request *reg_request) · 8 unmodified lines
26982699 */
26992700 if (treatment == REG_REQ_ALREADY_SET && wiphy &&
27002701 wiphy->regulatory_flags & REGULATORY_STRICT_REG) {
2701− wiphy_update_regulatory(wiphy, reg_request->initiator);
2702+ wiphy_update_regulatory(wiphy, initiator);
27022703 wiphy_all_share_dfs_chan_state(wiphy);
27032704 reg_check_channels();
27042705 }
@@ -2867,6 +2868,7 @@ static int regulatory_hint_core(const char *alpha2) · 162 unmodified lines
28672868 request->alpha2[0] = alpha2[0];
28682869 request->alpha2[1] = alpha2[1];
28692870 request->initiator = NL80211_REGDOM_SET_BY_CORE;
2871+ request->wiphy_idx = WIPHY_IDX_INVALID;
28702872
28712873 queue_regulatory_request(request);
28722874
net/wireless/scan.c+49−9
@@ -1058,13 +1058,23 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, · 1057 unmodified lines
10581058 return NULL;
10591059 }
10601060
1061+/*
1062+ * Update RX channel information based on the available frame payload
1063+ * information. This is mainly for the 2.4 GHz band where frames can be received
1064+ * from neighboring channels and the Beacon frames use the DSSS Parameter Set
1065+ * element to indicate the current (transmitting) channel, but this might also
1066+ * be needed on other bands if RX frequency does not match with the actual
1067+ * operating channel of a BSS.
1068+ */
10611069 static struct ieee80211_channel *
10621070 cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen,
1063− struct ieee80211_channel *channel)
1071+ struct ieee80211_channel *channel,
1072+ enum nl80211_bss_scan_width scan_width)
10641073 {
10651074 const u8 *tmp;
10661075 u32 freq;
10671076 int channel_number = -1;
1077+ struct ieee80211_channel *alt_channel;
10681078
10691079 tmp = cfg80211_find_ie(WLAN_EID_DS_PARAMS, ie, ielen);
10701080 if (tmp && tmp[1] == 1) {
@@ -1078,16 +1088,45 @@ cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, · 7 unmodified lines
10781088 }
10791089 }
10801090
1081− if (channel_number < 0)
1091+ if (channel_number < 0) {
1092+ /* No channel information in frame payload */
10821093 return channel;
1094+ }
10831095
10841096 freq = ieee80211_channel_to_frequency(channel_number, channel->band);
1085− channel = ieee80211_get_channel(wiphy, freq);
1086− if (!channel)
1087− return NULL;
1088− if (channel->flags & IEEE80211_CHAN_DISABLED)
1097+ alt_channel = ieee80211_get_channel(wiphy, freq);
1098+ if (!alt_channel) {
1099+ if (channel->band == NL80211_BAND_2GHZ) {
1100+ /*
1101+ * Better not allow unexpected channels when that could
1102+ * be going beyond the 1-11 range (e.g., discovering
1103+ * BSS on channel 12 when radio is configured for
1104+ * channel 11.
1105+ */
1106+ return NULL;
1107+ }
1108+
1109+ /* No match for the payload channel number - ignore it */
1110+ return channel;
1111+ }
1112+
1113+ if (scan_width == NL80211_BSS_CHAN_WIDTH_10 ||
1114+ scan_width == NL80211_BSS_CHAN_WIDTH_5) {
1115+ /*
1116+ * Ignore channel number in 5 and 10 MHz channels where there
1117+ * may not be an n:1 or 1:n mapping between frequencies and
1118+ * channel numbers.
1119+ */
1120+ return channel;
1121+ }
1122+
1123+ /*
1124+ * Use the channel determined through the payload channel number
1125+ * instead of the RX channel reported by the driver.
1126+ */
1127+ if (alt_channel->flags & IEEE80211_CHAN_DISABLED)
10891128 return NULL;
1090− return channel;
1129+ return alt_channel;
10911130 }
10921131
10931132 /* Returned bss is reference counted and must be cleaned up appropriately. */
@@ -1112,7 +1151,8 @@ cfg80211_inform_bss_data(struct wiphy *wiphy, · 18 unmodified lines
11121151 (data->signal < 0 || data->signal > 100)))
11131152 return NULL;
11141153
1115− channel = cfg80211_get_bss_channel(wiphy, ie, ielen, data->chan);
1154+ channel = cfg80211_get_bss_channel(wiphy, ie, ielen, data->chan,
1155+ data->scan_width);
11161156 if (!channel)
11171157 return NULL;
11181158
@@ -1210,7 +1250,7 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy, · 91 unmodified lines
12101250 return NULL;
12111251
12121252 channel = cfg80211_get_bss_channel(wiphy, mgmt->u.beacon.variable,
1213− ielen, data->chan);
1253+ ielen, data->chan, data->scan_width);
12141254 if (!channel)
12151255 return NULL;
12161256
net/wireless/wext-compat.c+10−4
@@ -1278,12 +1278,16 @@ static int cfg80211_wext_giwrate(struct net_device *dev, · 1277 unmodified lines
12781278 if (err)
12791279 return err;
12801280
1281− if (!(sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE)))
1282− return -EOPNOTSUPP;
1281+ if (!(sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE))) {
1282+ err = -EOPNOTSUPP;
1283+ goto free;
1284+ }
12831285
12841286 rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate);
12851287
1286− return 0;
1288+free:
1289+ cfg80211_sinfo_release_content(&sinfo);
1290+ return err;
12871291 }
12881292
12891293 /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
@@ -1293,7 +1297,7 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev) · 3 unmodified lines
12931297 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
12941298 /* we are under RTNL - globally locked - so can use static structs */
12951299 static struct iw_statistics wstats;
1296− static struct station_info sinfo;
1300+ static struct station_info sinfo = {};
12971301 u8 bssid[ETH_ALEN];
12981302
12991303 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION)
@@ -1352,6 +1356,8 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev) · 52 unmodified lines
13521356 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_FAILED))
13531357 wstats.discard.retries = sinfo.tx_failed;
13541358
1359+ cfg80211_sinfo_release_content(&sinfo);
1360+
13551361 return &wstats;
13561362 }
13571363
net/xfrm/xfrm_input.c+1−0
@@ -458,6 +458,7 @@ resume: · 457 unmodified lines
458458 XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR);
459459 goto drop;
460460 }
461+ crypto_done = false;
461462 } while (!err);
462463
463464 err = xfrm_rcv_cb(skb, family, x->type->proto, 0);
net/xfrm/xfrm_output.c+4−0
@@ -100,6 +100,10 @@ static int xfrm_output_one(struct sk_buff *skb, int err) · 99 unmodified lines
100100 spin_unlock_bh(&x->lock);
101101
102102 skb_dst_force(skb);
103+ if (!skb_dst(skb)) {
104+ XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR);
105+ goto error_nolock;
106+ }
103107
104108 if (xfrm_offload(skb)) {
105109 x->type_offload->encap(x, skb);
net/xfrm/xfrm_policy.c+4−0
@@ -2491,6 +2491,10 @@ int __xfrm_route_forward(struct sk_buff *skb, unsigned short family) · 2490 unmodified lines
24912491 }
24922492
24932493 skb_dst_force(skb);
2494+ if (!skb_dst(skb)) {
2495+ XFRM_INC_STATS(net, LINUX_MIB_XFRMFWDHDRERROR);
2496+ return 0;
2497+ }
24942498
24952499 dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, XFRM_LOOKUP_QUEUE);
24962500 if (IS_ERR(dst)) {
net/xfrm/xfrm_user.c+15−0
@@ -151,10 +151,16 @@ static int verify_newsa_info(struct xfrm_usersa_info *p, · 150 unmodified lines
151151 err = -EINVAL;
152152 switch (p->family) {
153153 case AF_INET:
154+ if (p->sel.prefixlen_d > 32 || p->sel.prefixlen_s > 32)
155+ goto out;
156+
154157 break;
155158
156159 case AF_INET6:
157160 #if IS_ENABLED(CONFIG_IPV6)
161+ if (p->sel.prefixlen_d > 128 || p->sel.prefixlen_s > 128)
162+ goto out;
163+
158164 break;
159165 #else
160166 err = -EAFNOSUPPORT;
@@ -1396,10 +1402,16 @@ static int verify_newpolicy_info(struct xfrm_userpolicy_info *p) · 1235 unmodified lines
13961402
13971403 switch (p->sel.family) {
13981404 case AF_INET:
1405+ if (p->sel.prefixlen_d > 32 || p->sel.prefixlen_s > 32)
1406+ return -EINVAL;
1407+
13991408 break;
14001409
14011410 case AF_INET6:
14021411 #if IS_ENABLED(CONFIG_IPV6)
1412+ if (p->sel.prefixlen_d > 128 || p->sel.prefixlen_s > 128)
1413+ return -EINVAL;
1414+
14031415 break;
14041416 #else
14051417 return -EAFNOSUPPORT;
@@ -1480,6 +1492,9 @@ static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family) · 74 unmodified lines
14801492 (ut[i].family != prev_family))
14811493 return -EINVAL;
14821494
1495+ if (ut[i].mode >= XFRM_MODE_MAX)
1496+ return -EINVAL;
1497+
14831498 prev_family = ut[i].family;
14841499
14851500 switch (ut[i].family) {
sound/hda/hdac_i915.c+3−1
@@ -145,9 +145,11 @@ int snd_hdac_i915_init(struct hdac_bus *bus) · 144 unmodified lines
145145 if (!acomp->ops) {
146146 request_module("i915");
147147 /* 10s timeout */
148− wait_for_completion_timeout(&bind_complete, 10 * 1000);
148+ wait_for_completion_timeout(&bind_complete,
149+ msecs_to_jiffies(10 * 1000));
149150 }
150151 if (!acomp->ops) {
152+ dev_info(bus->dev, "couldn't bind with audio component\n");
151153 snd_hdac_acomp_exit(bus);
152154 return -ENODEV;
153155 }
sound/pci/hda/patch_realtek.c+1−0
@@ -6409,6 +6409,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 6408 unmodified lines
64096409 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
64106410 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
64116411 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
6412+ SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
64126413 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
64136414 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
64146415 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
tools/hv/hv_fcopy_daemon.c+1−0
@@ -234,6 +234,7 @@ int main(int argc, char *argv[]) · 233 unmodified lines
234234 break;
235235
236236 default:
237+ error = HV_E_FAIL;
237238 syslog(LOG_ERR, "Unknown operation: %d",
238239 buffer.hdr.operation);
239240
tools/kvm/kvm_stat/kvm_stat+1−1
@@ -1325,7 +1325,7 @@ class Tui(object): · 1324 unmodified lines
13251325 msg = ''
13261326 while True:
13271327 self.screen.erase()
1328− self.screen.addstr(0, 0, 'Set update interval (defaults to %fs).' %
1328+ self.screen.addstr(0, 0, 'Set update interval (defaults to %.1fs).' %
13291329 DELAY_DEFAULT, curses.A_BOLD)
13301330 self.screen.addstr(4, 0, msg)
13311331 self.screen.addstr(2, 0, 'Change delay from %.1fs to ' %
tools/testing/selftests/rseq/param_test.c+10−9
@@ -56,15 +56,13 @@ unsigned int yield_mod_cnt, nr_abort; · 55 unmodified lines
5656 printf(fmt, ## __VA_ARGS__); \
5757 } while (0)
5858
59−#if defined(__x86_64__) || defined(__i386__)
59+#ifdef __i386__
6060
6161 #define INJECT_ASM_REG "eax"
6262
6363 #define RSEQ_INJECT_CLOBBER \
6464 , INJECT_ASM_REG
6565
66−#ifdef __i386__
67−
6866 #define RSEQ_INJECT_ASM(n) \
6967 "mov asm_loop_cnt_" #n ", %%" INJECT_ASM_REG "\n\t" \
7068 "test %%" INJECT_ASM_REG ",%%" INJECT_ASM_REG "\n\t" \
@@ -76,9 +74,16 @@ unsigned int yield_mod_cnt, nr_abort; · 5 unmodified lines
7674
7775 #elif defined(__x86_64__)
7876
77+#define INJECT_ASM_REG_P "rax"
78+#define INJECT_ASM_REG "eax"
79+
80+#define RSEQ_INJECT_CLOBBER \
81+ , INJECT_ASM_REG_P \
82+ , INJECT_ASM_REG
83+
7984 #define RSEQ_INJECT_ASM(n) \
80− "lea asm_loop_cnt_" #n "(%%rip), %%" INJECT_ASM_REG "\n\t" \
81− "mov (%%" INJECT_ASM_REG "), %%" INJECT_ASM_REG "\n\t" \
85+ "lea asm_loop_cnt_" #n "(%%rip), %%" INJECT_ASM_REG_P "\n\t" \
86+ "mov (%%" INJECT_ASM_REG_P "), %%" INJECT_ASM_REG "\n\t" \
8287 "test %%" INJECT_ASM_REG ",%%" INJECT_ASM_REG "\n\t" \
8388 "jz 333f\n\t" \
8489 "222:\n\t" \
@@ -86,10 +91,6 @@ unsigned int yield_mod_cnt, nr_abort; · 1 unmodified line
8691 "jnz 222b\n\t" \
8792 "333:\n\t"
8893
89−#else
90−#error "Unsupported architecture"
91−#endif
92−
9394 #elif defined(__s390__)
9495
9596 #define RSEQ_INJECT_INPUT \
tools/testing/selftests/x86/test_vdso.c+172−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <errno.h>
1818 #include <sched.h>
1919 #include <stdbool.h>
20+#include <limits.h>
2021
2122 #ifndef SYS_getcpu
2223 # ifdef __x86_64__
@@ -31,6 +32,14 @@ · 8 unmodified lines
3132
3233 int nerrs = 0;
3334
35+typedef int (*vgettime_t)(clockid_t, struct timespec *);
36+
37+vgettime_t vdso_clock_gettime;
38+
39+typedef long (*vgtod_t)(struct timeval *tv, struct timezone *tz);
40+
41+vgtod_t vdso_gettimeofday;
42+
3443 typedef long (*getcpu_t)(unsigned *, unsigned *, void *);
3544
3645 getcpu_t vgetcpu;
@@ -95,6 +104,15 @@ static void fill_function_pointers() · 58 unmodified lines
95104 printf("Warning: failed to find getcpu in vDSO\n");
96105
97106 vgetcpu = (getcpu_t) vsyscall_getcpu();
107+
108+ vdso_clock_gettime = (vgettime_t)dlsym(vdso, "__vdso_clock_gettime");
109+ if (!vdso_clock_gettime)
110+ printf("Warning: failed to find clock_gettime in vDSO\n");
111+
112+ vdso_gettimeofday = (vgtod_t)dlsym(vdso, "__vdso_gettimeofday");
113+ if (!vdso_gettimeofday)
114+ printf("Warning: failed to find gettimeofday in vDSO\n");
115+
98116 }
99117
100118 static long sys_getcpu(unsigned * cpu, unsigned * node,
@@ -103,6 +121,16 @@ static long sys_getcpu(unsigned * cpu, unsigned * node, · 2 unmodified lines
103121 return syscall(__NR_getcpu, cpu, node, cache);
104122 }
105123
124+static inline int sys_clock_gettime(clockid_t id, struct timespec *ts)
125+{
126+ return syscall(__NR_clock_gettime, id, ts);
127+}
128+
129+static inline int sys_gettimeofday(struct timeval *tv, struct timezone *tz)
130+{
131+ return syscall(__NR_gettimeofday, tv, tz);
132+}
133+
106134 static void test_getcpu(void)
107135 {
108136 printf("[RUN]\tTesting getcpu...\n");
@@ -155,10 +183,154 @@ static void test_getcpu(void) · 46 unmodified lines
155183 }
156184 }
157185
186+static bool ts_leq(const struct timespec *a, const struct timespec *b)
187+{
188+ if (a->tv_sec != b->tv_sec)
189+ return a->tv_sec < b->tv_sec;
190+ else
191+ return a->tv_nsec <= b->tv_nsec;
192+}
193+
194+static bool tv_leq(const struct timeval *a, const struct timeval *b)
195+{
196+ if (a->tv_sec != b->tv_sec)
197+ return a->tv_sec < b->tv_sec;
198+ else
199+ return a->tv_usec <= b->tv_usec;
200+}
201+
202+static char const * const clocknames[] = {
203+ [0] = "CLOCK_REALTIME",
204+ [1] = "CLOCK_MONOTONIC",
205+ [2] = "CLOCK_PROCESS_CPUTIME_ID",
206+ [3] = "CLOCK_THREAD_CPUTIME_ID",
207+ [4] = "CLOCK_MONOTONIC_RAW",
208+ [5] = "CLOCK_REALTIME_COARSE",
209+ [6] = "CLOCK_MONOTONIC_COARSE",
210+ [7] = "CLOCK_BOOTTIME",
211+ [8] = "CLOCK_REALTIME_ALARM",
212+ [9] = "CLOCK_BOOTTIME_ALARM",
213+ [10] = "CLOCK_SGI_CYCLE",
214+ [11] = "CLOCK_TAI",
215+};
216+
217+static void test_one_clock_gettime(int clock, const char *name)
218+{
219+ struct timespec start, vdso, end;
220+ int vdso_ret, end_ret;
221+
222+ printf("[RUN]\tTesting clock_gettime for clock %s (%d)...\n", name, clock);
223+
224+ if (sys_clock_gettime(clock, &start) < 0) {
225+ if (errno == EINVAL) {
226+ vdso_ret = vdso_clock_gettime(clock, &vdso);
227+ if (vdso_ret == -EINVAL) {
228+ printf("[OK]\tNo such clock.\n");
229+ } else {
230+ printf("[FAIL]\tNo such clock, but __vdso_clock_gettime returned %d\n", vdso_ret);
231+ nerrs++;
232+ }
233+ } else {
234+ printf("[WARN]\t clock_gettime(%d) syscall returned error %d\n", clock, errno);
235+ }
236+ return;
237+ }
238+
239+ vdso_ret = vdso_clock_gettime(clock, &vdso);
240+ end_ret = sys_clock_gettime(clock, &end);
241+
242+ if (vdso_ret != 0 || end_ret != 0) {
243+ printf("[FAIL]\tvDSO returned %d, syscall errno=%d\n",
244+ vdso_ret, errno);
245+ nerrs++;
246+ return;
247+ }
248+
249+ printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n",
250+ (unsigned long long)start.tv_sec, start.tv_nsec,
251+ (unsigned long long)vdso.tv_sec, vdso.tv_nsec,
252+ (unsigned long long)end.tv_sec, end.tv_nsec);
253+
254+ if (!ts_leq(&start, &vdso) || !ts_leq(&vdso, &end)) {
255+ printf("[FAIL]\tTimes are out of sequence\n");
256+ nerrs++;
257+ }
258+}
259+
260+static void test_clock_gettime(void)
261+{
262+ for (int clock = 0; clock < sizeof(clocknames) / sizeof(clocknames[0]);
263+ clock++) {
264+ test_one_clock_gettime(clock, clocknames[clock]);
265+ }
266+
267+ /* Also test some invalid clock ids */
268+ test_one_clock_gettime(-1, "invalid");
269+ test_one_clock_gettime(INT_MIN, "invalid");
270+ test_one_clock_gettime(INT_MAX, "invalid");
271+}
272+
273+static void test_gettimeofday(void)
274+{
275+ struct timeval start, vdso, end;
276+ struct timezone sys_tz, vdso_tz;
277+ int vdso_ret, end_ret;
278+
279+ if (!vdso_gettimeofday)
280+ return;
281+
282+ printf("[RUN]\tTesting gettimeofday...\n");
283+
284+ if (sys_gettimeofday(&start, &sys_tz) < 0) {
285+ printf("[FAIL]\tsys_gettimeofday failed (%d)\n", errno);
286+ nerrs++;
287+ return;
288+ }
289+
290+ vdso_ret = vdso_gettimeofday(&vdso, &vdso_tz);
291+ end_ret = sys_gettimeofday(&end, NULL);
292+
293+ if (vdso_ret != 0 || end_ret != 0) {
294+ printf("[FAIL]\tvDSO returned %d, syscall errno=%d\n",
295+ vdso_ret, errno);
296+ nerrs++;
297+ return;
298+ }
299+
300+ printf("\t%llu.%06ld %llu.%06ld %llu.%06ld\n",
301+ (unsigned long long)start.tv_sec, start.tv_usec,
302+ (unsigned long long)vdso.tv_sec, vdso.tv_usec,
303+ (unsigned long long)end.tv_sec, end.tv_usec);
304+
305+ if (!tv_leq(&start, &vdso) || !tv_leq(&vdso, &end)) {
306+ printf("[FAIL]\tTimes are out of sequence\n");
307+ nerrs++;
308+ }
309+
310+ if (sys_tz.tz_minuteswest == vdso_tz.tz_minuteswest &&
311+ sys_tz.tz_dsttime == vdso_tz.tz_dsttime) {
312+ printf("[OK]\ttimezones match: minuteswest=%d, dsttime=%d\n",
313+ sys_tz.tz_minuteswest, sys_tz.tz_dsttime);
314+ } else {
315+ printf("[FAIL]\ttimezones do not match\n");
316+ nerrs++;
317+ }
318+
319+ /* And make sure that passing NULL for tz doesn't crash. */
320+ vdso_gettimeofday(&vdso, NULL);
321+}
322+
158323 int main(int argc, char **argv)
159324 {
160325 fill_function_pointers();
161326
327+ test_clock_gettime();
328+ test_gettimeofday();
329+
330+ /*
331+ * Test getcpu() last so that, if something goes wrong setting affinity,
332+ * we still run the other tests.
333+ */
162334 test_getcpu();
163335
164336 return nerrs ? 1 : 0;