summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-01-24 23:44:15 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-24 23:44:15 -0500
commit955bd1d216c6ce4f40b181cfd369f4116e0627f2 (patch)
treed3f2669d3abb1c53c2f364732e8122ce0f25e3da
parentbe1b6e8b5470e8311bfa1a3dfd7bd59e85a99759 (diff)
parent5b7d27967dabfb17c21b0d98b29153b9e3ee71e5 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--MAINTAINERS12
-rw-r--r--arch/sparc/crypto/Makefile2
-rw-r--r--arch/x86/kernel/Makefile5
-rw-r--r--arch/x86/kernel/ftrace_64.S24
-rw-r--r--arch/x86/kernel/unwind_orc.c48
-rw-r--r--arch/x86/pci/fixup.c32
-rw-r--r--drivers/net/ethernet/ibm/emac/core.c6
-rw-r--r--drivers/net/ethernet/ibm/emac/emac.h4
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c10
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_rdma.c31
-rw-r--r--drivers/net/ppp/pppoe.c11
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c2
-rw-r--r--drivers/vhost/vhost.c6
-rw-r--r--include/linux/ftrace.h2
-rw-r--r--include/linux/vermagic.h8
-rw-r--r--include/net/ipv6.h1
-rw-r--r--include/net/pkt_cls.h2
-rw-r--r--kernel/trace/ftrace.c29
-rw-r--r--kernel/trace/trace.c34
-rw-r--r--kernel/trace/trace_events_trigger.c13
-rw-r--r--kernel/trace/trace_functions.c49
-rw-r--r--net/ipv4/xfrm4_mode_tunnel.c1
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/ipv6_sockglue.c2
-rw-r--r--net/ipv6/xfrm6_mode_tunnel.c1
-rw-r--r--net/kcm/kcmsock.c25
-rw-r--r--net/sched/em_nbyte.c2
-rw-r--r--net/xfrm/xfrm_device.c1
-rw-r--r--net/xfrm/xfrm_state.c12
-rw-r--r--net/xfrm/xfrm_user.c18
31 files changed, 274 insertions, 123 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 7ec1b088c07f..51e3a0d503dc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -62,7 +62,15 @@ trivial patch so apply some common sense.
62 62
637. When sending security related changes or reports to a maintainer 637. When sending security related changes or reports to a maintainer
64 please Cc: security@kernel.org, especially if the maintainer 64 please Cc: security@kernel.org, especially if the maintainer
65 does not respond. 65 does not respond. Please keep in mind that the security team is
66 a small set of people who can be efficient only when working on
67 verified bugs. Please only Cc: this list when you have identified
68 that the bug would present a short-term risk to other users if it
69 were publicly disclosed. For example, reports of address leaks do
70 not represent an immediate threat and are better handled publicly,
71 and ideally, should come with a patch proposal. Please do not send
72 automated reports to this list either. Such bugs will be handled
73 better and faster in the usual public places.
66 74
678. Happy hacking. 758. Happy hacking.
68 76
@@ -12253,7 +12261,7 @@ M: Security Officers <security@kernel.org>
12253S: Supported 12261S: Supported
12254 12262
12255SECURITY SUBSYSTEM 12263SECURITY SUBSYSTEM
12256M: James Morris <james.l.morris@oracle.com> 12264M: James Morris <jmorris@namei.org>
12257M: "Serge E. Hallyn" <serge@hallyn.com> 12265M: "Serge E. Hallyn" <serge@hallyn.com>
12258L: linux-security-module@vger.kernel.org (suggested Cc:) 12266L: linux-security-module@vger.kernel.org (suggested Cc:)
12259T: git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git 12267T: git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git
diff --git a/arch/sparc/crypto/Makefile b/arch/sparc/crypto/Makefile
index 818d3aa5172e..d257186c27d1 100644
--- a/arch/sparc/crypto/Makefile
+++ b/arch/sparc/crypto/Makefile
@@ -10,7 +10,7 @@ obj-$(CONFIG_CRYPTO_MD5_SPARC64) += md5-sparc64.o
10 10
11obj-$(CONFIG_CRYPTO_AES_SPARC64) += aes-sparc64.o 11obj-$(CONFIG_CRYPTO_AES_SPARC64) += aes-sparc64.o
12obj-$(CONFIG_CRYPTO_DES_SPARC64) += des-sparc64.o 12obj-$(CONFIG_CRYPTO_DES_SPARC64) += des-sparc64.o
13obj-$(CONFIG_CRYPTO_DES_SPARC64) += camellia-sparc64.o 13obj-$(CONFIG_CRYPTO_CAMELLIA_SPARC64) += camellia-sparc64.o
14 14
15obj-$(CONFIG_CRYPTO_CRC32C_SPARC64) += crc32c-sparc64.o 15obj-$(CONFIG_CRYPTO_CRC32C_SPARC64) += crc32c-sparc64.o
16 16
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 81bb565f4497..7e2baf7304ae 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -29,10 +29,13 @@ KASAN_SANITIZE_stacktrace.o := n
29KASAN_SANITIZE_paravirt.o := n 29KASAN_SANITIZE_paravirt.o := n
30 30
31OBJECT_FILES_NON_STANDARD_relocate_kernel_$(BITS).o := y 31OBJECT_FILES_NON_STANDARD_relocate_kernel_$(BITS).o := y
32OBJECT_FILES_NON_STANDARD_ftrace_$(BITS).o := y
33OBJECT_FILES_NON_STANDARD_test_nx.o := y 32OBJECT_FILES_NON_STANDARD_test_nx.o := y
34OBJECT_FILES_NON_STANDARD_paravirt_patch_$(BITS).o := y 33OBJECT_FILES_NON_STANDARD_paravirt_patch_$(BITS).o := y
35 34
35ifdef CONFIG_FRAME_POINTER
36OBJECT_FILES_NON_STANDARD_ftrace_$(BITS).o := y
37endif
38
36# If instrumentation of this dir is enabled, boot hangs during first second. 39# If instrumentation of this dir is enabled, boot hangs during first second.
37# Probably could be more selective here, but note that files related to irqs, 40# Probably could be more selective here, but note that files related to irqs,
38# boot, dumpstack/stacktrace, etc are either non-interesting or can lead to 41# boot, dumpstack/stacktrace, etc are either non-interesting or can lead to
diff --git a/arch/x86/kernel/ftrace_64.S b/arch/x86/kernel/ftrace_64.S
index 7cb8ba08beb9..ef61f540cf0a 100644
--- a/arch/x86/kernel/ftrace_64.S
+++ b/arch/x86/kernel/ftrace_64.S
@@ -8,6 +8,7 @@
8#include <asm/ftrace.h> 8#include <asm/ftrace.h>
9#include <asm/export.h> 9#include <asm/export.h>
10#include <asm/nospec-branch.h> 10#include <asm/nospec-branch.h>
11#include <asm/unwind_hints.h>
11 12
12 .code64 13 .code64
13 .section .entry.text, "ax" 14 .section .entry.text, "ax"
@@ -20,7 +21,6 @@ EXPORT_SYMBOL(__fentry__)
20EXPORT_SYMBOL(mcount) 21EXPORT_SYMBOL(mcount)
21#endif 22#endif
22 23
23/* All cases save the original rbp (8 bytes) */
24#ifdef CONFIG_FRAME_POINTER 24#ifdef CONFIG_FRAME_POINTER
25# ifdef CC_USING_FENTRY 25# ifdef CC_USING_FENTRY
26/* Save parent and function stack frames (rip and rbp) */ 26/* Save parent and function stack frames (rip and rbp) */
@@ -31,7 +31,7 @@ EXPORT_SYMBOL(mcount)
31# endif 31# endif
32#else 32#else
33/* No need to save a stack frame */ 33/* No need to save a stack frame */
34# define MCOUNT_FRAME_SIZE 8 34# define MCOUNT_FRAME_SIZE 0
35#endif /* CONFIG_FRAME_POINTER */ 35#endif /* CONFIG_FRAME_POINTER */
36 36
37/* Size of stack used to save mcount regs in save_mcount_regs */ 37/* Size of stack used to save mcount regs in save_mcount_regs */
@@ -64,10 +64,10 @@ EXPORT_SYMBOL(mcount)
64 */ 64 */
65.macro save_mcount_regs added=0 65.macro save_mcount_regs added=0
66 66
67 /* Always save the original rbp */ 67#ifdef CONFIG_FRAME_POINTER
68 /* Save the original rbp */
68 pushq %rbp 69 pushq %rbp
69 70
70#ifdef CONFIG_FRAME_POINTER
71 /* 71 /*
72 * Stack traces will stop at the ftrace trampoline if the frame pointer 72 * Stack traces will stop at the ftrace trampoline if the frame pointer
73 * is not set up properly. If fentry is used, we need to save a frame 73 * is not set up properly. If fentry is used, we need to save a frame
@@ -105,7 +105,11 @@ EXPORT_SYMBOL(mcount)
105 * Save the original RBP. Even though the mcount ABI does not 105 * Save the original RBP. Even though the mcount ABI does not
106 * require this, it helps out callers. 106 * require this, it helps out callers.
107 */ 107 */
108#ifdef CONFIG_FRAME_POINTER
108 movq MCOUNT_REG_SIZE-8(%rsp), %rdx 109 movq MCOUNT_REG_SIZE-8(%rsp), %rdx
110#else
111 movq %rbp, %rdx
112#endif
109 movq %rdx, RBP(%rsp) 113 movq %rdx, RBP(%rsp)
110 114
111 /* Copy the parent address into %rsi (second parameter) */ 115 /* Copy the parent address into %rsi (second parameter) */
@@ -148,7 +152,7 @@ EXPORT_SYMBOL(mcount)
148 152
149ENTRY(function_hook) 153ENTRY(function_hook)
150 retq 154 retq
151END(function_hook) 155ENDPROC(function_hook)
152 156
153ENTRY(ftrace_caller) 157ENTRY(ftrace_caller)
154 /* save_mcount_regs fills in first two parameters */ 158 /* save_mcount_regs fills in first two parameters */
@@ -184,7 +188,7 @@ GLOBAL(ftrace_graph_call)
184/* This is weak to keep gas from relaxing the jumps */ 188/* This is weak to keep gas from relaxing the jumps */
185WEAK(ftrace_stub) 189WEAK(ftrace_stub)
186 retq 190 retq
187END(ftrace_caller) 191ENDPROC(ftrace_caller)
188 192
189ENTRY(ftrace_regs_caller) 193ENTRY(ftrace_regs_caller)
190 /* Save the current flags before any operations that can change them */ 194 /* Save the current flags before any operations that can change them */
@@ -255,7 +259,7 @@ GLOBAL(ftrace_regs_caller_end)
255 259
256 jmp ftrace_epilogue 260 jmp ftrace_epilogue
257 261
258END(ftrace_regs_caller) 262ENDPROC(ftrace_regs_caller)
259 263
260 264
261#else /* ! CONFIG_DYNAMIC_FTRACE */ 265#else /* ! CONFIG_DYNAMIC_FTRACE */
@@ -313,9 +317,10 @@ ENTRY(ftrace_graph_caller)
313 restore_mcount_regs 317 restore_mcount_regs
314 318
315 retq 319 retq
316END(ftrace_graph_caller) 320ENDPROC(ftrace_graph_caller)
317 321
318GLOBAL(return_to_handler) 322ENTRY(return_to_handler)
323 UNWIND_HINT_EMPTY
319 subq $24, %rsp 324 subq $24, %rsp
320 325
321 /* Save the return values */ 326 /* Save the return values */
@@ -330,4 +335,5 @@ GLOBAL(return_to_handler)
330 movq (%rsp), %rax 335 movq (%rsp), %rax
331 addq $24, %rsp 336 addq $24, %rsp
332 JMP_NOSPEC %rdi 337 JMP_NOSPEC %rdi
338END(return_to_handler)
333#endif 339#endif
diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index be86a865087a..1f9188f5357c 100644
--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -74,8 +74,50 @@ static struct orc_entry *orc_module_find(unsigned long ip)
74} 74}
75#endif 75#endif
76 76
77#ifdef CONFIG_DYNAMIC_FTRACE
78static struct orc_entry *orc_find(unsigned long ip);
79
80/*
81 * Ftrace dynamic trampolines do not have orc entries of their own.
82 * But they are copies of the ftrace entries that are static and
83 * defined in ftrace_*.S, which do have orc entries.
84 *
85 * If the undwinder comes across a ftrace trampoline, then find the
86 * ftrace function that was used to create it, and use that ftrace
87 * function's orc entrie, as the placement of the return code in
88 * the stack will be identical.
89 */
90static struct orc_entry *orc_ftrace_find(unsigned long ip)
91{
92 struct ftrace_ops *ops;
93 unsigned long caller;
94
95 ops = ftrace_ops_trampoline(ip);
96 if (!ops)
97 return NULL;
98
99 if (ops->flags & FTRACE_OPS_FL_SAVE_REGS)
100 caller = (unsigned long)ftrace_regs_call;
101 else
102 caller = (unsigned long)ftrace_call;
103
104 /* Prevent unlikely recursion */
105 if (ip == caller)
106 return NULL;
107
108 return orc_find(caller);
109}
110#else
111static struct orc_entry *orc_ftrace_find(unsigned long ip)
112{
113 return NULL;
114}
115#endif
116
77static struct orc_entry *orc_find(unsigned long ip) 117static struct orc_entry *orc_find(unsigned long ip)
78{ 118{
119 static struct orc_entry *orc;
120
79 if (!orc_init) 121 if (!orc_init)
80 return NULL; 122 return NULL;
81 123
@@ -111,7 +153,11 @@ static struct orc_entry *orc_find(unsigned long ip)
111 __stop_orc_unwind_ip - __start_orc_unwind_ip, ip); 153 __stop_orc_unwind_ip - __start_orc_unwind_ip, ip);
112 154
113 /* Module lookup: */ 155 /* Module lookup: */
114 return orc_module_find(ip); 156 orc = orc_module_find(ip);
157 if (orc)
158 return orc;
159
160 return orc_ftrace_find(ip);
115} 161}
116 162
117static void orc_sort_swap(void *_a, void *_b, int size) 163static void orc_sort_swap(void *_a, void *_b, int size)
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index f6a26e3cb476..54ef19e90705 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -662,11 +662,11 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2033, quirk_no_aersid);
662 */ 662 */
663static void pci_amd_enable_64bit_bar(struct pci_dev *dev) 663static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
664{ 664{
665 static const char *name = "PCI Bus 0000:00";
666 struct resource *res, *conflict;
665 u32 base, limit, high; 667 u32 base, limit, high;
666 struct pci_dev *other; 668 struct pci_dev *other;
667 struct resource *res;
668 unsigned i; 669 unsigned i;
669 int r;
670 670
671 if (!(pci_probe & PCI_BIG_ROOT_WINDOW)) 671 if (!(pci_probe & PCI_BIG_ROOT_WINDOW))
672 return; 672 return;
@@ -707,21 +707,26 @@ static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
707 * Allocate a 256GB window directly below the 0xfd00000000 hardware 707 * Allocate a 256GB window directly below the 0xfd00000000 hardware
708 * limit (see AMD Family 15h Models 30h-3Fh BKDG, sec 2.4.6). 708 * limit (see AMD Family 15h Models 30h-3Fh BKDG, sec 2.4.6).
709 */ 709 */
710 res->name = "PCI Bus 0000:00"; 710 res->name = name;
711 res->flags = IORESOURCE_PREFETCH | IORESOURCE_MEM | 711 res->flags = IORESOURCE_PREFETCH | IORESOURCE_MEM |
712 IORESOURCE_MEM_64 | IORESOURCE_WINDOW; 712 IORESOURCE_MEM_64 | IORESOURCE_WINDOW;
713 res->start = 0xbd00000000ull; 713 res->start = 0xbd00000000ull;
714 res->end = 0xfd00000000ull - 1; 714 res->end = 0xfd00000000ull - 1;
715 715
716 r = request_resource(&iomem_resource, res); 716 conflict = request_resource_conflict(&iomem_resource, res);
717 if (r) { 717 if (conflict) {
718 kfree(res); 718 kfree(res);
719 return; 719 if (conflict->name != name)
720 } 720 return;
721 721
722 dev_info(&dev->dev, "adding root bus resource %pR (tainting kernel)\n", 722 /* We are resuming from suspend; just reenable the window */
723 res); 723 res = conflict;
724 add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); 724 } else {
725 dev_info(&dev->dev, "adding root bus resource %pR (tainting kernel)\n",
726 res);
727 add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
728 pci_bus_add_resource(dev->bus, res, 0);
729 }
725 730
726 base = ((res->start >> 8) & AMD_141b_MMIO_BASE_MMIOBASE_MASK) | 731 base = ((res->start >> 8) & AMD_141b_MMIO_BASE_MMIOBASE_MASK) |
727 AMD_141b_MMIO_BASE_RE_MASK | AMD_141b_MMIO_BASE_WE_MASK; 732 AMD_141b_MMIO_BASE_RE_MASK | AMD_141b_MMIO_BASE_WE_MASK;
@@ -733,13 +738,16 @@ static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
733 pci_write_config_dword(dev, AMD_141b_MMIO_HIGH(i), high); 738 pci_write_config_dword(dev, AMD_141b_MMIO_HIGH(i), high);
734 pci_write_config_dword(dev, AMD_141b_MMIO_LIMIT(i), limit); 739 pci_write_config_dword(dev, AMD_141b_MMIO_LIMIT(i), limit);
735 pci_write_config_dword(dev, AMD_141b_MMIO_BASE(i), base); 740 pci_write_config_dword(dev, AMD_141b_MMIO_BASE(i), base);
736
737 pci_bus_add_resource(dev->bus, res, 0);
738} 741}
739DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1401, pci_amd_enable_64bit_bar); 742DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1401, pci_amd_enable_64bit_bar);
740DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x141b, pci_amd_enable_64bit_bar); 743DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x141b, pci_amd_enable_64bit_bar);
741DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1571, pci_amd_enable_64bit_bar); 744DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1571, pci_amd_enable_64bit_bar);
742DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15b1, pci_amd_enable_64bit_bar); 745DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15b1, pci_amd_enable_64bit_bar);
743DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1601, pci_amd_enable_64bit_bar); 746DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1601, pci_amd_enable_64bit_bar);
747DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1401, pci_amd_enable_64bit_bar);
748DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x141b, pci_amd_enable_64bit_bar);
749DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1571, pci_amd_enable_64bit_bar);
750DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x15b1, pci_amd_enable_64bit_bar);
751DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1601, pci_amd_enable_64bit_bar);
744 752
745#endif 753#endif
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index 71ddad13baf4..354c0982847b 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -494,6 +494,9 @@ static u32 __emac_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_s
494 case 16384: 494 case 16384:
495 ret |= EMAC_MR1_RFS_16K; 495 ret |= EMAC_MR1_RFS_16K;
496 break; 496 break;
497 case 8192:
498 ret |= EMAC4_MR1_RFS_8K;
499 break;
497 case 4096: 500 case 4096:
498 ret |= EMAC_MR1_RFS_4K; 501 ret |= EMAC_MR1_RFS_4K;
499 break; 502 break;
@@ -516,6 +519,9 @@ static u32 __emac4_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_
516 case 16384: 519 case 16384:
517 ret |= EMAC4_MR1_TFS_16K; 520 ret |= EMAC4_MR1_TFS_16K;
518 break; 521 break;
522 case 8192:
523 ret |= EMAC4_MR1_TFS_8K;
524 break;
519 case 4096: 525 case 4096:
520 ret |= EMAC4_MR1_TFS_4K; 526 ret |= EMAC4_MR1_TFS_4K;
521 break; 527 break;
diff --git a/drivers/net/ethernet/ibm/emac/emac.h b/drivers/net/ethernet/ibm/emac/emac.h
index bc14dcf27b6b..e2f80cca9bed 100644
--- a/drivers/net/ethernet/ibm/emac/emac.h
+++ b/drivers/net/ethernet/ibm/emac/emac.h
@@ -138,9 +138,11 @@ struct emac_regs {
138 138
139#define EMAC4_MR1_RFS_2K 0x00100000 139#define EMAC4_MR1_RFS_2K 0x00100000
140#define EMAC4_MR1_RFS_4K 0x00180000 140#define EMAC4_MR1_RFS_4K 0x00180000
141#define EMAC4_MR1_RFS_8K 0x00200000
141#define EMAC4_MR1_RFS_16K 0x00280000 142#define EMAC4_MR1_RFS_16K 0x00280000
142#define EMAC4_MR1_TFS_2K 0x00020000 143#define EMAC4_MR1_TFS_2K 0x00020000
143#define EMAC4_MR1_TFS_4K 0x00030000 144#define EMAC4_MR1_TFS_4K 0x00030000
145#define EMAC4_MR1_TFS_8K 0x00040000
144#define EMAC4_MR1_TFS_16K 0x00050000 146#define EMAC4_MR1_TFS_16K 0x00050000
145#define EMAC4_MR1_TR 0x00008000 147#define EMAC4_MR1_TR 0x00008000
146#define EMAC4_MR1_MWSW_001 0x00001000 148#define EMAC4_MR1_MWSW_001 0x00001000
@@ -229,7 +231,7 @@ struct emac_regs {
229#define EMAC_STACR_PHYE 0x00004000 231#define EMAC_STACR_PHYE 0x00004000
230#define EMAC_STACR_STAC_MASK 0x00003000 232#define EMAC_STACR_STAC_MASK 0x00003000
231#define EMAC_STACR_STAC_READ 0x00001000 233#define EMAC_STACR_STAC_READ 0x00001000
232#define EMAC_STACR_STAC_WRITE 0x00002000 234#define EMAC_STACR_STAC_WRITE 0x00000800
233#define EMAC_STACR_OPBC_MASK 0x00000C00 235#define EMAC_STACR_OPBC_MASK 0x00000C00
234#define EMAC_STACR_OPBC_50 0x00000000 236#define EMAC_STACR_OPBC_50 0x00000000
235#define EMAC_STACR_OPBC_66 0x00000400 237#define EMAC_STACR_OPBC_66 0x00000400
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 0988c90f53dd..a222d691958d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -7437,6 +7437,8 @@ static int i40e_setup_tc_cls_flower(struct i40e_netdev_priv *np,
7437{ 7437{
7438 struct i40e_vsi *vsi = np->vsi; 7438 struct i40e_vsi *vsi = np->vsi;
7439 7439
7440 if (!tc_can_offload(vsi->netdev))
7441 return -EOPNOTSUPP;
7440 if (cls_flower->common.chain_index) 7442 if (cls_flower->common.chain_index)
7441 return -EOPNOTSUPP; 7443 return -EOPNOTSUPP;
7442 7444
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 91170d940268..f0b25baba09a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -1968,11 +1968,8 @@ static void mlxsw_sp_router_neigh_ent_ipv4_process(struct mlxsw_sp *mlxsw_sp,
1968 dipn = htonl(dip); 1968 dipn = htonl(dip);
1969 dev = mlxsw_sp->router->rifs[rif]->dev; 1969 dev = mlxsw_sp->router->rifs[rif]->dev;
1970 n = neigh_lookup(&arp_tbl, &dipn, dev); 1970 n = neigh_lookup(&arp_tbl, &dipn, dev);
1971 if (!n) { 1971 if (!n)
1972 netdev_err(dev, "Failed to find matching neighbour for IP=%pI4h\n",
1973 &dip);
1974 return; 1972 return;
1975 }
1976 1973
1977 netdev_dbg(dev, "Updating neighbour with IP=%pI4h\n", &dip); 1974 netdev_dbg(dev, "Updating neighbour with IP=%pI4h\n", &dip);
1978 neigh_event_send(n, NULL); 1975 neigh_event_send(n, NULL);
@@ -1999,11 +1996,8 @@ static void mlxsw_sp_router_neigh_ent_ipv6_process(struct mlxsw_sp *mlxsw_sp,
1999 1996
2000 dev = mlxsw_sp->router->rifs[rif]->dev; 1997 dev = mlxsw_sp->router->rifs[rif]->dev;
2001 n = neigh_lookup(&nd_tbl, &dip, dev); 1998 n = neigh_lookup(&nd_tbl, &dip, dev);
2002 if (!n) { 1999 if (!n)
2003 netdev_err(dev, "Failed to find matching neighbour for IP=%pI6c\n",
2004 &dip);
2005 return; 2000 return;
2006 }
2007 2001
2008 netdev_dbg(dev, "Updating neighbour with IP=%pI6c\n", &dip); 2002 netdev_dbg(dev, "Updating neighbour with IP=%pI6c\n", &dip);
2009 neigh_event_send(n, NULL); 2003 neigh_event_send(n, NULL);
diff --git a/drivers/net/ethernet/qlogic/qed/qed_rdma.c b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
index bdc46f11ce45..f6bf54614d7d 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_rdma.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
@@ -358,10 +358,27 @@ static void qed_rdma_resc_free(struct qed_hwfn *p_hwfn)
358 kfree(p_rdma_info); 358 kfree(p_rdma_info);
359} 359}
360 360
361static void qed_rdma_free_tid(void *rdma_cxt, u32 itid)
362{
363 struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
364
365 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "itid = %08x\n", itid);
366
367 spin_lock_bh(&p_hwfn->p_rdma_info->lock);
368 qed_bmap_release_id(p_hwfn, &p_hwfn->p_rdma_info->tid_map, itid);
369 spin_unlock_bh(&p_hwfn->p_rdma_info->lock);
370}
371
372static void qed_rdma_free_reserved_lkey(struct qed_hwfn *p_hwfn)
373{
374 qed_rdma_free_tid(p_hwfn, p_hwfn->p_rdma_info->dev->reserved_lkey);
375}
376
361static void qed_rdma_free(struct qed_hwfn *p_hwfn) 377static void qed_rdma_free(struct qed_hwfn *p_hwfn)
362{ 378{
363 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "Freeing RDMA\n"); 379 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "Freeing RDMA\n");
364 380
381 qed_rdma_free_reserved_lkey(p_hwfn);
365 qed_rdma_resc_free(p_hwfn); 382 qed_rdma_resc_free(p_hwfn);
366} 383}
367 384
@@ -615,9 +632,6 @@ static int qed_rdma_reserve_lkey(struct qed_hwfn *p_hwfn)
615{ 632{
616 struct qed_rdma_device *dev = p_hwfn->p_rdma_info->dev; 633 struct qed_rdma_device *dev = p_hwfn->p_rdma_info->dev;
617 634
618 /* The first DPI is reserved for the Kernel */
619 __set_bit(0, p_hwfn->p_rdma_info->dpi_map.bitmap);
620
621 /* Tid 0 will be used as the key for "reserved MR". 635 /* Tid 0 will be used as the key for "reserved MR".
622 * The driver should allocate memory for it so it can be loaded but no 636 * The driver should allocate memory for it so it can be loaded but no
623 * ramrod should be passed on it. 637 * ramrod should be passed on it.
@@ -797,17 +811,6 @@ static struct qed_rdma_device *qed_rdma_query_device(void *rdma_cxt)
797 return p_hwfn->p_rdma_info->dev; 811 return p_hwfn->p_rdma_info->dev;
798} 812}
799 813
800static void qed_rdma_free_tid(void *rdma_cxt, u32 itid)
801{
802 struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
803
804 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "itid = %08x\n", itid);
805
806 spin_lock_bh(&p_hwfn->p_rdma_info->lock);
807 qed_bmap_release_id(p_hwfn, &p_hwfn->p_rdma_info->tid_map, itid);
808 spin_unlock_bh(&p_hwfn->p_rdma_info->lock);
809}
810
811static void qed_rdma_cnq_prod_update(void *rdma_cxt, u8 qz_offset, u16 prod) 814static void qed_rdma_cnq_prod_update(void *rdma_cxt, u8 qz_offset, u16 prod)
812{ 815{
813 struct qed_hwfn *p_hwfn; 816 struct qed_hwfn *p_hwfn;
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index 4e1da1645b15..5aa59f41bf8c 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -842,6 +842,7 @@ static int pppoe_sendmsg(struct socket *sock, struct msghdr *m,
842 struct pppoe_hdr *ph; 842 struct pppoe_hdr *ph;
843 struct net_device *dev; 843 struct net_device *dev;
844 char *start; 844 char *start;
845 int hlen;
845 846
846 lock_sock(sk); 847 lock_sock(sk);
847 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) { 848 if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) {
@@ -860,16 +861,16 @@ static int pppoe_sendmsg(struct socket *sock, struct msghdr *m,
860 if (total_len > (dev->mtu + dev->hard_header_len)) 861 if (total_len > (dev->mtu + dev->hard_header_len))
861 goto end; 862 goto end;
862 863
863 864 hlen = LL_RESERVED_SPACE(dev);
864 skb = sock_wmalloc(sk, total_len + dev->hard_header_len + 32, 865 skb = sock_wmalloc(sk, hlen + sizeof(*ph) + total_len +
865 0, GFP_KERNEL); 866 dev->needed_tailroom, 0, GFP_KERNEL);
866 if (!skb) { 867 if (!skb) {
867 error = -ENOMEM; 868 error = -ENOMEM;
868 goto end; 869 goto end;
869 } 870 }
870 871
871 /* Reserve space for headers. */ 872 /* Reserve space for headers. */
872 skb_reserve(skb, dev->hard_header_len); 873 skb_reserve(skb, hlen);
873 skb_reset_network_header(skb); 874 skb_reset_network_header(skb);
874 875
875 skb->dev = dev; 876 skb->dev = dev;
@@ -930,7 +931,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
930 /* Copy the data if there is no space for the header or if it's 931 /* Copy the data if there is no space for the header or if it's
931 * read-only. 932 * read-only.
932 */ 933 */
933 if (skb_cow_head(skb, sizeof(*ph) + dev->hard_header_len)) 934 if (skb_cow_head(skb, LL_RESERVED_SPACE(dev) + sizeof(*ph)))
934 goto abort; 935 goto abort;
935 936
936 __skb_push(skb, sizeof(*ph)); 937 __skb_push(skb, sizeof(*ph));
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index d1c7029ded7c..cf95290b160c 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -1616,7 +1616,6 @@ static void vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq,
1616 rq->rx_ring[i].basePA); 1616 rq->rx_ring[i].basePA);
1617 rq->rx_ring[i].base = NULL; 1617 rq->rx_ring[i].base = NULL;
1618 } 1618 }
1619 rq->buf_info[i] = NULL;
1620 } 1619 }
1621 1620
1622 if (rq->data_ring.base) { 1621 if (rq->data_ring.base) {
@@ -1638,6 +1637,7 @@ static void vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq,
1638 (rq->rx_ring[0].size + rq->rx_ring[1].size); 1637 (rq->rx_ring[0].size + rq->rx_ring[1].size);
1639 dma_free_coherent(&adapter->pdev->dev, sz, rq->buf_info[0], 1638 dma_free_coherent(&adapter->pdev->dev, sz, rq->buf_info[0],
1640 rq->buf_info_pa); 1639 rq->buf_info_pa);
1640 rq->buf_info[0] = rq->buf_info[1] = NULL;
1641 } 1641 }
1642} 1642}
1643 1643
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 33ac2b186b85..5727b186b3ca 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -904,7 +904,7 @@ static void vhost_dev_lock_vqs(struct vhost_dev *d)
904{ 904{
905 int i = 0; 905 int i = 0;
906 for (i = 0; i < d->nvqs; ++i) 906 for (i = 0; i < d->nvqs; ++i)
907 mutex_lock(&d->vqs[i]->mutex); 907 mutex_lock_nested(&d->vqs[i]->mutex, i);
908} 908}
909 909
910static void vhost_dev_unlock_vqs(struct vhost_dev *d) 910static void vhost_dev_unlock_vqs(struct vhost_dev *d)
@@ -1015,6 +1015,10 @@ static int vhost_process_iotlb_msg(struct vhost_dev *dev,
1015 vhost_iotlb_notify_vq(dev, msg); 1015 vhost_iotlb_notify_vq(dev, msg);
1016 break; 1016 break;
1017 case VHOST_IOTLB_INVALIDATE: 1017 case VHOST_IOTLB_INVALIDATE:
1018 if (!dev->iotlb) {
1019 ret = -EFAULT;
1020 break;
1021 }
1018 vhost_vq_meta_reset(dev); 1022 vhost_vq_meta_reset(dev);
1019 vhost_del_umem_range(dev->iotlb, msg->iova, 1023 vhost_del_umem_range(dev->iotlb, msg->iova,
1020 msg->iova + msg->size - 1); 1024 msg->iova + msg->size - 1);
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 2bab81951ced..3319df9727aa 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -332,6 +332,8 @@ extern int ftrace_text_reserved(const void *start, const void *end);
332 332
333extern int ftrace_nr_registered_ops(void); 333extern int ftrace_nr_registered_ops(void);
334 334
335struct ftrace_ops *ftrace_ops_trampoline(unsigned long addr);
336
335bool is_ftrace_trampoline(unsigned long addr); 337bool is_ftrace_trampoline(unsigned long addr);
336 338
337/* 339/*
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h
index 853291714ae0..bae807eb2933 100644
--- a/include/linux/vermagic.h
+++ b/include/linux/vermagic.h
@@ -31,17 +31,11 @@
31#else 31#else
32#define MODULE_RANDSTRUCT_PLUGIN 32#define MODULE_RANDSTRUCT_PLUGIN
33#endif 33#endif
34#ifdef RETPOLINE
35#define MODULE_VERMAGIC_RETPOLINE "retpoline "
36#else
37#define MODULE_VERMAGIC_RETPOLINE ""
38#endif
39 34
40#define VERMAGIC_STRING \ 35#define VERMAGIC_STRING \
41 UTS_RELEASE " " \ 36 UTS_RELEASE " " \
42 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ 37 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
43 MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \ 38 MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \
44 MODULE_ARCH_VERMAGIC \ 39 MODULE_ARCH_VERMAGIC \
45 MODULE_RANDSTRUCT_PLUGIN \ 40 MODULE_RANDSTRUCT_PLUGIN
46 MODULE_VERMAGIC_RETPOLINE
47 41
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 9dc1230d789c..8606c9113d3f 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -332,6 +332,7 @@ int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq,
332 int flags); 332 int flags);
333int ip6_flowlabel_init(void); 333int ip6_flowlabel_init(void);
334void ip6_flowlabel_cleanup(void); 334void ip6_flowlabel_cleanup(void);
335bool ip6_autoflowlabel(struct net *net, const struct ipv6_pinfo *np);
335 336
336static inline void fl6_sock_release(struct ip6_flowlabel *fl) 337static inline void fl6_sock_release(struct ip6_flowlabel *fl)
337{ 338{
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 1a41513cec7f..fa2f6fb14093 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -535,7 +535,7 @@ static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer)
535{ 535{
536 switch (layer) { 536 switch (layer) {
537 case TCF_LAYER_LINK: 537 case TCF_LAYER_LINK:
538 return skb->data; 538 return skb_mac_header(skb);
539 case TCF_LAYER_NETWORK: 539 case TCF_LAYER_NETWORK:
540 return skb_network_header(skb); 540 return skb_network_header(skb);
541 case TCF_LAYER_TRANSPORT: 541 case TCF_LAYER_TRANSPORT:
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index ccdf3664e4a9..554b517c61a0 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1119,15 +1119,11 @@ static struct ftrace_ops global_ops = {
1119}; 1119};
1120 1120
1121/* 1121/*
1122 * This is used by __kernel_text_address() to return true if the 1122 * Used by the stack undwinder to know about dynamic ftrace trampolines.
1123 * address is on a dynamically allocated trampoline that would
1124 * not return true for either core_kernel_text() or
1125 * is_module_text_address().
1126 */ 1123 */
1127bool is_ftrace_trampoline(unsigned long addr) 1124struct ftrace_ops *ftrace_ops_trampoline(unsigned long addr)
1128{ 1125{
1129 struct ftrace_ops *op; 1126 struct ftrace_ops *op = NULL;
1130 bool ret = false;
1131 1127
1132 /* 1128 /*
1133 * Some of the ops may be dynamically allocated, 1129 * Some of the ops may be dynamically allocated,
@@ -1144,15 +1140,24 @@ bool is_ftrace_trampoline(unsigned long addr)
1144 if (op->trampoline && op->trampoline_size) 1140 if (op->trampoline && op->trampoline_size)
1145 if (addr >= op->trampoline && 1141 if (addr >= op->trampoline &&
1146 addr < op->trampoline + op->trampoline_size) { 1142 addr < op->trampoline + op->trampoline_size) {
1147 ret = true; 1143 preempt_enable_notrace();
1148 goto out; 1144 return op;
1149 } 1145 }
1150 } while_for_each_ftrace_op(op); 1146 } while_for_each_ftrace_op(op);
1151
1152 out:
1153 preempt_enable_notrace(); 1147 preempt_enable_notrace();
1154 1148
1155 return ret; 1149 return NULL;
1150}
1151
1152/*
1153 * This is used by __kernel_text_address() to return true if the
1154 * address is on a dynamically allocated trampoline that would
1155 * not return true for either core_kernel_text() or
1156 * is_module_text_address().
1157 */
1158bool is_ftrace_trampoline(unsigned long addr)
1159{
1160 return ftrace_ops_trampoline(addr) != NULL;
1156} 1161}
1157 1162
1158struct ftrace_page { 1163struct ftrace_page {
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 2a8d8a294345..8e3f20a18a06 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2374,6 +2374,15 @@ void trace_event_buffer_commit(struct trace_event_buffer *fbuffer)
2374} 2374}
2375EXPORT_SYMBOL_GPL(trace_event_buffer_commit); 2375EXPORT_SYMBOL_GPL(trace_event_buffer_commit);
2376 2376
2377/*
2378 * Skip 3:
2379 *
2380 * trace_buffer_unlock_commit_regs()
2381 * trace_event_buffer_commit()
2382 * trace_event_raw_event_xxx()
2383*/
2384# define STACK_SKIP 3
2385
2377void trace_buffer_unlock_commit_regs(struct trace_array *tr, 2386void trace_buffer_unlock_commit_regs(struct trace_array *tr,
2378 struct ring_buffer *buffer, 2387 struct ring_buffer *buffer,
2379 struct ring_buffer_event *event, 2388 struct ring_buffer_event *event,
@@ -2383,16 +2392,12 @@ void trace_buffer_unlock_commit_regs(struct trace_array *tr,
2383 __buffer_unlock_commit(buffer, event); 2392 __buffer_unlock_commit(buffer, event);
2384 2393
2385 /* 2394 /*
2386 * If regs is not set, then skip the following callers: 2395 * If regs is not set, then skip the necessary functions.
2387 * trace_buffer_unlock_commit_regs
2388 * event_trigger_unlock_commit
2389 * trace_event_buffer_commit
2390 * trace_event_raw_event_sched_switch
2391 * Note, we can still get here via blktrace, wakeup tracer 2396 * Note, we can still get here via blktrace, wakeup tracer
2392 * and mmiotrace, but that's ok if they lose a function or 2397 * and mmiotrace, but that's ok if they lose a function or
2393 * two. They are that meaningful. 2398 * two. They are not that meaningful.
2394 */ 2399 */
2395 ftrace_trace_stack(tr, buffer, flags, regs ? 0 : 4, pc, regs); 2400 ftrace_trace_stack(tr, buffer, flags, regs ? 0 : STACK_SKIP, pc, regs);
2396 ftrace_trace_userstack(buffer, flags, pc); 2401 ftrace_trace_userstack(buffer, flags, pc);
2397} 2402}
2398 2403
@@ -2579,11 +2584,13 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer,
2579 trace.skip = skip; 2584 trace.skip = skip;
2580 2585
2581 /* 2586 /*
2582 * Add two, for this function and the call to save_stack_trace() 2587 * Add one, for this function and the call to save_stack_trace()
2583 * If regs is set, then these functions will not be in the way. 2588 * If regs is set, then these functions will not be in the way.
2584 */ 2589 */
2590#ifndef CONFIG_UNWINDER_ORC
2585 if (!regs) 2591 if (!regs)
2586 trace.skip += 2; 2592 trace.skip++;
2593#endif
2587 2594
2588 /* 2595 /*
2589 * Since events can happen in NMIs there's no safe way to 2596 * Since events can happen in NMIs there's no safe way to
@@ -2711,11 +2718,10 @@ void trace_dump_stack(int skip)
2711 2718
2712 local_save_flags(flags); 2719 local_save_flags(flags);
2713 2720
2714 /* 2721#ifndef CONFIG_UNWINDER_ORC
2715 * Skip 3 more, seems to get us at the caller of 2722 /* Skip 1 to skip this function. */
2716 * this function. 2723 skip++;
2717 */ 2724#endif
2718 skip += 3;
2719 __ftrace_trace_stack(global_trace.trace_buffer.buffer, 2725 __ftrace_trace_stack(global_trace.trace_buffer.buffer,
2720 flags, skip, preempt_count(), NULL); 2726 flags, skip, preempt_count(), NULL);
2721} 2727}
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index f2ac9d44f6c4..87411482a46f 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -1123,13 +1123,22 @@ static __init int register_trigger_snapshot_cmd(void) { return 0; }
1123#endif /* CONFIG_TRACER_SNAPSHOT */ 1123#endif /* CONFIG_TRACER_SNAPSHOT */
1124 1124
1125#ifdef CONFIG_STACKTRACE 1125#ifdef CONFIG_STACKTRACE
1126#ifdef CONFIG_UNWINDER_ORC
1127/* Skip 2:
1128 * event_triggers_post_call()
1129 * trace_event_raw_event_xxx()
1130 */
1131# define STACK_SKIP 2
1132#else
1126/* 1133/*
1127 * Skip 3: 1134 * Skip 4:
1128 * stacktrace_trigger() 1135 * stacktrace_trigger()
1129 * event_triggers_post_call() 1136 * event_triggers_post_call()
1137 * trace_event_buffer_commit()
1130 * trace_event_raw_event_xxx() 1138 * trace_event_raw_event_xxx()
1131 */ 1139 */
1132#define STACK_SKIP 3 1140#define STACK_SKIP 4
1141#endif
1133 1142
1134static void 1143static void
1135stacktrace_trigger(struct event_trigger_data *data, void *rec) 1144stacktrace_trigger(struct event_trigger_data *data, void *rec)
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 27f7ad12c4b1..b611cd36e22d 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -154,6 +154,24 @@ function_trace_call(unsigned long ip, unsigned long parent_ip,
154 preempt_enable_notrace(); 154 preempt_enable_notrace();
155} 155}
156 156
157#ifdef CONFIG_UNWINDER_ORC
158/*
159 * Skip 2:
160 *
161 * function_stack_trace_call()
162 * ftrace_call()
163 */
164#define STACK_SKIP 2
165#else
166/*
167 * Skip 3:
168 * __trace_stack()
169 * function_stack_trace_call()
170 * ftrace_call()
171 */
172#define STACK_SKIP 3
173#endif
174
157static void 175static void
158function_stack_trace_call(unsigned long ip, unsigned long parent_ip, 176function_stack_trace_call(unsigned long ip, unsigned long parent_ip,
159 struct ftrace_ops *op, struct pt_regs *pt_regs) 177 struct ftrace_ops *op, struct pt_regs *pt_regs)
@@ -180,15 +198,7 @@ function_stack_trace_call(unsigned long ip, unsigned long parent_ip,
180 if (likely(disabled == 1)) { 198 if (likely(disabled == 1)) {
181 pc = preempt_count(); 199 pc = preempt_count();
182 trace_function(tr, ip, parent_ip, flags, pc); 200 trace_function(tr, ip, parent_ip, flags, pc);
183 /* 201 __trace_stack(tr, flags, STACK_SKIP, pc);
184 * skip over 5 funcs:
185 * __ftrace_trace_stack,
186 * __trace_stack,
187 * function_stack_trace_call
188 * ftrace_list_func
189 * ftrace_call
190 */
191 __trace_stack(tr, flags, 5, pc);
192 } 202 }
193 203
194 atomic_dec(&data->disabled); 204 atomic_dec(&data->disabled);
@@ -367,14 +377,27 @@ ftrace_traceoff(unsigned long ip, unsigned long parent_ip,
367 tracer_tracing_off(tr); 377 tracer_tracing_off(tr);
368} 378}
369 379
380#ifdef CONFIG_UNWINDER_ORC
370/* 381/*
371 * Skip 4: 382 * Skip 3:
383 *
384 * function_trace_probe_call()
385 * ftrace_ops_assist_func()
386 * ftrace_call()
387 */
388#define FTRACE_STACK_SKIP 3
389#else
390/*
391 * Skip 5:
392 *
393 * __trace_stack()
372 * ftrace_stacktrace() 394 * ftrace_stacktrace()
373 * function_trace_probe_call() 395 * function_trace_probe_call()
374 * ftrace_ops_list_func() 396 * ftrace_ops_assist_func()
375 * ftrace_call() 397 * ftrace_call()
376 */ 398 */
377#define STACK_SKIP 4 399#define FTRACE_STACK_SKIP 5
400#endif
378 401
379static __always_inline void trace_stack(struct trace_array *tr) 402static __always_inline void trace_stack(struct trace_array *tr)
380{ 403{
@@ -384,7 +407,7 @@ static __always_inline void trace_stack(struct trace_array *tr)
384 local_save_flags(flags); 407 local_save_flags(flags);
385 pc = preempt_count(); 408 pc = preempt_count();
386 409
387 __trace_stack(tr, flags, STACK_SKIP, pc); 410 __trace_stack(tr, flags, FTRACE_STACK_SKIP, pc);
388} 411}
389 412
390static void 413static void
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index 8affc6d83d58..63faeee989a9 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -92,6 +92,7 @@ static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
92 92
93 skb_reset_network_header(skb); 93 skb_reset_network_header(skb);
94 skb_mac_header_rebuild(skb); 94 skb_mac_header_rebuild(skb);
95 eth_hdr(skb)->h_proto = skb->protocol;
95 96
96 err = 0; 97 err = 0;
97 98
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index a4a94452132b..997c7f19ad62 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -174,7 +174,7 @@ int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
174 !(IP6CB(skb)->flags & IP6SKB_REROUTED)); 174 !(IP6CB(skb)->flags & IP6SKB_REROUTED));
175} 175}
176 176
177static bool ip6_autoflowlabel(struct net *net, const struct ipv6_pinfo *np) 177bool ip6_autoflowlabel(struct net *net, const struct ipv6_pinfo *np)
178{ 178{
179 if (!np->autoflowlabel_set) 179 if (!np->autoflowlabel_set)
180 return ip6_default_np_autolabel(net); 180 return ip6_default_np_autolabel(net);
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 2d4680e0376f..e8ffb5b5d84e 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -1336,7 +1336,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
1336 break; 1336 break;
1337 1337
1338 case IPV6_AUTOFLOWLABEL: 1338 case IPV6_AUTOFLOWLABEL:
1339 val = np->autoflowlabel; 1339 val = ip6_autoflowlabel(sock_net(sk), np);
1340 break; 1340 break;
1341 1341
1342 case IPV6_RECVFRAGSIZE: 1342 case IPV6_RECVFRAGSIZE:
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index 4e12859bc2ee..bb935a3b7fea 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -92,6 +92,7 @@ static int xfrm6_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
92 92
93 skb_reset_network_header(skb); 93 skb_reset_network_header(skb);
94 skb_mac_header_rebuild(skb); 94 skb_mac_header_rebuild(skb);
95 eth_hdr(skb)->h_proto = skb->protocol;
95 96
96 err = 0; 97 err = 0;
97 98
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index d4e98f20fc2a..4a8d407f8902 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -1387,8 +1387,13 @@ static int kcm_attach(struct socket *sock, struct socket *csock,
1387 if (!csk) 1387 if (!csk)
1388 return -EINVAL; 1388 return -EINVAL;
1389 1389
1390 /* We must prevent loops or risk deadlock ! */ 1390 /* Only allow TCP sockets to be attached for now */
1391 if (csk->sk_family == PF_KCM) 1391 if ((csk->sk_family != AF_INET && csk->sk_family != AF_INET6) ||
1392 csk->sk_protocol != IPPROTO_TCP)
1393 return -EOPNOTSUPP;
1394
1395 /* Don't allow listeners or closed sockets */
1396 if (csk->sk_state == TCP_LISTEN || csk->sk_state == TCP_CLOSE)
1392 return -EOPNOTSUPP; 1397 return -EOPNOTSUPP;
1393 1398
1394 psock = kmem_cache_zalloc(kcm_psockp, GFP_KERNEL); 1399 psock = kmem_cache_zalloc(kcm_psockp, GFP_KERNEL);
@@ -1405,9 +1410,18 @@ static int kcm_attach(struct socket *sock, struct socket *csock,
1405 return err; 1410 return err;
1406 } 1411 }
1407 1412
1408 sock_hold(csk);
1409
1410 write_lock_bh(&csk->sk_callback_lock); 1413 write_lock_bh(&csk->sk_callback_lock);
1414
1415 /* Check if sk_user_data is aready by KCM or someone else.
1416 * Must be done under lock to prevent race conditions.
1417 */
1418 if (csk->sk_user_data) {
1419 write_unlock_bh(&csk->sk_callback_lock);
1420 strp_done(&psock->strp);
1421 kmem_cache_free(kcm_psockp, psock);
1422 return -EALREADY;
1423 }
1424
1411 psock->save_data_ready = csk->sk_data_ready; 1425 psock->save_data_ready = csk->sk_data_ready;
1412 psock->save_write_space = csk->sk_write_space; 1426 psock->save_write_space = csk->sk_write_space;
1413 psock->save_state_change = csk->sk_state_change; 1427 psock->save_state_change = csk->sk_state_change;
@@ -1415,8 +1429,11 @@ static int kcm_attach(struct socket *sock, struct socket *csock,
1415 csk->sk_data_ready = psock_data_ready; 1429 csk->sk_data_ready = psock_data_ready;
1416 csk->sk_write_space = psock_write_space; 1430 csk->sk_write_space = psock_write_space;
1417 csk->sk_state_change = psock_state_change; 1431 csk->sk_state_change = psock_state_change;
1432
1418 write_unlock_bh(&csk->sk_callback_lock); 1433 write_unlock_bh(&csk->sk_callback_lock);
1419 1434
1435 sock_hold(csk);
1436
1420 /* Finished initialization, now add the psock to the MUX. */ 1437 /* Finished initialization, now add the psock to the MUX. */
1421 spin_lock_bh(&mux->lock); 1438 spin_lock_bh(&mux->lock);
1422 head = &mux->psocks; 1439 head = &mux->psocks;
diff --git a/net/sched/em_nbyte.c b/net/sched/em_nbyte.c
index df3110d69585..07c10bac06a0 100644
--- a/net/sched/em_nbyte.c
+++ b/net/sched/em_nbyte.c
@@ -51,7 +51,7 @@ static int em_nbyte_match(struct sk_buff *skb, struct tcf_ematch *em,
51 if (!tcf_valid_offset(skb, ptr, nbyte->hdr.len)) 51 if (!tcf_valid_offset(skb, ptr, nbyte->hdr.len))
52 return 0; 52 return 0;
53 53
54 return !memcmp(ptr + nbyte->hdr.off, nbyte->pattern, nbyte->hdr.len); 54 return !memcmp(ptr, nbyte->pattern, nbyte->hdr.len);
55} 55}
56 56
57static struct tcf_ematch_ops em_nbyte_ops = { 57static struct tcf_ematch_ops em_nbyte_ops = {
diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
index 75982506617b..92b4648e75ca 100644
--- a/net/xfrm/xfrm_device.c
+++ b/net/xfrm/xfrm_device.c
@@ -184,6 +184,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
184 184
185 err = dev->xfrmdev_ops->xdo_dev_state_add(x); 185 err = dev->xfrmdev_ops->xdo_dev_state_add(x);
186 if (err) { 186 if (err) {
187 xso->dev = NULL;
187 dev_put(dev); 188 dev_put(dev);
188 return err; 189 return err;
189 } 190 }
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 20b1e414dbee..54e21f19d722 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -317,7 +317,7 @@ retry:
317 317
318 if (!type && try_load) { 318 if (!type && try_load) {
319 request_module("xfrm-offload-%d-%d", family, proto); 319 request_module("xfrm-offload-%d-%d", family, proto);
320 try_load = 0; 320 try_load = false;
321 goto retry; 321 goto retry;
322 } 322 }
323 323
@@ -2279,8 +2279,6 @@ int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload)
2279 goto error; 2279 goto error;
2280 } 2280 }
2281 2281
2282 x->km.state = XFRM_STATE_VALID;
2283
2284error: 2282error:
2285 return err; 2283 return err;
2286} 2284}
@@ -2289,7 +2287,13 @@ EXPORT_SYMBOL(__xfrm_init_state);
2289 2287
2290int xfrm_init_state(struct xfrm_state *x) 2288int xfrm_init_state(struct xfrm_state *x)
2291{ 2289{
2292 return __xfrm_init_state(x, true, false); 2290 int err;
2291
2292 err = __xfrm_init_state(x, true, false);
2293 if (!err)
2294 x->km.state = XFRM_STATE_VALID;
2295
2296 return err;
2293} 2297}
2294 2298
2295EXPORT_SYMBOL(xfrm_init_state); 2299EXPORT_SYMBOL(xfrm_init_state);
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index bdb48e5dba04..7f52b8eb177d 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -598,13 +598,6 @@ static struct xfrm_state *xfrm_state_construct(struct net *net,
598 goto error; 598 goto error;
599 } 599 }
600 600
601 if (attrs[XFRMA_OFFLOAD_DEV]) {
602 err = xfrm_dev_state_add(net, x,
603 nla_data(attrs[XFRMA_OFFLOAD_DEV]));
604 if (err)
605 goto error;
606 }
607
608 if ((err = xfrm_alloc_replay_state_esn(&x->replay_esn, &x->preplay_esn, 601 if ((err = xfrm_alloc_replay_state_esn(&x->replay_esn, &x->preplay_esn,
609 attrs[XFRMA_REPLAY_ESN_VAL]))) 602 attrs[XFRMA_REPLAY_ESN_VAL])))
610 goto error; 603 goto error;
@@ -620,6 +613,14 @@ static struct xfrm_state *xfrm_state_construct(struct net *net,
620 /* override default values from above */ 613 /* override default values from above */
621 xfrm_update_ae_params(x, attrs, 0); 614 xfrm_update_ae_params(x, attrs, 0);
622 615
616 /* configure the hardware if offload is requested */
617 if (attrs[XFRMA_OFFLOAD_DEV]) {
618 err = xfrm_dev_state_add(net, x,
619 nla_data(attrs[XFRMA_OFFLOAD_DEV]));
620 if (err)
621 goto error;
622 }
623
623 return x; 624 return x;
624 625
625error: 626error:
@@ -662,6 +663,9 @@ static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
662 goto out; 663 goto out;
663 } 664 }
664 665
666 if (x->km.state == XFRM_STATE_VOID)
667 x->km.state = XFRM_STATE_VALID;
668
665 c.seq = nlh->nlmsg_seq; 669 c.seq = nlh->nlmsg_seq;
666 c.portid = nlh->nlmsg_pid; 670 c.portid = nlh->nlmsg_pid;
667 c.event = nlh->nlmsg_type; 671 c.event = nlh->nlmsg_type;