History

Merge remote-tracking branch 'djwong/ocfs2-vfs-reflink-6' into for-linus

Al Viro committed 9 years ago

Commit 3c55d6b2 parents 4da00fd 29ac8e8208 files · +2175 −903Browse files

Unified · Split

208 files
  1. CREDITS +4 −4
  2. Documentation/devicetree/bindings/net/ethernet.txt +20 −4
  3. Documentation/networking/nf_conntrack-sysctl.txt +5 −2
  4. MAINTAINERS +4 −9
  5. Makefile +9 −4
  6. arch/arc/include/asm/delay.h +5 −4
  7. arch/arc/include/asm/pgtable.h +1 −1
  8. arch/arc/mm/cache.c +1 −1
  9. arch/arm/boot/dts/Makefile +1 −1
  10. arch/arm/boot/dts/stih407-family.dtsi +16 −0
  11. arch/arm/boot/dts/sun5i-gr8-evb.dts +1 −1
  12. arch/arm/boot/dts/sun5i-gr8.dtsi +0 −0
  13. arch/arm64/boot/dts/arm/juno-base.dtsi +1 −1
  14. arch/arm64/boot/dts/arm/juno-r1.dts +1 −1
  15. arch/arm64/boot/dts/arm/juno-r2.dts +1 −1
  16. arch/arm64/boot/dts/arm/juno.dts +1 −1
  17. drivers/ata/ahci.c +0 −7
  18. drivers/ata/libata-scsi.c +1 −1
  19. drivers/block/zram/zram_drv.c +2 −1
  20. drivers/clk/bcm/Kconfig +1 −1
  21. drivers/clk/sunxi-ng/ccu-sun6i-a31.c +1 −1
  22. drivers/clk/sunxi-ng/ccu-sun8i-a33.c +1 −1
  23. drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +9 −2
  24. drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c +4 −1
  25. drivers/gpu/drm/arm/hdlcd_drv.c +1 −1
  26. drivers/gpu/drm/drm_ioctl.c +6 −4
  27. drivers/gpu/drm/i915/i915_gem.c +3 −2
  28. drivers/gpu/drm/i915/intel_display.c +2 −1
  29. drivers/gpu/drm/radeon/radeon_atpx_handler.c +9 −2
  30. drivers/i2c/busses/i2c-octeon-core.c +1 −3
  31. drivers/i2c/busses/i2c-octeon-core.h +11 −16
  32. drivers/input/mouse/psmouse-base.c +0 −4
  33. drivers/net/can/usb/peak_usb/pcan_ucan.h +29 −8
  34. drivers/net/can/usb/peak_usb/pcan_usb_core.c +2 −0
  35. drivers/net/can/usb/peak_usb/pcan_usb_core.h +2 −0
  36. drivers/net/can/usb/peak_usb/pcan_usb_fd.c +88 −16
  37. drivers/net/ethernet/altera/altera_tse_main.c +8 −13
  38. drivers/net/ethernet/amd/xgbe/xgbe-main.c +2 −2
  39. drivers/net/ethernet/aurora/nb8800.c +7 −2
  40. drivers/net/ethernet/broadcom/bcmsysport.c +12 −5
  41. drivers/net/ethernet/broadcom/genet/bcmgenet.c +5 −3
  42. drivers/net/ethernet/broadcom/genet/bcmmii.c +9 −1
  43. drivers/net/ethernet/cadence/macb.c +3 −2
  44. drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h +1 −0
  45. drivers/net/ethernet/freescale/fec.h +2 −0
  46. drivers/net/ethernet/freescale/fec_main.c +24 −4
  47. drivers/net/ethernet/freescale/fman/fman_memac.c +3 −0
  48. drivers/net/ethernet/freescale/fman/mac.c +2 −0
  49. drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +6 −1
  50. drivers/net/ethernet/freescale/gianfar.c +8 −0
  51. drivers/net/ethernet/freescale/ucc_geth.c +16 −7
  52. drivers/net/ethernet/intel/igb/igb_main.c +6 −2
  53. drivers/net/ethernet/intel/igbvf/netdev.c +6 −2
  54. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +6 −2
  55. drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +6 −2
  56. drivers/net/ethernet/marvell/mvneta.c +5 −0
  57. drivers/net/ethernet/mediatek/mtk_eth_soc.c +4 −0
  58. drivers/net/ethernet/mellanox/mlx4/en_netdev.c +2 −15
  59. drivers/net/ethernet/mellanox/mlx4/main.c +1 −4
  60. drivers/net/ethernet/mellanox/mlx4/mcg.c +6 −1
  61. drivers/net/ethernet/qualcomm/emac/emac-phy.c +1 −0
  62. drivers/net/ethernet/qualcomm/emac/emac.c +4 −0
  63. drivers/net/ethernet/renesas/ravb_main.c +14 −5
  64. drivers/net/ethernet/renesas/sh_eth.c +1 −1
  65. drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c +15 −2
  66. drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +19 −6
  67. drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c +14 −3
  68. drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +18 −5
  69. drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +24 −8
  70. drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +17 −4
  71. drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +26 −13
  72. drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +18 −5
  73. drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +14 −5
  74. drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c +19 −7
  75. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0 −1
  76. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +29 −4
  77. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +2 −0
  78. drivers/net/ethernet/synopsys/dwc_eth_qos.c +13 −7
  79. drivers/net/ethernet/ti/cpsw.c +6 −14
  80. drivers/net/ethernet/ti/davinci_emac.c +9 −1
  81. drivers/net/geneve.c +4 −10
  82. drivers/net/ipvlan/ipvlan_main.c +12 −5
  83. drivers/net/irda/w83977af_ir.c +3 −1
  84. drivers/net/macvtap.c +12 −7
  85. drivers/net/phy/realtek.c +12 −8
  86. drivers/net/tun.c +4 −6
  87. drivers/net/usb/asix_devices.c +3 −3
  88. drivers/net/usb/cdc_ether.c +31 −7
  89. drivers/net/usb/qmi_wwan.c +1 −0
  90. drivers/net/vxlan.c +7 −3
  91. drivers/net/wireless/marvell/mwifiex/cfg80211.c +7 −6
  92. drivers/of/of_mdio.c +15 −0
  93. drivers/pci/host/pcie-designware-plat.c +1 −1
  94. drivers/pci/pcie/aer/aer_inject.c +0 −14
  95. drivers/pci/probe.c +27 −1
  96. drivers/pwm/pwm-meson.c +1 −0
  97. drivers/pwm/sysfs.c +2 −0
  98. drivers/scsi/be2iscsi/be_mgmt.c +1 −1
  99. drivers/scsi/hpsa.c +11 −5
  100. drivers/scsi/hpsa.h +2 −0
  101. drivers/scsi/libfc/fc_lport.c +1 −1
  102. drivers/scsi/mpt3sas/mpt3sas_scsih.c +8 −5
  103. drivers/scsi/mvsas/mv_sas.c +3 −1
  104. drivers/scsi/qlogicpti.h +2 −2
  105. fs/btrfs/ctree.h +0 −3
  106. fs/btrfs/file.c +0 −1
  107. fs/btrfs/ioctl.c +0 −12
  108. fs/cifs/cifsencrypt.c +8 −3
  109. fs/cifs/cifssmb.c +2 −2
  110. fs/cifs/connect.c +18 −7
  111. fs/isofs/rock.c +2 −2
  112. fs/ocfs2/alloc.c +3 −4
  113. fs/ocfs2/aops.c +20 −11
  114. fs/ocfs2/file.c +35 −7
  115. fs/ocfs2/file.h +3 −0
  116. fs/ocfs2/inode.h +6 −0
  117. fs/ocfs2/move_extents.c +2 −8
  118. fs/ocfs2/refcounttree.c +451 −13
  119. fs/ocfs2/refcounttree.h +7 −0
  120. fs/ocfs2/xattr.c +2 −2
  121. fs/overlayfs/super.c +3 −3
  122. fs/read_write.c +226 −5
  123. fs/xfs/xfs_file.c +0 −19
  124. fs/xfs/xfs_reflink.c +9 −204
  125. include/asm-generic/export.h +1 −0
  126. include/linux/compiler-gcc.h +3 −1
  127. include/linux/fs.h +6 −0
  128. include/linux/mlx4/device.h +0 −1
  129. include/linux/of_mdio.h +4 −0
  130. include/linux/pagemap.h +15 −6
  131. include/linux/pci.h +14 −0
  132. include/net/ipv6.h +2 −0
  133. include/net/netfilter/nf_conntrack.h +3 −3
  134. include/net/netfilter/nf_tables.h +1 −1
  135. include/uapi/linux/input-event-codes.h +1 −1
  136. include/uapi/linux/tc_act/Kbuild +1 −0
  137. init/Kconfig +0 −1
  138. kernel/bpf/verifier.c +8 −2
  139. kernel/module.c +3 −2
  140. lib/debugobjects.c +8 −0
  141. lib/test_kasan.c +29 −0
  142. mm/huge_memory.c +2 −2
  143. mm/kasan/kasan.c +19 −0
  144. mm/kasan/kasan.h +4 −0
  145. mm/kasan/report.c +3 −0
  146. mm/khugepaged.c +2 −0
  147. mm/mlock.c +5 −2
  148. mm/mremap.c +8 −4
  149. mm/truncate.c +4 −4
  150. mm/vmscan.c +2 −0
  151. mm/workingset.c +1 −1
  152. net/core/flow.c +2 −4
  153. net/core/rtnetlink.c +2 −2
  154. net/core/sock.c +2 −2
  155. net/dccp/ipv4.c +7 −5
  156. net/dsa/dsa.c +4 −9
  157. net/dsa/dsa2.c +3 −1
  158. net/dsa/slave.c +16 −3
  159. net/ipv4/Kconfig +1 −0
  160. net/ipv4/af_inet.c +1 −1
  161. net/ipv4/esp4.c +1 −1
  162. net/ipv4/ip_output.c +2 −0
  163. net/ipv4/netfilter.c +4 −1
  164. net/ipv4/netfilter/arp_tables.c +2 −2
  165. net/ipv6/datagram.c +3 −1
  166. net/ipv6/esp6.c +1 −1
  167. net/ipv6/icmp.c +4 −2
  168. net/ipv6/ip6_offload.c +1 −1
  169. net/ipv6/ip6_tunnel.c +0 −1
  170. net/ipv6/ip6_vti.c +31 −0
  171. net/ipv6/netfilter/nf_conntrack_reasm.c +2 −2
  172. net/ipv6/netfilter/nf_defrag_ipv6_hooks.c +1 −1
  173. net/ipv6/netfilter/nf_reject_ipv6.c +1 −0
  174. net/ipv6/output_core.c +2 −0
  175. net/l2tp/l2tp_ip.c +34 −29
  176. net/l2tp/l2tp_ip6.c +42 −37
  177. net/netfilter/nf_nat_core.c +30 −19
  178. net/netfilter/nf_tables_api.c +9 −5
  179. net/netfilter/nft_hash.c +5 −2
  180. net/netfilter/nft_range.c +6 −0
  181. net/netlink/af_netlink.c +23 −4
  182. net/netlink/af_netlink.h +2 −0
  183. net/openvswitch/conntrack.c +4 −1
  184. net/packet/af_packet.c +12 −6
  185. net/rds/tcp.c +2 −0
  186. net/sched/act_pedit.c +20 −4
  187. net/sched/cls_basic.c +0 −4
  188. net/sched/cls_bpf.c +0 −4
  189. net/sched/cls_cgroup.c +3 −4
  190. net/sched/cls_flow.c +0 −1
  191. net/sched/cls_flower.c +32 −9
  192. net/sched/cls_matchall.c +0 −1
  193. net/sched/cls_rsvp.h +2 −1
  194. net/sched/cls_tcindex.c +0 −1
  195. net/tipc/bearer.c +9 −2
  196. net/tipc/bearer.h +13 −0
  197. net/tipc/link.c +19 −16
  198. net/tipc/udp_media.c +5 −0
  199. net/xfrm/xfrm_policy.c +6 −4
  200. net/xfrm/xfrm_user.c +1 −1
  201. samples/bpf/bpf_helpers.h +1 −1
  202. samples/bpf/sampleip_kern.c +1 −1
  203. samples/bpf/trace_event_kern.c +1 −1
  204. scripts/kconfig/Makefile +2 −0
  205. sound/sparc/dbri.c +16 −10
  206. virt/kvm/arm/vgic/vgic-v2.c +4 −2
  207. virt/kvm/arm/vgic/vgic-v3.c +4 −2
  208. virt/kvm/kvm_main.c +1 −1
CREDITS+4−4
@@ -9,7 +9,7 @@ · 8 unmodified lines
9 Linus9 Linus
10----------10----------
11 11
12M: Matt Mackal12N: Matt Mackal
13E: mpm@selenic.com13E: mpm@selenic.com
14D: SLOB slab allocator14D: SLOB slab allocator
15 15
@@ -1910,7 +1910,7 @@ S: Ra'annana, Israel · 1894 unmodified lines
1910 1910
1911N: Andi Kleen1911N: Andi Kleen
1912E: andi@firstfloor.org1912E: andi@firstfloor.org
1913U: http://www.halobates.de1913W: http://www.halobates.de
1914D: network, x86, NUMA, various hacks1914D: network, x86, NUMA, various hacks
1915S: Schwalbenstr. 961915S: Schwalbenstr. 96
1916S: 85551 Ottobrunn1916S: 85551 Ottobrunn
@@ -2089,8 +2089,8 @@ D: ST Microelectronics SPEAr13xx PCI host bridge driver · 172 unmodified lines
2089D: Synopsys Designware PCI host bridge driver2089D: Synopsys Designware PCI host bridge driver
2090 2090
2091N: Gabor Kuti2091N: Gabor Kuti
2092M: seasons@falcon.sch.bme.hu2092E: seasons@falcon.sch.bme.hu
2093M: seasons@makosteszta.sote.hu2093E: seasons@makosteszta.sote.hu
2094D: Original author of software suspend2094D: Original author of software suspend
2095 2095
2096N: Jaroslav Kysela2096N: Jaroslav Kysela
Documentation/devicetree/bindings/net/ethernet.txt+20−4
@@ -9,10 +9,26 @@ The following properties are common to the Ethernet controllers: · 8 unmodified lines
9- max-speed: number, specifies maximum speed in Mbit/s supported by the device;9- max-speed: number, specifies maximum speed in Mbit/s supported by the device;
10- max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than10- max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than
11 the maximum frame size (there's contradiction in ePAPR).11 the maximum frame size (there's contradiction in ePAPR).
12- phy-mode: string, operation mode of the PHY interface; supported values are12- phy-mode: string, operation mode of the PHY interface. This is now a de-facto
13 "mii", "gmii", "sgmii", "qsgmii", "tbi", "rev-mii", "rmii", "rgmii", "rgmii-id",13 standard property; supported values are:
14 "rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii", "trgmii"; this is now a14 * "mii"
15 de-facto standard property;15 * "gmii"
16 * "sgmii"
17 * "qsgmii"
18 * "tbi"
19 * "rev-mii"
20 * "rmii"
21 * "rgmii" (RX and TX delays are added by the MAC when required)
22 * "rgmii-id" (RGMII with internal RX and TX delays provided by the PHY, the
23 MAC should not add the RX or TX delays in this case)
24 * "rgmii-rxid" (RGMII with internal RX delay provided by the PHY, the MAC
25 should not add an RX delay in this case)
26 * "rgmii-txid" (RGMII with internal TX delay provided by the PHY, the MAC
27 should not add an TX delay in this case)
28 * "rtbi"
29 * "smii"
30 * "xgmii"
31 * "trgmii"
16- phy-connection-type: the same as "phy-mode" property but described in ePAPR;32- phy-connection-type: the same as "phy-mode" property but described in ePAPR;
17- phy-handle: phandle, specifies a reference to a node representing a PHY33- phy-handle: phandle, specifies a reference to a node representing a PHY
18 device; this property is described in ePAPR and so preferred;34 device; this property is described in ePAPR and so preferred;
Documentation/networking/nf_conntrack-sysctl.txt+5−2
@@ -62,10 +62,13 @@ nf_conntrack_generic_timeout - INTEGER (seconds) · 61 unmodified lines
62 protocols.62 protocols.
63 63
64nf_conntrack_helper - BOOLEAN64nf_conntrack_helper - BOOLEAN
65 0 - disabled65 0 - disabled (default)
66 not 0 - enabled (default)66 not 0 - enabled
67 67
68 Enable automatic conntrack helper assignment.68 Enable automatic conntrack helper assignment.
69 If disabled it is required to set up iptables rules to assign
70 helpers to connections. See the CT target description in the
71 iptables-extensions(8) man page for further information.
69 72
70nf_conntrack_icmp_timeout - INTEGER (seconds)73nf_conntrack_icmp_timeout - INTEGER (seconds)
71 default 3074 default 30
MAINTAINERS+4−9
@@ -9257,11 +9257,12 @@ S: Maintained · 9256 unmodified lines
9257F: drivers/pci/host/*layerscape*9257F: drivers/pci/host/*layerscape*
9258 9258
9259PCI DRIVER FOR IMX69259PCI DRIVER FOR IMX6
9260M: Richard Zhu <Richard.Zhu@freescale.com>9260M: Richard Zhu <hongxing.zhu@nxp.com>
9261M: Lucas Stach <l.stach@pengutronix.de>9261M: Lucas Stach <l.stach@pengutronix.de>
9262L: linux-pci@vger.kernel.org9262L: linux-pci@vger.kernel.org
9263L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)9263L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
9264S: Maintained9264S: Maintained
9265F: Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt
9265F: drivers/pci/host/*imx6*9266F: drivers/pci/host/*imx6*
9266 9267
9267PCI DRIVER FOR TI KEYSTONE9268PCI DRIVER FOR TI KEYSTONE
@@ -9320,17 +9321,11 @@ F: drivers/pci/host/pci-exynos.c · 52 unmodified lines
9320 9321
9321PCI DRIVER FOR SYNOPSIS DESIGNWARE9322PCI DRIVER FOR SYNOPSIS DESIGNWARE
9322M: Jingoo Han <jingoohan1@gmail.com>9323M: Jingoo Han <jingoohan1@gmail.com>
9323M: Pratyush Anand <pratyush.anand@gmail.com>9324M: Joao Pinto <Joao.Pinto@synopsys.com>
9324L: linux-pci@vger.kernel.org
9325S: Maintained
9326F: drivers/pci/host/*designware*
9327
9328PCI DRIVER FOR SYNOPSYS PROTOTYPING DEVICE
9329M: Jose Abreu <Jose.Abreu@synopsys.com>
9330L: linux-pci@vger.kernel.org9325L: linux-pci@vger.kernel.org
9331S: Maintained9326S: Maintained
9332F: Documentation/devicetree/bindings/pci/designware-pcie.txt9327F: Documentation/devicetree/bindings/pci/designware-pcie.txt
9333F: drivers/pci/host/pcie-designware-plat.c9328F: drivers/pci/host/*designware*
9334 9329
9335PCI DRIVER FOR GENERIC OF HOSTS9330PCI DRIVER FOR GENERIC OF HOSTS
9336M: Will Deacon <will.deacon@arm.com>9331M: Will Deacon <will.deacon@arm.com>
Makefile+9−4
@@ -1,7 +1,7 @@
1VERSION = 41VERSION = 4
2PATCHLEVEL = 92PATCHLEVEL = 9
3SUBLEVEL = 03SUBLEVEL = 0
4EXTRAVERSION = -rc74EXTRAVERSION = -rc8
5NAME = Psychotic Stoned Sheep5NAME = Psychotic Stoned Sheep
6 6
7# *DOCUMENTATION*7# *DOCUMENTATION*
@@ -607,6 +607,13 @@ else · 599 unmodified lines
607include/config/auto.conf: ;607include/config/auto.conf: ;
608endif # $(dot-config)608endif # $(dot-config)
609 609
610# For the kernel to actually contain only the needed exported symbols,
611# we have to build modules as well to determine what those symbols are.
612# (this can be evaluated only once include/config/auto.conf has been included)
613ifdef CONFIG_TRIM_UNUSED_KSYMS
614 KBUILD_MODULES := 1
615endif
616
610# The all: target is the default when no target is given on the617# The all: target is the default when no target is given on the
611# command line.618# command line.
612# This allow a user to issue only 'make' to build a kernel including modules619# This allow a user to issue only 'make' to build a kernel including modules
@@ -944,7 +951,7 @@ ifdef CONFIG_GDB_SCRIPTS · 331 unmodified lines
944endif951endif
945ifdef CONFIG_TRIM_UNUSED_KSYMS952ifdef CONFIG_TRIM_UNUSED_KSYMS
946 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \953 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
947 "$(MAKE) KBUILD_MODULES=1 -f $(srctree)/Makefile vmlinux_prereq"954 "$(MAKE) -f $(srctree)/Makefile vmlinux"
948endif955endif
949 956
950# standalone target for easier testing957# standalone target for easier testing
@@ -1019,8 +1026,6 @@ prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic · 68 unmodified lines
1019prepare1: prepare2 $(version_h) include/generated/utsrelease.h \1026prepare1: prepare2 $(version_h) include/generated/utsrelease.h \
1020 include/config/auto.conf1027 include/config/auto.conf
1021 $(cmd_crmodverdir)1028 $(cmd_crmodverdir)
1022 $(Q)test -e include/generated/autoksyms.h || \
1023 touch include/generated/autoksyms.h
1024 1029
1025archprepare: archheaders archscripts prepare1 scripts_basic1030archprepare: archheaders archscripts prepare1 scripts_basic
1026 1031
arch/arc/include/asm/delay.h+5−4
@@ -22,10 +22,11 @@ · 21 unmodified lines
22static inline void __delay(unsigned long loops)22static inline void __delay(unsigned long loops)
23{23{
24 __asm__ __volatile__(24 __asm__ __volatile__(
25 " lp 1f \n"25 " mov lp_count, %0 \n"
26 " nop \n"26 " lp 1f \n"
27 "1: \n"27 " nop \n"
28 : "+l"(loops));28 "1: \n"
29 : : "r"(loops));
29}30}
30 31
31extern void __bad_udelay(void);32extern void __bad_udelay(void);
arch/arc/include/asm/pgtable.h+1−1
@@ -280,7 +280,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep) · 279 unmodified lines
280 280
281#define pte_page(pte) pfn_to_page(pte_pfn(pte))281#define pte_page(pte) pfn_to_page(pte_pfn(pte))
282#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot)282#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot)
283#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))283#define pfn_pte(pfn, prot) __pte(__pfn_to_phys(pfn) | pgprot_val(prot))
284 284
285/* Don't use virt_to_pfn for macros below: could cause truncations for PAE40*/285/* Don't use virt_to_pfn for macros below: could cause truncations for PAE40*/
286#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT)286#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT)
arch/arc/mm/cache.c+1−1
@@ -23,7 +23,7 @@ · 22 unmodified lines
23 23
24static int l2_line_sz;24static int l2_line_sz;
25static int ioc_exists;25static int ioc_exists;
26int slc_enable = 1, ioc_enable = 1;26int slc_enable = 1, ioc_enable = 0;
27unsigned long perip_base = ARC_UNCACHED_ADDR_SPACE; /* legacy value for boot */27unsigned long perip_base = ARC_UNCACHED_ADDR_SPACE; /* legacy value for boot */
28unsigned long perip_end = 0xFFFFFFFF; /* legacy value */28unsigned long perip_end = 0xFFFFFFFF; /* legacy value */
29 29
arch/arm/boot/dts/Makefile+1−1
@@ -745,7 +745,6 @@ dtb-$(CONFIG_MACH_SUN4I) += \ · 744 unmodified lines
745 sun4i-a10-pcduino2.dtb \745 sun4i-a10-pcduino2.dtb \
746 sun4i-a10-pov-protab2-ips9.dtb746 sun4i-a10-pov-protab2-ips9.dtb
747dtb-$(CONFIG_MACH_SUN5I) += \747dtb-$(CONFIG_MACH_SUN5I) += \
748 ntc-gr8-evb.dtb \
749 sun5i-a10s-auxtek-t003.dtb \748 sun5i-a10s-auxtek-t003.dtb \
750 sun5i-a10s-auxtek-t004.dtb \749 sun5i-a10s-auxtek-t004.dtb \
751 sun5i-a10s-mk802.dtb \750 sun5i-a10s-mk802.dtb \
@@ -761,6 +760,7 @@ dtb-$(CONFIG_MACH_SUN5I) += \ · 9 unmodified lines
761 sun5i-a13-olinuxino-micro.dtb \760 sun5i-a13-olinuxino-micro.dtb \
762 sun5i-a13-q8-tablet.dtb \761 sun5i-a13-q8-tablet.dtb \
763 sun5i-a13-utoo-p66.dtb \762 sun5i-a13-utoo-p66.dtb \
763 sun5i-gr8-evb.dtb \
764 sun5i-r8-chip.dtb764 sun5i-r8-chip.dtb
765dtb-$(CONFIG_MACH_SUN6I) += \765dtb-$(CONFIG_MACH_SUN6I) += \
766 sun6i-a31-app4-evb1.dtb \766 sun6i-a31-app4-evb1.dtb \
arch/arm/boot/dts/stih407-family.dtsi+16−0
@@ -283,6 +283,8 @@ · 282 unmodified lines
283 clock-frequency = <400000>;283 clock-frequency = <400000>;
284 pinctrl-names = "default";284 pinctrl-names = "default";
285 pinctrl-0 = <&pinctrl_i2c0_default>;285 pinctrl-0 = <&pinctrl_i2c0_default>;
286 #address-cells = <1>;
287 #size-cells = <0>;
286 288
287 status = "disabled";289 status = "disabled";
288 };290 };
@@ -296,6 +298,8 @@ · 7 unmodified lines
296 clock-frequency = <400000>;298 clock-frequency = <400000>;
297 pinctrl-names = "default";299 pinctrl-names = "default";
298 pinctrl-0 = <&pinctrl_i2c1_default>;300 pinctrl-0 = <&pinctrl_i2c1_default>;
301 #address-cells = <1>;
302 #size-cells = <0>;
299 303
300 status = "disabled";304 status = "disabled";
301 };305 };
@@ -309,6 +313,8 @@ · 7 unmodified lines
309 clock-frequency = <400000>;313 clock-frequency = <400000>;
310 pinctrl-names = "default";314 pinctrl-names = "default";
311 pinctrl-0 = <&pinctrl_i2c2_default>;315 pinctrl-0 = <&pinctrl_i2c2_default>;
316 #address-cells = <1>;
317 #size-cells = <0>;
312 318
313 status = "disabled";319 status = "disabled";
314 };320 };
@@ -322,6 +328,8 @@ · 7 unmodified lines
322 clock-frequency = <400000>;328 clock-frequency = <400000>;
323 pinctrl-names = "default";329 pinctrl-names = "default";
324 pinctrl-0 = <&pinctrl_i2c3_default>;330 pinctrl-0 = <&pinctrl_i2c3_default>;
331 #address-cells = <1>;
332 #size-cells = <0>;
325 333
326 status = "disabled";334 status = "disabled";
327 };335 };
@@ -335,6 +343,8 @@ · 7 unmodified lines
335 clock-frequency = <400000>;343 clock-frequency = <400000>;
336 pinctrl-names = "default";344 pinctrl-names = "default";
337 pinctrl-0 = <&pinctrl_i2c4_default>;345 pinctrl-0 = <&pinctrl_i2c4_default>;
346 #address-cells = <1>;
347 #size-cells = <0>;
338 348
339 status = "disabled";349 status = "disabled";
340 };350 };
@@ -348,6 +358,8 @@ · 7 unmodified lines
348 clock-frequency = <400000>;358 clock-frequency = <400000>;
349 pinctrl-names = "default";359 pinctrl-names = "default";
350 pinctrl-0 = <&pinctrl_i2c5_default>;360 pinctrl-0 = <&pinctrl_i2c5_default>;
361 #address-cells = <1>;
362 #size-cells = <0>;
351 363
352 status = "disabled";364 status = "disabled";
353 };365 };
@@ -363,6 +375,8 @@ · 9 unmodified lines
363 clock-frequency = <400000>;375 clock-frequency = <400000>;
364 pinctrl-names = "default";376 pinctrl-names = "default";
365 pinctrl-0 = <&pinctrl_i2c10_default>;377 pinctrl-0 = <&pinctrl_i2c10_default>;
378 #address-cells = <1>;
379 #size-cells = <0>;
366 380
367 status = "disabled";381 status = "disabled";
368 };382 };
@@ -376,6 +390,8 @@ · 7 unmodified lines
376 clock-frequency = <400000>;390 clock-frequency = <400000>;
377 pinctrl-names = "default";391 pinctrl-names = "default";
378 pinctrl-0 = <&pinctrl_i2c11_default>;392 pinctrl-0 = <&pinctrl_i2c11_default>;
393 #address-cells = <1>;
394 #size-cells = <0>;
379 395
380 status = "disabled";396 status = "disabled";
381 };397 };
arch/arm/boot/dts/sun5i-gr8-evb.dtsrenamed from arch/arm/boot/dts/ntc-gr8-evb.dts+1−1
@@ -44,7 +44,7 @@ · 43 unmodified lines
44 */44 */
45 45
46/dts-v1/;46/dts-v1/;
47#include "ntc-gr8.dtsi"47#include "sun5i-gr8.dtsi"
48#include "sunxi-common-regulators.dtsi"48#include "sunxi-common-regulators.dtsi"
49 49
50#include <dt-bindings/gpio/gpio.h>50#include <dt-bindings/gpio/gpio.h>
arch/arm/boot/dts/sun5i-gr8.dtsirenamed from arch/arm/boot/dts/ntc-gr8.dtsi+0−0

File renamed without changes.

arch/arm64/boot/dts/arm/juno-base.dtsi+1−1
@@ -393,7 +393,7 @@ · 392 unmodified lines
393 #address-cells = <3>;393 #address-cells = <3>;
394 #size-cells = <2>;394 #size-cells = <2>;
395 dma-coherent;395 dma-coherent;
396 ranges = <0x01000000 0x00 0x5f800000 0x00 0x5f800000 0x0 0x00800000>,396 ranges = <0x01000000 0x00 0x00000000 0x00 0x5f800000 0x0 0x00800000>,
397 <0x02000000 0x00 0x50000000 0x00 0x50000000 0x0 0x08000000>,397 <0x02000000 0x00 0x50000000 0x00 0x50000000 0x0 0x08000000>,
398 <0x42000000 0x40 0x00000000 0x40 0x00000000 0x1 0x00000000>;398 <0x42000000 0x40 0x00000000 0x40 0x00000000 0x1 0x00000000>;
399 #interrupt-cells = <1>;399 #interrupt-cells = <1>;
arch/arm64/boot/dts/arm/juno-r1.dts+1−1
@@ -76,7 +76,7 @@ · 75 unmodified lines
76 compatible = "arm,idle-state";76 compatible = "arm,idle-state";
77 arm,psci-suspend-param = <0x1010000>;77 arm,psci-suspend-param = <0x1010000>;
78 local-timer-stop;78 local-timer-stop;
79 entry-latency-us = <300>;79 entry-latency-us = <400>;
80 exit-latency-us = <1200>;80 exit-latency-us = <1200>;
81 min-residency-us = <2500>;81 min-residency-us = <2500>;
82 };82 };
arch/arm64/boot/dts/arm/juno-r2.dts+1−1
@@ -76,7 +76,7 @@ · 75 unmodified lines
76 compatible = "arm,idle-state";76 compatible = "arm,idle-state";
77 arm,psci-suspend-param = <0x1010000>;77 arm,psci-suspend-param = <0x1010000>;
78 local-timer-stop;78 local-timer-stop;
79 entry-latency-us = <300>;79 entry-latency-us = <400>;
80 exit-latency-us = <1200>;80 exit-latency-us = <1200>;
81 min-residency-us = <2500>;81 min-residency-us = <2500>;
82 };82 };
arch/arm64/boot/dts/arm/juno.dts+1−1
@@ -76,7 +76,7 @@ · 75 unmodified lines
76 compatible = "arm,idle-state";76 compatible = "arm,idle-state";
77 arm,psci-suspend-param = <0x1010000>;77 arm,psci-suspend-param = <0x1010000>;
78 local-timer-stop;78 local-timer-stop;
79 entry-latency-us = <300>;79 entry-latency-us = <400>;
80 exit-latency-us = <1200>;80 exit-latency-us = <1200>;
81 min-residency-us = <2500>;81 min-residency-us = <2500>;
82 };82 };
drivers/ata/ahci.c+0−7
@@ -1436,13 +1436,6 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports, · 1435 unmodified lines
1436 "ahci: MRSM is on, fallback to single MSI\n");1436 "ahci: MRSM is on, fallback to single MSI\n");
1437 pci_free_irq_vectors(pdev);1437 pci_free_irq_vectors(pdev);
1438 }1438 }
1439
1440 /*
1441 * -ENOSPC indicated we don't have enough vectors. Don't bother
1442 * trying a single vectors for any other error:
1443 */
1444 if (nvec < 0 && nvec != -ENOSPC)
1445 return nvec;
1446 }1439 }
1447 1440
1448 /*1441 /*
drivers/ata/libata-scsi.c+1−1
@@ -1088,7 +1088,7 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc) · 1087 unmodified lines
1088 desc[1] = tf->command; /* status */1088 desc[1] = tf->command; /* status */
1089 desc[2] = tf->device;1089 desc[2] = tf->device;
1090 desc[3] = tf->nsect;1090 desc[3] = tf->nsect;
1091 desc[0] = 0;1091 desc[7] = 0;
1092 if (tf->flags & ATA_TFLAG_LBA48) {1092 if (tf->flags & ATA_TFLAG_LBA48) {
1093 desc[8] |= 0x80;1093 desc[8] |= 0x80;
1094 if (tf->hob_nsect)1094 if (tf->hob_nsect)
drivers/block/zram/zram_drv.c+2−1
@@ -1403,7 +1403,8 @@ static ssize_t hot_remove_store(struct class *class, · 1402 unmodified lines
1403 zram = idr_find(&zram_index_idr, dev_id);1403 zram = idr_find(&zram_index_idr, dev_id);
1404 if (zram) {1404 if (zram) {
1405 ret = zram_remove(zram);1405 ret = zram_remove(zram);
1406 idr_remove(&zram_index_idr, dev_id);1406 if (!ret)
1407 idr_remove(&zram_index_idr, dev_id);
1407 } else {1408 } else {
1408 ret = -ENODEV;1409 ret = -ENODEV;
1409 }1410 }
drivers/clk/bcm/Kconfig+1−1
@@ -20,7 +20,7 @@ config CLK_BCM_KONA · 19 unmodified lines
20 20
21config COMMON_CLK_IPROC21config COMMON_CLK_IPROC
22 bool "Broadcom iProc clock support"22 bool "Broadcom iProc clock support"
23 depends on ARCH_BCM_IPROC || COMPILE_TEST23 depends on ARCH_BCM_IPROC || ARCH_BCM_63XX || COMPILE_TEST
24 depends on COMMON_CLK24 depends on COMMON_CLK
25 default ARCH_BCM_IPROC25 default ARCH_BCM_IPROC
26 help26 help
drivers/clk/sunxi-ng/ccu-sun6i-a31.c+1−1
@@ -143,7 +143,7 @@ static SUNXI_CCU_NKM_WITH_MUX_GATE_LOCK(pll_mipi_clk, "pll-mipi", · 142 unmodified lines
143 4, 2, /* K */143 4, 2, /* K */
144 0, 4, /* M */144 0, 4, /* M */
145 21, 0, /* mux */145 21, 0, /* mux */
146 BIT(31), /* gate */146 BIT(31) | BIT(23) | BIT(22), /* gate */
147 BIT(28), /* lock */147 BIT(28), /* lock */
148 CLK_SET_RATE_UNGATE);148 CLK_SET_RATE_UNGATE);
149 149
drivers/clk/sunxi-ng/ccu-sun8i-a33.c+1−1
@@ -131,7 +131,7 @@ static SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_mipi_clk, "pll-mipi", · 130 unmodified lines
131 8, 4, /* N */131 8, 4, /* N */
132 4, 2, /* K */132 4, 2, /* K */
133 0, 4, /* M */133 0, 4, /* M */
134 BIT(31), /* gate */134 BIT(31) | BIT(23) | BIT(22), /* gate */
135 BIT(28), /* lock */135 BIT(28), /* lock */
136 CLK_SET_RATE_UNGATE);136 CLK_SET_RATE_UNGATE);
137 137
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c+9−2
@@ -485,7 +485,6 @@ static int amdgpu_atpx_power_state(enum vga_switcheroo_client_id id, · 484 unmodified lines
485 */485 */
486static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)486static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
487{487{
488 struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
489 acpi_handle dhandle, atpx_handle;488 acpi_handle dhandle, atpx_handle;
490 acpi_status status;489 acpi_status status;
491 490
@@ -500,7 +499,6 @@ static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev) · 8 unmodified lines
500 }499 }
501 amdgpu_atpx_priv.dhandle = dhandle;500 amdgpu_atpx_priv.dhandle = dhandle;
502 amdgpu_atpx_priv.atpx.handle = atpx_handle;501 amdgpu_atpx_priv.atpx.handle = atpx_handle;
503 amdgpu_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
504 return true;502 return true;
505}503}
506 504
@@ -562,17 +560,25 @@ static bool amdgpu_atpx_detect(void) · 55 unmodified lines
562 struct pci_dev *pdev = NULL;560 struct pci_dev *pdev = NULL;
563 bool has_atpx = false;561 bool has_atpx = false;
564 int vga_count = 0;562 int vga_count = 0;
563 bool d3_supported = false;
564 struct pci_dev *parent_pdev;
565 565
566 while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {566 while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
567 vga_count++;567 vga_count++;
568 568
569 has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);569 has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);
570
571 parent_pdev = pci_upstream_bridge(pdev);
572 d3_supported |= parent_pdev && parent_pdev->bridge_d3;
570 }573 }
571 574
572 while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {575 while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
573 vga_count++;576 vga_count++;
574 577
575 has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);578 has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);
579
580 parent_pdev = pci_upstream_bridge(pdev);
581 d3_supported |= parent_pdev && parent_pdev->bridge_d3;
576 }582 }
577 583
578 if (has_atpx && vga_count == 2) {584 if (has_atpx && vga_count == 2) {
@@ -580,6 +586,7 @@ static bool amdgpu_atpx_detect(void) · 1 unmodified line
580 printk(KERN_INFO "vga_switcheroo: detected switching method %s handle\n",586 printk(KERN_INFO "vga_switcheroo: detected switching method %s handle\n",
581 acpi_method_name);587 acpi_method_name);
582 amdgpu_atpx_priv.atpx_detected = true;588 amdgpu_atpx_priv.atpx_detected = true;
589 amdgpu_atpx_priv.bridge_pm_usable = d3_supported;
583 amdgpu_atpx_init();590 amdgpu_atpx_init();
584 return true;591 return true;
585 }592 }
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c+4−1
@@ -2214,6 +2214,7 @@ uint32_t polaris10_get_mac_definition(uint32_t value) · 2213 unmodified lines
2214int polaris10_process_firmware_header(struct pp_hwmgr *hwmgr)2214int polaris10_process_firmware_header(struct pp_hwmgr *hwmgr)
2215{2215{
2216 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smumgr->backend);2216 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smumgr->backend);
2217 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
2217 uint32_t tmp;2218 uint32_t tmp;
2218 int result;2219 int result;
2219 bool error = false;2220 bool error = false;
@@ -2233,8 +2234,10 @@ int polaris10_process_firmware_header(struct pp_hwmgr *hwmgr) · 13 unmodified lines
2233 offsetof(SMU74_Firmware_Header, SoftRegisters),2234 offsetof(SMU74_Firmware_Header, SoftRegisters),
2234 &tmp, SMC_RAM_END);2235 &tmp, SMC_RAM_END);
2235 2236
2236 if (!result)2237 if (!result) {
2238 data->soft_regs_start = tmp;
2237 smu_data->smu7_data.soft_regs_start = tmp;2239 smu_data->smu7_data.soft_regs_start = tmp;
2240 }
2238 2241
2239 error |= (0 != result);2242 error |= (0 != result);
2240 2243
drivers/gpu/drm/arm/hdlcd_drv.c+1−1
@@ -375,7 +375,6 @@ static int hdlcd_drm_bind(struct device *dev) · 374 unmodified lines
375 375
376err_fbdev:376err_fbdev:
377 drm_kms_helper_poll_fini(drm);377 drm_kms_helper_poll_fini(drm);
378 drm_mode_config_cleanup(drm);
379 drm_vblank_cleanup(drm);378 drm_vblank_cleanup(drm);
380err_vblank:379err_vblank:
381 pm_runtime_disable(drm->dev);380 pm_runtime_disable(drm->dev);
@@ -387,6 +386,7 @@ err_unload: · 5 unmodified lines
387 drm_irq_uninstall(drm);386 drm_irq_uninstall(drm);
388 of_reserved_mem_device_release(drm->dev);387 of_reserved_mem_device_release(drm->dev);
389err_free:388err_free:
389 drm_mode_config_cleanup(drm);
390 dev_set_drvdata(dev, NULL);390 dev_set_drvdata(dev, NULL);
391 drm_dev_unref(drm);391 drm_dev_unref(drm);
392 392
drivers/gpu/drm/drm_ioctl.c+6−4
@@ -254,10 +254,12 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_ · 253 unmodified lines
254 req->value = dev->mode_config.async_page_flip;254 req->value = dev->mode_config.async_page_flip;
255 break;255 break;
256 case DRM_CAP_PAGE_FLIP_TARGET:256 case DRM_CAP_PAGE_FLIP_TARGET:
257 req->value = 1;257 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
258 drm_for_each_crtc(crtc, dev) {258 req->value = 1;
259 if (!crtc->funcs->page_flip_target)259 drm_for_each_crtc(crtc, dev) {
260 req->value = 0;260 if (!crtc->funcs->page_flip_target)
261 req->value = 0;
262 }
261 }263 }
262 break;264 break;
263 case DRM_CAP_CURSOR_WIDTH:265 case DRM_CAP_CURSOR_WIDTH:
drivers/gpu/drm/i915/i915_gem.c+3−2
@@ -2268,7 +2268,7 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) · 2267 unmodified lines
2268 page = shmem_read_mapping_page(mapping, i);2268 page = shmem_read_mapping_page(mapping, i);
2269 if (IS_ERR(page)) {2269 if (IS_ERR(page)) {
2270 ret = PTR_ERR(page);2270 ret = PTR_ERR(page);
2271 goto err_pages;2271 goto err_sg;
2272 }2272 }
2273 }2273 }
2274#ifdef CONFIG_SWIOTLB2274#ifdef CONFIG_SWIOTLB
@@ -2311,8 +2311,9 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) · 36 unmodified lines
2311 2311
2312 return 0;2312 return 0;
2313 2313
2314err_pages:2314err_sg:
2315 sg_mark_end(sg);2315 sg_mark_end(sg);
2316err_pages:
2316 for_each_sgt_page(page, sgt_iter, st)2317 for_each_sgt_page(page, sgt_iter, st)
2317 put_page(page);2318 put_page(page);
2318 sg_free_table(st);2319 sg_free_table(st);
drivers/gpu/drm/i915/intel_display.c+2−1
@@ -12260,7 +12260,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, · 12259 unmodified lines
12260 intel_crtc->reset_count = i915_reset_count(&dev_priv->gpu_error);12260 intel_crtc->reset_count = i915_reset_count(&dev_priv->gpu_error);
12261 if (i915_reset_in_progress_or_wedged(&dev_priv->gpu_error)) {12261 if (i915_reset_in_progress_or_wedged(&dev_priv->gpu_error)) {
12262 ret = -EIO;12262 ret = -EIO;
12263 goto cleanup;12263 goto unlock;
12264 }12264 }
12265 12265
12266 atomic_inc(&intel_crtc->unpin_work_count);12266 atomic_inc(&intel_crtc->unpin_work_count);
@@ -12352,6 +12352,7 @@ cleanup_unpin: · 85 unmodified lines
12352 intel_unpin_fb_obj(fb, crtc->primary->state->rotation);12352 intel_unpin_fb_obj(fb, crtc->primary->state->rotation);
12353cleanup_pending:12353cleanup_pending:
12354 atomic_dec(&intel_crtc->unpin_work_count);12354 atomic_dec(&intel_crtc->unpin_work_count);
12355unlock:
12355 mutex_unlock(&dev->struct_mutex);12356 mutex_unlock(&dev->struct_mutex);
12356cleanup:12357cleanup:
12357 crtc->primary->fb = old_fb;12358 crtc->primary->fb = old_fb;
drivers/gpu/drm/radeon/radeon_atpx_handler.c+9−2
@@ -479,7 +479,6 @@ static int radeon_atpx_power_state(enum vga_switcheroo_client_id id, · 478 unmodified lines
479 */479 */
480static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)480static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
481{481{
482 struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
483 acpi_handle dhandle, atpx_handle;482 acpi_handle dhandle, atpx_handle;
484 acpi_status status;483 acpi_status status;
485 484
@@ -493,7 +492,6 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) · 7 unmodified lines
493 492
494 radeon_atpx_priv.dhandle = dhandle;493 radeon_atpx_priv.dhandle = dhandle;
495 radeon_atpx_priv.atpx.handle = atpx_handle;494 radeon_atpx_priv.atpx.handle = atpx_handle;
496 radeon_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
497 return true;495 return true;
498}496}
499 497
@@ -555,11 +553,16 @@ static bool radeon_atpx_detect(void) · 55 unmodified lines
555 struct pci_dev *pdev = NULL;553 struct pci_dev *pdev = NULL;
556 bool has_atpx = false;554 bool has_atpx = false;
557 int vga_count = 0;555 int vga_count = 0;
556 bool d3_supported = false;
557 struct pci_dev *parent_pdev;
558 558
559 while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {559 while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
560 vga_count++;560 vga_count++;
561 561
562 has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);562 has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);
563
564 parent_pdev = pci_upstream_bridge(pdev);
565 d3_supported |= parent_pdev && parent_pdev->bridge_d3;
563 }566 }
564 567
565 /* some newer PX laptops mark the dGPU as a non-VGA display device */568 /* some newer PX laptops mark the dGPU as a non-VGA display device */
@@ -567,6 +570,9 @@ static bool radeon_atpx_detect(void) · 1 unmodified line
567 vga_count++;570 vga_count++;
568 571
569 has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);572 has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);
573
574 parent_pdev = pci_upstream_bridge(pdev);
575 d3_supported |= parent_pdev && parent_pdev->bridge_d3;
570 }576 }
571 577
572 if (has_atpx && vga_count == 2) {578 if (has_atpx && vga_count == 2) {
@@ -574,6 +580,7 @@ static bool radeon_atpx_detect(void) · 1 unmodified line
574 printk(KERN_INFO "vga_switcheroo: detected switching method %s handle\n",580 printk(KERN_INFO "vga_switcheroo: detected switching method %s handle\n",
575 acpi_method_name);581 acpi_method_name);
576 radeon_atpx_priv.atpx_detected = true;582 radeon_atpx_priv.atpx_detected = true;
583 radeon_atpx_priv.bridge_pm_usable = d3_supported;
577 radeon_atpx_init();584 radeon_atpx_init();
578 return true;585 return true;
579 }586 }
drivers/i2c/busses/i2c-octeon-core.c+1−3
@@ -381,9 +381,7 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target, · 380 unmodified lines
381 if (result)381 if (result)
382 return result;382 return result;
383 383
384 data[i] = octeon_i2c_data_read(i2c, &result);384 data[i] = octeon_i2c_data_read(i2c);
385 if (result)
386 return result;
387 if (recv_len && i == 0) {385 if (recv_len && i == 0) {
388 if (data[i] > I2C_SMBUS_BLOCK_MAX + 1)386 if (data[i] > I2C_SMBUS_BLOCK_MAX + 1)
389 return -EPROTO;387 return -EPROTO;
drivers/i2c/busses/i2c-octeon-core.h+11−16
@@ -5,7 +5,6 @@ · 4 unmodified lines
5#include <linux/i2c.h>5#include <linux/i2c.h>
6#include <linux/i2c-smbus.h>6#include <linux/i2c-smbus.h>
7#include <linux/io.h>7#include <linux/io.h>
8#include <linux/iopoll.h>
9#include <linux/kernel.h>8#include <linux/kernel.h>
10#include <linux/pci.h>9#include <linux/pci.h>
11 10
@@ -145,9 +144,9 @@ static inline void octeon_i2c_reg_write(struct octeon_i2c *i2c, u64 eop_reg, u8 · 133 unmodified lines
145 u64 tmp;144 u64 tmp;
146 145
147 __raw_writeq(SW_TWSI_V | eop_reg | data, i2c->twsi_base + SW_TWSI(i2c));146 __raw_writeq(SW_TWSI_V | eop_reg | data, i2c->twsi_base + SW_TWSI(i2c));
148 147 do {
149 readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp, tmp & SW_TWSI_V,148 tmp = __raw_readq(i2c->twsi_base + SW_TWSI(i2c));
150 I2C_OCTEON_EVENT_WAIT, i2c->adap.timeout);149 } while ((tmp & SW_TWSI_V) != 0);
151}150}
152 151
153#define octeon_i2c_ctl_write(i2c, val) \152#define octeon_i2c_ctl_write(i2c, val) \
@@ -164,28 +163,24 @@ static inline void octeon_i2c_reg_write(struct octeon_i2c *i2c, u64 eop_reg, u8 · 10 unmodified lines
164 *163 *
165 * The I2C core registers are accessed indirectly via the SW_TWSI CSR.164 * The I2C core registers are accessed indirectly via the SW_TWSI CSR.
166 */165 */
167static inline int octeon_i2c_reg_read(struct octeon_i2c *i2c, u64 eop_reg,166static inline u8 octeon_i2c_reg_read(struct octeon_i2c *i2c, u64 eop_reg)
168 int *error)
169{167{
170 u64 tmp;168 u64 tmp;
171 int ret;
172 169
173 __raw_writeq(SW_TWSI_V | eop_reg | SW_TWSI_R, i2c->twsi_base + SW_TWSI(i2c));170 __raw_writeq(SW_TWSI_V | eop_reg | SW_TWSI_R, i2c->twsi_base + SW_TWSI(i2c));
171 do {
172 tmp = __raw_readq(i2c->twsi_base + SW_TWSI(i2c));
173 } while ((tmp & SW_TWSI_V) != 0);
174 174
175 ret = readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp,
176 tmp & SW_TWSI_V, I2C_OCTEON_EVENT_WAIT,
177 i2c->adap.timeout);
178 if (error)
179 *error = ret;
180 return tmp & 0xFF;175 return tmp & 0xFF;
181}176}
182 177
183#define octeon_i2c_ctl_read(i2c) \178#define octeon_i2c_ctl_read(i2c) \
184 octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_CTL, NULL)179 octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_CTL)
185#define octeon_i2c_data_read(i2c, error) \180#define octeon_i2c_data_read(i2c) \
186 octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_DATA, error)181 octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_DATA)
187#define octeon_i2c_stat_read(i2c) \182#define octeon_i2c_stat_read(i2c) \
188 octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_STAT, NULL)183 octeon_i2c_reg_read(i2c, SW_TWSI_EOP_TWSI_STAT)
189 184
190/**185/**
191 * octeon_i2c_read_int - read the TWSI_INT register186 * octeon_i2c_read_int - read the TWSI_INT register
drivers/input/mouse/psmouse-base.c+0−4
@@ -1115,10 +1115,6 @@ static int psmouse_extensions(struct psmouse *psmouse, · 1114 unmodified lines
1115 if (psmouse_try_protocol(psmouse, PSMOUSE_TOUCHKIT_PS2,1115 if (psmouse_try_protocol(psmouse, PSMOUSE_TOUCHKIT_PS2,
1116 &max_proto, set_properties, true))1116 &max_proto, set_properties, true))
1117 return PSMOUSE_TOUCHKIT_PS2;1117 return PSMOUSE_TOUCHKIT_PS2;
1118
1119 if (psmouse_try_protocol(psmouse, PSMOUSE_BYD,
1120 &max_proto, set_properties, true))
1121 return PSMOUSE_BYD;
1122 }1118 }
1123 1119
1124 /*1120 /*
drivers/net/can/usb/peak_usb/pcan_ucan.h+29−8
@@ -43,11 +43,22 @@ struct __packed pucan_command { · 42 unmodified lines
43 u16 args[3];43 u16 args[3];
44};44};
45 45
46#define PUCAN_TSLOW_BRP_BITS 10
47#define PUCAN_TSLOW_TSGEG1_BITS 8
48#define PUCAN_TSLOW_TSGEG2_BITS 7
49#define PUCAN_TSLOW_SJW_BITS 7
50
51#define PUCAN_TSLOW_BRP_MASK ((1 << PUCAN_TSLOW_BRP_BITS) - 1)
52#define PUCAN_TSLOW_TSEG1_MASK ((1 << PUCAN_TSLOW_TSGEG1_BITS) - 1)
53#define PUCAN_TSLOW_TSEG2_MASK ((1 << PUCAN_TSLOW_TSGEG2_BITS) - 1)
54#define PUCAN_TSLOW_SJW_MASK ((1 << PUCAN_TSLOW_SJW_BITS) - 1)
55
46/* uCAN TIMING_SLOW command fields */56/* uCAN TIMING_SLOW command fields */
47#define PUCAN_TSLOW_SJW_T(s, t) (((s) & 0xf) | ((!!(t)) << 7))57#define PUCAN_TSLOW_SJW_T(s, t) (((s) & PUCAN_TSLOW_SJW_MASK) | \
48#define PUCAN_TSLOW_TSEG2(t) ((t) & 0xf)58 ((!!(t)) << 7))
49#define PUCAN_TSLOW_TSEG1(t) ((t) & 0x3f)59#define PUCAN_TSLOW_TSEG2(t) ((t) & PUCAN_TSLOW_TSEG2_MASK)
50#define PUCAN_TSLOW_BRP(b) ((b) & 0x3ff)60#define PUCAN_TSLOW_TSEG1(t) ((t) & PUCAN_TSLOW_TSEG1_MASK)
61#define PUCAN_TSLOW_BRP(b) ((b) & PUCAN_TSLOW_BRP_MASK)
51 62
52struct __packed pucan_timing_slow {63struct __packed pucan_timing_slow {
53 __le16 opcode_channel;64 __le16 opcode_channel;
@@ -60,11 +71,21 @@ struct __packed pucan_timing_slow { · 6 unmodified lines
60 __le16 brp; /* BaudRate Prescaler */71 __le16 brp; /* BaudRate Prescaler */
61};72};
62 73
74#define PUCAN_TFAST_BRP_BITS 10
75#define PUCAN_TFAST_TSGEG1_BITS 5
76#define PUCAN_TFAST_TSGEG2_BITS 4
77#define PUCAN_TFAST_SJW_BITS 4
78
79#define PUCAN_TFAST_BRP_MASK ((1 << PUCAN_TFAST_BRP_BITS) - 1)
80#define PUCAN_TFAST_TSEG1_MASK ((1 << PUCAN_TFAST_TSGEG1_BITS) - 1)
81#define PUCAN_TFAST_TSEG2_MASK ((1 << PUCAN_TFAST_TSGEG2_BITS) - 1)
82#define PUCAN_TFAST_SJW_MASK ((1 << PUCAN_TFAST_SJW_BITS) - 1)
83
63/* uCAN TIMING_FAST command fields */84/* uCAN TIMING_FAST command fields */
64#define PUCAN_TFAST_SJW(s) ((s) & 0x3)85#define PUCAN_TFAST_SJW(s) ((s) & PUCAN_TFAST_SJW_MASK)
65#define PUCAN_TFAST_TSEG2(t) ((t) & 0x7)86#define PUCAN_TFAST_TSEG2(t) ((t) & PUCAN_TFAST_TSEG2_MASK)
66#define PUCAN_TFAST_TSEG1(t) ((t) & 0xf)87#define PUCAN_TFAST_TSEG1(t) ((t) & PUCAN_TFAST_TSEG1_MASK)
67#define PUCAN_TFAST_BRP(b) ((b) & 0x3ff)88#define PUCAN_TFAST_BRP(b) ((b) & PUCAN_TFAST_BRP_MASK)
68 89
69struct __packed pucan_timing_fast {90struct __packed pucan_timing_fast {
70 __le16 opcode_channel;91 __le16 opcode_channel;
drivers/net/can/usb/peak_usb/pcan_usb_core.c+2−0
@@ -39,6 +39,7 @@ static struct usb_device_id peak_usb_table[] = { · 38 unmodified lines
39 {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBPRO_PRODUCT_ID)},39 {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBPRO_PRODUCT_ID)},
40 {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBFD_PRODUCT_ID)},40 {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBFD_PRODUCT_ID)},
41 {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBPROFD_PRODUCT_ID)},41 {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBPROFD_PRODUCT_ID)},
42 {USB_DEVICE(PCAN_USB_VENDOR_ID, PCAN_USBX6_PRODUCT_ID)},
42 {} /* Terminating entry */43 {} /* Terminating entry */
43};44};
44 45
@@ -50,6 +51,7 @@ static const struct peak_usb_adapter *const peak_usb_adapters_list[] = { · 5 unmodified lines
50 &pcan_usb_pro,51 &pcan_usb_pro,
51 &pcan_usb_fd,52 &pcan_usb_fd,
52 &pcan_usb_pro_fd,53 &pcan_usb_pro_fd,
54 &pcan_usb_x6,
53};55};
54 56
55/*57/*
drivers/net/can/usb/peak_usb/pcan_usb_core.h+2−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
27#define PCAN_USBPRO_PRODUCT_ID 0x000d27#define PCAN_USBPRO_PRODUCT_ID 0x000d
28#define PCAN_USBPROFD_PRODUCT_ID 0x001128#define PCAN_USBPROFD_PRODUCT_ID 0x0011
29#define PCAN_USBFD_PRODUCT_ID 0x001229#define PCAN_USBFD_PRODUCT_ID 0x0012
30#define PCAN_USBX6_PRODUCT_ID 0x0014
30 31
31#define PCAN_USB_DRIVER_NAME "peak_usb"32#define PCAN_USB_DRIVER_NAME "peak_usb"
32 33
@@ -90,6 +91,7 @@ extern const struct peak_usb_adapter pcan_usb; · 57 unmodified lines
90extern const struct peak_usb_adapter pcan_usb_pro;91extern const struct peak_usb_adapter pcan_usb_pro;
91extern const struct peak_usb_adapter pcan_usb_fd;92extern const struct peak_usb_adapter pcan_usb_fd;
92extern const struct peak_usb_adapter pcan_usb_pro_fd;93extern const struct peak_usb_adapter pcan_usb_pro_fd;
94extern const struct peak_usb_adapter pcan_usb_x6;
93 95
94struct peak_time_ref {96struct peak_time_ref {
95 struct timeval tv_host_0, tv_host;97 struct timeval tv_host_0, tv_host;
drivers/net/can/usb/peak_usb/pcan_usb_fd.c+88−16
@@ -993,24 +993,24 @@ static void pcan_usb_fd_free(struct peak_usb_device *dev) · 992 unmodified lines
993static const struct can_bittiming_const pcan_usb_fd_const = {993static const struct can_bittiming_const pcan_usb_fd_const = {
994 .name = "pcan_usb_fd",994 .name = "pcan_usb_fd",
995 .tseg1_min = 1,995 .tseg1_min = 1,
996 .tseg1_max = 64,996 .tseg1_max = (1 << PUCAN_TSLOW_TSGEG1_BITS),
997 .tseg2_min = 1,997 .tseg2_min = 1,
998 .tseg2_max = 16,998 .tseg2_max = (1 << PUCAN_TSLOW_TSGEG2_BITS),
999 .sjw_max = 16,999 .sjw_max = (1 << PUCAN_TSLOW_SJW_BITS),
1000 .brp_min = 1,1000 .brp_min = 1,
1001 .brp_max = 1024,1001 .brp_max = (1 << PUCAN_TSLOW_BRP_BITS),
1002 .brp_inc = 1,1002 .brp_inc = 1,
1003};1003};
1004 1004
1005static const struct can_bittiming_const pcan_usb_fd_data_const = {1005static const struct can_bittiming_const pcan_usb_fd_data_const = {
1006 .name = "pcan_usb_fd",1006 .name = "pcan_usb_fd",
1007 .tseg1_min = 1,1007 .tseg1_min = 1,
1008 .tseg1_max = 16,1008 .tseg1_max = (1 << PUCAN_TFAST_TSGEG1_BITS),
1009 .tseg2_min = 1,1009 .tseg2_min = 1,
1010 .tseg2_max = 8,1010 .tseg2_max = (1 << PUCAN_TFAST_TSGEG2_BITS),
1011 .sjw_max = 4,1011 .sjw_max = (1 << PUCAN_TFAST_SJW_BITS),
1012 .brp_min = 1,1012 .brp_min = 1,
1013 .brp_max = 1024,1013 .brp_max = (1 << PUCAN_TFAST_BRP_BITS),
1014 .brp_inc = 1,1014 .brp_inc = 1,
1015};1015};
1016 1016
@@ -1065,24 +1065,24 @@ const struct peak_usb_adapter pcan_usb_fd = { · 48 unmodified lines
1065static const struct can_bittiming_const pcan_usb_pro_fd_const = {1065static const struct can_bittiming_const pcan_usb_pro_fd_const = {
1066 .name = "pcan_usb_pro_fd",1066 .name = "pcan_usb_pro_fd",
1067 .tseg1_min = 1,1067 .tseg1_min = 1,
1068 .tseg1_max = 64,1068 .tseg1_max = (1 << PUCAN_TSLOW_TSGEG1_BITS),
1069 .tseg2_min = 1,1069 .tseg2_min = 1,
1070 .tseg2_max = 16,1070 .tseg2_max = (1 << PUCAN_TSLOW_TSGEG2_BITS),
1071 .sjw_max = 16,1071 .sjw_max = (1 << PUCAN_TSLOW_SJW_BITS),
1072 .brp_min = 1,1072 .brp_min = 1,
1073 .brp_max = 1024,1073 .brp_max = (1 << PUCAN_TSLOW_BRP_BITS),
1074 .brp_inc = 1,1074 .brp_inc = 1,
1075};1075};
1076 1076
1077static const struct can_bittiming_const pcan_usb_pro_fd_data_const = {1077static const struct can_bittiming_const pcan_usb_pro_fd_data_const = {
1078 .name = "pcan_usb_pro_fd",1078 .name = "pcan_usb_pro_fd",
1079 .tseg1_min = 1,1079 .tseg1_min = 1,
1080 .tseg1_max = 16,1080 .tseg1_max = (1 << PUCAN_TFAST_TSGEG1_BITS),
1081 .tseg2_min = 1,1081 .tseg2_min = 1,
1082 .tseg2_max = 8,1082 .tseg2_max = (1 << PUCAN_TFAST_TSGEG2_BITS),
1083 .sjw_max = 4,1083 .sjw_max = (1 << PUCAN_TFAST_SJW_BITS),
1084 .brp_min = 1,1084 .brp_min = 1,
1085 .brp_max = 1024,1085 .brp_max = (1 << PUCAN_TFAST_BRP_BITS),
1086 .brp_inc = 1,1086 .brp_inc = 1,
1087};1087};
1088 1088
@@ -1132,3 +1132,75 @@ const struct peak_usb_adapter pcan_usb_pro_fd = { · 43 unmodified lines
1132 1132
1133 .do_get_berr_counter = pcan_usb_fd_get_berr_counter,1133 .do_get_berr_counter = pcan_usb_fd_get_berr_counter,
1134};1134};
1135
1136/* describes the PCAN-USB X6 adapter */
1137static const struct can_bittiming_const pcan_usb_x6_const = {
1138 .name = "pcan_usb_x6",
1139 .tseg1_min = 1,
1140 .tseg1_max = (1 << PUCAN_TSLOW_TSGEG1_BITS),
1141 .tseg2_min = 1,
1142 .tseg2_max = (1 << PUCAN_TSLOW_TSGEG2_BITS),
1143 .sjw_max = (1 << PUCAN_TSLOW_SJW_BITS),
1144 .brp_min = 1,
1145 .brp_max = (1 << PUCAN_TSLOW_BRP_BITS),
1146 .brp_inc = 1,
1147};
1148
1149static const struct can_bittiming_const pcan_usb_x6_data_const = {
1150 .name = "pcan_usb_x6",
1151 .tseg1_min = 1,
1152 .tseg1_max = (1 << PUCAN_TFAST_TSGEG1_BITS),
1153 .tseg2_min = 1,
1154 .tseg2_max = (1 << PUCAN_TFAST_TSGEG2_BITS),
1155 .sjw_max = (1 << PUCAN_TFAST_SJW_BITS),
1156 .brp_min = 1,
1157 .brp_max = (1 << PUCAN_TFAST_BRP_BITS),
1158 .brp_inc = 1,
1159};
1160
1161const struct peak_usb_adapter pcan_usb_x6 = {
1162 .name = "PCAN-USB X6",
1163 .device_id = PCAN_USBX6_PRODUCT_ID,
1164 .ctrl_count = PCAN_USBPROFD_CHANNEL_COUNT,
1165 .ctrlmode_supported = CAN_CTRLMODE_FD |
1166 CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY,
1167 .clock = {
1168 .freq = PCAN_UFD_CRYSTAL_HZ,
1169 },
1170 .bittiming_const = &pcan_usb_x6_const,
1171 .data_bittiming_const = &pcan_usb_x6_data_const,
1172
1173 /* size of device private data */
1174 .sizeof_dev_private = sizeof(struct pcan_usb_fd_device),
1175
1176 /* timestamps usage */
1177 .ts_used_bits = 32,
1178 .ts_period = 1000000, /* calibration period in ts. */
1179 .us_per_ts_scale = 1, /* us = (ts * scale) >> shift */
1180 .us_per_ts_shift = 0,
1181
1182 /* give here messages in/out endpoints */
1183 .ep_msg_in = PCAN_USBPRO_EP_MSGIN,
1184 .ep_msg_out = {PCAN_USBPRO_EP_MSGOUT_0, PCAN_USBPRO_EP_MSGOUT_1},
1185
1186 /* size of rx/tx usb buffers */
1187 .rx_buffer_size = PCAN_UFD_RX_BUFFER_SIZE,
1188 .tx_buffer_size = PCAN_UFD_TX_BUFFER_SIZE,
1189
1190 /* device callbacks */
1191 .intf_probe = pcan_usb_pro_probe, /* same as PCAN-USB Pro */
1192 .dev_init = pcan_usb_fd_init,
1193
1194 .dev_exit = pcan_usb_fd_exit,
1195 .dev_free = pcan_usb_fd_free,
1196 .dev_set_bus = pcan_usb_fd_set_bus,
1197 .dev_set_bittiming = pcan_usb_fd_set_bittiming_slow,
1198 .dev_set_data_bittiming = pcan_usb_fd_set_bittiming_fast,
1199 .dev_decode_buf = pcan_usb_fd_decode_buf,
1200 .dev_start = pcan_usb_fd_start,
1201 .dev_stop = pcan_usb_fd_stop,
1202 .dev_restart_async = pcan_usb_fd_restart_async,
1203 .dev_encode_msg = pcan_usb_fd_encode_msg,
1204
1205 .do_get_berr_counter = pcan_usb_fd_get_berr_counter,
1206};
drivers/net/ethernet/altera/altera_tse_main.c+8−13
@@ -400,12 +400,6 @@ static int tse_rx(struct altera_tse_private *priv, int limit) · 399 unmodified lines
400 400
401 skb_put(skb, pktlength);401 skb_put(skb, pktlength);
402 402
403 /* make cache consistent with receive packet buffer */
404 dma_sync_single_for_cpu(priv->device,
405 priv->rx_ring[entry].dma_addr,
406 priv->rx_ring[entry].len,
407 DMA_FROM_DEVICE);
408
409 dma_unmap_single(priv->device, priv->rx_ring[entry].dma_addr,403 dma_unmap_single(priv->device, priv->rx_ring[entry].dma_addr,
410 priv->rx_ring[entry].len, DMA_FROM_DEVICE);404 priv->rx_ring[entry].len, DMA_FROM_DEVICE);
411 405
@@ -469,7 +463,6 @@ static int tse_tx_complete(struct altera_tse_private *priv) · 57 unmodified lines
469 463
470 if (unlikely(netif_queue_stopped(priv->dev) &&464 if (unlikely(netif_queue_stopped(priv->dev) &&
471 tse_tx_avail(priv) > TSE_TX_THRESH(priv))) {465 tse_tx_avail(priv) > TSE_TX_THRESH(priv))) {
472 netif_tx_lock(priv->dev);
473 if (netif_queue_stopped(priv->dev) &&466 if (netif_queue_stopped(priv->dev) &&
474 tse_tx_avail(priv) > TSE_TX_THRESH(priv)) {467 tse_tx_avail(priv) > TSE_TX_THRESH(priv)) {
475 if (netif_msg_tx_done(priv))468 if (netif_msg_tx_done(priv))
@@ -477,7 +470,6 @@ static int tse_tx_complete(struct altera_tse_private *priv) · 1 unmodified line
477 __func__);470 __func__);
478 netif_wake_queue(priv->dev);471 netif_wake_queue(priv->dev);
479 }472 }
480 netif_tx_unlock(priv->dev);
481 }473 }
482 474
483 spin_unlock(&priv->tx_lock);475 spin_unlock(&priv->tx_lock);
@@ -592,10 +584,6 @@ static int tse_start_xmit(struct sk_buff *skb, struct net_device *dev) · 108 unmodified lines
592 buffer->dma_addr = dma_addr;584 buffer->dma_addr = dma_addr;
593 buffer->len = nopaged_len;585 buffer->len = nopaged_len;
594 586
595 /* Push data out of the cache hierarchy into main memory */
596 dma_sync_single_for_device(priv->device, buffer->dma_addr,
597 buffer->len, DMA_TO_DEVICE);
598
599 priv->dmaops->tx_buffer(priv, buffer);587 priv->dmaops->tx_buffer(priv, buffer);
600 588
601 skb_tx_timestamp(skb);589 skb_tx_timestamp(skb);
@@ -819,6 +807,8 @@ static int init_phy(struct net_device *dev) · 217 unmodified lines
819 807
820 if (!phydev) {808 if (!phydev) {
821 netdev_err(dev, "Could not find the PHY\n");809 netdev_err(dev, "Could not find the PHY\n");
810 if (fixed_link)
811 of_phy_deregister_fixed_link(priv->device->of_node);
822 return -ENODEV;812 return -ENODEV;
823 }813 }
824 814
@@ -1545,10 +1535,15 @@ err_free_netdev: · 720 unmodified lines
1545static int altera_tse_remove(struct platform_device *pdev)1535static int altera_tse_remove(struct platform_device *pdev)
1546{1536{
1547 struct net_device *ndev = platform_get_drvdata(pdev);1537 struct net_device *ndev = platform_get_drvdata(pdev);
1538 struct altera_tse_private *priv = netdev_priv(ndev);
1548 1539
1549 if (ndev->phydev)1540 if (ndev->phydev) {
1550 phy_disconnect(ndev->phydev);1541 phy_disconnect(ndev->phydev);
1551 1542
1543 if (of_phy_is_fixed_link(priv->device->of_node))
1544 of_phy_deregister_fixed_link(priv->device->of_node);
1545 }
1546
1552 platform_set_drvdata(pdev, NULL);1547 platform_set_drvdata(pdev, NULL);
1553 altera_tse_mdio_destroy(ndev);1548 altera_tse_mdio_destroy(ndev);
1554 unregister_netdev(ndev);1549 unregister_netdev(ndev);
drivers/net/ethernet/amd/xgbe/xgbe-main.c+2−2
@@ -829,7 +829,7 @@ static int xgbe_remove(struct platform_device *pdev) · 828 unmodified lines
829 return 0;829 return 0;
830}830}
831 831
832#ifdef CONFIG_PM832#ifdef CONFIG_PM_SLEEP
833static int xgbe_suspend(struct device *dev)833static int xgbe_suspend(struct device *dev)
834{834{
835 struct net_device *netdev = dev_get_drvdata(dev);835 struct net_device *netdev = dev_get_drvdata(dev);
@@ -874,7 +874,7 @@ static int xgbe_resume(struct device *dev) · 38 unmodified lines
874 874
875 return ret;875 return ret;
876}876}
877#endif /* CONFIG_PM */877#endif /* CONFIG_PM_SLEEP */
878 878
879#ifdef CONFIG_ACPI879#ifdef CONFIG_ACPI
880static const struct acpi_device_id xgbe_acpi_match[] = {880static const struct acpi_device_id xgbe_acpi_match[] = {
drivers/net/ethernet/aurora/nb8800.c+7−2
@@ -1466,12 +1466,12 @@ static int nb8800_probe(struct platform_device *pdev) · 1465 unmodified lines
1466 1466
1467 ret = nb8800_hw_init(dev);1467 ret = nb8800_hw_init(dev);
1468 if (ret)1468 if (ret)
1469 goto err_free_bus;1469 goto err_deregister_fixed_link;
1470 1470
1471 if (ops && ops->init) {1471 if (ops && ops->init) {
1472 ret = ops->init(dev);1472 ret = ops->init(dev);
1473 if (ret)1473 if (ret)
1474 goto err_free_bus;1474 goto err_deregister_fixed_link;
1475 }1475 }
1476 1476
1477 dev->netdev_ops = &nb8800_netdev_ops;1477 dev->netdev_ops = &nb8800_netdev_ops;
@@ -1504,6 +1504,9 @@ static int nb8800_probe(struct platform_device *pdev) · 26 unmodified lines
1504 1504
1505err_free_dma:1505err_free_dma:
1506 nb8800_dma_free(dev);1506 nb8800_dma_free(dev);
1507err_deregister_fixed_link:
1508 if (of_phy_is_fixed_link(pdev->dev.of_node))
1509 of_phy_deregister_fixed_link(pdev->dev.of_node);
1507err_free_bus:1510err_free_bus:
1508 of_node_put(priv->phy_node);1511 of_node_put(priv->phy_node);
1509 mdiobus_unregister(bus);1512 mdiobus_unregister(bus);
@@ -1521,6 +1524,8 @@ static int nb8800_remove(struct platform_device *pdev) · 11 unmodified lines
1521 struct nb8800_priv *priv = netdev_priv(ndev);1524 struct nb8800_priv *priv = netdev_priv(ndev);
1522 1525
1523 unregister_netdev(ndev);1526 unregister_netdev(ndev);
1527 if (of_phy_is_fixed_link(pdev->dev.of_node))
1528 of_phy_deregister_fixed_link(pdev->dev.of_node);
1524 of_node_put(priv->phy_node);1529 of_node_put(priv->phy_node);
1525 1530
1526 mdiobus_unregister(priv->mii_bus);1531 mdiobus_unregister(priv->mii_bus);
drivers/net/ethernet/broadcom/bcmsysport.c+12−5
@@ -1755,13 +1755,13 @@ static int bcm_sysport_probe(struct platform_device *pdev) · 1754 unmodified lines
1755 if (priv->irq0 <= 0 || priv->irq1 <= 0) {1755 if (priv->irq0 <= 0 || priv->irq1 <= 0) {
1756 dev_err(&pdev->dev, "invalid interrupts\n");1756 dev_err(&pdev->dev, "invalid interrupts\n");
1757 ret = -EINVAL;1757 ret = -EINVAL;
1758 goto err;1758 goto err_free_netdev;
1759 }1759 }
1760 1760
1761 priv->base = devm_ioremap_resource(&pdev->dev, r);1761 priv->base = devm_ioremap_resource(&pdev->dev, r);
1762 if (IS_ERR(priv->base)) {1762 if (IS_ERR(priv->base)) {
1763 ret = PTR_ERR(priv->base);1763 ret = PTR_ERR(priv->base);
1764 goto err;1764 goto err_free_netdev;
1765 }1765 }
1766 1766
1767 priv->netdev = dev;1767 priv->netdev = dev;
@@ -1779,7 +1779,7 @@ static int bcm_sysport_probe(struct platform_device *pdev) · 11 unmodified lines
1779 ret = of_phy_register_fixed_link(dn);1779 ret = of_phy_register_fixed_link(dn);
1780 if (ret) {1780 if (ret) {
1781 dev_err(&pdev->dev, "failed to register fixed PHY\n");1781 dev_err(&pdev->dev, "failed to register fixed PHY\n");
1782 goto err;1782 goto err_free_netdev;
1783 }1783 }
1784 1784
1785 priv->phy_dn = dn;1785 priv->phy_dn = dn;
@@ -1821,7 +1821,7 @@ static int bcm_sysport_probe(struct platform_device *pdev) · 35 unmodified lines
1821 ret = register_netdev(dev);1821 ret = register_netdev(dev);
1822 if (ret) {1822 if (ret) {
1823 dev_err(&pdev->dev, "failed to register net_device\n");1823 dev_err(&pdev->dev, "failed to register net_device\n");
1824 goto err;1824 goto err_deregister_fixed_link;
1825 }1825 }
1826 1826
1827 priv->rev = topctrl_readl(priv, REV_CNTL) & REV_MASK;1827 priv->rev = topctrl_readl(priv, REV_CNTL) & REV_MASK;
@@ -1832,7 +1832,11 @@ static int bcm_sysport_probe(struct platform_device *pdev) · 4 unmodified lines
1832 priv->base, priv->irq0, priv->irq1, txq, rxq);1832 priv->base, priv->irq0, priv->irq1, txq, rxq);
1833 1833
1834 return 0;1834 return 0;
1835err:1835
1836err_deregister_fixed_link:
1837 if (of_phy_is_fixed_link(dn))
1838 of_phy_deregister_fixed_link(dn);
1839err_free_netdev:
1836 free_netdev(dev);1840 free_netdev(dev);
1837 return ret;1841 return ret;
1838}1842}
@@ -1840,11 +1844,14 @@ err: · 1 unmodified line
1840static int bcm_sysport_remove(struct platform_device *pdev)1844static int bcm_sysport_remove(struct platform_device *pdev)
1841{1845{
1842 struct net_device *dev = dev_get_drvdata(&pdev->dev);1846 struct net_device *dev = dev_get_drvdata(&pdev->dev);
1847 struct device_node *dn = pdev->dev.of_node;
1843 1848
1844 /* Not much to do, ndo_close has been called1849 /* Not much to do, ndo_close has been called
1845 * and we use managed allocations1850 * and we use managed allocations
1846 */1851 */
1847 unregister_netdev(dev);1852 unregister_netdev(dev);
1853 if (of_phy_is_fixed_link(dn))
1854 of_phy_deregister_fixed_link(dn);
1848 free_netdev(dev);1855 free_netdev(dev);
1849 dev_set_drvdata(&pdev->dev, NULL);1856 dev_set_drvdata(&pdev->dev, NULL);
1850 1857
drivers/net/ethernet/broadcom/genet/bcmgenet.c+5−3
@@ -1172,6 +1172,7 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev, · 1171 unmodified lines
1172 struct bcmgenet_tx_ring *ring)1172 struct bcmgenet_tx_ring *ring)
1173{1173{
1174 struct bcmgenet_priv *priv = netdev_priv(dev);1174 struct bcmgenet_priv *priv = netdev_priv(dev);
1175 struct device *kdev = &priv->pdev->dev;
1175 struct enet_cb *tx_cb_ptr;1176 struct enet_cb *tx_cb_ptr;
1176 struct netdev_queue *txq;1177 struct netdev_queue *txq;
1177 unsigned int pkts_compl = 0;1178 unsigned int pkts_compl = 0;
@@ -1199,13 +1200,13 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev, · 21 unmodified lines
1199 if (tx_cb_ptr->skb) {1200 if (tx_cb_ptr->skb) {
1200 pkts_compl++;1201 pkts_compl++;
1201 bytes_compl += GENET_CB(tx_cb_ptr->skb)->bytes_sent;1202 bytes_compl += GENET_CB(tx_cb_ptr->skb)->bytes_sent;
1202 dma_unmap_single(&dev->dev,1203 dma_unmap_single(kdev,
1203 dma_unmap_addr(tx_cb_ptr, dma_addr),1204 dma_unmap_addr(tx_cb_ptr, dma_addr),
1204 dma_unmap_len(tx_cb_ptr, dma_len),1205 dma_unmap_len(tx_cb_ptr, dma_len),
1205 DMA_TO_DEVICE);1206 DMA_TO_DEVICE);
1206 bcmgenet_free_cb(tx_cb_ptr);1207 bcmgenet_free_cb(tx_cb_ptr);
1207 } else if (dma_unmap_addr(tx_cb_ptr, dma_addr)) {1208 } else if (dma_unmap_addr(tx_cb_ptr, dma_addr)) {
1208 dma_unmap_page(&dev->dev,1209 dma_unmap_page(kdev,
1209 dma_unmap_addr(tx_cb_ptr, dma_addr),1210 dma_unmap_addr(tx_cb_ptr, dma_addr),
1210 dma_unmap_len(tx_cb_ptr, dma_len),1211 dma_unmap_len(tx_cb_ptr, dma_len),
1211 DMA_TO_DEVICE);1212 DMA_TO_DEVICE);
@@ -1775,6 +1776,7 @@ static int bcmgenet_alloc_rx_buffers(struct bcmgenet_priv *priv, · 563 unmodified lines
1775 1776
1776static void bcmgenet_free_rx_buffers(struct bcmgenet_priv *priv)1777static void bcmgenet_free_rx_buffers(struct bcmgenet_priv *priv)
1777{1778{
1779 struct device *kdev = &priv->pdev->dev;
1778 struct enet_cb *cb;1780 struct enet_cb *cb;
1779 int i;1781 int i;
1780 1782
@@ -1782,7 +1784,7 @@ static void bcmgenet_free_rx_buffers(struct bcmgenet_priv *priv) · 1 unmodified line
1782 cb = &priv->rx_cbs[i];1784 cb = &priv->rx_cbs[i];
1783 1785
1784 if (dma_unmap_addr(cb, dma_addr)) {1786 if (dma_unmap_addr(cb, dma_addr)) {
1785 dma_unmap_single(&priv->dev->dev,1787 dma_unmap_single(kdev,
1786 dma_unmap_addr(cb, dma_addr),1788 dma_unmap_addr(cb, dma_addr),
1787 priv->rx_buf_len, DMA_FROM_DEVICE);1789 priv->rx_buf_len, DMA_FROM_DEVICE);
1788 dma_unmap_addr_set(cb, dma_addr, 0);1790 dma_unmap_addr_set(cb, dma_addr, 0);
drivers/net/ethernet/broadcom/genet/bcmmii.c+9−1
@@ -542,8 +542,10 @@ static int bcmgenet_mii_of_init(struct bcmgenet_priv *priv) · 541 unmodified lines
542 /* Make sure we initialize MoCA PHYs with a link down */542 /* Make sure we initialize MoCA PHYs with a link down */
543 if (phy_mode == PHY_INTERFACE_MODE_MOCA) {543 if (phy_mode == PHY_INTERFACE_MODE_MOCA) {
544 phydev = of_phy_find_device(dn);544 phydev = of_phy_find_device(dn);
545 if (phydev)545 if (phydev) {
546 phydev->link = 0;546 phydev->link = 0;
547 put_device(&phydev->mdio.dev);
548 }
547 }549 }
548 550
549 return 0;551 return 0;
@@ -625,6 +627,7 @@ static int bcmgenet_mii_bus_init(struct bcmgenet_priv *priv) · 75 unmodified lines
625int bcmgenet_mii_init(struct net_device *dev)627int bcmgenet_mii_init(struct net_device *dev)
626{628{
627 struct bcmgenet_priv *priv = netdev_priv(dev);629 struct bcmgenet_priv *priv = netdev_priv(dev);
630 struct device_node *dn = priv->pdev->dev.of_node;
628 int ret;631 int ret;
629 632
630 ret = bcmgenet_mii_alloc(priv);633 ret = bcmgenet_mii_alloc(priv);
@@ -638,6 +641,8 @@ int bcmgenet_mii_init(struct net_device *dev) · 7 unmodified lines
638 return 0;641 return 0;
639 642
640out:643out:
644 if (of_phy_is_fixed_link(dn))
645 of_phy_deregister_fixed_link(dn);
641 of_node_put(priv->phy_dn);646 of_node_put(priv->phy_dn);
642 mdiobus_unregister(priv->mii_bus);647 mdiobus_unregister(priv->mii_bus);
643 mdiobus_free(priv->mii_bus);648 mdiobus_free(priv->mii_bus);
@@ -647,7 +652,10 @@ out: · 3 unmodified lines
647void bcmgenet_mii_exit(struct net_device *dev)652void bcmgenet_mii_exit(struct net_device *dev)
648{653{
649 struct bcmgenet_priv *priv = netdev_priv(dev);654 struct bcmgenet_priv *priv = netdev_priv(dev);
655 struct device_node *dn = priv->pdev->dev.of_node;
650 656
657 if (of_phy_is_fixed_link(dn))
658 of_phy_deregister_fixed_link(dn);
651 of_node_put(priv->phy_dn);659 of_node_put(priv->phy_dn);
652 mdiobus_unregister(priv->mii_bus);660 mdiobus_unregister(priv->mii_bus);
653 mdiobus_free(priv->mii_bus);661 mdiobus_free(priv->mii_bus);
drivers/net/ethernet/cadence/macb.c+3−2
@@ -975,6 +975,7 @@ static inline void macb_init_rx_ring(struct macb *bp) · 974 unmodified lines
975 addr += bp->rx_buffer_size;975 addr += bp->rx_buffer_size;
976 }976 }
977 bp->rx_ring[RX_RING_SIZE - 1].addr |= MACB_BIT(RX_WRAP);977 bp->rx_ring[RX_RING_SIZE - 1].addr |= MACB_BIT(RX_WRAP);
978 bp->rx_tail = 0;
978}979}
979 980
980static int macb_rx(struct macb *bp, int budget)981static int macb_rx(struct macb *bp, int budget)
@@ -1156,6 +1157,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) · 175 unmodified lines
1156 if (status & MACB_BIT(RXUBR)) {1157 if (status & MACB_BIT(RXUBR)) {
1157 ctrl = macb_readl(bp, NCR);1158 ctrl = macb_readl(bp, NCR);
1158 macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE));1159 macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE));
1160 wmb();
1159 macb_writel(bp, NCR, ctrl | MACB_BIT(RE));1161 macb_writel(bp, NCR, ctrl | MACB_BIT(RE));
1160 1162
1161 if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)1163 if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
@@ -1616,8 +1618,6 @@ static void macb_init_rings(struct macb *bp) · 454 unmodified lines
1616 bp->queues[0].tx_head = 0;1618 bp->queues[0].tx_head = 0;
1617 bp->queues[0].tx_tail = 0;1619 bp->queues[0].tx_tail = 0;
1618 bp->queues[0].tx_ring[TX_RING_SIZE - 1].ctrl |= MACB_BIT(TX_WRAP);1620 bp->queues[0].tx_ring[TX_RING_SIZE - 1].ctrl |= MACB_BIT(TX_WRAP);
1619
1620 bp->rx_tail = 0;
1621}1621}
1622 1622
1623static void macb_reset_hw(struct macb *bp)1623static void macb_reset_hw(struct macb *bp)
@@ -2770,6 +2770,7 @@ static irqreturn_t at91ether_interrupt(int irq, void *dev_id) · 1146 unmodified lines
2770 if (intstatus & MACB_BIT(RXUBR)) {2770 if (intstatus & MACB_BIT(RXUBR)) {
2771 ctl = macb_readl(lp, NCR);2771 ctl = macb_readl(lp, NCR);
2772 macb_writel(lp, NCR, ctl & ~MACB_BIT(RE));2772 macb_writel(lp, NCR, ctl & ~MACB_BIT(RE));
2773 wmb();
2773 macb_writel(lp, NCR, ctl | MACB_BIT(RE));2774 macb_writel(lp, NCR, ctl | MACB_BIT(RE));
2774 }2775 }
2775 2776
drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h+1−0
@@ -168,6 +168,7 @@ CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN · 167 unmodified lines
168 CH_PCI_ID_TABLE_FENTRY(0x509a), /* Custom T520-CR */168 CH_PCI_ID_TABLE_FENTRY(0x509a), /* Custom T520-CR */
169 CH_PCI_ID_TABLE_FENTRY(0x509b), /* Custom T540-CR LOM */169 CH_PCI_ID_TABLE_FENTRY(0x509b), /* Custom T540-CR LOM */
170 CH_PCI_ID_TABLE_FENTRY(0x509c), /* Custom T520-CR*/170 CH_PCI_ID_TABLE_FENTRY(0x509c), /* Custom T520-CR*/
171 CH_PCI_ID_TABLE_FENTRY(0x509d), /* Custom T540-CR*/
171 172
172 /* T6 adapters:173 /* T6 adapters:
173 */174 */
drivers/net/ethernet/freescale/fec.h+2−0
@@ -574,6 +574,8 @@ struct fec_enet_private { · 573 unmodified lines
574 unsigned int reload_period;574 unsigned int reload_period;
575 int pps_enable;575 int pps_enable;
576 unsigned int next_counter;576 unsigned int next_counter;
577
578 u64 ethtool_stats[0];
577};579};
578 580
579void fec_ptp_init(struct platform_device *pdev);581void fec_ptp_init(struct platform_device *pdev);
drivers/net/ethernet/freescale/fec_main.c+24−4
@@ -2313,14 +2313,24 @@ static const struct fec_stat { · 2312 unmodified lines
2313 { "IEEE_rx_octets_ok", IEEE_R_OCTETS_OK },2313 { "IEEE_rx_octets_ok", IEEE_R_OCTETS_OK },
2314};2314};
2315 2315
2316static void fec_enet_get_ethtool_stats(struct net_device *dev,2316static void fec_enet_update_ethtool_stats(struct net_device *dev)
2317 struct ethtool_stats *stats, u64 *data)
2318{2317{
2319 struct fec_enet_private *fep = netdev_priv(dev);2318 struct fec_enet_private *fep = netdev_priv(dev);
2320 int i;2319 int i;
2321 2320
2322 for (i = 0; i < ARRAY_SIZE(fec_stats); i++)2321 for (i = 0; i < ARRAY_SIZE(fec_stats); i++)
2323 data[i] = readl(fep->hwp + fec_stats[i].offset);2322 fep->ethtool_stats[i] = readl(fep->hwp + fec_stats[i].offset);
2323}
2324
2325static void fec_enet_get_ethtool_stats(struct net_device *dev,
2326 struct ethtool_stats *stats, u64 *data)
2327{
2328 struct fec_enet_private *fep = netdev_priv(dev);
2329
2330 if (netif_running(dev))
2331 fec_enet_update_ethtool_stats(dev);
2332
2333 memcpy(data, fep->ethtool_stats, ARRAY_SIZE(fec_stats) * sizeof(u64));
2324}2334}
2325 2335
2326static void fec_enet_get_strings(struct net_device *netdev,2336static void fec_enet_get_strings(struct net_device *netdev,
@@ -2874,6 +2884,8 @@ fec_enet_close(struct net_device *ndev) · 547 unmodified lines
2874 if (fep->quirks & FEC_QUIRK_ERR006687)2884 if (fep->quirks & FEC_QUIRK_ERR006687)
2875 imx6q_cpuidle_fec_irqs_unused();2885 imx6q_cpuidle_fec_irqs_unused();
2876 2886
2887 fec_enet_update_ethtool_stats(ndev);
2888
2877 fec_enet_clk_enable(ndev, false);2889 fec_enet_clk_enable(ndev, false);
2878 pinctrl_pm_select_sleep_state(&fep->pdev->dev);2890 pinctrl_pm_select_sleep_state(&fep->pdev->dev);
2879 pm_runtime_mark_last_busy(&fep->pdev->dev);2891 pm_runtime_mark_last_busy(&fep->pdev->dev);
@@ -3180,6 +3192,8 @@ static int fec_enet_init(struct net_device *ndev) · 300 unmodified lines
3180 3192
3181 fec_restart(ndev);3193 fec_restart(ndev);
3182 3194
3195 fec_enet_update_ethtool_stats(ndev);
3196
3183 return 0;3197 return 0;
3184}3198}
3185 3199
@@ -3278,7 +3292,8 @@ fec_probe(struct platform_device *pdev) · 92 unmodified lines
3278 fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs);3292 fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs);
3279 3293
3280 /* Init network device */3294 /* Init network device */
3281 ndev = alloc_etherdev_mqs(sizeof(struct fec_enet_private),3295 ndev = alloc_etherdev_mqs(sizeof(struct fec_enet_private) +
3296 ARRAY_SIZE(fec_stats) * sizeof(u64),
3282 num_tx_qs, num_rx_qs);3297 num_tx_qs, num_rx_qs);
3283 if (!ndev)3298 if (!ndev)
3284 return -ENOMEM;3299 return -ENOMEM;
@@ -3475,6 +3490,8 @@ failed_regulator: · 190 unmodified lines
3475failed_clk_ipg:3490failed_clk_ipg:
3476 fec_enet_clk_enable(ndev, false);3491 fec_enet_clk_enable(ndev, false);
3477failed_clk:3492failed_clk:
3493 if (of_phy_is_fixed_link(np))
3494 of_phy_deregister_fixed_link(np);
3478failed_phy:3495failed_phy:
3479 of_node_put(phy_node);3496 of_node_put(phy_node);
3480failed_ioremap:3497failed_ioremap:
@@ -3488,6 +3505,7 @@ fec_drv_remove(struct platform_device *pdev) · 7 unmodified lines
3488{3505{
3489 struct net_device *ndev = platform_get_drvdata(pdev);3506 struct net_device *ndev = platform_get_drvdata(pdev);
3490 struct fec_enet_private *fep = netdev_priv(ndev);3507 struct fec_enet_private *fep = netdev_priv(ndev);
3508 struct device_node *np = pdev->dev.of_node;
3491 3509
3492 cancel_work_sync(&fep->tx_timeout_work);3510 cancel_work_sync(&fep->tx_timeout_work);
3493 fec_ptp_stop(pdev);3511 fec_ptp_stop(pdev);
@@ -3495,6 +3513,8 @@ fec_drv_remove(struct platform_device *pdev) · 1 unmodified line
3495 fec_enet_mii_remove(fep);3513 fec_enet_mii_remove(fep);
3496 if (fep->reg_phy)3514 if (fep->reg_phy)
3497 regulator_disable(fep->reg_phy);3515 regulator_disable(fep->reg_phy);
3516 if (of_phy_is_fixed_link(np))
3517 of_phy_deregister_fixed_link(np);
3498 of_node_put(fep->phy_node);3518 of_node_put(fep->phy_node);
3499 free_netdev(ndev);3519 free_netdev(ndev);
3500 3520
drivers/net/ethernet/freescale/fman/fman_memac.c+3−0
@@ -1107,6 +1107,9 @@ int memac_free(struct fman_mac *memac) · 1106 unmodified lines
1107{1107{
1108 free_init_resources(memac);1108 free_init_resources(memac);
1109 1109
1110 if (memac->pcsphy)
1111 put_device(&memac->pcsphy->mdio.dev);
1112
1110 kfree(memac->memac_drv_param);1113 kfree(memac->memac_drv_param);
1111 kfree(memac);1114 kfree(memac);
1112 1115
drivers/net/ethernet/freescale/fman/mac.c+2−0
@@ -892,6 +892,8 @@ static int mac_probe(struct platform_device *_of_dev) · 891 unmodified lines
892 priv->fixed_link->duplex = phy->duplex;892 priv->fixed_link->duplex = phy->duplex;
893 priv->fixed_link->pause = phy->pause;893 priv->fixed_link->pause = phy->pause;
894 priv->fixed_link->asym_pause = phy->asym_pause;894 priv->fixed_link->asym_pause = phy->asym_pause;
895
896 put_device(&phy->mdio.dev);
895 }897 }
896 898
897 err = mac_dev->init(mac_dev);899 err = mac_dev->init(mac_dev);
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c+6−1
@@ -980,7 +980,7 @@ static int fs_enet_probe(struct platform_device *ofdev) · 979 unmodified lines
980 err = clk_prepare_enable(clk);980 err = clk_prepare_enable(clk);
981 if (err) {981 if (err) {
982 ret = err;982 ret = err;
983 goto out_free_fpi;983 goto out_deregister_fixed_link;
984 }984 }
985 fpi->clk_per = clk;985 fpi->clk_per = clk;
986 }986 }
@@ -1061,6 +1061,9 @@ out_put: · 74 unmodified lines
1061 of_node_put(fpi->phy_node);1061 of_node_put(fpi->phy_node);
1062 if (fpi->clk_per)1062 if (fpi->clk_per)
1063 clk_disable_unprepare(fpi->clk_per);1063 clk_disable_unprepare(fpi->clk_per);
1064out_deregister_fixed_link:
1065 if (of_phy_is_fixed_link(ofdev->dev.of_node))
1066 of_phy_deregister_fixed_link(ofdev->dev.of_node);
1064out_free_fpi:1067out_free_fpi:
1065 kfree(fpi);1068 kfree(fpi);
1066 return ret;1069 return ret;
@@ -1079,6 +1082,8 @@ static int fs_enet_remove(struct platform_device *ofdev) · 12 unmodified lines
1079 of_node_put(fep->fpi->phy_node);1082 of_node_put(fep->fpi->phy_node);
1080 if (fep->fpi->clk_per)1083 if (fep->fpi->clk_per)
1081 clk_disable_unprepare(fep->fpi->clk_per);1084 clk_disable_unprepare(fep->fpi->clk_per);
1085 if (of_phy_is_fixed_link(ofdev->dev.of_node))
1086 of_phy_deregister_fixed_link(ofdev->dev.of_node);
1082 free_netdev(ndev);1087 free_netdev(ndev);
1083 return 0;1088 return 0;
1084}1089}
drivers/net/ethernet/freescale/gianfar.c+8−0
@@ -1312,6 +1312,7 @@ static void gfar_init_addr_hash_table(struct gfar_private *priv) · 1311 unmodified lines
1312 */1312 */
1313static int gfar_probe(struct platform_device *ofdev)1313static int gfar_probe(struct platform_device *ofdev)
1314{1314{
1315 struct device_node *np = ofdev->dev.of_node;
1315 struct net_device *dev = NULL;1316 struct net_device *dev = NULL;
1316 struct gfar_private *priv = NULL;1317 struct gfar_private *priv = NULL;
1317 int err = 0, i;1318 int err = 0, i;
@@ -1462,6 +1463,8 @@ static int gfar_probe(struct platform_device *ofdev) · 144 unmodified lines
1462 return 0;1463 return 0;
1463 1464
1464register_fail:1465register_fail:
1466 if (of_phy_is_fixed_link(np))
1467 of_phy_deregister_fixed_link(np);
1465 unmap_group_regs(priv);1468 unmap_group_regs(priv);
1466 gfar_free_rx_queues(priv);1469 gfar_free_rx_queues(priv);
1467 gfar_free_tx_queues(priv);1470 gfar_free_tx_queues(priv);
@@ -1474,11 +1477,16 @@ register_fail: · 6 unmodified lines
1474static int gfar_remove(struct platform_device *ofdev)1477static int gfar_remove(struct platform_device *ofdev)
1475{1478{
1476 struct gfar_private *priv = platform_get_drvdata(ofdev);1479 struct gfar_private *priv = platform_get_drvdata(ofdev);
1480 struct device_node *np = ofdev->dev.of_node;
1477 1481
1478 of_node_put(priv->phy_node);1482 of_node_put(priv->phy_node);
1479 of_node_put(priv->tbi_node);1483 of_node_put(priv->tbi_node);
1480 1484
1481 unregister_netdev(priv->ndev);1485 unregister_netdev(priv->ndev);
1486
1487 if (of_phy_is_fixed_link(np))
1488 of_phy_deregister_fixed_link(np);
1489
1482 unmap_group_regs(priv);1490 unmap_group_regs(priv);
1483 gfar_free_rx_queues(priv);1491 gfar_free_rx_queues(priv);
1484 gfar_free_tx_queues(priv);1492 gfar_free_tx_queues(priv);
drivers/net/ethernet/freescale/ucc_geth.c+16−7
@@ -3868,9 +3868,8 @@ static int ucc_geth_probe(struct platform_device* ofdev) · 3867 unmodified lines
3868 dev = alloc_etherdev(sizeof(*ugeth));3868 dev = alloc_etherdev(sizeof(*ugeth));
3869 3869
3870 if (dev == NULL) {3870 if (dev == NULL) {
3871 of_node_put(ug_info->tbi_node);3871 err = -ENOMEM;
3872 of_node_put(ug_info->phy_node);3872 goto err_deregister_fixed_link;
3873 return -ENOMEM;
3874 }3873 }
3875 3874
3876 ugeth = netdev_priv(dev);3875 ugeth = netdev_priv(dev);
@@ -3907,10 +3906,7 @@ static int ucc_geth_probe(struct platform_device* ofdev) · 30 unmodified lines
3907 if (netif_msg_probe(ugeth))3906 if (netif_msg_probe(ugeth))
3908 pr_err("%s: Cannot register net device, aborting\n",3907 pr_err("%s: Cannot register net device, aborting\n",
3909 dev->name);3908 dev->name);
3910 free_netdev(dev);3909 goto err_free_netdev;
3911 of_node_put(ug_info->tbi_node);
3912 of_node_put(ug_info->phy_node);
3913 return err;
3914 }3910 }
3915 3911
3916 mac_addr = of_get_mac_address(np);3912 mac_addr = of_get_mac_address(np);
@@ -3923,16 +3919,29 @@ static int ucc_geth_probe(struct platform_device* ofdev) · 6 unmodified lines
3923 ugeth->node = np;3919 ugeth->node = np;
3924 3920
3925 return 0;3921 return 0;
3922
3923err_free_netdev:
3924 free_netdev(dev);
3925err_deregister_fixed_link:
3926 if (of_phy_is_fixed_link(np))
3927 of_phy_deregister_fixed_link(np);
3928 of_node_put(ug_info->tbi_node);
3929 of_node_put(ug_info->phy_node);
3930
3931 return err;
3926}3932}
3927 3933
3928static int ucc_geth_remove(struct platform_device* ofdev)3934static int ucc_geth_remove(struct platform_device* ofdev)
3929{3935{
3930 struct net_device *dev = platform_get_drvdata(ofdev);3936 struct net_device *dev = platform_get_drvdata(ofdev);
3931 struct ucc_geth_private *ugeth = netdev_priv(dev);3937 struct ucc_geth_private *ugeth = netdev_priv(dev);
3938 struct device_node *np = ofdev->dev.of_node;
3932 3939
3933 unregister_netdev(dev);3940 unregister_netdev(dev);
3934 free_netdev(dev);3941 free_netdev(dev);
3935 ucc_geth_memclean(ugeth);3942 ucc_geth_memclean(ugeth);
3943 if (of_phy_is_fixed_link(np))
3944 of_phy_deregister_fixed_link(np);
3936 of_node_put(ugeth->ug_info->tbi_node);3945 of_node_put(ugeth->ug_info->tbi_node);
3937 of_node_put(ugeth->ug_info->phy_node);3946 of_node_put(ugeth->ug_info->phy_node);
3938 3947
drivers/net/ethernet/intel/igb/igb_main.c+6−2
@@ -4931,11 +4931,15 @@ static int igb_tso(struct igb_ring *tx_ring, · 4930 unmodified lines
4931 4931
4932 /* initialize outer IP header fields */4932 /* initialize outer IP header fields */
4933 if (ip.v4->version == 4) {4933 if (ip.v4->version == 4) {
4934 unsigned char *csum_start = skb_checksum_start(skb);
4935 unsigned char *trans_start = ip.hdr + (ip.v4->ihl * 4);
4936
4934 /* IP header will have to cancel out any data that4937 /* IP header will have to cancel out any data that
4935 * is not a part of the outer IP header4938 * is not a part of the outer IP header
4936 */4939 */
4937 ip.v4->check = csum_fold(csum_add(lco_csum(skb),4940 ip.v4->check = csum_fold(csum_partial(trans_start,
4938 csum_unfold(l4.tcp->check)));4941 csum_start - trans_start,
4942 0));
4939 type_tucmd |= E1000_ADVTXD_TUCMD_IPV4;4943 type_tucmd |= E1000_ADVTXD_TUCMD_IPV4;
4940 4944
4941 ip.v4->tot_len = 0;4945 ip.v4->tot_len = 0;
drivers/net/ethernet/intel/igbvf/netdev.c+6−2
@@ -1965,11 +1965,15 @@ static int igbvf_tso(struct igbvf_ring *tx_ring, · 1964 unmodified lines
1965 1965
1966 /* initialize outer IP header fields */1966 /* initialize outer IP header fields */
1967 if (ip.v4->version == 4) {1967 if (ip.v4->version == 4) {
1968 unsigned char *csum_start = skb_checksum_start(skb);
1969 unsigned char *trans_start = ip.hdr + (ip.v4->ihl * 4);
1970
1968 /* IP header will have to cancel out any data that1971 /* IP header will have to cancel out any data that
1969 * is not a part of the outer IP header1972 * is not a part of the outer IP header
1970 */1973 */
1971 ip.v4->check = csum_fold(csum_add(lco_csum(skb),1974 ip.v4->check = csum_fold(csum_partial(trans_start,
1972 csum_unfold(l4.tcp->check)));1975 csum_start - trans_start,
1976 0));
1973 type_tucmd |= E1000_ADVTXD_TUCMD_IPV4;1977 type_tucmd |= E1000_ADVTXD_TUCMD_IPV4;
1974 1978
1975 ip.v4->tot_len = 0;1979 ip.v4->tot_len = 0;
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+6−2
@@ -7277,11 +7277,15 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring, · 7276 unmodified lines
7277 7277
7278 /* initialize outer IP header fields */7278 /* initialize outer IP header fields */
7279 if (ip.v4->version == 4) {7279 if (ip.v4->version == 4) {
7280 unsigned char *csum_start = skb_checksum_start(skb);
7281 unsigned char *trans_start = ip.hdr + (ip.v4->ihl * 4);
7282
7280 /* IP header will have to cancel out any data that7283 /* IP header will have to cancel out any data that
7281 * is not a part of the outer IP header7284 * is not a part of the outer IP header
7282 */7285 */
7283 ip.v4->check = csum_fold(csum_add(lco_csum(skb),7286 ip.v4->check = csum_fold(csum_partial(trans_start,
7284 csum_unfold(l4.tcp->check)));7287 csum_start - trans_start,
7288 0));
7285 type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4;7289 type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4;
7286 7290
7287 ip.v4->tot_len = 0;7291 ip.v4->tot_len = 0;
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c+6−2
@@ -3329,11 +3329,15 @@ static int ixgbevf_tso(struct ixgbevf_ring *tx_ring, · 3328 unmodified lines
3329 3329
3330 /* initialize outer IP header fields */3330 /* initialize outer IP header fields */
3331 if (ip.v4->version == 4) {3331 if (ip.v4->version == 4) {
3332 unsigned char *csum_start = skb_checksum_start(skb);
3333 unsigned char *trans_start = ip.hdr + (ip.v4->ihl * 4);
3334
3332 /* IP header will have to cancel out any data that3335 /* IP header will have to cancel out any data that
3333 * is not a part of the outer IP header3336 * is not a part of the outer IP header
3334 */3337 */
3335 ip.v4->check = csum_fold(csum_add(lco_csum(skb),3338 ip.v4->check = csum_fold(csum_partial(trans_start,
3336 csum_unfold(l4.tcp->check)));3339 csum_start - trans_start,
3340 0));
3337 type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4;3341 type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4;
3338 3342
3339 ip.v4->tot_len = 0;3343 ip.v4->tot_len = 0;
drivers/net/ethernet/marvell/mvneta.c+5−0
@@ -4191,6 +4191,8 @@ err_clk: · 4190 unmodified lines
4191 clk_disable_unprepare(pp->clk);4191 clk_disable_unprepare(pp->clk);
4192err_put_phy_node:4192err_put_phy_node:
4193 of_node_put(phy_node);4193 of_node_put(phy_node);
4194 if (of_phy_is_fixed_link(dn))
4195 of_phy_deregister_fixed_link(dn);
4194err_free_irq:4196err_free_irq:
4195 irq_dispose_mapping(dev->irq);4197 irq_dispose_mapping(dev->irq);
4196err_free_netdev:4198err_free_netdev:
@@ -4202,6 +4204,7 @@ err_free_netdev: · 5 unmodified lines
4202static int mvneta_remove(struct platform_device *pdev)4204static int mvneta_remove(struct platform_device *pdev)
4203{4205{
4204 struct net_device *dev = platform_get_drvdata(pdev);4206 struct net_device *dev = platform_get_drvdata(pdev);
4207 struct device_node *dn = pdev->dev.of_node;
4205 struct mvneta_port *pp = netdev_priv(dev);4208 struct mvneta_port *pp = netdev_priv(dev);
4206 4209
4207 unregister_netdev(dev);4210 unregister_netdev(dev);
@@ -4209,6 +4212,8 @@ static int mvneta_remove(struct platform_device *pdev) · 1 unmodified line
4209 clk_disable_unprepare(pp->clk);4212 clk_disable_unprepare(pp->clk);
4210 free_percpu(pp->ports);4213 free_percpu(pp->ports);
4211 free_percpu(pp->stats);4214 free_percpu(pp->stats);
4215 if (of_phy_is_fixed_link(dn))
4216 of_phy_deregister_fixed_link(dn);
4212 irq_dispose_mapping(dev->irq);4217 irq_dispose_mapping(dev->irq);
4213 of_node_put(pp->phy_node);4218 of_node_put(pp->phy_node);
4214 free_netdev(dev);4219 free_netdev(dev);
drivers/net/ethernet/mediatek/mtk_eth_soc.c+4−0
@@ -318,6 +318,8 @@ static int mtk_phy_connect(struct net_device *dev) · 317 unmodified lines
318 return 0;318 return 0;
319 319
320err_phy:320err_phy:
321 if (of_phy_is_fixed_link(mac->of_node))
322 of_phy_deregister_fixed_link(mac->of_node);
321 of_node_put(np);323 of_node_put(np);
322 dev_err(eth->dev, "%s: invalid phy\n", __func__);324 dev_err(eth->dev, "%s: invalid phy\n", __func__);
323 return -EINVAL;325 return -EINVAL;
@@ -1923,6 +1925,8 @@ static void mtk_uninit(struct net_device *dev) · 1599 unmodified lines
1923 struct mtk_eth *eth = mac->hw;1925 struct mtk_eth *eth = mac->hw;
1924 1926
1925 phy_disconnect(dev->phydev);1927 phy_disconnect(dev->phydev);
1928 if (of_phy_is_fixed_link(mac->of_node))
1929 of_phy_deregister_fixed_link(mac->of_node);
1926 mtk_irq_disable(eth, MTK_QDMA_INT_MASK, ~0);1930 mtk_irq_disable(eth, MTK_QDMA_INT_MASK, ~0);
1927 mtk_irq_disable(eth, MTK_PDMA_INT_MASK, ~0);1931 mtk_irq_disable(eth, MTK_PDMA_INT_MASK, ~0);
1928}1932}
drivers/net/ethernet/mellanox/mlx4/en_netdev.c+2−15
@@ -2079,13 +2079,6 @@ err: · 2078 unmodified lines
2079 return -ENOMEM;2079 return -ENOMEM;
2080}2080}
2081 2081
2082static void mlx4_en_shutdown(struct net_device *dev)
2083{
2084 rtnl_lock();
2085 netif_device_detach(dev);
2086 mlx4_en_close(dev);
2087 rtnl_unlock();
2088}
2089 2082
2090static int mlx4_en_copy_priv(struct mlx4_en_priv *dst,2083static int mlx4_en_copy_priv(struct mlx4_en_priv *dst,
2091 struct mlx4_en_priv *src,2084 struct mlx4_en_priv *src,
@@ -2162,8 +2155,6 @@ void mlx4_en_destroy_netdev(struct net_device *dev) · 70 unmodified lines
2162{2155{
2163 struct mlx4_en_priv *priv = netdev_priv(dev);2156 struct mlx4_en_priv *priv = netdev_priv(dev);
2164 struct mlx4_en_dev *mdev = priv->mdev;2157 struct mlx4_en_dev *mdev = priv->mdev;
2165 bool shutdown = mdev->dev->persist->interface_state &
2166 MLX4_INTERFACE_STATE_SHUTDOWN;
2167 2158
2168 en_dbg(DRV, priv, "Destroying netdev on port:%d\n", priv->port);2159 en_dbg(DRV, priv, "Destroying netdev on port:%d\n", priv->port);
2169 2160
@@ -2171,10 +2162,7 @@ void mlx4_en_destroy_netdev(struct net_device *dev) · 1 unmodified line
2171 if (priv->registered) {2162 if (priv->registered) {
2172 devlink_port_type_clear(mlx4_get_devlink_port(mdev->dev,2163 devlink_port_type_clear(mlx4_get_devlink_port(mdev->dev,
2173 priv->port));2164 priv->port));
2174 if (shutdown)2165 unregister_netdev(dev);
2175 mlx4_en_shutdown(dev);
2176 else
2177 unregister_netdev(dev);
2178 }2166 }
2179 2167
2180 if (priv->allocated)2168 if (priv->allocated)
@@ -2203,8 +2191,7 @@ void mlx4_en_destroy_netdev(struct net_device *dev) · 22 unmodified lines
2203 kfree(priv->tx_ring);2191 kfree(priv->tx_ring);
2204 kfree(priv->tx_cq);2192 kfree(priv->tx_cq);
2205 2193
2206 if (!shutdown)2194 free_netdev(dev);
2207 free_netdev(dev);
2208}2195}
2209 2196
2210static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)2197static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)
drivers/net/ethernet/mellanox/mlx4/main.c+1−4
@@ -4147,11 +4147,8 @@ static void mlx4_shutdown(struct pci_dev *pdev) · 4146 unmodified lines
4147 4147
4148 mlx4_info(persist->dev, "mlx4_shutdown was called\n");4148 mlx4_info(persist->dev, "mlx4_shutdown was called\n");
4149 mutex_lock(&persist->interface_state_mutex);4149 mutex_lock(&persist->interface_state_mutex);
4150 if (persist->interface_state & MLX4_INTERFACE_STATE_UP) {4150 if (persist->interface_state & MLX4_INTERFACE_STATE_UP)
4151 /* Notify mlx4 clients that the kernel is being shut down */
4152 persist->interface_state |= MLX4_INTERFACE_STATE_SHUTDOWN;
4153 mlx4_unload_one(pdev);4151 mlx4_unload_one(pdev);
4154 }
4155 mutex_unlock(&persist->interface_state_mutex);4152 mutex_unlock(&persist->interface_state_mutex);
4156}4153}
4157 4154
drivers/net/ethernet/mellanox/mlx4/mcg.c+6−1
@@ -1457,7 +1457,12 @@ EXPORT_SYMBOL_GPL(mlx4_multicast_detach); · 1456 unmodified lines
1457int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port,1457int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port,
1458 u32 qpn, enum mlx4_net_trans_promisc_mode mode)1458 u32 qpn, enum mlx4_net_trans_promisc_mode mode)
1459{1459{
1460 struct mlx4_net_trans_rule rule;1460 struct mlx4_net_trans_rule rule = {
1461 .queue_mode = MLX4_NET_TRANS_Q_FIFO,
1462 .exclusive = 0,
1463 .allow_loopback = 1,
1464 };
1465
1461 u64 *regid_p;1466 u64 *regid_p;
1462 1467
1463 switch (mode) {1468 switch (mode) {
drivers/net/ethernet/qualcomm/emac/emac-phy.c+1−0
@@ -212,6 +212,7 @@ int emac_phy_config(struct platform_device *pdev, struct emac_adapter *adpt) · 211 unmodified lines
212 212
213 phy_np = of_parse_phandle(np, "phy-handle", 0);213 phy_np = of_parse_phandle(np, "phy-handle", 0);
214 adpt->phydev = of_phy_find_device(phy_np);214 adpt->phydev = of_phy_find_device(phy_np);
215 of_node_put(phy_np);
215 }216 }
216 217
217 if (!adpt->phydev) {218 if (!adpt->phydev) {
drivers/net/ethernet/qualcomm/emac/emac.c+4−0
@@ -711,6 +711,8 @@ static int emac_probe(struct platform_device *pdev) · 710 unmodified lines
711err_undo_napi:711err_undo_napi:
712 netif_napi_del(&adpt->rx_q.napi);712 netif_napi_del(&adpt->rx_q.napi);
713err_undo_mdiobus:713err_undo_mdiobus:
714 if (!has_acpi_companion(&pdev->dev))
715 put_device(&adpt->phydev->mdio.dev);
714 mdiobus_unregister(adpt->mii_bus);716 mdiobus_unregister(adpt->mii_bus);
715err_undo_clocks:717err_undo_clocks:
716 emac_clks_teardown(adpt);718 emac_clks_teardown(adpt);
@@ -730,6 +732,8 @@ static int emac_remove(struct platform_device *pdev) · 13 unmodified lines
730 732
731 emac_clks_teardown(adpt);733 emac_clks_teardown(adpt);
732 734
735 if (!has_acpi_companion(&pdev->dev))
736 put_device(&adpt->phydev->mdio.dev);
733 mdiobus_unregister(adpt->mii_bus);737 mdiobus_unregister(adpt->mii_bus);
734 free_netdev(netdev);738 free_netdev(netdev);
735 739
drivers/net/ethernet/renesas/ravb_main.c+14−5
@@ -1008,20 +1008,18 @@ static int ravb_phy_init(struct net_device *ndev) · 1007 unmodified lines
1008 of_node_put(pn);1008 of_node_put(pn);
1009 if (!phydev) {1009 if (!phydev) {
1010 netdev_err(ndev, "failed to connect PHY\n");1010 netdev_err(ndev, "failed to connect PHY\n");
1011 return -ENOENT;1011 err = -ENOENT;
1012 goto err_deregister_fixed_link;
1012 }1013 }
1013 1014
1014 /* This driver only support 10/100Mbit speeds on Gen31015 /* This driver only support 10/100Mbit speeds on Gen3
1015 * at this time.1016 * at this time.
1016 */1017 */
1017 if (priv->chip_id == RCAR_GEN3) {1018 if (priv->chip_id == RCAR_GEN3) {
1018 int err;
1019
1020 err = phy_set_max_speed(phydev, SPEED_100);1019 err = phy_set_max_speed(phydev, SPEED_100);
1021 if (err) {1020 if (err) {
1022 netdev_err(ndev, "failed to limit PHY to 100Mbit/s\n");1021 netdev_err(ndev, "failed to limit PHY to 100Mbit/s\n");
1023 phy_disconnect(phydev);1022 goto err_phy_disconnect;
1024 return err;
1025 }1023 }
1026 1024
1027 netdev_info(ndev, "limited PHY to 100Mbit/s\n");1025 netdev_info(ndev, "limited PHY to 100Mbit/s\n");
@@ -1033,6 +1031,14 @@ static int ravb_phy_init(struct net_device *ndev) · 5 unmodified lines
1033 phy_attached_info(phydev);1031 phy_attached_info(phydev);
1034 1032
1035 return 0;1033 return 0;
1034
1035err_phy_disconnect:
1036 phy_disconnect(phydev);
1037err_deregister_fixed_link:
1038 if (of_phy_is_fixed_link(np))
1039 of_phy_deregister_fixed_link(np);
1040
1041 return err;
1036}1042}
1037 1043
1038/* PHY control start function */1044/* PHY control start function */
@@ -1634,6 +1640,7 @@ static void ravb_set_rx_mode(struct net_device *ndev) · 595 unmodified lines
1634/* Device close function for Ethernet AVB */1640/* Device close function for Ethernet AVB */
1635static int ravb_close(struct net_device *ndev)1641static int ravb_close(struct net_device *ndev)
1636{1642{
1643 struct device_node *np = ndev->dev.parent->of_node;
1637 struct ravb_private *priv = netdev_priv(ndev);1644 struct ravb_private *priv = netdev_priv(ndev);
1638 struct ravb_tstamp_skb *ts_skb, *ts_skb2;1645 struct ravb_tstamp_skb *ts_skb, *ts_skb2;
1639 1646
@@ -1663,6 +1670,8 @@ static int ravb_close(struct net_device *ndev) · 23 unmodified lines
1663 if (ndev->phydev) {1670 if (ndev->phydev) {
1664 phy_stop(ndev->phydev);1671 phy_stop(ndev->phydev);
1665 phy_disconnect(ndev->phydev);1672 phy_disconnect(ndev->phydev);
1673 if (of_phy_is_fixed_link(np))
1674 of_phy_deregister_fixed_link(np);
1666 }1675 }
1667 1676
1668 if (priv->chip_id != RCAR_GEN2) {1677 if (priv->chip_id != RCAR_GEN2) {
drivers/net/ethernet/renesas/sh_eth.c+1−1
@@ -518,7 +518,7 @@ static struct sh_eth_cpu_data r7s72100_data = { · 517 unmodified lines
518 518
519 .ecsr_value = ECSR_ICD,519 .ecsr_value = ECSR_ICD,
520 .ecsipr_value = ECSIPR_ICDIP,520 .ecsipr_value = ECSIPR_ICDIP,
521 .eesipr_value = 0xff7f009f,521 .eesipr_value = 0xe77f009f,
522 522
523 .tx_check = EESR_TC1 | EESR_FTC,523 .tx_check = EESR_TC1 | EESR_FTC,
524 .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |524 .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c+15−2
@@ -50,10 +50,23 @@ static int dwmac_generic_probe(struct platform_device *pdev) · 49 unmodified lines
50 if (plat_dat->init) {50 if (plat_dat->init) {
51 ret = plat_dat->init(pdev, plat_dat->bsp_priv);51 ret = plat_dat->init(pdev, plat_dat->bsp_priv);
52 if (ret)52 if (ret)
53 return ret;53 goto err_remove_config_dt;
54 }54 }
55 55
56 return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);56 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
57 if (ret)
58 goto err_exit;
59
60 return 0;
61
62err_exit:
63 if (plat_dat->exit)
64 plat_dat->exit(pdev, plat_dat->bsp_priv);
65err_remove_config_dt:
66 if (pdev->dev.of_node)
67 stmmac_remove_config_dt(pdev, plat_dat);
68
69 return ret;
57}70}
58 71
59static const struct of_device_id dwmac_generic_match[] = {72static const struct of_device_id dwmac_generic_match[] = {
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c+19−6
@@ -271,15 +271,17 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) · 270 unmodified lines
271 return PTR_ERR(plat_dat);271 return PTR_ERR(plat_dat);
272 272
273 gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL);273 gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL);
274 if (!gmac)274 if (!gmac) {
275 return -ENOMEM;275 err = -ENOMEM;
276 goto err_remove_config_dt;
277 }
276 278
277 gmac->pdev = pdev;279 gmac->pdev = pdev;
278 280
279 err = ipq806x_gmac_of_parse(gmac);281 err = ipq806x_gmac_of_parse(gmac);
280 if (err) {282 if (err) {
281 dev_err(dev, "device tree parsing error\n");283 dev_err(dev, "device tree parsing error\n");
282 return err;284 goto err_remove_config_dt;
283 }285 }
284 286
285 regmap_write(gmac->qsgmii_csr, QSGMII_PCS_CAL_LCKDT_CTL,287 regmap_write(gmac->qsgmii_csr, QSGMII_PCS_CAL_LCKDT_CTL,
@@ -300,7 +302,8 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) · 14 unmodified lines
300 default:302 default:
301 dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n",303 dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n",
302 phy_modes(gmac->phy_mode));304 phy_modes(gmac->phy_mode));
303 return -EINVAL;305 err = -EINVAL;
306 goto err_remove_config_dt;
304 }307 }
305 regmap_write(gmac->nss_common, NSS_COMMON_GMAC_CTL(gmac->id), val);308 regmap_write(gmac->nss_common, NSS_COMMON_GMAC_CTL(gmac->id), val);
306 309
@@ -319,7 +322,8 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) · 12 unmodified lines
319 default:322 default:
320 dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n",323 dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n",
321 phy_modes(gmac->phy_mode));324 phy_modes(gmac->phy_mode));
322 return -EINVAL;325 err = -EINVAL;
326 goto err_remove_config_dt;
323 }327 }
324 regmap_write(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, val);328 regmap_write(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, val);
325 329
@@ -346,7 +350,16 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) · 20 unmodified lines
346 plat_dat->bsp_priv = gmac;350 plat_dat->bsp_priv = gmac;
347 plat_dat->fix_mac_speed = ipq806x_gmac_fix_mac_speed;351 plat_dat->fix_mac_speed = ipq806x_gmac_fix_mac_speed;
348 352
349 return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);353 err = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
354 if (err)
355 goto err_remove_config_dt;
356
357 return 0;
358
359err_remove_config_dt:
360 stmmac_remove_config_dt(pdev, plat_dat);
361
362 return err;
350}363}
351 364
352static const struct of_device_id ipq806x_gmac_dwmac_match[] = {365static const struct of_device_id ipq806x_gmac_dwmac_match[] = {
drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c+14−3
@@ -46,7 +46,8 @@ static int lpc18xx_dwmac_probe(struct platform_device *pdev) · 45 unmodified lines
46 reg = syscon_regmap_lookup_by_compatible("nxp,lpc1850-creg");46 reg = syscon_regmap_lookup_by_compatible("nxp,lpc1850-creg");
47 if (IS_ERR(reg)) {47 if (IS_ERR(reg)) {
48 dev_err(&pdev->dev, "syscon lookup failed\n");48 dev_err(&pdev->dev, "syscon lookup failed\n");
49 return PTR_ERR(reg);49 ret = PTR_ERR(reg);
50 goto err_remove_config_dt;
50 }51 }
51 52
52 if (plat_dat->interface == PHY_INTERFACE_MODE_MII) {53 if (plat_dat->interface == PHY_INTERFACE_MODE_MII) {
@@ -55,13 +56,23 @@ static int lpc18xx_dwmac_probe(struct platform_device *pdev) · 2 unmodified lines
55 ethmode = LPC18XX_CREG_CREG6_ETHMODE_RMII;56 ethmode = LPC18XX_CREG_CREG6_ETHMODE_RMII;
56 } else {57 } else {
57 dev_err(&pdev->dev, "Only MII and RMII mode supported\n");58 dev_err(&pdev->dev, "Only MII and RMII mode supported\n");
58 return -EINVAL;59 ret = -EINVAL;
60 goto err_remove_config_dt;
59 }61 }
60 62
61 regmap_update_bits(reg, LPC18XX_CREG_CREG6,63 regmap_update_bits(reg, LPC18XX_CREG_CREG6,
62 LPC18XX_CREG_CREG6_ETHMODE_MASK, ethmode);64 LPC18XX_CREG_CREG6_ETHMODE_MASK, ethmode);
63 65
64 return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);66 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
67 if (ret)
68 goto err_remove_config_dt;
69
70 return 0;
71
72err_remove_config_dt:
73 stmmac_remove_config_dt(pdev, plat_dat);
74
75 return ret;
65}76}
66 77
67static const struct of_device_id lpc18xx_dwmac_match[] = {78static const struct of_device_id lpc18xx_dwmac_match[] = {
drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c+18−5
@@ -64,18 +64,31 @@ static int meson6_dwmac_probe(struct platform_device *pdev) · 63 unmodified lines
64 return PTR_ERR(plat_dat);64 return PTR_ERR(plat_dat);
65 65
66 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);66 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
67 if (!dwmac)67 if (!dwmac) {
68 return -ENOMEM;68 ret = -ENOMEM;
69 goto err_remove_config_dt;
70 }
69 71
70 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);72 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
71 dwmac->reg = devm_ioremap_resource(&pdev->dev, res);73 dwmac->reg = devm_ioremap_resource(&pdev->dev, res);
72 if (IS_ERR(dwmac->reg))74 if (IS_ERR(dwmac->reg)) {
73 return PTR_ERR(dwmac->reg);75 ret = PTR_ERR(dwmac->reg);
76 goto err_remove_config_dt;
77 }
74 78
75 plat_dat->bsp_priv = dwmac;79 plat_dat->bsp_priv = dwmac;
76 plat_dat->fix_mac_speed = meson6_dwmac_fix_mac_speed;80 plat_dat->fix_mac_speed = meson6_dwmac_fix_mac_speed;
77 81
78 return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);82 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
83 if (ret)
84 goto err_remove_config_dt;
85
86 return 0;
87
88err_remove_config_dt:
89 stmmac_remove_config_dt(pdev, plat_dat);
90
91 return ret;
79}92}
80 93
81static const struct of_device_id meson6_dwmac_match[] = {94static const struct of_device_id meson6_dwmac_match[] = {
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c+24−8
@@ -264,32 +264,48 @@ static int meson8b_dwmac_probe(struct platform_device *pdev) · 263 unmodified lines
264 return PTR_ERR(plat_dat);264 return PTR_ERR(plat_dat);
265 265
266 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);266 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
267 if (!dwmac)267 if (!dwmac) {
268 return -ENOMEM;268 ret = -ENOMEM;
269 goto err_remove_config_dt;
270 }
269 271
270 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);272 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
271 dwmac->regs = devm_ioremap_resource(&pdev->dev, res);273 dwmac->regs = devm_ioremap_resource(&pdev->dev, res);
272 if (IS_ERR(dwmac->regs))274 if (IS_ERR(dwmac->regs)) {
273 return PTR_ERR(dwmac->regs);275 ret = PTR_ERR(dwmac->regs);
276 goto err_remove_config_dt;
277 }
274 278
275 dwmac->pdev = pdev;279 dwmac->pdev = pdev;
276 dwmac->phy_mode = of_get_phy_mode(pdev->dev.of_node);280 dwmac->phy_mode = of_get_phy_mode(pdev->dev.of_node);
277 if (dwmac->phy_mode < 0) {281 if (dwmac->phy_mode < 0) {
278 dev_err(&pdev->dev, "missing phy-mode property\n");282 dev_err(&pdev->dev, "missing phy-mode property\n");
279 return -EINVAL;283 ret = -EINVAL;
284 goto err_remove_config_dt;
280 }285 }
281 286
282 ret = meson8b_init_clk(dwmac);287 ret = meson8b_init_clk(dwmac);
283 if (ret)288 if (ret)
284 return ret;289 goto err_remove_config_dt;
285 290
286 ret = meson8b_init_prg_eth(dwmac);291 ret = meson8b_init_prg_eth(dwmac);
287 if (ret)292 if (ret)
288 return ret;293 goto err_remove_config_dt;
289 294
290 plat_dat->bsp_priv = dwmac;295 plat_dat->bsp_priv = dwmac;
291 296
292 return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);297 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
298 if (ret)
299 goto err_clk_disable;
300
301 return 0;
302
303err_clk_disable:
304 clk_disable_unprepare(dwmac->m25_div_clk);
305err_remove_config_dt:
306 stmmac_remove_config_dt(pdev, plat_dat);
307
308 return ret;
293}309}
294 310
295static int meson8b_dwmac_remove(struct platform_device *pdev)311static int meson8b_dwmac_remove(struct platform_device *pdev)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c+17−4
@@ -981,14 +981,27 @@ static int rk_gmac_probe(struct platform_device *pdev) · 980 unmodified lines
981 plat_dat->resume = rk_gmac_resume;981 plat_dat->resume = rk_gmac_resume;
982 982
983 plat_dat->bsp_priv = rk_gmac_setup(pdev, data);983 plat_dat->bsp_priv = rk_gmac_setup(pdev, data);
984 if (IS_ERR(plat_dat->bsp_priv))984 if (IS_ERR(plat_dat->bsp_priv)) {
985 return PTR_ERR(plat_dat->bsp_priv);985 ret = PTR_ERR(plat_dat->bsp_priv);
986 goto err_remove_config_dt;
987 }
986 988
987 ret = rk_gmac_init(pdev, plat_dat->bsp_priv);989 ret = rk_gmac_init(pdev, plat_dat->bsp_priv);
988 if (ret)990 if (ret)
989 return ret;991 goto err_remove_config_dt;
992
993 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
994 if (ret)
995 goto err_gmac_exit;
996
997 return 0;
998
999err_gmac_exit:
1000 rk_gmac_exit(pdev, plat_dat->bsp_priv);
1001err_remove_config_dt:
1002 stmmac_remove_config_dt(pdev, plat_dat);
990 1003
991 return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);1004 return ret;
992}1005}
993 1006
994static const struct of_device_id rk_gmac_dwmac_match[] = {1007static const struct of_device_id rk_gmac_dwmac_match[] = {
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c+26−13
@@ -304,6 +304,8 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) · 303 unmodified lines
304 struct device *dev = &pdev->dev;304 struct device *dev = &pdev->dev;
305 int ret;305 int ret;
306 struct socfpga_dwmac *dwmac;306 struct socfpga_dwmac *dwmac;
307 struct net_device *ndev;
308 struct stmmac_priv *stpriv;
307 309
308 ret = stmmac_get_platform_resources(pdev, &stmmac_res);310 ret = stmmac_get_platform_resources(pdev, &stmmac_res);
309 if (ret)311 if (ret)
@@ -314,32 +316,43 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) · 4 unmodified lines
314 return PTR_ERR(plat_dat);316 return PTR_ERR(plat_dat);
315 317
316 dwmac = devm_kzalloc(dev, sizeof(*dwmac), GFP_KERNEL);318 dwmac = devm_kzalloc(dev, sizeof(*dwmac), GFP_KERNEL);
317 if (!dwmac)319 if (!dwmac) {
318 return -ENOMEM;320 ret = -ENOMEM;
321 goto err_remove_config_dt;
322 }
319 323
320 ret = socfpga_dwmac_parse_data(dwmac, dev);324 ret = socfpga_dwmac_parse_data(dwmac, dev);
321 if (ret) {325 if (ret) {
322 dev_err(dev, "Unable to parse OF data\n");326 dev_err(dev, "Unable to parse OF data\n");
323 return ret;327 goto err_remove_config_dt;
324 }328 }
325 329
326 plat_dat->bsp_priv = dwmac;330 plat_dat->bsp_priv = dwmac;
327 plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed;331 plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed;
328 332
329 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);333 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
334 if (ret)
335 goto err_remove_config_dt;
330 336
331 if (!ret) {337 ndev = platform_get_drvdata(pdev);
332 struct net_device *ndev = platform_get_drvdata(pdev);338 stpriv = netdev_priv(ndev);
333 struct stmmac_priv *stpriv = netdev_priv(ndev);
334 339
335 /* The socfpga driver needs to control the stmmac reset to340 /* The socfpga driver needs to control the stmmac reset to set the phy
336 * set the phy mode. Create a copy of the core reset handel341 * mode. Create a copy of the core reset handle so it can be used by
337 * so it can be used by the driver later.342 * the driver later.
338 */343 */
339 dwmac->stmmac_rst = stpriv->stmmac_rst;344 dwmac->stmmac_rst = stpriv->stmmac_rst;
340 345
341 ret = socfpga_dwmac_set_phy_mode(dwmac);346 ret = socfpga_dwmac_set_phy_mode(dwmac);
342 }347 if (ret)
348 goto err_dvr_remove;
349
350 return 0;
351
352err_dvr_remove:
353 stmmac_dvr_remove(&pdev->dev);
354err_remove_config_dt:
355 stmmac_remove_config_dt(pdev, plat_dat);
343 356
344 return ret;357 return ret;
345}358}
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c+18−5
@@ -345,13 +345,15 @@ static int sti_dwmac_probe(struct platform_device *pdev) · 344 unmodified lines
345 return PTR_ERR(plat_dat);345 return PTR_ERR(plat_dat);
346 346
347 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);347 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
348 if (!dwmac)348 if (!dwmac) {
349 return -ENOMEM;349 ret = -ENOMEM;
350 goto err_remove_config_dt;
351 }
350 352
351 ret = sti_dwmac_parse_data(dwmac, pdev);353 ret = sti_dwmac_parse_data(dwmac, pdev);
352 if (ret) {354 if (ret) {
353 dev_err(&pdev->dev, "Unable to parse OF data\n");355 dev_err(&pdev->dev, "Unable to parse OF data\n");
354 return ret;356 goto err_remove_config_dt;
355 }357 }
356 358
357 dwmac->fix_retime_src = data->fix_retime_src;359 dwmac->fix_retime_src = data->fix_retime_src;
@@ -363,9 +365,20 @@ static int sti_dwmac_probe(struct platform_device *pdev) · 5 unmodified lines
363 365
364 ret = sti_dwmac_init(pdev, plat_dat->bsp_priv);366 ret = sti_dwmac_init(pdev, plat_dat->bsp_priv);
365 if (ret)367 if (ret)
366 return ret;368 goto err_remove_config_dt;
369
370 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
371 if (ret)
372 goto err_dwmac_exit;
373
374 return 0;
375
376err_dwmac_exit:
377 sti_dwmac_exit(pdev, plat_dat->bsp_priv);
378err_remove_config_dt:
379 stmmac_remove_config_dt(pdev, plat_dat);
367 380
368 return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);381 return ret;
369}382}
370 383
371static const struct sti_dwmac_of_data stih4xx_dwmac_data = {384static const struct sti_dwmac_of_data stih4xx_dwmac_data = {
drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c+14−5
@@ -107,24 +107,33 @@ static int stm32_dwmac_probe(struct platform_device *pdev) · 106 unmodified lines
107 return PTR_ERR(plat_dat);107 return PTR_ERR(plat_dat);
108 108
109 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);109 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
110 if (!dwmac)110 if (!dwmac) {
111 return -ENOMEM;111 ret = -ENOMEM;
112 goto err_remove_config_dt;
113 }
112 114
113 ret = stm32_dwmac_parse_data(dwmac, &pdev->dev);115 ret = stm32_dwmac_parse_data(dwmac, &pdev->dev);
114 if (ret) {116 if (ret) {
115 dev_err(&pdev->dev, "Unable to parse OF data\n");117 dev_err(&pdev->dev, "Unable to parse OF data\n");
116 return ret;118 goto err_remove_config_dt;
117 }119 }
118 120
119 plat_dat->bsp_priv = dwmac;121 plat_dat->bsp_priv = dwmac;
120 122
121 ret = stm32_dwmac_init(plat_dat);123 ret = stm32_dwmac_init(plat_dat);
122 if (ret)124 if (ret)
123 return ret;125 goto err_remove_config_dt;
124 126
125 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);127 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
126 if (ret)128 if (ret)
127 stm32_dwmac_clk_disable(dwmac);129 goto err_clk_disable;
130
131 return 0;
132
133err_clk_disable:
134 stm32_dwmac_clk_disable(dwmac);
135err_remove_config_dt:
136 stmmac_remove_config_dt(pdev, plat_dat);
128 137
129 return ret;138 return ret;
130}139}
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c+19−7
@@ -120,22 +120,27 @@ static int sun7i_gmac_probe(struct platform_device *pdev) · 119 unmodified lines
120 return PTR_ERR(plat_dat);120 return PTR_ERR(plat_dat);
121 121
122 gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL);122 gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL);
123 if (!gmac)123 if (!gmac) {
124 return -ENOMEM;124 ret = -ENOMEM;
125 goto err_remove_config_dt;
126 }
125 127
126 gmac->interface = of_get_phy_mode(dev->of_node);128 gmac->interface = of_get_phy_mode(dev->of_node);
127 129
128 gmac->tx_clk = devm_clk_get(dev, "allwinner_gmac_tx");130 gmac->tx_clk = devm_clk_get(dev, "allwinner_gmac_tx");
129 if (IS_ERR(gmac->tx_clk)) {131 if (IS_ERR(gmac->tx_clk)) {
130 dev_err(dev, "could not get tx clock\n");132 dev_err(dev, "could not get tx clock\n");
131 return PTR_ERR(gmac->tx_clk);133 ret = PTR_ERR(gmac->tx_clk);
134 goto err_remove_config_dt;
132 }135 }
133 136
134 /* Optional regulator for PHY */137 /* Optional regulator for PHY */
135 gmac->regulator = devm_regulator_get_optional(dev, "phy");138 gmac->regulator = devm_regulator_get_optional(dev, "phy");
136 if (IS_ERR(gmac->regulator)) {139 if (IS_ERR(gmac->regulator)) {
137 if (PTR_ERR(gmac->regulator) == -EPROBE_DEFER)140 if (PTR_ERR(gmac->regulator) == -EPROBE_DEFER) {
138 return -EPROBE_DEFER;141 ret = -EPROBE_DEFER;
142 goto err_remove_config_dt;
143 }
139 dev_info(dev, "no regulator found\n");144 dev_info(dev, "no regulator found\n");
140 gmac->regulator = NULL;145 gmac->regulator = NULL;
141 }146 }
@@ -151,11 +156,18 @@ static int sun7i_gmac_probe(struct platform_device *pdev) · 9 unmodified lines
151 156
152 ret = sun7i_gmac_init(pdev, plat_dat->bsp_priv);157 ret = sun7i_gmac_init(pdev, plat_dat->bsp_priv);
153 if (ret)158 if (ret)
154 return ret;159 goto err_remove_config_dt;
155 160
156 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);161 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
157 if (ret)162 if (ret)
158 sun7i_gmac_exit(pdev, plat_dat->bsp_priv);163 goto err_gmac_exit;
164
165 return 0;
166
167err_gmac_exit:
168 sun7i_gmac_exit(pdev, plat_dat->bsp_priv);
169err_remove_config_dt:
170 stmmac_remove_config_dt(pdev, plat_dat);
159 171
160 return ret;172 return ret;
161}173}
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+0−1
@@ -3416,7 +3416,6 @@ int stmmac_dvr_remove(struct device *dev) · 3415 unmodified lines
3416 stmmac_set_mac(priv->ioaddr, false);3416 stmmac_set_mac(priv->ioaddr, false);
3417 netif_carrier_off(ndev);3417 netif_carrier_off(ndev);
3418 unregister_netdev(ndev);3418 unregister_netdev(ndev);
3419 of_node_put(priv->plat->phy_node);
3420 if (priv->stmmac_rst)3419 if (priv->stmmac_rst)
3421 reset_control_assert(priv->stmmac_rst);3420 reset_control_assert(priv->stmmac_rst);
3422 clk_disable_unprepare(priv->pclk);3421 clk_disable_unprepare(priv->pclk);
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c+29−4
@@ -200,7 +200,6 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, · 199 unmodified lines
200/**200/**
201 * stmmac_probe_config_dt - parse device-tree driver parameters201 * stmmac_probe_config_dt - parse device-tree driver parameters
202 * @pdev: platform_device structure202 * @pdev: platform_device structure
203 * @plat: driver data platform structure
204 * @mac: MAC address to use203 * @mac: MAC address to use
205 * Description:204 * Description:
206 * this function is to read the driver parameters from device-tree and205 * this function is to read the driver parameters from device-tree and
@@ -306,7 +305,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) · 99 unmodified lines
306 dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),305 dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
307 GFP_KERNEL);306 GFP_KERNEL);
308 if (!dma_cfg) {307 if (!dma_cfg) {
309 of_node_put(plat->phy_node);308 stmmac_remove_config_dt(pdev, plat);
310 return ERR_PTR(-ENOMEM);309 return ERR_PTR(-ENOMEM);
311 }310 }
312 plat->dma_cfg = dma_cfg;311 plat->dma_cfg = dma_cfg;
@@ -329,14 +328,37 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) · 16 unmodified lines
329 328
330 return plat;329 return plat;
331}330}
331
332/**
333 * stmmac_remove_config_dt - undo the effects of stmmac_probe_config_dt()
334 * @pdev: platform_device structure
335 * @plat: driver data platform structure
336 *
337 * Release resources claimed by stmmac_probe_config_dt().
338 */
339void stmmac_remove_config_dt(struct platform_device *pdev,
340 struct plat_stmmacenet_data *plat)
341{
342 struct device_node *np = pdev->dev.of_node;
343
344 if (of_phy_is_fixed_link(np))
345 of_phy_deregister_fixed_link(np);
346 of_node_put(plat->phy_node);
347}
332#else348#else
333struct plat_stmmacenet_data *349struct plat_stmmacenet_data *
334stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)350stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
335{351{
336 return ERR_PTR(-ENOSYS);352 return ERR_PTR(-ENOSYS);
337}353}
354
355void stmmac_remove_config_dt(struct platform_device *pdev,
356 struct plat_stmmacenet_data *plat)
357{
358}
338#endif /* CONFIG_OF */359#endif /* CONFIG_OF */
339EXPORT_SYMBOL_GPL(stmmac_probe_config_dt);360EXPORT_SYMBOL_GPL(stmmac_probe_config_dt);
361EXPORT_SYMBOL_GPL(stmmac_remove_config_dt);
340 362
341int stmmac_get_platform_resources(struct platform_device *pdev,363int stmmac_get_platform_resources(struct platform_device *pdev,
342 struct stmmac_resources *stmmac_res)364 struct stmmac_resources *stmmac_res)
@@ -392,10 +414,13 @@ int stmmac_pltfr_remove(struct platform_device *pdev) · 49 unmodified lines
392{414{
393 struct net_device *ndev = platform_get_drvdata(pdev);415 struct net_device *ndev = platform_get_drvdata(pdev);
394 struct stmmac_priv *priv = netdev_priv(ndev);416 struct stmmac_priv *priv = netdev_priv(ndev);
417 struct plat_stmmacenet_data *plat = priv->plat;
395 int ret = stmmac_dvr_remove(&pdev->dev);418 int ret = stmmac_dvr_remove(&pdev->dev);
396 419
397 if (priv->plat->exit)420 if (plat->exit)
398 priv->plat->exit(pdev, priv->plat->bsp_priv);421 plat->exit(pdev, plat->bsp_priv);
422
423 stmmac_remove_config_dt(pdev, plat);
399 424
400 return ret;425 return ret;
401}426}
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h+2−0
@@ -23,6 +23,8 @@ · 22 unmodified lines
23 23
24struct plat_stmmacenet_data *24struct plat_stmmacenet_data *
25stmmac_probe_config_dt(struct platform_device *pdev, const char **mac);25stmmac_probe_config_dt(struct platform_device *pdev, const char **mac);
26void stmmac_remove_config_dt(struct platform_device *pdev,
27 struct plat_stmmacenet_data *plat);
26 28
27int stmmac_get_platform_resources(struct platform_device *pdev,29int stmmac_get_platform_resources(struct platform_device *pdev,
28 struct stmmac_resources *stmmac_res);30 struct stmmac_resources *stmmac_res);
drivers/net/ethernet/synopsys/dwc_eth_qos.c+13−7
@@ -2881,7 +2881,7 @@ static int dwceqos_probe(struct platform_device *pdev) · 2880 unmodified lines
2881 ret = of_get_phy_mode(lp->pdev->dev.of_node);2881 ret = of_get_phy_mode(lp->pdev->dev.of_node);
2882 if (ret < 0) {2882 if (ret < 0) {
2883 dev_err(&lp->pdev->dev, "error in getting phy i/f\n");2883 dev_err(&lp->pdev->dev, "error in getting phy i/f\n");
2884 goto err_out_clk_dis_phy;2884 goto err_out_deregister_fixed_link;
2885 }2885 }
2886 2886
2887 lp->phy_interface = ret;2887 lp->phy_interface = ret;
@@ -2889,14 +2889,14 @@ static int dwceqos_probe(struct platform_device *pdev) · 1 unmodified line
2889 ret = dwceqos_mii_init(lp);2889 ret = dwceqos_mii_init(lp);
2890 if (ret) {2890 if (ret) {
2891 dev_err(&lp->pdev->dev, "error in dwceqos_mii_init\n");2891 dev_err(&lp->pdev->dev, "error in dwceqos_mii_init\n");
2892 goto err_out_clk_dis_phy;2892 goto err_out_deregister_fixed_link;
2893 }2893 }
2894 2894
2895 ret = dwceqos_mii_probe(ndev);2895 ret = dwceqos_mii_probe(ndev);
2896 if (ret != 0) {2896 if (ret != 0) {
2897 netdev_err(ndev, "mii_probe fail.\n");2897 netdev_err(ndev, "mii_probe fail.\n");
2898 ret = -ENXIO;2898 ret = -ENXIO;
2899 goto err_out_clk_dis_phy;2899 goto err_out_deregister_fixed_link;
2900 }2900 }
2901 2901
2902 dwceqos_set_umac_addr(lp, lp->ndev->dev_addr, 0);2902 dwceqos_set_umac_addr(lp, lp->ndev->dev_addr, 0);
@@ -2914,7 +2914,7 @@ static int dwceqos_probe(struct platform_device *pdev) · 11 unmodified lines
2914 if (ret) {2914 if (ret) {
2915 dev_err(&lp->pdev->dev, "Unable to retrieve DT, error %d\n",2915 dev_err(&lp->pdev->dev, "Unable to retrieve DT, error %d\n",
2916 ret);2916 ret);
2917 goto err_out_clk_dis_phy;2917 goto err_out_deregister_fixed_link;
2918 }2918 }
2919 dev_info(&lp->pdev->dev, "pdev->id %d, baseaddr 0x%08lx, irq %d\n",2919 dev_info(&lp->pdev->dev, "pdev->id %d, baseaddr 0x%08lx, irq %d\n",
2920 pdev->id, ndev->base_addr, ndev->irq);2920 pdev->id, ndev->base_addr, ndev->irq);
@@ -2924,7 +2924,7 @@ static int dwceqos_probe(struct platform_device *pdev) · 3 unmodified lines
2924 if (ret) {2924 if (ret) {
2925 dev_err(&lp->pdev->dev, "Unable to request IRQ %d, error %d\n",2925 dev_err(&lp->pdev->dev, "Unable to request IRQ %d, error %d\n",
2926 ndev->irq, ret);2926 ndev->irq, ret);
2927 goto err_out_clk_dis_phy;2927 goto err_out_deregister_fixed_link;
2928 }2928 }
2929 2929
2930 if (netif_msg_probe(lp))2930 if (netif_msg_probe(lp))
@@ -2935,11 +2935,14 @@ static int dwceqos_probe(struct platform_device *pdev) · 4 unmodified lines
2935 ret = register_netdev(ndev);2935 ret = register_netdev(ndev);
2936 if (ret) {2936 if (ret) {
2937 dev_err(&pdev->dev, "Cannot register net device, aborting.\n");2937 dev_err(&pdev->dev, "Cannot register net device, aborting.\n");
2938 goto err_out_clk_dis_phy;2938 goto err_out_deregister_fixed_link;
2939 }2939 }
2940 2940
2941 return 0;2941 return 0;
2942 2942
2943err_out_deregister_fixed_link:
2944 if (of_phy_is_fixed_link(pdev->dev.of_node))
2945 of_phy_deregister_fixed_link(pdev->dev.of_node);
2943err_out_clk_dis_phy:2946err_out_clk_dis_phy:
2944 clk_disable_unprepare(lp->phy_ref_clk);2947 clk_disable_unprepare(lp->phy_ref_clk);
2945err_out_clk_dis_aper:2948err_out_clk_dis_aper:
@@ -2959,8 +2962,11 @@ static int dwceqos_remove(struct platform_device *pdev) · 13 unmodified lines
2959 if (ndev) {2962 if (ndev) {
2960 lp = netdev_priv(ndev);2963 lp = netdev_priv(ndev);
2961 2964
2962 if (ndev->phydev)2965 if (ndev->phydev) {
2963 phy_disconnect(ndev->phydev);2966 phy_disconnect(ndev->phydev);
2967 if (of_phy_is_fixed_link(pdev->dev.of_node))
2968 of_phy_deregister_fixed_link(pdev->dev.of_node);
2969 }
2964 mdiobus_unregister(lp->mii_bus);2970 mdiobus_unregister(lp->mii_bus);
2965 mdiobus_free(lp->mii_bus);2971 mdiobus_free(lp->mii_bus);
2966 2972
drivers/net/ethernet/ti/cpsw.c+6−14
@@ -2459,20 +2459,8 @@ static void cpsw_remove_dt(struct platform_device *pdev) · 2458 unmodified lines
2459 if (strcmp(slave_node->name, "slave"))2459 if (strcmp(slave_node->name, "slave"))
2460 continue;2460 continue;
2461 2461
2462 if (of_phy_is_fixed_link(slave_node)) {2462 if (of_phy_is_fixed_link(slave_node))
2463 struct phy_device *phydev;2463 of_phy_deregister_fixed_link(slave_node);
2464
2465 phydev = of_phy_find_device(slave_node);
2466 if (phydev) {
2467 fixed_phy_unregister(phydev);
2468 /* Put references taken by
2469 * of_phy_find_device() and
2470 * of_phy_register_fixed_link().
2471 */
2472 phy_device_free(phydev);
2473 phy_device_free(phydev);
2474 }
2475 }
2476 2464
2477 of_node_put(slave_data->phy_node);2465 of_node_put(slave_data->phy_node);
2478 2466
@@ -2942,6 +2930,8 @@ static int cpsw_resume(struct device *dev) · 463 unmodified lines
2942 /* Select default pin state */2930 /* Select default pin state */
2943 pinctrl_pm_select_default_state(dev);2931 pinctrl_pm_select_default_state(dev);
2944 2932
2933 /* shut up ASSERT_RTNL() warning in netif_set_real_num_tx/rx_queues */
2934 rtnl_lock();
2945 if (cpsw->data.dual_emac) {2935 if (cpsw->data.dual_emac) {
2946 int i;2936 int i;
2947 2937
@@ -2953,6 +2943,8 @@ static int cpsw_resume(struct device *dev) · 5 unmodified lines
2953 if (netif_running(ndev))2943 if (netif_running(ndev))
2954 cpsw_ndo_open(ndev);2944 cpsw_ndo_open(ndev);
2955 }2945 }
2946 rtnl_unlock();
2947
2956 return 0;2948 return 0;
2957}2949}
2958#endif2950#endif
drivers/net/ethernet/ti/davinci_emac.c+9−1
@@ -1767,6 +1767,7 @@ static int davinci_emac_try_get_mac(struct platform_device *pdev, · 1766 unmodified lines
1767 */1767 */
1768static int davinci_emac_probe(struct platform_device *pdev)1768static int davinci_emac_probe(struct platform_device *pdev)
1769{1769{
1770 struct device_node *np = pdev->dev.of_node;
1770 int rc = 0;1771 int rc = 0;
1771 struct resource *res, *res_ctrl;1772 struct resource *res, *res_ctrl;
1772 struct net_device *ndev;1773 struct net_device *ndev;
@@ -1805,7 +1806,7 @@ static int davinci_emac_probe(struct platform_device *pdev) · 32 unmodified lines
1805 if (!pdata) {1806 if (!pdata) {
1806 dev_err(&pdev->dev, "no platform data\n");1807 dev_err(&pdev->dev, "no platform data\n");
1807 rc = -ENODEV;1808 rc = -ENODEV;
1808 goto no_pdata;1809 goto err_free_netdev;
1809 }1810 }
1810 1811
1811 /* MAC addr and PHY mask , RMII enable info from platform_data */1812 /* MAC addr and PHY mask , RMII enable info from platform_data */
@@ -1941,6 +1942,10 @@ no_cpdma_chan: · 129 unmodified lines
1941 cpdma_chan_destroy(priv->rxchan);1942 cpdma_chan_destroy(priv->rxchan);
1942 cpdma_ctlr_destroy(priv->dma);1943 cpdma_ctlr_destroy(priv->dma);
1943no_pdata:1944no_pdata:
1945 if (of_phy_is_fixed_link(np))
1946 of_phy_deregister_fixed_link(np);
1947 of_node_put(priv->phy_node);
1948err_free_netdev:
1944 free_netdev(ndev);1949 free_netdev(ndev);
1945 return rc;1950 return rc;
1946}1951}
@@ -1956,6 +1961,7 @@ static int davinci_emac_remove(struct platform_device *pdev) · 9 unmodified lines
1956{1961{
1957 struct net_device *ndev = platform_get_drvdata(pdev);1962 struct net_device *ndev = platform_get_drvdata(pdev);
1958 struct emac_priv *priv = netdev_priv(ndev);1963 struct emac_priv *priv = netdev_priv(ndev);
1964 struct device_node *np = pdev->dev.of_node;
1959 1965
1960 dev_notice(&ndev->dev, "DaVinci EMAC: davinci_emac_remove()\n");1966 dev_notice(&ndev->dev, "DaVinci EMAC: davinci_emac_remove()\n");
1961 1967
@@ -1968,6 +1974,8 @@ static int davinci_emac_remove(struct platform_device *pdev) · 6 unmodified lines
1968 unregister_netdev(ndev);1974 unregister_netdev(ndev);
1969 of_node_put(priv->phy_node);1975 of_node_put(priv->phy_node);
1970 pm_runtime_disable(&pdev->dev);1976 pm_runtime_disable(&pdev->dev);
1977 if (of_phy_is_fixed_link(np))
1978 of_phy_deregister_fixed_link(np);
1971 free_netdev(ndev);1979 free_netdev(ndev);
1972 1980
1973 return 0;1981 return 0;
drivers/net/geneve.c+4−10
@@ -859,7 +859,6 @@ static netdev_tx_t geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 858 unmodified lines
859 struct geneve_dev *geneve = netdev_priv(dev);859 struct geneve_dev *geneve = netdev_priv(dev);
860 struct geneve_sock *gs4;860 struct geneve_sock *gs4;
861 struct rtable *rt = NULL;861 struct rtable *rt = NULL;
862 const struct iphdr *iip; /* interior IP header */
863 int err = -EINVAL;862 int err = -EINVAL;
864 struct flowi4 fl4;863 struct flowi4 fl4;
865 __u8 tos, ttl;864 __u8 tos, ttl;
@@ -890,8 +889,6 @@ static netdev_tx_t geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 24 unmodified lines
890 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);889 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
891 skb_reset_mac_header(skb);890 skb_reset_mac_header(skb);
892 891
893 iip = ip_hdr(skb);
894
895 if (info) {892 if (info) {
896 const struct ip_tunnel_key *key = &info->key;893 const struct ip_tunnel_key *key = &info->key;
897 u8 *opts = NULL;894 u8 *opts = NULL;
@@ -911,7 +908,7 @@ static netdev_tx_t geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 13 unmodified lines
911 if (unlikely(err))908 if (unlikely(err))
912 goto tx_error;909 goto tx_error;
913 910
914 tos = ip_tunnel_ecn_encap(key->tos, iip, skb);911 tos = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);
915 ttl = key->ttl;912 ttl = key->ttl;
916 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;913 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
917 } else {914 } else {
@@ -920,7 +917,7 @@ static netdev_tx_t geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 2 unmodified lines
920 if (unlikely(err))917 if (unlikely(err))
921 goto tx_error;918 goto tx_error;
922 919
923 tos = ip_tunnel_ecn_encap(fl4.flowi4_tos, iip, skb);920 tos = ip_tunnel_ecn_encap(fl4.flowi4_tos, ip_hdr(skb), skb);
924 ttl = geneve->ttl;921 ttl = geneve->ttl;
925 if (!ttl && IN_MULTICAST(ntohl(fl4.daddr)))922 if (!ttl && IN_MULTICAST(ntohl(fl4.daddr)))
926 ttl = 1;923 ttl = 1;
@@ -952,7 +949,6 @@ static netdev_tx_t geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 25 unmodified lines
952{949{
953 struct geneve_dev *geneve = netdev_priv(dev);950 struct geneve_dev *geneve = netdev_priv(dev);
954 struct dst_entry *dst = NULL;951 struct dst_entry *dst = NULL;
955 const struct iphdr *iip; /* interior IP header */
956 struct geneve_sock *gs6;952 struct geneve_sock *gs6;
957 int err = -EINVAL;953 int err = -EINVAL;
958 struct flowi6 fl6;954 struct flowi6 fl6;
@@ -982,8 +978,6 @@ static netdev_tx_t geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 23 unmodified lines
982 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);978 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
983 skb_reset_mac_header(skb);979 skb_reset_mac_header(skb);
984 980
985 iip = ip_hdr(skb);
986
987 if (info) {981 if (info) {
988 const struct ip_tunnel_key *key = &info->key;982 const struct ip_tunnel_key *key = &info->key;
989 u8 *opts = NULL;983 u8 *opts = NULL;
@@ -1004,7 +998,7 @@ static netdev_tx_t geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 14 unmodified lines
1004 if (unlikely(err))998 if (unlikely(err))
1005 goto tx_error;999 goto tx_error;
1006 1000
1007 prio = ip_tunnel_ecn_encap(key->tos, iip, skb);1001 prio = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);
1008 ttl = key->ttl;1002 ttl = key->ttl;
1009 label = info->key.label;1003 label = info->key.label;
1010 } else {1004 } else {
@@ -1014,7 +1008,7 @@ static netdev_tx_t geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, · 3 unmodified lines
1014 goto tx_error;1008 goto tx_error;
1015 1009
1016 prio = ip_tunnel_ecn_encap(ip6_tclass(fl6.flowlabel),1010 prio = ip_tunnel_ecn_encap(ip6_tclass(fl6.flowlabel),
1017 iip, skb);1011 ip_hdr(skb), skb);
1018 ttl = geneve->ttl;1012 ttl = geneve->ttl;
1019 if (!ttl && ipv6_addr_is_multicast(&fl6.daddr))1013 if (!ttl && ipv6_addr_is_multicast(&fl6.daddr))
1020 ttl = 1;1014 ttl = 1;
drivers/net/ipvlan/ipvlan_main.c+12−5
@@ -497,6 +497,7 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev, · 496 unmodified lines
497 struct net_device *phy_dev;497 struct net_device *phy_dev;
498 int err;498 int err;
499 u16 mode = IPVLAN_MODE_L3;499 u16 mode = IPVLAN_MODE_L3;
500 bool create = false;
500 501
501 if (!tb[IFLA_LINK])502 if (!tb[IFLA_LINK])
502 return -EINVAL;503 return -EINVAL;
@@ -513,6 +514,7 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev, · 10 unmodified lines
513 err = ipvlan_port_create(phy_dev);514 err = ipvlan_port_create(phy_dev);
514 if (err < 0)515 if (err < 0)
515 return err;516 return err;
517 create = true;
516 }518 }
517 519
518 if (data && data[IFLA_IPVLAN_MODE])520 if (data && data[IFLA_IPVLAN_MODE])
@@ -536,22 +538,27 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev, · 17 unmodified lines
536 538
537 err = register_netdevice(dev);539 err = register_netdevice(dev);
538 if (err < 0)540 if (err < 0)
539 return err;541 goto destroy_ipvlan_port;
540 542
541 err = netdev_upper_dev_link(phy_dev, dev);543 err = netdev_upper_dev_link(phy_dev, dev);
542 if (err) {544 if (err) {
543 unregister_netdevice(dev);545 goto unregister_netdev;
544 return err;
545 }546 }
546 err = ipvlan_set_port_mode(port, mode);547 err = ipvlan_set_port_mode(port, mode);
547 if (err) {548 if (err) {
548 unregister_netdevice(dev);549 goto unregister_netdev;
549 return err;
550 }550 }
551 551
552 list_add_tail_rcu(&ipvlan->pnode, &port->ipvlans);552 list_add_tail_rcu(&ipvlan->pnode, &port->ipvlans);
553 netif_stacked_transfer_operstate(phy_dev, dev);553 netif_stacked_transfer_operstate(phy_dev, dev);
554 return 0;554 return 0;
555
556unregister_netdev:
557 unregister_netdevice(dev);
558destroy_ipvlan_port:
559 if (create)
560 ipvlan_port_destroy(phy_dev);
561 return err;
555}562}
556 563
557static void ipvlan_link_delete(struct net_device *dev, struct list_head *head)564static void ipvlan_link_delete(struct net_device *dev, struct list_head *head)
drivers/net/irda/w83977af_ir.c+3−1
@@ -518,7 +518,9 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb, · 517 unmodified lines
518 518
519 mtt = irda_get_mtt(skb);519 mtt = irda_get_mtt(skb);
520 pr_debug("%s(%ld), mtt=%d\n", __func__ , jiffies, mtt);520 pr_debug("%s(%ld), mtt=%d\n", __func__ , jiffies, mtt);
521 if (mtt)521 if (mtt > 1000)
522 mdelay(mtt/1000);
523 else if (mtt)
522 udelay(mtt);524 udelay(mtt);
523 525
524 /* Enable DMA interrupt */526 /* Enable DMA interrupt */
drivers/net/macvtap.c+12−7
@@ -491,7 +491,13 @@ static int macvtap_newlink(struct net *src_net, · 490 unmodified lines
491 /* Don't put anything that may fail after macvlan_common_newlink491 /* Don't put anything that may fail after macvlan_common_newlink
492 * because we can't undo what it does.492 * because we can't undo what it does.
493 */493 */
494 return macvlan_common_newlink(src_net, dev, tb, data);494 err = macvlan_common_newlink(src_net, dev, tb, data);
495 if (err) {
496 netdev_rx_handler_unregister(dev);
497 return err;
498 }
499
500 return 0;
495}501}
496 502
497static void macvtap_dellink(struct net_device *dev,503static void macvtap_dellink(struct net_device *dev,
@@ -736,13 +742,8 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, · 238 unmodified lines
736 742
737 if (zerocopy)743 if (zerocopy)
738 err = zerocopy_sg_from_iter(skb, from);744 err = zerocopy_sg_from_iter(skb, from);
739 else {745 else
740 err = skb_copy_datagram_from_iter(skb, 0, from, len);746 err = skb_copy_datagram_from_iter(skb, 0, from, len);
741 if (!err && m && m->msg_control) {
742 struct ubuf_info *uarg = m->msg_control;
743 uarg->callback(uarg, false);
744 }
745 }
746 747
747 if (err)748 if (err)
748 goto err_kfree;749 goto err_kfree;
@@ -773,7 +774,11 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, · 24 unmodified lines
773 skb_shinfo(skb)->destructor_arg = m->msg_control;774 skb_shinfo(skb)->destructor_arg = m->msg_control;
774 skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;775 skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
775 skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG;776 skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG;
777 } else if (m && m->msg_control) {
778 struct ubuf_info *uarg = m->msg_control;
779 uarg->callback(uarg, false);
776 }780 }
781
777 if (vlan) {782 if (vlan) {
778 skb->dev = vlan->dev;783 skb->dev = vlan->dev;
779 dev_queue_xmit(skb);784 dev_queue_xmit(skb);
drivers/net/phy/realtek.c+12−8
@@ -102,15 +102,19 @@ static int rtl8211f_config_init(struct phy_device *phydev) · 101 unmodified lines
102 if (ret < 0)102 if (ret < 0)
103 return ret;103 return ret;
104 104
105 if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {105 phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd08);
106 /* enable TXDLY */106 reg = phy_read(phydev, 0x11);
107 phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd08);107
108 reg = phy_read(phydev, 0x11);108 /* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */
109 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
110 phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
109 reg |= RTL8211F_TX_DELAY;111 reg |= RTL8211F_TX_DELAY;
110 phy_write(phydev, 0x11, reg);112 else
111 /* restore to default page 0 */113 reg &= ~RTL8211F_TX_DELAY;
112 phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0);114
113 }115 phy_write(phydev, 0x11, reg);
116 /* restore to default page 0 */
117 phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0);
114 118
115 return 0;119 return 0;
116}120}
drivers/net/tun.c+4−6
@@ -1246,13 +1246,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, · 1245 unmodified lines
1246 1246
1247 if (zerocopy)1247 if (zerocopy)
1248 err = zerocopy_sg_from_iter(skb, from);1248 err = zerocopy_sg_from_iter(skb, from);
1249 else {1249 else
1250 err = skb_copy_datagram_from_iter(skb, 0, from, len);1250 err = skb_copy_datagram_from_iter(skb, 0, from, len);
1251 if (!err && msg_control) {
1252 struct ubuf_info *uarg = msg_control;
1253 uarg->callback(uarg, false);
1254 }
1255 }
1256 1251
1257 if (err) {1252 if (err) {
1258 this_cpu_inc(tun->pcpu_stats->rx_dropped);1253 this_cpu_inc(tun->pcpu_stats->rx_dropped);
@@ -1298,6 +1293,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, · 39 unmodified lines
1298 skb_shinfo(skb)->destructor_arg = msg_control;1293 skb_shinfo(skb)->destructor_arg = msg_control;
1299 skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;1294 skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
1300 skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG;1295 skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG;
1296 } else if (msg_control) {
1297 struct ubuf_info *uarg = msg_control;
1298 uarg->callback(uarg, false);
1301 }1299 }
1302 1300
1303 skb_reset_network_header(skb);1301 skb_reset_network_header(skb);
drivers/net/usb/asix_devices.c+3−3
@@ -603,12 +603,12 @@ static void ax88772_suspend(struct usbnet *dev) · 602 unmodified lines
603 u16 medium;603 u16 medium;
604 604
605 /* Stop MAC operation */605 /* Stop MAC operation */
606 medium = asix_read_medium_status(dev, 0);606 medium = asix_read_medium_status(dev, 1);
607 medium &= ~AX_MEDIUM_RE;607 medium &= ~AX_MEDIUM_RE;
608 asix_write_medium_mode(dev, medium, 0);608 asix_write_medium_mode(dev, medium, 1);
609 609
610 netdev_dbg(dev->net, "ax88772_suspend: medium=0x%04x\n",610 netdev_dbg(dev->net, "ax88772_suspend: medium=0x%04x\n",
611 asix_read_medium_status(dev, 0));611 asix_read_medium_status(dev, 1));
612 612
613 /* Preserve BMCR for restoring */613 /* Preserve BMCR for restoring */
614 priv->presvd_phy_bmcr =614 priv->presvd_phy_bmcr =
drivers/net/usb/cdc_ether.c+31−7
@@ -388,12 +388,6 @@ void usbnet_cdc_status(struct usbnet *dev, struct urb *urb) · 387 unmodified lines
388 case USB_CDC_NOTIFY_NETWORK_CONNECTION:388 case USB_CDC_NOTIFY_NETWORK_CONNECTION:
389 netif_dbg(dev, timer, dev->net, "CDC: carrier %s\n",389 netif_dbg(dev, timer, dev->net, "CDC: carrier %s\n",
390 event->wValue ? "on" : "off");390 event->wValue ? "on" : "off");
391
392 /* Work-around for devices with broken off-notifications */
393 if (event->wValue &&
394 !test_bit(__LINK_STATE_NOCARRIER, &dev->net->state))
395 usbnet_link_change(dev, 0, 0);
396
397 usbnet_link_change(dev, !!event->wValue, 0);391 usbnet_link_change(dev, !!event->wValue, 0);
398 break;392 break;
399 case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */393 case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */
@@ -466,6 +460,36 @@ static int usbnet_cdc_zte_rx_fixup(struct usbnet *dev, struct sk_buff *skb) · 66 unmodified lines
466 return 1;460 return 1;
467}461}
468 462
463/* Ensure correct link state
464 *
465 * Some devices (ZTE MF823/831/910) export two carrier on notifications when
466 * connected. This causes the link state to be incorrect. Work around this by
467 * always setting the state to off, then on.
468 */
469void usbnet_cdc_zte_status(struct usbnet *dev, struct urb *urb)
470{
471 struct usb_cdc_notification *event;
472
473 if (urb->actual_length < sizeof(*event))
474 return;
475
476 event = urb->transfer_buffer;
477
478 if (event->bNotificationType != USB_CDC_NOTIFY_NETWORK_CONNECTION) {
479 usbnet_cdc_status(dev, urb);
480 return;
481 }
482
483 netif_dbg(dev, timer, dev->net, "CDC: carrier %s\n",
484 event->wValue ? "on" : "off");
485
486 if (event->wValue &&
487 netif_carrier_ok(dev->net))
488 netif_carrier_off(dev->net);
489
490 usbnet_link_change(dev, !!event->wValue, 0);
491}
492
469static const struct driver_info cdc_info = {493static const struct driver_info cdc_info = {
470 .description = "CDC Ethernet Device",494 .description = "CDC Ethernet Device",
471 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,495 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
@@ -481,7 +505,7 @@ static const struct driver_info zte_cdc_info = { · 9 unmodified lines
481 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,505 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
482 .bind = usbnet_cdc_zte_bind,506 .bind = usbnet_cdc_zte_bind,
483 .unbind = usbnet_cdc_unbind,507 .unbind = usbnet_cdc_unbind,
484 .status = usbnet_cdc_status,508 .status = usbnet_cdc_zte_status,
485 .set_rx_mode = usbnet_cdc_update_filter,509 .set_rx_mode = usbnet_cdc_update_filter,
486 .manage_power = usbnet_manage_power,510 .manage_power = usbnet_manage_power,
487 .rx_fixup = usbnet_cdc_zte_rx_fixup,511 .rx_fixup = usbnet_cdc_zte_rx_fixup,
drivers/net/usb/qmi_wwan.c+1−0
@@ -894,6 +894,7 @@ static const struct usb_device_id products[] = { · 893 unmodified lines
894 {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */894 {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */
895 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */895 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
896 {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */896 {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */
897 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */
897 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */898 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
898 {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */899 {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */
899 {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */900 {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */
drivers/net/vxlan.c+7−3
@@ -611,6 +611,7 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan, · 610 unmodified lines
611 struct vxlan_rdst *rd = NULL;611 struct vxlan_rdst *rd = NULL;
612 struct vxlan_fdb *f;612 struct vxlan_fdb *f;
613 int notify = 0;613 int notify = 0;
614 int rc;
614 615
615 f = __vxlan_find_mac(vxlan, mac);616 f = __vxlan_find_mac(vxlan, mac);
616 if (f) {617 if (f) {
@@ -641,8 +642,7 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan, · 24 unmodified lines
641 if ((flags & NLM_F_APPEND) &&642 if ((flags & NLM_F_APPEND) &&
642 (is_multicast_ether_addr(f->eth_addr) ||643 (is_multicast_ether_addr(f->eth_addr) ||
643 is_zero_ether_addr(f->eth_addr))) {644 is_zero_ether_addr(f->eth_addr))) {
644 int rc = vxlan_fdb_append(f, ip, port, vni, ifindex,645 rc = vxlan_fdb_append(f, ip, port, vni, ifindex, &rd);
645 &rd);
646 646
647 if (rc < 0)647 if (rc < 0)
648 return rc;648 return rc;
@@ -673,7 +673,11 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan, · 24 unmodified lines
673 INIT_LIST_HEAD(&f->remotes);673 INIT_LIST_HEAD(&f->remotes);
674 memcpy(f->eth_addr, mac, ETH_ALEN);674 memcpy(f->eth_addr, mac, ETH_ALEN);
675 675
676 vxlan_fdb_append(f, ip, port, vni, ifindex, &rd);676 rc = vxlan_fdb_append(f, ip, port, vni, ifindex, &rd);
677 if (rc < 0) {
678 kfree(f);
679 return rc;
680 }
677 681
678 ++vxlan->addrcnt;682 ++vxlan->addrcnt;
679 hlist_add_head_rcu(&f->hlist,683 hlist_add_head_rcu(&f->hlist,
drivers/net/wireless/marvell/mwifiex/cfg80211.c+7−6
@@ -2222,8 +2222,9 @@ done: · 2221 unmodified lines
2222 is_scanning_required = 1;2222 is_scanning_required = 1;
2223 } else {2223 } else {
2224 mwifiex_dbg(priv->adapter, MSG,2224 mwifiex_dbg(priv->adapter, MSG,
2225 "info: trying to associate to '%s' bssid %pM\n",2225 "info: trying to associate to '%.*s' bssid %pM\n",
2226 (char *)req_ssid.ssid, bss->bssid);2226 req_ssid.ssid_len, (char *)req_ssid.ssid,
2227 bss->bssid);
2227 memcpy(&priv->cfg_bssid, bss->bssid, ETH_ALEN);2228 memcpy(&priv->cfg_bssid, bss->bssid, ETH_ALEN);
2228 break;2229 break;
2229 }2230 }
@@ -2283,8 +2284,8 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, · 53 unmodified lines
2283 }2284 }
2284 2285
2285 mwifiex_dbg(adapter, INFO,2286 mwifiex_dbg(adapter, INFO,
2286 "info: Trying to associate to %s and bssid %pM\n",2287 "info: Trying to associate to %.*s and bssid %pM\n",
2287 (char *)sme->ssid, sme->bssid);2288 (int)sme->ssid_len, (char *)sme->ssid, sme->bssid);
2288 2289
2289 if (!mwifiex_stop_bg_scan(priv))2290 if (!mwifiex_stop_bg_scan(priv))
2290 cfg80211_sched_scan_stopped_rtnl(priv->wdev.wiphy);2291 cfg80211_sched_scan_stopped_rtnl(priv->wdev.wiphy);
@@ -2417,8 +2418,8 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, · 126 unmodified lines
2417 }2418 }
2418 2419
2419 mwifiex_dbg(priv->adapter, MSG,2420 mwifiex_dbg(priv->adapter, MSG,
2420 "info: trying to join to %s and bssid %pM\n",2421 "info: trying to join to %.*s and bssid %pM\n",
2421 (char *)params->ssid, params->bssid);2422 params->ssid_len, (char *)params->ssid, params->bssid);
2422 2423
2423 mwifiex_set_ibss_params(priv, params);2424 mwifiex_set_ibss_params(priv, params);
2424 2425
drivers/of/of_mdio.c+15−0
@@ -490,3 +490,18 @@ int of_phy_register_fixed_link(struct device_node *np) · 489 unmodified lines
490 return -ENODEV;490 return -ENODEV;
491}491}
492EXPORT_SYMBOL(of_phy_register_fixed_link);492EXPORT_SYMBOL(of_phy_register_fixed_link);
493
494void of_phy_deregister_fixed_link(struct device_node *np)
495{
496 struct phy_device *phydev;
497
498 phydev = of_phy_find_device(np);
499 if (!phydev)
500 return;
501
502 fixed_phy_unregister(phydev);
503
504 put_device(&phydev->mdio.dev); /* of_phy_find_device() */
505 phy_device_free(phydev); /* fixed_phy_register() */
506}
507EXPORT_SYMBOL(of_phy_deregister_fixed_link);
drivers/pci/host/pcie-designware-plat.c+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
3 *3 *
4 * Copyright (C) 2015-2016 Synopsys, Inc. (www.synopsys.com)4 * Copyright (C) 2015-2016 Synopsys, Inc. (www.synopsys.com)
5 *5 *
6 * Authors: Joao Pinto <jpmpinto@gmail.com>6 * Authors: Joao Pinto <Joao.Pinto@synopsys.com>
7 *7 *
8 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as9 * it under the terms of the GNU General Public License version 2 as
drivers/pci/pcie/aer/aer_inject.c+0−14
@@ -307,20 +307,6 @@ out: · 306 unmodified lines
307 return 0;307 return 0;
308}308}
309 309
310static struct pci_dev *pcie_find_root_port(struct pci_dev *dev)
311{
312 while (1) {
313 if (!pci_is_pcie(dev))
314 break;
315 if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
316 return dev;
317 if (!dev->bus->self)
318 break;
319 dev = dev->bus->self;
320 }
321 return NULL;
322}
323
324static int find_aer_device_iter(struct device *device, void *data)310static int find_aer_device_iter(struct device *device, void *data)
325{311{
326 struct pcie_device **result = data;312 struct pcie_device **result = data;
drivers/pci/probe.c+27−1
@@ -1439,6 +1439,21 @@ static void program_hpp_type1(struct pci_dev *dev, struct hpp_type1 *hpp) · 1438 unmodified lines
1439 dev_warn(&dev->dev, "PCI-X settings not supported\n");1439 dev_warn(&dev->dev, "PCI-X settings not supported\n");
1440}1440}
1441 1441
1442static bool pcie_root_rcb_set(struct pci_dev *dev)
1443{
1444 struct pci_dev *rp = pcie_find_root_port(dev);
1445 u16 lnkctl;
1446
1447 if (!rp)
1448 return false;
1449
1450 pcie_capability_read_word(rp, PCI_EXP_LNKCTL, &lnkctl);
1451 if (lnkctl & PCI_EXP_LNKCTL_RCB)
1452 return true;
1453
1454 return false;
1455}
1456
1442static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp)1457static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp)
1443{1458{
1444 int pos;1459 int pos;
@@ -1468,9 +1483,20 @@ static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp) · 23 unmodified lines
1468 ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or);1483 ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or);
1469 1484
1470 /* Initialize Link Control Register */1485 /* Initialize Link Control Register */
1471 if (pcie_cap_has_lnkctl(dev))1486 if (pcie_cap_has_lnkctl(dev)) {
1487
1488 /*
1489 * If the Root Port supports Read Completion Boundary of
1490 * 128, set RCB to 128. Otherwise, clear it.
1491 */
1492 hpp->pci_exp_lnkctl_and |= PCI_EXP_LNKCTL_RCB;
1493 hpp->pci_exp_lnkctl_or &= ~PCI_EXP_LNKCTL_RCB;
1494 if (pcie_root_rcb_set(dev))
1495 hpp->pci_exp_lnkctl_or |= PCI_EXP_LNKCTL_RCB;
1496
1472 pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL,1497 pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL,
1473 ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or);1498 ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or);
1499 }
1474 1500
1475 /* Find Advanced Error Reporting Enhanced Capability */1501 /* Find Advanced Error Reporting Enhanced Capability */
1476 pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);1502 pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
drivers/pwm/pwm-meson.c+1−0
@@ -474,6 +474,7 @@ static int meson_pwm_probe(struct platform_device *pdev) · 473 unmodified lines
474 if (IS_ERR(meson->base))474 if (IS_ERR(meson->base))
475 return PTR_ERR(meson->base);475 return PTR_ERR(meson->base);
476 476
477 spin_lock_init(&meson->lock);
477 meson->chip.dev = &pdev->dev;478 meson->chip.dev = &pdev->dev;
478 meson->chip.ops = &meson_pwm_ops;479 meson->chip.ops = &meson_pwm_ops;
479 meson->chip.base = -1;480 meson->chip.base = -1;
drivers/pwm/sysfs.c+2−0
@@ -425,6 +425,8 @@ void pwmchip_sysfs_unexport_children(struct pwm_chip *chip) · 424 unmodified lines
425 if (test_bit(PWMF_EXPORTED, &pwm->flags))425 if (test_bit(PWMF_EXPORTED, &pwm->flags))
426 pwm_unexport_child(parent, pwm);426 pwm_unexport_child(parent, pwm);
427 }427 }
428
429 put_device(parent);
428}430}
429 431
430static int __init pwm_sysfs_init(void)432static int __init pwm_sysfs_init(void)
drivers/scsi/be2iscsi/be_mgmt.c+1−1
@@ -1083,7 +1083,7 @@ unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba) · 1082 unmodified lines
1083 nonemb_cmd = &phba->boot_struct.nonemb_cmd;1083 nonemb_cmd = &phba->boot_struct.nonemb_cmd;
1084 nonemb_cmd->size = sizeof(*resp);1084 nonemb_cmd->size = sizeof(*resp);
1085 nonemb_cmd->va = pci_alloc_consistent(phba->ctrl.pdev,1085 nonemb_cmd->va = pci_alloc_consistent(phba->ctrl.pdev,
1086 sizeof(nonemb_cmd->size),1086 nonemb_cmd->size,
1087 &nonemb_cmd->dma);1087 &nonemb_cmd->dma);
1088 if (!nonemb_cmd->va) {1088 if (!nonemb_cmd->va) {
1089 mutex_unlock(&ctrl->mbox_lock);1089 mutex_unlock(&ctrl->mbox_lock);
drivers/scsi/hpsa.c+11−5
@@ -2009,7 +2009,7 @@ static struct hpsa_scsi_dev_t *lookup_hpsa_scsi_dev(struct ctlr_info *h, · 2008 unmodified lines
2009 2009
2010static int hpsa_slave_alloc(struct scsi_device *sdev)2010static int hpsa_slave_alloc(struct scsi_device *sdev)
2011{2011{
2012 struct hpsa_scsi_dev_t *sd;2012 struct hpsa_scsi_dev_t *sd = NULL;
2013 unsigned long flags;2013 unsigned long flags;
2014 struct ctlr_info *h;2014 struct ctlr_info *h;
2015 2015
@@ -2026,7 +2026,8 @@ static int hpsa_slave_alloc(struct scsi_device *sdev) · 10 unmodified lines
2026 sd->target = sdev_id(sdev);2026 sd->target = sdev_id(sdev);
2027 sd->lun = sdev->lun;2027 sd->lun = sdev->lun;
2028 }2028 }
2029 } else2029 }
2030 if (!sd)
2030 sd = lookup_hpsa_scsi_dev(h, sdev_channel(sdev),2031 sd = lookup_hpsa_scsi_dev(h, sdev_channel(sdev),
2031 sdev_id(sdev), sdev->lun);2032 sdev_id(sdev), sdev->lun);
2032 2033
@@ -3840,6 +3841,7 @@ static int hpsa_update_device_info(struct ctlr_info *h, · 1807 unmodified lines
3840 sizeof(this_device->vendor));3841 sizeof(this_device->vendor));
3841 memcpy(this_device->model, &inq_buff[16],3842 memcpy(this_device->model, &inq_buff[16],
3842 sizeof(this_device->model));3843 sizeof(this_device->model));
3844 this_device->rev = inq_buff[2];
3843 memset(this_device->device_id, 0,3845 memset(this_device->device_id, 0,
3844 sizeof(this_device->device_id));3846 sizeof(this_device->device_id));
3845 if (hpsa_get_device_id(h, scsi3addr, this_device->device_id, 8,3847 if (hpsa_get_device_id(h, scsi3addr, this_device->device_id, 8,
@@ -3929,10 +3931,14 @@ static void figure_bus_target_lun(struct ctlr_info *h, · 83 unmodified lines
3929 3931
3930 if (!is_logical_dev_addr_mode(lunaddrbytes)) {3932 if (!is_logical_dev_addr_mode(lunaddrbytes)) {
3931 /* physical device, target and lun filled in later */3933 /* physical device, target and lun filled in later */
3932 if (is_hba_lunid(lunaddrbytes))3934 if (is_hba_lunid(lunaddrbytes)) {
3935 int bus = HPSA_HBA_BUS;
3936
3937 if (!device->rev)
3938 bus = HPSA_LEGACY_HBA_BUS;
3933 hpsa_set_bus_target_lun(device,3939 hpsa_set_bus_target_lun(device,
3934 HPSA_HBA_BUS, 0, lunid & 0x3fff);3940 bus, 0, lunid & 0x3fff);
3935 else3941 } else
3936 /* defer target, lun assignment for physical devices */3942 /* defer target, lun assignment for physical devices */
3937 hpsa_set_bus_target_lun(device,3943 hpsa_set_bus_target_lun(device,
3938 HPSA_PHYSICAL_DEVICE_BUS, -1, -1);3944 HPSA_PHYSICAL_DEVICE_BUS, -1, -1);
drivers/scsi/hpsa.h+2−0
@@ -69,6 +69,7 @@ struct hpsa_scsi_dev_t { · 68 unmodified lines
69 u64 sas_address;69 u64 sas_address;
70 unsigned char vendor[8]; /* bytes 8-15 of inquiry data */70 unsigned char vendor[8]; /* bytes 8-15 of inquiry data */
71 unsigned char model[16]; /* bytes 16-31 of inquiry data */71 unsigned char model[16]; /* bytes 16-31 of inquiry data */
72 unsigned char rev; /* byte 2 of inquiry data */
72 unsigned char raid_level; /* from inquiry page 0xC1 */73 unsigned char raid_level; /* from inquiry page 0xC1 */
73 unsigned char volume_offline; /* discovered via TUR or VPD */74 unsigned char volume_offline; /* discovered via TUR or VPD */
74 u16 queue_depth; /* max queue_depth for this device */75 u16 queue_depth; /* max queue_depth for this device */
@@ -402,6 +403,7 @@ struct offline_device_entry { · 327 unmodified lines
402#define HPSA_RAID_VOLUME_BUS 1403#define HPSA_RAID_VOLUME_BUS 1
403#define HPSA_EXTERNAL_RAID_VOLUME_BUS 2404#define HPSA_EXTERNAL_RAID_VOLUME_BUS 2
404#define HPSA_HBA_BUS 0405#define HPSA_HBA_BUS 0
406#define HPSA_LEGACY_HBA_BUS 3
405 407
406/*408/*
407 Send the command to the hardware409 Send the command to the hardware
drivers/scsi/libfc/fc_lport.c+1−1
@@ -308,7 +308,7 @@ struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *shost) · 307 unmodified lines
308 fc_stats = &lport->host_stats;308 fc_stats = &lport->host_stats;
309 memset(fc_stats, 0, sizeof(struct fc_host_statistics));309 memset(fc_stats, 0, sizeof(struct fc_host_statistics));
310 310
311 fc_stats->seconds_since_last_reset = (lport->boot_time - jiffies) / HZ;311 fc_stats->seconds_since_last_reset = (jiffies - lport->boot_time) / HZ;
312 312
313 for_each_possible_cpu(cpu) {313 for_each_possible_cpu(cpu) {
314 struct fc_stats *stats;314 struct fc_stats *stats;
drivers/scsi/mpt3sas/mpt3sas_scsih.c+8−5
@@ -3885,6 +3885,11 @@ _scsih_temp_threshold_events(struct MPT3SAS_ADAPTER *ioc, · 3884 unmodified lines
3885 }3885 }
3886}3886}
3887 3887
3888static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd)
3889{
3890 return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16);
3891}
3892
3888/**3893/**
3889 * _scsih_flush_running_cmds - completing outstanding commands.3894 * _scsih_flush_running_cmds - completing outstanding commands.
3890 * @ioc: per adapter object3895 * @ioc: per adapter object
@@ -3906,6 +3911,9 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc) · 15 unmodified lines
3906 if (!scmd)3911 if (!scmd)
3907 continue;3912 continue;
3908 count++;3913 count++;
3914 if (ata_12_16_cmd(scmd))
3915 scsi_internal_device_unblock(scmd->device,
3916 SDEV_RUNNING);
3909 mpt3sas_base_free_smid(ioc, smid);3917 mpt3sas_base_free_smid(ioc, smid);
3910 scsi_dma_unmap(scmd);3918 scsi_dma_unmap(scmd);
3911 if (ioc->pci_error_recovery)3919 if (ioc->pci_error_recovery)
@@ -4010,11 +4018,6 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 ioc_status) · 98 unmodified lines
4010 SAM_STAT_CHECK_CONDITION;4018 SAM_STAT_CHECK_CONDITION;
4011}4019}
4012 4020
4013static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd)
4014{
4015 return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16);
4016}
4017
4018/**4021/**
4019 * scsih_qcmd - main scsi request entry point4022 * scsih_qcmd - main scsi request entry point
4020 * @scmd: pointer to scsi command object4023 * @scmd: pointer to scsi command object
drivers/scsi/mvsas/mv_sas.c+3−1
@@ -791,8 +791,10 @@ static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf · 790 unmodified lines
791 slot->slot_tag = tag;791 slot->slot_tag = tag;
792 792
793 slot->buf = pci_pool_alloc(mvi->dma_pool, GFP_ATOMIC, &slot->buf_dma);793 slot->buf = pci_pool_alloc(mvi->dma_pool, GFP_ATOMIC, &slot->buf_dma);
794 if (!slot->buf)794 if (!slot->buf) {
795 rc = -ENOMEM;
795 goto err_out_tag;796 goto err_out_tag;
797 }
796 memset(slot->buf, 0, MVS_SLOT_BUF_SZ);798 memset(slot->buf, 0, MVS_SLOT_BUF_SZ);
797 799
798 tei.task = task;800 tei.task = task;
drivers/scsi/qlogicpti.h+2−2
@@ -356,8 +356,8 @@ struct qlogicpti { · 355 unmodified lines
356 356
357 /* The rest of the elements are unimportant for performance. */357 /* The rest of the elements are unimportant for performance. */
358 struct qlogicpti *next;358 struct qlogicpti *next;
359 __u32 res_dvma; /* Ptr to RESPONSE bufs (DVMA)*/359 dma_addr_t res_dvma; /* Ptr to RESPONSE bufs (DVMA)*/
360 __u32 req_dvma; /* Ptr to REQUEST bufs (DVMA) */360 dma_addr_t req_dvma; /* Ptr to REQUEST bufs (DVMA) */
361 u_char fware_majrev, fware_minrev, fware_micrev;361 u_char fware_majrev, fware_minrev, fware_micrev;
362 struct Scsi_Host *qhost;362 struct Scsi_Host *qhost;
363 int qpti_id;363 int qpti_id;
fs/btrfs/ctree.h+0−3
@@ -3232,9 +3232,6 @@ int btrfs_dirty_pages(struct btrfs_root *root, struct inode *inode, · 3231 unmodified lines
3232 loff_t pos, size_t write_bytes,3232 loff_t pos, size_t write_bytes,
3233 struct extent_state **cached);3233 struct extent_state **cached);
3234int btrfs_fdatawrite_range(struct inode *inode, loff_t start, loff_t end);3234int btrfs_fdatawrite_range(struct inode *inode, loff_t start, loff_t end);
3235ssize_t btrfs_copy_file_range(struct file *file_in, loff_t pos_in,
3236 struct file *file_out, loff_t pos_out,
3237 size_t len, unsigned int flags);
3238int btrfs_clone_file_range(struct file *file_in, loff_t pos_in,3235int btrfs_clone_file_range(struct file *file_in, loff_t pos_in,
3239 struct file *file_out, loff_t pos_out, u64 len);3236 struct file *file_out, loff_t pos_out, u64 len);
3240 3237
fs/btrfs/file.c+0−1
@@ -2998,7 +2998,6 @@ const struct file_operations btrfs_file_operations = { · 2997 unmodified lines
2998#ifdef CONFIG_COMPAT2998#ifdef CONFIG_COMPAT
2999 .compat_ioctl = btrfs_compat_ioctl,2999 .compat_ioctl = btrfs_compat_ioctl,
3000#endif3000#endif
3001 .copy_file_range = btrfs_copy_file_range,
3002 .clone_file_range = btrfs_clone_file_range,3001 .clone_file_range = btrfs_clone_file_range,
3003 .dedupe_file_range = btrfs_dedupe_file_range,3002 .dedupe_file_range = btrfs_dedupe_file_range,
3004};3003};
fs/btrfs/ioctl.c+0−12
@@ -3980,18 +3980,6 @@ out_unlock: · 3979 unmodified lines
3980 return ret;3980 return ret;
3981}3981}
3982 3982
3983ssize_t btrfs_copy_file_range(struct file *file_in, loff_t pos_in,
3984 struct file *file_out, loff_t pos_out,
3985 size_t len, unsigned int flags)
3986{
3987 ssize_t ret;
3988
3989 ret = btrfs_clone_files(file_out, file_in, pos_in, len, pos_out);
3990 if (ret == 0)
3991 ret = len;
3992 return ret;
3993}
3994
3995int btrfs_clone_file_range(struct file *src_file, loff_t off,3983int btrfs_clone_file_range(struct file *src_file, loff_t off,
3996 struct file *dst_file, loff_t destoff, u64 len)3984 struct file *dst_file, loff_t destoff, u64 len)
3997{3985{
fs/cifs/cifsencrypt.c+8−3
@@ -808,7 +808,11 @@ calc_seckey(struct cifs_ses *ses) · 807 unmodified lines
808 struct crypto_skcipher *tfm_arc4;808 struct crypto_skcipher *tfm_arc4;
809 struct scatterlist sgin, sgout;809 struct scatterlist sgin, sgout;
810 struct skcipher_request *req;810 struct skcipher_request *req;
811 unsigned char sec_key[CIFS_SESS_KEY_SIZE]; /* a nonce */811 unsigned char *sec_key;
812
813 sec_key = kmalloc(CIFS_SESS_KEY_SIZE, GFP_KERNEL);
814 if (sec_key == NULL)
815 return -ENOMEM;
812 816
813 get_random_bytes(sec_key, CIFS_SESS_KEY_SIZE);817 get_random_bytes(sec_key, CIFS_SESS_KEY_SIZE);
814 818
@@ -816,7 +820,7 @@ calc_seckey(struct cifs_ses *ses) · 1 unmodified line
816 if (IS_ERR(tfm_arc4)) {820 if (IS_ERR(tfm_arc4)) {
817 rc = PTR_ERR(tfm_arc4);821 rc = PTR_ERR(tfm_arc4);
818 cifs_dbg(VFS, "could not allocate crypto API arc4\n");822 cifs_dbg(VFS, "could not allocate crypto API arc4\n");
819 return rc;823 goto out;
820 }824 }
821 825
822 rc = crypto_skcipher_setkey(tfm_arc4, ses->auth_key.response,826 rc = crypto_skcipher_setkey(tfm_arc4, ses->auth_key.response,
@@ -854,7 +858,8 @@ calc_seckey(struct cifs_ses *ses) · 31 unmodified lines
854 858
855out_free_cipher:859out_free_cipher:
856 crypto_free_skcipher(tfm_arc4);860 crypto_free_skcipher(tfm_arc4);
857 861out:
862 kfree(sec_key);
858 return rc;863 return rc;
859}864}
860 865
fs/cifs/cifssmb.c+2−2
@@ -3427,6 +3427,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, · 3426 unmodified lines
3427 __u16 rc = 0;3427 __u16 rc = 0;
3428 struct cifs_posix_acl *cifs_acl = (struct cifs_posix_acl *)parm_data;3428 struct cifs_posix_acl *cifs_acl = (struct cifs_posix_acl *)parm_data;
3429 struct posix_acl_xattr_header *local_acl = (void *)pACL;3429 struct posix_acl_xattr_header *local_acl = (void *)pACL;
3430 struct posix_acl_xattr_entry *ace = (void *)(local_acl + 1);
3430 int count;3431 int count;
3431 int i;3432 int i;
3432 3433
@@ -3453,8 +3454,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, · 20 unmodified lines
3453 return 0;3454 return 0;
3454 }3455 }
3455 for (i = 0; i < count; i++) {3456 for (i = 0; i < count; i++) {
3456 rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i],3457 rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i], &ace[i]);
3457 (struct posix_acl_xattr_entry *)(local_acl + 1));
3458 if (rc != 0) {3458 if (rc != 0) {
3459 /* ACE not converted */3459 /* ACE not converted */
3460 break;3460 break;
fs/cifs/connect.c+18−7
@@ -412,6 +412,9 @@ cifs_reconnect(struct TCP_Server_Info *server) · 411 unmodified lines
412 }412 }
413 } while (server->tcpStatus == CifsNeedReconnect);413 } while (server->tcpStatus == CifsNeedReconnect);
414 414
415 if (server->tcpStatus == CifsNeedNegotiate)
416 mod_delayed_work(cifsiod_wq, &server->echo, 0);
417
415 return rc;418 return rc;
416}419}
417 420
@@ -421,17 +424,25 @@ cifs_echo_request(struct work_struct *work) · 3 unmodified lines
421 int rc;424 int rc;
422 struct TCP_Server_Info *server = container_of(work,425 struct TCP_Server_Info *server = container_of(work,
423 struct TCP_Server_Info, echo.work);426 struct TCP_Server_Info, echo.work);
424 unsigned long echo_interval = server->echo_interval;427 unsigned long echo_interval;
428
429 /*
430 * If we need to renegotiate, set echo interval to zero to
431 * immediately call echo service where we can renegotiate.
432 */
433 if (server->tcpStatus == CifsNeedNegotiate)
434 echo_interval = 0;
435 else
436 echo_interval = server->echo_interval;
425 437
426 /*438 /*
427 * We cannot send an echo if it is disabled or until the439 * We cannot send an echo if it is disabled.
428 * NEGOTIATE_PROTOCOL request is done, which is indicated by440 * Also, no need to ping if we got a response recently.
429 * server->ops->need_neg() == true. Also, no need to ping if
430 * we got a response recently.
431 */441 */
432 442
433 if (server->tcpStatus == CifsNeedReconnect ||443 if (server->tcpStatus == CifsNeedReconnect ||
434 server->tcpStatus == CifsExiting || server->tcpStatus == CifsNew ||444 server->tcpStatus == CifsExiting ||
445 server->tcpStatus == CifsNew ||
435 (server->ops->can_echo && !server->ops->can_echo(server)) ||446 (server->ops->can_echo && !server->ops->can_echo(server)) ||
436 time_before(jiffies, server->lstrp + echo_interval - HZ))447 time_before(jiffies, server->lstrp + echo_interval - HZ))
437 goto requeue_echo;448 goto requeue_echo;
@@ -442,7 +453,7 @@ cifs_echo_request(struct work_struct *work) · 4 unmodified lines
442 server->hostname);453 server->hostname);
443 454
444requeue_echo:455requeue_echo:
445 queue_delayed_work(cifsiod_wq, &server->echo, echo_interval);456 queue_delayed_work(cifsiod_wq, &server->echo, server->echo_interval);
446}457}
447 458
448static bool459static bool
fs/isofs/rock.c+2−2
@@ -377,9 +377,9 @@ repeat: · 376 unmodified lines
377 {377 {
378 int p;378 int p;
379 for (p = 0; p < rr->u.ER.len_id; p++)379 for (p = 0; p < rr->u.ER.len_id; p++)
380 printk("%c", rr->u.ER.data[p]);380 printk(KERN_CONT "%c", rr->u.ER.data[p]);
381 }381 }
382 printk("\n");382 printk(KERN_CONT "\n");
383 break;383 break;
384 case SIG('P', 'X'):384 case SIG('P', 'X'):
385 inode->i_mode = isonum_733(rr->u.PX.mode);385 inode->i_mode = isonum_733(rr->u.PX.mode);
fs/ocfs2/alloc.c+3−4
@@ -5194,7 +5194,7 @@ int ocfs2_change_extent_flag(handle_t *handle, · 5193 unmodified lines
5194 rec = &el->l_recs[index];5194 rec = &el->l_recs[index];
5195 if (new_flags && (rec->e_flags & new_flags)) {5195 if (new_flags && (rec->e_flags & new_flags)) {
5196 mlog(ML_ERROR, "Owner %llu tried to set %d flags on an "5196 mlog(ML_ERROR, "Owner %llu tried to set %d flags on an "
5197 "extent that already had them",5197 "extent that already had them\n",
5198 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),5198 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
5199 new_flags);5199 new_flags);
5200 goto out;5200 goto out;
@@ -5202,7 +5202,7 @@ int ocfs2_change_extent_flag(handle_t *handle, · 1 unmodified line
5202 5202
5203 if (clear_flags && !(rec->e_flags & clear_flags)) {5203 if (clear_flags && !(rec->e_flags & clear_flags)) {
5204 mlog(ML_ERROR, "Owner %llu tried to clear %d flags on an "5204 mlog(ML_ERROR, "Owner %llu tried to clear %d flags on an "
5205 "extent that didn't have them",5205 "extent that didn't have them\n",
5206 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),5206 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
5207 clear_flags);5207 clear_flags);
5208 goto out;5208 goto out;
@@ -5713,8 +5713,7 @@ int ocfs2_remove_btree_range(struct inode *inode, · 504 unmodified lines
5713 struct ocfs2_refcount_tree *ref_tree = NULL;5713 struct ocfs2_refcount_tree *ref_tree = NULL;
5714 5714
5715 if ((flags & OCFS2_EXT_REFCOUNTED) && len) {5715 if ((flags & OCFS2_EXT_REFCOUNTED) && len) {
5716 BUG_ON(!(OCFS2_I(inode)->ip_dyn_features &5716 BUG_ON(!ocfs2_is_refcount_inode(inode));
5717 OCFS2_HAS_REFCOUNT_FL));
5718 5717
5719 if (!refcount_tree_locked) {5718 if (!refcount_tree_locked) {
5720 ret = ocfs2_lock_refcount_tree(osb, refcount_loc, 1,5719 ret = ocfs2_lock_refcount_tree(osb, refcount_loc, 1,
fs/ocfs2/aops.c+20−11
@@ -464,6 +464,15 @@ static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block) · 463 unmodified lines
464 trace_ocfs2_bmap((unsigned long long)OCFS2_I(inode)->ip_blkno,464 trace_ocfs2_bmap((unsigned long long)OCFS2_I(inode)->ip_blkno,
465 (unsigned long long)block);465 (unsigned long long)block);
466 466
467 /*
468 * The swap code (ab-)uses ->bmap to get a block mapping and then
469 * bypasseѕ the file system for actual I/O. We really can't allow
470 * that on refcounted inodes, so we have to skip out here. And yes,
471 * 0 is the magic code for a bmap error..
472 */
473 if (ocfs2_is_refcount_inode(inode))
474 return 0;
475
467 /* We don't need to lock journal system files, since they aren't476 /* We don't need to lock journal system files, since they aren't
468 * accessed concurrently from multiple nodes.477 * accessed concurrently from multiple nodes.
469 */478 */
@@ -2254,10 +2263,10 @@ out: · 1784 unmodified lines
2254 return ret;2263 return ret;
2255}2264}
2256 2265
2257static void ocfs2_dio_end_io_write(struct inode *inode,2266static int ocfs2_dio_end_io_write(struct inode *inode,
2258 struct ocfs2_dio_write_ctxt *dwc,2267 struct ocfs2_dio_write_ctxt *dwc,
2259 loff_t offset,2268 loff_t offset,
2260 ssize_t bytes)2269 ssize_t bytes)
2261{2270{
2262 struct ocfs2_cached_dealloc_ctxt dealloc;2271 struct ocfs2_cached_dealloc_ctxt dealloc;
2263 struct ocfs2_extent_tree et;2272 struct ocfs2_extent_tree et;
@@ -2308,7 +2317,7 @@ static void ocfs2_dio_end_io_write(struct inode *inode, · 44 unmodified lines
2308 mlog_errno(ret);2317 mlog_errno(ret);
2309 }2318 }
2310 2319
2311 di = (struct ocfs2_dinode *)di_bh;2320 di = (struct ocfs2_dinode *)di_bh->b_data;
2312 2321
2313 ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh);2322 ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh);
2314 2323
@@ -2365,6 +2374,8 @@ out: · 50 unmodified lines
2365 if (locked)2374 if (locked)
2366 inode_unlock(inode);2375 inode_unlock(inode);
2367 ocfs2_dio_free_write_ctx(inode, dwc);2376 ocfs2_dio_free_write_ctx(inode, dwc);
2377
2378 return ret;
2368}2379}
2369 2380
2370/*2381/*
@@ -2379,21 +2390,19 @@ static int ocfs2_dio_end_io(struct kiocb *iocb, · 8 unmodified lines
2379{2390{
2380 struct inode *inode = file_inode(iocb->ki_filp);2391 struct inode *inode = file_inode(iocb->ki_filp);
2381 int level;2392 int level;
2382 2393 int ret = 0;
2383 if (bytes <= 0)
2384 return 0;
2385 2394
2386 /* this io's submitter should not have unlocked this before we could */2395 /* this io's submitter should not have unlocked this before we could */
2387 BUG_ON(!ocfs2_iocb_is_rw_locked(iocb));2396 BUG_ON(!ocfs2_iocb_is_rw_locked(iocb));
2388 2397
2389 if (private)2398 if (bytes > 0 && private)
2390 ocfs2_dio_end_io_write(inode, private, offset, bytes);2399 ret = ocfs2_dio_end_io_write(inode, private, offset, bytes);
2391 2400
2392 ocfs2_iocb_clear_rw_locked(iocb);2401 ocfs2_iocb_clear_rw_locked(iocb);
2393 2402
2394 level = ocfs2_iocb_rw_locked_level(iocb);2403 level = ocfs2_iocb_rw_locked_level(iocb);
2395 ocfs2_rw_unlock(inode, level);2404 ocfs2_rw_unlock(inode, level);
2396 return 0;2405 return ret;
2397}2406}
2398 2407
2399static ssize_t ocfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter)2408static ssize_t ocfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
fs/ocfs2/file.c+35−7
@@ -1030,7 +1030,7 @@ int ocfs2_extend_no_holes(struct inode *inode, struct buffer_head *di_bh, · 1029 unmodified lines
1030 * Only quota files call this without a bh, and they can't be1030 * Only quota files call this without a bh, and they can't be
1031 * refcounted.1031 * refcounted.
1032 */1032 */
1033 BUG_ON(!di_bh && (oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL));1033 BUG_ON(!di_bh && ocfs2_is_refcount_inode(inode));
1034 BUG_ON(!di_bh && !(oi->ip_flags & OCFS2_INODE_SYSTEM_FILE));1034 BUG_ON(!di_bh && !(oi->ip_flags & OCFS2_INODE_SYSTEM_FILE));
1035 1035
1036 clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size);1036 clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size);
@@ -1667,9 +1667,9 @@ static void ocfs2_calc_trunc_pos(struct inode *inode, · 630 unmodified lines
1667 *done = ret;1667 *done = ret;
1668}1668}
1669 1669
1670static int ocfs2_remove_inode_range(struct inode *inode,1670int ocfs2_remove_inode_range(struct inode *inode,
1671 struct buffer_head *di_bh, u64 byte_start,1671 struct buffer_head *di_bh, u64 byte_start,
1672 u64 byte_len)1672 u64 byte_len)
1673{1673{
1674 int ret = 0, flags = 0, done = 0, i;1674 int ret = 0, flags = 0, done = 0, i;
1675 u32 trunc_start, trunc_len, trunc_end, trunc_cpos, phys_cpos;1675 u32 trunc_start, trunc_len, trunc_end, trunc_cpos, phys_cpos;
@@ -1719,8 +1719,7 @@ static int ocfs2_remove_inode_range(struct inode *inode, · 43 unmodified lines
1719 * within one cluster(means is not exactly aligned to clustersize).1719 * within one cluster(means is not exactly aligned to clustersize).
1720 */1720 */
1721 1721
1722 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL) {1722 if (ocfs2_is_refcount_inode(inode)) {
1723
1724 ret = ocfs2_cow_file_pos(inode, di_bh, byte_start);1723 ret = ocfs2_cow_file_pos(inode, di_bh, byte_start);
1725 if (ret) {1724 if (ret) {
1726 mlog_errno(ret);1725 mlog_errno(ret);
@@ -2036,7 +2035,7 @@ int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos, · 309 unmodified lines
2036 struct super_block *sb = inode->i_sb;2035 struct super_block *sb = inode->i_sb;
2037 2036
2038 if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)) ||2037 if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)) ||
2039 !(OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL) ||2038 !ocfs2_is_refcount_inode(inode) ||
2040 OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)2039 OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
2041 return 0;2040 return 0;
2042 2041
@@ -2440,6 +2439,31 @@ out: · 397 unmodified lines
2440 return offset;2439 return offset;
2441}2440}
2442 2441
2442static int ocfs2_file_clone_range(struct file *file_in,
2443 loff_t pos_in,
2444 struct file *file_out,
2445 loff_t pos_out,
2446 u64 len)
2447{
2448 return ocfs2_reflink_remap_range(file_in, pos_in, file_out, pos_out,
2449 len, false);
2450}
2451
2452static ssize_t ocfs2_file_dedupe_range(struct file *src_file,
2453 u64 loff,
2454 u64 len,
2455 struct file *dst_file,
2456 u64 dst_loff)
2457{
2458 int error;
2459
2460 error = ocfs2_reflink_remap_range(src_file, loff, dst_file, dst_loff,
2461 len, true);
2462 if (error)
2463 return error;
2464 return len;
2465}
2466
2443const struct inode_operations ocfs2_file_iops = {2467const struct inode_operations ocfs2_file_iops = {
2444 .setattr = ocfs2_setattr,2468 .setattr = ocfs2_setattr,
2445 .getattr = ocfs2_getattr,2469 .getattr = ocfs2_getattr,
@@ -2479,6 +2503,8 @@ const struct file_operations ocfs2_fops = { · 33 unmodified lines
2479 .splice_read = generic_file_splice_read,2503 .splice_read = generic_file_splice_read,
2480 .splice_write = iter_file_splice_write,2504 .splice_write = iter_file_splice_write,
2481 .fallocate = ocfs2_fallocate,2505 .fallocate = ocfs2_fallocate,
2506 .clone_file_range = ocfs2_file_clone_range,
2507 .dedupe_file_range = ocfs2_file_dedupe_range,
2482};2508};
2483 2509
2484const struct file_operations ocfs2_dops = {2510const struct file_operations ocfs2_dops = {
@@ -2524,6 +2550,8 @@ const struct file_operations ocfs2_fops_no_plocks = { · 39 unmodified lines
2524 .splice_read = generic_file_splice_read,2550 .splice_read = generic_file_splice_read,
2525 .splice_write = iter_file_splice_write,2551 .splice_write = iter_file_splice_write,
2526 .fallocate = ocfs2_fallocate,2552 .fallocate = ocfs2_fallocate,
2553 .clone_file_range = ocfs2_file_clone_range,
2554 .dedupe_file_range = ocfs2_file_dedupe_range,
2527};2555};
2528 2556
2529const struct file_operations ocfs2_dops_no_plocks = {2557const struct file_operations ocfs2_dops_no_plocks = {
fs/ocfs2/file.h+3−0
@@ -82,4 +82,7 @@ int ocfs2_change_file_space(struct file *file, unsigned int cmd, · 81 unmodified lines
82 82
83int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos,83int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos,
84 size_t count);84 size_t count);
85int ocfs2_remove_inode_range(struct inode *inode,
86 struct buffer_head *di_bh, u64 byte_start,
87 u64 byte_len);
85#endif /* OCFS2_FILE_H */88#endif /* OCFS2_FILE_H */
fs/ocfs2/inode.h+6−0
@@ -181,4 +181,10 @@ static inline struct ocfs2_inode_info *cache_info_to_inode(struct ocfs2_caching_ · 180 unmodified lines
181 return container_of(ci, struct ocfs2_inode_info, ip_metadata_cache);181 return container_of(ci, struct ocfs2_inode_info, ip_metadata_cache);
182}182}
183 183
184/* Does this inode have the reflink flag set? */
185static inline bool ocfs2_is_refcount_inode(struct inode *inode)
186{
187 return (OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL);
188}
189
184#endif /* OCFS2_INODE_H */190#endif /* OCFS2_INODE_H */
fs/ocfs2/move_extents.c+2−8
@@ -235,10 +235,7 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context, · 234 unmodified lines
235 u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);235 u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
236 236
237 if ((ext_flags & OCFS2_EXT_REFCOUNTED) && *len) {237 if ((ext_flags & OCFS2_EXT_REFCOUNTED) && *len) {
238 238 BUG_ON(!ocfs2_is_refcount_inode(inode));
239 BUG_ON(!(OCFS2_I(inode)->ip_dyn_features &
240 OCFS2_HAS_REFCOUNT_FL));
241
242 BUG_ON(!context->refcount_loc);239 BUG_ON(!context->refcount_loc);
243 240
244 ret = ocfs2_lock_refcount_tree(osb, context->refcount_loc, 1,241 ret = ocfs2_lock_refcount_tree(osb, context->refcount_loc, 1,
@@ -581,10 +578,7 @@ static int ocfs2_move_extent(struct ocfs2_move_extents_context *context, · 336 unmodified lines
581 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);578 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
582 579
583 if ((ext_flags & OCFS2_EXT_REFCOUNTED) && len) {580 if ((ext_flags & OCFS2_EXT_REFCOUNTED) && len) {
584 581 BUG_ON(!ocfs2_is_refcount_inode(inode));
585 BUG_ON(!(OCFS2_I(inode)->ip_dyn_features &
586 OCFS2_HAS_REFCOUNT_FL));
587
588 BUG_ON(!context->refcount_loc);582 BUG_ON(!context->refcount_loc);
589 583
590 ret = ocfs2_lock_refcount_tree(osb, context->refcount_loc, 1,584 ret = ocfs2_lock_refcount_tree(osb, context->refcount_loc, 1,
fs/ocfs2/refcounttree.c+451−13
@@ -34,6 +34,7 @@ · 33 unmodified lines
34#include "xattr.h"34#include "xattr.h"
35#include "namei.h"35#include "namei.h"
36#include "ocfs2_trace.h"36#include "ocfs2_trace.h"
37#include "file.h"
37 38
38#include <linux/bio.h>39#include <linux/bio.h>
39#include <linux/blkdev.h>40#include <linux/blkdev.h>
@@ -410,7 +411,7 @@ static int ocfs2_get_refcount_block(struct inode *inode, u64 *ref_blkno) · 370 unmodified lines
410 goto out;411 goto out;
411 }412 }
412 413
413 BUG_ON(!(OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL));414 BUG_ON(!ocfs2_is_refcount_inode(inode));
414 415
415 di = (struct ocfs2_dinode *)di_bh->b_data;416 di = (struct ocfs2_dinode *)di_bh->b_data;
416 *ref_blkno = le64_to_cpu(di->i_refcount_loc);417 *ref_blkno = le64_to_cpu(di->i_refcount_loc);
@@ -570,7 +571,7 @@ static int ocfs2_create_refcount_tree(struct inode *inode, · 153 unmodified lines
570 u32 num_got;571 u32 num_got;
571 u64 suballoc_loc, first_blkno;572 u64 suballoc_loc, first_blkno;
572 573
573 BUG_ON(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL);574 BUG_ON(ocfs2_is_refcount_inode(inode));
574 575
575 trace_ocfs2_create_refcount_tree(576 trace_ocfs2_create_refcount_tree(
576 (unsigned long long)OCFS2_I(inode)->ip_blkno);577 (unsigned long long)OCFS2_I(inode)->ip_blkno);
@@ -708,7 +709,7 @@ static int ocfs2_set_refcount_tree(struct inode *inode, · 131 unmodified lines
708 struct ocfs2_refcount_block *rb;709 struct ocfs2_refcount_block *rb;
709 struct ocfs2_refcount_tree *ref_tree;710 struct ocfs2_refcount_tree *ref_tree;
710 711
711 BUG_ON(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL);712 BUG_ON(ocfs2_is_refcount_inode(inode));
712 713
713 ret = ocfs2_lock_refcount_tree(osb, refcount_loc, 1,714 ret = ocfs2_lock_refcount_tree(osb, refcount_loc, 1,
714 &ref_tree, &ref_root_bh);715 &ref_tree, &ref_root_bh);
@@ -775,7 +776,7 @@ int ocfs2_remove_refcount_tree(struct inode *inode, struct buffer_head *di_bh) · 60 unmodified lines
775 u64 blk = 0, bg_blkno = 0, ref_blkno = le64_to_cpu(di->i_refcount_loc);776 u64 blk = 0, bg_blkno = 0, ref_blkno = le64_to_cpu(di->i_refcount_loc);
776 u16 bit = 0;777 u16 bit = 0;
777 778
778 if (!(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL))779 if (!ocfs2_is_refcount_inode(inode))
779 return 0;780 return 0;
780 781
781 BUG_ON(!ref_blkno);782 BUG_ON(!ref_blkno);
@@ -2299,11 +2300,10 @@ int ocfs2_decrease_refcount(struct inode *inode, · 1517 unmodified lines
2299{2300{
2300 int ret;2301 int ret;
2301 u64 ref_blkno;2302 u64 ref_blkno;
2302 struct ocfs2_inode_info *oi = OCFS2_I(inode);
2303 struct buffer_head *ref_root_bh = NULL;2303 struct buffer_head *ref_root_bh = NULL;
2304 struct ocfs2_refcount_tree *tree;2304 struct ocfs2_refcount_tree *tree;
2305 2305
2306 BUG_ON(!(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL));2306 BUG_ON(!ocfs2_is_refcount_inode(inode));
2307 2307
2308 ret = ocfs2_get_refcount_block(inode, &ref_blkno);2308 ret = ocfs2_get_refcount_block(inode, &ref_blkno);
2309 if (ret) {2309 if (ret) {
@@ -2533,7 +2533,6 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode, · 223 unmodified lines
2533 int *ref_blocks)2533 int *ref_blocks)
2534{2534{
2535 int ret;2535 int ret;
2536 struct ocfs2_inode_info *oi = OCFS2_I(inode);
2537 struct buffer_head *ref_root_bh = NULL;2536 struct buffer_head *ref_root_bh = NULL;
2538 struct ocfs2_refcount_tree *tree;2537 struct ocfs2_refcount_tree *tree;
2539 u64 start_cpos = ocfs2_blocks_to_clusters(inode->i_sb, phys_blkno);2538 u64 start_cpos = ocfs2_blocks_to_clusters(inode->i_sb, phys_blkno);
@@ -2544,7 +2543,7 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode, · 4 unmodified lines
2544 goto out;2543 goto out;
2545 }2544 }
2546 2545
2547 BUG_ON(!(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL));2546 BUG_ON(!ocfs2_is_refcount_inode(inode));
2548 2547
2549 ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb),2548 ret = ocfs2_get_refcount_tree(OCFS2_SB(inode->i_sb),
2550 refcount_loc, &tree);2549 refcount_loc, &tree);
@@ -3412,14 +3411,13 @@ static int ocfs2_refcount_cow_hunk(struct inode *inode, · 861 unmodified lines
3412{3411{
3413 int ret;3412 int ret;
3414 u32 cow_start = 0, cow_len = 0;3413 u32 cow_start = 0, cow_len = 0;
3415 struct ocfs2_inode_info *oi = OCFS2_I(inode);
3416 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);3414 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
3417 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;3415 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
3418 struct buffer_head *ref_root_bh = NULL;3416 struct buffer_head *ref_root_bh = NULL;
3419 struct ocfs2_refcount_tree *ref_tree;3417 struct ocfs2_refcount_tree *ref_tree;
3420 struct ocfs2_cow_context *context = NULL;3418 struct ocfs2_cow_context *context = NULL;
3421 3419
3422 BUG_ON(!(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL));3420 BUG_ON(!ocfs2_is_refcount_inode(inode));
3423 3421
3424 ret = ocfs2_refcount_cal_cow_clusters(inode, &di->id2.i_list,3422 ret = ocfs2_refcount_cal_cow_clusters(inode, &di->id2.i_list,
3425 cpos, write_len, max_cpos,3423 cpos, write_len, max_cpos,
@@ -3629,11 +3627,10 @@ int ocfs2_refcount_cow_xattr(struct inode *inode, · 203 unmodified lines
3629{3627{
3630 int ret;3628 int ret;
3631 struct ocfs2_xattr_value_root *xv = vb->vb_xv;3629 struct ocfs2_xattr_value_root *xv = vb->vb_xv;
3632 struct ocfs2_inode_info *oi = OCFS2_I(inode);
3633 struct ocfs2_cow_context *context = NULL;3630 struct ocfs2_cow_context *context = NULL;
3634 u32 cow_start, cow_len;3631 u32 cow_start, cow_len;
3635 3632
3636 BUG_ON(!(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL));3633 BUG_ON(!ocfs2_is_refcount_inode(inode));
3637 3634
3638 ret = ocfs2_refcount_cal_cow_clusters(inode, &xv->xr_list,3635 ret = ocfs2_refcount_cal_cow_clusters(inode, &xv->xr_list,
3639 cpos, write_len, UINT_MAX,3636 cpos, write_len, UINT_MAX,
@@ -3696,6 +3693,9 @@ int ocfs2_add_refcount_flag(struct inode *inode, · 56 unmodified lines
3696 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);3693 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
3697 struct ocfs2_alloc_context *meta_ac = NULL;3694 struct ocfs2_alloc_context *meta_ac = NULL;
3698 3695
3696 /* We need to be able to handle at least an extent tree split. */
3697 ref_blocks = ocfs2_extend_meta_needed(data_et->et_root_el);
3698
3699 ret = ocfs2_calc_refcount_meta_credits(inode->i_sb,3699 ret = ocfs2_calc_refcount_meta_credits(inode->i_sb,
3700 ref_ci, ref_root_bh,3700 ref_ci, ref_root_bh,
3701 p_cluster, num_clusters,3701 p_cluster, num_clusters,
@@ -3807,7 +3807,7 @@ static int ocfs2_attach_refcount_tree(struct inode *inode, · 105 unmodified lines
3807 3807
3808 ocfs2_init_dealloc_ctxt(&dealloc);3808 ocfs2_init_dealloc_ctxt(&dealloc);
3809 3809
3810 if (!(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL)) {3810 if (!ocfs2_is_refcount_inode(inode)) {
3811 ret = ocfs2_create_refcount_tree(inode, di_bh);3811 ret = ocfs2_create_refcount_tree(inode, di_bh);
3812 if (ret) {3812 if (ret) {
3813 mlog_errno(ret);3813 mlog_errno(ret);
@@ -3934,6 +3934,13 @@ static int ocfs2_add_refcounted_extent(struct inode *inode, · 120 unmodified lines
3934 ret = ocfs2_increase_refcount(handle, ref_ci, ref_root_bh,3934 ret = ocfs2_increase_refcount(handle, ref_ci, ref_root_bh,
3935 p_cluster, num_clusters,3935 p_cluster, num_clusters,
3936 meta_ac, dealloc);3936 meta_ac, dealloc);
3937 if (ret) {
3938 mlog_errno(ret);
3939 goto out_commit;
3940 }
3941
3942 ret = dquot_alloc_space_nodirty(inode,
3943 ocfs2_clusters_to_bytes(osb->sb, num_clusters));
3937 if (ret)3944 if (ret)
3938 mlog_errno(ret);3945 mlog_errno(ret);
3939 3946
@@ -4442,3 +4449,434 @@ out: · 502 unmodified lines
4442 4449
4443 return error;4450 return error;
4444}4451}
4452
4453/* Update destination inode size, if necessary. */
4454static int ocfs2_reflink_update_dest(struct inode *dest,
4455 struct buffer_head *d_bh,
4456 loff_t newlen)
4457{
4458 handle_t *handle;
4459 int ret;
4460
4461 dest->i_blocks = ocfs2_inode_sector_count(dest);
4462
4463 if (newlen <= i_size_read(dest))
4464 return 0;
4465
4466 handle = ocfs2_start_trans(OCFS2_SB(dest->i_sb),
4467 OCFS2_INODE_UPDATE_CREDITS);
4468 if (IS_ERR(handle)) {
4469 ret = PTR_ERR(handle);
4470 mlog_errno(ret);
4471 return ret;
4472 }
4473
4474 /* Extend i_size if needed. */
4475 spin_lock(&OCFS2_I(dest)->ip_lock);
4476 if (newlen > i_size_read(dest))
4477 i_size_write(dest, newlen);
4478 spin_unlock(&OCFS2_I(dest)->ip_lock);
4479 dest->i_ctime = dest->i_mtime = current_time(dest);
4480
4481 ret = ocfs2_mark_inode_dirty(handle, dest, d_bh);
4482 if (ret) {
4483 mlog_errno(ret);
4484 goto out_commit;
4485 }
4486
4487out_commit:
4488 ocfs2_commit_trans(OCFS2_SB(dest->i_sb), handle);
4489 return ret;
4490}
4491
4492/* Remap the range pos_in:len in s_inode to pos_out:len in t_inode. */
4493static int ocfs2_reflink_remap_extent(struct inode *s_inode,
4494 struct buffer_head *s_bh,
4495 loff_t pos_in,
4496 struct inode *t_inode,
4497 struct buffer_head *t_bh,
4498 loff_t pos_out,
4499 loff_t len,
4500 struct ocfs2_cached_dealloc_ctxt *dealloc)
4501{
4502 struct ocfs2_extent_tree s_et;
4503 struct ocfs2_extent_tree t_et;
4504 struct ocfs2_dinode *dis;
4505 struct buffer_head *ref_root_bh = NULL;
4506 struct ocfs2_refcount_tree *ref_tree;
4507 struct ocfs2_super *osb;
4508 loff_t pstart, plen;
4509 u32 p_cluster, num_clusters, slast, spos, tpos;
4510 unsigned int ext_flags;
4511 int ret = 0;
4512
4513 osb = OCFS2_SB(s_inode->i_sb);
4514 dis = (struct ocfs2_dinode *)s_bh->b_data;
4515 ocfs2_init_dinode_extent_tree(&s_et, INODE_CACHE(s_inode), s_bh);
4516 ocfs2_init_dinode_extent_tree(&t_et, INODE_CACHE(t_inode), t_bh);
4517
4518 spos = ocfs2_bytes_to_clusters(s_inode->i_sb, pos_in);
4519 tpos = ocfs2_bytes_to_clusters(t_inode->i_sb, pos_out);
4520 slast = ocfs2_clusters_for_bytes(s_inode->i_sb, pos_in + len);
4521
4522 while (spos < slast) {
4523 if (fatal_signal_pending(current)) {
4524 ret = -EINTR;
4525 goto out;
4526 }
4527
4528 /* Look up the extent. */
4529 ret = ocfs2_get_clusters(s_inode, spos, &p_cluster,
4530 &num_clusters, &ext_flags);
4531 if (ret) {
4532 mlog_errno(ret);
4533 goto out;
4534 }
4535
4536 num_clusters = min_t(u32, num_clusters, slast - spos);
4537
4538 /* Punch out the dest range. */
4539 pstart = ocfs2_clusters_to_bytes(t_inode->i_sb, tpos);
4540 plen = ocfs2_clusters_to_bytes(t_inode->i_sb, num_clusters);
4541 ret = ocfs2_remove_inode_range(t_inode, t_bh, pstart, plen);
4542 if (ret) {
4543 mlog_errno(ret);
4544 goto out;
4545 }
4546
4547 if (p_cluster == 0)
4548 goto next_loop;
4549
4550 /* Lock the refcount btree... */
4551 ret = ocfs2_lock_refcount_tree(osb,
4552 le64_to_cpu(dis->i_refcount_loc),
4553 1, &ref_tree, &ref_root_bh);
4554 if (ret) {
4555 mlog_errno(ret);
4556 goto out;
4557 }
4558
4559 /* Mark s_inode's extent as refcounted. */
4560 if (!(ext_flags & OCFS2_EXT_REFCOUNTED)) {
4561 ret = ocfs2_add_refcount_flag(s_inode, &s_et,
4562 &ref_tree->rf_ci,
4563 ref_root_bh, spos,
4564 p_cluster, num_clusters,
4565 dealloc, NULL);
4566 if (ret) {
4567 mlog_errno(ret);
4568 goto out_unlock_refcount;
4569 }
4570 }
4571
4572 /* Map in the new extent. */
4573 ext_flags |= OCFS2_EXT_REFCOUNTED;
4574 ret = ocfs2_add_refcounted_extent(t_inode, &t_et,
4575 &ref_tree->rf_ci,
4576 ref_root_bh,
4577 tpos, p_cluster,
4578 num_clusters,
4579 ext_flags,
4580 dealloc);
4581 if (ret) {
4582 mlog_errno(ret);
4583 goto out_unlock_refcount;
4584 }
4585
4586 ocfs2_unlock_refcount_tree(osb, ref_tree, 1);
4587 brelse(ref_root_bh);
4588next_loop:
4589 spos += num_clusters;
4590 tpos += num_clusters;
4591 }
4592
4593out:
4594 return ret;
4595out_unlock_refcount:
4596 ocfs2_unlock_refcount_tree(osb, ref_tree, 1);
4597 brelse(ref_root_bh);
4598 return ret;
4599}
4600
4601/* Set up refcount tree and remap s_inode to t_inode. */
4602static int ocfs2_reflink_remap_blocks(struct inode *s_inode,
4603 struct buffer_head *s_bh,
4604 loff_t pos_in,
4605 struct inode *t_inode,
4606 struct buffer_head *t_bh,
4607 loff_t pos_out,
4608 loff_t len)
4609{
4610 struct ocfs2_cached_dealloc_ctxt dealloc;
4611 struct ocfs2_super *osb;
4612 struct ocfs2_dinode *dis;
4613 struct ocfs2_dinode *dit;
4614 int ret;
4615
4616 osb = OCFS2_SB(s_inode->i_sb);
4617 dis = (struct ocfs2_dinode *)s_bh->b_data;
4618 dit = (struct ocfs2_dinode *)t_bh->b_data;
4619 ocfs2_init_dealloc_ctxt(&dealloc);
4620
4621 /*
4622 * If we're reflinking the entire file and the source is inline
4623 * data, just copy the contents.
4624 */
4625 if (pos_in == pos_out && pos_in == 0 && len == i_size_read(s_inode) &&
4626 i_size_read(t_inode) <= len &&
4627 (OCFS2_I(s_inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)) {
4628 ret = ocfs2_duplicate_inline_data(s_inode, s_bh, t_inode, t_bh);
4629 if (ret)
4630 mlog_errno(ret);
4631 goto out;
4632 }
4633
4634 /*
4635 * If both inodes belong to two different refcount groups then
4636 * forget it because we don't know how (or want) to go merging
4637 * refcount trees.
4638 */
4639 ret = -EOPNOTSUPP;
4640 if (ocfs2_is_refcount_inode(s_inode) &&
4641 ocfs2_is_refcount_inode(t_inode) &&
4642 le64_to_cpu(dis->i_refcount_loc) !=
4643 le64_to_cpu(dit->i_refcount_loc))
4644 goto out;
4645
4646 /* Neither inode has a refcount tree. Add one to s_inode. */
4647 if (!ocfs2_is_refcount_inode(s_inode) &&
4648 !ocfs2_is_refcount_inode(t_inode)) {
4649 ret = ocfs2_create_refcount_tree(s_inode, s_bh);
4650 if (ret) {
4651 mlog_errno(ret);
4652 goto out;
4653 }
4654 }
4655
4656 /* Ensure that both inodes end up with the same refcount tree. */
4657 if (!ocfs2_is_refcount_inode(s_inode)) {
4658 ret = ocfs2_set_refcount_tree(s_inode, s_bh,
4659 le64_to_cpu(dit->i_refcount_loc));
4660 if (ret) {
4661 mlog_errno(ret);
4662 goto out;
4663 }
4664 }
4665 if (!ocfs2_is_refcount_inode(t_inode)) {
4666 ret = ocfs2_set_refcount_tree(t_inode, t_bh,
4667 le64_to_cpu(dis->i_refcount_loc));
4668 if (ret) {
4669 mlog_errno(ret);
4670 goto out;
4671 }
4672 }
4673
4674 /* Turn off inline data in the dest file. */
4675 if (OCFS2_I(t_inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
4676 ret = ocfs2_convert_inline_data_to_extents(t_inode, t_bh);
4677 if (ret) {
4678 mlog_errno(ret);
4679 goto out;
4680 }
4681 }
4682
4683 /* Actually remap extents now. */
4684 ret = ocfs2_reflink_remap_extent(s_inode, s_bh, pos_in, t_inode, t_bh,
4685 pos_out, len, &dealloc);
4686 if (ret) {
4687 mlog_errno(ret);
4688 goto out;
4689 }
4690
4691out:
4692 if (ocfs2_dealloc_has_cluster(&dealloc)) {
4693 ocfs2_schedule_truncate_log_flush(osb, 1);
4694 ocfs2_run_deallocs(osb, &dealloc);
4695 }
4696
4697 return ret;
4698}
4699
4700/* Lock an inode and grab a bh pointing to the inode. */
4701static int ocfs2_reflink_inodes_lock(struct inode *s_inode,
4702 struct buffer_head **bh1,
4703 struct inode *t_inode,
4704 struct buffer_head **bh2)
4705{
4706 struct inode *inode1;
4707 struct inode *inode2;
4708 struct ocfs2_inode_info *oi1;
4709 struct ocfs2_inode_info *oi2;
4710 bool same_inode = (s_inode == t_inode);
4711 int status;
4712
4713 /* First grab the VFS and rw locks. */
4714 lock_two_nondirectories(s_inode, t_inode);
4715 inode1 = s_inode;
4716 inode2 = t_inode;
4717 if (inode1->i_ino > inode2->i_ino)
4718 swap(inode1, inode2);
4719
4720 status = ocfs2_rw_lock(inode1, 1);
4721 if (status) {
4722 mlog_errno(status);
4723 goto out_i1;
4724 }
4725 if (!same_inode) {
4726 status = ocfs2_rw_lock(inode2, 1);
4727 if (status) {
4728 mlog_errno(status);
4729 goto out_i2;
4730 }
4731 }
4732
4733 /* Now go for the cluster locks */
4734 oi1 = OCFS2_I(inode1);
4735 oi2 = OCFS2_I(inode2);
4736
4737 trace_ocfs2_double_lock((unsigned long long)oi1->ip_blkno,
4738 (unsigned long long)oi2->ip_blkno);
4739
4740 if (*bh1)
4741 *bh1 = NULL;
4742 if (*bh2)
4743 *bh2 = NULL;
4744
4745 /* We always want to lock the one with the lower lockid first. */
4746 if (oi1->ip_blkno > oi2->ip_blkno)
4747 mlog_errno(-ENOLCK);
4748
4749 /* lock id1 */
4750 status = ocfs2_inode_lock_nested(inode1, bh1, 1, OI_LS_REFLINK_TARGET);
4751 if (status < 0) {
4752 if (status != -ENOENT)
4753 mlog_errno(status);
4754 goto out_rw2;
4755 }
4756
4757 /* lock id2 */
4758 if (!same_inode) {
4759 status = ocfs2_inode_lock_nested(inode2, bh2, 1,
4760 OI_LS_REFLINK_TARGET);
4761 if (status < 0) {
4762 if (status != -ENOENT)
4763 mlog_errno(status);
4764 goto out_cl1;
4765 }
4766 } else
4767 *bh2 = *bh1;
4768
4769 trace_ocfs2_double_lock_end(
4770 (unsigned long long)OCFS2_I(inode1)->ip_blkno,
4771 (unsigned long long)OCFS2_I(inode2)->ip_blkno);
4772
4773 return 0;
4774
4775out_cl1:
4776 ocfs2_inode_unlock(inode1, 1);
4777 brelse(*bh1);
4778 *bh1 = NULL;
4779out_rw2:
4780 ocfs2_rw_unlock(inode2, 1);
4781out_i2:
4782 ocfs2_rw_unlock(inode1, 1);
4783out_i1:
4784 unlock_two_nondirectories(s_inode, t_inode);
4785 return status;
4786}
4787
4788/* Unlock both inodes and release buffers. */
4789static void ocfs2_reflink_inodes_unlock(struct inode *s_inode,
4790 struct buffer_head *s_bh,
4791 struct inode *t_inode,
4792 struct buffer_head *t_bh)
4793{
4794 ocfs2_inode_unlock(s_inode, 1);
4795 ocfs2_rw_unlock(s_inode, 1);
4796 brelse(s_bh);
4797 if (s_inode != t_inode) {
4798 ocfs2_inode_unlock(t_inode, 1);
4799 ocfs2_rw_unlock(t_inode, 1);
4800 brelse(t_bh);
4801 }
4802 unlock_two_nondirectories(s_inode, t_inode);
4803}
4804
4805/* Link a range of blocks from one file to another. */
4806int ocfs2_reflink_remap_range(struct file *file_in,
4807 loff_t pos_in,
4808 struct file *file_out,
4809 loff_t pos_out,
4810 u64 len,
4811 bool is_dedupe)
4812{
4813 struct inode *inode_in = file_inode(file_in);
4814 struct inode *inode_out = file_inode(file_out);
4815 struct ocfs2_super *osb = OCFS2_SB(inode_in->i_sb);
4816 struct buffer_head *in_bh = NULL, *out_bh = NULL;
4817 bool same_inode = (inode_in == inode_out);
4818 ssize_t ret;
4819
4820 if (!ocfs2_refcount_tree(osb))
4821 return -EOPNOTSUPP;
4822 if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
4823 return -EROFS;
4824
4825 /* Lock both files against IO */
4826 ret = ocfs2_reflink_inodes_lock(inode_in, &in_bh, inode_out, &out_bh);
4827 if (ret)
4828 return ret;
4829
4830 /* Check file eligibility and prepare for block sharing. */
4831 ret = -EINVAL;
4832 if ((OCFS2_I(inode_in)->ip_flags & OCFS2_INODE_SYSTEM_FILE) ||
4833 (OCFS2_I(inode_out)->ip_flags & OCFS2_INODE_SYSTEM_FILE))
4834 goto out_unlock;
4835
4836 ret = vfs_clone_file_prep_inodes(inode_in, pos_in, inode_out, pos_out,
4837 &len, is_dedupe);
4838 if (ret || len == 0)
4839 goto out_unlock;
4840
4841 /* Lock out changes to the allocation maps and remap. */
4842 down_write(&OCFS2_I(inode_in)->ip_alloc_sem);
4843 if (!same_inode)
4844 down_write_nested(&OCFS2_I(inode_out)->ip_alloc_sem,
4845 SINGLE_DEPTH_NESTING);
4846
4847 ret = ocfs2_reflink_remap_blocks(inode_in, in_bh, pos_in, inode_out,
4848 out_bh, pos_out, len);
4849
4850 /* Zap any page cache for the destination file's range. */
4851 if (!ret)
4852 truncate_inode_pages_range(&inode_out->i_data, pos_out,
4853 PAGE_ALIGN(pos_out + len) - 1);
4854
4855 up_write(&OCFS2_I(inode_in)->ip_alloc_sem);
4856 if (!same_inode)
4857 up_write(&OCFS2_I(inode_out)->ip_alloc_sem);
4858 if (ret) {
4859 mlog_errno(ret);
4860 goto out_unlock;
4861 }
4862
4863 /*
4864 * Empty the extent map so that we may get the right extent
4865 * record from the disk.
4866 */
4867 ocfs2_extent_map_trunc(inode_in, 0);
4868 ocfs2_extent_map_trunc(inode_out, 0);
4869
4870 ret = ocfs2_reflink_update_dest(inode_out, out_bh, pos_out + len);
4871 if (ret) {
4872 mlog_errno(ret);
4873 goto out_unlock;
4874 }
4875
4876 ocfs2_reflink_inodes_unlock(inode_in, in_bh, inode_out, out_bh);
4877 return 0;
4878
4879out_unlock:
4880 ocfs2_reflink_inodes_unlock(inode_in, in_bh, inode_out, out_bh);
4881 return ret;
4882}
fs/ocfs2/refcounttree.h+7−0
@@ -115,4 +115,11 @@ int ocfs2_reflink_ioctl(struct inode *inode, · 114 unmodified lines
115 const char __user *oldname,115 const char __user *oldname,
116 const char __user *newname,116 const char __user *newname,
117 bool preserve);117 bool preserve);
118int ocfs2_reflink_remap_range(struct file *file_in,
119 loff_t pos_in,
120 struct file *file_out,
121 loff_t pos_out,
122 u64 len,
123 bool is_dedupe);
124
118#endif /* OCFS2_REFCOUNTTREE_H */125#endif /* OCFS2_REFCOUNTTREE_H */
fs/ocfs2/xattr.c+2−2
@@ -2577,7 +2577,7 @@ int ocfs2_xattr_remove(struct inode *inode, struct buffer_head *di_bh) · 2576 unmodified lines
2577 if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL))2577 if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL))
2578 return 0;2578 return 0;
2579 2579
2580 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL) {2580 if (ocfs2_is_refcount_inode(inode)) {
2581 ret = ocfs2_lock_refcount_tree(OCFS2_SB(inode->i_sb),2581 ret = ocfs2_lock_refcount_tree(OCFS2_SB(inode->i_sb),
2582 le64_to_cpu(di->i_refcount_loc),2582 le64_to_cpu(di->i_refcount_loc),
2583 1, &ref_tree, &ref_root_bh);2583 1, &ref_tree, &ref_root_bh);
@@ -3608,7 +3608,7 @@ int ocfs2_xattr_set(struct inode *inode, · 1024 unmodified lines
3608 }3608 }
3609 3609
3610 /* Check whether the value is refcounted and do some preparation. */3610 /* Check whether the value is refcounted and do some preparation. */
3611 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL &&3611 if (ocfs2_is_refcount_inode(inode) &&
3612 (!xis.not_found || !xbs.not_found)) {3612 (!xis.not_found || !xbs.not_found)) {
3613 ret = ocfs2_prepare_refcount_xattr(inode, di, &xi,3613 ret = ocfs2_prepare_refcount_xattr(inode, di, &xi,
3614 &xis, &xbs, &ref_tree,3614 &xis, &xbs, &ref_tree,
fs/overlayfs/super.c+3−3
@@ -328,11 +328,11 @@ static struct dentry *ovl_d_real(struct dentry *dentry, · 327 unmodified lines
328 if (!real)328 if (!real)
329 goto bug;329 goto bug;
330 330
331 /* Handle recursion */
332 real = d_real(real, inode, open_flags);
333
331 if (!inode || inode == d_inode(real))334 if (!inode || inode == d_inode(real))
332 return real;335 return real;
333
334 /* Handle recursion */
335 return d_real(real, inode, open_flags);
336bug:336bug:
337 WARN(1, "ovl_d_real(%pd4, %s:%lu): real dentry not found\n", dentry,337 WARN(1, "ovl_d_real(%pd4, %s:%lu): real dentry not found\n", dentry,
338 inode ? inode->i_sb->s_id : "NULL", inode ? inode->i_ino : 0);338 inode ? inode->i_sb->s_id : "NULL", inode ? inode->i_ino : 0);
fs/read_write.c+226−5
@@ -1542,20 +1542,37 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in, · 1541 unmodified lines
1542 if (ret)1542 if (ret)
1543 return ret;1543 return ret;
1544 1544
1545 ret = -EOPNOTSUPP;1545 /*
1546 if (file_out->f_op->copy_file_range)1546 * Try cloning first, this is supported by more file systems, and
1547 * more efficient if both clone and copy are supported (e.g. NFS).
1548 */
1549 if (file_in->f_op->clone_file_range) {
1550 ret = file_in->f_op->clone_file_range(file_in, pos_in,
1551 file_out, pos_out, len);
1552 if (ret == 0) {
1553 ret = len;
1554 goto done;
1555 }
1556 }
1557
1558 if (file_out->f_op->copy_file_range) {
1547 ret = file_out->f_op->copy_file_range(file_in, pos_in, file_out,1559 ret = file_out->f_op->copy_file_range(file_in, pos_in, file_out,
1548 pos_out, len, flags);1560 pos_out, len, flags);
1549 if (ret == -EOPNOTSUPP)1561 if (ret != -EOPNOTSUPP)
1550 ret = do_splice_direct(file_in, &pos_in, file_out, &pos_out,1562 goto done;
1551 len > MAX_RW_COUNT ? MAX_RW_COUNT : len, 0);1563 }
1564
1565 ret = do_splice_direct(file_in, &pos_in, file_out, &pos_out,
1566 len > MAX_RW_COUNT ? MAX_RW_COUNT : len, 0);
1552 1567
1568done:
1553 if (ret > 0) {1569 if (ret > 0) {
1554 fsnotify_access(file_in);1570 fsnotify_access(file_in);
1555 add_rchar(current, ret);1571 add_rchar(current, ret);
1556 fsnotify_modify(file_out);1572 fsnotify_modify(file_out);
1557 add_wchar(current, ret);1573 add_wchar(current, ret);
1558 }1574 }
1575
1559 inc_syscr(current);1576 inc_syscr(current);
1560 inc_syscw(current);1577 inc_syscw(current);
1561 1578
@@ -1650,6 +1667,114 @@ static int clone_verify_area(struct file *file, loff_t pos, u64 len, bool write) · 88 unmodified lines
1650 return security_file_permission(file, write ? MAY_WRITE : MAY_READ);1667 return security_file_permission(file, write ? MAY_WRITE : MAY_READ);
1651}1668}
1652 1669
1670/*
1671 * Check that the two inodes are eligible for cloning, the ranges make
1672 * sense, and then flush all dirty data. Caller must ensure that the
1673 * inodes have been locked against any other modifications.
1674 */
1675int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,
1676 struct inode *inode_out, loff_t pos_out,
1677 u64 *len, bool is_dedupe)
1678{
1679 loff_t bs = inode_out->i_sb->s_blocksize;
1680 loff_t blen;
1681 loff_t isize;
1682 bool same_inode = (inode_in == inode_out);
1683 int ret;
1684
1685 /* Don't touch certain kinds of inodes */
1686 if (IS_IMMUTABLE(inode_out))
1687 return -EPERM;
1688
1689 if (IS_SWAPFILE(inode_in) || IS_SWAPFILE(inode_out))
1690 return -ETXTBSY;
1691
1692 /* Don't reflink dirs, pipes, sockets... */
1693 if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode))
1694 return -EISDIR;
1695 if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode))
1696 return -EINVAL;
1697
1698 /* Are we going all the way to the end? */
1699 isize = i_size_read(inode_in);
1700 if (isize == 0) {
1701 *len = 0;
1702 return 0;
1703 }
1704
1705 /* Zero length dedupe exits immediately; reflink goes to EOF. */
1706 if (*len == 0) {
1707 if (is_dedupe) {
1708 *len = 0;
1709 return 0;
1710 }
1711 *len = isize - pos_in;
1712 }
1713
1714 /* Ensure offsets don't wrap and the input is inside i_size */
1715 if (pos_in + *len < pos_in || pos_out + *len < pos_out ||
1716 pos_in + *len > isize)
1717 return -EINVAL;
1718
1719 /* Don't allow dedupe past EOF in the dest file */
1720 if (is_dedupe) {
1721 loff_t disize;
1722
1723 disize = i_size_read(inode_out);
1724 if (pos_out >= disize || pos_out + *len > disize)
1725 return -EINVAL;
1726 }
1727
1728 /* If we're linking to EOF, continue to the block boundary. */
1729 if (pos_in + *len == isize)
1730 blen = ALIGN(isize, bs) - pos_in;
1731 else
1732 blen = *len;
1733
1734 /* Only reflink if we're aligned to block boundaries */
1735 if (!IS_ALIGNED(pos_in, bs) || !IS_ALIGNED(pos_in + blen, bs) ||
1736 !IS_ALIGNED(pos_out, bs) || !IS_ALIGNED(pos_out + blen, bs))
1737 return -EINVAL;
1738
1739 /* Don't allow overlapped reflink within the same file */
1740 if (same_inode) {
1741 if (pos_out + blen > pos_in && pos_out < pos_in + blen)
1742 return -EINVAL;
1743 }
1744
1745 /* Wait for the completion of any pending IOs on both files */
1746 inode_dio_wait(inode_in);
1747 if (!same_inode)
1748 inode_dio_wait(inode_out);
1749
1750 ret = filemap_write_and_wait_range(inode_in->i_mapping,
1751 pos_in, pos_in + *len - 1);
1752 if (ret)
1753 return ret;
1754
1755 ret = filemap_write_and_wait_range(inode_out->i_mapping,
1756 pos_out, pos_out + *len - 1);
1757 if (ret)
1758 return ret;
1759
1760 /*
1761 * Check that the extents are the same.
1762 */
1763 if (is_dedupe) {
1764 bool is_same = false;
1765
1766 ret = vfs_dedupe_file_range_compare(inode_in, pos_in,
1767 inode_out, pos_out, *len, &is_same);
1768 if (ret)
1769 return ret;
1770 if (!is_same)
1771 return -EBADE;
1772 }
1773
1774 return 0;
1775}
1776EXPORT_SYMBOL(vfs_clone_file_prep_inodes);
1777
1653int vfs_clone_file_range(struct file *file_in, loff_t pos_in,1778int vfs_clone_file_range(struct file *file_in, loff_t pos_in,
1654 struct file *file_out, loff_t pos_out, u64 len)1779 struct file *file_out, loff_t pos_out, u64 len)
1655{1780{
@@ -1701,6 +1826,102 @@ int vfs_clone_file_range(struct file *file_in, loff_t pos_in, · 45 unmodified lines
1701}1826}
1702EXPORT_SYMBOL(vfs_clone_file_range);1827EXPORT_SYMBOL(vfs_clone_file_range);
1703 1828
1829/*
1830 * Read a page's worth of file data into the page cache. Return the page
1831 * locked.
1832 */
1833static struct page *vfs_dedupe_get_page(struct inode *inode, loff_t offset)
1834{
1835 struct address_space *mapping;
1836 struct page *page;
1837 pgoff_t n;
1838
1839 n = offset >> PAGE_SHIFT;
1840 mapping = inode->i_mapping;
1841 page = read_mapping_page(mapping, n, NULL);
1842 if (IS_ERR(page))
1843 return page;
1844 if (!PageUptodate(page)) {
1845 put_page(page);
1846 return ERR_PTR(-EIO);
1847 }
1848 lock_page(page);
1849 return page;
1850}
1851
1852/*
1853 * Compare extents of two files to see if they are the same.
1854 * Caller must have locked both inodes to prevent write races.
1855 */
1856int vfs_dedupe_file_range_compare(struct inode *src, loff_t srcoff,
1857 struct inode *dest, loff_t destoff,
1858 loff_t len, bool *is_same)
1859{
1860 loff_t src_poff;
1861 loff_t dest_poff;
1862 void *src_addr;
1863 void *dest_addr;
1864 struct page *src_page;
1865 struct page *dest_page;
1866 loff_t cmp_len;
1867 bool same;
1868 int error;
1869
1870 error = -EINVAL;
1871 same = true;
1872 while (len) {
1873 src_poff = srcoff & (PAGE_SIZE - 1);
1874 dest_poff = destoff & (PAGE_SIZE - 1);
1875 cmp_len = min(PAGE_SIZE - src_poff,
1876 PAGE_SIZE - dest_poff);
1877 cmp_len = min(cmp_len, len);
1878 if (cmp_len <= 0)
1879 goto out_error;
1880
1881 src_page = vfs_dedupe_get_page(src, srcoff);
1882 if (IS_ERR(src_page)) {
1883 error = PTR_ERR(src_page);
1884 goto out_error;
1885 }
1886 dest_page = vfs_dedupe_get_page(dest, destoff);
1887 if (IS_ERR(dest_page)) {
1888 error = PTR_ERR(dest_page);
1889 unlock_page(src_page);
1890 put_page(src_page);
1891 goto out_error;
1892 }
1893 src_addr = kmap_atomic(src_page);
1894 dest_addr = kmap_atomic(dest_page);
1895
1896 flush_dcache_page(src_page);
1897 flush_dcache_page(dest_page);
1898
1899 if (memcmp(src_addr + src_poff, dest_addr + dest_poff, cmp_len))
1900 same = false;
1901
1902 kunmap_atomic(dest_addr);
1903 kunmap_atomic(src_addr);
1904 unlock_page(dest_page);
1905 unlock_page(src_page);
1906 put_page(dest_page);
1907 put_page(src_page);
1908
1909 if (!same)
1910 break;
1911
1912 srcoff += cmp_len;
1913 destoff += cmp_len;
1914 len -= cmp_len;
1915 }
1916
1917 *is_same = same;
1918 return 0;
1919
1920out_error:
1921 return error;
1922}
1923EXPORT_SYMBOL(vfs_dedupe_file_range_compare);
1924
1704int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)1925int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same)
1705{1926{
1706 struct file_dedupe_range_info *info;1927 struct file_dedupe_range_info *info;
fs/xfs/xfs_file.c+0−19
@@ -909,24 +909,6 @@ out_unlock: · 908 unmodified lines
909 return error;909 return error;
910}910}
911 911
912STATIC ssize_t
913xfs_file_copy_range(
914 struct file *file_in,
915 loff_t pos_in,
916 struct file *file_out,
917 loff_t pos_out,
918 size_t len,
919 unsigned int flags)
920{
921 int error;
922
923 error = xfs_reflink_remap_range(file_in, pos_in, file_out, pos_out,
924 len, false);
925 if (error)
926 return error;
927 return len;
928}
929
930STATIC int912STATIC int
931xfs_file_clone_range(913xfs_file_clone_range(
932 struct file *file_in,914 struct file *file_in,
@@ -1625,7 +1607,6 @@ const struct file_operations xfs_file_operations = { · 692 unmodified lines
1625 .fsync = xfs_file_fsync,1607 .fsync = xfs_file_fsync,
1626 .get_unmapped_area = thp_get_unmapped_area,1608 .get_unmapped_area = thp_get_unmapped_area,
1627 .fallocate = xfs_file_fallocate,1609 .fallocate = xfs_file_fallocate,
1628 .copy_file_range = xfs_file_copy_range,
1629 .clone_file_range = xfs_file_clone_range,1610 .clone_file_range = xfs_file_clone_range,
1630 .dedupe_file_range = xfs_file_dedupe_range,1611 .dedupe_file_range = xfs_file_dedupe_range,
1631};1612};
fs/xfs/xfs_reflink.c+9−204
@@ -1164,111 +1164,6 @@ err: · 1163 unmodified lines
1164 return error;1164 return error;
1165}1165}
1166 1166
1167/*
1168 * Read a page's worth of file data into the page cache. Return the page
1169 * locked.
1170 */
1171static struct page *
1172xfs_get_page(
1173 struct inode *inode,
1174 xfs_off_t offset)
1175{
1176 struct address_space *mapping;
1177 struct page *page;
1178 pgoff_t n;
1179
1180 n = offset >> PAGE_SHIFT;
1181 mapping = inode->i_mapping;
1182 page = read_mapping_page(mapping, n, NULL);
1183 if (IS_ERR(page))
1184 return page;
1185 if (!PageUptodate(page)) {
1186 put_page(page);
1187 return ERR_PTR(-EIO);
1188 }
1189 lock_page(page);
1190 return page;
1191}
1192
1193/*
1194 * Compare extents of two files to see if they are the same.
1195 */
1196static int
1197xfs_compare_extents(
1198 struct inode *src,
1199 xfs_off_t srcoff,
1200 struct inode *dest,
1201 xfs_off_t destoff,
1202 xfs_off_t len,
1203 bool *is_same)
1204{
1205 xfs_off_t src_poff;
1206 xfs_off_t dest_poff;
1207 void *src_addr;
1208 void *dest_addr;
1209 struct page *src_page;
1210 struct page *dest_page;
1211 xfs_off_t cmp_len;
1212 bool same;
1213 int error;
1214
1215 error = -EINVAL;
1216 same = true;
1217 while (len) {
1218 src_poff = srcoff & (PAGE_SIZE - 1);
1219 dest_poff = destoff & (PAGE_SIZE - 1);
1220 cmp_len = min(PAGE_SIZE - src_poff,
1221 PAGE_SIZE - dest_poff);
1222 cmp_len = min(cmp_len, len);
1223 ASSERT(cmp_len > 0);
1224
1225 trace_xfs_reflink_compare_extents(XFS_I(src), srcoff, cmp_len,
1226 XFS_I(dest), destoff);
1227
1228 src_page = xfs_get_page(src, srcoff);
1229 if (IS_ERR(src_page)) {
1230 error = PTR_ERR(src_page);
1231 goto out_error;
1232 }
1233 dest_page = xfs_get_page(dest, destoff);
1234 if (IS_ERR(dest_page)) {
1235 error = PTR_ERR(dest_page);
1236 unlock_page(src_page);
1237 put_page(src_page);
1238 goto out_error;
1239 }
1240 src_addr = kmap_atomic(src_page);
1241 dest_addr = kmap_atomic(dest_page);
1242
1243 flush_dcache_page(src_page);
1244 flush_dcache_page(dest_page);
1245
1246 if (memcmp(src_addr + src_poff, dest_addr + dest_poff, cmp_len))
1247 same = false;
1248
1249 kunmap_atomic(dest_addr);
1250 kunmap_atomic(src_addr);
1251 unlock_page(dest_page);
1252 unlock_page(src_page);
1253 put_page(dest_page);
1254 put_page(src_page);
1255
1256 if (!same)
1257 break;
1258
1259 srcoff += cmp_len;
1260 destoff += cmp_len;
1261 len -= cmp_len;
1262 }
1263
1264 *is_same = same;
1265 return 0;
1266
1267out_error:
1268 trace_xfs_reflink_compare_extents_error(XFS_I(dest), error, _RET_IP_);
1269 return error;
1270}
1271
1272/*1167/*
1273 * Link a range of blocks from one file to another.1168 * Link a range of blocks from one file to another.
1274 */1169 */
@@ -1286,14 +1181,11 @@ xfs_reflink_remap_range( · 11 unmodified lines
1286 struct inode *inode_out = file_inode(file_out);1181 struct inode *inode_out = file_inode(file_out);
1287 struct xfs_inode *dest = XFS_I(inode_out);1182 struct xfs_inode *dest = XFS_I(inode_out);
1288 struct xfs_mount *mp = src->i_mount;1183 struct xfs_mount *mp = src->i_mount;
1289 loff_t bs = inode_out->i_sb->s_blocksize;
1290 bool same_inode = (inode_in == inode_out);1184 bool same_inode = (inode_in == inode_out);
1291 xfs_fileoff_t sfsbno, dfsbno;1185 xfs_fileoff_t sfsbno, dfsbno;
1292 xfs_filblks_t fsblen;1186 xfs_filblks_t fsblen;
1293 xfs_extlen_t cowextsize;1187 xfs_extlen_t cowextsize;
1294 loff_t isize;
1295 ssize_t ret;1188 ssize_t ret;
1296 loff_t blen;
1297 1189
1298 if (!xfs_sb_version_hasreflink(&mp->m_sb))1190 if (!xfs_sb_version_hasreflink(&mp->m_sb))
1299 return -EOPNOTSUPP;1191 return -EOPNOTSUPP;
@@ -1310,26 +1202,8 @@ xfs_reflink_remap_range( · 10 unmodified lines
1310 xfs_lock_two_inodes(src, dest, XFS_MMAPLOCK_EXCL);1202 xfs_lock_two_inodes(src, dest, XFS_MMAPLOCK_EXCL);
1311 }1203 }
1312 1204
1313 /* Don't touch certain kinds of inodes */1205 /* Check file eligibility and prepare for block sharing. */
1314 ret = -EPERM;
1315 if (IS_IMMUTABLE(inode_out))
1316 goto out_unlock;
1317
1318 ret = -ETXTBSY;
1319 if (IS_SWAPFILE(inode_in) || IS_SWAPFILE(inode_out))
1320 goto out_unlock;
1321
1322
1323 /* Don't reflink dirs, pipes, sockets... */
1324 ret = -EISDIR;
1325 if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode))
1326 goto out_unlock;
1327 ret = -EINVAL;1206 ret = -EINVAL;
1328 if (S_ISFIFO(inode_in->i_mode) || S_ISFIFO(inode_out->i_mode))
1329 goto out_unlock;
1330 if (!S_ISREG(inode_in->i_mode) || !S_ISREG(inode_out->i_mode))
1331 goto out_unlock;
1332
1333 /* Don't reflink realtime inodes */1207 /* Don't reflink realtime inodes */
1334 if (XFS_IS_REALTIME_INODE(src) || XFS_IS_REALTIME_INODE(dest))1208 if (XFS_IS_REALTIME_INODE(src) || XFS_IS_REALTIME_INODE(dest))
1335 goto out_unlock;1209 goto out_unlock;
@@ -1338,91 +1212,18 @@ xfs_reflink_remap_range( · 2 unmodified lines
1338 if (IS_DAX(inode_in) || IS_DAX(inode_out))1212 if (IS_DAX(inode_in) || IS_DAX(inode_out))
1339 goto out_unlock;1213 goto out_unlock;
1340 1214
1341 /* Are we going all the way to the end? */1215 ret = vfs_clone_file_prep_inodes(inode_in, pos_in, inode_out, pos_out,
1342 isize = i_size_read(inode_in);1216 &len, is_dedupe);
1343 if (isize == 0) {1217 if (ret || len == 0)
1344 ret = 0;
1345 goto out_unlock;
1346 }
1347
1348 if (len == 0)
1349 len = isize - pos_in;
1350
1351 /* Ensure offsets don't wrap and the input is inside i_size */
1352 if (pos_in + len < pos_in || pos_out + len < pos_out ||
1353 pos_in + len > isize)
1354 goto out_unlock;
1355
1356 /* Don't allow dedupe past EOF in the dest file */
1357 if (is_dedupe) {
1358 loff_t disize;
1359
1360 disize = i_size_read(inode_out);
1361 if (pos_out >= disize || pos_out + len > disize)
1362 goto out_unlock;
1363 }
1364
1365 /* If we're linking to EOF, continue to the block boundary. */
1366 if (pos_in + len == isize)
1367 blen = ALIGN(isize, bs) - pos_in;
1368 else
1369 blen = len;
1370
1371 /* Only reflink if we're aligned to block boundaries */
1372 if (!IS_ALIGNED(pos_in, bs) || !IS_ALIGNED(pos_in + blen, bs) ||
1373 !IS_ALIGNED(pos_out, bs) || !IS_ALIGNED(pos_out + blen, bs))
1374 goto out_unlock;
1375
1376 /* Don't allow overlapped reflink within the same file */
1377 if (same_inode) {
1378 if (pos_out + blen > pos_in && pos_out < pos_in + blen)
1379 goto out_unlock;
1380 }
1381
1382 /* Wait for the completion of any pending IOs on both files */
1383 inode_dio_wait(inode_in);
1384 if (!same_inode)
1385 inode_dio_wait(inode_out);
1386
1387 ret = filemap_write_and_wait_range(inode_in->i_mapping,
1388 pos_in, pos_in + len - 1);
1389 if (ret)
1390 goto out_unlock;
1391
1392 ret = filemap_write_and_wait_range(inode_out->i_mapping,
1393 pos_out, pos_out + len - 1);
1394 if (ret)
1395 goto out_unlock;1218 goto out_unlock;
1396 1219
1397 trace_xfs_reflink_remap_range(src, pos_in, len, dest, pos_out);1220 trace_xfs_reflink_remap_range(src, pos_in, len, dest, pos_out);
1398 1221
1399 /*1222 /* Set flags and remap blocks. */
1400 * Check that the extents are the same.
1401 */
1402 if (is_dedupe) {
1403 bool is_same = false;
1404
1405 ret = xfs_compare_extents(inode_in, pos_in, inode_out, pos_out,
1406 len, &is_same);
1407 if (ret)
1408 goto out_unlock;
1409 if (!is_same) {
1410 ret = -EBADE;
1411 goto out_unlock;
1412 }
1413 }
1414
1415 ret = xfs_reflink_set_inode_flag(src, dest);1223 ret = xfs_reflink_set_inode_flag(src, dest);
1416 if (ret)1224 if (ret)
1417 goto out_unlock;1225 goto out_unlock;
1418 1226
1419 /*
1420 * Invalidate the page cache so that we can clear any CoW mappings
1421 * in the destination file.
1422 */
1423 truncate_inode_pages_range(&inode_out->i_data, pos_out,
1424 PAGE_ALIGN(pos_out + len) - 1);
1425
1426 dfsbno = XFS_B_TO_FSBT(mp, pos_out);1227 dfsbno = XFS_B_TO_FSBT(mp, pos_out);
1427 sfsbno = XFS_B_TO_FSBT(mp, pos_in);1228 sfsbno = XFS_B_TO_FSBT(mp, pos_in);
1428 fsblen = XFS_B_TO_FSB(mp, len);1229 fsblen = XFS_B_TO_FSB(mp, len);
@@ -1431,6 +1232,10 @@ xfs_reflink_remap_range( · 2 unmodified lines
1431 if (ret)1232 if (ret)
1432 goto out_unlock;1233 goto out_unlock;
1433 1234
1235 /* Zap any page cache for the destination file's range. */
1236 truncate_inode_pages_range(&inode_out->i_data, pos_out,
1237 PAGE_ALIGN(pos_out + len) - 1);
1238
1434 /*1239 /*
1435 * Carry the cowextsize hint from src to dest if we're sharing the1240 * Carry the cowextsize hint from src to dest if we're sharing the
1436 * entire source file to the entire destination file, the source file1241 * entire source file to the entire destination file, the source file
include/asm-generic/export.h+1−0
@@ -54,6 +54,7 @@ KSYM(__kstrtab_\name): · 53 unmodified lines
54KSYM(__kcrctab_\name):54KSYM(__kcrctab_\name):
55 __put KSYM(__crc_\name)55 __put KSYM(__crc_\name)
56 .weak KSYM(__crc_\name)56 .weak KSYM(__crc_\name)
57 .set KSYM(__crc_\name), 0
57 .previous58 .previous
58#endif59#endif
59#endif60#endif
include/linux/compiler-gcc.h+3−1
@@ -263,7 +263,9 @@ · 262 unmodified lines
263#endif263#endif
264#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP && !__CHECKER__ */264#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP && !__CHECKER__ */
265 265
266#if GCC_VERSION >= 50000266#if GCC_VERSION >= 70000
267#define KASAN_ABI_VERSION 5
268#elif GCC_VERSION >= 50000
267#define KASAN_ABI_VERSION 4269#define KASAN_ABI_VERSION 4
268#elif GCC_VERSION >= 40902270#elif GCC_VERSION >= 40902
269#define KASAN_ABI_VERSION 3271#define KASAN_ABI_VERSION 3
include/linux/fs.h+6−0
@@ -1778,8 +1778,14 @@ extern ssize_t vfs_writev(struct file *, const struct iovec __user *, · 1777 unmodified lines
1778 unsigned long, loff_t *, int);1778 unsigned long, loff_t *, int);
1779extern ssize_t vfs_copy_file_range(struct file *, loff_t , struct file *,1779extern ssize_t vfs_copy_file_range(struct file *, loff_t , struct file *,
1780 loff_t, size_t, unsigned int);1780 loff_t, size_t, unsigned int);
1781extern int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,
1782 struct inode *inode_out, loff_t pos_out,
1783 u64 *len, bool is_dedupe);
1781extern int vfs_clone_file_range(struct file *file_in, loff_t pos_in,1784extern int vfs_clone_file_range(struct file *file_in, loff_t pos_in,
1782 struct file *file_out, loff_t pos_out, u64 len);1785 struct file *file_out, loff_t pos_out, u64 len);
1786extern int vfs_dedupe_file_range_compare(struct inode *src, loff_t srcoff,
1787 struct inode *dest, loff_t destoff,
1788 loff_t len, bool *is_same);
1783extern int vfs_dedupe_file_range(struct file *file,1789extern int vfs_dedupe_file_range(struct file *file,
1784 struct file_dedupe_range *same);1790 struct file_dedupe_range *same);
1785 1791
include/linux/mlx4/device.h+0−1
@@ -476,7 +476,6 @@ enum { · 475 unmodified lines
476enum {476enum {
477 MLX4_INTERFACE_STATE_UP = 1 << 0,477 MLX4_INTERFACE_STATE_UP = 1 << 0,
478 MLX4_INTERFACE_STATE_DELETION = 1 << 1,478 MLX4_INTERFACE_STATE_DELETION = 1 << 1,
479 MLX4_INTERFACE_STATE_SHUTDOWN = 1 << 2,
480};479};
481 480
482#define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \481#define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \
include/linux/of_mdio.h+4−0
@@ -29,6 +29,7 @@ struct phy_device *of_phy_attach(struct net_device *dev, · 28 unmodified lines
29extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);29extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
30extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np);30extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np);
31extern int of_phy_register_fixed_link(struct device_node *np);31extern int of_phy_register_fixed_link(struct device_node *np);
32extern void of_phy_deregister_fixed_link(struct device_node *np);
32extern bool of_phy_is_fixed_link(struct device_node *np);33extern bool of_phy_is_fixed_link(struct device_node *np);
33 34
34#else /* CONFIG_OF */35#else /* CONFIG_OF */
@@ -83,6 +84,9 @@ static inline int of_phy_register_fixed_link(struct device_node *np) · 48 unmodified lines
83{84{
84 return -ENOSYS;85 return -ENOSYS;
85}86}
87static inline void of_phy_deregister_fixed_link(struct device_node *np)
88{
89}
86static inline bool of_phy_is_fixed_link(struct device_node *np)90static inline bool of_phy_is_fixed_link(struct device_node *np)
87{91{
88 return false;92 return false;
include/linux/pagemap.h+15−6
@@ -374,16 +374,13 @@ static inline struct page *read_mapping_page(struct address_space *mapping, · 373 unmodified lines
374}374}
375 375
376/*376/*
377 * Get the offset in PAGE_SIZE.377 * Get index of the page with in radix-tree
378 * (TODO: hugepage should have ->index in PAGE_SIZE)378 * (TODO: remove once hugetlb pages will have ->index in PAGE_SIZE)
379 */379 */
380static inline pgoff_t page_to_pgoff(struct page *page)380static inline pgoff_t page_to_index(struct page *page)
381{381{
382 pgoff_t pgoff;382 pgoff_t pgoff;
383 383
384 if (unlikely(PageHeadHuge(page)))
385 return page->index << compound_order(page);
386
387 if (likely(!PageTransTail(page)))384 if (likely(!PageTransTail(page)))
388 return page->index;385 return page->index;
389 386
@@ -396,6 +393,18 @@ static inline pgoff_t page_to_pgoff(struct page *page) · 6 unmodified lines
396 return pgoff;393 return pgoff;
397}394}
398 395
396/*
397 * Get the offset in PAGE_SIZE.
398 * (TODO: hugepage should have ->index in PAGE_SIZE)
399 */
400static inline pgoff_t page_to_pgoff(struct page *page)
401{
402 if (unlikely(PageHeadHuge(page)))
403 return page->index << compound_order(page);
404
405 return page_to_index(page);
406}
407
399/*408/*
400 * Return byte-offset into filesystem object for page.409 * Return byte-offset into filesystem object for page.
401 */410 */
include/linux/pci.h+14−0
@@ -1928,6 +1928,20 @@ static inline int pci_pcie_type(const struct pci_dev *dev) · 1927 unmodified lines
1928 return (pcie_caps_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4;1928 return (pcie_caps_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4;
1929}1929}
1930 1930
1931static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev)
1932{
1933 while (1) {
1934 if (!pci_is_pcie(dev))
1935 break;
1936 if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
1937 return dev;
1938 if (!dev->bus->self)
1939 break;
1940 dev = dev->bus->self;
1941 }
1942 return NULL;
1943}
1944
1931void pci_request_acs(void);1945void pci_request_acs(void);
1932bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags);1946bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags);
1933bool pci_acs_path_enabled(struct pci_dev *start,1947bool pci_acs_path_enabled(struct pci_dev *start,
include/net/ipv6.h+2−0
@@ -970,6 +970,8 @@ int compat_ipv6_setsockopt(struct sock *sk, int level, int optname, · 969 unmodified lines
970int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,970int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
971 char __user *optval, int __user *optlen);971 char __user *optval, int __user *optlen);
972 972
973int __ip6_datagram_connect(struct sock *sk, struct sockaddr *addr,
974 int addr_len);
973int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len);975int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len);
974int ip6_datagram_connect_v6_only(struct sock *sk, struct sockaddr *addr,976int ip6_datagram_connect_v6_only(struct sock *sk, struct sockaddr *addr,
975 int addr_len);977 int addr_len);
include/net/netfilter/nf_conntrack.h+3−3
@@ -100,6 +100,9 @@ struct nf_conn { · 99 unmodified lines
100 100
101 possible_net_t ct_net;101 possible_net_t ct_net;
102 102
103#if IS_ENABLED(CONFIG_NF_NAT)
104 struct rhlist_head nat_bysource;
105#endif
103 /* all members below initialized via memset */106 /* all members below initialized via memset */
104 u8 __nfct_init_offset[0];107 u8 __nfct_init_offset[0];
105 108
@@ -117,9 +120,6 @@ struct nf_conn { · 11 unmodified lines
117 /* Extensions */120 /* Extensions */
118 struct nf_ct_ext *ext;121 struct nf_ct_ext *ext;
119 122
120#if IS_ENABLED(CONFIG_NF_NAT)
121 struct rhash_head nat_bysource;
122#endif
123 /* Storage reserved for other modules, must be the last member */123 /* Storage reserved for other modules, must be the last member */
124 union nf_conntrack_proto proto;124 union nf_conntrack_proto proto;
125};125};
include/net/netfilter/nf_tables.h+1−1
@@ -313,7 +313,7 @@ void nft_unregister_set(struct nft_set_ops *ops); · 312 unmodified lines
313 * @size: maximum set size313 * @size: maximum set size
314 * @nelems: number of elements314 * @nelems: number of elements
315 * @ndeact: number of deactivated elements queued for removal315 * @ndeact: number of deactivated elements queued for removal
316 * @timeout: default timeout value in msecs316 * @timeout: default timeout value in jiffies
317 * @gc_int: garbage collection interval in msecs317 * @gc_int: garbage collection interval in msecs
318 * @policy: set parameterization (see enum nft_set_policies)318 * @policy: set parameterization (see enum nft_set_policies)
319 * @udlen: user data length319 * @udlen: user data length
include/uapi/linux/input-event-codes.h+1−1
@@ -640,7 +640,7 @@ · 639 unmodified lines
640 * Control a data application associated with the currently viewed channel,640 * Control a data application associated with the currently viewed channel,
641 * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.)641 * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.)
642 */642 */
643#define KEY_DATA 0x275643#define KEY_DATA 0x277
644 644
645#define BTN_TRIGGER_HAPPY 0x2c0645#define BTN_TRIGGER_HAPPY 0x2c0
646#define BTN_TRIGGER_HAPPY1 0x2c0646#define BTN_TRIGGER_HAPPY1 0x2c0
include/uapi/linux/tc_act/Kbuild+1−0
@@ -11,3 +11,4 @@ header-y += tc_vlan.h · 10 unmodified lines
11header-y += tc_bpf.h11header-y += tc_bpf.h
12header-y += tc_connmark.h12header-y += tc_connmark.h
13header-y += tc_ife.h13header-y += tc_ife.h
14header-y += tc_tunnel_key.h
init/Kconfig+0−1
@@ -1945,7 +1945,6 @@ config MODULE_FORCE_UNLOAD · 1944 unmodified lines
1945 1945
1946config MODVERSIONS1946config MODVERSIONS
1947 bool "Module versioning support"1947 bool "Module versioning support"
1948 depends on BROKEN
1949 help1948 help
1950 Usually, you have to use modules compiled with your kernel.1949 Usually, you have to use modules compiled with your kernel.
1951 Saying Y here makes it sometimes possible to use modules1950 Saying Y here makes it sometimes possible to use modules
kernel/bpf/verifier.c+8−2
@@ -2454,6 +2454,7 @@ static bool states_equal(struct bpf_verifier_env *env, · 2453 unmodified lines
2454 struct bpf_verifier_state *old,2454 struct bpf_verifier_state *old,
2455 struct bpf_verifier_state *cur)2455 struct bpf_verifier_state *cur)
2456{2456{
2457 bool varlen_map_access = env->varlen_map_value_access;
2457 struct bpf_reg_state *rold, *rcur;2458 struct bpf_reg_state *rold, *rcur;
2458 int i;2459 int i;
2459 2460
@@ -2467,12 +2468,17 @@ static bool states_equal(struct bpf_verifier_env *env, · 7 unmodified lines
2467 /* If the ranges were not the same, but everything else was and2468 /* If the ranges were not the same, but everything else was and
2468 * we didn't do a variable access into a map then we are a-ok.2469 * we didn't do a variable access into a map then we are a-ok.
2469 */2470 */
2470 if (!env->varlen_map_value_access &&2471 if (!varlen_map_access &&
2471 rold->type == rcur->type && rold->imm == rcur->imm)2472 rold->type == rcur->type && rold->imm == rcur->imm)
2472 continue;2473 continue;
2473 2474
2475 /* If we didn't map access then again we don't care about the
2476 * mismatched range values and it's ok if our old type was
2477 * UNKNOWN and we didn't go to a NOT_INIT'ed reg.
2478 */
2474 if (rold->type == NOT_INIT ||2479 if (rold->type == NOT_INIT ||
2475 (rold->type == UNKNOWN_VALUE && rcur->type != NOT_INIT))2480 (!varlen_map_access && rold->type == UNKNOWN_VALUE &&
2481 rcur->type != NOT_INIT))
2476 continue;2482 continue;
2477 2483
2478 if (rold->type == PTR_TO_PACKET && rcur->type == PTR_TO_PACKET &&2484 if (rold->type == PTR_TO_PACKET && rcur->type == PTR_TO_PACKET &&
kernel/module.c+3−2
@@ -1301,8 +1301,9 @@ static int check_version(Elf_Shdr *sechdrs, · 1300 unmodified lines
1301 goto bad_version;1301 goto bad_version;
1302 }1302 }
1303 1303
1304 pr_warn("%s: no symbol version for %s\n", mod->name, symname);1304 /* Broken toolchain. Warn once, then let it go.. */
1305 return 0;1305 pr_warn_once("%s: no symbol version for %s\n", mod->name, symname);
1306 return 1;
1306 1307
1307bad_version:1308bad_version:
1308 pr_warn("%s: disagrees about version of symbol %s\n",1309 pr_warn("%s: disagrees about version of symbol %s\n",
lib/debugobjects.c+8−0
@@ -362,6 +362,7 @@ void debug_object_init(void *addr, struct debug_obj_descr *descr) · 361 unmodified lines
362 362
363 __debug_object_init(addr, descr, 0);363 __debug_object_init(addr, descr, 0);
364}364}
365EXPORT_SYMBOL_GPL(debug_object_init);
365 366
366/**367/**
367 * debug_object_init_on_stack - debug checks when an object on stack is368 * debug_object_init_on_stack - debug checks when an object on stack is
@@ -376,6 +377,7 @@ void debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr) · 8 unmodified lines
376 377
377 __debug_object_init(addr, descr, 1);378 __debug_object_init(addr, descr, 1);
378}379}
380EXPORT_SYMBOL_GPL(debug_object_init_on_stack);
379 381
380/**382/**
381 * debug_object_activate - debug checks when an object is activated383 * debug_object_activate - debug checks when an object is activated
@@ -449,6 +451,7 @@ int debug_object_activate(void *addr, struct debug_obj_descr *descr) · 67 unmodified lines
449 }451 }
450 return 0;452 return 0;
451}453}
454EXPORT_SYMBOL_GPL(debug_object_activate);
452 455
453/**456/**
454 * debug_object_deactivate - debug checks when an object is deactivated457 * debug_object_deactivate - debug checks when an object is deactivated
@@ -496,6 +499,7 @@ void debug_object_deactivate(void *addr, struct debug_obj_descr *descr) · 41 unmodified lines
496 499
497 raw_spin_unlock_irqrestore(&db->lock, flags);500 raw_spin_unlock_irqrestore(&db->lock, flags);
498}501}
502EXPORT_SYMBOL_GPL(debug_object_deactivate);
499 503
500/**504/**
501 * debug_object_destroy - debug checks when an object is destroyed505 * debug_object_destroy - debug checks when an object is destroyed
@@ -542,6 +546,7 @@ void debug_object_destroy(void *addr, struct debug_obj_descr *descr) · 40 unmodified lines
542out_unlock:546out_unlock:
543 raw_spin_unlock_irqrestore(&db->lock, flags);547 raw_spin_unlock_irqrestore(&db->lock, flags);
544}548}
549EXPORT_SYMBOL_GPL(debug_object_destroy);
545 550
546/**551/**
547 * debug_object_free - debug checks when an object is freed552 * debug_object_free - debug checks when an object is freed
@@ -582,6 +587,7 @@ void debug_object_free(void *addr, struct debug_obj_descr *descr) · 34 unmodified lines
582out_unlock:587out_unlock:
583 raw_spin_unlock_irqrestore(&db->lock, flags);588 raw_spin_unlock_irqrestore(&db->lock, flags);
584}589}
590EXPORT_SYMBOL_GPL(debug_object_free);
585 591
586/**592/**
587 * debug_object_assert_init - debug checks when object should be init-ed593 * debug_object_assert_init - debug checks when object should be init-ed
@@ -626,6 +632,7 @@ void debug_object_assert_init(void *addr, struct debug_obj_descr *descr) · 38 unmodified lines
626 632
627 raw_spin_unlock_irqrestore(&db->lock, flags);633 raw_spin_unlock_irqrestore(&db->lock, flags);
628}634}
635EXPORT_SYMBOL_GPL(debug_object_assert_init);
629 636
630/**637/**
631 * debug_object_active_state - debug checks object usage state machine638 * debug_object_active_state - debug checks object usage state machine
@@ -673,6 +680,7 @@ debug_object_active_state(void *addr, struct debug_obj_descr *descr, · 41 unmodified lines
673 680
674 raw_spin_unlock_irqrestore(&db->lock, flags);681 raw_spin_unlock_irqrestore(&db->lock, flags);
675}682}
683EXPORT_SYMBOL_GPL(debug_object_active_state);
676 684
677#ifdef CONFIG_DEBUG_OBJECTS_FREE685#ifdef CONFIG_DEBUG_OBJECTS_FREE
678static void __debug_check_no_obj_freed(const void *address, unsigned long size)686static void __debug_check_no_obj_freed(const void *address, unsigned long size)
lib/test_kasan.c+29−0
@@ -20,6 +20,11 @@ · 19 unmodified lines
20#include <linux/uaccess.h>20#include <linux/uaccess.h>
21#include <linux/module.h>21#include <linux/module.h>
22 22
23/*
24 * Note: test functions are marked noinline so that their names appear in
25 * reports.
26 */
27
23static noinline void __init kmalloc_oob_right(void)28static noinline void __init kmalloc_oob_right(void)
24{29{
25 char *ptr;30 char *ptr;
@@ -411,6 +416,29 @@ static noinline void __init copy_user_test(void) · 385 unmodified lines
411 kfree(kmem);416 kfree(kmem);
412}417}
413 418
419static noinline void __init use_after_scope_test(void)
420{
421 volatile char *volatile p;
422
423 pr_info("use-after-scope on int\n");
424 {
425 int local = 0;
426
427 p = (char *)&local;
428 }
429 p[0] = 1;
430 p[3] = 1;
431
432 pr_info("use-after-scope on array\n");
433 {
434 char local[1024] = {0};
435
436 p = local;
437 }
438 p[0] = 1;
439 p[1023] = 1;
440}
441
414static int __init kmalloc_tests_init(void)442static int __init kmalloc_tests_init(void)
415{443{
416 kmalloc_oob_right();444 kmalloc_oob_right();
@@ -436,6 +464,7 @@ static int __init kmalloc_tests_init(void) · 19 unmodified lines
436 kasan_global_oob();464 kasan_global_oob();
437 ksize_unpoisons_memory();465 ksize_unpoisons_memory();
438 copy_user_test();466 copy_user_test();
467 use_after_scope_test();
439 return -EAGAIN;468 return -EAGAIN;
440}469}
441 470
mm/huge_memory.c+2−2
@@ -1456,9 +1456,9 @@ bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, · 1455 unmodified lines
1456 new_ptl = pmd_lockptr(mm, new_pmd);1456 new_ptl = pmd_lockptr(mm, new_pmd);
1457 if (new_ptl != old_ptl)1457 if (new_ptl != old_ptl)
1458 spin_lock_nested(new_ptl, SINGLE_DEPTH_NESTING);1458 spin_lock_nested(new_ptl, SINGLE_DEPTH_NESTING);
1459 if (pmd_present(*old_pmd) && pmd_dirty(*old_pmd))
1460 force_flush = true;
1461 pmd = pmdp_huge_get_and_clear(mm, old_addr, old_pmd);1459 pmd = pmdp_huge_get_and_clear(mm, old_addr, old_pmd);
1460 if (pmd_present(pmd) && pmd_dirty(pmd))
1461 force_flush = true;
1462 VM_BUG_ON(!pmd_none(*new_pmd));1462 VM_BUG_ON(!pmd_none(*new_pmd));
1463 1463
1464 if (pmd_move_must_withdraw(new_ptl, old_ptl) &&1464 if (pmd_move_must_withdraw(new_ptl, old_ptl) &&
mm/kasan/kasan.c+19−0
@@ -764,6 +764,25 @@ EXPORT_SYMBOL(__asan_storeN_noabort); · 763 unmodified lines
764void __asan_handle_no_return(void) {}764void __asan_handle_no_return(void) {}
765EXPORT_SYMBOL(__asan_handle_no_return);765EXPORT_SYMBOL(__asan_handle_no_return);
766 766
767/* Emitted by compiler to poison large objects when they go out of scope. */
768void __asan_poison_stack_memory(const void *addr, size_t size)
769{
770 /*
771 * Addr is KASAN_SHADOW_SCALE_SIZE-aligned and the object is surrounded
772 * by redzones, so we simply round up size to simplify logic.
773 */
774 kasan_poison_shadow(addr, round_up(size, KASAN_SHADOW_SCALE_SIZE),
775 KASAN_USE_AFTER_SCOPE);
776}
777EXPORT_SYMBOL(__asan_poison_stack_memory);
778
779/* Emitted by compiler to unpoison large objects when they go into scope. */
780void __asan_unpoison_stack_memory(const void *addr, size_t size)
781{
782 kasan_unpoison_shadow(addr, size);
783}
784EXPORT_SYMBOL(__asan_unpoison_stack_memory);
785
767#ifdef CONFIG_MEMORY_HOTPLUG786#ifdef CONFIG_MEMORY_HOTPLUG
768static int kasan_mem_notifier(struct notifier_block *nb,787static int kasan_mem_notifier(struct notifier_block *nb,
769 unsigned long action, void *data)788 unsigned long action, void *data)
mm/kasan/kasan.h+4−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
21#define KASAN_STACK_MID 0xF221#define KASAN_STACK_MID 0xF2
22#define KASAN_STACK_RIGHT 0xF322#define KASAN_STACK_RIGHT 0xF3
23#define KASAN_STACK_PARTIAL 0xF423#define KASAN_STACK_PARTIAL 0xF4
24#define KASAN_USE_AFTER_SCOPE 0xF8
24 25
25/* Don't break randconfig/all*config builds */26/* Don't break randconfig/all*config builds */
26#ifndef KASAN_ABI_VERSION27#ifndef KASAN_ABI_VERSION
@@ -53,6 +54,9 @@ struct kasan_global { · 26 unmodified lines
53#if KASAN_ABI_VERSION >= 454#if KASAN_ABI_VERSION >= 4
54 struct kasan_source_location *location;55 struct kasan_source_location *location;
55#endif56#endif
57#if KASAN_ABI_VERSION >= 5
58 char *odr_indicator;
59#endif
56};60};
57 61
58/**62/**
mm/kasan/report.c+3−0
@@ -90,6 +90,9 @@ static void print_error_description(struct kasan_access_info *info) · 89 unmodified lines
90 case KASAN_KMALLOC_FREE:90 case KASAN_KMALLOC_FREE:
91 bug_type = "use-after-free";91 bug_type = "use-after-free";
92 break;92 break;
93 case KASAN_USE_AFTER_SCOPE:
94 bug_type = "use-after-scope";
95 break;
93 }96 }
94 97
95 pr_err("BUG: KASAN: %s in %pS at addr %p\n",98 pr_err("BUG: KASAN: %s in %pS at addr %p\n",
mm/khugepaged.c+2−0
@@ -103,6 +103,7 @@ static struct khugepaged_scan khugepaged_scan = { · 102 unmodified lines
103 .mm_head = LIST_HEAD_INIT(khugepaged_scan.mm_head),103 .mm_head = LIST_HEAD_INIT(khugepaged_scan.mm_head),
104};104};
105 105
106#ifdef CONFIG_SYSFS
106static ssize_t scan_sleep_millisecs_show(struct kobject *kobj,107static ssize_t scan_sleep_millisecs_show(struct kobject *kobj,
107 struct kobj_attribute *attr,108 struct kobj_attribute *attr,
108 char *buf)109 char *buf)
@@ -295,6 +296,7 @@ struct attribute_group khugepaged_attr_group = { · 186 unmodified lines
295 .attrs = khugepaged_attr,296 .attrs = khugepaged_attr,
296 .name = "khugepaged",297 .name = "khugepaged",
297};298};
299#endif /* CONFIG_SYSFS */
298 300
299#define VM_NO_KHUGEPAGED (VM_SPECIAL | VM_HUGETLB)301#define VM_NO_KHUGEPAGED (VM_SPECIAL | VM_HUGETLB)
300 302
mm/mlock.c+5−2
@@ -190,10 +190,13 @@ unsigned int munlock_vma_page(struct page *page) · 189 unmodified lines
190 */190 */
191 spin_lock_irq(zone_lru_lock(zone));191 spin_lock_irq(zone_lru_lock(zone));
192 192
193 nr_pages = hpage_nr_pages(page);193 if (!TestClearPageMlocked(page)) {
194 if (!TestClearPageMlocked(page))194 /* Potentially, PTE-mapped THP: do not skip the rest PTEs */
195 nr_pages = 1;
195 goto unlock_out;196 goto unlock_out;
197 }
196 198
199 nr_pages = hpage_nr_pages(page);
197 __mod_zone_page_state(zone, NR_MLOCK, -nr_pages);200 __mod_zone_page_state(zone, NR_MLOCK, -nr_pages);
198 201
199 if (__munlock_isolate_lru_page(page, true)) {202 if (__munlock_isolate_lru_page(page, true)) {
mm/mremap.c+8−4
@@ -149,14 +149,18 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, · 148 unmodified lines
149 if (pte_none(*old_pte))149 if (pte_none(*old_pte))
150 continue;150 continue;
151 151
152 pte = ptep_get_and_clear(mm, old_addr, old_pte);
152 /*153 /*
153 * We are remapping a dirty PTE, make sure to154 * If we are remapping a dirty PTE, make sure
154 * flush TLB before we drop the PTL for the155 * to flush TLB before we drop the PTL for the
155 * old PTE or we may race with page_mkclean().156 * old PTE or we may race with page_mkclean().
157 *
158 * This check has to be done after we removed the
159 * old PTE from page tables or another thread may
160 * dirty it after the check and before the removal.
156 */161 */
157 if (pte_present(*old_pte) && pte_dirty(*old_pte))162 if (pte_present(pte) && pte_dirty(pte))
158 force_flush = true;163 force_flush = true;
159 pte = ptep_get_and_clear(mm, old_addr, old_pte);
160 pte = move_pte(pte, new_vma->vm_page_prot, old_addr, new_addr);164 pte = move_pte(pte, new_vma->vm_page_prot, old_addr, new_addr);
161 pte = move_soft_dirty_pte(pte);165 pte = move_soft_dirty_pte(pte);
162 set_pte_at(mm, new_addr, new_pte, pte);166 set_pte_at(mm, new_addr, new_pte, pte);
mm/truncate.c+4−4
@@ -283,7 +283,7 @@ void truncate_inode_pages_range(struct address_space *mapping, · 282 unmodified lines
283 283
284 if (!trylock_page(page))284 if (!trylock_page(page))
285 continue;285 continue;
286 WARN_ON(page_to_pgoff(page) != index);286 WARN_ON(page_to_index(page) != index);
287 if (PageWriteback(page)) {287 if (PageWriteback(page)) {
288 unlock_page(page);288 unlock_page(page);
289 continue;289 continue;
@@ -371,7 +371,7 @@ void truncate_inode_pages_range(struct address_space *mapping, · 81 unmodified lines
371 }371 }
372 372
373 lock_page(page);373 lock_page(page);
374 WARN_ON(page_to_pgoff(page) != index);374 WARN_ON(page_to_index(page) != index);
375 wait_on_page_writeback(page);375 wait_on_page_writeback(page);
376 truncate_inode_page(mapping, page);376 truncate_inode_page(mapping, page);
377 unlock_page(page);377 unlock_page(page);
@@ -492,7 +492,7 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping, · 114 unmodified lines
492 if (!trylock_page(page))492 if (!trylock_page(page))
493 continue;493 continue;
494 494
495 WARN_ON(page_to_pgoff(page) != index);495 WARN_ON(page_to_index(page) != index);
496 496
497 /* Middle of THP: skip */497 /* Middle of THP: skip */
498 if (PageTransTail(page)) {498 if (PageTransTail(page)) {
@@ -612,7 +612,7 @@ int invalidate_inode_pages2_range(struct address_space *mapping, · 113 unmodified lines
612 }612 }
613 613
614 lock_page(page);614 lock_page(page);
615 WARN_ON(page_to_pgoff(page) != index);615 WARN_ON(page_to_index(page) != index);
616 if (page->mapping != mapping) {616 if (page->mapping != mapping) {
617 unlock_page(page);617 unlock_page(page);
618 continue;618 continue;
mm/vmscan.c+2−0
@@ -2354,6 +2354,8 @@ static void shrink_node_memcg(struct pglist_data *pgdat, struct mem_cgroup *memc · 2353 unmodified lines
2354 }2354 }
2355 }2355 }
2356 2356
2357 cond_resched();
2358
2357 if (nr_reclaimed < nr_to_reclaim || scan_adjusted)2359 if (nr_reclaimed < nr_to_reclaim || scan_adjusted)
2358 continue;2360 continue;
2359 2361
mm/workingset.c+1−1
@@ -348,7 +348,7 @@ static unsigned long count_shadow_nodes(struct shrinker *shrinker, · 347 unmodified lines
348 shadow_nodes = list_lru_shrink_count(&workingset_shadow_nodes, sc);348 shadow_nodes = list_lru_shrink_count(&workingset_shadow_nodes, sc);
349 local_irq_enable();349 local_irq_enable();
350 350
351 if (memcg_kmem_enabled()) {351 if (sc->memcg) {
352 pages = mem_cgroup_node_nr_lru_pages(sc->memcg, sc->nid,352 pages = mem_cgroup_node_nr_lru_pages(sc->memcg, sc->nid,
353 LRU_ALL_FILE);353 LRU_ALL_FILE);
354 } else {354 } else {
net/core/flow.c+2−4
@@ -95,7 +95,6 @@ static void flow_cache_gc_task(struct work_struct *work) · 94 unmodified lines
95 list_for_each_entry_safe(fce, n, &gc_list, u.gc_list) {95 list_for_each_entry_safe(fce, n, &gc_list, u.gc_list) {
96 flow_entry_kill(fce, xfrm);96 flow_entry_kill(fce, xfrm);
97 atomic_dec(&xfrm->flow_cache_gc_count);97 atomic_dec(&xfrm->flow_cache_gc_count);
98 WARN_ON(atomic_read(&xfrm->flow_cache_gc_count) < 0);
99 }98 }
100}99}
101 100
@@ -236,9 +235,8 @@ flow_cache_lookup(struct net *net, const struct flowi *key, u16 family, u8 dir, · 134 unmodified lines
236 if (fcp->hash_count > fc->high_watermark)235 if (fcp->hash_count > fc->high_watermark)
237 flow_cache_shrink(fc, fcp);236 flow_cache_shrink(fc, fcp);
238 237
239 if (fcp->hash_count > 2 * fc->high_watermark ||238 if (atomic_read(&net->xfrm.flow_cache_gc_count) >
240 atomic_read(&net->xfrm.flow_cache_gc_count) > fc->high_watermark) {239 2 * num_online_cpus() * fc->high_watermark) {
241 atomic_inc(&net->xfrm.flow_cache_genid);
242 flo = ERR_PTR(-ENOBUFS);240 flo = ERR_PTR(-ENOBUFS);
243 goto ret_object;241 goto ret_object;
244 }242 }
net/core/rtnetlink.c+2−2
@@ -931,8 +931,8 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev, · 930 unmodified lines
931 + nla_total_size(4) /* IFLA_PROMISCUITY */931 + nla_total_size(4) /* IFLA_PROMISCUITY */
932 + nla_total_size(4) /* IFLA_NUM_TX_QUEUES */932 + nla_total_size(4) /* IFLA_NUM_TX_QUEUES */
933 + nla_total_size(4) /* IFLA_NUM_RX_QUEUES */933 + nla_total_size(4) /* IFLA_NUM_RX_QUEUES */
934 + nla_total_size(4) /* IFLA_MAX_GSO_SEGS */934 + nla_total_size(4) /* IFLA_GSO_MAX_SEGS */
935 + nla_total_size(4) /* IFLA_MAX_GSO_SIZE */935 + nla_total_size(4) /* IFLA_GSO_MAX_SIZE */
936 + nla_total_size(1) /* IFLA_OPERSTATE */936 + nla_total_size(1) /* IFLA_OPERSTATE */
937 + nla_total_size(1) /* IFLA_LINKMODE */937 + nla_total_size(1) /* IFLA_LINKMODE */
938 + nla_total_size(4) /* IFLA_CARRIER_CHANGES */938 + nla_total_size(4) /* IFLA_CARRIER_CHANGES */
net/core/sock.c+2−2
@@ -715,7 +715,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, · 714 unmodified lines
715 val = min_t(u32, val, sysctl_wmem_max);715 val = min_t(u32, val, sysctl_wmem_max);
716set_sndbuf:716set_sndbuf:
717 sk->sk_userlocks |= SOCK_SNDBUF_LOCK;717 sk->sk_userlocks |= SOCK_SNDBUF_LOCK;
718 sk->sk_sndbuf = max_t(u32, val * 2, SOCK_MIN_SNDBUF);718 sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF);
719 /* Wake up sending tasks if we upped the value. */719 /* Wake up sending tasks if we upped the value. */
720 sk->sk_write_space(sk);720 sk->sk_write_space(sk);
721 break;721 break;
@@ -751,7 +751,7 @@ set_rcvbuf: · 29 unmodified lines
751 * returning the value we actually used in getsockopt751 * returning the value we actually used in getsockopt
752 * is the most desirable behavior.752 * is the most desirable behavior.
753 */753 */
754 sk->sk_rcvbuf = max_t(u32, val * 2, SOCK_MIN_RCVBUF);754 sk->sk_rcvbuf = max_t(int, val * 2, SOCK_MIN_RCVBUF);
755 break;755 break;
756 756
757 case SO_RCVBUFFORCE:757 case SO_RCVBUFFORCE:
net/dccp/ipv4.c+7−5
@@ -700,6 +700,7 @@ int dccp_invalid_packet(struct sk_buff *skb) · 699 unmodified lines
700{700{
701 const struct dccp_hdr *dh;701 const struct dccp_hdr *dh;
702 unsigned int cscov;702 unsigned int cscov;
703 u8 dccph_doff;
703 704
704 if (skb->pkt_type != PACKET_HOST)705 if (skb->pkt_type != PACKET_HOST)
705 return 1;706 return 1;
@@ -721,18 +722,19 @@ int dccp_invalid_packet(struct sk_buff *skb) · 15 unmodified lines
721 /*722 /*
722 * If P.Data Offset is too small for packet type, drop packet and return723 * If P.Data Offset is too small for packet type, drop packet and return
723 */724 */
724 if (dh->dccph_doff < dccp_hdr_len(skb) / sizeof(u32)) {725 dccph_doff = dh->dccph_doff;
725 DCCP_WARN("P.Data Offset(%u) too small\n", dh->dccph_doff);726 if (dccph_doff < dccp_hdr_len(skb) / sizeof(u32)) {
727 DCCP_WARN("P.Data Offset(%u) too small\n", dccph_doff);
726 return 1;728 return 1;
727 }729 }
728 /*730 /*
729 * If P.Data Offset is too too large for packet, drop packet and return731 * If P.Data Offset is too too large for packet, drop packet and return
730 */732 */
731 if (!pskb_may_pull(skb, dh->dccph_doff * sizeof(u32))) {733 if (!pskb_may_pull(skb, dccph_doff * sizeof(u32))) {
732 DCCP_WARN("P.Data Offset(%u) too large\n", dh->dccph_doff);734 DCCP_WARN("P.Data Offset(%u) too large\n", dccph_doff);
733 return 1;735 return 1;
734 }736 }
735 737 dh = dccp_hdr(skb);
736 /*738 /*
737 * If P.type is not Data, Ack, or DataAck and P.X == 0 (the packet739 * If P.type is not Data, Ack, or DataAck and P.X == 0 (the packet
738 * has short sequence numbers), drop packet and return740 * has short sequence numbers), drop packet and return
net/dsa/dsa.c+4−9
@@ -233,6 +233,8 @@ int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev, · 232 unmodified lines
233 genphy_read_status(phydev);233 genphy_read_status(phydev);
234 if (ds->ops->adjust_link)234 if (ds->ops->adjust_link)
235 ds->ops->adjust_link(ds, port, phydev);235 ds->ops->adjust_link(ds, port, phydev);
236
237 put_device(&phydev->mdio.dev);
236 }238 }
237 239
238 return 0;240 return 0;
@@ -504,15 +506,8 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, · 265 unmodified lines
504 506
505void dsa_cpu_dsa_destroy(struct device_node *port_dn)507void dsa_cpu_dsa_destroy(struct device_node *port_dn)
506{508{
507 struct phy_device *phydev;509 if (of_phy_is_fixed_link(port_dn))
508 510 of_phy_deregister_fixed_link(port_dn);
509 if (of_phy_is_fixed_link(port_dn)) {
510 phydev = of_phy_find_device(port_dn);
511 if (phydev) {
512 phy_device_free(phydev);
513 fixed_phy_unregister(phydev);
514 }
515 }
516}511}
517 512
518static void dsa_switch_destroy(struct dsa_switch *ds)513static void dsa_switch_destroy(struct dsa_switch *ds)
net/dsa/dsa2.c+3−1
@@ -28,8 +28,10 @@ static struct dsa_switch_tree *dsa_get_dst(u32 tree) · 27 unmodified lines
28 struct dsa_switch_tree *dst;28 struct dsa_switch_tree *dst;
29 29
30 list_for_each_entry(dst, &dsa_switch_trees, list)30 list_for_each_entry(dst, &dsa_switch_trees, list)
31 if (dst->tree == tree)31 if (dst->tree == tree) {
32 kref_get(&dst->refcount);
32 return dst;33 return dst;
34 }
33 return NULL;35 return NULL;
34}36}
35 37
net/dsa/slave.c+16−3
@@ -1125,7 +1125,7 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, · 1124 unmodified lines
1125 p->phy_interface = mode;1125 p->phy_interface = mode;
1126 1126
1127 phy_dn = of_parse_phandle(port_dn, "phy-handle", 0);1127 phy_dn = of_parse_phandle(port_dn, "phy-handle", 0);
1128 if (of_phy_is_fixed_link(port_dn)) {1128 if (!phy_dn && of_phy_is_fixed_link(port_dn)) {
1129 /* In the case of a fixed PHY, the DT node associated1129 /* In the case of a fixed PHY, the DT node associated
1130 * to the fixed PHY is the Port DT node1130 * to the fixed PHY is the Port DT node
1131 */1131 */
@@ -1135,7 +1135,7 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, · 3 unmodified lines
1135 return ret;1135 return ret;
1136 }1136 }
1137 phy_is_fixed = true;1137 phy_is_fixed = true;
1138 phy_dn = port_dn;1138 phy_dn = of_node_get(port_dn);
1139 }1139 }
1140 1140
1141 if (ds->ops->get_phy_flags)1141 if (ds->ops->get_phy_flags)
@@ -1154,6 +1154,7 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, · 12 unmodified lines
1154 ret = dsa_slave_phy_connect(p, slave_dev, phy_id);1154 ret = dsa_slave_phy_connect(p, slave_dev, phy_id);
1155 if (ret) {1155 if (ret) {
1156 netdev_err(slave_dev, "failed to connect to phy%d: %d\n", phy_id, ret);1156 netdev_err(slave_dev, "failed to connect to phy%d: %d\n", phy_id, ret);
1157 of_node_put(phy_dn);
1157 return ret;1158 return ret;
1158 }1159 }
1159 } else {1160 } else {
@@ -1162,6 +1163,8 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, · 2 unmodified lines
1162 phy_flags,1163 phy_flags,
1163 p->phy_interface);1164 p->phy_interface);
1164 }1165 }
1166
1167 of_node_put(phy_dn);
1165 }1168 }
1166 1169
1167 if (p->phy && phy_is_fixed)1170 if (p->phy && phy_is_fixed)
@@ -1174,6 +1177,8 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, · 6 unmodified lines
1174 ret = dsa_slave_phy_connect(p, slave_dev, p->port);1177 ret = dsa_slave_phy_connect(p, slave_dev, p->port);
1175 if (ret) {1178 if (ret) {
1176 netdev_err(slave_dev, "failed to connect to port %d: %d\n", p->port, ret);1179 netdev_err(slave_dev, "failed to connect to port %d: %d\n", p->port, ret);
1180 if (phy_is_fixed)
1181 of_phy_deregister_fixed_link(port_dn);
1177 return ret;1182 return ret;
1178 }1183 }
1179 }1184 }
@@ -1289,10 +1294,18 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent, · 109 unmodified lines
1289void dsa_slave_destroy(struct net_device *slave_dev)1294void dsa_slave_destroy(struct net_device *slave_dev)
1290{1295{
1291 struct dsa_slave_priv *p = netdev_priv(slave_dev);1296 struct dsa_slave_priv *p = netdev_priv(slave_dev);
1297 struct dsa_switch *ds = p->parent;
1298 struct device_node *port_dn;
1299
1300 port_dn = ds->ports[p->port].dn;
1292 1301
1293 netif_carrier_off(slave_dev);1302 netif_carrier_off(slave_dev);
1294 if (p->phy)1303 if (p->phy) {
1295 phy_disconnect(p->phy);1304 phy_disconnect(p->phy);
1305
1306 if (of_phy_is_fixed_link(port_dn))
1307 of_phy_deregister_fixed_link(port_dn);
1308 }
1296 unregister_netdev(slave_dev);1309 unregister_netdev(slave_dev);
1297 free_netdev(slave_dev);1310 free_netdev(slave_dev);
1298}1311}
net/ipv4/Kconfig+1−0
@@ -715,6 +715,7 @@ config DEFAULT_TCP_CONG · 714 unmodified lines
715 default "reno" if DEFAULT_RENO715 default "reno" if DEFAULT_RENO
716 default "dctcp" if DEFAULT_DCTCP716 default "dctcp" if DEFAULT_DCTCP
717 default "cdg" if DEFAULT_CDG717 default "cdg" if DEFAULT_CDG
718 default "bbr" if DEFAULT_BBR
718 default "cubic"719 default "cubic"
719 720
720config TCP_MD5SIG721config TCP_MD5SIG
net/ipv4/af_inet.c+1−1
@@ -1233,7 +1233,7 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb, · 1232 unmodified lines
1233 fixedid = !!(skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID);1233 fixedid = !!(skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID);
1234 1234
1235 /* fixed ID is invalid if DF bit is not set */1235 /* fixed ID is invalid if DF bit is not set */
1236 if (fixedid && !(iph->frag_off & htons(IP_DF)))1236 if (fixedid && !(ip_hdr(skb)->frag_off & htons(IP_DF)))
1237 goto out;1237 goto out;
1238 }1238 }
1239 1239
net/ipv4/esp4.c+1−1
@@ -476,7 +476,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) · 475 unmodified lines
476 esph = (void *)skb_push(skb, 4);476 esph = (void *)skb_push(skb, 4);
477 *seqhi = esph->spi;477 *seqhi = esph->spi;
478 esph->spi = esph->seq_no;478 esph->spi = esph->seq_no;
479 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq.input.hi);479 esph->seq_no = XFRM_SKB_CB(skb)->seq.input.hi;
480 aead_request_set_callback(req, 0, esp_input_done_esn, skb);480 aead_request_set_callback(req, 0, esp_input_done_esn, skb);
481 }481 }
482 482
net/ipv4/ip_output.c+2−0
@@ -107,6 +107,8 @@ int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb) · 106 unmodified lines
107 if (unlikely(!skb))107 if (unlikely(!skb))
108 return 0;108 return 0;
109 109
110 skb->protocol = htons(ETH_P_IP);
111
110 return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT,112 return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT,
111 net, sk, skb, NULL, skb_dst(skb)->dev,113 net, sk, skb, NULL, skb_dst(skb)->dev,
112 dst_output);114 dst_output);
net/ipv4/netfilter.c+4−1
@@ -24,10 +24,11 @@ int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned int addr_t · 23 unmodified lines
24 struct flowi4 fl4 = {};24 struct flowi4 fl4 = {};
25 __be32 saddr = iph->saddr;25 __be32 saddr = iph->saddr;
26 __u8 flags = skb->sk ? inet_sk_flowi_flags(skb->sk) : 0;26 __u8 flags = skb->sk ? inet_sk_flowi_flags(skb->sk) : 0;
27 struct net_device *dev = skb_dst(skb)->dev;
27 unsigned int hh_len;28 unsigned int hh_len;
28 29
29 if (addr_type == RTN_UNSPEC)30 if (addr_type == RTN_UNSPEC)
30 addr_type = inet_addr_type(net, saddr);31 addr_type = inet_addr_type_dev_table(net, dev, saddr);
31 if (addr_type == RTN_LOCAL || addr_type == RTN_UNICAST)32 if (addr_type == RTN_LOCAL || addr_type == RTN_UNICAST)
32 flags |= FLOWI_FLAG_ANYSRC;33 flags |= FLOWI_FLAG_ANYSRC;
33 else34 else
@@ -40,6 +41,8 @@ int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned int addr_t · 6 unmodified lines
40 fl4.saddr = saddr;41 fl4.saddr = saddr;
41 fl4.flowi4_tos = RT_TOS(iph->tos);42 fl4.flowi4_tos = RT_TOS(iph->tos);
42 fl4.flowi4_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0;43 fl4.flowi4_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0;
44 if (!fl4.flowi4_oif)
45 fl4.flowi4_oif = l3mdev_master_ifindex(dev);
43 fl4.flowi4_mark = skb->mark;46 fl4.flowi4_mark = skb->mark;
44 fl4.flowi4_flags = flags;47 fl4.flowi4_flags = flags;
45 rt = ip_route_output_key(net, &fl4);48 rt = ip_route_output_key(net, &fl4);
net/ipv4/netfilter/arp_tables.c+2−2
@@ -1201,8 +1201,8 @@ static int translate_compat_table(struct xt_table_info **pinfo, · 1200 unmodified lines
1201 1201
1202 newinfo->number = compatr->num_entries;1202 newinfo->number = compatr->num_entries;
1203 for (i = 0; i < NF_ARP_NUMHOOKS; i++) {1203 for (i = 0; i < NF_ARP_NUMHOOKS; i++) {
1204 newinfo->hook_entry[i] = info->hook_entry[i];1204 newinfo->hook_entry[i] = compatr->hook_entry[i];
1205 newinfo->underflow[i] = info->underflow[i];1205 newinfo->underflow[i] = compatr->underflow[i];
1206 }1206 }
1207 entry1 = newinfo->entries;1207 entry1 = newinfo->entries;
1208 pos = entry1;1208 pos = entry1;
net/ipv6/datagram.c+3−1
@@ -139,7 +139,8 @@ void ip6_datagram_release_cb(struct sock *sk) · 138 unmodified lines
139}139}
140EXPORT_SYMBOL_GPL(ip6_datagram_release_cb);140EXPORT_SYMBOL_GPL(ip6_datagram_release_cb);
141 141
142static int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)142int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr,
143 int addr_len)
143{144{
144 struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr;145 struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr;
145 struct inet_sock *inet = inet_sk(sk);146 struct inet_sock *inet = inet_sk(sk);
@@ -252,6 +253,7 @@ ipv4_connected: · 106 unmodified lines
252out:253out:
253 return err;254 return err;
254}255}
256EXPORT_SYMBOL_GPL(__ip6_datagram_connect);
255 257
256int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)258int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
257{259{
net/ipv6/esp6.c+1−1
@@ -418,7 +418,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb) · 417 unmodified lines
418 esph = (void *)skb_push(skb, 4);418 esph = (void *)skb_push(skb, 4);
419 *seqhi = esph->spi;419 *seqhi = esph->spi;
420 esph->spi = esph->seq_no;420 esph->spi = esph->seq_no;
421 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq.input.hi);421 esph->seq_no = XFRM_SKB_CB(skb)->seq.input.hi;
422 aead_request_set_callback(req, 0, esp_input_done_esn, skb);422 aead_request_set_callback(req, 0, esp_input_done_esn, skb);
423 }423 }
424 424
net/ipv6/icmp.c+4−2
@@ -447,8 +447,10 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, · 446 unmodified lines
447 447
448 if (__ipv6_addr_needs_scope_id(addr_type))448 if (__ipv6_addr_needs_scope_id(addr_type))
449 iif = skb->dev->ifindex;449 iif = skb->dev->ifindex;
450 else450 else {
451 iif = l3mdev_master_ifindex(skb_dst(skb)->dev);451 dst = skb_dst(skb);
452 iif = l3mdev_master_ifindex(dst ? dst->dev : skb->dev);
453 }
452 454
453 /*455 /*
454 * Must not send error if the source does not uniquely456 * Must not send error if the source does not uniquely
net/ipv6/ip6_offload.c+1−1
@@ -99,7 +99,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, · 98 unmodified lines
99 segs = ops->callbacks.gso_segment(skb, features);99 segs = ops->callbacks.gso_segment(skb, features);
100 }100 }
101 101
102 if (IS_ERR(segs))102 if (IS_ERR_OR_NULL(segs))
103 goto out;103 goto out;
104 104
105 gso_partial = !!(skb_shinfo(segs)->gso_type & SKB_GSO_PARTIAL);105 gso_partial = !!(skb_shinfo(segs)->gso_type & SKB_GSO_PARTIAL);
net/ipv6/ip6_tunnel.c+0−1
@@ -1181,7 +1181,6 @@ route_lookup: · 1180 unmodified lines
1181 if (err)1181 if (err)
1182 return err;1182 return err;
1183 1183
1184 skb->protocol = htons(ETH_P_IPV6);
1185 skb_push(skb, sizeof(struct ipv6hdr));1184 skb_push(skb, sizeof(struct ipv6hdr));
1186 skb_reset_network_header(skb);1185 skb_reset_network_header(skb);
1187 ipv6h = ipv6_hdr(skb);1186 ipv6h = ipv6_hdr(skb);
net/ipv6/ip6_vti.c+31−0
@@ -1138,6 +1138,33 @@ static struct xfrm6_protocol vti_ipcomp6_protocol __read_mostly = { · 1137 unmodified lines
1138 .priority = 100,1138 .priority = 100,
1139};1139};
1140 1140
1141static bool is_vti6_tunnel(const struct net_device *dev)
1142{
1143 return dev->netdev_ops == &vti6_netdev_ops;
1144}
1145
1146static int vti6_device_event(struct notifier_block *unused,
1147 unsigned long event, void *ptr)
1148{
1149 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1150 struct ip6_tnl *t = netdev_priv(dev);
1151
1152 if (!is_vti6_tunnel(dev))
1153 return NOTIFY_DONE;
1154
1155 switch (event) {
1156 case NETDEV_DOWN:
1157 if (!net_eq(t->net, dev_net(dev)))
1158 xfrm_garbage_collect(t->net);
1159 break;
1160 }
1161 return NOTIFY_DONE;
1162}
1163
1164static struct notifier_block vti6_notifier_block __read_mostly = {
1165 .notifier_call = vti6_device_event,
1166};
1167
1141/**1168/**
1142 * vti6_tunnel_init - register protocol and reserve needed resources1169 * vti6_tunnel_init - register protocol and reserve needed resources
1143 *1170 *
@@ -1148,6 +1175,8 @@ static int __init vti6_tunnel_init(void) · 4 unmodified lines
1148 const char *msg;1175 const char *msg;
1149 int err;1176 int err;
1150 1177
1178 register_netdevice_notifier(&vti6_notifier_block);
1179
1151 msg = "tunnel device";1180 msg = "tunnel device";
1152 err = register_pernet_device(&vti6_net_ops);1181 err = register_pernet_device(&vti6_net_ops);
1153 if (err < 0)1182 if (err < 0)
@@ -1180,6 +1209,7 @@ xfrm_proto_ah_failed: · 26 unmodified lines
1180xfrm_proto_esp_failed:1209xfrm_proto_esp_failed:
1181 unregister_pernet_device(&vti6_net_ops);1210 unregister_pernet_device(&vti6_net_ops);
1182pernet_dev_failed:1211pernet_dev_failed:
1212 unregister_netdevice_notifier(&vti6_notifier_block);
1183 pr_err("vti6 init: failed to register %s\n", msg);1213 pr_err("vti6 init: failed to register %s\n", msg);
1184 return err;1214 return err;
1185}1215}
@@ -1194,6 +1224,7 @@ static void __exit vti6_tunnel_cleanup(void) · 8 unmodified lines
1194 xfrm6_protocol_deregister(&vti_ah6_protocol, IPPROTO_AH);1224 xfrm6_protocol_deregister(&vti_ah6_protocol, IPPROTO_AH);
1195 xfrm6_protocol_deregister(&vti_esp6_protocol, IPPROTO_ESP);1225 xfrm6_protocol_deregister(&vti_esp6_protocol, IPPROTO_ESP);
1196 unregister_pernet_device(&vti6_net_ops);1226 unregister_pernet_device(&vti6_net_ops);
1227 unregister_netdevice_notifier(&vti6_notifier_block);
1197}1228}
1198 1229
1199module_init(vti6_tunnel_init);1230module_init(vti6_tunnel_init);
net/ipv6/netfilter/nf_conntrack_reasm.c+2−2
@@ -576,11 +576,11 @@ int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user) · 575 unmodified lines
576 /* Jumbo payload inhibits frag. header */576 /* Jumbo payload inhibits frag. header */
577 if (ipv6_hdr(skb)->payload_len == 0) {577 if (ipv6_hdr(skb)->payload_len == 0) {
578 pr_debug("payload len = 0\n");578 pr_debug("payload len = 0\n");
579 return -EINVAL;579 return 0;
580 }580 }
581 581
582 if (find_prev_fhdr(skb, &prevhdr, &nhoff, &fhoff) < 0)582 if (find_prev_fhdr(skb, &prevhdr, &nhoff, &fhoff) < 0)
583 return -EINVAL;583 return 0;
584 584
585 if (!pskb_may_pull(skb, fhoff + sizeof(*fhdr)))585 if (!pskb_may_pull(skb, fhoff + sizeof(*fhdr)))
586 return -ENOMEM;586 return -ENOMEM;
net/ipv6/netfilter/nf_defrag_ipv6_hooks.c+1−1
@@ -69,7 +69,7 @@ static unsigned int ipv6_defrag(void *priv, · 68 unmodified lines
69 if (err == -EINPROGRESS)69 if (err == -EINPROGRESS)
70 return NF_STOLEN;70 return NF_STOLEN;
71 71
72 return NF_ACCEPT;72 return err == 0 ? NF_ACCEPT : NF_DROP;
73}73}
74 74
75static struct nf_hook_ops ipv6_defrag_ops[] = {75static struct nf_hook_ops ipv6_defrag_ops[] = {
net/ipv6/netfilter/nf_reject_ipv6.c+1−0
@@ -156,6 +156,7 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) · 155 unmodified lines
156 fl6.daddr = oip6h->saddr;156 fl6.daddr = oip6h->saddr;
157 fl6.fl6_sport = otcph->dest;157 fl6.fl6_sport = otcph->dest;
158 fl6.fl6_dport = otcph->source;158 fl6.fl6_dport = otcph->source;
159 fl6.flowi6_oif = l3mdev_master_ifindex(skb_dst(oldskb)->dev);
159 security_skb_classify_flow(oldskb, flowi6_to_flowi(&fl6));160 security_skb_classify_flow(oldskb, flowi6_to_flowi(&fl6));
160 dst = ip6_route_output(net, NULL, &fl6);161 dst = ip6_route_output(net, NULL, &fl6);
161 if (dst->error) {162 if (dst->error) {
net/ipv6/output_core.c+2−0
@@ -155,6 +155,8 @@ int __ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb) · 154 unmodified lines
155 if (unlikely(!skb))155 if (unlikely(!skb))
156 return 0;156 return 0;
157 157
158 skb->protocol = htons(ETH_P_IPV6);
159
158 return nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT,160 return nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT,
159 net, sk, skb, NULL, skb_dst(skb)->dev,161 net, sk, skb, NULL, skb_dst(skb)->dev,
160 dst_output);162 dst_output);
net/l2tp/l2tp_ip.c+34−29
@@ -61,7 +61,8 @@ static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif · 60 unmodified lines
61 if ((l2tp->conn_id == tunnel_id) &&61 if ((l2tp->conn_id == tunnel_id) &&
62 net_eq(sock_net(sk), net) &&62 net_eq(sock_net(sk), net) &&
63 !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) &&63 !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) &&
64 !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))64 (!sk->sk_bound_dev_if || !dif ||
65 sk->sk_bound_dev_if == dif))
65 goto found;66 goto found;
66 }67 }
67 68
@@ -182,15 +183,17 @@ pass_up: · 114 unmodified lines
182 struct iphdr *iph = (struct iphdr *) skb_network_header(skb);183 struct iphdr *iph = (struct iphdr *) skb_network_header(skb);
183 184
184 read_lock_bh(&l2tp_ip_lock);185 read_lock_bh(&l2tp_ip_lock);
185 sk = __l2tp_ip_bind_lookup(net, iph->daddr, 0, tunnel_id);186 sk = __l2tp_ip_bind_lookup(net, iph->daddr, inet_iif(skb),
187 tunnel_id);
188 if (!sk) {
189 read_unlock_bh(&l2tp_ip_lock);
190 goto discard;
191 }
192
193 sock_hold(sk);
186 read_unlock_bh(&l2tp_ip_lock);194 read_unlock_bh(&l2tp_ip_lock);
187 }195 }
188 196
189 if (sk == NULL)
190 goto discard;
191
192 sock_hold(sk);
193
194 if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))197 if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
195 goto discard_put;198 goto discard_put;
196 199
@@ -256,15 +259,9 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 59 unmodified lines
256 if (addr->l2tp_family != AF_INET)259 if (addr->l2tp_family != AF_INET)
257 return -EINVAL;260 return -EINVAL;
258 261
259 ret = -EADDRINUSE;
260 read_lock_bh(&l2tp_ip_lock);
261 if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr,
262 sk->sk_bound_dev_if, addr->l2tp_conn_id))
263 goto out_in_use;
264
265 read_unlock_bh(&l2tp_ip_lock);
266
267 lock_sock(sk);262 lock_sock(sk);
263
264 ret = -EINVAL;
268 if (!sock_flag(sk, SOCK_ZAPPED))265 if (!sock_flag(sk, SOCK_ZAPPED))
269 goto out;266 goto out;
270 267
@@ -281,25 +278,28 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 10 unmodified lines
281 inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr;278 inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr;
282 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)279 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
283 inet->inet_saddr = 0; /* Use device */280 inet->inet_saddr = 0; /* Use device */
284 sk_dst_reset(sk);
285 281
282 write_lock_bh(&l2tp_ip_lock);
283 if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr,
284 sk->sk_bound_dev_if, addr->l2tp_conn_id)) {
285 write_unlock_bh(&l2tp_ip_lock);
286 ret = -EADDRINUSE;
287 goto out;
288 }
289
290 sk_dst_reset(sk);
286 l2tp_ip_sk(sk)->conn_id = addr->l2tp_conn_id;291 l2tp_ip_sk(sk)->conn_id = addr->l2tp_conn_id;
287 292
288 write_lock_bh(&l2tp_ip_lock);
289 sk_add_bind_node(sk, &l2tp_ip_bind_table);293 sk_add_bind_node(sk, &l2tp_ip_bind_table);
290 sk_del_node_init(sk);294 sk_del_node_init(sk);
291 write_unlock_bh(&l2tp_ip_lock);295 write_unlock_bh(&l2tp_ip_lock);
296
292 ret = 0;297 ret = 0;
293 sock_reset_flag(sk, SOCK_ZAPPED);298 sock_reset_flag(sk, SOCK_ZAPPED);
294 299
295out:300out:
296 release_sock(sk);301 release_sock(sk);
297 302
298 return ret;
299
300out_in_use:
301 read_unlock_bh(&l2tp_ip_lock);
302
303 return ret;303 return ret;
304}304}
305 305
@@ -308,21 +308,24 @@ static int l2tp_ip_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len · 2 unmodified lines
308 struct sockaddr_l2tpip *lsa = (struct sockaddr_l2tpip *) uaddr;308 struct sockaddr_l2tpip *lsa = (struct sockaddr_l2tpip *) uaddr;
309 int rc;309 int rc;
310 310
311 if (sock_flag(sk, SOCK_ZAPPED)) /* Must bind first - autobinding does not work */
312 return -EINVAL;
313
314 if (addr_len < sizeof(*lsa))311 if (addr_len < sizeof(*lsa))
315 return -EINVAL;312 return -EINVAL;
316 313
317 if (ipv4_is_multicast(lsa->l2tp_addr.s_addr))314 if (ipv4_is_multicast(lsa->l2tp_addr.s_addr))
318 return -EINVAL;315 return -EINVAL;
319 316
320 rc = ip4_datagram_connect(sk, uaddr, addr_len);
321 if (rc < 0)
322 return rc;
323
324 lock_sock(sk);317 lock_sock(sk);
325 318
319 /* Must bind first - autobinding does not work */
320 if (sock_flag(sk, SOCK_ZAPPED)) {
321 rc = -EINVAL;
322 goto out_sk;
323 }
324
325 rc = __ip4_datagram_connect(sk, uaddr, addr_len);
326 if (rc < 0)
327 goto out_sk;
328
326 l2tp_ip_sk(sk)->peer_conn_id = lsa->l2tp_conn_id;329 l2tp_ip_sk(sk)->peer_conn_id = lsa->l2tp_conn_id;
327 330
328 write_lock_bh(&l2tp_ip_lock);331 write_lock_bh(&l2tp_ip_lock);
@@ -330,7 +333,9 @@ static int l2tp_ip_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len · 1 unmodified line
330 sk_add_bind_node(sk, &l2tp_ip_bind_table);333 sk_add_bind_node(sk, &l2tp_ip_bind_table);
331 write_unlock_bh(&l2tp_ip_lock);334 write_unlock_bh(&l2tp_ip_lock);
332 335
336out_sk:
333 release_sock(sk);337 release_sock(sk);
338
334 return rc;339 return rc;
335}340}
336 341
net/l2tp/l2tp_ip6.c+42−37
@@ -72,8 +72,9 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net, · 71 unmodified lines
72 72
73 if ((l2tp->conn_id == tunnel_id) &&73 if ((l2tp->conn_id == tunnel_id) &&
74 net_eq(sock_net(sk), net) &&74 net_eq(sock_net(sk), net) &&
75 !(addr && ipv6_addr_equal(addr, laddr)) &&75 (!addr || ipv6_addr_equal(addr, laddr)) &&
76 !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))76 (!sk->sk_bound_dev_if || !dif ||
77 sk->sk_bound_dev_if == dif))
77 goto found;78 goto found;
78 }79 }
79 80
@@ -196,16 +197,17 @@ pass_up: · 116 unmodified lines
196 struct ipv6hdr *iph = ipv6_hdr(skb);197 struct ipv6hdr *iph = ipv6_hdr(skb);
197 198
198 read_lock_bh(&l2tp_ip6_lock);199 read_lock_bh(&l2tp_ip6_lock);
199 sk = __l2tp_ip6_bind_lookup(net, &iph->daddr,200 sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, inet6_iif(skb),
200 0, tunnel_id);201 tunnel_id);
202 if (!sk) {
203 read_unlock_bh(&l2tp_ip6_lock);
204 goto discard;
205 }
206
207 sock_hold(sk);
201 read_unlock_bh(&l2tp_ip6_lock);208 read_unlock_bh(&l2tp_ip6_lock);
202 }209 }
203 210
204 if (sk == NULL)
205 goto discard;
206
207 sock_hold(sk);
208
209 if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb))211 if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb))
210 goto discard_put;212 goto discard_put;
211 213
@@ -266,6 +268,7 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 54 unmodified lines
266 struct sockaddr_l2tpip6 *addr = (struct sockaddr_l2tpip6 *) uaddr;268 struct sockaddr_l2tpip6 *addr = (struct sockaddr_l2tpip6 *) uaddr;
267 struct net *net = sock_net(sk);269 struct net *net = sock_net(sk);
268 __be32 v4addr = 0;270 __be32 v4addr = 0;
271 int bound_dev_if;
269 int addr_type;272 int addr_type;
270 int err;273 int err;
271 274
@@ -284,13 +287,6 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 12 unmodified lines
284 if (addr_type & IPV6_ADDR_MULTICAST)287 if (addr_type & IPV6_ADDR_MULTICAST)
285 return -EADDRNOTAVAIL;288 return -EADDRNOTAVAIL;
286 289
287 err = -EADDRINUSE;
288 read_lock_bh(&l2tp_ip6_lock);
289 if (__l2tp_ip6_bind_lookup(net, &addr->l2tp_addr,
290 sk->sk_bound_dev_if, addr->l2tp_conn_id))
291 goto out_in_use;
292 read_unlock_bh(&l2tp_ip6_lock);
293
294 lock_sock(sk);290 lock_sock(sk);
295 291
296 err = -EINVAL;292 err = -EINVAL;
@@ -300,28 +296,25 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 3 unmodified lines
300 if (sk->sk_state != TCP_CLOSE)296 if (sk->sk_state != TCP_CLOSE)
301 goto out_unlock;297 goto out_unlock;
302 298
299 bound_dev_if = sk->sk_bound_dev_if;
300
303 /* Check if the address belongs to the host. */301 /* Check if the address belongs to the host. */
304 rcu_read_lock();302 rcu_read_lock();
305 if (addr_type != IPV6_ADDR_ANY) {303 if (addr_type != IPV6_ADDR_ANY) {
306 struct net_device *dev = NULL;304 struct net_device *dev = NULL;
307 305
308 if (addr_type & IPV6_ADDR_LINKLOCAL) {306 if (addr_type & IPV6_ADDR_LINKLOCAL) {
309 if (addr_len >= sizeof(struct sockaddr_in6) &&307 if (addr->l2tp_scope_id)
310 addr->l2tp_scope_id) {308 bound_dev_if = addr->l2tp_scope_id;
311 /* Override any existing binding, if another
312 * one is supplied by user.
313 */
314 sk->sk_bound_dev_if = addr->l2tp_scope_id;
315 }
316 309
317 /* Binding to link-local address requires an310 /* Binding to link-local address requires an
318 interface */311 * interface.
319 if (!sk->sk_bound_dev_if)312 */
313 if (!bound_dev_if)
320 goto out_unlock_rcu;314 goto out_unlock_rcu;
321 315
322 err = -ENODEV;316 err = -ENODEV;
323 dev = dev_get_by_index_rcu(sock_net(sk),317 dev = dev_get_by_index_rcu(sock_net(sk), bound_dev_if);
324 sk->sk_bound_dev_if);
325 if (!dev)318 if (!dev)
326 goto out_unlock_rcu;319 goto out_unlock_rcu;
327 }320 }
@@ -336,13 +329,22 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 8 unmodified lines
336 }329 }
337 rcu_read_unlock();330 rcu_read_unlock();
338 331
339 inet->inet_rcv_saddr = inet->inet_saddr = v4addr;332 write_lock_bh(&l2tp_ip6_lock);
333 if (__l2tp_ip6_bind_lookup(net, &addr->l2tp_addr, bound_dev_if,
334 addr->l2tp_conn_id)) {
335 write_unlock_bh(&l2tp_ip6_lock);
336 err = -EADDRINUSE;
337 goto out_unlock;
338 }
339
340 inet->inet_saddr = v4addr;
341 inet->inet_rcv_saddr = v4addr;
342 sk->sk_bound_dev_if = bound_dev_if;
340 sk->sk_v6_rcv_saddr = addr->l2tp_addr;343 sk->sk_v6_rcv_saddr = addr->l2tp_addr;
341 np->saddr = addr->l2tp_addr;344 np->saddr = addr->l2tp_addr;
342 345
343 l2tp_ip6_sk(sk)->conn_id = addr->l2tp_conn_id;346 l2tp_ip6_sk(sk)->conn_id = addr->l2tp_conn_id;
344 347
345 write_lock_bh(&l2tp_ip6_lock);
346 sk_add_bind_node(sk, &l2tp_ip6_bind_table);348 sk_add_bind_node(sk, &l2tp_ip6_bind_table);
347 sk_del_node_init(sk);349 sk_del_node_init(sk);
348 write_unlock_bh(&l2tp_ip6_lock);350 write_unlock_bh(&l2tp_ip6_lock);
@@ -355,10 +357,7 @@ out_unlock_rcu: · 6 unmodified lines
355 rcu_read_unlock();357 rcu_read_unlock();
356out_unlock:358out_unlock:
357 release_sock(sk);359 release_sock(sk);
358 return err;
359 360
360out_in_use:
361 read_unlock_bh(&l2tp_ip6_lock);
362 return err;361 return err;
363}362}
364 363
@@ -371,9 +370,6 @@ static int l2tp_ip6_connect(struct sock *sk, struct sockaddr *uaddr, · 6 unmodified lines
371 int addr_type;370 int addr_type;
372 int rc;371 int rc;
373 372
374 if (sock_flag(sk, SOCK_ZAPPED)) /* Must bind first - autobinding does not work */
375 return -EINVAL;
376
377 if (addr_len < sizeof(*lsa))373 if (addr_len < sizeof(*lsa))
378 return -EINVAL;374 return -EINVAL;
379 375
@@ -390,10 +386,18 @@ static int l2tp_ip6_connect(struct sock *sk, struct sockaddr *uaddr, · 10 unmodified lines
390 return -EINVAL;386 return -EINVAL;
391 }387 }
392 388
393 rc = ip6_datagram_connect(sk, uaddr, addr_len);
394
395 lock_sock(sk);389 lock_sock(sk);
396 390
391 /* Must bind first - autobinding does not work */
392 if (sock_flag(sk, SOCK_ZAPPED)) {
393 rc = -EINVAL;
394 goto out_sk;
395 }
396
397 rc = __ip6_datagram_connect(sk, uaddr, addr_len);
398 if (rc < 0)
399 goto out_sk;
400
397 l2tp_ip6_sk(sk)->peer_conn_id = lsa->l2tp_conn_id;401 l2tp_ip6_sk(sk)->peer_conn_id = lsa->l2tp_conn_id;
398 402
399 write_lock_bh(&l2tp_ip6_lock);403 write_lock_bh(&l2tp_ip6_lock);
@@ -401,6 +405,7 @@ static int l2tp_ip6_connect(struct sock *sk, struct sockaddr *uaddr, · 1 unmodified line
401 sk_add_bind_node(sk, &l2tp_ip6_bind_table);405 sk_add_bind_node(sk, &l2tp_ip6_bind_table);
402 write_unlock_bh(&l2tp_ip6_lock);406 write_unlock_bh(&l2tp_ip6_lock);
403 407
408out_sk:
404 release_sock(sk);409 release_sock(sk);
405 410
406 return rc;411 return rc;
net/netfilter/nf_nat_core.c+30−19
@@ -42,7 +42,7 @@ struct nf_nat_conn_key { · 41 unmodified lines
42 const struct nf_conntrack_zone *zone;42 const struct nf_conntrack_zone *zone;
43};43};
44 44
45static struct rhashtable nf_nat_bysource_table;45static struct rhltable nf_nat_bysource_table;
46 46
47inline const struct nf_nat_l3proto *47inline const struct nf_nat_l3proto *
48__nf_nat_l3proto_find(u8 family)48__nf_nat_l3proto_find(u8 family)
@@ -193,9 +193,12 @@ static int nf_nat_bysource_cmp(struct rhashtable_compare_arg *arg, · 144 unmodified lines
193 const struct nf_nat_conn_key *key = arg->key;193 const struct nf_nat_conn_key *key = arg->key;
194 const struct nf_conn *ct = obj;194 const struct nf_conn *ct = obj;
195 195
196 return same_src(ct, key->tuple) &&196 if (!same_src(ct, key->tuple) ||
197 net_eq(nf_ct_net(ct), key->net) &&197 !net_eq(nf_ct_net(ct), key->net) ||
198 nf_ct_zone_equal(ct, key->zone, IP_CT_DIR_ORIGINAL);198 !nf_ct_zone_equal(ct, key->zone, IP_CT_DIR_ORIGINAL))
199 return 1;
200
201 return 0;
199}202}
200 203
201static struct rhashtable_params nf_nat_bysource_params = {204static struct rhashtable_params nf_nat_bysource_params = {
@@ -204,7 +207,6 @@ static struct rhashtable_params nf_nat_bysource_params = { · 2 unmodified lines
204 .obj_cmpfn = nf_nat_bysource_cmp,207 .obj_cmpfn = nf_nat_bysource_cmp,
205 .nelem_hint = 256,208 .nelem_hint = 256,
206 .min_size = 1024,209 .min_size = 1024,
207 .nulls_base = (1U << RHT_BASE_SHIFT),
208};210};
209 211
210/* Only called for SRC manip */212/* Only called for SRC manip */
@@ -223,12 +225,15 @@ find_appropriate_src(struct net *net, · 12 unmodified lines
223 .tuple = tuple,225 .tuple = tuple,
224 .zone = zone226 .zone = zone
225 };227 };
228 struct rhlist_head *hl;
226 229
227 ct = rhashtable_lookup_fast(&nf_nat_bysource_table, &key,230 hl = rhltable_lookup(&nf_nat_bysource_table, &key,
228 nf_nat_bysource_params);231 nf_nat_bysource_params);
229 if (!ct)232 if (!hl)
230 return 0;233 return 0;
231 234
235 ct = container_of(hl, typeof(*ct), nat_bysource);
236
232 nf_ct_invert_tuplepr(result,237 nf_ct_invert_tuplepr(result,
233 &ct->tuplehash[IP_CT_DIR_REPLY].tuple);238 &ct->tuplehash[IP_CT_DIR_REPLY].tuple);
234 result->dst = tuple->dst;239 result->dst = tuple->dst;
@@ -446,11 +451,17 @@ nf_nat_setup_info(struct nf_conn *ct, · 211 unmodified lines
446 }451 }
447 452
448 if (maniptype == NF_NAT_MANIP_SRC) {453 if (maniptype == NF_NAT_MANIP_SRC) {
454 struct nf_nat_conn_key key = {
455 .net = nf_ct_net(ct),
456 .tuple = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
457 .zone = nf_ct_zone(ct),
458 };
449 int err;459 int err;
450 460
451 err = rhashtable_insert_fast(&nf_nat_bysource_table,461 err = rhltable_insert_key(&nf_nat_bysource_table,
452 &ct->nat_bysource,462 &key,
453 nf_nat_bysource_params);463 &ct->nat_bysource,
464 nf_nat_bysource_params);
454 if (err)465 if (err)
455 return NF_DROP;466 return NF_DROP;
456 }467 }
@@ -567,8 +578,8 @@ static int nf_nat_proto_clean(struct nf_conn *ct, void *data) · 110 unmodified lines
567 * will delete entry from already-freed table.578 * will delete entry from already-freed table.
568 */579 */
569 ct->status &= ~IPS_NAT_DONE_MASK;580 ct->status &= ~IPS_NAT_DONE_MASK;
570 rhashtable_remove_fast(&nf_nat_bysource_table, &ct->nat_bysource,581 rhltable_remove(&nf_nat_bysource_table, &ct->nat_bysource,
571 nf_nat_bysource_params);582 nf_nat_bysource_params);
572 583
573 /* don't delete conntrack. Although that would make things a lot584 /* don't delete conntrack. Although that would make things a lot
574 * simpler, we'd end up flushing all conntracks on nat rmmod.585 * simpler, we'd end up flushing all conntracks on nat rmmod.
@@ -698,8 +709,8 @@ static void nf_nat_cleanup_conntrack(struct nf_conn *ct) · 123 unmodified lines
698 if (!nat)709 if (!nat)
699 return;710 return;
700 711
701 rhashtable_remove_fast(&nf_nat_bysource_table, &ct->nat_bysource,712 rhltable_remove(&nf_nat_bysource_table, &ct->nat_bysource,
702 nf_nat_bysource_params);713 nf_nat_bysource_params);
703}714}
704 715
705static struct nf_ct_ext_type nat_extend __read_mostly = {716static struct nf_ct_ext_type nat_extend __read_mostly = {
@@ -834,13 +845,13 @@ static int __init nf_nat_init(void) · 128 unmodified lines
834{845{
835 int ret;846 int ret;
836 847
837 ret = rhashtable_init(&nf_nat_bysource_table, &nf_nat_bysource_params);848 ret = rhltable_init(&nf_nat_bysource_table, &nf_nat_bysource_params);
838 if (ret)849 if (ret)
839 return ret;850 return ret;
840 851
841 ret = nf_ct_extend_register(&nat_extend);852 ret = nf_ct_extend_register(&nat_extend);
842 if (ret < 0) {853 if (ret < 0) {
843 rhashtable_destroy(&nf_nat_bysource_table);854 rhltable_destroy(&nf_nat_bysource_table);
844 printk(KERN_ERR "nf_nat_core: Unable to register extension\n");855 printk(KERN_ERR "nf_nat_core: Unable to register extension\n");
845 return ret;856 return ret;
846 }857 }
@@ -864,7 +875,7 @@ static int __init nf_nat_init(void) · 17 unmodified lines
864 return 0;875 return 0;
865 876
866 cleanup_extend:877 cleanup_extend:
867 rhashtable_destroy(&nf_nat_bysource_table);878 rhltable_destroy(&nf_nat_bysource_table);
868 nf_ct_extend_unregister(&nat_extend);879 nf_ct_extend_unregister(&nat_extend);
869 return ret;880 return ret;
870}881}
@@ -883,7 +894,7 @@ static void __exit nf_nat_cleanup(void) · 12 unmodified lines
883 for (i = 0; i < NFPROTO_NUMPROTO; i++)894 for (i = 0; i < NFPROTO_NUMPROTO; i++)
884 kfree(nf_nat_l4protos[i]);895 kfree(nf_nat_l4protos[i]);
885 896
886 rhashtable_destroy(&nf_nat_bysource_table);897 rhltable_destroy(&nf_nat_bysource_table);
887}898}
888 899
889MODULE_LICENSE("GPL");900MODULE_LICENSE("GPL");
net/netfilter/nf_tables_api.c+9−5
@@ -2570,7 +2570,8 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, · 2569 unmodified lines
2570 }2570 }
2571 2571
2572 if (set->timeout &&2572 if (set->timeout &&
2573 nla_put_be64(skb, NFTA_SET_TIMEOUT, cpu_to_be64(set->timeout),2573 nla_put_be64(skb, NFTA_SET_TIMEOUT,
2574 cpu_to_be64(jiffies_to_msecs(set->timeout)),
2574 NFTA_SET_PAD))2575 NFTA_SET_PAD))
2575 goto nla_put_failure;2576 goto nla_put_failure;
2576 if (set->gc_int &&2577 if (set->gc_int &&
@@ -2859,7 +2860,8 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk, · 282 unmodified lines
2859 if (nla[NFTA_SET_TIMEOUT] != NULL) {2860 if (nla[NFTA_SET_TIMEOUT] != NULL) {
2860 if (!(flags & NFT_SET_TIMEOUT))2861 if (!(flags & NFT_SET_TIMEOUT))
2861 return -EINVAL;2862 return -EINVAL;
2862 timeout = be64_to_cpu(nla_get_be64(nla[NFTA_SET_TIMEOUT]));2863 timeout = msecs_to_jiffies(be64_to_cpu(nla_get_be64(
2864 nla[NFTA_SET_TIMEOUT])));
2863 }2865 }
2864 gc_int = 0;2866 gc_int = 0;
2865 if (nla[NFTA_SET_GC_INTERVAL] != NULL) {2867 if (nla[NFTA_SET_GC_INTERVAL] != NULL) {
@@ -3178,7 +3180,8 @@ static int nf_tables_fill_setelem(struct sk_buff *skb, · 312 unmodified lines
3178 3180
3179 if (nft_set_ext_exists(ext, NFT_SET_EXT_TIMEOUT) &&3181 if (nft_set_ext_exists(ext, NFT_SET_EXT_TIMEOUT) &&
3180 nla_put_be64(skb, NFTA_SET_ELEM_TIMEOUT,3182 nla_put_be64(skb, NFTA_SET_ELEM_TIMEOUT,
3181 cpu_to_be64(*nft_set_ext_timeout(ext)),3183 cpu_to_be64(jiffies_to_msecs(
3184 *nft_set_ext_timeout(ext))),
3182 NFTA_SET_ELEM_PAD))3185 NFTA_SET_ELEM_PAD))
3183 goto nla_put_failure;3186 goto nla_put_failure;
3184 3187
@@ -3447,7 +3450,7 @@ void *nft_set_elem_init(const struct nft_set *set, · 262 unmodified lines
3447 memcpy(nft_set_ext_data(ext), data, set->dlen);3450 memcpy(nft_set_ext_data(ext), data, set->dlen);
3448 if (nft_set_ext_exists(ext, NFT_SET_EXT_EXPIRATION))3451 if (nft_set_ext_exists(ext, NFT_SET_EXT_EXPIRATION))
3449 *nft_set_ext_expiration(ext) =3452 *nft_set_ext_expiration(ext) =
3450 jiffies + msecs_to_jiffies(timeout);3453 jiffies + timeout;
3451 if (nft_set_ext_exists(ext, NFT_SET_EXT_TIMEOUT))3454 if (nft_set_ext_exists(ext, NFT_SET_EXT_TIMEOUT))
3452 *nft_set_ext_timeout(ext) = timeout;3455 *nft_set_ext_timeout(ext) = timeout;
3453 3456
@@ -3535,7 +3538,8 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set, · 81 unmodified lines
3535 if (nla[NFTA_SET_ELEM_TIMEOUT] != NULL) {3538 if (nla[NFTA_SET_ELEM_TIMEOUT] != NULL) {
3536 if (!(set->flags & NFT_SET_TIMEOUT))3539 if (!(set->flags & NFT_SET_TIMEOUT))
3537 return -EINVAL;3540 return -EINVAL;
3538 timeout = be64_to_cpu(nla_get_be64(nla[NFTA_SET_ELEM_TIMEOUT]));3541 timeout = msecs_to_jiffies(be64_to_cpu(nla_get_be64(
3542 nla[NFTA_SET_ELEM_TIMEOUT])));
3539 } else if (set->flags & NFT_SET_TIMEOUT) {3543 } else if (set->flags & NFT_SET_TIMEOUT) {
3540 timeout = set->timeout;3544 timeout = set->timeout;
3541 }3545 }
net/netfilter/nft_hash.c+5−2
@@ -53,6 +53,7 @@ static int nft_hash_init(const struct nft_ctx *ctx, · 52 unmodified lines
53{53{
54 struct nft_hash *priv = nft_expr_priv(expr);54 struct nft_hash *priv = nft_expr_priv(expr);
55 u32 len;55 u32 len;
56 int err;
56 57
57 if (!tb[NFTA_HASH_SREG] ||58 if (!tb[NFTA_HASH_SREG] ||
58 !tb[NFTA_HASH_DREG] ||59 !tb[NFTA_HASH_DREG] ||
@@ -67,8 +68,10 @@ static int nft_hash_init(const struct nft_ctx *ctx, · 8 unmodified lines
67 priv->sreg = nft_parse_register(tb[NFTA_HASH_SREG]);68 priv->sreg = nft_parse_register(tb[NFTA_HASH_SREG]);
68 priv->dreg = nft_parse_register(tb[NFTA_HASH_DREG]);69 priv->dreg = nft_parse_register(tb[NFTA_HASH_DREG]);
69 70
70 len = ntohl(nla_get_be32(tb[NFTA_HASH_LEN]));71 err = nft_parse_u32_check(tb[NFTA_HASH_LEN], U8_MAX, &len);
71 if (len == 0 || len > U8_MAX)72 if (err < 0)
73 return err;
74 if (len == 0)
72 return -ERANGE;75 return -ERANGE;
73 76
74 priv->len = len;77 priv->len = len;
net/netfilter/nft_range.c+6−0
@@ -59,6 +59,12 @@ static int nft_range_init(const struct nft_ctx *ctx, const struct nft_expr *expr · 58 unmodified lines
59 int err;59 int err;
60 u32 op;60 u32 op;
61 61
62 if (!tb[NFTA_RANGE_SREG] ||
63 !tb[NFTA_RANGE_OP] ||
64 !tb[NFTA_RANGE_FROM_DATA] ||
65 !tb[NFTA_RANGE_TO_DATA])
66 return -EINVAL;
67
62 err = nft_data_init(NULL, &priv->data_from, sizeof(priv->data_from),68 err = nft_data_init(NULL, &priv->data_from, sizeof(priv->data_from),
63 &desc_from, tb[NFTA_RANGE_FROM_DATA]);69 &desc_from, tb[NFTA_RANGE_FROM_DATA]);
64 if (err < 0)70 if (err < 0)
net/netlink/af_netlink.c+23−4
@@ -322,14 +322,11 @@ static void netlink_skb_set_owner_r(struct sk_buff *skb, struct sock *sk) · 321 unmodified lines
322 sk_mem_charge(sk, skb->truesize);322 sk_mem_charge(sk, skb->truesize);
323}323}
324 324
325static void netlink_sock_destruct(struct sock *sk)325static void __netlink_sock_destruct(struct sock *sk)
326{326{
327 struct netlink_sock *nlk = nlk_sk(sk);327 struct netlink_sock *nlk = nlk_sk(sk);
328 328
329 if (nlk->cb_running) {329 if (nlk->cb_running) {
330 if (nlk->cb.done)
331 nlk->cb.done(&nlk->cb);
332
333 module_put(nlk->cb.module);330 module_put(nlk->cb.module);
334 kfree_skb(nlk->cb.skb);331 kfree_skb(nlk->cb.skb);
335 }332 }
@@ -346,6 +343,28 @@ static void netlink_sock_destruct(struct sock *sk) · 10 unmodified lines
346 WARN_ON(nlk_sk(sk)->groups);343 WARN_ON(nlk_sk(sk)->groups);
347}344}
348 345
346static void netlink_sock_destruct_work(struct work_struct *work)
347{
348 struct netlink_sock *nlk = container_of(work, struct netlink_sock,
349 work);
350
351 nlk->cb.done(&nlk->cb);
352 __netlink_sock_destruct(&nlk->sk);
353}
354
355static void netlink_sock_destruct(struct sock *sk)
356{
357 struct netlink_sock *nlk = nlk_sk(sk);
358
359 if (nlk->cb_running && nlk->cb.done) {
360 INIT_WORK(&nlk->work, netlink_sock_destruct_work);
361 schedule_work(&nlk->work);
362 return;
363 }
364
365 __netlink_sock_destruct(sk);
366}
367
349/* This lock without WQ_FLAG_EXCLUSIVE is good on UP and it is _very_ bad on368/* This lock without WQ_FLAG_EXCLUSIVE is good on UP and it is _very_ bad on
350 * SMP. Look, when several writers sleep and reader wakes them up, all but one369 * SMP. Look, when several writers sleep and reader wakes them up, all but one
351 * immediately hit write lock and grab all the cpus. Exclusive sleep solves370 * immediately hit write lock and grab all the cpus. Exclusive sleep solves
net/netlink/af_netlink.h+2−0
@@ -3,6 +3,7 @@ · 2 unmodified lines
3 3
4#include <linux/rhashtable.h>4#include <linux/rhashtable.h>
5#include <linux/atomic.h>5#include <linux/atomic.h>
6#include <linux/workqueue.h>
6#include <net/sock.h>7#include <net/sock.h>
7 8
8#define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8)9#define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8)
@@ -33,6 +34,7 @@ struct netlink_sock { · 24 unmodified lines
33 34
34 struct rhash_head node;35 struct rhash_head node;
35 struct rcu_head rcu;36 struct rcu_head rcu;
37 struct work_struct work;
36};38};
37 39
38static inline struct netlink_sock *nlk_sk(struct sock *sk)40static inline struct netlink_sock *nlk_sk(struct sock *sk)
net/openvswitch/conntrack.c+4−1
@@ -370,8 +370,11 @@ static int handle_fragments(struct net *net, struct sw_flow_key *key, · 369 unmodified lines
370 skb_orphan(skb);370 skb_orphan(skb);
371 memset(IP6CB(skb), 0, sizeof(struct inet6_skb_parm));371 memset(IP6CB(skb), 0, sizeof(struct inet6_skb_parm));
372 err = nf_ct_frag6_gather(net, skb, user);372 err = nf_ct_frag6_gather(net, skb, user);
373 if (err)373 if (err) {
374 if (err != -EINPROGRESS)
375 kfree_skb(skb);
374 return err;376 return err;
377 }
375 378
376 key->ip.proto = ipv6_hdr(skb)->nexthdr;379 key->ip.proto = ipv6_hdr(skb)->nexthdr;
377 ovs_cb.mru = IP6CB(skb)->frag_max_size;380 ovs_cb.mru = IP6CB(skb)->frag_max_size;
net/packet/af_packet.c+12−6
@@ -3648,19 +3648,25 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv · 3647 unmodified lines
3648 3648
3649 if (optlen != sizeof(val))3649 if (optlen != sizeof(val))
3650 return -EINVAL;3650 return -EINVAL;
3651 if (po->rx_ring.pg_vec || po->tx_ring.pg_vec)
3652 return -EBUSY;
3653 if (copy_from_user(&val, optval, sizeof(val)))3651 if (copy_from_user(&val, optval, sizeof(val)))
3654 return -EFAULT;3652 return -EFAULT;
3655 switch (val) {3653 switch (val) {
3656 case TPACKET_V1:3654 case TPACKET_V1:
3657 case TPACKET_V2:3655 case TPACKET_V2:
3658 case TPACKET_V3:3656 case TPACKET_V3:
3659 po->tp_version = val;3657 break;
3660 return 0;
3661 default:3658 default:
3662 return -EINVAL;3659 return -EINVAL;
3663 }3660 }
3661 lock_sock(sk);
3662 if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) {
3663 ret = -EBUSY;
3664 } else {
3665 po->tp_version = val;
3666 ret = 0;
3667 }
3668 release_sock(sk);
3669 return ret;
3664 }3670 }
3665 case PACKET_RESERVE:3671 case PACKET_RESERVE:
3666 {3672 {
@@ -4164,6 +4170,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, · 497 unmodified lines
4164 /* Added to avoid minimal code churn */4170 /* Added to avoid minimal code churn */
4165 struct tpacket_req *req = &req_u->req;4171 struct tpacket_req *req = &req_u->req;
4166 4172
4173 lock_sock(sk);
4167 /* Opening a Tx-ring is NOT supported in TPACKET_V3 */4174 /* Opening a Tx-ring is NOT supported in TPACKET_V3 */
4168 if (!closing && tx_ring && (po->tp_version > TPACKET_V2)) {4175 if (!closing && tx_ring && (po->tp_version > TPACKET_V2)) {
4169 net_warn_ratelimited("Tx-ring is not supported.\n");4176 net_warn_ratelimited("Tx-ring is not supported.\n");
@@ -4245,7 +4252,6 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, · 75 unmodified lines
4245 goto out;4252 goto out;
4246 }4253 }
4247 4254
4248 lock_sock(sk);
4249 4255
4250 /* Detach socket from network */4256 /* Detach socket from network */
4251 spin_lock(&po->bind_lock);4257 spin_lock(&po->bind_lock);
@@ -4294,11 +4300,11 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, · 42 unmodified lines
4294 if (!tx_ring)4300 if (!tx_ring)
4295 prb_shutdown_retire_blk_timer(po, rb_queue);4301 prb_shutdown_retire_blk_timer(po, rb_queue);
4296 }4302 }
4297 release_sock(sk);
4298 4303
4299 if (pg_vec)4304 if (pg_vec)
4300 free_pg_vec(pg_vec, order, req->tp_block_nr);4305 free_pg_vec(pg_vec, order, req->tp_block_nr);
4301out:4306out:
4307 release_sock(sk);
4302 return err;4308 return err;
4303}4309}
4304 4310
net/rds/tcp.c+2−0
@@ -659,6 +659,8 @@ out_recv: · 658 unmodified lines
659out_pernet:659out_pernet:
660 unregister_pernet_subsys(&rds_tcp_net_ops);660 unregister_pernet_subsys(&rds_tcp_net_ops);
661out_slab:661out_slab:
662 if (unregister_netdevice_notifier(&rds_tcp_dev_notifier))
663 pr_warn("could not unregister rds_tcp_dev_notifier\n");
662 kmem_cache_destroy(rds_tcp_conn_slab);664 kmem_cache_destroy(rds_tcp_conn_slab);
663out:665out:
664 return ret;666 return ret;
net/sched/act_pedit.c+20−4
@@ -108,6 +108,17 @@ static void tcf_pedit_cleanup(struct tc_action *a, int bind) · 107 unmodified lines
108 kfree(keys);108 kfree(keys);
109}109}
110 110
111static bool offset_valid(struct sk_buff *skb, int offset)
112{
113 if (offset > 0 && offset > skb->len)
114 return false;
115
116 if (offset < 0 && -offset > skb_headroom(skb))
117 return false;
118
119 return true;
120}
121
111static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,122static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
112 struct tcf_result *res)123 struct tcf_result *res)
113{124{
@@ -134,6 +145,11 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a, · 20 unmodified lines
134 if (tkey->offmask) {145 if (tkey->offmask) {
135 char *d, _d;146 char *d, _d;
136 147
148 if (!offset_valid(skb, off + tkey->at)) {
149 pr_info("tc filter pedit 'at' offset %d out of bounds\n",
150 off + tkey->at);
151 goto bad;
152 }
137 d = skb_header_pointer(skb, off + tkey->at, 1,153 d = skb_header_pointer(skb, off + tkey->at, 1,
138 &_d);154 &_d);
139 if (!d)155 if (!d)
@@ -146,10 +162,10 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a, · 6 unmodified lines
146 " offset must be on 32 bit boundaries\n");162 " offset must be on 32 bit boundaries\n");
147 goto bad;163 goto bad;
148 }164 }
149 if (offset > 0 && offset > skb->len) {165
150 pr_info("tc filter pedit"166 if (!offset_valid(skb, off + offset)) {
151 " offset %d can't exceed pkt length %d\n",167 pr_info("tc filter pedit offset %d out of bounds\n",
152 offset, skb->len);168 offset);
153 goto bad;169 goto bad;
154 }170 }
155 171
net/sched/cls_basic.c+0−4
@@ -62,9 +62,6 @@ static unsigned long basic_get(struct tcf_proto *tp, u32 handle) · 61 unmodified lines
62 struct basic_head *head = rtnl_dereference(tp->root);62 struct basic_head *head = rtnl_dereference(tp->root);
63 struct basic_filter *f;63 struct basic_filter *f;
64 64
65 if (head == NULL)
66 return 0UL;
67
68 list_for_each_entry(f, &head->flist, link) {65 list_for_each_entry(f, &head->flist, link) {
69 if (f->handle == handle) {66 if (f->handle == handle) {
70 l = (unsigned long) f;67 l = (unsigned long) f;
@@ -109,7 +106,6 @@ static bool basic_destroy(struct tcf_proto *tp, bool force) · 38 unmodified lines
109 tcf_unbind_filter(tp, &f->res);106 tcf_unbind_filter(tp, &f->res);
110 call_rcu(&f->rcu, basic_delete_filter);107 call_rcu(&f->rcu, basic_delete_filter);
111 }108 }
112 RCU_INIT_POINTER(tp->root, NULL);
113 kfree_rcu(head, rcu);109 kfree_rcu(head, rcu);
114 return true;110 return true;
115}111}
net/sched/cls_bpf.c+0−4
@@ -292,7 +292,6 @@ static bool cls_bpf_destroy(struct tcf_proto *tp, bool force) · 291 unmodified lines
292 call_rcu(&prog->rcu, __cls_bpf_delete_prog);292 call_rcu(&prog->rcu, __cls_bpf_delete_prog);
293 }293 }
294 294
295 RCU_INIT_POINTER(tp->root, NULL);
296 kfree_rcu(head, rcu);295 kfree_rcu(head, rcu);
297 return true;296 return true;
298}297}
@@ -303,9 +302,6 @@ static unsigned long cls_bpf_get(struct tcf_proto *tp, u32 handle) · 4 unmodified lines
303 struct cls_bpf_prog *prog;302 struct cls_bpf_prog *prog;
304 unsigned long ret = 0UL;303 unsigned long ret = 0UL;
305 304
306 if (head == NULL)
307 return 0UL;
308
309 list_for_each_entry(prog, &head->plist, link) {305 list_for_each_entry(prog, &head->plist, link) {
310 if (prog->handle == handle) {306 if (prog->handle == handle) {
311 ret = (unsigned long) prog;307 ret = (unsigned long) prog;
net/sched/cls_cgroup.c+3−4
@@ -137,11 +137,10 @@ static bool cls_cgroup_destroy(struct tcf_proto *tp, bool force) · 136 unmodified lines
137 137
138 if (!force)138 if (!force)
139 return false;139 return false;
140 140 /* Head can still be NULL due to cls_cgroup_init(). */
141 if (head) {141 if (head)
142 RCU_INIT_POINTER(tp->root, NULL);
143 call_rcu(&head->rcu, cls_cgroup_destroy_rcu);142 call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
144 }143
145 return true;144 return true;
146}145}
147 146
net/sched/cls_flow.c+0−1
@@ -596,7 +596,6 @@ static bool flow_destroy(struct tcf_proto *tp, bool force) · 595 unmodified lines
596 list_del_rcu(&f->list);596 list_del_rcu(&f->list);
597 call_rcu(&f->rcu, flow_destroy_filter);597 call_rcu(&f->rcu, flow_destroy_filter);
598 }598 }
599 RCU_INIT_POINTER(tp->root, NULL);
600 kfree_rcu(head, rcu);599 kfree_rcu(head, rcu);
601 return true;600 return true;
602}601}
net/sched/cls_flower.c+32−9
@@ -13,6 +13,7 @@ · 12 unmodified lines
13#include <linux/init.h>13#include <linux/init.h>
14#include <linux/module.h>14#include <linux/module.h>
15#include <linux/rhashtable.h>15#include <linux/rhashtable.h>
16#include <linux/workqueue.h>
16 17
17#include <linux/if_ether.h>18#include <linux/if_ether.h>
18#include <linux/in6.h>19#include <linux/in6.h>
@@ -64,7 +65,10 @@ struct cls_fl_head { · 45 unmodified lines
64 bool mask_assigned;65 bool mask_assigned;
65 struct list_head filters;66 struct list_head filters;
66 struct rhashtable_params ht_params;67 struct rhashtable_params ht_params;
67 struct rcu_head rcu;68 union {
69 struct work_struct work;
70 struct rcu_head rcu;
71 };
68};72};
69 73
70struct cls_fl_filter {74struct cls_fl_filter {
@@ -269,6 +273,24 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f) · 198 unmodified lines
269 dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol, &tc);273 dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol, &tc);
270}274}
271 275
276static void fl_destroy_sleepable(struct work_struct *work)
277{
278 struct cls_fl_head *head = container_of(work, struct cls_fl_head,
279 work);
280 if (head->mask_assigned)
281 rhashtable_destroy(&head->ht);
282 kfree(head);
283 module_put(THIS_MODULE);
284}
285
286static void fl_destroy_rcu(struct rcu_head *rcu)
287{
288 struct cls_fl_head *head = container_of(rcu, struct cls_fl_head, rcu);
289
290 INIT_WORK(&head->work, fl_destroy_sleepable);
291 schedule_work(&head->work);
292}
293
272static bool fl_destroy(struct tcf_proto *tp, bool force)294static bool fl_destroy(struct tcf_proto *tp, bool force)
273{295{
274 struct cls_fl_head *head = rtnl_dereference(tp->root);296 struct cls_fl_head *head = rtnl_dereference(tp->root);
@@ -282,10 +304,9 @@ static bool fl_destroy(struct tcf_proto *tp, bool force) · 7 unmodified lines
282 list_del_rcu(&f->list);304 list_del_rcu(&f->list);
283 call_rcu(&f->rcu, fl_destroy_filter);305 call_rcu(&f->rcu, fl_destroy_filter);
284 }306 }
285 RCU_INIT_POINTER(tp->root, NULL);307
286 if (head->mask_assigned)308 __module_get(THIS_MODULE);
287 rhashtable_destroy(&head->ht);309 call_rcu(&head->rcu, fl_destroy_rcu);
288 kfree_rcu(head, rcu);
289 return true;310 return true;
290}311}
291 312
@@ -711,8 +732,9 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, · 419 unmodified lines
711 goto errout;732 goto errout;
712 733
713 if (fold) {734 if (fold) {
714 rhashtable_remove_fast(&head->ht, &fold->ht_node,735 if (!tc_skip_sw(fold->flags))
715 head->ht_params);736 rhashtable_remove_fast(&head->ht, &fold->ht_node,
737 head->ht_params);
716 fl_hw_destroy_filter(tp, (unsigned long)fold);738 fl_hw_destroy_filter(tp, (unsigned long)fold);
717 }739 }
718 740
@@ -739,8 +761,9 @@ static int fl_delete(struct tcf_proto *tp, unsigned long arg) · 20 unmodified lines
739 struct cls_fl_head *head = rtnl_dereference(tp->root);761 struct cls_fl_head *head = rtnl_dereference(tp->root);
740 struct cls_fl_filter *f = (struct cls_fl_filter *) arg;762 struct cls_fl_filter *f = (struct cls_fl_filter *) arg;
741 763
742 rhashtable_remove_fast(&head->ht, &f->ht_node,764 if (!tc_skip_sw(f->flags))
743 head->ht_params);765 rhashtable_remove_fast(&head->ht, &f->ht_node,
766 head->ht_params);
744 list_del_rcu(&f->list);767 list_del_rcu(&f->list);
745 fl_hw_destroy_filter(tp, (unsigned long)f);768 fl_hw_destroy_filter(tp, (unsigned long)f);
746 tcf_unbind_filter(tp, &f->res);769 tcf_unbind_filter(tp, &f->res);
net/sched/cls_matchall.c+0−1
@@ -114,7 +114,6 @@ static bool mall_destroy(struct tcf_proto *tp, bool force) · 113 unmodified lines
114 114
115 call_rcu(&f->rcu, mall_destroy_filter);115 call_rcu(&f->rcu, mall_destroy_filter);
116 }116 }
117 RCU_INIT_POINTER(tp->root, NULL);
118 kfree_rcu(head, rcu);117 kfree_rcu(head, rcu);
119 return true;118 return true;
120}119}
net/sched/cls_rsvp.h+2−1
@@ -152,7 +152,8 @@ static int rsvp_classify(struct sk_buff *skb, const struct tcf_proto *tp, · 151 unmodified lines
152 return -1;152 return -1;
153 nhptr = ip_hdr(skb);153 nhptr = ip_hdr(skb);
154#endif154#endif
155 155 if (unlikely(!head))
156 return -1;
156restart:157restart:
157 158
158#if RSVP_DST_LEN == 4159#if RSVP_DST_LEN == 4
net/sched/cls_tcindex.c+0−1
@@ -543,7 +543,6 @@ static bool tcindex_destroy(struct tcf_proto *tp, bool force) · 542 unmodified lines
543 walker.fn = tcindex_destroy_element;543 walker.fn = tcindex_destroy_element;
544 tcindex_walk(tp, &walker);544 tcindex_walk(tp, &walker);
545 545
546 RCU_INIT_POINTER(tp->root, NULL);
547 call_rcu(&p->rcu, __tcindex_destroy);546 call_rcu(&p->rcu, __tcindex_destroy);
548 return true;547 return true;
549}548}
net/tipc/bearer.c+9−2
@@ -421,6 +421,10 @@ int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b, · 420 unmodified lines
421 dev = dev_get_by_name(net, driver_name);421 dev = dev_get_by_name(net, driver_name);
422 if (!dev)422 if (!dev)
423 return -ENODEV;423 return -ENODEV;
424 if (tipc_mtu_bad(dev, 0)) {
425 dev_put(dev);
426 return -EINVAL;
427 }
424 428
425 /* Associate TIPC bearer with L2 bearer */429 /* Associate TIPC bearer with L2 bearer */
426 rcu_assign_pointer(b->media_ptr, dev);430 rcu_assign_pointer(b->media_ptr, dev);
@@ -610,8 +614,6 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt, · 183 unmodified lines
610 if (!b)614 if (!b)
611 return NOTIFY_DONE;615 return NOTIFY_DONE;
612 616
613 b->mtu = dev->mtu;
614
615 switch (evt) {617 switch (evt) {
616 case NETDEV_CHANGE:618 case NETDEV_CHANGE:
617 if (netif_carrier_ok(dev))619 if (netif_carrier_ok(dev))
@@ -624,6 +626,11 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt, · 6 unmodified lines
624 tipc_reset_bearer(net, b);626 tipc_reset_bearer(net, b);
625 break;627 break;
626 case NETDEV_CHANGEMTU:628 case NETDEV_CHANGEMTU:
629 if (tipc_mtu_bad(dev, 0)) {
630 bearer_disable(net, b);
631 break;
632 }
633 b->mtu = dev->mtu;
627 tipc_reset_bearer(net, b);634 tipc_reset_bearer(net, b);
628 break;635 break;
629 case NETDEV_CHANGEADDR:636 case NETDEV_CHANGEADDR:
net/tipc/bearer.h+13−0
@@ -39,6 +39,7 @@ · 38 unmodified lines
39 39
40#include "netlink.h"40#include "netlink.h"
41#include "core.h"41#include "core.h"
42#include "msg.h"
42#include <net/genetlink.h>43#include <net/genetlink.h>
43 44
44#define MAX_MEDIA 345#define MAX_MEDIA 3
@@ -59,6 +60,9 @@ · 14 unmodified lines
59#define TIPC_MEDIA_TYPE_IB 260#define TIPC_MEDIA_TYPE_IB 2
60#define TIPC_MEDIA_TYPE_UDP 361#define TIPC_MEDIA_TYPE_UDP 3
61 62
63/* minimum bearer MTU */
64#define TIPC_MIN_BEARER_MTU (MAX_H_SIZE + INT_H_SIZE)
65
62/**66/**
63 * struct tipc_media_addr - destination address used by TIPC bearers67 * struct tipc_media_addr - destination address used by TIPC bearers
64 * @value: address info (format defined by media)68 * @value: address info (format defined by media)
@@ -215,4 +219,13 @@ void tipc_bearer_xmit(struct net *net, u32 bearer_id, · 150 unmodified lines
215void tipc_bearer_bc_xmit(struct net *net, u32 bearer_id,219void tipc_bearer_bc_xmit(struct net *net, u32 bearer_id,
216 struct sk_buff_head *xmitq);220 struct sk_buff_head *xmitq);
217 221
222/* check if device MTU is too low for tipc headers */
223static inline bool tipc_mtu_bad(struct net_device *dev, unsigned int reserve)
224{
225 if (dev->mtu >= TIPC_MIN_BEARER_MTU + reserve)
226 return false;
227 netdev_warn(dev, "MTU too low for tipc bearer\n");
228 return true;
229}
230
218#endif /* _TIPC_BEARER_H */231#endif /* _TIPC_BEARER_H */
net/tipc/link.c+19−16
@@ -47,8 +47,8 @@ · 46 unmodified lines
47#include <linux/pkt_sched.h>47#include <linux/pkt_sched.h>
48 48
49struct tipc_stats {49struct tipc_stats {
50 u32 sent_info; /* used in counting # sent packets */50 u32 sent_pkts;
51 u32 recv_info; /* used in counting # recv'd packets */51 u32 recv_pkts;
52 u32 sent_states;52 u32 sent_states;
53 u32 recv_states;53 u32 recv_states;
54 u32 sent_probes;54 u32 sent_probes;
@@ -857,7 +857,6 @@ void tipc_link_reset(struct tipc_link *l) · 802 unmodified lines
857 l->acked = 0;857 l->acked = 0;
858 l->silent_intv_cnt = 0;858 l->silent_intv_cnt = 0;
859 l->rst_cnt = 0;859 l->rst_cnt = 0;
860 l->stats.recv_info = 0;
861 l->stale_count = 0;860 l->stale_count = 0;
862 l->bc_peer_is_up = false;861 l->bc_peer_is_up = false;
863 memset(&l->mon_state, 0, sizeof(l->mon_state));862 memset(&l->mon_state, 0, sizeof(l->mon_state));
@@ -888,6 +887,7 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, · 24 unmodified lines
888 struct sk_buff_head *transmq = &l->transmq;887 struct sk_buff_head *transmq = &l->transmq;
889 struct sk_buff_head *backlogq = &l->backlogq;888 struct sk_buff_head *backlogq = &l->backlogq;
890 struct sk_buff *skb, *_skb, *bskb;889 struct sk_buff *skb, *_skb, *bskb;
890 int pkt_cnt = skb_queue_len(list);
891 891
892 /* Match msg importance against this and all higher backlog limits: */892 /* Match msg importance against this and all higher backlog limits: */
893 if (!skb_queue_empty(backlogq)) {893 if (!skb_queue_empty(backlogq)) {
@@ -901,6 +901,11 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, · 7 unmodified lines
901 return -EMSGSIZE;901 return -EMSGSIZE;
902 }902 }
903 903
904 if (pkt_cnt > 1) {
905 l->stats.sent_fragmented++;
906 l->stats.sent_fragments += pkt_cnt;
907 }
908
904 /* Prepare each packet for sending, and add to relevant queue: */909 /* Prepare each packet for sending, and add to relevant queue: */
905 while (skb_queue_len(list)) {910 while (skb_queue_len(list)) {
906 skb = skb_peek(list);911 skb = skb_peek(list);
@@ -920,6 +925,7 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, · 13 unmodified lines
920 __skb_queue_tail(xmitq, _skb);925 __skb_queue_tail(xmitq, _skb);
921 TIPC_SKB_CB(skb)->ackers = l->ackers;926 TIPC_SKB_CB(skb)->ackers = l->ackers;
922 l->rcv_unacked = 0;927 l->rcv_unacked = 0;
928 l->stats.sent_pkts++;
923 seqno++;929 seqno++;
924 continue;930 continue;
925 }931 }
@@ -968,6 +974,7 @@ void tipc_link_advance_backlog(struct tipc_link *l, struct sk_buff_head *xmitq) · 42 unmodified lines
968 msg_set_ack(hdr, ack);974 msg_set_ack(hdr, ack);
969 msg_set_bcast_ack(hdr, bc_ack);975 msg_set_bcast_ack(hdr, bc_ack);
970 l->rcv_unacked = 0;976 l->rcv_unacked = 0;
977 l->stats.sent_pkts++;
971 seqno++;978 seqno++;
972 }979 }
973 l->snd_nxt = seqno;980 l->snd_nxt = seqno;
@@ -1260,7 +1267,7 @@ int tipc_link_rcv(struct tipc_link *l, struct sk_buff *skb, · 286 unmodified lines
1260 1267
1261 /* Deliver packet */1268 /* Deliver packet */
1262 l->rcv_nxt++;1269 l->rcv_nxt++;
1263 l->stats.recv_info++;1270 l->stats.recv_pkts++;
1264 if (!tipc_data_input(l, skb, l->inputq))1271 if (!tipc_data_input(l, skb, l->inputq))
1265 rc |= tipc_link_input(l, skb, l->inputq);1272 rc |= tipc_link_input(l, skb, l->inputq);
1266 if (unlikely(++l->rcv_unacked >= TIPC_MIN_LINK_WIN))1273 if (unlikely(++l->rcv_unacked >= TIPC_MIN_LINK_WIN))
@@ -1800,10 +1807,6 @@ void tipc_link_set_queue_limits(struct tipc_link *l, u32 win) · 533 unmodified lines
1800void tipc_link_reset_stats(struct tipc_link *l)1807void tipc_link_reset_stats(struct tipc_link *l)
1801{1808{
1802 memset(&l->stats, 0, sizeof(l->stats));1809 memset(&l->stats, 0, sizeof(l->stats));
1803 if (!link_is_bc_sndlink(l)) {
1804 l->stats.sent_info = l->snd_nxt;
1805 l->stats.recv_info = l->rcv_nxt;
1806 }
1807}1810}
1808 1811
1809static void link_print(struct tipc_link *l, const char *str)1812static void link_print(struct tipc_link *l, const char *str)
@@ -1867,12 +1870,12 @@ static int __tipc_nl_add_stats(struct sk_buff *skb, struct tipc_stats *s) · 57 unmodified lines
1867 };1870 };
1868 1871
1869 struct nla_map map[] = {1872 struct nla_map map[] = {
1870 {TIPC_NLA_STATS_RX_INFO, s->recv_info},1873 {TIPC_NLA_STATS_RX_INFO, 0},
1871 {TIPC_NLA_STATS_RX_FRAGMENTS, s->recv_fragments},1874 {TIPC_NLA_STATS_RX_FRAGMENTS, s->recv_fragments},
1872 {TIPC_NLA_STATS_RX_FRAGMENTED, s->recv_fragmented},1875 {TIPC_NLA_STATS_RX_FRAGMENTED, s->recv_fragmented},
1873 {TIPC_NLA_STATS_RX_BUNDLES, s->recv_bundles},1876 {TIPC_NLA_STATS_RX_BUNDLES, s->recv_bundles},
1874 {TIPC_NLA_STATS_RX_BUNDLED, s->recv_bundled},1877 {TIPC_NLA_STATS_RX_BUNDLED, s->recv_bundled},
1875 {TIPC_NLA_STATS_TX_INFO, s->sent_info},1878 {TIPC_NLA_STATS_TX_INFO, 0},
1876 {TIPC_NLA_STATS_TX_FRAGMENTS, s->sent_fragments},1879 {TIPC_NLA_STATS_TX_FRAGMENTS, s->sent_fragments},
1877 {TIPC_NLA_STATS_TX_FRAGMENTED, s->sent_fragmented},1880 {TIPC_NLA_STATS_TX_FRAGMENTED, s->sent_fragmented},
1878 {TIPC_NLA_STATS_TX_BUNDLES, s->sent_bundles},1881 {TIPC_NLA_STATS_TX_BUNDLES, s->sent_bundles},
@@ -1947,9 +1950,9 @@ int __tipc_nl_add_link(struct net *net, struct tipc_nl_msg *msg, · 68 unmodified lines
1947 goto attr_msg_full;1950 goto attr_msg_full;
1948 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_MTU, link->mtu))1951 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_MTU, link->mtu))
1949 goto attr_msg_full;1952 goto attr_msg_full;
1950 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, link->rcv_nxt))1953 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, link->stats.recv_pkts))
1951 goto attr_msg_full;1954 goto attr_msg_full;
1952 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, link->snd_nxt))1955 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, link->stats.sent_pkts))
1953 goto attr_msg_full;1956 goto attr_msg_full;
1954 1957
1955 if (tipc_link_is_up(link))1958 if (tipc_link_is_up(link))
@@ -2004,12 +2007,12 @@ static int __tipc_nl_add_bc_link_stat(struct sk_buff *skb, · 48 unmodified lines
2004 };2007 };
2005 2008
2006 struct nla_map map[] = {2009 struct nla_map map[] = {
2007 {TIPC_NLA_STATS_RX_INFO, stats->recv_info},2010 {TIPC_NLA_STATS_RX_INFO, stats->recv_pkts},
2008 {TIPC_NLA_STATS_RX_FRAGMENTS, stats->recv_fragments},2011 {TIPC_NLA_STATS_RX_FRAGMENTS, stats->recv_fragments},
2009 {TIPC_NLA_STATS_RX_FRAGMENTED, stats->recv_fragmented},2012 {TIPC_NLA_STATS_RX_FRAGMENTED, stats->recv_fragmented},
2010 {TIPC_NLA_STATS_RX_BUNDLES, stats->recv_bundles},2013 {TIPC_NLA_STATS_RX_BUNDLES, stats->recv_bundles},
2011 {TIPC_NLA_STATS_RX_BUNDLED, stats->recv_bundled},2014 {TIPC_NLA_STATS_RX_BUNDLED, stats->recv_bundled},
2012 {TIPC_NLA_STATS_TX_INFO, stats->sent_info},2015 {TIPC_NLA_STATS_TX_INFO, stats->sent_pkts},
2013 {TIPC_NLA_STATS_TX_FRAGMENTS, stats->sent_fragments},2016 {TIPC_NLA_STATS_TX_FRAGMENTS, stats->sent_fragments},
2014 {TIPC_NLA_STATS_TX_FRAGMENTED, stats->sent_fragmented},2017 {TIPC_NLA_STATS_TX_FRAGMENTED, stats->sent_fragmented},
2015 {TIPC_NLA_STATS_TX_BUNDLES, stats->sent_bundles},2018 {TIPC_NLA_STATS_TX_BUNDLES, stats->sent_bundles},
@@ -2076,9 +2079,9 @@ int tipc_nl_add_bc_link(struct net *net, struct tipc_nl_msg *msg) · 60 unmodified lines
2076 goto attr_msg_full;2079 goto attr_msg_full;
2077 if (nla_put_string(msg->skb, TIPC_NLA_LINK_NAME, bcl->name))2080 if (nla_put_string(msg->skb, TIPC_NLA_LINK_NAME, bcl->name))
2078 goto attr_msg_full;2081 goto attr_msg_full;
2079 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, bcl->rcv_nxt))2082 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_RX, 0))
2080 goto attr_msg_full;2083 goto attr_msg_full;
2081 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, bcl->snd_nxt))2084 if (nla_put_u32(msg->skb, TIPC_NLA_LINK_TX, 0))
2082 goto attr_msg_full;2085 goto attr_msg_full;
2083 2086
2084 prop = nla_nest_start(msg->skb, TIPC_NLA_LINK_PROP);2087 prop = nla_nest_start(msg->skb, TIPC_NLA_LINK_PROP);
net/tipc/udp_media.c+5−0
@@ -697,6 +697,11 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b, · 696 unmodified lines
697 udp_conf.local_ip.s_addr = htonl(INADDR_ANY);697 udp_conf.local_ip.s_addr = htonl(INADDR_ANY);
698 udp_conf.use_udp_checksums = false;698 udp_conf.use_udp_checksums = false;
699 ub->ifindex = dev->ifindex;699 ub->ifindex = dev->ifindex;
700 if (tipc_mtu_bad(dev, sizeof(struct iphdr) +
701 sizeof(struct udphdr))) {
702 err = -EINVAL;
703 goto err;
704 }
700 b->mtu = dev->mtu - sizeof(struct iphdr)705 b->mtu = dev->mtu - sizeof(struct iphdr)
701 - sizeof(struct udphdr);706 - sizeof(struct udphdr);
702#if IS_ENABLED(CONFIG_IPV6)707#if IS_ENABLED(CONFIG_IPV6)
net/xfrm/xfrm_policy.c+6−4
@@ -1268,12 +1268,14 @@ static struct xfrm_policy *xfrm_sk_policy_lookup(const struct sock *sk, int dir, · 1267 unmodified lines
1268 err = security_xfrm_policy_lookup(pol->security,1268 err = security_xfrm_policy_lookup(pol->security,
1269 fl->flowi_secid,1269 fl->flowi_secid,
1270 policy_to_flow_dir(dir));1270 policy_to_flow_dir(dir));
1271 if (!err && !xfrm_pol_hold_rcu(pol))1271 if (!err) {
1272 goto again;1272 if (!xfrm_pol_hold_rcu(pol))
1273 else if (err == -ESRCH)1273 goto again;
1274 } else if (err == -ESRCH) {
1274 pol = NULL;1275 pol = NULL;
1275 else1276 } else {
1276 pol = ERR_PTR(err);1277 pol = ERR_PTR(err);
1278 }
1277 } else1279 } else
1278 pol = NULL;1280 pol = NULL;
1279 }1281 }
net/xfrm/xfrm_user.c+1−1
@@ -2450,7 +2450,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) · 2449 unmodified lines
2450 2450
2451#ifdef CONFIG_COMPAT2451#ifdef CONFIG_COMPAT
2452 if (in_compat_syscall())2452 if (in_compat_syscall())
2453 return -ENOTSUPP;2453 return -EOPNOTSUPP;
2454#endif2454#endif
2455 2455
2456 type = nlh->nlmsg_type;2456 type = nlh->nlmsg_type;
samples/bpf/bpf_helpers.h+1−1
@@ -113,7 +113,7 @@ static int (*bpf_skb_under_cgroup)(void *ctx, void *map, int index) = · 112 unmodified lines
113#define PT_REGS_FP(x) ((x)->gprs[11]) /* Works only with CONFIG_FRAME_POINTER */113#define PT_REGS_FP(x) ((x)->gprs[11]) /* Works only with CONFIG_FRAME_POINTER */
114#define PT_REGS_RC(x) ((x)->gprs[2])114#define PT_REGS_RC(x) ((x)->gprs[2])
115#define PT_REGS_SP(x) ((x)->gprs[15])115#define PT_REGS_SP(x) ((x)->gprs[15])
116#define PT_REGS_IP(x) ((x)->ip)116#define PT_REGS_IP(x) ((x)->psw.addr)
117 117
118#elif defined(__aarch64__)118#elif defined(__aarch64__)
119 119
samples/bpf/sampleip_kern.c+1−1
@@ -25,7 +25,7 @@ int do_sample(struct bpf_perf_event_data *ctx) · 24 unmodified lines
25 u64 ip;25 u64 ip;
26 u32 *value, init_val = 1;26 u32 *value, init_val = 1;
27 27
28 ip = ctx->regs.ip;28 ip = PT_REGS_IP(&ctx->regs);
29 value = bpf_map_lookup_elem(&ip_map, &ip);29 value = bpf_map_lookup_elem(&ip_map, &ip);
30 if (value)30 if (value)
31 *value += 1;31 *value += 1;
samples/bpf/trace_event_kern.c+1−1
@@ -50,7 +50,7 @@ int bpf_prog1(struct bpf_perf_event_data *ctx) · 49 unmodified lines
50 key.userstack = bpf_get_stackid(ctx, &stackmap, USER_STACKID_FLAGS);50 key.userstack = bpf_get_stackid(ctx, &stackmap, USER_STACKID_FLAGS);
51 if ((int)key.kernstack < 0 && (int)key.userstack < 0) {51 if ((int)key.kernstack < 0 && (int)key.userstack < 0) {
52 bpf_trace_printk(fmt, sizeof(fmt), cpu, ctx->sample_period,52 bpf_trace_printk(fmt, sizeof(fmt), cpu, ctx->sample_period,
53 ctx->regs.ip);53 PT_REGS_IP(&ctx->regs));
54 return 0;54 return 0;
55 }55 }
56 56
scripts/kconfig/Makefile+2−0
@@ -35,6 +35,8 @@ nconfig: $(obj)/nconf · 34 unmodified lines
35 35
36silentoldconfig: $(obj)/conf36silentoldconfig: $(obj)/conf
37 $(Q)mkdir -p include/config include/generated37 $(Q)mkdir -p include/config include/generated
38 $(Q)test -e include/generated/autoksyms.h || \
39 touch include/generated/autoksyms.h
38 $< $(silent) --$@ $(Kconfig)40 $< $(silent) --$@ $(Kconfig)
39 41
40localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf42localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
sound/sparc/dbri.c+16−10
@@ -304,7 +304,7 @@ struct snd_dbri { · 303 unmodified lines
304 spinlock_t lock;304 spinlock_t lock;
305 305
306 struct dbri_dma *dma; /* Pointer to our DMA block */306 struct dbri_dma *dma; /* Pointer to our DMA block */
307 u32 dma_dvma; /* DBRI visible DMA address */307 dma_addr_t dma_dvma; /* DBRI visible DMA address */
308 308
309 void __iomem *regs; /* dbri HW regs */309 void __iomem *regs; /* dbri HW regs */
310 int dbri_irqp; /* intr queue pointer */310 int dbri_irqp; /* intr queue pointer */
@@ -657,12 +657,14 @@ static void dbri_cmdwait(struct snd_dbri *dbri) · 346 unmodified lines
657 */657 */
658static s32 *dbri_cmdlock(struct snd_dbri *dbri, int len)658static s32 *dbri_cmdlock(struct snd_dbri *dbri, int len)
659{659{
660 u32 dvma_addr = (u32)dbri->dma_dvma;
661
660 /* Space for 2 WAIT cmds (replaced later by 1 JUMP cmd) */662 /* Space for 2 WAIT cmds (replaced later by 1 JUMP cmd) */
661 len += 2;663 len += 2;
662 spin_lock(&dbri->cmdlock);664 spin_lock(&dbri->cmdlock);
663 if (dbri->cmdptr - dbri->dma->cmd + len < DBRI_NO_CMDS - 2)665 if (dbri->cmdptr - dbri->dma->cmd + len < DBRI_NO_CMDS - 2)
664 return dbri->cmdptr + 2;666 return dbri->cmdptr + 2;
665 else if (len < sbus_readl(dbri->regs + REG8) - dbri->dma_dvma)667 else if (len < sbus_readl(dbri->regs + REG8) - dvma_addr)
666 return dbri->dma->cmd;668 return dbri->dma->cmd;
667 else669 else
668 printk(KERN_ERR "DBRI: no space for commands.");670 printk(KERN_ERR "DBRI: no space for commands.");
@@ -680,6 +682,7 @@ static s32 *dbri_cmdlock(struct snd_dbri *dbri, int len) · 11 unmodified lines
680 */682 */
681static void dbri_cmdsend(struct snd_dbri *dbri, s32 *cmd, int len)683static void dbri_cmdsend(struct snd_dbri *dbri, s32 *cmd, int len)
682{684{
685 u32 dvma_addr = (u32)dbri->dma_dvma;
683 s32 tmp, addr;686 s32 tmp, addr;
684 static int wait_id = 0;687 static int wait_id = 0;
685 688
@@ -689,7 +692,7 @@ static void dbri_cmdsend(struct snd_dbri *dbri, s32 *cmd, int len) · 3 unmodified lines
689 *(cmd+1) = DBRI_CMD(D_WAIT, 1, wait_id);692 *(cmd+1) = DBRI_CMD(D_WAIT, 1, wait_id);
690 693
691 /* Replace the last command with JUMP */694 /* Replace the last command with JUMP */
692 addr = dbri->dma_dvma + (cmd - len - dbri->dma->cmd) * sizeof(s32);695 addr = dvma_addr + (cmd - len - dbri->dma->cmd) * sizeof(s32);
693 *(dbri->cmdptr+1) = addr;696 *(dbri->cmdptr+1) = addr;
694 *(dbri->cmdptr) = DBRI_CMD(D_JUMP, 0, 0);697 *(dbri->cmdptr) = DBRI_CMD(D_JUMP, 0, 0);
695 698
@@ -747,6 +750,7 @@ static void dbri_reset(struct snd_dbri *dbri) · 51 unmodified lines
747/* Lock must not be held before calling this */750/* Lock must not be held before calling this */
748static void dbri_initialize(struct snd_dbri *dbri)751static void dbri_initialize(struct snd_dbri *dbri)
749{752{
753 u32 dvma_addr = (u32)dbri->dma_dvma;
750 s32 *cmd;754 s32 *cmd;
751 u32 dma_addr;755 u32 dma_addr;
752 unsigned long flags;756 unsigned long flags;
@@ -764,7 +768,7 @@ static void dbri_initialize(struct snd_dbri *dbri) · 11 unmodified lines
764 /*768 /*
765 * Initialize the interrupt ring buffer.769 * Initialize the interrupt ring buffer.
766 */770 */
767 dma_addr = dbri->dma_dvma + dbri_dma_off(intr, 0);771 dma_addr = dvma_addr + dbri_dma_off(intr, 0);
768 dbri->dma->intr[0] = dma_addr;772 dbri->dma->intr[0] = dma_addr;
769 dbri->dbri_irqp = 1;773 dbri->dbri_irqp = 1;
770 /*774 /*
@@ -778,7 +782,7 @@ static void dbri_initialize(struct snd_dbri *dbri) · 7 unmodified lines
778 dbri->cmdptr = cmd;782 dbri->cmdptr = cmd;
779 *(cmd++) = DBRI_CMD(D_WAIT, 1, 0);783 *(cmd++) = DBRI_CMD(D_WAIT, 1, 0);
780 *(cmd++) = DBRI_CMD(D_WAIT, 1, 0);784 *(cmd++) = DBRI_CMD(D_WAIT, 1, 0);
781 dma_addr = dbri->dma_dvma + dbri_dma_off(cmd, 0);785 dma_addr = dvma_addr + dbri_dma_off(cmd, 0);
782 sbus_writel(dma_addr, dbri->regs + REG8);786 sbus_writel(dma_addr, dbri->regs + REG8);
783 spin_unlock(&dbri->cmdlock);787 spin_unlock(&dbri->cmdlock);
784 788
@@ -1077,6 +1081,7 @@ static void recv_fixed(struct snd_dbri *dbri, int pipe, volatile __u32 *ptr) · 292 unmodified lines
1077static int setup_descs(struct snd_dbri *dbri, int streamno, unsigned int period)1081static int setup_descs(struct snd_dbri *dbri, int streamno, unsigned int period)
1078{1082{
1079 struct dbri_streaminfo *info = &dbri->stream_info[streamno];1083 struct dbri_streaminfo *info = &dbri->stream_info[streamno];
1084 u32 dvma_addr = (u32)dbri->dma_dvma;
1080 __u32 dvma_buffer;1085 __u32 dvma_buffer;
1081 int desc;1086 int desc;
1082 int len;1087 int len;
@@ -1177,7 +1182,7 @@ static int setup_descs(struct snd_dbri *dbri, int streamno, unsigned int period) · 94 unmodified lines
1177 else {1182 else {
1178 dbri->next_desc[last_desc] = desc;1183 dbri->next_desc[last_desc] = desc;
1179 dbri->dma->desc[last_desc].nda =1184 dbri->dma->desc[last_desc].nda =
1180 dbri->dma_dvma + dbri_dma_off(desc, desc);1185 dvma_addr + dbri_dma_off(desc, desc);
1181 }1186 }
1182 1187
1183 last_desc = desc;1188 last_desc = desc;
@@ -1192,7 +1197,7 @@ static int setup_descs(struct snd_dbri *dbri, int streamno, unsigned int period) · 8 unmodified lines
1192 }1197 }
1193 1198
1194 dbri->dma->desc[last_desc].nda =1199 dbri->dma->desc[last_desc].nda =
1195 dbri->dma_dvma + dbri_dma_off(desc, first_desc);1200 dvma_addr + dbri_dma_off(desc, first_desc);
1196 dbri->next_desc[last_desc] = first_desc;1201 dbri->next_desc[last_desc] = first_desc;
1197 dbri->pipes[info->pipe].first_desc = first_desc;1202 dbri->pipes[info->pipe].first_desc = first_desc;
1198 dbri->pipes[info->pipe].desc = first_desc;1203 dbri->pipes[info->pipe].desc = first_desc;
@@ -1697,6 +1702,7 @@ interrupts are disabled. · 498 unmodified lines
1697static void xmit_descs(struct snd_dbri *dbri)1702static void xmit_descs(struct snd_dbri *dbri)
1698{1703{
1699 struct dbri_streaminfo *info;1704 struct dbri_streaminfo *info;
1705 u32 dvma_addr = (u32)dbri->dma_dvma;
1700 s32 *cmd;1706 s32 *cmd;
1701 unsigned long flags;1707 unsigned long flags;
1702 int first_td;1708 int first_td;
@@ -1718,7 +1724,7 @@ static void xmit_descs(struct snd_dbri *dbri) · 15 unmodified lines
1718 *(cmd++) = DBRI_CMD(D_SDP, 0,1724 *(cmd++) = DBRI_CMD(D_SDP, 0,
1719 dbri->pipes[info->pipe].sdp1725 dbri->pipes[info->pipe].sdp
1720 | D_SDP_P | D_SDP_EVERY | D_SDP_C);1726 | D_SDP_P | D_SDP_EVERY | D_SDP_C);
1721 *(cmd++) = dbri->dma_dvma +1727 *(cmd++) = dvma_addr +
1722 dbri_dma_off(desc, first_td);1728 dbri_dma_off(desc, first_td);
1723 dbri_cmdsend(dbri, cmd, 2);1729 dbri_cmdsend(dbri, cmd, 2);
1724 1730
@@ -1740,7 +1746,7 @@ static void xmit_descs(struct snd_dbri *dbri) · 15 unmodified lines
1740 *(cmd++) = DBRI_CMD(D_SDP, 0,1746 *(cmd++) = DBRI_CMD(D_SDP, 0,
1741 dbri->pipes[info->pipe].sdp1747 dbri->pipes[info->pipe].sdp
1742 | D_SDP_P | D_SDP_EVERY | D_SDP_C);1748 | D_SDP_P | D_SDP_EVERY | D_SDP_C);
1743 *(cmd++) = dbri->dma_dvma +1749 *(cmd++) = dvma_addr +
1744 dbri_dma_off(desc, first_td);1750 dbri_dma_off(desc, first_td);
1745 dbri_cmdsend(dbri, cmd, 2);1751 dbri_cmdsend(dbri, cmd, 2);
1746 1752
@@ -2539,7 +2545,7 @@ static int snd_dbri_create(struct snd_card *card, · 792 unmodified lines
2539 if (!dbri->dma)2545 if (!dbri->dma)
2540 return -ENOMEM;2546 return -ENOMEM;
2541 2547
2542 dprintk(D_GEN, "DMA Cmd Block 0x%p (0x%08x)\n",2548 dprintk(D_GEN, "DMA Cmd Block 0x%p (%pad)\n",
2543 dbri->dma, dbri->dma_dvma);2549 dbri->dma, dbri->dma_dvma);
2544 2550
2545 /* Map the registers into memory. */2551 /* Map the registers into memory. */
virt/kvm/arm/vgic/vgic-v2.c+4−2
@@ -50,8 +50,10 @@ void vgic_v2_process_maintenance(struct kvm_vcpu *vcpu) · 49 unmodified lines
50 50
51 WARN_ON(cpuif->vgic_lr[lr] & GICH_LR_STATE);51 WARN_ON(cpuif->vgic_lr[lr] & GICH_LR_STATE);
52 52
53 kvm_notify_acked_irq(vcpu->kvm, 0,53 /* Only SPIs require notification */
54 intid - VGIC_NR_PRIVATE_IRQS);54 if (vgic_valid_spi(vcpu->kvm, intid))
55 kvm_notify_acked_irq(vcpu->kvm, 0,
56 intid - VGIC_NR_PRIVATE_IRQS);
55 }57 }
56 }58 }
57 59
virt/kvm/arm/vgic/vgic-v3.c+4−2
@@ -41,8 +41,10 @@ void vgic_v3_process_maintenance(struct kvm_vcpu *vcpu) · 40 unmodified lines
41 41
42 WARN_ON(cpuif->vgic_lr[lr] & ICH_LR_STATE);42 WARN_ON(cpuif->vgic_lr[lr] & ICH_LR_STATE);
43 43
44 kvm_notify_acked_irq(vcpu->kvm, 0,44 /* Only SPIs require notification */
45 intid - VGIC_NR_PRIVATE_IRQS);45 if (vgic_valid_spi(vcpu->kvm, intid))
46 kvm_notify_acked_irq(vcpu->kvm, 0,
47 intid - VGIC_NR_PRIVATE_IRQS);
46 }48 }
47 49
48 /*50 /*
virt/kvm/kvm_main.c+1−1
@@ -2889,10 +2889,10 @@ static int kvm_ioctl_create_device(struct kvm *kvm, · 2888 unmodified lines
2889 2889
2890 ret = anon_inode_getfd(ops->name, &kvm_device_fops, dev, O_RDWR | O_CLOEXEC);2890 ret = anon_inode_getfd(ops->name, &kvm_device_fops, dev, O_RDWR | O_CLOEXEC);
2891 if (ret < 0) {2891 if (ret < 0) {
2892 ops->destroy(dev);
2893 mutex_lock(&kvm->lock);2892 mutex_lock(&kvm->lock);
2894 list_del(&dev->vm_node);2893 list_del(&dev->vm_node);
2895 mutex_unlock(&kvm->lock);2894 mutex_unlock(&kvm->lock);
2895 ops->destroy(dev);
2896 return ret;2896 return ret;
2897 }2897 }
2898 2898

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t