diff options
191 files changed, 1411 insertions, 609 deletions
@@ -9,7 +9,7 @@ | |||
9 | Linus | 9 | Linus |
10 | ---------- | 10 | ---------- |
11 | 11 | ||
12 | M: Matt Mackal | 12 | N: Matt Mackal |
13 | E: mpm@selenic.com | 13 | E: mpm@selenic.com |
14 | D: SLOB slab allocator | 14 | D: SLOB slab allocator |
15 | 15 | ||
@@ -1910,7 +1910,7 @@ S: Ra'annana, Israel | |||
1910 | 1910 | ||
1911 | N: Andi Kleen | 1911 | N: Andi Kleen |
1912 | E: andi@firstfloor.org | 1912 | E: andi@firstfloor.org |
1913 | U: http://www.halobates.de | 1913 | W: http://www.halobates.de |
1914 | D: network, x86, NUMA, various hacks | 1914 | D: network, x86, NUMA, various hacks |
1915 | S: Schwalbenstr. 96 | 1915 | S: Schwalbenstr. 96 |
1916 | S: 85551 Ottobrunn | 1916 | S: 85551 Ottobrunn |
@@ -2089,8 +2089,8 @@ D: ST Microelectronics SPEAr13xx PCI host bridge driver | |||
2089 | D: Synopsys Designware PCI host bridge driver | 2089 | D: Synopsys Designware PCI host bridge driver |
2090 | 2090 | ||
2091 | N: Gabor Kuti | 2091 | N: Gabor Kuti |
2092 | M: seasons@falcon.sch.bme.hu | 2092 | E: seasons@falcon.sch.bme.hu |
2093 | M: seasons@makosteszta.sote.hu | 2093 | E: seasons@makosteszta.sote.hu |
2094 | D: Original author of software suspend | 2094 | D: Original author of software suspend |
2095 | 2095 | ||
2096 | N: Jaroslav Kysela | 2096 | N: Jaroslav Kysela |
diff --git a/Documentation/devicetree/bindings/net/ethernet.txt b/Documentation/devicetree/bindings/net/ethernet.txt index e1d76812419c..05150957ecfd 100644 --- a/Documentation/devicetree/bindings/net/ethernet.txt +++ b/Documentation/devicetree/bindings/net/ethernet.txt | |||
@@ -9,10 +9,26 @@ The following properties are common to the Ethernet controllers: | |||
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 than | 10 | - 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 are | 12 | - 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 a | 14 | * "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 PHY | 33 | - 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; |
diff --git a/Documentation/networking/nf_conntrack-sysctl.txt b/Documentation/networking/nf_conntrack-sysctl.txt index 399e4e866a9c..433b6724797a 100644 --- a/Documentation/networking/nf_conntrack-sysctl.txt +++ b/Documentation/networking/nf_conntrack-sysctl.txt | |||
@@ -62,10 +62,13 @@ nf_conntrack_generic_timeout - INTEGER (seconds) | |||
62 | protocols. | 62 | protocols. |
63 | 63 | ||
64 | nf_conntrack_helper - BOOLEAN | 64 | nf_conntrack_helper - BOOLEAN |
65 | 0 - disabled | 65 | 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 | ||
70 | nf_conntrack_icmp_timeout - INTEGER (seconds) | 73 | nf_conntrack_icmp_timeout - INTEGER (seconds) |
71 | default 30 | 74 | default 30 |
diff --git a/MAINTAINERS b/MAINTAINERS index 3348d0ed0a31..e773ad5446e3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -9260,11 +9260,12 @@ S: Maintained | |||
9260 | F: drivers/pci/host/*layerscape* | 9260 | F: drivers/pci/host/*layerscape* |
9261 | 9261 | ||
9262 | PCI DRIVER FOR IMX6 | 9262 | PCI DRIVER FOR IMX6 |
9263 | M: Richard Zhu <Richard.Zhu@freescale.com> | 9263 | M: Richard Zhu <hongxing.zhu@nxp.com> |
9264 | M: Lucas Stach <l.stach@pengutronix.de> | 9264 | M: Lucas Stach <l.stach@pengutronix.de> |
9265 | L: linux-pci@vger.kernel.org | 9265 | L: linux-pci@vger.kernel.org |
9266 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 9266 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
9267 | S: Maintained | 9267 | S: Maintained |
9268 | F: Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt | ||
9268 | F: drivers/pci/host/*imx6* | 9269 | F: drivers/pci/host/*imx6* |
9269 | 9270 | ||
9270 | PCI DRIVER FOR TI KEYSTONE | 9271 | PCI DRIVER FOR TI KEYSTONE |
@@ -9323,17 +9324,11 @@ F: drivers/pci/host/pci-exynos.c | |||
9323 | 9324 | ||
9324 | PCI DRIVER FOR SYNOPSIS DESIGNWARE | 9325 | PCI DRIVER FOR SYNOPSIS DESIGNWARE |
9325 | M: Jingoo Han <jingoohan1@gmail.com> | 9326 | M: Jingoo Han <jingoohan1@gmail.com> |
9326 | M: Pratyush Anand <pratyush.anand@gmail.com> | 9327 | M: Joao Pinto <Joao.Pinto@synopsys.com> |
9327 | L: linux-pci@vger.kernel.org | ||
9328 | S: Maintained | ||
9329 | F: drivers/pci/host/*designware* | ||
9330 | |||
9331 | PCI DRIVER FOR SYNOPSYS PROTOTYPING DEVICE | ||
9332 | M: Jose Abreu <Jose.Abreu@synopsys.com> | ||
9333 | L: linux-pci@vger.kernel.org | 9328 | L: linux-pci@vger.kernel.org |
9334 | S: Maintained | 9329 | S: Maintained |
9335 | F: Documentation/devicetree/bindings/pci/designware-pcie.txt | 9330 | F: Documentation/devicetree/bindings/pci/designware-pcie.txt |
9336 | F: drivers/pci/host/pcie-designware-plat.c | 9331 | F: drivers/pci/host/*designware* |
9337 | 9332 | ||
9338 | PCI DRIVER FOR GENERIC OF HOSTS | 9333 | PCI DRIVER FOR GENERIC OF HOSTS |
9339 | M: Will Deacon <will.deacon@arm.com> | 9334 | M: Will Deacon <will.deacon@arm.com> |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 9 | 2 | PATCHLEVEL = 9 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc6 | 4 | EXTRAVERSION = -rc7 |
5 | NAME = Psychotic Stoned Sheep | 5 | NAME = Psychotic Stoned Sheep |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
@@ -1019,8 +1019,6 @@ prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic | |||
1019 | prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ | 1019 | prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ |
1020 | include/config/auto.conf | 1020 | include/config/auto.conf |
1021 | $(cmd_crmodverdir) | 1021 | $(cmd_crmodverdir) |
1022 | $(Q)test -e include/generated/autoksyms.h || \ | ||
1023 | touch include/generated/autoksyms.h | ||
1024 | 1022 | ||
1025 | archprepare: archheaders archscripts prepare1 scripts_basic | 1023 | archprepare: archheaders archscripts prepare1 scripts_basic |
1026 | 1024 | ||
diff --git a/arch/arc/include/asm/delay.h b/arch/arc/include/asm/delay.h index 08e7e2a16ac1..a36e8601114d 100644 --- a/arch/arc/include/asm/delay.h +++ b/arch/arc/include/asm/delay.h | |||
@@ -22,10 +22,11 @@ | |||
22 | static inline void __delay(unsigned long loops) | 22 | static 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 | ||
31 | extern void __bad_udelay(void); | 32 | extern void __bad_udelay(void); |
diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h index 89eeb3720051..e94ca72b974e 100644 --- a/arch/arc/include/asm/pgtable.h +++ b/arch/arc/include/asm/pgtable.h | |||
@@ -280,7 +280,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep) | |||
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) |
diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c index 2b96cfc3be75..50d71695cd4e 100644 --- a/arch/arc/mm/cache.c +++ b/arch/arc/mm/cache.c | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | static int l2_line_sz; | 24 | static int l2_line_sz; |
25 | static int ioc_exists; | 25 | static int ioc_exists; |
26 | int slc_enable = 1, ioc_enable = 1; | 26 | int slc_enable = 1, ioc_enable = 0; |
27 | unsigned long perip_base = ARC_UNCACHED_ADDR_SPACE; /* legacy value for boot */ | 27 | unsigned long perip_base = ARC_UNCACHED_ADDR_SPACE; /* legacy value for boot */ |
28 | unsigned long perip_end = 0xFFFFFFFF; /* legacy value */ | 28 | unsigned long perip_end = 0xFFFFFFFF; /* legacy value */ |
29 | 29 | ||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index befcd2619902..c558ba75cbcc 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -745,7 +745,6 @@ dtb-$(CONFIG_MACH_SUN4I) += \ | |||
745 | sun4i-a10-pcduino2.dtb \ | 745 | sun4i-a10-pcduino2.dtb \ |
746 | sun4i-a10-pov-protab2-ips9.dtb | 746 | sun4i-a10-pov-protab2-ips9.dtb |
747 | dtb-$(CONFIG_MACH_SUN5I) += \ | 747 | dtb-$(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) += \ | |||
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.dtb | 764 | sun5i-r8-chip.dtb |
765 | dtb-$(CONFIG_MACH_SUN6I) += \ | 765 | dtb-$(CONFIG_MACH_SUN6I) += \ |
766 | sun6i-a31-app4-evb1.dtb \ | 766 | sun6i-a31-app4-evb1.dtb \ |
diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi index 91096a49efa9..8f79b4147bba 100644 --- a/arch/arm/boot/dts/stih407-family.dtsi +++ b/arch/arm/boot/dts/stih407-family.dtsi | |||
@@ -283,6 +283,8 @@ | |||
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 @@ | |||
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 @@ | |||
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 @@ | |||
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 @@ | |||
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 @@ | |||
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 @@ | |||
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 @@ | |||
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 | }; |
diff --git a/arch/arm/boot/dts/ntc-gr8-evb.dts b/arch/arm/boot/dts/sun5i-gr8-evb.dts index 4b622f3b5220..714381fd64d7 100644 --- a/arch/arm/boot/dts/ntc-gr8-evb.dts +++ b/arch/arm/boot/dts/sun5i-gr8-evb.dts | |||
@@ -44,7 +44,7 @@ | |||
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> |
diff --git a/arch/arm/boot/dts/ntc-gr8.dtsi b/arch/arm/boot/dts/sun5i-gr8.dtsi index ca54e03ef366..ca54e03ef366 100644 --- a/arch/arm/boot/dts/ntc-gr8.dtsi +++ b/arch/arm/boot/dts/sun5i-gr8.dtsi | |||
diff --git a/arch/arm64/boot/dts/arm/juno-base.dtsi b/arch/arm64/boot/dts/arm/juno-base.dtsi index 334271a25f70..7d3a2acc6a55 100644 --- a/arch/arm64/boot/dts/arm/juno-base.dtsi +++ b/arch/arm64/boot/dts/arm/juno-base.dtsi | |||
@@ -393,7 +393,7 @@ | |||
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>; |
diff --git a/arch/arm64/boot/dts/arm/juno-r1.dts b/arch/arm64/boot/dts/arm/juno-r1.dts index 123a58b29cbd..f0b857d6d73c 100644 --- a/arch/arm64/boot/dts/arm/juno-r1.dts +++ b/arch/arm64/boot/dts/arm/juno-r1.dts | |||
@@ -76,7 +76,7 @@ | |||
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 | }; |
diff --git a/arch/arm64/boot/dts/arm/juno-r2.dts b/arch/arm64/boot/dts/arm/juno-r2.dts index 007be826efce..26aaa6a7670f 100644 --- a/arch/arm64/boot/dts/arm/juno-r2.dts +++ b/arch/arm64/boot/dts/arm/juno-r2.dts | |||
@@ -76,7 +76,7 @@ | |||
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 | }; |
diff --git a/arch/arm64/boot/dts/arm/juno.dts b/arch/arm64/boot/dts/arm/juno.dts index a7270eff6939..6e154d948a80 100644 --- a/arch/arm64/boot/dts/arm/juno.dts +++ b/arch/arm64/boot/dts/arm/juno.dts | |||
@@ -76,7 +76,7 @@ | |||
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 | }; |
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index 7dd2dd47909a..df78b2ca70eb 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h | |||
@@ -215,6 +215,12 @@ | |||
215 | #endif | 215 | #endif |
216 | 216 | ||
217 | /* | 217 | /* |
218 | * Wired register bits | ||
219 | */ | ||
220 | #define MIPSR6_WIRED_LIMIT (_ULCAST_(0xffff) << 16) | ||
221 | #define MIPSR6_WIRED_WIRED (_ULCAST_(0xffff) << 0) | ||
222 | |||
223 | /* | ||
218 | * Values used for computation of new tlb entries | 224 | * Values used for computation of new tlb entries |
219 | */ | 225 | */ |
220 | #define PL_4K 12 | 226 | #define PL_4K 12 |
diff --git a/arch/mips/include/asm/tlb.h b/arch/mips/include/asm/tlb.h index 4a2349302b55..dd179fd8acda 100644 --- a/arch/mips/include/asm/tlb.h +++ b/arch/mips/include/asm/tlb.h | |||
@@ -1,6 +1,9 @@ | |||
1 | #ifndef __ASM_TLB_H | 1 | #ifndef __ASM_TLB_H |
2 | #define __ASM_TLB_H | 2 | #define __ASM_TLB_H |
3 | 3 | ||
4 | #include <asm/cpu-features.h> | ||
5 | #include <asm/mipsregs.h> | ||
6 | |||
4 | /* | 7 | /* |
5 | * MIPS doesn't need any special per-pte or per-vma handling, except | 8 | * MIPS doesn't need any special per-pte or per-vma handling, except |
6 | * we need to flush cache for area to be unmapped. | 9 | * we need to flush cache for area to be unmapped. |
@@ -22,6 +25,16 @@ | |||
22 | ((CKSEG0 + ((idx) << (PAGE_SHIFT + 1))) | \ | 25 | ((CKSEG0 + ((idx) << (PAGE_SHIFT + 1))) | \ |
23 | (cpu_has_tlbinv ? MIPS_ENTRYHI_EHINV : 0)) | 26 | (cpu_has_tlbinv ? MIPS_ENTRYHI_EHINV : 0)) |
24 | 27 | ||
28 | static inline unsigned int num_wired_entries(void) | ||
29 | { | ||
30 | unsigned int wired = read_c0_wired(); | ||
31 | |||
32 | if (cpu_has_mips_r6) | ||
33 | wired &= MIPSR6_WIRED_WIRED; | ||
34 | |||
35 | return wired; | ||
36 | } | ||
37 | |||
25 | #include <asm-generic/tlb.h> | 38 | #include <asm-generic/tlb.h> |
26 | 39 | ||
27 | #endif /* __ASM_TLB_H */ | 40 | #endif /* __ASM_TLB_H */ |
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c index d56a855828c2..3bef306cdfdb 100644 --- a/arch/mips/mm/fault.c +++ b/arch/mips/mm/fault.c | |||
@@ -209,17 +209,18 @@ bad_area_nosemaphore: | |||
209 | if (show_unhandled_signals && | 209 | if (show_unhandled_signals && |
210 | unhandled_signal(tsk, SIGSEGV) && | 210 | unhandled_signal(tsk, SIGSEGV) && |
211 | __ratelimit(&ratelimit_state)) { | 211 | __ratelimit(&ratelimit_state)) { |
212 | pr_info("\ndo_page_fault(): sending SIGSEGV to %s for invalid %s %0*lx", | 212 | pr_info("do_page_fault(): sending SIGSEGV to %s for invalid %s %0*lx\n", |
213 | tsk->comm, | 213 | tsk->comm, |
214 | write ? "write access to" : "read access from", | 214 | write ? "write access to" : "read access from", |
215 | field, address); | 215 | field, address); |
216 | pr_info("epc = %0*lx in", field, | 216 | pr_info("epc = %0*lx in", field, |
217 | (unsigned long) regs->cp0_epc); | 217 | (unsigned long) regs->cp0_epc); |
218 | print_vma_addr(" ", regs->cp0_epc); | 218 | print_vma_addr(KERN_CONT " ", regs->cp0_epc); |
219 | pr_cont("\n"); | ||
219 | pr_info("ra = %0*lx in", field, | 220 | pr_info("ra = %0*lx in", field, |
220 | (unsigned long) regs->regs[31]); | 221 | (unsigned long) regs->regs[31]); |
221 | print_vma_addr(" ", regs->regs[31]); | 222 | print_vma_addr(KERN_CONT " ", regs->regs[31]); |
222 | pr_info("\n"); | 223 | pr_cont("\n"); |
223 | } | 224 | } |
224 | current->thread.trap_nr = (regs->cp0_cause >> 2) & 0x1f; | 225 | current->thread.trap_nr = (regs->cp0_cause >> 2) & 0x1f; |
225 | info.si_signo = SIGSEGV; | 226 | info.si_signo = SIGSEGV; |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 3a6edecc3f38..e86ebcf5c071 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -118,7 +118,7 @@ static void *__kmap_pgprot(struct page *page, unsigned long addr, pgprot_t prot) | |||
118 | writex_c0_entrylo1(entrylo); | 118 | writex_c0_entrylo1(entrylo); |
119 | } | 119 | } |
120 | #endif | 120 | #endif |
121 | tlbidx = read_c0_wired(); | 121 | tlbidx = num_wired_entries(); |
122 | write_c0_wired(tlbidx + 1); | 122 | write_c0_wired(tlbidx + 1); |
123 | write_c0_index(tlbidx); | 123 | write_c0_index(tlbidx); |
124 | mtc0_tlbw_hazard(); | 124 | mtc0_tlbw_hazard(); |
@@ -147,7 +147,7 @@ void kunmap_coherent(void) | |||
147 | 147 | ||
148 | local_irq_save(flags); | 148 | local_irq_save(flags); |
149 | old_ctx = read_c0_entryhi(); | 149 | old_ctx = read_c0_entryhi(); |
150 | wired = read_c0_wired() - 1; | 150 | wired = num_wired_entries() - 1; |
151 | write_c0_wired(wired); | 151 | write_c0_wired(wired); |
152 | write_c0_index(wired); | 152 | write_c0_index(wired); |
153 | write_c0_entryhi(UNIQUE_ENTRYHI(wired)); | 153 | write_c0_entryhi(UNIQUE_ENTRYHI(wired)); |
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c index bba9c1484b41..0596505770db 100644 --- a/arch/mips/mm/tlb-r4k.c +++ b/arch/mips/mm/tlb-r4k.c | |||
@@ -65,7 +65,7 @@ void local_flush_tlb_all(void) | |||
65 | write_c0_entrylo0(0); | 65 | write_c0_entrylo0(0); |
66 | write_c0_entrylo1(0); | 66 | write_c0_entrylo1(0); |
67 | 67 | ||
68 | entry = read_c0_wired(); | 68 | entry = num_wired_entries(); |
69 | 69 | ||
70 | /* | 70 | /* |
71 | * Blast 'em all away. | 71 | * Blast 'em all away. |
@@ -385,7 +385,7 @@ void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1, | |||
385 | old_ctx = read_c0_entryhi(); | 385 | old_ctx = read_c0_entryhi(); |
386 | htw_stop(); | 386 | htw_stop(); |
387 | old_pagemask = read_c0_pagemask(); | 387 | old_pagemask = read_c0_pagemask(); |
388 | wired = read_c0_wired(); | 388 | wired = num_wired_entries(); |
389 | write_c0_wired(wired + 1); | 389 | write_c0_wired(wired + 1); |
390 | write_c0_index(wired); | 390 | write_c0_index(wired); |
391 | tlbw_use_hazard(); /* What is the hazard here? */ | 391 | tlbw_use_hazard(); /* What is the hazard here? */ |
@@ -449,7 +449,7 @@ __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, | |||
449 | htw_stop(); | 449 | htw_stop(); |
450 | old_ctx = read_c0_entryhi(); | 450 | old_ctx = read_c0_entryhi(); |
451 | old_pagemask = read_c0_pagemask(); | 451 | old_pagemask = read_c0_pagemask(); |
452 | wired = read_c0_wired(); | 452 | wired = num_wired_entries(); |
453 | if (--temp_tlb_entry < wired) { | 453 | if (--temp_tlb_entry < wired) { |
454 | printk(KERN_WARNING | 454 | printk(KERN_WARNING |
455 | "No TLB space left for add_temporary_entry\n"); | 455 | "No TLB space left for add_temporary_entry\n"); |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 9669fc7c19df..74f4c662f776 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1436,13 +1436,6 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports, | |||
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 | /* |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 9cceb4a875a5..c4eb4ae9c3aa 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -1088,7 +1088,7 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc) | |||
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) |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 04365b17ee67..5163c8f918cb 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -1403,7 +1403,8 @@ static ssize_t hot_remove_store(struct class *class, | |||
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 | } |
diff --git a/drivers/clk/bcm/Kconfig b/drivers/clk/bcm/Kconfig index f21e9b7afd1a..e3eed5a78404 100644 --- a/drivers/clk/bcm/Kconfig +++ b/drivers/clk/bcm/Kconfig | |||
@@ -20,7 +20,7 @@ config CLK_BCM_KONA | |||
20 | 20 | ||
21 | config COMMON_CLK_IPROC | 21 | config COMMON_CLK_IPROC |
22 | bool "Broadcom iProc clock support" | 22 | bool "Broadcom iProc clock support" |
23 | depends on ARCH_BCM_IPROC || COMPILE_TEST | 23 | depends on ARCH_BCM_IPROC || ARCH_BCM_63XX || COMPILE_TEST |
24 | depends on COMMON_CLK | 24 | depends on COMMON_CLK |
25 | default ARCH_BCM_IPROC | 25 | default ARCH_BCM_IPROC |
26 | help | 26 | help |
diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c index 4a82a49cff5e..fc75a335a7ce 100644 --- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c +++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c | |||
@@ -143,7 +143,7 @@ static SUNXI_CCU_NKM_WITH_MUX_GATE_LOCK(pll_mipi_clk, "pll-mipi", | |||
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 | ||
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c index 96b40ca57697..9bd1f78a0547 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c | |||
@@ -131,7 +131,7 @@ static SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_mipi_clk, "pll-mipi", | |||
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 | ||
diff --git a/drivers/i2c/busses/i2c-octeon-core.c b/drivers/i2c/busses/i2c-octeon-core.c index 419b54bfc7c7..5e63b17f935d 100644 --- a/drivers/i2c/busses/i2c-octeon-core.c +++ b/drivers/i2c/busses/i2c-octeon-core.c | |||
@@ -381,9 +381,7 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target, | |||
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; |
diff --git a/drivers/i2c/busses/i2c-octeon-core.h b/drivers/i2c/busses/i2c-octeon-core.h index 1db7c835a454..87151ea74acd 100644 --- a/drivers/i2c/busses/i2c-octeon-core.h +++ b/drivers/i2c/busses/i2c-octeon-core.h | |||
@@ -5,7 +5,6 @@ | |||
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 | |||
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 | |||
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 | */ |
167 | static inline int octeon_i2c_reg_read(struct octeon_i2c *i2c, u64 eop_reg, | 166 | static 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 register | 186 | * octeon_i2c_read_int - read the TWSI_INT register |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index fb4b185dea96..bee267424972 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -1115,10 +1115,6 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
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 | /* |
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index 58470f5ced04..8c53748a769d 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c | |||
@@ -338,7 +338,9 @@ static int dmar_pci_bus_notifier(struct notifier_block *nb, | |||
338 | struct pci_dev *pdev = to_pci_dev(data); | 338 | struct pci_dev *pdev = to_pci_dev(data); |
339 | struct dmar_pci_notify_info *info; | 339 | struct dmar_pci_notify_info *info; |
340 | 340 | ||
341 | /* Only care about add/remove events for physical functions */ | 341 | /* Only care about add/remove events for physical functions. |
342 | * For VFs we actually do the lookup based on the corresponding | ||
343 | * PF in device_to_iommu() anyway. */ | ||
342 | if (pdev->is_virtfn) | 344 | if (pdev->is_virtfn) |
343 | return NOTIFY_DONE; | 345 | return NOTIFY_DONE; |
344 | if (action != BUS_NOTIFY_ADD_DEVICE && | 346 | if (action != BUS_NOTIFY_ADD_DEVICE && |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 3965e73db51c..d8376c2d18b3 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -892,7 +892,13 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf | |||
892 | return NULL; | 892 | return NULL; |
893 | 893 | ||
894 | if (dev_is_pci(dev)) { | 894 | if (dev_is_pci(dev)) { |
895 | struct pci_dev *pf_pdev; | ||
896 | |||
895 | pdev = to_pci_dev(dev); | 897 | pdev = to_pci_dev(dev); |
898 | /* VFs aren't listed in scope tables; we need to look up | ||
899 | * the PF instead to find the IOMMU. */ | ||
900 | pf_pdev = pci_physfn(pdev); | ||
901 | dev = &pf_pdev->dev; | ||
896 | segment = pci_domain_nr(pdev->bus); | 902 | segment = pci_domain_nr(pdev->bus); |
897 | } else if (has_acpi_companion(dev)) | 903 | } else if (has_acpi_companion(dev)) |
898 | dev = &ACPI_COMPANION(dev)->dev; | 904 | dev = &ACPI_COMPANION(dev)->dev; |
@@ -905,6 +911,13 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf | |||
905 | for_each_active_dev_scope(drhd->devices, | 911 | for_each_active_dev_scope(drhd->devices, |
906 | drhd->devices_cnt, i, tmp) { | 912 | drhd->devices_cnt, i, tmp) { |
907 | if (tmp == dev) { | 913 | if (tmp == dev) { |
914 | /* For a VF use its original BDF# not that of the PF | ||
915 | * which we used for the IOMMU lookup. Strictly speaking | ||
916 | * we could do this for all PCI devices; we only need to | ||
917 | * get the BDF# from the scope table for ACPI matches. */ | ||
918 | if (pdev->is_virtfn) | ||
919 | goto got_pdev; | ||
920 | |||
908 | *bus = drhd->devices[i].bus; | 921 | *bus = drhd->devices[i].bus; |
909 | *devfn = drhd->devices[i].devfn; | 922 | *devfn = drhd->devices[i].devfn; |
910 | goto out; | 923 | goto out; |
diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index 8ebb3530afa7..cb72e0011310 100644 --- a/drivers/iommu/intel-svm.c +++ b/drivers/iommu/intel-svm.c | |||
@@ -39,10 +39,18 @@ int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu) | |||
39 | struct page *pages; | 39 | struct page *pages; |
40 | int order; | 40 | int order; |
41 | 41 | ||
42 | order = ecap_pss(iommu->ecap) + 7 - PAGE_SHIFT; | 42 | /* Start at 2 because it's defined as 2^(1+PSS) */ |
43 | if (order < 0) | 43 | iommu->pasid_max = 2 << ecap_pss(iommu->ecap); |
44 | order = 0; | 44 | |
45 | 45 | /* Eventually I'm promised we will get a multi-level PASID table | |
46 | * and it won't have to be physically contiguous. Until then, | ||
47 | * limit the size because 8MiB contiguous allocations can be hard | ||
48 | * to come by. The limit of 0x20000, which is 1MiB for each of | ||
49 | * the PASID and PASID-state tables, is somewhat arbitrary. */ | ||
50 | if (iommu->pasid_max > 0x20000) | ||
51 | iommu->pasid_max = 0x20000; | ||
52 | |||
53 | order = get_order(sizeof(struct pasid_entry) * iommu->pasid_max); | ||
46 | pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, order); | 54 | pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, order); |
47 | if (!pages) { | 55 | if (!pages) { |
48 | pr_warn("IOMMU: %s: Failed to allocate PASID table\n", | 56 | pr_warn("IOMMU: %s: Failed to allocate PASID table\n", |
@@ -53,6 +61,8 @@ int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu) | |||
53 | pr_info("%s: Allocated order %d PASID table.\n", iommu->name, order); | 61 | pr_info("%s: Allocated order %d PASID table.\n", iommu->name, order); |
54 | 62 | ||
55 | if (ecap_dis(iommu->ecap)) { | 63 | if (ecap_dis(iommu->ecap)) { |
64 | /* Just making it explicit... */ | ||
65 | BUILD_BUG_ON(sizeof(struct pasid_entry) != sizeof(struct pasid_state_entry)); | ||
56 | pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, order); | 66 | pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, order); |
57 | if (pages) | 67 | if (pages) |
58 | iommu->pasid_state_table = page_address(pages); | 68 | iommu->pasid_state_table = page_address(pages); |
@@ -68,11 +78,7 @@ int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu) | |||
68 | 78 | ||
69 | int intel_svm_free_pasid_tables(struct intel_iommu *iommu) | 79 | int intel_svm_free_pasid_tables(struct intel_iommu *iommu) |
70 | { | 80 | { |
71 | int order; | 81 | int order = get_order(sizeof(struct pasid_entry) * iommu->pasid_max); |
72 | |||
73 | order = ecap_pss(iommu->ecap) + 7 - PAGE_SHIFT; | ||
74 | if (order < 0) | ||
75 | order = 0; | ||
76 | 82 | ||
77 | if (iommu->pasid_table) { | 83 | if (iommu->pasid_table) { |
78 | free_pages((unsigned long)iommu->pasid_table, order); | 84 | free_pages((unsigned long)iommu->pasid_table, order); |
@@ -371,8 +377,8 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_ | |||
371 | } | 377 | } |
372 | svm->iommu = iommu; | 378 | svm->iommu = iommu; |
373 | 379 | ||
374 | if (pasid_max > 2 << ecap_pss(iommu->ecap)) | 380 | if (pasid_max > iommu->pasid_max) |
375 | pasid_max = 2 << ecap_pss(iommu->ecap); | 381 | pasid_max = iommu->pasid_max; |
376 | 382 | ||
377 | /* Do not use PASID 0 in caching mode (virtualised IOMMU) */ | 383 | /* Do not use PASID 0 in caching mode (virtualised IOMMU) */ |
378 | ret = idr_alloc(&iommu->pasid_idr, svm, | 384 | ret = idr_alloc(&iommu->pasid_idr, svm, |
diff --git a/drivers/net/can/usb/peak_usb/pcan_ucan.h b/drivers/net/can/usb/peak_usb/pcan_ucan.h index e8fc4952c6b0..2147678f0225 100644 --- a/drivers/net/can/usb/peak_usb/pcan_ucan.h +++ b/drivers/net/can/usb/peak_usb/pcan_ucan.h | |||
@@ -43,11 +43,22 @@ struct __packed pucan_command { | |||
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 | ||
52 | struct __packed pucan_timing_slow { | 63 | struct __packed pucan_timing_slow { |
53 | __le16 opcode_channel; | 64 | __le16 opcode_channel; |
@@ -60,11 +71,21 @@ struct __packed pucan_timing_slow { | |||
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 | ||
69 | struct __packed pucan_timing_fast { | 90 | struct __packed pucan_timing_fast { |
70 | __le16 opcode_channel; | 91 | __le16 opcode_channel; |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c index c06382cdfdfe..f3141ca56bc3 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c | |||
@@ -39,6 +39,7 @@ static struct usb_device_id peak_usb_table[] = { | |||
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[] = { | |||
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 | /* |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.h b/drivers/net/can/usb/peak_usb/pcan_usb_core.h index 506fe506c9d3..3cbfb069893d 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.h +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define PCAN_USBPRO_PRODUCT_ID 0x000d | 27 | #define PCAN_USBPRO_PRODUCT_ID 0x000d |
28 | #define PCAN_USBPROFD_PRODUCT_ID 0x0011 | 28 | #define PCAN_USBPROFD_PRODUCT_ID 0x0011 |
29 | #define PCAN_USBFD_PRODUCT_ID 0x0012 | 29 | #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; | |||
90 | extern const struct peak_usb_adapter pcan_usb_pro; | 91 | extern const struct peak_usb_adapter pcan_usb_pro; |
91 | extern const struct peak_usb_adapter pcan_usb_fd; | 92 | extern const struct peak_usb_adapter pcan_usb_fd; |
92 | extern const struct peak_usb_adapter pcan_usb_pro_fd; | 93 | extern const struct peak_usb_adapter pcan_usb_pro_fd; |
94 | extern const struct peak_usb_adapter pcan_usb_x6; | ||
93 | 95 | ||
94 | struct peak_time_ref { | 96 | struct peak_time_ref { |
95 | struct timeval tv_host_0, tv_host; | 97 | struct timeval tv_host_0, tv_host; |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c index ce44a033f63b..304732550f0a 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c | |||
@@ -993,24 +993,24 @@ static void pcan_usb_fd_free(struct peak_usb_device *dev) | |||
993 | static const struct can_bittiming_const pcan_usb_fd_const = { | 993 | static 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 | ||
1005 | static const struct can_bittiming_const pcan_usb_fd_data_const = { | 1005 | static 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 = { | |||
1065 | static const struct can_bittiming_const pcan_usb_pro_fd_const = { | 1065 | static 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 | ||
1077 | static const struct can_bittiming_const pcan_usb_pro_fd_data_const = { | 1077 | static 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 = { | |||
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 */ | ||
1137 | static 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 | |||
1149 | static 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 | |||
1161 | const 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 | }; | ||
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c index d8bca949d810..25864bff25ee 100644 --- a/drivers/net/ethernet/altera/altera_tse_main.c +++ b/drivers/net/ethernet/altera/altera_tse_main.c | |||
@@ -422,12 +422,6 @@ static int tse_rx(struct altera_tse_private *priv, int limit) | |||
422 | 422 | ||
423 | skb_put(skb, pktlength); | 423 | skb_put(skb, pktlength); |
424 | 424 | ||
425 | /* make cache consistent with receive packet buffer */ | ||
426 | dma_sync_single_for_cpu(priv->device, | ||
427 | priv->rx_ring[entry].dma_addr, | ||
428 | priv->rx_ring[entry].len, | ||
429 | DMA_FROM_DEVICE); | ||
430 | |||
431 | dma_unmap_single(priv->device, priv->rx_ring[entry].dma_addr, | 425 | dma_unmap_single(priv->device, priv->rx_ring[entry].dma_addr, |
432 | priv->rx_ring[entry].len, DMA_FROM_DEVICE); | 426 | priv->rx_ring[entry].len, DMA_FROM_DEVICE); |
433 | 427 | ||
@@ -491,7 +485,6 @@ static int tse_tx_complete(struct altera_tse_private *priv) | |||
491 | 485 | ||
492 | if (unlikely(netif_queue_stopped(priv->dev) && | 486 | if (unlikely(netif_queue_stopped(priv->dev) && |
493 | tse_tx_avail(priv) > TSE_TX_THRESH(priv))) { | 487 | tse_tx_avail(priv) > TSE_TX_THRESH(priv))) { |
494 | netif_tx_lock(priv->dev); | ||
495 | if (netif_queue_stopped(priv->dev) && | 488 | if (netif_queue_stopped(priv->dev) && |
496 | tse_tx_avail(priv) > TSE_TX_THRESH(priv)) { | 489 | tse_tx_avail(priv) > TSE_TX_THRESH(priv)) { |
497 | if (netif_msg_tx_done(priv)) | 490 | if (netif_msg_tx_done(priv)) |
@@ -499,7 +492,6 @@ static int tse_tx_complete(struct altera_tse_private *priv) | |||
499 | __func__); | 492 | __func__); |
500 | netif_wake_queue(priv->dev); | 493 | netif_wake_queue(priv->dev); |
501 | } | 494 | } |
502 | netif_tx_unlock(priv->dev); | ||
503 | } | 495 | } |
504 | 496 | ||
505 | spin_unlock(&priv->tx_lock); | 497 | spin_unlock(&priv->tx_lock); |
@@ -614,10 +606,6 @@ static int tse_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
614 | buffer->dma_addr = dma_addr; | 606 | buffer->dma_addr = dma_addr; |
615 | buffer->len = nopaged_len; | 607 | buffer->len = nopaged_len; |
616 | 608 | ||
617 | /* Push data out of the cache hierarchy into main memory */ | ||
618 | dma_sync_single_for_device(priv->device, buffer->dma_addr, | ||
619 | buffer->len, DMA_TO_DEVICE); | ||
620 | |||
621 | priv->dmaops->tx_buffer(priv, buffer); | 609 | priv->dmaops->tx_buffer(priv, buffer); |
622 | 610 | ||
623 | skb_tx_timestamp(skb); | 611 | skb_tx_timestamp(skb); |
@@ -841,6 +829,8 @@ static int init_phy(struct net_device *dev) | |||
841 | 829 | ||
842 | if (!phydev) { | 830 | if (!phydev) { |
843 | netdev_err(dev, "Could not find the PHY\n"); | 831 | netdev_err(dev, "Could not find the PHY\n"); |
832 | if (fixed_link) | ||
833 | of_phy_deregister_fixed_link(priv->device->of_node); | ||
844 | return -ENODEV; | 834 | return -ENODEV; |
845 | } | 835 | } |
846 | 836 | ||
@@ -1630,10 +1620,15 @@ err_free_netdev: | |||
1630 | static int altera_tse_remove(struct platform_device *pdev) | 1620 | static int altera_tse_remove(struct platform_device *pdev) |
1631 | { | 1621 | { |
1632 | struct net_device *ndev = platform_get_drvdata(pdev); | 1622 | struct net_device *ndev = platform_get_drvdata(pdev); |
1623 | struct altera_tse_private *priv = netdev_priv(ndev); | ||
1633 | 1624 | ||
1634 | if (ndev->phydev) | 1625 | if (ndev->phydev) { |
1635 | phy_disconnect(ndev->phydev); | 1626 | phy_disconnect(ndev->phydev); |
1636 | 1627 | ||
1628 | if (of_phy_is_fixed_link(priv->device->of_node)) | ||
1629 | of_phy_deregister_fixed_link(priv->device->of_node); | ||
1630 | } | ||
1631 | |||
1637 | platform_set_drvdata(pdev, NULL); | 1632 | platform_set_drvdata(pdev, NULL); |
1638 | altera_tse_mdio_destroy(ndev); | 1633 | altera_tse_mdio_destroy(ndev); |
1639 | unregister_netdev(ndev); | 1634 | unregister_netdev(ndev); |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-platform.c b/drivers/net/ethernet/amd/xgbe/xgbe-platform.c index 8c530dccb447..84d4c51cab8c 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-platform.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-platform.c | |||
@@ -538,7 +538,7 @@ static int xgbe_platform_remove(struct platform_device *pdev) | |||
538 | return 0; | 538 | return 0; |
539 | } | 539 | } |
540 | 540 | ||
541 | #ifdef CONFIG_PM | 541 | #ifdef CONFIG_PM_SLEEP |
542 | static int xgbe_platform_suspend(struct device *dev) | 542 | static int xgbe_platform_suspend(struct device *dev) |
543 | { | 543 | { |
544 | struct xgbe_prv_data *pdata = dev_get_drvdata(dev); | 544 | struct xgbe_prv_data *pdata = dev_get_drvdata(dev); |
@@ -583,7 +583,7 @@ static int xgbe_platform_resume(struct device *dev) | |||
583 | 583 | ||
584 | return ret; | 584 | return ret; |
585 | } | 585 | } |
586 | #endif /* CONFIG_PM */ | 586 | #endif /* CONFIG_PM_SLEEP */ |
587 | 587 | ||
588 | static const struct xgbe_version_data xgbe_v1 = { | 588 | static const struct xgbe_version_data xgbe_v1 = { |
589 | .init_function_ptrs_phy_impl = xgbe_init_function_ptrs_phy_v1, | 589 | .init_function_ptrs_phy_impl = xgbe_init_function_ptrs_phy_v1, |
diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c index 07ff6492402a..5711fbbd6ae3 100644 --- a/drivers/net/ethernet/aurora/nb8800.c +++ b/drivers/net/ethernet/aurora/nb8800.c | |||
@@ -1457,12 +1457,12 @@ static int nb8800_probe(struct platform_device *pdev) | |||
1457 | 1457 | ||
1458 | ret = nb8800_hw_init(dev); | 1458 | ret = nb8800_hw_init(dev); |
1459 | if (ret) | 1459 | if (ret) |
1460 | goto err_free_bus; | 1460 | goto err_deregister_fixed_link; |
1461 | 1461 | ||
1462 | if (ops && ops->init) { | 1462 | if (ops && ops->init) { |
1463 | ret = ops->init(dev); | 1463 | ret = ops->init(dev); |
1464 | if (ret) | 1464 | if (ret) |
1465 | goto err_free_bus; | 1465 | goto err_deregister_fixed_link; |
1466 | } | 1466 | } |
1467 | 1467 | ||
1468 | dev->netdev_ops = &nb8800_netdev_ops; | 1468 | dev->netdev_ops = &nb8800_netdev_ops; |
@@ -1495,6 +1495,9 @@ static int nb8800_probe(struct platform_device *pdev) | |||
1495 | 1495 | ||
1496 | err_free_dma: | 1496 | err_free_dma: |
1497 | nb8800_dma_free(dev); | 1497 | nb8800_dma_free(dev); |
1498 | err_deregister_fixed_link: | ||
1499 | if (of_phy_is_fixed_link(pdev->dev.of_node)) | ||
1500 | of_phy_deregister_fixed_link(pdev->dev.of_node); | ||
1498 | err_free_bus: | 1501 | err_free_bus: |
1499 | of_node_put(priv->phy_node); | 1502 | of_node_put(priv->phy_node); |
1500 | mdiobus_unregister(bus); | 1503 | mdiobus_unregister(bus); |
@@ -1512,6 +1515,8 @@ static int nb8800_remove(struct platform_device *pdev) | |||
1512 | struct nb8800_priv *priv = netdev_priv(ndev); | 1515 | struct nb8800_priv *priv = netdev_priv(ndev); |
1513 | 1516 | ||
1514 | unregister_netdev(ndev); | 1517 | unregister_netdev(ndev); |
1518 | if (of_phy_is_fixed_link(pdev->dev.of_node)) | ||
1519 | of_phy_deregister_fixed_link(pdev->dev.of_node); | ||
1515 | of_node_put(priv->phy_node); | 1520 | of_node_put(priv->phy_node); |
1516 | 1521 | ||
1517 | mdiobus_unregister(priv->mii_bus); | 1522 | mdiobus_unregister(priv->mii_bus); |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index c3354b9941d1..25d1eb4933d0 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
@@ -1755,13 +1755,13 @@ static int bcm_sysport_probe(struct platform_device *pdev) | |||
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) | |||
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) | |||
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) | |||
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; |
1835 | err: | 1835 | |
1836 | err_deregister_fixed_link: | ||
1837 | if (of_phy_is_fixed_link(dn)) | ||
1838 | of_phy_deregister_fixed_link(dn); | ||
1839 | err_free_netdev: | ||
1836 | free_netdev(dev); | 1840 | free_netdev(dev); |
1837 | return ret; | 1841 | return ret; |
1838 | } | 1842 | } |
@@ -1840,11 +1844,14 @@ err: | |||
1840 | static int bcm_sysport_remove(struct platform_device *pdev) | 1844 | static 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 called | 1849 | /* Not much to do, ndo_close has been called |
1845 | * and we use managed allocations | 1850 | * 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 | ||
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 33638dc0e104..f92896835d2a 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
@@ -1165,6 +1165,7 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev, | |||
1165 | struct bcmgenet_tx_ring *ring) | 1165 | struct bcmgenet_tx_ring *ring) |
1166 | { | 1166 | { |
1167 | struct bcmgenet_priv *priv = netdev_priv(dev); | 1167 | struct bcmgenet_priv *priv = netdev_priv(dev); |
1168 | struct device *kdev = &priv->pdev->dev; | ||
1168 | struct enet_cb *tx_cb_ptr; | 1169 | struct enet_cb *tx_cb_ptr; |
1169 | struct netdev_queue *txq; | 1170 | struct netdev_queue *txq; |
1170 | unsigned int pkts_compl = 0; | 1171 | unsigned int pkts_compl = 0; |
@@ -1192,13 +1193,13 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev, | |||
1192 | if (tx_cb_ptr->skb) { | 1193 | if (tx_cb_ptr->skb) { |
1193 | pkts_compl++; | 1194 | pkts_compl++; |
1194 | bytes_compl += GENET_CB(tx_cb_ptr->skb)->bytes_sent; | 1195 | bytes_compl += GENET_CB(tx_cb_ptr->skb)->bytes_sent; |
1195 | dma_unmap_single(&dev->dev, | 1196 | dma_unmap_single(kdev, |
1196 | dma_unmap_addr(tx_cb_ptr, dma_addr), | 1197 | dma_unmap_addr(tx_cb_ptr, dma_addr), |
1197 | dma_unmap_len(tx_cb_ptr, dma_len), | 1198 | dma_unmap_len(tx_cb_ptr, dma_len), |
1198 | DMA_TO_DEVICE); | 1199 | DMA_TO_DEVICE); |
1199 | bcmgenet_free_cb(tx_cb_ptr); | 1200 | bcmgenet_free_cb(tx_cb_ptr); |
1200 | } else if (dma_unmap_addr(tx_cb_ptr, dma_addr)) { | 1201 | } else if (dma_unmap_addr(tx_cb_ptr, dma_addr)) { |
1201 | dma_unmap_page(&dev->dev, | 1202 | dma_unmap_page(kdev, |
1202 | dma_unmap_addr(tx_cb_ptr, dma_addr), | 1203 | dma_unmap_addr(tx_cb_ptr, dma_addr), |
1203 | dma_unmap_len(tx_cb_ptr, dma_len), | 1204 | dma_unmap_len(tx_cb_ptr, dma_len), |
1204 | DMA_TO_DEVICE); | 1205 | DMA_TO_DEVICE); |
@@ -1768,6 +1769,7 @@ static int bcmgenet_alloc_rx_buffers(struct bcmgenet_priv *priv, | |||
1768 | 1769 | ||
1769 | static void bcmgenet_free_rx_buffers(struct bcmgenet_priv *priv) | 1770 | static void bcmgenet_free_rx_buffers(struct bcmgenet_priv *priv) |
1770 | { | 1771 | { |
1772 | struct device *kdev = &priv->pdev->dev; | ||
1771 | struct enet_cb *cb; | 1773 | struct enet_cb *cb; |
1772 | int i; | 1774 | int i; |
1773 | 1775 | ||
@@ -1775,7 +1777,7 @@ static void bcmgenet_free_rx_buffers(struct bcmgenet_priv *priv) | |||
1775 | cb = &priv->rx_cbs[i]; | 1777 | cb = &priv->rx_cbs[i]; |
1776 | 1778 | ||
1777 | if (dma_unmap_addr(cb, dma_addr)) { | 1779 | if (dma_unmap_addr(cb, dma_addr)) { |
1778 | dma_unmap_single(&priv->dev->dev, | 1780 | dma_unmap_single(kdev, |
1779 | dma_unmap_addr(cb, dma_addr), | 1781 | dma_unmap_addr(cb, dma_addr), |
1780 | priv->rx_buf_len, DMA_FROM_DEVICE); | 1782 | priv->rx_buf_len, DMA_FROM_DEVICE); |
1781 | dma_unmap_addr_set(cb, dma_addr, 0); | 1783 | dma_unmap_addr_set(cb, dma_addr, 0); |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c index 457c3bc8cfff..e87607621e62 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c | |||
@@ -542,8 +542,10 @@ static int bcmgenet_mii_of_init(struct bcmgenet_priv *priv) | |||
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) | |||
625 | int bcmgenet_mii_init(struct net_device *dev) | 627 | int 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) | |||
638 | return 0; | 641 | return 0; |
639 | 642 | ||
640 | out: | 643 | out: |
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: | |||
647 | void bcmgenet_mii_exit(struct net_device *dev) | 652 | void 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); |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 0e489bb82456..538544a7c642 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -991,6 +991,7 @@ static inline void macb_init_rx_ring(struct macb *bp) | |||
991 | addr += bp->rx_buffer_size; | 991 | addr += bp->rx_buffer_size; |
992 | } | 992 | } |
993 | bp->rx_ring[bp->rx_ring_size - 1].addr |= MACB_BIT(RX_WRAP); | 993 | bp->rx_ring[bp->rx_ring_size - 1].addr |= MACB_BIT(RX_WRAP); |
994 | bp->rx_tail = 0; | ||
994 | } | 995 | } |
995 | 996 | ||
996 | static int macb_rx(struct macb *bp, int budget) | 997 | static int macb_rx(struct macb *bp, int budget) |
@@ -1172,6 +1173,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
1172 | if (status & MACB_BIT(RXUBR)) { | 1173 | if (status & MACB_BIT(RXUBR)) { |
1173 | ctrl = macb_readl(bp, NCR); | 1174 | ctrl = macb_readl(bp, NCR); |
1174 | macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE)); | 1175 | macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE)); |
1176 | wmb(); | ||
1175 | macb_writel(bp, NCR, ctrl | MACB_BIT(RE)); | 1177 | macb_writel(bp, NCR, ctrl | MACB_BIT(RE)); |
1176 | 1178 | ||
1177 | if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) | 1179 | if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) |
@@ -1736,8 +1738,6 @@ static void macb_init_rings(struct macb *bp) | |||
1736 | bp->queues[0].tx_head = 0; | 1738 | bp->queues[0].tx_head = 0; |
1737 | bp->queues[0].tx_tail = 0; | 1739 | bp->queues[0].tx_tail = 0; |
1738 | bp->queues[0].tx_ring[bp->tx_ring_size - 1].ctrl |= MACB_BIT(TX_WRAP); | 1740 | bp->queues[0].tx_ring[bp->tx_ring_size - 1].ctrl |= MACB_BIT(TX_WRAP); |
1739 | |||
1740 | bp->rx_tail = 0; | ||
1741 | } | 1741 | } |
1742 | 1742 | ||
1743 | static void macb_reset_hw(struct macb *bp) | 1743 | static void macb_reset_hw(struct macb *bp) |
@@ -2943,6 +2943,7 @@ static irqreturn_t at91ether_interrupt(int irq, void *dev_id) | |||
2943 | if (intstatus & MACB_BIT(RXUBR)) { | 2943 | if (intstatus & MACB_BIT(RXUBR)) { |
2944 | ctl = macb_readl(lp, NCR); | 2944 | ctl = macb_readl(lp, NCR); |
2945 | macb_writel(lp, NCR, ctl & ~MACB_BIT(RE)); | 2945 | macb_writel(lp, NCR, ctl & ~MACB_BIT(RE)); |
2946 | wmb(); | ||
2946 | macb_writel(lp, NCR, ctl | MACB_BIT(RE)); | 2947 | macb_writel(lp, NCR, ctl | MACB_BIT(RE)); |
2947 | } | 2948 | } |
2948 | 2949 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h b/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h index df1573c4a659..ecf3ccc257bc 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h | |||
@@ -168,6 +168,7 @@ CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN | |||
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 | */ |
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index c865135f3cb9..5ea740b4cf14 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h | |||
@@ -574,6 +574,8 @@ struct fec_enet_private { | |||
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 | ||
579 | void fec_ptp_init(struct platform_device *pdev); | 581 | void fec_ptp_init(struct platform_device *pdev); |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 1aabe4bcc8ea..ecaa7a90b7c8 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -2310,14 +2310,24 @@ static const struct fec_stat { | |||
2310 | { "IEEE_rx_octets_ok", IEEE_R_OCTETS_OK }, | 2310 | { "IEEE_rx_octets_ok", IEEE_R_OCTETS_OK }, |
2311 | }; | 2311 | }; |
2312 | 2312 | ||
2313 | static void fec_enet_get_ethtool_stats(struct net_device *dev, | 2313 | static void fec_enet_update_ethtool_stats(struct net_device *dev) |
2314 | struct ethtool_stats *stats, u64 *data) | ||
2315 | { | 2314 | { |
2316 | struct fec_enet_private *fep = netdev_priv(dev); | 2315 | struct fec_enet_private *fep = netdev_priv(dev); |
2317 | int i; | 2316 | int i; |
2318 | 2317 | ||
2319 | for (i = 0; i < ARRAY_SIZE(fec_stats); i++) | 2318 | for (i = 0; i < ARRAY_SIZE(fec_stats); i++) |
2320 | data[i] = readl(fep->hwp + fec_stats[i].offset); | 2319 | fep->ethtool_stats[i] = readl(fep->hwp + fec_stats[i].offset); |
2320 | } | ||
2321 | |||
2322 | static void fec_enet_get_ethtool_stats(struct net_device *dev, | ||
2323 | struct ethtool_stats *stats, u64 *data) | ||
2324 | { | ||
2325 | struct fec_enet_private *fep = netdev_priv(dev); | ||
2326 | |||
2327 | if (netif_running(dev)) | ||
2328 | fec_enet_update_ethtool_stats(dev); | ||
2329 | |||
2330 | memcpy(data, fep->ethtool_stats, ARRAY_SIZE(fec_stats) * sizeof(u64)); | ||
2321 | } | 2331 | } |
2322 | 2332 | ||
2323 | static void fec_enet_get_strings(struct net_device *netdev, | 2333 | static void fec_enet_get_strings(struct net_device *netdev, |
@@ -2861,6 +2871,8 @@ fec_enet_close(struct net_device *ndev) | |||
2861 | if (fep->quirks & FEC_QUIRK_ERR006687) | 2871 | if (fep->quirks & FEC_QUIRK_ERR006687) |
2862 | imx6q_cpuidle_fec_irqs_unused(); | 2872 | imx6q_cpuidle_fec_irqs_unused(); |
2863 | 2873 | ||
2874 | fec_enet_update_ethtool_stats(ndev); | ||
2875 | |||
2864 | fec_enet_clk_enable(ndev, false); | 2876 | fec_enet_clk_enable(ndev, false); |
2865 | pinctrl_pm_select_sleep_state(&fep->pdev->dev); | 2877 | pinctrl_pm_select_sleep_state(&fep->pdev->dev); |
2866 | pm_runtime_mark_last_busy(&fep->pdev->dev); | 2878 | pm_runtime_mark_last_busy(&fep->pdev->dev); |
@@ -3166,6 +3178,8 @@ static int fec_enet_init(struct net_device *ndev) | |||
3166 | 3178 | ||
3167 | fec_restart(ndev); | 3179 | fec_restart(ndev); |
3168 | 3180 | ||
3181 | fec_enet_update_ethtool_stats(ndev); | ||
3182 | |||
3169 | return 0; | 3183 | return 0; |
3170 | } | 3184 | } |
3171 | 3185 | ||
@@ -3264,7 +3278,8 @@ fec_probe(struct platform_device *pdev) | |||
3264 | fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs); | 3278 | fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs); |
3265 | 3279 | ||
3266 | /* Init network device */ | 3280 | /* Init network device */ |
3267 | ndev = alloc_etherdev_mqs(sizeof(struct fec_enet_private), | 3281 | ndev = alloc_etherdev_mqs(sizeof(struct fec_enet_private) + |
3282 | ARRAY_SIZE(fec_stats) * sizeof(u64), | ||
3268 | num_tx_qs, num_rx_qs); | 3283 | num_tx_qs, num_rx_qs); |
3269 | if (!ndev) | 3284 | if (!ndev) |
3270 | return -ENOMEM; | 3285 | return -ENOMEM; |
@@ -3461,6 +3476,8 @@ failed_regulator: | |||
3461 | failed_clk_ipg: | 3476 | failed_clk_ipg: |
3462 | fec_enet_clk_enable(ndev, false); | 3477 | fec_enet_clk_enable(ndev, false); |
3463 | failed_clk: | 3478 | failed_clk: |
3479 | if (of_phy_is_fixed_link(np)) | ||
3480 | of_phy_deregister_fixed_link(np); | ||
3464 | failed_phy: | 3481 | failed_phy: |
3465 | of_node_put(phy_node); | 3482 | of_node_put(phy_node); |
3466 | failed_ioremap: | 3483 | failed_ioremap: |
@@ -3474,6 +3491,7 @@ fec_drv_remove(struct platform_device *pdev) | |||
3474 | { | 3491 | { |
3475 | struct net_device *ndev = platform_get_drvdata(pdev); | 3492 | struct net_device *ndev = platform_get_drvdata(pdev); |
3476 | struct fec_enet_private *fep = netdev_priv(ndev); | 3493 | struct fec_enet_private *fep = netdev_priv(ndev); |
3494 | struct device_node *np = pdev->dev.of_node; | ||
3477 | 3495 | ||
3478 | cancel_work_sync(&fep->tx_timeout_work); | 3496 | cancel_work_sync(&fep->tx_timeout_work); |
3479 | fec_ptp_stop(pdev); | 3497 | fec_ptp_stop(pdev); |
@@ -3481,6 +3499,8 @@ fec_drv_remove(struct platform_device *pdev) | |||
3481 | fec_enet_mii_remove(fep); | 3499 | fec_enet_mii_remove(fep); |
3482 | if (fep->reg_phy) | 3500 | if (fep->reg_phy) |
3483 | regulator_disable(fep->reg_phy); | 3501 | regulator_disable(fep->reg_phy); |
3502 | if (of_phy_is_fixed_link(np)) | ||
3503 | of_phy_deregister_fixed_link(np); | ||
3484 | of_node_put(fep->phy_node); | 3504 | of_node_put(fep->phy_node); |
3485 | free_netdev(ndev); | 3505 | free_netdev(ndev); |
3486 | 3506 | ||
diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 53ef51e3bd9e..71a5ded9d1de 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c | |||
@@ -1107,6 +1107,9 @@ int memac_free(struct fman_mac *memac) | |||
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 | ||
diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index cc5d07cfe535..69ca42ce5dd5 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c | |||
@@ -896,6 +896,8 @@ static int mac_probe(struct platform_device *_of_dev) | |||
896 | priv->fixed_link->duplex = phy->duplex; | 896 | priv->fixed_link->duplex = phy->duplex; |
897 | priv->fixed_link->pause = phy->pause; | 897 | priv->fixed_link->pause = phy->pause; |
898 | priv->fixed_link->asym_pause = phy->asym_pause; | 898 | priv->fixed_link->asym_pause = phy->asym_pause; |
899 | |||
900 | put_device(&phy->mdio.dev); | ||
899 | } | 901 | } |
900 | 902 | ||
901 | err = mac_dev->init(mac_dev); | 903 | err = mac_dev->init(mac_dev); |
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c index 34843c155420..d9f3a480ca1b 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | |||
@@ -967,7 +967,7 @@ static int fs_enet_probe(struct platform_device *ofdev) | |||
967 | err = clk_prepare_enable(clk); | 967 | err = clk_prepare_enable(clk); |
968 | if (err) { | 968 | if (err) { |
969 | ret = err; | 969 | ret = err; |
970 | goto out_free_fpi; | 970 | goto out_deregister_fixed_link; |
971 | } | 971 | } |
972 | fpi->clk_per = clk; | 972 | fpi->clk_per = clk; |
973 | } | 973 | } |
@@ -1048,6 +1048,9 @@ out_put: | |||
1048 | of_node_put(fpi->phy_node); | 1048 | of_node_put(fpi->phy_node); |
1049 | if (fpi->clk_per) | 1049 | if (fpi->clk_per) |
1050 | clk_disable_unprepare(fpi->clk_per); | 1050 | clk_disable_unprepare(fpi->clk_per); |
1051 | out_deregister_fixed_link: | ||
1052 | if (of_phy_is_fixed_link(ofdev->dev.of_node)) | ||
1053 | of_phy_deregister_fixed_link(ofdev->dev.of_node); | ||
1051 | out_free_fpi: | 1054 | out_free_fpi: |
1052 | kfree(fpi); | 1055 | kfree(fpi); |
1053 | return ret; | 1056 | return ret; |
@@ -1066,6 +1069,8 @@ static int fs_enet_remove(struct platform_device *ofdev) | |||
1066 | of_node_put(fep->fpi->phy_node); | 1069 | of_node_put(fep->fpi->phy_node); |
1067 | if (fep->fpi->clk_per) | 1070 | if (fep->fpi->clk_per) |
1068 | clk_disable_unprepare(fep->fpi->clk_per); | 1071 | clk_disable_unprepare(fep->fpi->clk_per); |
1072 | if (of_phy_is_fixed_link(ofdev->dev.of_node)) | ||
1073 | of_phy_deregister_fixed_link(ofdev->dev.of_node); | ||
1069 | free_netdev(ndev); | 1074 | free_netdev(ndev); |
1070 | return 0; | 1075 | return 0; |
1071 | } | 1076 | } |
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 409210413f5d..756f7e763d5f 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
@@ -1312,6 +1312,7 @@ static void gfar_init_addr_hash_table(struct gfar_private *priv) | |||
1312 | */ | 1312 | */ |
1313 | static int gfar_probe(struct platform_device *ofdev) | 1313 | static 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; |
@@ -1465,6 +1466,8 @@ static int gfar_probe(struct platform_device *ofdev) | |||
1465 | return 0; | 1466 | return 0; |
1466 | 1467 | ||
1467 | register_fail: | 1468 | register_fail: |
1469 | if (of_phy_is_fixed_link(np)) | ||
1470 | of_phy_deregister_fixed_link(np); | ||
1468 | unmap_group_regs(priv); | 1471 | unmap_group_regs(priv); |
1469 | gfar_free_rx_queues(priv); | 1472 | gfar_free_rx_queues(priv); |
1470 | gfar_free_tx_queues(priv); | 1473 | gfar_free_tx_queues(priv); |
@@ -1477,11 +1480,16 @@ register_fail: | |||
1477 | static int gfar_remove(struct platform_device *ofdev) | 1480 | static int gfar_remove(struct platform_device *ofdev) |
1478 | { | 1481 | { |
1479 | struct gfar_private *priv = platform_get_drvdata(ofdev); | 1482 | struct gfar_private *priv = platform_get_drvdata(ofdev); |
1483 | struct device_node *np = ofdev->dev.of_node; | ||
1480 | 1484 | ||
1481 | of_node_put(priv->phy_node); | 1485 | of_node_put(priv->phy_node); |
1482 | of_node_put(priv->tbi_node); | 1486 | of_node_put(priv->tbi_node); |
1483 | 1487 | ||
1484 | unregister_netdev(priv->ndev); | 1488 | unregister_netdev(priv->ndev); |
1489 | |||
1490 | if (of_phy_is_fixed_link(np)) | ||
1491 | of_phy_deregister_fixed_link(np); | ||
1492 | |||
1485 | unmap_group_regs(priv); | 1493 | unmap_group_regs(priv); |
1486 | gfar_free_rx_queues(priv); | 1494 | gfar_free_rx_queues(priv); |
1487 | gfar_free_tx_queues(priv); | 1495 | gfar_free_tx_queues(priv); |
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 786182480a73..53c5fcf1436c 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c | |||
@@ -3867,9 +3867,8 @@ static int ucc_geth_probe(struct platform_device* ofdev) | |||
3867 | dev = alloc_etherdev(sizeof(*ugeth)); | 3867 | dev = alloc_etherdev(sizeof(*ugeth)); |
3868 | 3868 | ||
3869 | if (dev == NULL) { | 3869 | if (dev == NULL) { |
3870 | of_node_put(ug_info->tbi_node); | 3870 | err = -ENOMEM; |
3871 | of_node_put(ug_info->phy_node); | 3871 | goto err_deregister_fixed_link; |
3872 | return -ENOMEM; | ||
3873 | } | 3872 | } |
3874 | 3873 | ||
3875 | ugeth = netdev_priv(dev); | 3874 | ugeth = netdev_priv(dev); |
@@ -3906,10 +3905,7 @@ static int ucc_geth_probe(struct platform_device* ofdev) | |||
3906 | if (netif_msg_probe(ugeth)) | 3905 | if (netif_msg_probe(ugeth)) |
3907 | pr_err("%s: Cannot register net device, aborting\n", | 3906 | pr_err("%s: Cannot register net device, aborting\n", |
3908 | dev->name); | 3907 | dev->name); |
3909 | free_netdev(dev); | 3908 | goto err_free_netdev; |
3910 | of_node_put(ug_info->tbi_node); | ||
3911 | of_node_put(ug_info->phy_node); | ||
3912 | return err; | ||
3913 | } | 3909 | } |
3914 | 3910 | ||
3915 | mac_addr = of_get_mac_address(np); | 3911 | mac_addr = of_get_mac_address(np); |
@@ -3922,16 +3918,29 @@ static int ucc_geth_probe(struct platform_device* ofdev) | |||
3922 | ugeth->node = np; | 3918 | ugeth->node = np; |
3923 | 3919 | ||
3924 | return 0; | 3920 | return 0; |
3921 | |||
3922 | err_free_netdev: | ||
3923 | free_netdev(dev); | ||
3924 | err_deregister_fixed_link: | ||
3925 | if (of_phy_is_fixed_link(np)) | ||
3926 | of_phy_deregister_fixed_link(np); | ||
3927 | of_node_put(ug_info->tbi_node); | ||
3928 | of_node_put(ug_info->phy_node); | ||
3929 | |||
3930 | return err; | ||
3925 | } | 3931 | } |
3926 | 3932 | ||
3927 | static int ucc_geth_remove(struct platform_device* ofdev) | 3933 | static int ucc_geth_remove(struct platform_device* ofdev) |
3928 | { | 3934 | { |
3929 | struct net_device *dev = platform_get_drvdata(ofdev); | 3935 | struct net_device *dev = platform_get_drvdata(ofdev); |
3930 | struct ucc_geth_private *ugeth = netdev_priv(dev); | 3936 | struct ucc_geth_private *ugeth = netdev_priv(dev); |
3937 | struct device_node *np = ofdev->dev.of_node; | ||
3931 | 3938 | ||
3932 | unregister_netdev(dev); | 3939 | unregister_netdev(dev); |
3933 | free_netdev(dev); | 3940 | free_netdev(dev); |
3934 | ucc_geth_memclean(ugeth); | 3941 | ucc_geth_memclean(ugeth); |
3942 | if (of_phy_is_fixed_link(np)) | ||
3943 | of_phy_deregister_fixed_link(np); | ||
3935 | of_node_put(ugeth->ug_info->tbi_node); | 3944 | of_node_put(ugeth->ug_info->tbi_node); |
3936 | of_node_put(ugeth->ug_info->phy_node); | 3945 | of_node_put(ugeth->ug_info->phy_node); |
3937 | 3946 | ||
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 4feca69e5833..cae24a8ccf47 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -4935,11 +4935,15 @@ static int igb_tso(struct igb_ring *tx_ring, | |||
4935 | 4935 | ||
4936 | /* initialize outer IP header fields */ | 4936 | /* initialize outer IP header fields */ |
4937 | if (ip.v4->version == 4) { | 4937 | if (ip.v4->version == 4) { |
4938 | unsigned char *csum_start = skb_checksum_start(skb); | ||
4939 | unsigned char *trans_start = ip.hdr + (ip.v4->ihl * 4); | ||
4940 | |||
4938 | /* IP header will have to cancel out any data that | 4941 | /* IP header will have to cancel out any data that |
4939 | * is not a part of the outer IP header | 4942 | * is not a part of the outer IP header |
4940 | */ | 4943 | */ |
4941 | ip.v4->check = csum_fold(csum_add(lco_csum(skb), | 4944 | ip.v4->check = csum_fold(csum_partial(trans_start, |
4942 | csum_unfold(l4.tcp->check))); | 4945 | csum_start - trans_start, |
4946 | 0)); | ||
4943 | type_tucmd |= E1000_ADVTXD_TUCMD_IPV4; | 4947 | type_tucmd |= E1000_ADVTXD_TUCMD_IPV4; |
4944 | 4948 | ||
4945 | ip.v4->tot_len = 0; | 4949 | ip.v4->tot_len = 0; |
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index 810fcf7aa2c6..839ba110f7fb 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c | |||
@@ -1965,11 +1965,15 @@ static int igbvf_tso(struct igbvf_ring *tx_ring, | |||
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 that | 1971 | /* IP header will have to cancel out any data that |
1969 | * is not a part of the outer IP header | 1972 | * 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; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 2436984481cc..1e2f39ebd824 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -7287,11 +7287,15 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring, | |||
7287 | 7287 | ||
7288 | /* initialize outer IP header fields */ | 7288 | /* initialize outer IP header fields */ |
7289 | if (ip.v4->version == 4) { | 7289 | if (ip.v4->version == 4) { |
7290 | unsigned char *csum_start = skb_checksum_start(skb); | ||
7291 | unsigned char *trans_start = ip.hdr + (ip.v4->ihl * 4); | ||
7292 | |||
7290 | /* IP header will have to cancel out any data that | 7293 | /* IP header will have to cancel out any data that |
7291 | * is not a part of the outer IP header | 7294 | * is not a part of the outer IP header |
7292 | */ | 7295 | */ |
7293 | ip.v4->check = csum_fold(csum_add(lco_csum(skb), | 7296 | ip.v4->check = csum_fold(csum_partial(trans_start, |
7294 | csum_unfold(l4.tcp->check))); | 7297 | csum_start - trans_start, |
7298 | 0)); | ||
7295 | type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4; | 7299 | type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4; |
7296 | 7300 | ||
7297 | ip.v4->tot_len = 0; | 7301 | ip.v4->tot_len = 0; |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index d316f503a727..6d4bef5803f2 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -3335,11 +3335,15 @@ static int ixgbevf_tso(struct ixgbevf_ring *tx_ring, | |||
3335 | 3335 | ||
3336 | /* initialize outer IP header fields */ | 3336 | /* initialize outer IP header fields */ |
3337 | if (ip.v4->version == 4) { | 3337 | if (ip.v4->version == 4) { |
3338 | unsigned char *csum_start = skb_checksum_start(skb); | ||
3339 | unsigned char *trans_start = ip.hdr + (ip.v4->ihl * 4); | ||
3340 | |||
3338 | /* IP header will have to cancel out any data that | 3341 | /* IP header will have to cancel out any data that |
3339 | * is not a part of the outer IP header | 3342 | * is not a part of the outer IP header |
3340 | */ | 3343 | */ |
3341 | ip.v4->check = csum_fold(csum_add(lco_csum(skb), | 3344 | ip.v4->check = csum_fold(csum_partial(trans_start, |
3342 | csum_unfold(l4.tcp->check))); | 3345 | csum_start - trans_start, |
3346 | 0)); | ||
3343 | type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4; | 3347 | type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4; |
3344 | 3348 | ||
3345 | ip.v4->tot_len = 0; | 3349 | ip.v4->tot_len = 0; |
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index aa87c6858478..5e5b259dd2cc 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
@@ -4327,6 +4327,8 @@ err_clk: | |||
4327 | clk_disable_unprepare(pp->clk); | 4327 | clk_disable_unprepare(pp->clk); |
4328 | err_put_phy_node: | 4328 | err_put_phy_node: |
4329 | of_node_put(phy_node); | 4329 | of_node_put(phy_node); |
4330 | if (of_phy_is_fixed_link(dn)) | ||
4331 | of_phy_deregister_fixed_link(dn); | ||
4330 | err_free_irq: | 4332 | err_free_irq: |
4331 | irq_dispose_mapping(dev->irq); | 4333 | irq_dispose_mapping(dev->irq); |
4332 | err_free_netdev: | 4334 | err_free_netdev: |
@@ -4338,6 +4340,7 @@ err_free_netdev: | |||
4338 | static int mvneta_remove(struct platform_device *pdev) | 4340 | static int mvneta_remove(struct platform_device *pdev) |
4339 | { | 4341 | { |
4340 | struct net_device *dev = platform_get_drvdata(pdev); | 4342 | struct net_device *dev = platform_get_drvdata(pdev); |
4343 | struct device_node *dn = pdev->dev.of_node; | ||
4341 | struct mvneta_port *pp = netdev_priv(dev); | 4344 | struct mvneta_port *pp = netdev_priv(dev); |
4342 | 4345 | ||
4343 | unregister_netdev(dev); | 4346 | unregister_netdev(dev); |
@@ -4345,6 +4348,8 @@ static int mvneta_remove(struct platform_device *pdev) | |||
4345 | clk_disable_unprepare(pp->clk); | 4348 | clk_disable_unprepare(pp->clk); |
4346 | free_percpu(pp->ports); | 4349 | free_percpu(pp->ports); |
4347 | free_percpu(pp->stats); | 4350 | free_percpu(pp->stats); |
4351 | if (of_phy_is_fixed_link(dn)) | ||
4352 | of_phy_deregister_fixed_link(dn); | ||
4348 | irq_dispose_mapping(dev->irq); | 4353 | irq_dispose_mapping(dev->irq); |
4349 | of_node_put(pp->phy_node); | 4354 | of_node_put(pp->phy_node); |
4350 | free_netdev(dev); | 4355 | free_netdev(dev); |
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index d71627417ea7..3dd87889e67e 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | |||
@@ -318,6 +318,8 @@ static int mtk_phy_connect(struct net_device *dev) | |||
318 | return 0; | 318 | return 0; |
319 | 319 | ||
320 | err_phy: | 320 | err_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) | |||
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 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 091b904262bc..49a81f1fc1d6 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -2109,13 +2109,6 @@ err: | |||
2109 | return -ENOMEM; | 2109 | return -ENOMEM; |
2110 | } | 2110 | } |
2111 | 2111 | ||
2112 | static void mlx4_en_shutdown(struct net_device *dev) | ||
2113 | { | ||
2114 | rtnl_lock(); | ||
2115 | netif_device_detach(dev); | ||
2116 | mlx4_en_close(dev); | ||
2117 | rtnl_unlock(); | ||
2118 | } | ||
2119 | 2112 | ||
2120 | static int mlx4_en_copy_priv(struct mlx4_en_priv *dst, | 2113 | static int mlx4_en_copy_priv(struct mlx4_en_priv *dst, |
2121 | struct mlx4_en_priv *src, | 2114 | struct mlx4_en_priv *src, |
@@ -2214,8 +2207,6 @@ void mlx4_en_destroy_netdev(struct net_device *dev) | |||
2214 | { | 2207 | { |
2215 | struct mlx4_en_priv *priv = netdev_priv(dev); | 2208 | struct mlx4_en_priv *priv = netdev_priv(dev); |
2216 | struct mlx4_en_dev *mdev = priv->mdev; | 2209 | struct mlx4_en_dev *mdev = priv->mdev; |
2217 | bool shutdown = mdev->dev->persist->interface_state & | ||
2218 | MLX4_INTERFACE_STATE_SHUTDOWN; | ||
2219 | int t; | 2210 | int t; |
2220 | 2211 | ||
2221 | en_dbg(DRV, priv, "Destroying netdev on port:%d\n", priv->port); | 2212 | en_dbg(DRV, priv, "Destroying netdev on port:%d\n", priv->port); |
@@ -2224,10 +2215,7 @@ void mlx4_en_destroy_netdev(struct net_device *dev) | |||
2224 | if (priv->registered) { | 2215 | if (priv->registered) { |
2225 | devlink_port_type_clear(mlx4_get_devlink_port(mdev->dev, | 2216 | devlink_port_type_clear(mlx4_get_devlink_port(mdev->dev, |
2226 | priv->port)); | 2217 | priv->port)); |
2227 | if (shutdown) | 2218 | unregister_netdev(dev); |
2228 | mlx4_en_shutdown(dev); | ||
2229 | else | ||
2230 | unregister_netdev(dev); | ||
2231 | } | 2219 | } |
2232 | 2220 | ||
2233 | if (priv->allocated) | 2221 | if (priv->allocated) |
@@ -2258,8 +2246,7 @@ void mlx4_en_destroy_netdev(struct net_device *dev) | |||
2258 | kfree(priv->tx_cq[t]); | 2246 | kfree(priv->tx_cq[t]); |
2259 | } | 2247 | } |
2260 | 2248 | ||
2261 | if (!shutdown) | 2249 | free_netdev(dev); |
2262 | free_netdev(dev); | ||
2263 | } | 2250 | } |
2264 | 2251 | ||
2265 | static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu) | 2252 | static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 6f4e67bc3538..75d07fa9d0b1 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -4147,11 +4147,8 @@ static void mlx4_shutdown(struct pci_dev *pdev) | |||
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 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c index 94b891c118c1..1a670b681555 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mcg.c +++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c | |||
@@ -1457,7 +1457,12 @@ EXPORT_SYMBOL_GPL(mlx4_multicast_detach); | |||
1457 | int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, | 1457 | int 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) { |
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-phy.c b/drivers/net/ethernet/qualcomm/emac/emac-phy.c index da4e90db4d98..99a14df28b96 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac-phy.c +++ b/drivers/net/ethernet/qualcomm/emac/emac-phy.c | |||
@@ -212,6 +212,7 @@ int emac_phy_config(struct platform_device *pdev, struct emac_adapter *adpt) | |||
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) { |
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c index 8be526af659a..ae32f855e31b 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac.c | |||
@@ -710,6 +710,8 @@ static int emac_probe(struct platform_device *pdev) | |||
710 | err_undo_napi: | 710 | err_undo_napi: |
711 | netif_napi_del(&adpt->rx_q.napi); | 711 | netif_napi_del(&adpt->rx_q.napi); |
712 | err_undo_mdiobus: | 712 | err_undo_mdiobus: |
713 | if (!has_acpi_companion(&pdev->dev)) | ||
714 | put_device(&adpt->phydev->mdio.dev); | ||
713 | mdiobus_unregister(adpt->mii_bus); | 715 | mdiobus_unregister(adpt->mii_bus); |
714 | err_undo_clocks: | 716 | err_undo_clocks: |
715 | emac_clks_teardown(adpt); | 717 | emac_clks_teardown(adpt); |
@@ -729,6 +731,8 @@ static int emac_remove(struct platform_device *pdev) | |||
729 | 731 | ||
730 | emac_clks_teardown(adpt); | 732 | emac_clks_teardown(adpt); |
731 | 733 | ||
734 | if (!has_acpi_companion(&pdev->dev)) | ||
735 | put_device(&adpt->phydev->mdio.dev); | ||
732 | mdiobus_unregister(adpt->mii_bus); | 736 | mdiobus_unregister(adpt->mii_bus); |
733 | free_netdev(netdev); | 737 | free_netdev(netdev); |
734 | 738 | ||
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 27cfec3154c8..92d7692c840d 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c | |||
@@ -1008,20 +1008,18 @@ static int ravb_phy_init(struct net_device *ndev) | |||
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 Gen3 | 1015 | /* 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) | |||
1033 | phy_attached_info(phydev); | 1031 | phy_attached_info(phydev); |
1034 | 1032 | ||
1035 | return 0; | 1033 | return 0; |
1034 | |||
1035 | err_phy_disconnect: | ||
1036 | phy_disconnect(phydev); | ||
1037 | err_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) | |||
1634 | /* Device close function for Ethernet AVB */ | 1640 | /* Device close function for Ethernet AVB */ |
1635 | static int ravb_close(struct net_device *ndev) | 1641 | static 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) | |||
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) { |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index e443695c2757..f341c1bc7001 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -518,7 +518,7 @@ static struct sh_eth_cpu_data r7s72100_data = { | |||
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 | |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c index b1e5f24708c9..e6e6c2fcc4b7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c | |||
@@ -50,10 +50,23 @@ static int dwmac_generic_probe(struct platform_device *pdev) | |||
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 | |||
62 | err_exit: | ||
63 | if (plat_dat->exit) | ||
64 | plat_dat->exit(pdev, plat_dat->bsp_priv); | ||
65 | err_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 | ||
59 | static const struct of_device_id dwmac_generic_match[] = { | 72 | static const struct of_device_id dwmac_generic_match[] = { |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c index 36d3355f2fb0..866444b6c82f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | |||
@@ -271,15 +271,17 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) | |||
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) | |||
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) | |||
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) | |||
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 | |||
359 | err_remove_config_dt: | ||
360 | stmmac_remove_config_dt(pdev, plat_dat); | ||
361 | |||
362 | return err; | ||
350 | } | 363 | } |
351 | 364 | ||
352 | static const struct of_device_id ipq806x_gmac_dwmac_match[] = { | 365 | static const struct of_device_id ipq806x_gmac_dwmac_match[] = { |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c index 78e9d1861896..3d3f43d91b98 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c | |||
@@ -46,7 +46,8 @@ static int lpc18xx_dwmac_probe(struct platform_device *pdev) | |||
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) | |||
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 | |||
72 | err_remove_config_dt: | ||
73 | stmmac_remove_config_dt(pdev, plat_dat); | ||
74 | |||
75 | return ret; | ||
65 | } | 76 | } |
66 | 77 | ||
67 | static const struct of_device_id lpc18xx_dwmac_match[] = { | 78 | static const struct of_device_id lpc18xx_dwmac_match[] = { |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c index 309d99536a2c..7fdd1760a74c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | |||
@@ -64,18 +64,31 @@ static int meson6_dwmac_probe(struct platform_device *pdev) | |||
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 | |||
88 | err_remove_config_dt: | ||
89 | stmmac_remove_config_dt(pdev, plat_dat); | ||
90 | |||
91 | return ret; | ||
79 | } | 92 | } |
80 | 93 | ||
81 | static const struct of_device_id meson6_dwmac_match[] = { | 94 | static const struct of_device_id meson6_dwmac_match[] = { |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c index 250e4ceafc8d..ffaed1f35efe 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | |||
@@ -264,32 +264,48 @@ static int meson8b_dwmac_probe(struct platform_device *pdev) | |||
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 | |||
303 | err_clk_disable: | ||
304 | clk_disable_unprepare(dwmac->m25_div_clk); | ||
305 | err_remove_config_dt: | ||
306 | stmmac_remove_config_dt(pdev, plat_dat); | ||
307 | |||
308 | return ret; | ||
293 | } | 309 | } |
294 | 310 | ||
295 | static int meson8b_dwmac_remove(struct platform_device *pdev) | 311 | static int meson8b_dwmac_remove(struct platform_device *pdev) |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index 6b787d73b32a..77ab0a85f067 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | |||
@@ -939,14 +939,27 @@ static int rk_gmac_probe(struct platform_device *pdev) | |||
939 | plat_dat->fix_mac_speed = rk_fix_speed; | 939 | plat_dat->fix_mac_speed = rk_fix_speed; |
940 | 940 | ||
941 | plat_dat->bsp_priv = rk_gmac_setup(pdev, data); | 941 | plat_dat->bsp_priv = rk_gmac_setup(pdev, data); |
942 | if (IS_ERR(plat_dat->bsp_priv)) | 942 | if (IS_ERR(plat_dat->bsp_priv)) { |
943 | return PTR_ERR(plat_dat->bsp_priv); | 943 | ret = PTR_ERR(plat_dat->bsp_priv); |
944 | goto err_remove_config_dt; | ||
945 | } | ||
944 | 946 | ||
945 | ret = rk_gmac_powerup(plat_dat->bsp_priv); | 947 | ret = rk_gmac_powerup(plat_dat->bsp_priv); |
946 | if (ret) | 948 | if (ret) |
947 | return ret; | 949 | goto err_remove_config_dt; |
950 | |||
951 | ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); | ||
952 | if (ret) | ||
953 | goto err_gmac_powerdown; | ||
948 | 954 | ||
949 | return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); | 955 | return 0; |
956 | |||
957 | err_gmac_powerdown: | ||
958 | rk_gmac_powerdown(plat_dat->bsp_priv); | ||
959 | err_remove_config_dt: | ||
960 | stmmac_remove_config_dt(pdev, plat_dat); | ||
961 | |||
962 | return ret; | ||
950 | } | 963 | } |
951 | 964 | ||
952 | static int rk_gmac_remove(struct platform_device *pdev) | 965 | static int rk_gmac_remove(struct platform_device *pdev) |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 5ad1dfb40f2b..1f997027ae51 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | |||
@@ -304,6 +304,8 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) | |||
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) | |||
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 to | 340 | /* 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 handel | 341 | * 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 | |||
352 | err_dvr_remove: | ||
353 | stmmac_dvr_remove(&pdev->dev); | ||
354 | err_remove_config_dt: | ||
355 | stmmac_remove_config_dt(pdev, plat_dat); | ||
343 | 356 | ||
344 | return ret; | 357 | return ret; |
345 | } | 358 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c index c9006ab083d5..86e0e053804c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | |||
@@ -329,13 +329,15 @@ static int sti_dwmac_probe(struct platform_device *pdev) | |||
329 | return PTR_ERR(plat_dat); | 329 | return PTR_ERR(plat_dat); |
330 | 330 | ||
331 | dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); | 331 | dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); |
332 | if (!dwmac) | 332 | if (!dwmac) { |
333 | return -ENOMEM; | 333 | ret = -ENOMEM; |
334 | goto err_remove_config_dt; | ||
335 | } | ||
334 | 336 | ||
335 | ret = sti_dwmac_parse_data(dwmac, pdev); | 337 | ret = sti_dwmac_parse_data(dwmac, pdev); |
336 | if (ret) { | 338 | if (ret) { |
337 | dev_err(&pdev->dev, "Unable to parse OF data\n"); | 339 | dev_err(&pdev->dev, "Unable to parse OF data\n"); |
338 | return ret; | 340 | goto err_remove_config_dt; |
339 | } | 341 | } |
340 | 342 | ||
341 | dwmac->fix_retime_src = data->fix_retime_src; | 343 | dwmac->fix_retime_src = data->fix_retime_src; |
@@ -345,7 +347,7 @@ static int sti_dwmac_probe(struct platform_device *pdev) | |||
345 | 347 | ||
346 | ret = clk_prepare_enable(dwmac->clk); | 348 | ret = clk_prepare_enable(dwmac->clk); |
347 | if (ret) | 349 | if (ret) |
348 | return ret; | 350 | goto err_remove_config_dt; |
349 | 351 | ||
350 | ret = sti_dwmac_set_mode(dwmac); | 352 | ret = sti_dwmac_set_mode(dwmac); |
351 | if (ret) | 353 | if (ret) |
@@ -359,6 +361,9 @@ static int sti_dwmac_probe(struct platform_device *pdev) | |||
359 | 361 | ||
360 | disable_clk: | 362 | disable_clk: |
361 | clk_disable_unprepare(dwmac->clk); | 363 | clk_disable_unprepare(dwmac->clk); |
364 | err_remove_config_dt: | ||
365 | stmmac_remove_config_dt(pdev, plat_dat); | ||
366 | |||
362 | return ret; | 367 | return ret; |
363 | } | 368 | } |
364 | 369 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c index e5a926b8bee7..61cb24810d10 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | |||
@@ -107,24 +107,33 @@ static int stm32_dwmac_probe(struct platform_device *pdev) | |||
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 | |||
133 | err_clk_disable: | ||
134 | stm32_dwmac_clk_disable(dwmac); | ||
135 | err_remove_config_dt: | ||
136 | stmmac_remove_config_dt(pdev, plat_dat); | ||
128 | 137 | ||
129 | return ret; | 138 | return ret; |
130 | } | 139 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c index adff46375a32..d07520fb969e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | |||
@@ -120,22 +120,27 @@ static int sun7i_gmac_probe(struct platform_device *pdev) | |||
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) | |||
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 | |||
167 | err_gmac_exit: | ||
168 | sun7i_gmac_exit(pdev, plat_dat->bsp_priv); | ||
169 | err_remove_config_dt: | ||
170 | stmmac_remove_config_dt(pdev, plat_dat); | ||
159 | 171 | ||
160 | return ret; | 172 | return ret; |
161 | } | 173 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 48a4e841956b..982c95213da4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -3428,7 +3428,6 @@ int stmmac_dvr_remove(struct device *dev) | |||
3428 | stmmac_set_mac(priv->ioaddr, false); | 3428 | stmmac_set_mac(priv->ioaddr, false); |
3429 | netif_carrier_off(ndev); | 3429 | netif_carrier_off(ndev); |
3430 | unregister_netdev(ndev); | 3430 | unregister_netdev(ndev); |
3431 | of_node_put(priv->plat->phy_node); | ||
3432 | if (priv->stmmac_rst) | 3431 | if (priv->stmmac_rst) |
3433 | reset_control_assert(priv->stmmac_rst); | 3432 | reset_control_assert(priv->stmmac_rst); |
3434 | clk_disable_unprepare(priv->pclk); | 3433 | clk_disable_unprepare(priv->pclk); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 4d544c34c1f2..98bf86d64d96 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | |||
@@ -200,7 +200,6 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, | |||
200 | /** | 200 | /** |
201 | * stmmac_probe_config_dt - parse device-tree driver parameters | 201 | * stmmac_probe_config_dt - parse device-tree driver parameters |
202 | * @pdev: platform_device structure | 202 | * @pdev: platform_device structure |
203 | * @plat: driver data platform structure | ||
204 | * @mac: MAC address to use | 203 | * @mac: MAC address to use |
205 | * Description: | 204 | * Description: |
206 | * this function is to read the driver parameters from device-tree and | 205 | * 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) | |||
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) | |||
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 | */ | ||
339 | void 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 | #else | 348 | #else |
333 | struct plat_stmmacenet_data * | 349 | struct plat_stmmacenet_data * |
334 | stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) | 350 | stmmac_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 | |||
355 | void stmmac_remove_config_dt(struct platform_device *pdev, | ||
356 | struct plat_stmmacenet_data *plat) | ||
357 | { | ||
358 | } | ||
338 | #endif /* CONFIG_OF */ | 359 | #endif /* CONFIG_OF */ |
339 | EXPORT_SYMBOL_GPL(stmmac_probe_config_dt); | 360 | EXPORT_SYMBOL_GPL(stmmac_probe_config_dt); |
361 | EXPORT_SYMBOL_GPL(stmmac_remove_config_dt); | ||
340 | 362 | ||
341 | int stmmac_get_platform_resources(struct platform_device *pdev, | 363 | int 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) | |||
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 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h index 64e147f53a9c..b72eb0de57b7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h | |||
@@ -23,6 +23,8 @@ | |||
23 | 23 | ||
24 | struct plat_stmmacenet_data * | 24 | struct plat_stmmacenet_data * |
25 | stmmac_probe_config_dt(struct platform_device *pdev, const char **mac); | 25 | stmmac_probe_config_dt(struct platform_device *pdev, const char **mac); |
26 | void stmmac_remove_config_dt(struct platform_device *pdev, | ||
27 | struct plat_stmmacenet_data *plat); | ||
26 | 28 | ||
27 | int stmmac_get_platform_resources(struct platform_device *pdev, | 29 | int stmmac_get_platform_resources(struct platform_device *pdev, |
28 | struct stmmac_resources *stmmac_res); | 30 | struct stmmac_resources *stmmac_res); |
diff --git a/drivers/net/ethernet/synopsys/dwc_eth_qos.c b/drivers/net/ethernet/synopsys/dwc_eth_qos.c index acce385f69d4..09f5a67da35e 100644 --- a/drivers/net/ethernet/synopsys/dwc_eth_qos.c +++ b/drivers/net/ethernet/synopsys/dwc_eth_qos.c | |||
@@ -2881,7 +2881,7 @@ static int dwceqos_probe(struct platform_device *pdev) | |||
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) | |||
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) | |||
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) | |||
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) | |||
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 | ||
2943 | err_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); | ||
2943 | err_out_clk_dis_phy: | 2946 | err_out_clk_dis_phy: |
2944 | clk_disable_unprepare(lp->phy_ref_clk); | 2947 | clk_disable_unprepare(lp->phy_ref_clk); |
2945 | err_out_clk_dis_aper: | 2948 | err_out_clk_dis_aper: |
@@ -2959,8 +2962,11 @@ static int dwceqos_remove(struct platform_device *pdev) | |||
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 | ||
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index dd5d83086805..3f96c57f3580 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -2671,20 +2671,8 @@ static void cpsw_remove_dt(struct platform_device *pdev) | |||
2671 | if (strcmp(slave_node->name, "slave")) | 2671 | if (strcmp(slave_node->name, "slave")) |
2672 | continue; | 2672 | continue; |
2673 | 2673 | ||
2674 | if (of_phy_is_fixed_link(slave_node)) { | 2674 | if (of_phy_is_fixed_link(slave_node)) |
2675 | struct phy_device *phydev; | 2675 | of_phy_deregister_fixed_link(slave_node); |
2676 | |||
2677 | phydev = of_phy_find_device(slave_node); | ||
2678 | if (phydev) { | ||
2679 | fixed_phy_unregister(phydev); | ||
2680 | /* Put references taken by | ||
2681 | * of_phy_find_device() and | ||
2682 | * of_phy_register_fixed_link(). | ||
2683 | */ | ||
2684 | phy_device_free(phydev); | ||
2685 | phy_device_free(phydev); | ||
2686 | } | ||
2687 | } | ||
2688 | 2676 | ||
2689 | of_node_put(slave_data->phy_node); | 2677 | of_node_put(slave_data->phy_node); |
2690 | 2678 | ||
@@ -3155,6 +3143,8 @@ static int cpsw_resume(struct device *dev) | |||
3155 | /* Select default pin state */ | 3143 | /* Select default pin state */ |
3156 | pinctrl_pm_select_default_state(dev); | 3144 | pinctrl_pm_select_default_state(dev); |
3157 | 3145 | ||
3146 | /* shut up ASSERT_RTNL() warning in netif_set_real_num_tx/rx_queues */ | ||
3147 | rtnl_lock(); | ||
3158 | if (cpsw->data.dual_emac) { | 3148 | if (cpsw->data.dual_emac) { |
3159 | int i; | 3149 | int i; |
3160 | 3150 | ||
@@ -3166,6 +3156,8 @@ static int cpsw_resume(struct device *dev) | |||
3166 | if (netif_running(ndev)) | 3156 | if (netif_running(ndev)) |
3167 | cpsw_ndo_open(ndev); | 3157 | cpsw_ndo_open(ndev); |
3168 | } | 3158 | } |
3159 | rtnl_unlock(); | ||
3160 | |||
3169 | return 0; | 3161 | return 0; |
3170 | } | 3162 | } |
3171 | #endif | 3163 | #endif |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 84fbe5714f8b..481c7bf0395b 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1767,6 +1767,7 @@ static int davinci_emac_try_get_mac(struct platform_device *pdev, | |||
1767 | */ | 1767 | */ |
1768 | static int davinci_emac_probe(struct platform_device *pdev) | 1768 | static 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) | |||
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: | |||
1941 | cpdma_chan_destroy(priv->rxchan); | 1942 | cpdma_chan_destroy(priv->rxchan); |
1942 | cpdma_ctlr_destroy(priv->dma); | 1943 | cpdma_ctlr_destroy(priv->dma); |
1943 | no_pdata: | 1944 | no_pdata: |
1945 | if (of_phy_is_fixed_link(np)) | ||
1946 | of_phy_deregister_fixed_link(np); | ||
1947 | of_node_put(priv->phy_node); | ||
1948 | err_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) | |||
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) | |||
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; |
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index c6aa667b50cd..5430460167b5 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c | |||
@@ -497,6 +497,7 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev, | |||
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, | |||
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, | |||
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 | |||
556 | unregister_netdev: | ||
557 | unregister_netdevice(dev); | ||
558 | destroy_ipvlan_port: | ||
559 | if (create) | ||
560 | ipvlan_port_destroy(phy_dev); | ||
561 | return err; | ||
555 | } | 562 | } |
556 | 563 | ||
557 | static void ipvlan_link_delete(struct net_device *dev, struct list_head *head) | 564 | static void ipvlan_link_delete(struct net_device *dev, struct list_head *head) |
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c index 4e3d2e7c697c..e8c3a8c32534 100644 --- a/drivers/net/irda/w83977af_ir.c +++ b/drivers/net/irda/w83977af_ir.c | |||
@@ -518,7 +518,9 @@ static netdev_tx_t w83977af_hard_xmit(struct sk_buff *skb, | |||
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 */ |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 2513939bf245..52a9d811be06 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -491,7 +491,13 @@ static int macvtap_newlink(struct net *src_net, | |||
491 | /* Don't put anything that may fail after macvlan_common_newlink | 491 | /* 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 | ||
497 | static void macvtap_dellink(struct net_device *dev, | 503 | static void macvtap_dellink(struct net_device *dev, |
@@ -736,13 +742,8 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, | |||
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, | |||
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); |
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index aadd6e9f54ad..9cbe645e3d89 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c | |||
@@ -102,15 +102,19 @@ static int rtl8211f_config_init(struct phy_device *phydev) | |||
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 | } |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index e2af2dd544f0..a3ac8636f3ba 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1231,13 +1231,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
1231 | 1231 | ||
1232 | if (zerocopy) | 1232 | if (zerocopy) |
1233 | err = zerocopy_sg_from_iter(skb, from); | 1233 | err = zerocopy_sg_from_iter(skb, from); |
1234 | else { | 1234 | else |
1235 | err = skb_copy_datagram_from_iter(skb, 0, from, len); | 1235 | err = skb_copy_datagram_from_iter(skb, 0, from, len); |
1236 | if (!err && msg_control) { | ||
1237 | struct ubuf_info *uarg = msg_control; | ||
1238 | uarg->callback(uarg, false); | ||
1239 | } | ||
1240 | } | ||
1241 | 1236 | ||
1242 | if (err) { | 1237 | if (err) { |
1243 | this_cpu_inc(tun->pcpu_stats->rx_dropped); | 1238 | this_cpu_inc(tun->pcpu_stats->rx_dropped); |
@@ -1282,6 +1277,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
1282 | skb_shinfo(skb)->destructor_arg = msg_control; | 1277 | skb_shinfo(skb)->destructor_arg = msg_control; |
1283 | skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; | 1278 | skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; |
1284 | skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; | 1279 | skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; |
1280 | } else if (msg_control) { | ||
1281 | struct ubuf_info *uarg = msg_control; | ||
1282 | uarg->callback(uarg, false); | ||
1285 | } | 1283 | } |
1286 | 1284 | ||
1287 | skb_reset_network_header(skb); | 1285 | skb_reset_network_header(skb); |
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index 7363cc5dd1bf..6c646e228833 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c | |||
@@ -603,12 +603,12 @@ static void ax88772_suspend(struct usbnet *dev) | |||
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 = |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 45e5e4332a28..fe7b2886cb6b 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -388,12 +388,6 @@ void usbnet_cdc_status(struct usbnet *dev, struct urb *urb) | |||
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) | |||
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 | */ | ||
469 | void 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 | |||
469 | static const struct driver_info cdc_info = { | 493 | static 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 = { | |||
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, |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 3ff76c6db4f6..6fe1cdb0174f 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -894,6 +894,7 @@ static const struct usb_device_id products[] = { | |||
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 */ |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 21e92be6e56c..bb70dd5723b5 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -611,6 +611,7 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan, | |||
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, | |||
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, | |||
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, |
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index a7d359e9f378..145cc4b5103b 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c | |||
@@ -2238,8 +2238,9 @@ done: | |||
2238 | is_scanning_required = 1; | 2238 | is_scanning_required = 1; |
2239 | } else { | 2239 | } else { |
2240 | mwifiex_dbg(priv->adapter, MSG, | 2240 | mwifiex_dbg(priv->adapter, MSG, |
2241 | "info: trying to associate to '%s' bssid %pM\n", | 2241 | "info: trying to associate to '%.*s' bssid %pM\n", |
2242 | (char *)req_ssid.ssid, bss->bssid); | 2242 | req_ssid.ssid_len, (char *)req_ssid.ssid, |
2243 | bss->bssid); | ||
2243 | memcpy(&priv->cfg_bssid, bss->bssid, ETH_ALEN); | 2244 | memcpy(&priv->cfg_bssid, bss->bssid, ETH_ALEN); |
2244 | break; | 2245 | break; |
2245 | } | 2246 | } |
@@ -2299,8 +2300,8 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, | |||
2299 | } | 2300 | } |
2300 | 2301 | ||
2301 | mwifiex_dbg(adapter, INFO, | 2302 | mwifiex_dbg(adapter, INFO, |
2302 | "info: Trying to associate to %s and bssid %pM\n", | 2303 | "info: Trying to associate to %.*s and bssid %pM\n", |
2303 | (char *)sme->ssid, sme->bssid); | 2304 | (int)sme->ssid_len, (char *)sme->ssid, sme->bssid); |
2304 | 2305 | ||
2305 | if (!mwifiex_stop_bg_scan(priv)) | 2306 | if (!mwifiex_stop_bg_scan(priv)) |
2306 | cfg80211_sched_scan_stopped_rtnl(priv->wdev.wiphy); | 2307 | cfg80211_sched_scan_stopped_rtnl(priv->wdev.wiphy); |
@@ -2433,8 +2434,8 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, | |||
2433 | } | 2434 | } |
2434 | 2435 | ||
2435 | mwifiex_dbg(priv->adapter, MSG, | 2436 | mwifiex_dbg(priv->adapter, MSG, |
2436 | "info: trying to join to %s and bssid %pM\n", | 2437 | "info: trying to join to %.*s and bssid %pM\n", |
2437 | (char *)params->ssid, params->bssid); | 2438 | params->ssid_len, (char *)params->ssid, params->bssid); |
2438 | 2439 | ||
2439 | mwifiex_set_ibss_params(priv, params); | 2440 | mwifiex_set_ibss_params(priv, params); |
2440 | 2441 | ||
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 5a3145a02547..262281bd68fa 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -490,3 +490,18 @@ int of_phy_register_fixed_link(struct device_node *np) | |||
490 | return -ENODEV; | 490 | return -ENODEV; |
491 | } | 491 | } |
492 | EXPORT_SYMBOL(of_phy_register_fixed_link); | 492 | EXPORT_SYMBOL(of_phy_register_fixed_link); |
493 | |||
494 | void 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 | } | ||
507 | EXPORT_SYMBOL(of_phy_deregister_fixed_link); | ||
diff --git a/drivers/pci/host/pcie-designware-plat.c b/drivers/pci/host/pcie-designware-plat.c index 8df6312ed300..1a02038c4640 100644 --- a/drivers/pci/host/pcie-designware-plat.c +++ b/drivers/pci/host/pcie-designware-plat.c | |||
@@ -3,7 +3,7 @@ | |||
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 modify | 8 | * 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 as | 9 | * it under the terms of the GNU General Public License version 2 as |
diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c index db553dc22c8e..2b6a59266689 100644 --- a/drivers/pci/pcie/aer/aer_inject.c +++ b/drivers/pci/pcie/aer/aer_inject.c | |||
@@ -307,20 +307,6 @@ out: | |||
307 | return 0; | 307 | return 0; |
308 | } | 308 | } |
309 | 309 | ||
310 | static 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 | |||
324 | static int find_aer_device_iter(struct device *device, void *data) | 310 | static int find_aer_device_iter(struct device *device, void *data) |
325 | { | 311 | { |
326 | struct pcie_device **result = data; | 312 | struct pcie_device **result = data; |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index ab002671fa60..104c46d53121 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -1439,6 +1439,21 @@ static void program_hpp_type1(struct pci_dev *dev, struct hpp_type1 *hpp) | |||
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 | ||
1442 | static 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 | |||
1442 | static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp) | 1457 | static 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) | |||
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); |
diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 381871b2bb46..9d5bd7d5c610 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c | |||
@@ -474,6 +474,7 @@ static int meson_pwm_probe(struct platform_device *pdev) | |||
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; |
diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c index 0296d8178ae2..a813239300c3 100644 --- a/drivers/pwm/sysfs.c +++ b/drivers/pwm/sysfs.c | |||
@@ -425,6 +425,8 @@ void pwmchip_sysfs_unexport_children(struct pwm_chip *chip) | |||
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 | ||
430 | static int __init pwm_sysfs_init(void) | 432 | static int __init pwm_sysfs_init(void) |
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c index aebc4ddb3060..ac05317bba7f 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.c +++ b/drivers/scsi/be2iscsi/be_mgmt.c | |||
@@ -1083,7 +1083,7 @@ unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba) | |||
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); |
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index d007ec18179a..a1d6ab76a514 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -2009,7 +2009,7 @@ static struct hpsa_scsi_dev_t *lookup_hpsa_scsi_dev(struct ctlr_info *h, | |||
2009 | 2009 | ||
2010 | static int hpsa_slave_alloc(struct scsi_device *sdev) | 2010 | static 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) | |||
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 | } else | 2029 | } |
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, | |||
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, | |||
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 | else | 3941 | } 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); |
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h index 82cdfad874f3..9ea162de80dc 100644 --- a/drivers/scsi/hpsa.h +++ b/drivers/scsi/hpsa.h | |||
@@ -69,6 +69,7 @@ struct hpsa_scsi_dev_t { | |||
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 { | |||
402 | #define HPSA_RAID_VOLUME_BUS 1 | 403 | #define HPSA_RAID_VOLUME_BUS 1 |
403 | #define HPSA_EXTERNAL_RAID_VOLUME_BUS 2 | 404 | #define HPSA_EXTERNAL_RAID_VOLUME_BUS 2 |
404 | #define HPSA_HBA_BUS 0 | 405 | #define HPSA_HBA_BUS 0 |
406 | #define HPSA_LEGACY_HBA_BUS 3 | ||
405 | 407 | ||
406 | /* | 408 | /* |
407 | Send the command to the hardware | 409 | Send the command to the hardware |
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index 04ce7cfb6d1b..50c71678a156 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
@@ -308,7 +308,7 @@ struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *shost) | |||
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; |
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 91b70bc46e7f..1c4744e78173 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c | |||
@@ -3885,6 +3885,11 @@ _scsih_temp_threshold_events(struct MPT3SAS_ADAPTER *ioc, | |||
3885 | } | 3885 | } |
3886 | } | 3886 | } |
3887 | 3887 | ||
3888 | static 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 object | 3895 | * @ioc: per adapter object |
@@ -3906,6 +3911,9 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc) | |||
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) | |||
4010 | SAM_STAT_CHECK_CONDITION; | 4018 | SAM_STAT_CHECK_CONDITION; |
4011 | } | 4019 | } |
4012 | 4020 | ||
4013 | static 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 point | 4022 | * scsih_qcmd - main scsi request entry point |
4020 | * @scmd: pointer to scsi command object | 4023 | * @scmd: pointer to scsi command object |
diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c index 86eb19902bac..c7cc8035eacb 100644 --- a/drivers/scsi/mvsas/mv_sas.c +++ b/drivers/scsi/mvsas/mv_sas.c | |||
@@ -791,8 +791,10 @@ static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf | |||
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; |
diff --git a/drivers/scsi/qlogicpti.h b/drivers/scsi/qlogicpti.h index 4377e87ee79c..892a0b058b99 100644 --- a/drivers/scsi/qlogicpti.h +++ b/drivers/scsi/qlogicpti.h | |||
@@ -356,8 +356,8 @@ struct qlogicpti { | |||
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; |
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 8347c90cf483..5eb04129f938 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -808,7 +808,11 @@ calc_seckey(struct cifs_ses *ses) | |||
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) | |||
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) | |||
854 | 858 | ||
855 | out_free_cipher: | 859 | out_free_cipher: |
856 | crypto_free_skcipher(tfm_arc4); | 860 | crypto_free_skcipher(tfm_arc4); |
857 | 861 | out: | |
862 | kfree(sec_key); | ||
858 | return rc; | 863 | return rc; |
859 | } | 864 | } |
860 | 865 | ||
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 3f3185febc58..e3fed9249a04 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -3427,6 +3427,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, | |||
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, | |||
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; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index aab5227979e2..4547aeddd12b 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -412,6 +412,9 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
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) | |||
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 the | 439 | * We cannot send an echo if it is disabled. |
428 | * NEGOTIATE_PROTOCOL request is done, which is indicated by | 440 | * 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) | |||
442 | server->hostname); | 453 | server->hostname); |
443 | 454 | ||
444 | requeue_echo: | 455 | requeue_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 | ||
448 | static bool | 459 | static bool |
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c index 98b3eb7d8eaf..0ec137310320 100644 --- a/fs/isofs/rock.c +++ b/fs/isofs/rock.c | |||
@@ -377,9 +377,9 @@ repeat: | |||
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); |
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index edd46a0e951d..0e100856c7b8 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c | |||
@@ -328,11 +328,11 @@ static struct dentry *ovl_d_real(struct dentry *dentry, | |||
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); | ||
336 | bug: | 336 | bug: |
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); |
diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h index 63554e9f6e0c..59a3b2f58c22 100644 --- a/include/asm-generic/export.h +++ b/include/asm-generic/export.h | |||
@@ -54,6 +54,7 @@ KSYM(__kstrtab_\name): | |||
54 | KSYM(__kcrctab_\name): | 54 | KSYM(__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 | .previous | 58 | .previous |
58 | #endif | 59 | #endif |
59 | #endif | 60 | #endif |
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 432f5c97e18f..928e5ca0caee 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
@@ -263,7 +263,9 @@ | |||
263 | #endif | 263 | #endif |
264 | #endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP && !__CHECKER__ */ | 264 | #endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP && !__CHECKER__ */ |
265 | 265 | ||
266 | #if GCC_VERSION >= 50000 | 266 | #if GCC_VERSION >= 70000 |
267 | #define KASAN_ABI_VERSION 5 | ||
268 | #elif GCC_VERSION >= 50000 | ||
267 | #define KASAN_ABI_VERSION 4 | 269 | #define KASAN_ABI_VERSION 4 |
268 | #elif GCC_VERSION >= 40902 | 270 | #elif GCC_VERSION >= 40902 |
269 | #define KASAN_ABI_VERSION 3 | 271 | #define KASAN_ABI_VERSION 3 |
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index 2d9b650047a5..d49e26c6cdc7 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h | |||
@@ -429,6 +429,7 @@ struct intel_iommu { | |||
429 | struct page_req_dsc *prq; | 429 | struct page_req_dsc *prq; |
430 | unsigned char prq_name[16]; /* Name for PRQ interrupt */ | 430 | unsigned char prq_name[16]; /* Name for PRQ interrupt */ |
431 | struct idr pasid_idr; | 431 | struct idr pasid_idr; |
432 | u32 pasid_max; | ||
432 | #endif | 433 | #endif |
433 | struct q_inval *qi; /* Queued invalidation info */ | 434 | struct q_inval *qi; /* Queued invalidation info */ |
434 | u32 *iommu_state; /* Store iommu states between suspend and resume.*/ | 435 | u32 *iommu_state; /* Store iommu states between suspend and resume.*/ |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 3be7abd6e722..c9f379689dd0 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -476,7 +476,6 @@ enum { | |||
476 | enum { | 476 | enum { |
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 | \ |
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index 2ab233661ae5..a58cca8bcb29 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h | |||
@@ -29,6 +29,7 @@ struct phy_device *of_phy_attach(struct net_device *dev, | |||
29 | extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); | 29 | extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); |
30 | extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np); | 30 | extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np); |
31 | extern int of_phy_register_fixed_link(struct device_node *np); | 31 | extern int of_phy_register_fixed_link(struct device_node *np); |
32 | extern void of_phy_deregister_fixed_link(struct device_node *np); | ||
32 | extern bool of_phy_is_fixed_link(struct device_node *np); | 33 | extern 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) | |||
83 | { | 84 | { |
84 | return -ENOSYS; | 85 | return -ENOSYS; |
85 | } | 86 | } |
87 | static inline void of_phy_deregister_fixed_link(struct device_node *np) | ||
88 | { | ||
89 | } | ||
86 | static inline bool of_phy_is_fixed_link(struct device_node *np) | 90 | static inline bool of_phy_is_fixed_link(struct device_node *np) |
87 | { | 91 | { |
88 | return false; | 92 | return false; |
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index dd15d39e1985..7dbe9148b2f8 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
@@ -374,16 +374,13 @@ static inline struct page *read_mapping_page(struct address_space *mapping, | |||
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 | */ |
380 | static inline pgoff_t page_to_pgoff(struct page *page) | 380 | static 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 | ||
@@ -397,6 +394,18 @@ static inline pgoff_t page_to_pgoff(struct page *page) | |||
397 | } | 394 | } |
398 | 395 | ||
399 | /* | 396 | /* |
397 | * Get the offset in PAGE_SIZE. | ||
398 | * (TODO: hugepage should have ->index in PAGE_SIZE) | ||
399 | */ | ||
400 | static 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 | |||
408 | /* | ||
400 | * Return byte-offset into filesystem object for page. | 409 | * Return byte-offset into filesystem object for page. |
401 | */ | 410 | */ |
402 | static inline loff_t page_offset(struct page *page) | 411 | static inline loff_t page_offset(struct page *page) |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 0e49f70dbd9b..a38772a85588 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -1928,6 +1928,20 @@ static inline int pci_pcie_type(const struct pci_dev *dev) | |||
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 | ||
1931 | static 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 | |||
1931 | void pci_request_acs(void); | 1945 | void pci_request_acs(void); |
1932 | bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); | 1946 | bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); |
1933 | bool pci_acs_path_enabled(struct pci_dev *start, | 1947 | bool pci_acs_path_enabled(struct pci_dev *start, |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 0a3622bf086f..487e57391664 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -971,6 +971,8 @@ int compat_ipv6_setsockopt(struct sock *sk, int level, int optname, | |||
971 | int compat_ipv6_getsockopt(struct sock *sk, int level, int optname, | 971 | int compat_ipv6_getsockopt(struct sock *sk, int level, int optname, |
972 | char __user *optval, int __user *optlen); | 972 | char __user *optval, int __user *optlen); |
973 | 973 | ||
974 | int __ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, | ||
975 | int addr_len); | ||
974 | int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len); | 976 | int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len); |
975 | int ip6_datagram_connect_v6_only(struct sock *sk, struct sockaddr *addr, | 977 | int ip6_datagram_connect_v6_only(struct sock *sk, struct sockaddr *addr, |
976 | int addr_len); | 978 | int addr_len); |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 50418052a520..d9d52c020a70 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -100,6 +100,9 @@ struct nf_conn { | |||
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 { | |||
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 | }; |
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 311f02739b51..32970cba184a 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
@@ -329,7 +329,7 @@ void nft_unregister_set(struct nft_set_ops *ops); | |||
329 | * @size: maximum set size | 329 | * @size: maximum set size |
330 | * @nelems: number of elements | 330 | * @nelems: number of elements |
331 | * @ndeact: number of deactivated elements queued for removal | 331 | * @ndeact: number of deactivated elements queued for removal |
332 | * @timeout: default timeout value in msecs | 332 | * @timeout: default timeout value in jiffies |
333 | * @gc_int: garbage collection interval in msecs | 333 | * @gc_int: garbage collection interval in msecs |
334 | * @policy: set parameterization (see enum nft_set_policies) | 334 | * @policy: set parameterization (see enum nft_set_policies) |
335 | * @udlen: user data length | 335 | * @udlen: user data length |
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index d6d071fc3c56..3af60ee69053 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h | |||
@@ -640,7 +640,7 @@ | |||
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 0x275 | 643 | #define KEY_DATA 0x277 |
644 | 644 | ||
645 | #define BTN_TRIGGER_HAPPY 0x2c0 | 645 | #define BTN_TRIGGER_HAPPY 0x2c0 |
646 | #define BTN_TRIGGER_HAPPY1 0x2c0 | 646 | #define BTN_TRIGGER_HAPPY1 0x2c0 |
diff --git a/include/uapi/linux/tc_act/Kbuild b/include/uapi/linux/tc_act/Kbuild index e3969bd939e4..9611c7b6c18f 100644 --- a/include/uapi/linux/tc_act/Kbuild +++ b/include/uapi/linux/tc_act/Kbuild | |||
@@ -11,3 +11,4 @@ header-y += tc_vlan.h | |||
11 | header-y += tc_bpf.h | 11 | header-y += tc_bpf.h |
12 | header-y += tc_connmark.h | 12 | header-y += tc_connmark.h |
13 | header-y += tc_ife.h | 13 | header-y += tc_ife.h |
14 | header-y += tc_tunnel_key.h | ||
diff --git a/init/Kconfig b/init/Kconfig index 5001a576b1d7..405120b5f13e 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -1957,7 +1957,6 @@ config MODULE_FORCE_UNLOAD | |||
1957 | 1957 | ||
1958 | config MODVERSIONS | 1958 | config MODVERSIONS |
1959 | bool "Module versioning support" | 1959 | bool "Module versioning support" |
1960 | depends on BROKEN | ||
1961 | help | 1960 | help |
1962 | Usually, you have to use modules compiled with your kernel. | 1961 | Usually, you have to use modules compiled with your kernel. |
1963 | Saying Y here makes it sometimes possible to use modules | 1962 | Saying Y here makes it sometimes possible to use modules |
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 8135cb1077ee..0e742210750e 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c | |||
@@ -2508,6 +2508,7 @@ static bool states_equal(struct bpf_verifier_env *env, | |||
2508 | struct bpf_verifier_state *old, | 2508 | struct bpf_verifier_state *old, |
2509 | struct bpf_verifier_state *cur) | 2509 | struct bpf_verifier_state *cur) |
2510 | { | 2510 | { |
2511 | bool varlen_map_access = env->varlen_map_value_access; | ||
2511 | struct bpf_reg_state *rold, *rcur; | 2512 | struct bpf_reg_state *rold, *rcur; |
2512 | int i; | 2513 | int i; |
2513 | 2514 | ||
@@ -2521,12 +2522,17 @@ static bool states_equal(struct bpf_verifier_env *env, | |||
2521 | /* If the ranges were not the same, but everything else was and | 2522 | /* If the ranges were not the same, but everything else was and |
2522 | * we didn't do a variable access into a map then we are a-ok. | 2523 | * we didn't do a variable access into a map then we are a-ok. |
2523 | */ | 2524 | */ |
2524 | if (!env->varlen_map_value_access && | 2525 | if (!varlen_map_access && |
2525 | rold->type == rcur->type && rold->imm == rcur->imm) | 2526 | rold->type == rcur->type && rold->imm == rcur->imm) |
2526 | continue; | 2527 | continue; |
2527 | 2528 | ||
2529 | /* If we didn't map access then again we don't care about the | ||
2530 | * mismatched range values and it's ok if our old type was | ||
2531 | * UNKNOWN and we didn't go to a NOT_INIT'ed reg. | ||
2532 | */ | ||
2528 | if (rold->type == NOT_INIT || | 2533 | if (rold->type == NOT_INIT || |
2529 | (rold->type == UNKNOWN_VALUE && rcur->type != NOT_INIT)) | 2534 | (!varlen_map_access && rold->type == UNKNOWN_VALUE && |
2535 | rcur->type != NOT_INIT)) | ||
2530 | continue; | 2536 | continue; |
2531 | 2537 | ||
2532 | if (rold->type == PTR_TO_PACKET && rcur->type == PTR_TO_PACKET && | 2538 | if (rold->type == PTR_TO_PACKET && rcur->type == PTR_TO_PACKET && |
diff --git a/kernel/module.c b/kernel/module.c index f57dd63186e6..0e54d5bf0097 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1301,8 +1301,9 @@ static int check_version(Elf_Shdr *sechdrs, | |||
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 | ||
1307 | bad_version: | 1308 | bad_version: |
1308 | pr_warn("%s: disagrees about version of symbol %s\n", | 1309 | pr_warn("%s: disagrees about version of symbol %s\n", |
diff --git a/lib/debugobjects.c b/lib/debugobjects.c index a8e12601eb37..056052dc8e91 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c | |||
@@ -362,6 +362,7 @@ void debug_object_init(void *addr, struct debug_obj_descr *descr) | |||
362 | 362 | ||
363 | __debug_object_init(addr, descr, 0); | 363 | __debug_object_init(addr, descr, 0); |
364 | } | 364 | } |
365 | EXPORT_SYMBOL_GPL(debug_object_init); | ||
365 | 366 | ||
366 | /** | 367 | /** |
367 | * debug_object_init_on_stack - debug checks when an object on stack is | 368 | * 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) | |||
376 | 377 | ||
377 | __debug_object_init(addr, descr, 1); | 378 | __debug_object_init(addr, descr, 1); |
378 | } | 379 | } |
380 | EXPORT_SYMBOL_GPL(debug_object_init_on_stack); | ||
379 | 381 | ||
380 | /** | 382 | /** |
381 | * debug_object_activate - debug checks when an object is activated | 383 | * 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) | |||
449 | } | 451 | } |
450 | return 0; | 452 | return 0; |
451 | } | 453 | } |
454 | EXPORT_SYMBOL_GPL(debug_object_activate); | ||
452 | 455 | ||
453 | /** | 456 | /** |
454 | * debug_object_deactivate - debug checks when an object is deactivated | 457 | * 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) | |||
496 | 499 | ||
497 | raw_spin_unlock_irqrestore(&db->lock, flags); | 500 | raw_spin_unlock_irqrestore(&db->lock, flags); |
498 | } | 501 | } |
502 | EXPORT_SYMBOL_GPL(debug_object_deactivate); | ||
499 | 503 | ||
500 | /** | 504 | /** |
501 | * debug_object_destroy - debug checks when an object is destroyed | 505 | * 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) | |||
542 | out_unlock: | 546 | out_unlock: |
543 | raw_spin_unlock_irqrestore(&db->lock, flags); | 547 | raw_spin_unlock_irqrestore(&db->lock, flags); |
544 | } | 548 | } |
549 | EXPORT_SYMBOL_GPL(debug_object_destroy); | ||
545 | 550 | ||
546 | /** | 551 | /** |
547 | * debug_object_free - debug checks when an object is freed | 552 | * 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) | |||
582 | out_unlock: | 587 | out_unlock: |
583 | raw_spin_unlock_irqrestore(&db->lock, flags); | 588 | raw_spin_unlock_irqrestore(&db->lock, flags); |
584 | } | 589 | } |
590 | EXPORT_SYMBOL_GPL(debug_object_free); | ||
585 | 591 | ||
586 | /** | 592 | /** |
587 | * debug_object_assert_init - debug checks when object should be init-ed | 593 | * 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) | |||
626 | 632 | ||
627 | raw_spin_unlock_irqrestore(&db->lock, flags); | 633 | raw_spin_unlock_irqrestore(&db->lock, flags); |
628 | } | 634 | } |
635 | EXPORT_SYMBOL_GPL(debug_object_assert_init); | ||
629 | 636 | ||
630 | /** | 637 | /** |
631 | * debug_object_active_state - debug checks object usage state machine | 638 | * 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, | |||
673 | 680 | ||
674 | raw_spin_unlock_irqrestore(&db->lock, flags); | 681 | raw_spin_unlock_irqrestore(&db->lock, flags); |
675 | } | 682 | } |
683 | EXPORT_SYMBOL_GPL(debug_object_active_state); | ||
676 | 684 | ||
677 | #ifdef CONFIG_DEBUG_OBJECTS_FREE | 685 | #ifdef CONFIG_DEBUG_OBJECTS_FREE |
678 | static void __debug_check_no_obj_freed(const void *address, unsigned long size) | 686 | static void __debug_check_no_obj_freed(const void *address, unsigned long size) |
diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 5e51872b3fc1..fbdf87920093 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c | |||
@@ -20,6 +20,11 @@ | |||
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 | |||
23 | static noinline void __init kmalloc_oob_right(void) | 28 | static 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) | |||
411 | kfree(kmem); | 416 | kfree(kmem); |
412 | } | 417 | } |
413 | 418 | ||
419 | static 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 | |||
414 | static int __init kmalloc_tests_init(void) | 442 | static 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) | |||
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 | ||
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index eff3de359d50..d4a6e4001512 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1456,9 +1456,9 @@ bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, | |||
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) && |
diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c index 70c009741aab..0e9505f66ec1 100644 --- a/mm/kasan/kasan.c +++ b/mm/kasan/kasan.c | |||
@@ -764,6 +764,25 @@ EXPORT_SYMBOL(__asan_storeN_noabort); | |||
764 | void __asan_handle_no_return(void) {} | 764 | void __asan_handle_no_return(void) {} |
765 | EXPORT_SYMBOL(__asan_handle_no_return); | 765 | EXPORT_SYMBOL(__asan_handle_no_return); |
766 | 766 | ||
767 | /* Emitted by compiler to poison large objects when they go out of scope. */ | ||
768 | void __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 | } | ||
777 | EXPORT_SYMBOL(__asan_poison_stack_memory); | ||
778 | |||
779 | /* Emitted by compiler to unpoison large objects when they go into scope. */ | ||
780 | void __asan_unpoison_stack_memory(const void *addr, size_t size) | ||
781 | { | ||
782 | kasan_unpoison_shadow(addr, size); | ||
783 | } | ||
784 | EXPORT_SYMBOL(__asan_unpoison_stack_memory); | ||
785 | |||
767 | #ifdef CONFIG_MEMORY_HOTPLUG | 786 | #ifdef CONFIG_MEMORY_HOTPLUG |
768 | static int kasan_mem_notifier(struct notifier_block *nb, | 787 | static int kasan_mem_notifier(struct notifier_block *nb, |
769 | unsigned long action, void *data) | 788 | unsigned long action, void *data) |
diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index e5c2181fee6f..1c260e6b3b3c 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define KASAN_STACK_MID 0xF2 | 21 | #define KASAN_STACK_MID 0xF2 |
22 | #define KASAN_STACK_RIGHT 0xF3 | 22 | #define KASAN_STACK_RIGHT 0xF3 |
23 | #define KASAN_STACK_PARTIAL 0xF4 | 23 | #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_VERSION | 27 | #ifndef KASAN_ABI_VERSION |
@@ -53,6 +54,9 @@ struct kasan_global { | |||
53 | #if KASAN_ABI_VERSION >= 4 | 54 | #if KASAN_ABI_VERSION >= 4 |
54 | struct kasan_source_location *location; | 55 | struct kasan_source_location *location; |
55 | #endif | 56 | #endif |
57 | #if KASAN_ABI_VERSION >= 5 | ||
58 | char *odr_indicator; | ||
59 | #endif | ||
56 | }; | 60 | }; |
57 | 61 | ||
58 | /** | 62 | /** |
diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 24c1211fe9d5..073325aedc68 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c | |||
@@ -90,6 +90,9 @@ static void print_error_description(struct kasan_access_info *info) | |||
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", |
diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 728d7790dc2d..87e1a7ca3846 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c | |||
@@ -103,6 +103,7 @@ static struct khugepaged_scan khugepaged_scan = { | |||
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 | ||
106 | static ssize_t scan_sleep_millisecs_show(struct kobject *kobj, | 107 | static 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 = { | |||
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 | ||
diff --git a/mm/mlock.c b/mm/mlock.c index 145a4258ddbc..cdbed8aaa426 100644 --- a/mm/mlock.c +++ b/mm/mlock.c | |||
@@ -190,10 +190,13 @@ unsigned int munlock_vma_page(struct page *page) | |||
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)) { |
diff --git a/mm/mremap.c b/mm/mremap.c index 6ccecc03f56a..30d7d2482eea 100644 --- a/mm/mremap.c +++ b/mm/mremap.c | |||
@@ -149,14 +149,18 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, | |||
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 to | 154 | * If we are remapping a dirty PTE, make sure |
154 | * flush TLB before we drop the PTL for the | 155 | * 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); |
diff --git a/mm/truncate.c b/mm/truncate.c index a01cce450a26..8d8c62d89e6d 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -283,7 +283,7 @@ void truncate_inode_pages_range(struct address_space *mapping, | |||
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, | |||
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, | |||
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, | |||
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; |
diff --git a/net/core/flow.c b/net/core/flow.c index 3937b1b68d5b..18e8893d4be5 100644 --- a/net/core/flow.c +++ b/net/core/flow.c | |||
@@ -95,7 +95,6 @@ static void flow_cache_gc_task(struct work_struct *work) | |||
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, | |||
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 | } |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 4cb84f0449a8..c482491a63d8 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -931,8 +931,8 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev, | |||
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 */ |
diff --git a/net/core/sock.c b/net/core/sock.c index d8c7f8c877ca..9fa46b956bdc 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -715,7 +715,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, | |||
715 | val = min_t(u32, val, sysctl_wmem_max); | 715 | val = min_t(u32, val, sysctl_wmem_max); |
716 | set_sndbuf: | 716 | set_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: | |||
751 | * returning the value we actually used in getsockopt | 751 | * 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: |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index fda321d814d6..d859a5c36e70 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -694,6 +694,7 @@ int dccp_invalid_packet(struct sk_buff *skb) | |||
694 | { | 694 | { |
695 | const struct dccp_hdr *dh; | 695 | const struct dccp_hdr *dh; |
696 | unsigned int cscov; | 696 | unsigned int cscov; |
697 | u8 dccph_doff; | ||
697 | 698 | ||
698 | if (skb->pkt_type != PACKET_HOST) | 699 | if (skb->pkt_type != PACKET_HOST) |
699 | return 1; | 700 | return 1; |
@@ -715,18 +716,19 @@ int dccp_invalid_packet(struct sk_buff *skb) | |||
715 | /* | 716 | /* |
716 | * If P.Data Offset is too small for packet type, drop packet and return | 717 | * If P.Data Offset is too small for packet type, drop packet and return |
717 | */ | 718 | */ |
718 | if (dh->dccph_doff < dccp_hdr_len(skb) / sizeof(u32)) { | 719 | dccph_doff = dh->dccph_doff; |
719 | DCCP_WARN("P.Data Offset(%u) too small\n", dh->dccph_doff); | 720 | if (dccph_doff < dccp_hdr_len(skb) / sizeof(u32)) { |
721 | DCCP_WARN("P.Data Offset(%u) too small\n", dccph_doff); | ||
720 | return 1; | 722 | return 1; |
721 | } | 723 | } |
722 | /* | 724 | /* |
723 | * If P.Data Offset is too too large for packet, drop packet and return | 725 | * If P.Data Offset is too too large for packet, drop packet and return |
724 | */ | 726 | */ |
725 | if (!pskb_may_pull(skb, dh->dccph_doff * sizeof(u32))) { | 727 | if (!pskb_may_pull(skb, dccph_doff * sizeof(u32))) { |
726 | DCCP_WARN("P.Data Offset(%u) too large\n", dh->dccph_doff); | 728 | DCCP_WARN("P.Data Offset(%u) too large\n", dccph_doff); |
727 | return 1; | 729 | return 1; |
728 | } | 730 | } |
729 | 731 | dh = dccp_hdr(skb); | |
730 | /* | 732 | /* |
731 | * If P.type is not Data, Ack, or DataAck and P.X == 0 (the packet | 733 | * If P.type is not Data, Ack, or DataAck and P.X == 0 (the packet |
732 | * has short sequence numbers), drop packet and return | 734 | * has short sequence numbers), drop packet and return |
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index a6902c1e2f28..7899919cd9f0 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -233,6 +233,8 @@ int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev, | |||
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, | |||
504 | 506 | ||
505 | void dsa_cpu_dsa_destroy(struct device_node *port_dn) | 507 | void 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 | ||
518 | static void dsa_switch_destroy(struct dsa_switch *ds) | 513 | static void dsa_switch_destroy(struct dsa_switch *ds) |
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index f8a7d9aab437..5fff951a0a49 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c | |||
@@ -28,8 +28,10 @@ static struct dsa_switch_tree *dsa_get_dst(u32 tree) | |||
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 | ||
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index d0c7bce88743..68c9eea00518 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -1127,7 +1127,7 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
1127 | p->phy_interface = mode; | 1127 | p->phy_interface = mode; |
1128 | 1128 | ||
1129 | phy_dn = of_parse_phandle(port_dn, "phy-handle", 0); | 1129 | phy_dn = of_parse_phandle(port_dn, "phy-handle", 0); |
1130 | if (of_phy_is_fixed_link(port_dn)) { | 1130 | if (!phy_dn && of_phy_is_fixed_link(port_dn)) { |
1131 | /* In the case of a fixed PHY, the DT node associated | 1131 | /* In the case of a fixed PHY, the DT node associated |
1132 | * to the fixed PHY is the Port DT node | 1132 | * to the fixed PHY is the Port DT node |
1133 | */ | 1133 | */ |
@@ -1137,7 +1137,7 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
1137 | return ret; | 1137 | return ret; |
1138 | } | 1138 | } |
1139 | phy_is_fixed = true; | 1139 | phy_is_fixed = true; |
1140 | phy_dn = port_dn; | 1140 | phy_dn = of_node_get(port_dn); |
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | if (ds->ops->get_phy_flags) | 1143 | if (ds->ops->get_phy_flags) |
@@ -1156,6 +1156,7 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
1156 | ret = dsa_slave_phy_connect(p, slave_dev, phy_id); | 1156 | ret = dsa_slave_phy_connect(p, slave_dev, phy_id); |
1157 | if (ret) { | 1157 | if (ret) { |
1158 | netdev_err(slave_dev, "failed to connect to phy%d: %d\n", phy_id, ret); | 1158 | netdev_err(slave_dev, "failed to connect to phy%d: %d\n", phy_id, ret); |
1159 | of_node_put(phy_dn); | ||
1159 | return ret; | 1160 | return ret; |
1160 | } | 1161 | } |
1161 | } else { | 1162 | } else { |
@@ -1164,6 +1165,8 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
1164 | phy_flags, | 1165 | phy_flags, |
1165 | p->phy_interface); | 1166 | p->phy_interface); |
1166 | } | 1167 | } |
1168 | |||
1169 | of_node_put(phy_dn); | ||
1167 | } | 1170 | } |
1168 | 1171 | ||
1169 | if (p->phy && phy_is_fixed) | 1172 | if (p->phy && phy_is_fixed) |
@@ -1176,6 +1179,8 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
1176 | ret = dsa_slave_phy_connect(p, slave_dev, p->port); | 1179 | ret = dsa_slave_phy_connect(p, slave_dev, p->port); |
1177 | if (ret) { | 1180 | if (ret) { |
1178 | netdev_err(slave_dev, "failed to connect to port %d: %d\n", p->port, ret); | 1181 | netdev_err(slave_dev, "failed to connect to port %d: %d\n", p->port, ret); |
1182 | if (phy_is_fixed) | ||
1183 | of_phy_deregister_fixed_link(port_dn); | ||
1179 | return ret; | 1184 | return ret; |
1180 | } | 1185 | } |
1181 | } | 1186 | } |
@@ -1293,10 +1298,18 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent, | |||
1293 | void dsa_slave_destroy(struct net_device *slave_dev) | 1298 | void dsa_slave_destroy(struct net_device *slave_dev) |
1294 | { | 1299 | { |
1295 | struct dsa_slave_priv *p = netdev_priv(slave_dev); | 1300 | struct dsa_slave_priv *p = netdev_priv(slave_dev); |
1301 | struct dsa_switch *ds = p->parent; | ||
1302 | struct device_node *port_dn; | ||
1303 | |||
1304 | port_dn = ds->ports[p->port].dn; | ||
1296 | 1305 | ||
1297 | netif_carrier_off(slave_dev); | 1306 | netif_carrier_off(slave_dev); |
1298 | if (p->phy) | 1307 | if (p->phy) { |
1299 | phy_disconnect(p->phy); | 1308 | phy_disconnect(p->phy); |
1309 | |||
1310 | if (of_phy_is_fixed_link(port_dn)) | ||
1311 | of_phy_deregister_fixed_link(port_dn); | ||
1312 | } | ||
1300 | unregister_netdev(slave_dev); | 1313 | unregister_netdev(slave_dev); |
1301 | free_netdev(slave_dev); | 1314 | free_netdev(slave_dev); |
1302 | } | 1315 | } |
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 28e051a8e847..6e7baaf814c6 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig | |||
@@ -723,6 +723,7 @@ config DEFAULT_TCP_CONG | |||
723 | default "reno" if DEFAULT_RENO | 723 | default "reno" if DEFAULT_RENO |
724 | default "dctcp" if DEFAULT_DCTCP | 724 | default "dctcp" if DEFAULT_DCTCP |
725 | default "cdg" if DEFAULT_CDG | 725 | default "cdg" if DEFAULT_CDG |
726 | default "bbr" if DEFAULT_BBR | ||
726 | default "cubic" | 727 | default "cubic" |
727 | 728 | ||
728 | config TCP_MD5SIG | 729 | config TCP_MD5SIG |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 24d2550492ee..1830e6f0e9cc 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1243,7 +1243,7 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb, | |||
1243 | fixedid = !!(skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID); | 1243 | fixedid = !!(skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID); |
1244 | 1244 | ||
1245 | /* fixed ID is invalid if DF bit is not set */ | 1245 | /* fixed ID is invalid if DF bit is not set */ |
1246 | if (fixedid && !(iph->frag_off & htons(IP_DF))) | 1246 | if (fixedid && !(ip_hdr(skb)->frag_off & htons(IP_DF))) |
1247 | goto out; | 1247 | goto out; |
1248 | } | 1248 | } |
1249 | 1249 | ||
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index d95631d09248..20fb25e3027b 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -476,7 +476,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) | |||
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 | ||
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 9af2b7853be4..9ffc2625cddd 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -108,6 +108,8 @@ int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb) | |||
108 | if (unlikely(!skb)) | 108 | if (unlikely(!skb)) |
109 | return 0; | 109 | return 0; |
110 | 110 | ||
111 | skb->protocol = htons(ETH_P_IP); | ||
112 | |||
111 | return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, | 113 | return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, |
112 | net, sk, skb, NULL, skb_dst(skb)->dev, | 114 | net, sk, skb, NULL, skb_dst(skb)->dev, |
113 | dst_output); | 115 | dst_output); |
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c index c3776ff6749f..b3cc1335adbc 100644 --- a/net/ipv4/netfilter.c +++ b/net/ipv4/netfilter.c | |||
@@ -24,10 +24,11 @@ int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned int addr_t | |||
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 | else | 34 | else |
@@ -40,6 +41,8 @@ int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned int addr_t | |||
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); |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 39004da318e2..848a0704b28f 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -1197,8 +1197,8 @@ static int translate_compat_table(struct xt_table_info **pinfo, | |||
1197 | 1197 | ||
1198 | newinfo->number = compatr->num_entries; | 1198 | newinfo->number = compatr->num_entries; |
1199 | for (i = 0; i < NF_ARP_NUMHOOKS; i++) { | 1199 | for (i = 0; i < NF_ARP_NUMHOOKS; i++) { |
1200 | newinfo->hook_entry[i] = info->hook_entry[i]; | 1200 | newinfo->hook_entry[i] = compatr->hook_entry[i]; |
1201 | newinfo->underflow[i] = info->underflow[i]; | 1201 | newinfo->underflow[i] = compatr->underflow[i]; |
1202 | } | 1202 | } |
1203 | entry1 = newinfo->entries; | 1203 | entry1 = newinfo->entries; |
1204 | pos = entry1; | 1204 | pos = entry1; |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index c5d76d2edd26..0489e19258ad 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -140,7 +140,8 @@ void ip6_datagram_release_cb(struct sock *sk) | |||
140 | } | 140 | } |
141 | EXPORT_SYMBOL_GPL(ip6_datagram_release_cb); | 141 | EXPORT_SYMBOL_GPL(ip6_datagram_release_cb); |
142 | 142 | ||
143 | static int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | 143 | int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, |
144 | int addr_len) | ||
144 | { | 145 | { |
145 | struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; | 146 | struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; |
146 | struct inet_sock *inet = inet_sk(sk); | 147 | struct inet_sock *inet = inet_sk(sk); |
@@ -253,6 +254,7 @@ ipv4_connected: | |||
253 | out: | 254 | out: |
254 | return err; | 255 | return err; |
255 | } | 256 | } |
257 | EXPORT_SYMBOL_GPL(__ip6_datagram_connect); | ||
256 | 258 | ||
257 | int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | 259 | int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) |
258 | { | 260 | { |
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 218f0cba231c..cbcdd5db31f4 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -418,7 +418,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
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 | ||
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index eb948ffd734b..17fa28f7a0ff 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -448,8 +448,10 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, | |||
448 | 448 | ||
449 | if (__ipv6_addr_needs_scope_id(addr_type)) | 449 | if (__ipv6_addr_needs_scope_id(addr_type)) |
450 | iif = skb->dev->ifindex; | 450 | iif = skb->dev->ifindex; |
451 | else | 451 | else { |
452 | iif = l3mdev_master_ifindex(skb_dst(skb)->dev); | 452 | dst = skb_dst(skb); |
453 | iif = l3mdev_master_ifindex(dst ? dst->dev : skb->dev); | ||
454 | } | ||
453 | 455 | ||
454 | /* | 456 | /* |
455 | * Must not send error if the source does not uniquely | 457 | * Must not send error if the source does not uniquely |
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index 1fcf61f1cbc3..89c59e656f44 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c | |||
@@ -99,7 +99,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, | |||
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); |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 1f49fb1101a1..8b186b56183a 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1181,7 +1181,6 @@ route_lookup: | |||
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); |
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index c476bb8e9cdb..f4b4a4a5f4ba 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c | |||
@@ -1122,6 +1122,33 @@ static struct xfrm6_protocol vti_ipcomp6_protocol __read_mostly = { | |||
1122 | .priority = 100, | 1122 | .priority = 100, |
1123 | }; | 1123 | }; |
1124 | 1124 | ||
1125 | static bool is_vti6_tunnel(const struct net_device *dev) | ||
1126 | { | ||
1127 | return dev->netdev_ops == &vti6_netdev_ops; | ||
1128 | } | ||
1129 | |||
1130 | static int vti6_device_event(struct notifier_block *unused, | ||
1131 | unsigned long event, void *ptr) | ||
1132 | { | ||
1133 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); | ||
1134 | struct ip6_tnl *t = netdev_priv(dev); | ||
1135 | |||
1136 | if (!is_vti6_tunnel(dev)) | ||
1137 | return NOTIFY_DONE; | ||
1138 | |||
1139 | switch (event) { | ||
1140 | case NETDEV_DOWN: | ||
1141 | if (!net_eq(t->net, dev_net(dev))) | ||
1142 | xfrm_garbage_collect(t->net); | ||
1143 | break; | ||
1144 | } | ||
1145 | return NOTIFY_DONE; | ||
1146 | } | ||
1147 | |||
1148 | static struct notifier_block vti6_notifier_block __read_mostly = { | ||
1149 | .notifier_call = vti6_device_event, | ||
1150 | }; | ||
1151 | |||
1125 | /** | 1152 | /** |
1126 | * vti6_tunnel_init - register protocol and reserve needed resources | 1153 | * vti6_tunnel_init - register protocol and reserve needed resources |
1127 | * | 1154 | * |
@@ -1132,6 +1159,8 @@ static int __init vti6_tunnel_init(void) | |||
1132 | const char *msg; | 1159 | const char *msg; |
1133 | int err; | 1160 | int err; |
1134 | 1161 | ||
1162 | register_netdevice_notifier(&vti6_notifier_block); | ||
1163 | |||
1135 | msg = "tunnel device"; | 1164 | msg = "tunnel device"; |
1136 | err = register_pernet_device(&vti6_net_ops); | 1165 | err = register_pernet_device(&vti6_net_ops); |
1137 | if (err < 0) | 1166 | if (err < 0) |
@@ -1164,6 +1193,7 @@ xfrm_proto_ah_failed: | |||
1164 | xfrm_proto_esp_failed: | 1193 | xfrm_proto_esp_failed: |
1165 | unregister_pernet_device(&vti6_net_ops); | 1194 | unregister_pernet_device(&vti6_net_ops); |
1166 | pernet_dev_failed: | 1195 | pernet_dev_failed: |
1196 | unregister_netdevice_notifier(&vti6_notifier_block); | ||
1167 | pr_err("vti6 init: failed to register %s\n", msg); | 1197 | pr_err("vti6 init: failed to register %s\n", msg); |
1168 | return err; | 1198 | return err; |
1169 | } | 1199 | } |
@@ -1178,6 +1208,7 @@ static void __exit vti6_tunnel_cleanup(void) | |||
1178 | xfrm6_protocol_deregister(&vti_ah6_protocol, IPPROTO_AH); | 1208 | xfrm6_protocol_deregister(&vti_ah6_protocol, IPPROTO_AH); |
1179 | xfrm6_protocol_deregister(&vti_esp6_protocol, IPPROTO_ESP); | 1209 | xfrm6_protocol_deregister(&vti_esp6_protocol, IPPROTO_ESP); |
1180 | unregister_pernet_device(&vti6_net_ops); | 1210 | unregister_pernet_device(&vti6_net_ops); |
1211 | unregister_netdevice_notifier(&vti6_notifier_block); | ||
1181 | } | 1212 | } |
1182 | 1213 | ||
1183 | module_init(vti6_tunnel_init); | 1214 | module_init(vti6_tunnel_init); |
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index e4347aeb2e65..9948b5ce52da 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c | |||
@@ -576,11 +576,11 @@ int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user) | |||
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; |
diff --git a/net/ipv6/netfilter/nf_defrag_ipv6_hooks.c b/net/ipv6/netfilter/nf_defrag_ipv6_hooks.c index f7aab5ab93a5..f06b0471f39f 100644 --- a/net/ipv6/netfilter/nf_defrag_ipv6_hooks.c +++ b/net/ipv6/netfilter/nf_defrag_ipv6_hooks.c | |||
@@ -69,7 +69,7 @@ static unsigned int ipv6_defrag(void *priv, | |||
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 | ||
75 | static struct nf_hook_ops ipv6_defrag_ops[] = { | 75 | static struct nf_hook_ops ipv6_defrag_ops[] = { |
diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c index a5400223fd74..10090400c72f 100644 --- a/net/ipv6/netfilter/nf_reject_ipv6.c +++ b/net/ipv6/netfilter/nf_reject_ipv6.c | |||
@@ -156,6 +156,7 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) | |||
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) { |
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c index 7cca8ac66fe9..cd4252346a32 100644 --- a/net/ipv6/output_core.c +++ b/net/ipv6/output_core.c | |||
@@ -155,6 +155,8 @@ int __ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb) | |||
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); |
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 982f6c44ea01..8938b6ba57a0 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c | |||
@@ -61,7 +61,8 @@ static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif | |||
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: | |||
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) | |||
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,14 +278,22 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
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 | ||
@@ -296,11 +301,6 @@ out: | |||
296 | release_sock(sk); | 301 | release_sock(sk); |
297 | 302 | ||
298 | return ret; | 303 | return ret; |
299 | |||
300 | out_in_use: | ||
301 | read_unlock_bh(&l2tp_ip_lock); | ||
302 | |||
303 | return ret; | ||
304 | } | 304 | } |
305 | 305 | ||
306 | static int l2tp_ip_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | 306 | static int l2tp_ip_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) |
@@ -308,21 +308,24 @@ static int l2tp_ip_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len | |||
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 | |||
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 | ||
336 | out_sk: | ||
333 | release_sock(sk); | 337 | release_sock(sk); |
338 | |||
334 | return rc; | 339 | return rc; |
335 | } | 340 | } |
336 | 341 | ||
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index 667ec909846f..f092ac441fdd 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c | |||
@@ -72,8 +72,9 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net, | |||
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: | |||
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) | |||
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) | |||
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) | |||
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 an | 310 | /* 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) | |||
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: | |||
355 | rcu_read_unlock(); | 357 | rcu_read_unlock(); |
356 | out_unlock: | 358 | out_unlock: |
357 | release_sock(sk); | 359 | release_sock(sk); |
358 | return err; | ||
359 | 360 | ||
360 | out_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, | |||
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, | |||
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, | |||
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 | ||
408 | out_sk: | ||
404 | release_sock(sk); | 409 | release_sock(sk); |
405 | 410 | ||
406 | return rc; | 411 | return rc; |
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c index bbb8f3df79f7..5b9c884a452e 100644 --- a/net/netfilter/nf_nat_core.c +++ b/net/netfilter/nf_nat_core.c | |||
@@ -42,7 +42,7 @@ struct nf_nat_conn_key { | |||
42 | const struct nf_conntrack_zone *zone; | 42 | const struct nf_conntrack_zone *zone; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static struct rhashtable nf_nat_bysource_table; | 45 | static struct rhltable nf_nat_bysource_table; |
46 | 46 | ||
47 | inline const struct nf_nat_l3proto * | 47 | inline 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, | |||
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 | ||
201 | static struct rhashtable_params nf_nat_bysource_params = { | 204 | static struct rhashtable_params nf_nat_bysource_params = { |
@@ -204,7 +207,6 @@ static struct rhashtable_params nf_nat_bysource_params = { | |||
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, | |||
223 | .tuple = tuple, | 225 | .tuple = tuple, |
224 | .zone = zone | 226 | .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, | |||
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) | |||
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 lot | 584 | /* 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) | |||
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 | ||
705 | static struct nf_ct_ext_type nat_extend __read_mostly = { | 716 | static struct nf_ct_ext_type nat_extend __read_mostly = { |
@@ -834,13 +845,13 @@ static int __init nf_nat_init(void) | |||
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) | |||
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) | |||
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 | ||
889 | MODULE_LICENSE("GPL"); | 900 | MODULE_LICENSE("GPL"); |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 026581b04ea8..e5194f6f906c 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -2570,7 +2570,8 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, | |||
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, | |||
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, | |||
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, | |||
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, | |||
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 | } |
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c index 97ad8e30e4b4..eb2721af898d 100644 --- a/net/netfilter/nft_hash.c +++ b/net/netfilter/nft_hash.c | |||
@@ -53,6 +53,7 @@ static int nft_hash_init(const struct nft_ctx *ctx, | |||
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] || |
@@ -66,8 +67,10 @@ static int nft_hash_init(const struct nft_ctx *ctx, | |||
66 | priv->sreg = nft_parse_register(tb[NFTA_HASH_SREG]); | 67 | priv->sreg = nft_parse_register(tb[NFTA_HASH_SREG]); |
67 | priv->dreg = nft_parse_register(tb[NFTA_HASH_DREG]); | 68 | priv->dreg = nft_parse_register(tb[NFTA_HASH_DREG]); |
68 | 69 | ||
69 | len = ntohl(nla_get_be32(tb[NFTA_HASH_LEN])); | 70 | err = nft_parse_u32_check(tb[NFTA_HASH_LEN], U8_MAX, &len); |
70 | if (len == 0 || len > U8_MAX) | 71 | if (err < 0) |
72 | return err; | ||
73 | if (len == 0) | ||
71 | return -ERANGE; | 74 | return -ERANGE; |
72 | 75 | ||
73 | priv->len = len; | 76 | priv->len = len; |
diff --git a/net/netfilter/nft_range.c b/net/netfilter/nft_range.c index 009062606697..9edc74eedc10 100644 --- a/net/netfilter/nft_range.c +++ b/net/netfilter/nft_range.c | |||
@@ -59,6 +59,12 @@ static int nft_range_init(const struct nft_ctx *ctx, const struct nft_expr *expr | |||
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) |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 62bea4591054..602e5ebe9db3 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -322,14 +322,11 @@ static void netlink_skb_set_owner_r(struct sk_buff *skb, struct sock *sk) | |||
322 | sk_mem_charge(sk, skb->truesize); | 322 | sk_mem_charge(sk, skb->truesize); |
323 | } | 323 | } |
324 | 324 | ||
325 | static void netlink_sock_destruct(struct sock *sk) | 325 | static 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) | |||
346 | WARN_ON(nlk_sk(sk)->groups); | 343 | WARN_ON(nlk_sk(sk)->groups); |
347 | } | 344 | } |
348 | 345 | ||
346 | static 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 | |||
355 | static 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 on | 368 | /* 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 one | 369 | * 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 solves | 370 | * immediately hit write lock and grab all the cpus. Exclusive sleep solves |
diff --git a/net/netlink/af_netlink.h b/net/netlink/af_netlink.h index 3cfd6cc60504..4fdb38318977 100644 --- a/net/netlink/af_netlink.h +++ b/net/netlink/af_netlink.h | |||
@@ -3,6 +3,7 @@ | |||
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 { | |||
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 | ||
38 | static inline struct netlink_sock *nlk_sk(struct sock *sk) | 40 | static inline struct netlink_sock *nlk_sk(struct sock *sk) |
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index 9b8a028b7dad..6b78bab27755 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c | |||
@@ -370,8 +370,11 @@ static int handle_fragments(struct net *net, struct sw_flow_key *key, | |||
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; |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index fab9bbfdead5..89f2e8c1f4dc 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -3593,19 +3593,25 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv | |||
3593 | 3593 | ||
3594 | if (optlen != sizeof(val)) | 3594 | if (optlen != sizeof(val)) |
3595 | return -EINVAL; | 3595 | return -EINVAL; |
3596 | if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) | ||
3597 | return -EBUSY; | ||
3598 | if (copy_from_user(&val, optval, sizeof(val))) | 3596 | if (copy_from_user(&val, optval, sizeof(val))) |
3599 | return -EFAULT; | 3597 | return -EFAULT; |
3600 | switch (val) { | 3598 | switch (val) { |
3601 | case TPACKET_V1: | 3599 | case TPACKET_V1: |
3602 | case TPACKET_V2: | 3600 | case TPACKET_V2: |
3603 | case TPACKET_V3: | 3601 | case TPACKET_V3: |
3604 | po->tp_version = val; | 3602 | break; |
3605 | return 0; | ||
3606 | default: | 3603 | default: |
3607 | return -EINVAL; | 3604 | return -EINVAL; |
3608 | } | 3605 | } |
3606 | lock_sock(sk); | ||
3607 | if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { | ||
3608 | ret = -EBUSY; | ||
3609 | } else { | ||
3610 | po->tp_version = val; | ||
3611 | ret = 0; | ||
3612 | } | ||
3613 | release_sock(sk); | ||
3614 | return ret; | ||
3609 | } | 3615 | } |
3610 | case PACKET_RESERVE: | 3616 | case PACKET_RESERVE: |
3611 | { | 3617 | { |
@@ -4109,6 +4115,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, | |||
4109 | /* Added to avoid minimal code churn */ | 4115 | /* Added to avoid minimal code churn */ |
4110 | struct tpacket_req *req = &req_u->req; | 4116 | struct tpacket_req *req = &req_u->req; |
4111 | 4117 | ||
4118 | lock_sock(sk); | ||
4112 | /* Opening a Tx-ring is NOT supported in TPACKET_V3 */ | 4119 | /* Opening a Tx-ring is NOT supported in TPACKET_V3 */ |
4113 | if (!closing && tx_ring && (po->tp_version > TPACKET_V2)) { | 4120 | if (!closing && tx_ring && (po->tp_version > TPACKET_V2)) { |
4114 | net_warn_ratelimited("Tx-ring is not supported.\n"); | 4121 | net_warn_ratelimited("Tx-ring is not supported.\n"); |
@@ -4190,7 +4197,6 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, | |||
4190 | goto out; | 4197 | goto out; |
4191 | } | 4198 | } |
4192 | 4199 | ||
4193 | lock_sock(sk); | ||
4194 | 4200 | ||
4195 | /* Detach socket from network */ | 4201 | /* Detach socket from network */ |
4196 | spin_lock(&po->bind_lock); | 4202 | spin_lock(&po->bind_lock); |
@@ -4239,11 +4245,11 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, | |||
4239 | if (!tx_ring) | 4245 | if (!tx_ring) |
4240 | prb_shutdown_retire_blk_timer(po, rb_queue); | 4246 | prb_shutdown_retire_blk_timer(po, rb_queue); |
4241 | } | 4247 | } |
4242 | release_sock(sk); | ||
4243 | 4248 | ||
4244 | if (pg_vec) | 4249 | if (pg_vec) |
4245 | free_pg_vec(pg_vec, order, req->tp_block_nr); | 4250 | free_pg_vec(pg_vec, order, req->tp_block_nr); |
4246 | out: | 4251 | out: |
4252 | release_sock(sk); | ||
4247 | return err; | 4253 | return err; |
4248 | } | 4254 | } |
4249 | 4255 | ||
diff --git a/net/rds/tcp.c b/net/rds/tcp.c index 1a0399dea764..57bb52361e0f 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c | |||
@@ -665,6 +665,8 @@ out_recv: | |||
665 | out_pernet: | 665 | out_pernet: |
666 | unregister_pernet_subsys(&rds_tcp_net_ops); | 666 | unregister_pernet_subsys(&rds_tcp_net_ops); |
667 | out_slab: | 667 | out_slab: |
668 | if (unregister_netdevice_notifier(&rds_tcp_dev_notifier)) | ||
669 | pr_warn("could not unregister rds_tcp_dev_notifier\n"); | ||
668 | kmem_cache_destroy(rds_tcp_conn_slab); | 670 | kmem_cache_destroy(rds_tcp_conn_slab); |
669 | out: | 671 | out: |
670 | return ret; | 672 | return ret; |
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index eda322045e75..b27c4daec88f 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
@@ -108,6 +108,17 @@ static void tcf_pedit_cleanup(struct tc_action *a, int bind) | |||
108 | kfree(keys); | 108 | kfree(keys); |
109 | } | 109 | } |
110 | 110 | ||
111 | static 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 | |||
111 | static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a, | 122 | static 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, | |||
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, | |||
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 | ||
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index eb219b78cd49..5877f6061b57 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -62,9 +62,6 @@ static unsigned long basic_get(struct tcf_proto *tp, u32 handle) | |||
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) | |||
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 | } |
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index 28cb5fa5af92..c37aa8b77fb5 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c | |||
@@ -289,7 +289,6 @@ static bool cls_bpf_destroy(struct tcf_proto *tp, bool force) | |||
289 | call_rcu(&prog->rcu, __cls_bpf_delete_prog); | 289 | call_rcu(&prog->rcu, __cls_bpf_delete_prog); |
290 | } | 290 | } |
291 | 291 | ||
292 | RCU_INIT_POINTER(tp->root, NULL); | ||
293 | kfree_rcu(head, rcu); | 292 | kfree_rcu(head, rcu); |
294 | return true; | 293 | return true; |
295 | } | 294 | } |
@@ -300,9 +299,6 @@ static unsigned long cls_bpf_get(struct tcf_proto *tp, u32 handle) | |||
300 | struct cls_bpf_prog *prog; | 299 | struct cls_bpf_prog *prog; |
301 | unsigned long ret = 0UL; | 300 | unsigned long ret = 0UL; |
302 | 301 | ||
303 | if (head == NULL) | ||
304 | return 0UL; | ||
305 | |||
306 | list_for_each_entry(prog, &head->plist, link) { | 302 | list_for_each_entry(prog, &head->plist, link) { |
307 | if (prog->handle == handle) { | 303 | if (prog->handle == handle) { |
308 | ret = (unsigned long) prog; | 304 | ret = (unsigned long) prog; |
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index 85233c470035..c1f20077837f 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -137,11 +137,10 @@ static bool cls_cgroup_destroy(struct tcf_proto *tp, bool force) | |||
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 | ||
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index e39672394c7b..6575aba87630 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c | |||
@@ -596,7 +596,6 @@ static bool flow_destroy(struct tcf_proto *tp, bool force) | |||
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 | } |
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 1cacfa5c95f3..c5cea78491dc 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c | |||
@@ -13,6 +13,7 @@ | |||
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> |
@@ -65,7 +66,10 @@ struct cls_fl_head { | |||
65 | bool mask_assigned; | 66 | bool mask_assigned; |
66 | struct list_head filters; | 67 | struct list_head filters; |
67 | struct rhashtable_params ht_params; | 68 | struct rhashtable_params ht_params; |
68 | struct rcu_head rcu; | 69 | union { |
70 | struct work_struct work; | ||
71 | struct rcu_head rcu; | ||
72 | }; | ||
69 | }; | 73 | }; |
70 | 74 | ||
71 | struct cls_fl_filter { | 75 | struct cls_fl_filter { |
@@ -286,6 +290,24 @@ static void __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f) | |||
286 | call_rcu(&f->rcu, fl_destroy_filter); | 290 | call_rcu(&f->rcu, fl_destroy_filter); |
287 | } | 291 | } |
288 | 292 | ||
293 | static void fl_destroy_sleepable(struct work_struct *work) | ||
294 | { | ||
295 | struct cls_fl_head *head = container_of(work, struct cls_fl_head, | ||
296 | work); | ||
297 | if (head->mask_assigned) | ||
298 | rhashtable_destroy(&head->ht); | ||
299 | kfree(head); | ||
300 | module_put(THIS_MODULE); | ||
301 | } | ||
302 | |||
303 | static void fl_destroy_rcu(struct rcu_head *rcu) | ||
304 | { | ||
305 | struct cls_fl_head *head = container_of(rcu, struct cls_fl_head, rcu); | ||
306 | |||
307 | INIT_WORK(&head->work, fl_destroy_sleepable); | ||
308 | schedule_work(&head->work); | ||
309 | } | ||
310 | |||
289 | static bool fl_destroy(struct tcf_proto *tp, bool force) | 311 | static bool fl_destroy(struct tcf_proto *tp, bool force) |
290 | { | 312 | { |
291 | struct cls_fl_head *head = rtnl_dereference(tp->root); | 313 | struct cls_fl_head *head = rtnl_dereference(tp->root); |
@@ -296,10 +318,10 @@ static bool fl_destroy(struct tcf_proto *tp, bool force) | |||
296 | 318 | ||
297 | list_for_each_entry_safe(f, next, &head->filters, list) | 319 | list_for_each_entry_safe(f, next, &head->filters, list) |
298 | __fl_delete(tp, f); | 320 | __fl_delete(tp, f); |
299 | RCU_INIT_POINTER(tp->root, NULL); | 321 | |
300 | if (head->mask_assigned) | 322 | __module_get(THIS_MODULE); |
301 | rhashtable_destroy(&head->ht); | 323 | call_rcu(&head->rcu, fl_destroy_rcu); |
302 | kfree_rcu(head, rcu); | 324 | |
303 | return true; | 325 | return true; |
304 | } | 326 | } |
305 | 327 | ||
@@ -759,8 +781,9 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, | |||
759 | } | 781 | } |
760 | 782 | ||
761 | if (fold) { | 783 | if (fold) { |
762 | rhashtable_remove_fast(&head->ht, &fold->ht_node, | 784 | if (!tc_skip_sw(fold->flags)) |
763 | head->ht_params); | 785 | rhashtable_remove_fast(&head->ht, &fold->ht_node, |
786 | head->ht_params); | ||
764 | if (!tc_skip_hw(fold->flags)) | 787 | if (!tc_skip_hw(fold->flags)) |
765 | fl_hw_destroy_filter(tp, fold); | 788 | fl_hw_destroy_filter(tp, fold); |
766 | } | 789 | } |
@@ -788,8 +811,9 @@ static int fl_delete(struct tcf_proto *tp, unsigned long arg) | |||
788 | struct cls_fl_head *head = rtnl_dereference(tp->root); | 811 | struct cls_fl_head *head = rtnl_dereference(tp->root); |
789 | struct cls_fl_filter *f = (struct cls_fl_filter *) arg; | 812 | struct cls_fl_filter *f = (struct cls_fl_filter *) arg; |
790 | 813 | ||
791 | rhashtable_remove_fast(&head->ht, &f->ht_node, | 814 | if (!tc_skip_sw(f->flags)) |
792 | head->ht_params); | 815 | rhashtable_remove_fast(&head->ht, &f->ht_node, |
816 | head->ht_params); | ||
793 | __fl_delete(tp, f); | 817 | __fl_delete(tp, f); |
794 | return 0; | 818 | return 0; |
795 | } | 819 | } |
diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c index 25927b6c4436..f935429bd5ef 100644 --- a/net/sched/cls_matchall.c +++ b/net/sched/cls_matchall.c | |||
@@ -114,7 +114,6 @@ static bool mall_destroy(struct tcf_proto *tp, bool force) | |||
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 | } |
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index 4f05a19fb073..322438fb3ffc 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h | |||
@@ -152,7 +152,8 @@ static int rsvp_classify(struct sk_buff *skb, const struct tcf_proto *tp, | |||
152 | return -1; | 152 | return -1; |
153 | nhptr = ip_hdr(skb); | 153 | nhptr = ip_hdr(skb); |
154 | #endif | 154 | #endif |
155 | 155 | if (unlikely(!head)) | |
156 | return -1; | ||
156 | restart: | 157 | restart: |
157 | 158 | ||
158 | #if RSVP_DST_LEN == 4 | 159 | #if RSVP_DST_LEN == 4 |
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 96144bdf30db..0751245a6ace 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -543,7 +543,6 @@ static bool tcindex_destroy(struct tcf_proto *tp, bool force) | |||
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 | } |
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 975dbeb60ab0..52d74760fb68 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
@@ -421,6 +421,10 @@ int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b, | |||
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, | |||
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, | |||
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: |
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index 78892e2f53e3..278ff7f616f9 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h | |||
@@ -39,6 +39,7 @@ | |||
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 3 | 45 | #define MAX_MEDIA 3 |
@@ -59,6 +60,9 @@ | |||
59 | #define TIPC_MEDIA_TYPE_IB 2 | 60 | #define TIPC_MEDIA_TYPE_IB 2 |
60 | #define TIPC_MEDIA_TYPE_UDP 3 | 61 | #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 bearers | 67 | * 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, | |||
215 | void tipc_bearer_bc_xmit(struct net *net, u32 bearer_id, | 219 | void 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 */ | ||
223 | static 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 */ |
diff --git a/net/tipc/link.c b/net/tipc/link.c index ecc12411155e..bda89bf9f4ff 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -47,8 +47,8 @@ | |||
47 | #include <linux/pkt_sched.h> | 47 | #include <linux/pkt_sched.h> |
48 | 48 | ||
49 | struct tipc_stats { | 49 | struct 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) | |||
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, | |||
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, | |||
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, | |||
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) | |||
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, | |||
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) | |||
1800 | void tipc_link_reset_stats(struct tipc_link *l) | 1807 | void 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 | ||
1809 | static void link_print(struct tipc_link *l, const char *str) | 1812 | static 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) | |||
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, | |||
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, | |||
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) | |||
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); |
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c index 78cab9c5a445..b58dc95f3d35 100644 --- a/net/tipc/udp_media.c +++ b/net/tipc/udp_media.c | |||
@@ -697,6 +697,11 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b, | |||
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) |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index fd6986634e6f..5bf7e1bfeac7 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1268,12 +1268,14 @@ static struct xfrm_policy *xfrm_sk_policy_lookup(const struct sock *sk, int dir, | |||
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 | else | 1276 | } else { |
1276 | pol = ERR_PTR(err); | 1277 | pol = ERR_PTR(err); |
1278 | } | ||
1277 | } else | 1279 | } else |
1278 | pol = NULL; | 1280 | pol = NULL; |
1279 | } | 1281 | } |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 08892091cfe3..671a1d0333f0 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -2450,7 +2450,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
2450 | 2450 | ||
2451 | #ifdef CONFIG_COMPAT | 2451 | #ifdef CONFIG_COMPAT |
2452 | if (in_compat_syscall()) | 2452 | if (in_compat_syscall()) |
2453 | return -ENOTSUPP; | 2453 | return -EOPNOTSUPP; |
2454 | #endif | 2454 | #endif |
2455 | 2455 | ||
2456 | type = nlh->nlmsg_type; | 2456 | type = nlh->nlmsg_type; |
diff --git a/samples/bpf/bpf_helpers.h b/samples/bpf/bpf_helpers.h index a246c6122629..8370a6e3839d 100644 --- a/samples/bpf/bpf_helpers.h +++ b/samples/bpf/bpf_helpers.h | |||
@@ -117,7 +117,7 @@ static int (*bpf_skb_change_head)(void *, int len, int flags) = | |||
117 | #define PT_REGS_FP(x) ((x)->gprs[11]) /* Works only with CONFIG_FRAME_POINTER */ | 117 | #define PT_REGS_FP(x) ((x)->gprs[11]) /* Works only with CONFIG_FRAME_POINTER */ |
118 | #define PT_REGS_RC(x) ((x)->gprs[2]) | 118 | #define PT_REGS_RC(x) ((x)->gprs[2]) |
119 | #define PT_REGS_SP(x) ((x)->gprs[15]) | 119 | #define PT_REGS_SP(x) ((x)->gprs[15]) |
120 | #define PT_REGS_IP(x) ((x)->ip) | 120 | #define PT_REGS_IP(x) ((x)->psw.addr) |
121 | 121 | ||
122 | #elif defined(__aarch64__) | 122 | #elif defined(__aarch64__) |
123 | 123 | ||
diff --git a/samples/bpf/sampleip_kern.c b/samples/bpf/sampleip_kern.c index 774a681f374a..ceabf31079cf 100644 --- a/samples/bpf/sampleip_kern.c +++ b/samples/bpf/sampleip_kern.c | |||
@@ -25,7 +25,7 @@ int do_sample(struct bpf_perf_event_data *ctx) | |||
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; |
diff --git a/samples/bpf/trace_event_kern.c b/samples/bpf/trace_event_kern.c index 71a8ed32823e..41b6115a32eb 100644 --- a/samples/bpf/trace_event_kern.c +++ b/samples/bpf/trace_event_kern.c | |||
@@ -50,7 +50,7 @@ int bpf_prog1(struct bpf_perf_event_data *ctx) | |||
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 | ||
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index ebced77deb9c..90a091b6ae4d 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -35,6 +35,8 @@ nconfig: $(obj)/nconf | |||
35 | 35 | ||
36 | silentoldconfig: $(obj)/conf | 36 | silentoldconfig: $(obj)/conf |
37 | $(Q)mkdir -p include/config include/generated | 37 | $(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 | ||
40 | localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | 42 | localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf |
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index 0190cb6332f2..3fe4468ea2c5 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c | |||
@@ -304,7 +304,7 @@ struct snd_dbri { | |||
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) | |||
657 | */ | 657 | */ |
658 | static s32 *dbri_cmdlock(struct snd_dbri *dbri, int len) | 658 | static 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 | else | 669 | 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) | |||
680 | */ | 682 | */ |
681 | static void dbri_cmdsend(struct snd_dbri *dbri, s32 *cmd, int len) | 683 | static 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) | |||
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) | |||
747 | /* Lock must not be held before calling this */ | 750 | /* Lock must not be held before calling this */ |
748 | static void dbri_initialize(struct snd_dbri *dbri) | 751 | static 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) | |||
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) | |||
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) | |||
1077 | static int setup_descs(struct snd_dbri *dbri, int streamno, unsigned int period) | 1081 | static 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) | |||
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) | |||
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. | |||
1697 | static void xmit_descs(struct snd_dbri *dbri) | 1702 | static 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) | |||
1718 | *(cmd++) = DBRI_CMD(D_SDP, 0, | 1724 | *(cmd++) = DBRI_CMD(D_SDP, 0, |
1719 | dbri->pipes[info->pipe].sdp | 1725 | 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) | |||
1740 | *(cmd++) = DBRI_CMD(D_SDP, 0, | 1746 | *(cmd++) = DBRI_CMD(D_SDP, 0, |
1741 | dbri->pipes[info->pipe].sdp | 1747 | 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, | |||
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. */ |
diff --git a/virt/kvm/arm/vgic/vgic-v2.c b/virt/kvm/arm/vgic/vgic-v2.c index 0a063af40565..9bab86757fa4 100644 --- a/virt/kvm/arm/vgic/vgic-v2.c +++ b/virt/kvm/arm/vgic/vgic-v2.c | |||
@@ -50,8 +50,10 @@ void vgic_v2_process_maintenance(struct kvm_vcpu *vcpu) | |||
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 | ||
diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c index 9f0dae397d9c..5c9f9745e6ca 100644 --- a/virt/kvm/arm/vgic/vgic-v3.c +++ b/virt/kvm/arm/vgic/vgic-v3.c | |||
@@ -41,8 +41,10 @@ void vgic_v3_process_maintenance(struct kvm_vcpu *vcpu) | |||
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 | /* |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 5c360347a1e9..7f9ee2929cfe 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -2889,10 +2889,10 @@ static int kvm_ioctl_create_device(struct kvm *kvm, | |||
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 | ||