History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Simple cases of overlapping changes in the packet scheduler. Must easier to resolve this time. Which probably means that I screwed it up somehow.

David S. Miller committed 9 years ago

Commit 4dc67582 parents 19aeeb9 3fefc31148 files · +1125 −436Browse files

Unified · Split

148 files
  1. .mailmap +3 −0
  2. Documentation/process/kernel-enforcement-statement.rst +16 −6
  3. MAINTAINERS +9 −5
  4. Makefile +1 −1
  5. arch/arm/Makefile +2 −0
  6. arch/arm/boot/compressed/vmlinux.lds.S +9 −0
  7. arch/arm/boot/dts/armada-375.dtsi +2 −2
  8. arch/arm/boot/dts/armada-38x.dtsi +2 −2
  9. arch/arm/boot/dts/armada-39x.dtsi +2 −2
  10. arch/arm/boot/dts/uniphier-ld4.dtsi +6 −3
  11. arch/arm/boot/dts/uniphier-pro4.dtsi +4 −2
  12. arch/arm/boot/dts/uniphier-sld8.dtsi +6 −3
  13. arch/arm/include/asm/Kbuild +0 −1
  14. arch/arm/include/asm/unaligned.h +27 −0
  15. arch/arm/kvm/emulate.c +2 −4
  16. arch/arm/kvm/hyp/Makefile +1 −1
  17. arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi +6 −3
  18. arch/arm64/kvm/hyp/Makefile +1 −1
  19. arch/arm64/kvm/inject_fault.c +15 −1
  20. arch/ia64/include/asm/acpi.h +2 −0
  21. arch/mips/generic/board-ni169445.its.S +1 −1
  22. arch/mips/generic/init.c +1 −1
  23. arch/mips/generic/kexec.c +1 −1
  24. arch/mips/include/asm/mips-cm.h +2 −2
  25. arch/mips/include/asm/stackframe.h +4 −4
  26. arch/mips/kernel/probes-common.h +1 −1
  27. arch/mips/kernel/smp-cmp.c +3 −3
  28. arch/mips/kernel/smp-cps.c +1 −1
  29. arch/mips/kernel/smp.c +17 −7
  30. arch/mips/mm/uasm-micromips.c +1 −1
  31. arch/mips/net/ebpf_jit.c +1 −1
  32. arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S +6 −6
  33. arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S +6 −6
  34. arch/x86/include/asm/acpi.h +2 −0
  35. arch/x86/kernel/cpu/mcheck/dev-mcelog.c +27 −94
  36. arch/x86/kernel/kvmclock.c +1 −1
  37. arch/x86/kernel/module.c +13 −0
  38. arch/x86/kvm/lapic.c +5 −0
  39. arch/x86/kvm/vmx.c +0 −3
  40. arch/x86/mm/mem_encrypt.c +1 −1
  41. arch/x86/mm/tlb.c +14 −3
  42. crypto/ccm.c +3 −1
  43. drivers/acpi/processor_idle.c +2 −0
  44. drivers/acpi/sleep.c +28 −0
  45. drivers/firmware/efi/libstub/Makefile +3 −3
  46. drivers/firmware/efi/libstub/arm-stub.c +5 −2
  47. drivers/ide/ide-cd.c +6 −1
  48. drivers/idle/intel_idle.c +5 −4
  49. drivers/input/sparse-keymap.c +1 −0
  50. drivers/input/touchscreen/ar1021_i2c.c +1 −0
  51. drivers/irqchip/irq-mvebu-gicp.c +1 −0
  52. drivers/net/bonding/bond_main.c +2 −1
  53. drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h +3 −3
  54. drivers/net/ethernet/marvell/mvpp2.c +4 −0
  55. drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +8 −5
  56. drivers/net/usb/asix_devices.c +2 −2
  57. drivers/net/usb/cdc_ether.c +1 −1
  58. drivers/net/usb/qmi_wwan.c +2 −1
  59. drivers/scsi/scsi_lib.c +0 −3
  60. drivers/scsi/scsi_transport_srp.c +1 −4
  61. include/linux/compiler.h +2 −2
  62. include/linux/skbuff.h +7 −0
  63. include/net/act_api.h +1 −3
  64. include/net/pkt_cls.h +24 −0
  65. include/sound/seq_kernel.h +2 −1
  66. include/sound/timer.h +2 −0
  67. include/uapi/sound/asound.h +3 −3
  68. kernel/events/core.c +4 −2
  69. kernel/futex.c +20 −3
  70. kernel/sched/cpufreq_schedutil.c +1 −5
  71. kernel/watchdog_hld.c +10 −5
  72. kernel/workqueue_internal.h +2 −1
  73. lib/asn1_decoder.c +2 −2
  74. net/core/skbuff.c +1 −0
  75. net/ipv4/tcp_input.c +1 −1
  76. net/l2tp/l2tp_ip.c +9 −15
  77. net/l2tp/l2tp_ip6.c +9 −15
  78. net/qrtr/qrtr.c +1 −1
  79. net/sched/act_api.c +0 −2
  80. net/sched/act_bpf.c +1 −1
  81. net/sched/act_connmark.c +1 −1
  82. net/sched/act_csum.c +1 −1
  83. net/sched/act_gact.c +1 −1
  84. net/sched/act_ife.c +1 −1
  85. net/sched/act_ipt.c +2 −2
  86. net/sched/act_mirred.c +1 −1
  87. net/sched/act_nat.c +1 −1
  88. net/sched/act_pedit.c +1 −1
  89. net/sched/act_police.c +1 −1
  90. net/sched/act_sample.c +1 −1
  91. net/sched/act_simple.c +1 −1
  92. net/sched/act_skbedit.c +1 −1
  93. net/sched/act_skbmod.c +1 −1
  94. net/sched/act_tunnel_key.c +1 −1
  95. net/sched/act_vlan.c +1 −1
  96. net/sched/cls_api.c +1 −0
  97. net/sched/cls_basic.c +15 −5
  98. net/sched/cls_bpf.c +6 −1
  99. net/sched/cls_cgroup.c +18 −6
  100. net/sched/cls_flow.c +18 −6
  101. net/sched/cls_flower.c +13 −3
  102. net/sched/cls_fw.c +14 −3
  103. net/sched/cls_matchall.c +12 −3
  104. net/sched/cls_route.c +14 −3
  105. net/sched/cls_rsvp.h +12 −3
  106. net/sched/cls_tcindex.c +26 −7
  107. net/sched/cls_u32.c +7 −1
  108. net/xfrm/xfrm_input.c +2 −2
  109. net/xfrm/xfrm_policy.c +35 −36
  110. scripts/leaking_addresses.pl +305 −0
  111. security/apparmor/ipc.c +2 −2
  112. sound/core/hrtimer.c +1 −0
  113. sound/core/seq/oss/seq_oss_midi.c +1 −3
  114. sound/core/seq/oss/seq_oss_readq.c +29 −0
  115. sound/core/seq/oss/seq_oss_readq.h +2 −0
  116. sound/core/timer.c +54 −13
  117. sound/pci/hda/patch_realtek.c +5 −0
  118. sound/usb/quirks.c +1 −0
  119. tools/arch/x86/include/asm/disabled-features.h +0 −1
  120. tools/arch/x86/include/asm/required-features.h +0 −1
  121. tools/arch/x86/include/uapi/asm/unistd.h +1 −0
  122. tools/arch/x86/lib/memcpy_64.S +4 −1
  123. tools/include/asm-generic/bitops/__fls.h +1 −0
  124. tools/include/asm-generic/bitops/arch_hweight.h +1 −0
  125. tools/include/asm-generic/bitops/const_hweight.h +1 −0
  126. tools/include/asm-generic/bitops/fls.h +1 −0
  127. tools/include/asm-generic/bitops/fls64.h +1 −0
  128. tools/include/asm/export.h +7 −0
  129. tools/include/linux/hash.h +0 −1
  130. tools/include/uapi/asm-generic/ioctls.h +1 −0
  131. tools/include/uapi/asm-generic/mman-common.h +1 −0
  132. tools/include/uapi/asm-generic/mman.h +2 −2
  133. tools/include/uapi/linux/bpf.h +1 −0
  134. tools/include/uapi/linux/bpf_common.h +1 −1
  135. tools/include/uapi/linux/fcntl.h +1 −1
  136. tools/include/uapi/linux/hw_breakpoint.h +1 −1
  137. tools/include/uapi/linux/kvm.h +1 −0
  138. tools/include/uapi/linux/mman.h +1 −1
  139. tools/include/uapi/linux/perf_event.h +1 −0
  140. tools/include/uapi/linux/sched.h +1 −0
  141. tools/include/uapi/linux/stat.h +1 −1
  142. tools/include/uapi/linux/vhost.h +1 −0
  143. tools/include/uapi/sound/asound.h +1 −0
  144. tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk +1 −0
  145. tools/perf/util/annotate.c +11 −1
  146. tools/perf/util/parse-events.l +6 −2
  147. virt/kvm/arm/arm.c +14 −17
  148. virt/kvm/arm/vgic/vgic-its.c +48 −25
.mailmap+3−0
@@ -15,6 +15,7 @@ Adriana Reus <adi.reus@gmail.com> <adriana.reus@intel.com> · 14 unmodified lines
1515 Alan Cox <alan@lxorguk.ukuu.org.uk>
1616 Alan Cox <root@hraefn.swansea.linux.org.uk>
1717 Aleksey Gorelov <aleksey_gorelov@phoenix.com>
18+Aleksandar Markovic <aleksandar.markovic@mips.com> <aleksandar.markovic@imgtec.com>
1819 Al Viro <viro@ftp.linux.org.uk>
1920 Al Viro <viro@zenIV.linux.org.uk>
2021 Andreas Herrmann <aherrman@de.ibm.com>
@@ -101,6 +102,7 @@ Leonid I Ananiev <leonid.i.ananiev@intel.com> · 80 unmodified lines
101102 Linas Vepstas <linas@austin.ibm.com>
102103 Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de>
103104 Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@ascom.ch>
105+Marcin Nowakowski <marcin.nowakowski@mips.com> <marcin.nowakowski@imgtec.com>
104106 Mark Brown <broonie@sirena.org.uk>
105107 Martin Kepplinger <martink@posteo.de> <martin.kepplinger@theobroma-systems.com>
106108 Martin Kepplinger <martink@posteo.de> <martin.kepplinger@ginzinger.com>
@@ -119,6 +121,7 @@ Matt Redfearn <matt.redfearn@mips.com> <matt.redfearn@imgtec.com> · 12 unmodified lines
119121 Mayuresh Janorkar <mayur@ti.com>
120122 Michael Buesch <m@bues.ch>
121123 Michel Dänzer <michel@tungstengraphics.com>
124+Miodrag Dinic <miodrag.dinic@mips.com> <miodrag.dinic@imgtec.com>
122125 Mitesh shah <mshah@teja.com>
123126 Mohit Kumar <mohit.kumar@st.com> <mohit.kumar.dhaka@gmail.com>
124127 Morten Welinder <terra@gnome.org>
Documentation/process/kernel-enforcement-statement.rst+16−6
@@ -50,8 +50,9 @@ be stronger. · 49 unmodified lines
5050 Except where noted below, we speak only for ourselves, and not for any company
5151 we might work for today, have in the past, or will in the future.
5252
53+ - Laura Abbott
5354 - Bjorn Andersson (Linaro)
54− - Andrea Arcangeli (Red Hat)
55+ - Andrea Arcangeli
5556 - Neil Armstrong
5657 - Jens Axboe
5758 - Pablo Neira Ayuso
@@ -60,15 +61,17 @@ we might work for today, have in the past, or will in the future. · 2 unmodified lines
6061 - Felipe Balbi
6162 - Arnd Bergmann
6263 - Ard Biesheuvel
63− - Paolo Bonzini (Red Hat)
64+ - Tim Bird
65+ - Paolo Bonzini
6466 - Christian Borntraeger
6567 - Mark Brown (Linaro)
6668 - Paul Burton
6769 - Javier Martinez Canillas
6870 - Rob Clark
6971 - Jonathan Corbet
72+ - Dennis Dalessandro
7073 - Vivien Didelot (Savoir-faire Linux)
71− - Hans de Goede (Red Hat)
74+ - Hans de Goede
7275 - Mel Gorman (SUSE)
7376 - Sven Eckelmann
7477 - Alex Elder (Linaro)
@@ -79,6 +82,7 @@ we might work for today, have in the past, or will in the future. · 4 unmodified lines
7982 - Juergen Gross
8083 - Shawn Guo
8184 - Ulf Hansson
85+ - Stephen Hemminger (Microsoft)
8286 - Tejun Heo
8387 - Rob Herring
8488 - Masami Hiramatsu
@@ -104,18 +108,21 @@ we might work for today, have in the past, or will in the future. · 19 unmodified lines
104108 - Viresh Kumar
105109 - Aneesh Kumar K.V
106110 - Julia Lawall
107− - Doug Ledford (Red Hat)
111+ - Doug Ledford
108112 - Chuck Lever (Oracle)
109113 - Daniel Lezcano
110114 - Shaohua Li
111− - Xin Long (Red Hat)
115+ - Xin Long
112116 - Tony Luck
117+ - Catalin Marinas (Arm Ltd)
113118 - Mike Marshall
114119 - Chris Mason
115120 - Paul E. McKenney
116121 - David S. Miller
117122 - Ingo Molnar
118123 - Kuninori Morimoto
124+ - Trond Myklebust
125+ - Martin K. Petersen (Oracle)
119126 - Borislav Petkov
120127 - Jiri Pirko
121128 - Josh Poimboeuf
@@ -124,18 +131,20 @@ we might work for today, have in the past, or will in the future. · 2 unmodified lines
124131 - Joerg Roedel
125132 - Leon Romanovsky
126133 - Steven Rostedt (VMware)
127− - Ivan Safonov
134+ - Frank Rowand
128135 - Ivan Safonov
129136 - Anna Schumaker
130137 - Jes Sorensen
131138 - K.Y. Srinivasan
132139 - Heiko Stuebner
133140 - Jiri Kosina (SUSE)
141+ - Willy Tarreau
134142 - Dmitry Torokhov
135143 - Linus Torvalds
136144 - Thierry Reding
137145 - Rik van Riel
138146 - Geert Uytterhoeven (Glider bvba)
147+ - Eduardo Valentin (Amazon.com)
139148 - Daniel Vetter
140149 - Linus Walleij
141150 - Richard Weinberger
@@ -145,3 +154,4 @@ we might work for today, have in the past, or will in the future. · 3 unmodified lines
145154 - Masahiro Yamada
146155 - Wei Yongjun
147156 - Lv Zheng
157+ - Marc Zyngier (Arm Ltd)
MAINTAINERS+9−5
@@ -873,7 +873,7 @@ F: drivers/android/ · 872 unmodified lines
873873 F: drivers/staging/android/
874874
875875 ANDROID GOLDFISH RTC DRIVER
876−M: Miodrag Dinic <miodrag.dinic@imgtec.com>
876+M: Miodrag Dinic <miodrag.dinic@mips.com>
877877 S: Supported
878878 F: Documentation/devicetree/bindings/rtc/google,goldfish-rtc.txt
879879 F: drivers/rtc/rtc-goldfish.c
@@ -7752,6 +7752,11 @@ S: Maintained · 6872 unmodified lines
77527752 F: Documentation/scsi/53c700.txt
77537753 F: drivers/scsi/53c700*
77547754
7755+LEAKING_ADDRESSES
7756+M: Tobin C. Harding <me@tobin.cc>
7757+S: Maintained
7758+F: scripts/leaking_addresses.pl
7759+
77557760 LED SUBSYSTEM
77567761 M: Richard Purdie <rpurdie@rpsys.net>
77577762 M: Jacek Anaszewski <jacek.anaszewski@gmail.com>
@@ -9027,7 +9032,7 @@ F: drivers/*/*loongson1* · 1269 unmodified lines
90279032 F: drivers/*/*/*loongson1*
90289033
90299034 MIPS RINT INSTRUCTION EMULATION
9030−M: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
9035+M: Aleksandar Markovic <aleksandar.markovic@mips.com>
90319036 L: linux-mips@linux-mips.org
90329037 S: Supported
90339038 F: arch/mips/math-emu/sp_rint.c
@@ -10692,10 +10697,9 @@ S: Maintained · 1658 unmodified lines
1069210697 F: drivers/pinctrl/spear/
1069310698
1069410699 PISTACHIO SOC SUPPORT
10695−M: James Hartley <james.hartley@imgtec.com>
10696−M: Ionela Voinescu <ionela.voinescu@imgtec.com>
10700+M: James Hartley <james.hartley@sondrel.com>
1069710701 L: linux-mips@linux-mips.org
10698−S: Maintained
10702+S: Odd Fixes
1069910703 F: arch/mips/pistachio/
1070010704 F: arch/mips/include/asm/mach-pistachio/
1070110705 F: arch/mips/boot/dts/img/pistachio*
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 4
33 PATCHLEVEL = 14
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc7
5+EXTRAVERSION = -rc8
66 NAME = Fearless Coyote
77
88 # *DOCUMENTATION*
arch/arm/Makefile+2−0
@@ -44,10 +44,12 @@ endif · 43 unmodified lines
4444
4545 ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
4646 KBUILD_CPPFLAGS += -mbig-endian
47+CHECKFLAGS += -D__ARMEB__
4748 AS += -EB
4849 LD += -EB
4950 else
5051 KBUILD_CPPFLAGS += -mlittle-endian
52+CHECKFLAGS += -D__ARMEL__
5153 AS += -EL
5254 LD += -EL
5355 endif
arch/arm/boot/compressed/vmlinux.lds.S+9−0
@@ -85,6 +85,15 @@ SECTIONS · 84 unmodified lines
8585
8686 _edata = .;
8787
88+ /*
89+ * The image_end section appears after any additional loadable sections
90+ * that the linker may decide to insert in the binary image. Having
91+ * this symbol allows further debug in the near future.
92+ */
93+ .image_end (NOLOAD) : {
94+ _edata_real = .;
95+ }
96+
8897 _magic_sig = ZIMAGE_MAGIC(0x016f2818);
8998 _magic_start = ZIMAGE_MAGIC(_start);
9099 _magic_end = ZIMAGE_MAGIC(_edata);
arch/arm/boot/dts/armada-375.dtsi+2−2
@@ -178,9 +178,9 @@ · 177 unmodified lines
178178 reg = <0x8000 0x1000>;
179179 cache-unified;
180180 cache-level = <2>;
181− arm,double-linefill-incr = <1>;
181+ arm,double-linefill-incr = <0>;
182182 arm,double-linefill-wrap = <0>;
183− arm,double-linefill = <1>;
183+ arm,double-linefill = <0>;
184184 prefetch-data = <1>;
185185 };
186186
arch/arm/boot/dts/armada-38x.dtsi+2−2
@@ -143,9 +143,9 @@ · 142 unmodified lines
143143 reg = <0x8000 0x1000>;
144144 cache-unified;
145145 cache-level = <2>;
146− arm,double-linefill-incr = <1>;
146+ arm,double-linefill-incr = <0>;
147147 arm,double-linefill-wrap = <0>;
148− arm,double-linefill = <1>;
148+ arm,double-linefill = <0>;
149149 prefetch-data = <1>;
150150 };
151151
arch/arm/boot/dts/armada-39x.dtsi+2−2
@@ -111,9 +111,9 @@ · 110 unmodified lines
111111 reg = <0x8000 0x1000>;
112112 cache-unified;
113113 cache-level = <2>;
114− arm,double-linefill-incr = <1>;
114+ arm,double-linefill-incr = <0>;
115115 arm,double-linefill-wrap = <0>;
116− arm,double-linefill = <1>;
116+ arm,double-linefill = <0>;
117117 prefetch-data = <1>;
118118 };
119119
arch/arm/boot/dts/uniphier-ld4.dtsi+6−3
@@ -209,7 +209,8 @@ · 208 unmodified lines
209209 interrupts = <0 80 4>;
210210 pinctrl-names = "default";
211211 pinctrl-0 = <&pinctrl_usb0>;
212− clocks = <&mio_clk 7>, <&mio_clk 8>, <&mio_clk 12>;
212+ clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 8>,
213+ <&mio_clk 12>;
213214 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,
214215 <&mio_rst 12>;
215216 };
@@ -221,7 +222,8 @@ · 5 unmodified lines
221222 interrupts = <0 81 4>;
222223 pinctrl-names = "default";
223224 pinctrl-0 = <&pinctrl_usb1>;
224− clocks = <&mio_clk 7>, <&mio_clk 9>, <&mio_clk 13>;
225+ clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 9>,
226+ <&mio_clk 13>;
225227 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,
226228 <&mio_rst 13>;
227229 };
@@ -233,7 +235,8 @@ · 5 unmodified lines
233235 interrupts = <0 82 4>;
234236 pinctrl-names = "default";
235237 pinctrl-0 = <&pinctrl_usb2>;
236− clocks = <&mio_clk 7>, <&mio_clk 10>, <&mio_clk 14>;
238+ clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 10>,
239+ <&mio_clk 14>;
237240 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>,
238241 <&mio_rst 14>;
239242 };
arch/arm/boot/dts/uniphier-pro4.dtsi+4−2
@@ -241,7 +241,8 @@ · 240 unmodified lines
241241 interrupts = <0 80 4>;
242242 pinctrl-names = "default";
243243 pinctrl-0 = <&pinctrl_usb2>;
244− clocks = <&mio_clk 7>, <&mio_clk 8>, <&mio_clk 12>;
244+ clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 8>,
245+ <&mio_clk 12>;
245246 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,
246247 <&mio_rst 12>;
247248 };
@@ -253,7 +254,8 @@ · 5 unmodified lines
253254 interrupts = <0 81 4>;
254255 pinctrl-names = "default";
255256 pinctrl-0 = <&pinctrl_usb3>;
256− clocks = <&mio_clk 7>, <&mio_clk 9>, <&mio_clk 13>;
257+ clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 9>,
258+ <&mio_clk 13>;
257259 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,
258260 <&mio_rst 13>;
259261 };
arch/arm/boot/dts/uniphier-sld8.dtsi+6−3
@@ -209,7 +209,8 @@ · 208 unmodified lines
209209 interrupts = <0 80 4>;
210210 pinctrl-names = "default";
211211 pinctrl-0 = <&pinctrl_usb0>;
212− clocks = <&mio_clk 7>, <&mio_clk 8>, <&mio_clk 12>;
212+ clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 8>,
213+ <&mio_clk 12>;
213214 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,
214215 <&mio_rst 12>;
215216 };
@@ -221,7 +222,8 @@ · 5 unmodified lines
221222 interrupts = <0 81 4>;
222223 pinctrl-names = "default";
223224 pinctrl-0 = <&pinctrl_usb1>;
224− clocks = <&mio_clk 7>, <&mio_clk 9>, <&mio_clk 13>;
225+ clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 9>,
226+ <&mio_clk 13>;
225227 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,
226228 <&mio_rst 13>;
227229 };
@@ -233,7 +235,8 @@ · 5 unmodified lines
233235 interrupts = <0 82 4>;
234236 pinctrl-names = "default";
235237 pinctrl-0 = <&pinctrl_usb2>;
236− clocks = <&mio_clk 7>, <&mio_clk 10>, <&mio_clk 14>;
238+ clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 10>,
239+ <&mio_clk 14>;
237240 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>,
238241 <&mio_rst 14>;
239242 };
arch/arm/include/asm/Kbuild+0−1
@@ -20,7 +20,6 @@ generic-y += simd.h · 19 unmodified lines
2020 generic-y += sizes.h
2121 generic-y += timex.h
2222 generic-y += trace_clock.h
23−generic-y += unaligned.h
2423
2524 generated-y += mach-types.h
2625 generated-y += unistd-nr.h
arch/arm/include/asm/unaligned.h+27−0
@@ -0,0 +1,27 @@
1+#ifndef __ASM_ARM_UNALIGNED_H
2+#define __ASM_ARM_UNALIGNED_H
3+
4+/*
5+ * We generally want to set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS on ARMv6+,
6+ * but we don't want to use linux/unaligned/access_ok.h since that can lead
7+ * to traps on unaligned stm/ldm or strd/ldrd.
8+ */
9+#include <asm/byteorder.h>
10+
11+#if defined(__LITTLE_ENDIAN)
12+# include <linux/unaligned/le_struct.h>
13+# include <linux/unaligned/be_byteshift.h>
14+# include <linux/unaligned/generic.h>
15+# define get_unaligned __get_unaligned_le
16+# define put_unaligned __put_unaligned_le
17+#elif defined(__BIG_ENDIAN)
18+# include <linux/unaligned/be_struct.h>
19+# include <linux/unaligned/le_byteshift.h>
20+# include <linux/unaligned/generic.h>
21+# define get_unaligned __get_unaligned_be
22+# define put_unaligned __put_unaligned_be
23+#else
24+# error need to define endianess
25+#endif
26+
27+#endif /* __ASM_ARM_UNALIGNED_H */
arch/arm/kvm/emulate.c+2−4
@@ -227,7 +227,7 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu) · 226 unmodified lines
227227 u32 return_offset = (is_thumb) ? 2 : 4;
228228
229229 kvm_update_psr(vcpu, UND_MODE);
230− *vcpu_reg(vcpu, 14) = *vcpu_pc(vcpu) - return_offset;
230+ *vcpu_reg(vcpu, 14) = *vcpu_pc(vcpu) + return_offset;
231231
232232 /* Branch to exception vector */
233233 *vcpu_pc(vcpu) = exc_vector_base(vcpu) + vect_offset;
@@ -239,10 +239,8 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu) · 5 unmodified lines
239239 */
240240 static void inject_abt(struct kvm_vcpu *vcpu, bool is_pabt, unsigned long addr)
241241 {
242− unsigned long cpsr = *vcpu_cpsr(vcpu);
243− bool is_thumb = (cpsr & PSR_T_BIT);
244242 u32 vect_offset;
245− u32 return_offset = (is_thumb) ? 4 : 0;
243+ u32 return_offset = (is_pabt) ? 4 : 8;
246244 bool is_lpae;
247245
248246 kvm_update_psr(vcpu, ABT_MODE);
arch/arm/kvm/hyp/Makefile+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 # Makefile for Kernel-based Virtual Machine module, HYP part
44 #
55
6−ccflags-y += -fno-stack-protector
6+ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING
77
88 KVM=../../../../virt/kvm
99
arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi+6−3
@@ -299,7 +299,8 @@ · 298 unmodified lines
299299 interrupts = <0 243 4>;
300300 pinctrl-names = "default";
301301 pinctrl-0 = <&pinctrl_usb0>;
302− clocks = <&mio_clk 7>, <&mio_clk 8>, <&mio_clk 12>;
302+ clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 8>,
303+ <&mio_clk 12>;
303304 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,
304305 <&mio_rst 12>;
305306 };
@@ -311,7 +312,8 @@ · 5 unmodified lines
311312 interrupts = <0 244 4>;
312313 pinctrl-names = "default";
313314 pinctrl-0 = <&pinctrl_usb1>;
314− clocks = <&mio_clk 7>, <&mio_clk 9>, <&mio_clk 13>;
315+ clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 9>,
316+ <&mio_clk 13>;
315317 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,
316318 <&mio_rst 13>;
317319 };
@@ -323,7 +325,8 @@ · 5 unmodified lines
323325 interrupts = <0 245 4>;
324326 pinctrl-names = "default";
325327 pinctrl-0 = <&pinctrl_usb2>;
326− clocks = <&mio_clk 7>, <&mio_clk 10>, <&mio_clk 14>;
328+ clocks = <&sys_clk 8>, <&mio_clk 7>, <&mio_clk 10>,
329+ <&mio_clk 14>;
327330 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>,
328331 <&mio_rst 14>;
329332 };
arch/arm64/kvm/hyp/Makefile+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 # Makefile for Kernel-based Virtual Machine module, HYP part
44 #
55
6−ccflags-y += -fno-stack-protector
6+ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING
77
88 KVM=../../../../virt/kvm
99
arch/arm64/kvm/inject_fault.c+15−1
@@ -33,12 +33,26 @@ · 32 unmodified lines
3333 #define LOWER_EL_AArch64_VECTOR 0x400
3434 #define LOWER_EL_AArch32_VECTOR 0x600
3535
36+/*
37+ * Table taken from ARMv8 ARM DDI0487B-B, table G1-10.
38+ */
39+static const u8 return_offsets[8][2] = {
40+ [0] = { 0, 0 }, /* Reset, unused */
41+ [1] = { 4, 2 }, /* Undefined */
42+ [2] = { 0, 0 }, /* SVC, unused */
43+ [3] = { 4, 4 }, /* Prefetch abort */
44+ [4] = { 8, 8 }, /* Data abort */
45+ [5] = { 0, 0 }, /* HVC, unused */
46+ [6] = { 4, 4 }, /* IRQ, unused */
47+ [7] = { 4, 4 }, /* FIQ, unused */
48+};
49+
3650 static void prepare_fault32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset)
3751 {
3852 unsigned long cpsr;
3953 unsigned long new_spsr_value = *vcpu_cpsr(vcpu);
4054 bool is_thumb = (new_spsr_value & COMPAT_PSR_T_BIT);
41− u32 return_offset = (is_thumb) ? 4 : 0;
55+ u32 return_offset = return_offsets[vect_offset >> 2][is_thumb];
4256 u32 sctlr = vcpu_cp15(vcpu, c1_SCTLR);
4357
4458 cpsr = mode | COMPAT_PSR_I_BIT;
arch/ia64/include/asm/acpi.h+2−0
@@ -112,6 +112,8 @@ static inline void arch_acpi_set_pdc_bits(u32 *buf) · 111 unmodified lines
112112 buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
113113 }
114114
115+#define acpi_unlazy_tlb(x)
116+
115117 #ifdef CONFIG_ACPI_NUMA
116118 extern cpumask_t early_cpu_possible_map;
117119 #define for_each_possible_early_cpu(cpu) \
arch/mips/generic/board-ni169445.its.S+1−1
@@ -1,4 +1,4 @@
1−{
1+/ {
22 images {
33 fdt@ni169445 {
44 description = "NI 169445 device tree";
arch/mips/generic/init.c+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 #include <asm/fw/fw.h>
2121 #include <asm/irq_cpu.h>
2222 #include <asm/machine.h>
23−#include <asm/mips-cpc.h>
23+#include <asm/mips-cps.h>
2424 #include <asm/prom.h>
2525 #include <asm/smp-ops.h>
2626 #include <asm/time.h>
arch/mips/generic/kexec.c+1−1
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 2016 Imagination Technologies
3− * Author: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
3+ * Author: Marcin Nowakowski <marcin.nowakowski@mips.com>
44 *
55 * This program is free software; you can redistribute it and/or modify it
66 * under the terms of the GNU General Public License as published by the
arch/mips/include/asm/mips-cm.h+2−2
@@ -142,8 +142,8 @@ GCR_ACCESSOR_RO(64, 0x000, config) · 141 unmodified lines
142142 GCR_ACCESSOR_RW(64, 0x008, base)
143143 #define CM_GCR_BASE_GCRBASE GENMASK_ULL(47, 15)
144144 #define CM_GCR_BASE_CMDEFTGT GENMASK(1, 0)
145−#define CM_GCR_BASE_CMDEFTGT_DISABLED 0
146−#define CM_GCR_BASE_CMDEFTGT_MEM 1
145+#define CM_GCR_BASE_CMDEFTGT_MEM 0
146+#define CM_GCR_BASE_CMDEFTGT_RESERVED 1
147147 #define CM_GCR_BASE_CMDEFTGT_IOCU0 2
148148 #define CM_GCR_BASE_CMDEFTGT_IOCU1 3
149149
arch/mips/include/asm/stackframe.h+4−4
@@ -199,6 +199,10 @@ · 198 unmodified lines
199199 sll k0, 3 /* extract cu0 bit */
200200 .set noreorder
201201 bltz k0, 8f
202+ move k0, sp
203+ .if \docfi
204+ .cfi_register sp, k0
205+ .endif
202206 #ifdef CONFIG_EVA
203207 /*
204208 * Flush interAptiv's Return Prediction Stack (RPS) by writing
@@ -225,10 +229,6 @@ · 20 unmodified lines
225229 MTC0 k0, CP0_ENTRYHI
226230 #endif
227231 .set reorder
228− move k0, sp
229− .if \docfi
230− .cfi_register sp, k0
231− .endif
232232 /* Called from user mode, new stack. */
233233 get_saved_sp docfi=\docfi tosp=1
234234 8:
arch/mips/kernel/probes-common.h+1−1
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 2016 Imagination Technologies
3− * Author: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
3+ * Author: Marcin Nowakowski <marcin.nowakowski@mips.com>
44 *
55 * This program is free software; you can redistribute it and/or modify it
66 * under the terms of the GNU General Public License as published by the
arch/mips/kernel/smp-cmp.c+3−3
@@ -19,7 +19,7 @@ · 18 unmodified lines
1919 #undef DEBUG
2020
2121 #include <linux/kernel.h>
22−#include <linux/sched.h>
22+#include <linux/sched/task_stack.h>
2323 #include <linux/smp.h>
2424 #include <linux/cpumask.h>
2525 #include <linux/interrupt.h>
@@ -50,8 +50,8 @@ static void cmp_init_secondary(void) · 24 unmodified lines
5050
5151 #ifdef CONFIG_MIPS_MT_SMP
5252 if (cpu_has_mipsmt)
53− c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) &
54− TCBIND_CURVPE;
53+ cpu_set_vpe_id(c, (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) &
54+ TCBIND_CURVPE);
5555 #endif
5656 }
5757
arch/mips/kernel/smp-cps.c+1−1
@@ -306,7 +306,7 @@ static int cps_boot_secondary(int cpu, struct task_struct *idle) · 305 unmodified lines
306306 int err;
307307
308308 /* We don't yet support booting CPUs in other clusters */
309− if (cpu_cluster(&cpu_data[cpu]) != cpu_cluster(&current_cpu_data))
309+ if (cpu_cluster(&cpu_data[cpu]) != cpu_cluster(&raw_current_cpu_data))
310310 return -ENOSYS;
311311
312312 vpe_cfg->pc = (unsigned long)&smp_bootstrap;
arch/mips/kernel/smp.c+17−7
@@ -42,7 +42,7 @@ · 41 unmodified lines
4242 #include <asm/processor.h>
4343 #include <asm/idle.h>
4444 #include <asm/r4k-timer.h>
45−#include <asm/mips-cpc.h>
45+#include <asm/mips-cps.h>
4646 #include <asm/mmu_context.h>
4747 #include <asm/time.h>
4848 #include <asm/setup.h>
@@ -66,6 +66,7 @@ EXPORT_SYMBOL(cpu_sibling_map); · 17 unmodified lines
6666 cpumask_t cpu_core_map[NR_CPUS] __read_mostly;
6767 EXPORT_SYMBOL(cpu_core_map);
6868
69+static DECLARE_COMPLETION(cpu_starting);
6970 static DECLARE_COMPLETION(cpu_running);
7071
7172 /*
@@ -374,6 +375,12 @@ asmlinkage void start_secondary(void) · 302 unmodified lines
374375 cpumask_set_cpu(cpu, &cpu_coherent_mask);
375376 notify_cpu_starting(cpu);
376377
378+ /* Notify boot CPU that we're starting & ready to sync counters */
379+ complete(&cpu_starting);
380+
381+ synchronise_count_slave(cpu);
382+
383+ /* The CPU is running and counters synchronised, now mark it online */
377384 set_cpu_online(cpu, true);
378385
379386 set_cpu_sibling_map(cpu);
@@ -381,8 +388,11 @@ asmlinkage void start_secondary(void) · 1 unmodified line
381388
382389 calculate_cpu_foreign_map();
383390
391+ /*
392+ * Notify boot CPU that we're up & online and it can safely return
393+ * from __cpu_up
394+ */
384395 complete(&cpu_running);
385− synchronise_count_slave(cpu);
386396
387397 /*
388398 * irq will be enabled in ->smp_finish(), enabling it too early
@@ -445,17 +455,17 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) · 56 unmodified lines
445455 if (err)
446456 return err;
447457
448− /*
449− * We must check for timeout here, as the CPU will not be marked
450− * online until the counters are synchronised.
451− */
452− if (!wait_for_completion_timeout(&cpu_running,
458+ /* Wait for CPU to start and be ready to sync counters */
459+ if (!wait_for_completion_timeout(&cpu_starting,
453460 msecs_to_jiffies(1000))) {
454461 pr_crit("CPU%u: failed to start\n", cpu);
455462 return -EIO;
456463 }
457464
458465 synchronise_count_master(cpu);
466+
467+ /* Wait for CPU to finish startup & mark itself online before return */
468+ wait_for_completion(&cpu_running);
459469 return 0;
460470 }
461471
arch/mips/mm/uasm-micromips.c+1−1
@@ -80,7 +80,7 @@ static const struct insn const insn_table_MM[insn_invalid] = { · 79 unmodified lines
8080 [insn_jr] = {M(mm_pool32a_op, 0, 0, 0, mm_jalr_op, mm_pool32axf_op), RS},
8181 [insn_lb] = {M(mm_lb32_op, 0, 0, 0, 0, 0), RT | RS | SIMM},
8282 [insn_ld] = {0, 0},
83− [insn_lh] = {M(mm_lh32_op, 0, 0, 0, 0, 0), RS | RS | SIMM},
83+ [insn_lh] = {M(mm_lh32_op, 0, 0, 0, 0, 0), RT | RS | SIMM},
8484 [insn_ll] = {M(mm_pool32c_op, 0, 0, (mm_ll_func << 1), 0, 0), RS | RT | SIMM},
8585 [insn_lld] = {0, 0},
8686 [insn_lui] = {M(mm_pool32i_op, mm_lui_op, 0, 0, 0, 0), RS | SIMM},
arch/mips/net/ebpf_jit.c+1−1
@@ -1513,7 +1513,7 @@ ld_skb_common: · 1512 unmodified lines
15131513 }
15141514 src = ebpf_to_mips_reg(ctx, insn, src_reg_no_fp);
15151515 if (src < 0)
1516− return dst;
1516+ return src;
15171517 if (BPF_MODE(insn->code) == BPF_XADD) {
15181518 switch (BPF_SIZE(insn->code)) {
15191519 case BPF_W:
arch/x86/crypto/sha1-mb/sha1_mb_mgr_flush_avx2.S+6−6
@@ -157,8 +157,8 @@ LABEL skip_ %I · 156 unmodified lines
157157 .endr
158158
159159 # Find min length
160− vmovdqa _lens+0*16(state), %xmm0
161− vmovdqa _lens+1*16(state), %xmm1
160+ vmovdqu _lens+0*16(state), %xmm0
161+ vmovdqu _lens+1*16(state), %xmm1
162162
163163 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
164164 vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
@@ -178,8 +178,8 @@ LABEL skip_ %I · 13 unmodified lines
178178 vpsubd %xmm2, %xmm0, %xmm0
179179 vpsubd %xmm2, %xmm1, %xmm1
180180
181− vmovdqa %xmm0, _lens+0*16(state)
182− vmovdqa %xmm1, _lens+1*16(state)
181+ vmovdqu %xmm0, _lens+0*16(state)
182+ vmovdqu %xmm1, _lens+1*16(state)
183183
184184 # "state" and "args" are the same address, arg1
185185 # len is arg2
@@ -235,8 +235,8 @@ ENTRY(sha1_mb_mgr_get_comp_job_avx2) · 49 unmodified lines
235235 jc .return_null
236236
237237 # Find min length
238− vmovdqa _lens(state), %xmm0
239− vmovdqa _lens+1*16(state), %xmm1
238+ vmovdqu _lens(state), %xmm0
239+ vmovdqu _lens+1*16(state), %xmm1
240240
241241 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
242242 vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
arch/x86/crypto/sha256-mb/sha256_mb_mgr_flush_avx2.S+6−6
@@ -155,8 +155,8 @@ LABEL skip_ %I · 154 unmodified lines
155155 .endr
156156
157157 # Find min length
158− vmovdqa _lens+0*16(state), %xmm0
159− vmovdqa _lens+1*16(state), %xmm1
158+ vmovdqu _lens+0*16(state), %xmm0
159+ vmovdqu _lens+1*16(state), %xmm1
160160
161161 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
162162 vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
@@ -176,8 +176,8 @@ LABEL skip_ %I · 13 unmodified lines
176176 vpsubd %xmm2, %xmm0, %xmm0
177177 vpsubd %xmm2, %xmm1, %xmm1
178178
179− vmovdqa %xmm0, _lens+0*16(state)
180− vmovdqa %xmm1, _lens+1*16(state)
179+ vmovdqu %xmm0, _lens+0*16(state)
180+ vmovdqu %xmm1, _lens+1*16(state)
181181
182182 # "state" and "args" are the same address, arg1
183183 # len is arg2
@@ -234,8 +234,8 @@ ENTRY(sha256_mb_mgr_get_comp_job_avx2) · 50 unmodified lines
234234 jc .return_null
235235
236236 # Find min length
237− vmovdqa _lens(state), %xmm0
238− vmovdqa _lens+1*16(state), %xmm1
237+ vmovdqu _lens(state), %xmm0
238+ vmovdqu _lens+1*16(state), %xmm1
239239
240240 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
241241 vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
arch/x86/include/asm/acpi.h+2−0
@@ -150,6 +150,8 @@ static inline void disable_acpi(void) { } · 149 unmodified lines
150150 extern int x86_acpi_numa_init(void);
151151 #endif /* CONFIG_ACPI_NUMA */
152152
153+#define acpi_unlazy_tlb(x) leave_mm(x)
154+
153155 #ifdef CONFIG_ACPI_APEI
154156 static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
155157 {
arch/x86/kernel/cpu/mcheck/dev-mcelog.c+27−94
@@ -24,14 +24,6 @@ static DEFINE_MUTEX(mce_chrdev_read_mutex); · 23 unmodified lines
2424 static char mce_helper[128];
2525 static char *mce_helper_argv[2] = { mce_helper, NULL };
2626
27−#define mce_log_get_idx_check(p) \
28−({ \
29− RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held() && \
30− !lockdep_is_held(&mce_chrdev_read_mutex), \
31− "suspicious mce_log_get_idx_check() usage"); \
32− smp_load_acquire(&(p)); \
33−})
34−
3527 /*
3628 * Lockless MCE logging infrastructure.
3729 * This avoids deadlocks on printk locks without having to break locks. Also
@@ -53,43 +45,32 @@ static int dev_mce_log(struct notifier_block *nb, unsigned long val, · 15 unmodified lines
5345 void *data)
5446 {
5547 struct mce *mce = (struct mce *)data;
56− unsigned int next, entry;
57−
58− wmb();
59− for (;;) {
60− entry = mce_log_get_idx_check(mcelog.next);
61− for (;;) {
62−
63− /*
64− * When the buffer fills up discard new entries.
65− * Assume that the earlier errors are the more
66− * interesting ones:
67− */
68− if (entry >= MCE_LOG_LEN) {
69− set_bit(MCE_OVERFLOW,
70− (unsigned long *)&mcelog.flags);
71− return NOTIFY_OK;
72− }
73− /* Old left over entry. Skip: */
74− if (mcelog.entry[entry].finished) {
75− entry++;
76− continue;
77− }
78− break;
79− }
80− smp_rmb();
81− next = entry + 1;
82− if (cmpxchg(&mcelog.next, entry, next) == entry)
83− break;
48+ unsigned int entry;
49+
50+ mutex_lock(&mce_chrdev_read_mutex);
51+
52+ entry = mcelog.next;
53+
54+ /*
55+ * When the buffer fills up discard new entries. Assume that the
56+ * earlier errors are the more interesting ones:
57+ */
58+ if (entry >= MCE_LOG_LEN) {
59+ set_bit(MCE_OVERFLOW, (unsigned long *)&mcelog.flags);
60+ goto unlock;
8461 }
62+
63+ mcelog.next = entry + 1;
64+
8565 memcpy(mcelog.entry + entry, mce, sizeof(struct mce));
86− wmb();
8766 mcelog.entry[entry].finished = 1;
88− wmb();
8967
9068 /* wake processes polling /dev/mcelog */
9169 wake_up_interruptible(&mce_chrdev_wait);
9270
71+unlock:
72+ mutex_unlock(&mce_chrdev_read_mutex);
73+
9374 return NOTIFY_OK;
9475 }
9576
@@ -177,13 +158,6 @@ static int mce_chrdev_release(struct inode *inode, struct file *file) · 81 unmodified lines
177158 return 0;
178159 }
179160
180−static void collect_tscs(void *data)
181−{
182− unsigned long *cpu_tsc = (unsigned long *)data;
183−
184− cpu_tsc[smp_processor_id()] = rdtsc();
185−}
186−
187161 static int mce_apei_read_done;
188162
189163 /* Collect MCE record of previous boot in persistent storage via APEI ERST. */
@@ -231,14 +205,9 @@ static ssize_t mce_chrdev_read(struct file *filp, char __user *ubuf, · 41 unmodified lines
231205 size_t usize, loff_t *off)
232206 {
233207 char __user *buf = ubuf;
234− unsigned long *cpu_tsc;
235− unsigned prev, next;
208+ unsigned next;
236209 int i, err;
237210
238− cpu_tsc = kmalloc(nr_cpu_ids * sizeof(long), GFP_KERNEL);
239− if (!cpu_tsc)
240− return -ENOMEM;
241−
242211 mutex_lock(&mce_chrdev_read_mutex);
243212
244213 if (!mce_apei_read_done) {
@@ -247,65 +216,29 @@ static ssize_t mce_chrdev_read(struct file *filp, char __user *ubuf, · 2 unmodified lines
247216 goto out;
248217 }
249218
250− next = mce_log_get_idx_check(mcelog.next);
251−
252219 /* Only supports full reads right now */
253220 err = -EINVAL;
254221 if (*off != 0 || usize < MCE_LOG_LEN*sizeof(struct mce))
255222 goto out;
256223
224+ next = mcelog.next;
257225 err = 0;
258− prev = 0;
259− do {
260− for (i = prev; i < next; i++) {
261− unsigned long start = jiffies;
262− struct mce *m = &mcelog.entry[i];
263−
264− while (!m->finished) {
265− if (time_after_eq(jiffies, start + 2)) {
266− memset(m, 0, sizeof(*m));
267− goto timeout;
268− }
269− cpu_relax();
270− }
271− smp_rmb();
272− err |= copy_to_user(buf, m, sizeof(*m));
273− buf += sizeof(*m);
274−timeout:
275− ;
276− }
277−
278− memset(mcelog.entry + prev, 0,
279− (next - prev) * sizeof(struct mce));
280− prev = next;
281− next = cmpxchg(&mcelog.next, prev, 0);
282− } while (next != prev);
283−
284− synchronize_sched();
285226
286− /*
287− * Collect entries that were still getting written before the
288− * synchronize.
289− */
290− on_each_cpu(collect_tscs, cpu_tsc, 1);
291−
292− for (i = next; i < MCE_LOG_LEN; i++) {
227+ for (i = 0; i < next; i++) {
293228 struct mce *m = &mcelog.entry[i];
294229
295− if (m->finished && m->tsc < cpu_tsc[m->cpu]) {
296− err |= copy_to_user(buf, m, sizeof(*m));
297− smp_rmb();
298− buf += sizeof(*m);
299− memset(m, 0, sizeof(*m));
300− }
230+ err |= copy_to_user(buf, m, sizeof(*m));
231+ buf += sizeof(*m);
301232 }
302233
234+ memset(mcelog.entry, 0, next * sizeof(struct mce));
235+ mcelog.next = 0;
236+
303237 if (err)
304238 err = -EFAULT;
305239
306240 out:
307241 mutex_unlock(&mce_chrdev_read_mutex);
308− kfree(cpu_tsc);
309242
310243 return err ? err : buf - ubuf;
311244 }
arch/x86/kernel/kvmclock.c+1−1
@@ -79,7 +79,7 @@ static void kvm_get_wallclock(struct timespec *now) · 78 unmodified lines
7979
8080 static int kvm_set_wallclock(const struct timespec *now)
8181 {
82− return -1;
82+ return -ENODEV;
8383 }
8484
8585 static u64 kvm_clock_read(void)
arch/x86/kernel/module.c+13−0
@@ -172,19 +172,27 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, · 171 unmodified lines
172172 case R_X86_64_NONE:
173173 break;
174174 case R_X86_64_64:
175+ if (*(u64 *)loc != 0)
176+ goto invalid_relocation;
175177 *(u64 *)loc = val;
176178 break;
177179 case R_X86_64_32:
180+ if (*(u32 *)loc != 0)
181+ goto invalid_relocation;
178182 *(u32 *)loc = val;
179183 if (val != *(u32 *)loc)
180184 goto overflow;
181185 break;
182186 case R_X86_64_32S:
187+ if (*(s32 *)loc != 0)
188+ goto invalid_relocation;
183189 *(s32 *)loc = val;
184190 if ((s64)val != *(s32 *)loc)
185191 goto overflow;
186192 break;
187193 case R_X86_64_PC32:
194+ if (*(u32 *)loc != 0)
195+ goto invalid_relocation;
188196 val -= (u64)loc;
189197 *(u32 *)loc = val;
190198 #if 0
@@ -200,6 +208,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, · 9 unmodified lines
200208 }
201209 return 0;
202210
211+invalid_relocation:
212+ pr_err("x86/modules: Skipping invalid relocation target, existing value is nonzero for type %d, loc %p, val %Lx\n",
213+ (int)ELF64_R_TYPE(rel[i].r_info), loc, val);
214+ return -ENOEXEC;
215+
203216 overflow:
204217 pr_err("overflow in relocation type %d val %Lx\n",
205218 (int)ELF64_R_TYPE(rel[i].r_info), val);
arch/x86/kvm/lapic.c+5−0
@@ -1992,6 +1992,11 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu, bool init_event) · 1991 unmodified lines
19921992 vcpu->arch.apic_base | MSR_IA32_APICBASE_BSP);
19931993 vcpu->arch.pv_eoi.msr_val = 0;
19941994 apic_update_ppr(apic);
1995+ if (vcpu->arch.apicv_active) {
1996+ kvm_x86_ops->apicv_post_state_restore(vcpu);
1997+ kvm_x86_ops->hwapic_irr_update(vcpu, -1);
1998+ kvm_x86_ops->hwapic_isr_update(vcpu, -1);
1999+ }
19952000
19962001 vcpu->arch.apic_arb_prio = 0;
19972002 vcpu->arch.apic_attention = 0;
arch/x86/kvm/vmx.c+0−3
@@ -5619,9 +5619,6 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) · 5618 unmodified lines
56195619
56205620 kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu);
56215621
5622− if (kvm_vcpu_apicv_active(vcpu))
5623− memset(&vmx->pi_desc, 0, sizeof(struct pi_desc));
5624−
56255622 if (vmx->vpid != 0)
56265623 vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
56275624
arch/x86/mm/mem_encrypt.c+1−1
@@ -40,7 +40,7 @@ static char sme_cmdline_off[] __initdata = "off"; · 39 unmodified lines
4040 * section is later cleared.
4141 */
4242 u64 sme_me_mask __section(.data) = 0;
43−EXPORT_SYMBOL_GPL(sme_me_mask);
43+EXPORT_SYMBOL(sme_me_mask);
4444
4545 /* Buffer used for early in-place encryption by BSP, no locking needed */
4646 static char sme_early_buffer[PAGE_SIZE] __aligned(PAGE_SIZE);
arch/x86/mm/tlb.c+14−3
@@ -85,6 +85,7 @@ void leave_mm(int cpu) · 84 unmodified lines
8585
8686 switch_mm(NULL, &init_mm, NULL);
8787 }
88+EXPORT_SYMBOL_GPL(leave_mm);
8889
8990 void switch_mm(struct mm_struct *prev, struct mm_struct *next,
9091 struct task_struct *tsk)
@@ -195,12 +196,22 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next, · 104 unmodified lines
195196 this_cpu_write(cpu_tlbstate.ctxs[new_asid].ctx_id, next->context.ctx_id);
196197 this_cpu_write(cpu_tlbstate.ctxs[new_asid].tlb_gen, next_tlb_gen);
197198 write_cr3(build_cr3(next, new_asid));
198− trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH,
199− TLB_FLUSH_ALL);
199+
200+ /*
201+ * NB: This gets called via leave_mm() in the idle path
202+ * where RCU functions differently. Tracing normally
203+ * uses RCU, so we need to use the _rcuidle variant.
204+ *
205+ * (There is no good reason for this. The idle code should
206+ * be rearranged to call this before rcu_idle_enter().)
207+ */
208+ trace_tlb_flush_rcuidle(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
200209 } else {
201210 /* The new ASID is already up to date. */
202211 write_cr3(build_cr3_noflush(next, new_asid));
203− trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, 0);
212+
213+ /* See above wrt _rcuidle. */
214+ trace_tlb_flush_rcuidle(TLB_FLUSH_ON_TASK_SWITCH, 0);
204215 }
205216
206217 this_cpu_write(cpu_tlbstate.loaded_mm, next);
crypto/ccm.c+3−1
@@ -363,7 +363,7 @@ static int crypto_ccm_decrypt(struct aead_request *req) · 362 unmodified lines
363363 unsigned int cryptlen = req->cryptlen;
364364 u8 *authtag = pctx->auth_tag;
365365 u8 *odata = pctx->odata;
366− u8 *iv = req->iv;
366+ u8 *iv = pctx->idata;
367367 int err;
368368
369369 cryptlen -= authsize;
@@ -379,6 +379,8 @@ static int crypto_ccm_decrypt(struct aead_request *req) · 9 unmodified lines
379379 if (req->src != req->dst)
380380 dst = pctx->dst;
381381
382+ memcpy(iv, req->iv, 16);
383+
382384 skcipher_request_set_tfm(skreq, ctx->ctr);
383385 skcipher_request_set_callback(skreq, pctx->flags,
384386 crypto_ccm_decrypt_done, req);
drivers/acpi/processor_idle.c+2−0
@@ -710,6 +710,8 @@ static DEFINE_RAW_SPINLOCK(c3_lock); · 709 unmodified lines
710710 static void acpi_idle_enter_bm(struct acpi_processor *pr,
711711 struct acpi_processor_cx *cx, bool timer_bc)
712712 {
713+ acpi_unlazy_tlb(smp_processor_id());
714+
713715 /*
714716 * Must be done before busmaster disable as we might need to
715717 * access HPET !
drivers/acpi/sleep.c+28−0
@@ -160,6 +160,14 @@ static int __init init_nvs_nosave(const struct dmi_system_id *d) · 159 unmodified lines
160160 return 0;
161161 }
162162
163+static bool acpi_sleep_no_lps0;
164+
165+static int __init init_no_lps0(const struct dmi_system_id *d)
166+{
167+ acpi_sleep_no_lps0 = true;
168+ return 0;
169+}
170+
163171 static const struct dmi_system_id acpisleep_dmi_table[] __initconst = {
164172 {
165173 .callback = init_old_suspend_ordering,
@@ -343,6 +351,19 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { · 177 unmodified lines
343351 DMI_MATCH(DMI_PRODUCT_NAME, "80E3"),
344352 },
345353 },
354+ /*
355+ * https://bugzilla.kernel.org/show_bug.cgi?id=196907
356+ * Some Dell XPS13 9360 cannot do suspend-to-idle using the Low Power
357+ * S0 Idle firmware interface.
358+ */
359+ {
360+ .callback = init_no_lps0,
361+ .ident = "Dell XPS13 9360",
362+ .matches = {
363+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
364+ DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9360"),
365+ },
366+ },
346367 {},
347368 };
348369
@@ -485,6 +506,7 @@ static void acpi_pm_end(void) · 136 unmodified lines
485506 }
486507 #else /* !CONFIG_ACPI_SLEEP */
487508 #define acpi_target_sleep_state ACPI_STATE_S0
509+#define acpi_sleep_no_lps0 (false)
488510 static inline void acpi_sleep_dmi_check(void) {}
489511 #endif /* CONFIG_ACPI_SLEEP */
490512
@@ -863,6 +885,12 @@ static int lps0_device_attach(struct acpi_device *adev, · 372 unmodified lines
863885 if (lps0_device_handle)
864886 return 0;
865887
888+ if (acpi_sleep_no_lps0) {
889+ acpi_handle_info(adev->handle,
890+ "Low Power S0 Idle interface disabled\n");
891+ return 0;
892+ }
893+
866894 if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
867895 return 0;
868896
drivers/firmware/efi/libstub/Makefile+3−3
@@ -34,13 +34,14 @@ lib-y := efi-stub-helper.o gop.o secureboot.o · 33 unmodified lines
3434 lib-$(CONFIG_RESET_ATTACK_MITIGATION) += tpm.o
3535
3636 # include the stub's generic dependencies from lib/ when building for ARM/arm64
37−arm-deps := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c fdt_sw.c sort.c
37+arm-deps-y := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c fdt_sw.c
38+arm-deps-$(CONFIG_ARM64) += sort.c
3839
3940 $(obj)/lib-%.o: $(srctree)/lib/%.c FORCE
4041 $(call if_changed_rule,cc_o_c)
4142
4243 lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o string.o random.o \
43− $(patsubst %.c,lib-%.o,$(arm-deps))
44+ $(patsubst %.c,lib-%.o,$(arm-deps-y))
4445
4546 lib-$(CONFIG_ARM) += arm32-stub.o
4647 lib-$(CONFIG_ARM64) += arm64-stub.o
@@ -91,5 +92,4 @@ quiet_cmd_stubcopy = STUBCPY $@ · 44 unmodified lines
9192 # explicitly by the decompressor linker script.
9293 #
9394 STUBCOPY_FLAGS-$(CONFIG_ARM) += --rename-section .data=.data.efistub
94−STUBCOPY_RM-$(CONFIG_ARM) += -R ___ksymtab+sort -R ___kcrctab+sort
9595 STUBCOPY_RELOC-$(CONFIG_ARM) := R_ARM_ABS
drivers/firmware/efi/libstub/arm-stub.c+5−2
@@ -350,7 +350,9 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size, · 349 unmodified lines
350350 * The easiest way to find adjacent regions is to sort the memory map
351351 * before traversing it.
352352 */
353− sort(memory_map, map_size / desc_size, desc_size, cmp_mem_desc, NULL);
353+ if (IS_ENABLED(CONFIG_ARM64))
354+ sort(memory_map, map_size / desc_size, desc_size, cmp_mem_desc,
355+ NULL);
354356
355357 for (l = 0; l < map_size; l += desc_size, prev = in) {
356358 u64 paddr, size;
@@ -367,7 +369,8 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size, · 10 unmodified lines
367369 * a 4k page size kernel to kexec a 64k page size kernel and
368370 * vice versa.
369371 */
370− if (!regions_are_adjacent(prev, in) ||
372+ if ((IS_ENABLED(CONFIG_ARM64) &&
373+ !regions_are_adjacent(prev, in)) ||
371374 !regions_have_compatible_memory_type_attrs(prev, in)) {
372375
373376 paddr = round_down(in->phys_addr, SZ_64K);
drivers/ide/ide-cd.c+6−1
@@ -867,11 +867,16 @@ static void msf_from_bcd(struct atapi_msf *msf) · 866 unmodified lines
867867 int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense)
868868 {
869869 struct cdrom_info *info = drive->driver_data;
870− struct cdrom_device_info *cdi = &info->devinfo;
870+ struct cdrom_device_info *cdi;
871871 unsigned char cmd[BLK_MAX_CDB];
872872
873873 ide_debug_log(IDE_DBG_FUNC, "enter");
874874
875+ if (!info)
876+ return -EIO;
877+
878+ cdi = &info->devinfo;
879+
875880 memset(cmd, 0, BLK_MAX_CDB);
876881 cmd[0] = GPCMD_TEST_UNIT_READY;
877882
drivers/idle/intel_idle.c+5−4
@@ -913,15 +913,16 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev, · 912 unmodified lines
913913 struct cpuidle_state *state = &drv->states[index];
914914 unsigned long eax = flg2MWAIT(state->flags);
915915 unsigned int cstate;
916+ int cpu = smp_processor_id();
916917
917918 cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
918919
919920 /*
920− * NB: if CPUIDLE_FLAG_TLB_FLUSHED is set, this idle transition
921− * will probably flush the TLB. It's not guaranteed to flush
922− * the TLB, though, so it's not clear that we can do anything
923− * useful with this knowledge.
921+ * leave_mm() to avoid costly and often unnecessary wakeups
922+ * for flushing the user TLB's associated with the active mm.
924923 */
924+ if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED)
925+ leave_mm(cpu);
925926
926927 if (!(lapic_timer_reliable_states & (1 << (cstate))))
927928 tick_broadcast_enter();
drivers/input/sparse-keymap.c+1−0
@@ -255,6 +255,7 @@ void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *k · 254 unmodified lines
255255
256256 case KE_VSW:
257257 input_report_switch(dev, ke->sw.code, value);
258+ input_sync(dev);
258259 break;
259260 }
260261 }
drivers/input/touchscreen/ar1021_i2c.c+1−0
@@ -117,6 +117,7 @@ static int ar1021_i2c_probe(struct i2c_client *client, · 116 unmodified lines
117117 input->open = ar1021_i2c_open;
118118 input->close = ar1021_i2c_close;
119119
120+ __set_bit(INPUT_PROP_DIRECT, input->propbit);
120121 input_set_capability(input, EV_KEY, BTN_TOUCH);
121122 input_set_abs_params(input, ABS_X, 0, AR1021_MAX_X, 0, 0);
122123 input_set_abs_params(input, ABS_Y, 0, AR1021_MAX_Y, 0, 0);
drivers/irqchip/irq-mvebu-gicp.c+1−0
@@ -194,6 +194,7 @@ static int mvebu_gicp_probe(struct platform_device *pdev) · 193 unmodified lines
194194 return -ENOMEM;
195195
196196 gicp->dev = &pdev->dev;
197+ spin_lock_init(&gicp->spi_lock);
197198
198199 gicp->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
199200 if (!gicp->res)
drivers/net/bonding/bond_main.c+2−1
@@ -2046,6 +2046,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 2045 unmodified lines
20462046
20472047 bond_for_each_slave_rcu(bond, slave, iter) {
20482048 slave->new_link = BOND_LINK_NOCHANGE;
2049+ slave->link_new_state = slave->link;
20492050
20502051 link_state = bond_check_dev_link(bond, slave->dev, 0);
20512052
@@ -3267,7 +3268,7 @@ u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb) · 1215 unmodified lines
32673268 hash ^= (hash >> 16);
32683269 hash ^= (hash >> 8);
32693270
3270− return hash;
3271+ return hash >> 1;
32713272 }
32723273
32733274 /*-------------------------- Device entry points ----------------------------*/
drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h+3−3
@@ -37,7 +37,7 @@ · 36 unmodified lines
3737
3838 #define T4FW_VERSION_MAJOR 0x01
3939 #define T4FW_VERSION_MINOR 0x10
40−#define T4FW_VERSION_MICRO 0x2D
40+#define T4FW_VERSION_MICRO 0x3F
4141 #define T4FW_VERSION_BUILD 0x00
4242
4343 #define T4FW_MIN_VERSION_MAJOR 0x01
@@ -46,7 +46,7 @@ · 2 unmodified lines
4646
4747 #define T5FW_VERSION_MAJOR 0x01
4848 #define T5FW_VERSION_MINOR 0x10
49−#define T5FW_VERSION_MICRO 0x2D
49+#define T5FW_VERSION_MICRO 0x3F
5050 #define T5FW_VERSION_BUILD 0x00
5151
5252 #define T5FW_MIN_VERSION_MAJOR 0x00
@@ -55,7 +55,7 @@ · 2 unmodified lines
5555
5656 #define T6FW_VERSION_MAJOR 0x01
5757 #define T6FW_VERSION_MINOR 0x10
58−#define T6FW_VERSION_MICRO 0x2D
58+#define T6FW_VERSION_MICRO 0x3F
5959 #define T6FW_VERSION_BUILD 0x00
6060
6161 #define T6FW_MIN_VERSION_MAJOR 0x00
drivers/net/ethernet/marvell/mvpp2.c+4−0
@@ -6941,6 +6941,9 @@ static int mvpp2_irqs_init(struct mvpp2_port *port) · 6940 unmodified lines
69416941 for (i = 0; i < port->nqvecs; i++) {
69426942 struct mvpp2_queue_vector *qv = port->qvecs + i;
69436943
6944+ if (qv->type == MVPP2_QUEUE_VECTOR_PRIVATE)
6945+ irq_set_status_flags(qv->irq, IRQ_NO_BALANCING);
6946+
69446947 err = request_irq(qv->irq, mvpp2_isr, 0, port->dev->name, qv);
69456948 if (err)
69466949 goto err;
@@ -6970,6 +6973,7 @@ static void mvpp2_irqs_deinit(struct mvpp2_port *port) · 23 unmodified lines
69706973 struct mvpp2_queue_vector *qv = port->qvecs + i;
69716974
69726975 irq_set_affinity_hint(qv->irq, NULL);
6976+ irq_clear_status_flags(qv->irq, IRQ_NO_BALANCING);
69736977 free_irq(qv->irq, qv);
69746978 }
69756979 }
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c+8−5
@@ -365,21 +365,24 @@ static void mlx5e_execute_l2_action(struct mlx5e_priv *priv, · 364 unmodified lines
365365 struct mlx5e_l2_hash_node *hn)
366366 {
367367 u8 action = hn->action;
368+ u8 mac_addr[ETH_ALEN];
368369 int l2_err = 0;
369370
371+ ether_addr_copy(mac_addr, hn->ai.addr);
372+
370373 switch (action) {
371374 case MLX5E_ACTION_ADD:
372375 mlx5e_add_l2_flow_rule(priv, &hn->ai, MLX5E_FULLMATCH);
373− if (!is_multicast_ether_addr(hn->ai.addr)) {
374− l2_err = mlx5_mpfs_add_mac(priv->mdev, hn->ai.addr);
376+ if (!is_multicast_ether_addr(mac_addr)) {
377+ l2_err = mlx5_mpfs_add_mac(priv->mdev, mac_addr);
375378 hn->mpfs = !l2_err;
376379 }
377380 hn->action = MLX5E_ACTION_NONE;
378381 break;
379382
380383 case MLX5E_ACTION_DEL:
381− if (!is_multicast_ether_addr(hn->ai.addr) && hn->mpfs)
382− l2_err = mlx5_mpfs_del_mac(priv->mdev, hn->ai.addr);
384+ if (!is_multicast_ether_addr(mac_addr) && hn->mpfs)
385+ l2_err = mlx5_mpfs_del_mac(priv->mdev, mac_addr);
383386 mlx5e_del_l2_flow_rule(priv, &hn->ai);
384387 mlx5e_del_l2_from_hash(hn);
385388 break;
@@ -387,7 +390,7 @@ static void mlx5e_execute_l2_action(struct mlx5e_priv *priv, · 1 unmodified line
387390
388391 if (l2_err)
389392 netdev_warn(priv->netdev, "MPFS, failed to %s mac %pM, err(%d)\n",
390− action == MLX5E_ACTION_ADD ? "add" : "del", hn->ai.addr, l2_err);
393+ action == MLX5E_ACTION_ADD ? "add" : "del", mac_addr, l2_err);
391394 }
392395
393396 static void mlx5e_sync_netdev_addr(struct mlx5e_priv *priv)
drivers/net/usb/asix_devices.c+2−2
@@ -626,7 +626,7 @@ static int asix_suspend(struct usb_interface *intf, pm_message_t message) · 625 unmodified lines
626626 struct usbnet *dev = usb_get_intfdata(intf);
627627 struct asix_common_private *priv = dev->driver_priv;
628628
629− if (priv->suspend)
629+ if (priv && priv->suspend)
630630 priv->suspend(dev);
631631
632632 return usbnet_suspend(intf, message);
@@ -678,7 +678,7 @@ static int asix_resume(struct usb_interface *intf) · 45 unmodified lines
678678 struct usbnet *dev = usb_get_intfdata(intf);
679679 struct asix_common_private *priv = dev->driver_priv;
680680
681− if (priv->resume)
681+ if (priv && priv->resume)
682682 priv->resume(dev);
683683
684684 return usbnet_resume(intf);
drivers/net/usb/cdc_ether.c+1−1
@@ -230,7 +230,7 @@ skip: · 229 unmodified lines
230230 goto bad_desc;
231231 }
232232
233− if (header.usb_cdc_ether_desc) {
233+ if (header.usb_cdc_ether_desc && info->ether->wMaxSegmentSize) {
234234 dev->hard_mtu = le16_to_cpu(info->ether->wMaxSegmentSize);
235235 /* because of Zaurus, we may be ignoring the host
236236 * side link address we were given.
drivers/net/usb/qmi_wwan.c+2−1
@@ -499,6 +499,7 @@ static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb) · 498 unmodified lines
499499 return 1;
500500 }
501501 if (rawip) {
502+ skb_reset_mac_header(skb);
502503 skb->dev = dev->net; /* normally set by eth_type_trans */
503504 skb->protocol = proto;
504505 return 1;
@@ -681,7 +682,7 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) · 176 unmodified lines
681682 }
682683
683684 /* errors aren't fatal - we can live with the dynamic address */
684− if (cdc_ether) {
685+ if (cdc_ether && cdc_ether->wMaxSegmentSize) {
685686 dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize);
686687 usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress);
687688 }
drivers/scsi/scsi_lib.c+0−3
@@ -2685,7 +2685,6 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state) · 2684 unmodified lines
26852685
26862686 }
26872687 sdev->sdev_state = state;
2688− sysfs_notify(&sdev->sdev_gendev.kobj, NULL, "state");
26892688 return 0;
26902689
26912690 illegal:
@@ -3109,7 +3108,6 @@ int scsi_internal_device_unblock_nowait(struct scsi_device *sdev, · 417 unmodified lines
31093108 case SDEV_BLOCK:
31103109 case SDEV_TRANSPORT_OFFLINE:
31113110 sdev->sdev_state = new_state;
3112− sysfs_notify(&sdev->sdev_gendev.kobj, NULL, "state");
31133111 break;
31143112 case SDEV_CREATED_BLOCK:
31153113 if (new_state == SDEV_TRANSPORT_OFFLINE ||
@@ -3117,7 +3115,6 @@ int scsi_internal_device_unblock_nowait(struct scsi_device *sdev, · 1 unmodified line
31173115 sdev->sdev_state = new_state;
31183116 else
31193117 sdev->sdev_state = SDEV_CREATED;
3120− sysfs_notify(&sdev->sdev_gendev.kobj, NULL, "state");
31213118 break;
31223119 case SDEV_CANCEL:
31233120 case SDEV_OFFLINE:
drivers/scsi/scsi_transport_srp.c+1−4
@@ -556,11 +556,8 @@ int srp_reconnect_rport(struct srp_rport *rport) · 555 unmodified lines
556556 */
557557 shost_for_each_device(sdev, shost) {
558558 mutex_lock(&sdev->state_mutex);
559− if (sdev->sdev_state == SDEV_OFFLINE) {
559+ if (sdev->sdev_state == SDEV_OFFLINE)
560560 sdev->sdev_state = SDEV_RUNNING;
561− sysfs_notify(&sdev->sdev_gendev.kobj,
562− NULL, "state");
563− }
564561 mutex_unlock(&sdev->state_mutex);
565562 }
566563 } else if (rport->state == SRP_RPORT_RUNNING) {
include/linux/compiler.h+2−2
@@ -191,13 +191,13 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 190 unmodified lines
191191 asm("%c0:\n\t" \
192192 ".pushsection .discard.reachable\n\t" \
193193 ".long %c0b - .\n\t" \
194− ".popsection\n\t" : : "i" (__LINE__)); \
194+ ".popsection\n\t" : : "i" (__COUNTER__)); \
195195 })
196196 #define annotate_unreachable() ({ \
197197 asm("%c0:\n\t" \
198198 ".pushsection .discard.unreachable\n\t" \
199199 ".long %c0b - .\n\t" \
200− ".popsection\n\t" : : "i" (__LINE__)); \
200+ ".popsection\n\t" : : "i" (__COUNTER__)); \
201201 })
202202 #define ASM_UNREACHABLE \
203203 "999:\n\t" \
include/linux/skbuff.h+7−0
@@ -3841,6 +3841,13 @@ static inline void nf_reset_trace(struct sk_buff *skb) · 3840 unmodified lines
38413841 #endif
38423842 }
38433843
3844+static inline void ipvs_reset(struct sk_buff *skb)
3845+{
3846+#if IS_ENABLED(CONFIG_IP_VS)
3847+ skb->ipvs_property = 0;
3848+#endif
3849+}
3850+
38443851 /* Note: This doesn't put any conntrack and bridge info in dst. */
38453852 static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src,
38463853 bool copy)
include/net/act_api.h+1−3
@@ -14,7 +14,6 @@ · 13 unmodified lines
1414 struct tcf_idrinfo {
1515 spinlock_t lock;
1616 struct idr action_idr;
17− struct net *net;
1817 };
1918
2019 struct tc_action_ops;
@@ -105,7 +104,7 @@ struct tc_action_net { · 84 unmodified lines
105104
106105 static inline
107106 int tc_action_net_init(struct tc_action_net *tn,
108− const struct tc_action_ops *ops, struct net *net)
107+ const struct tc_action_ops *ops)
109108 {
110109 int err = 0;
111110
@@ -113,7 +112,6 @@ int tc_action_net_init(struct tc_action_net *tn, · 1 unmodified line
113112 if (!tn->idrinfo)
114113 return -ENOMEM;
115114 tn->ops = ops;
116− tn->idrinfo->net = net;
117115 spin_lock_init(&tn->idrinfo->lock);
118116 idr_init(&tn->idrinfo->action_idr);
119117 return err;
include/net/pkt_cls.h+24−0
@@ -231,6 +231,7 @@ struct tcf_exts { · 230 unmodified lines
231231 __u32 type; /* for backward compat(TCA_OLD_COMPAT) */
232232 int nr_actions;
233233 struct tc_action **actions;
234+ struct net *net;
234235 #endif
235236 /* Map to export classifier specific extension TLV types to the
236237 * generic extensions API. Unsupported extensions must be set to 0.
@@ -244,6 +245,7 @@ static inline int tcf_exts_init(struct tcf_exts *exts, int action, int police) · 7 unmodified lines
244245 #ifdef CONFIG_NET_CLS_ACT
245246 exts->type = 0;
246247 exts->nr_actions = 0;
248+ exts->net = NULL;
247249 exts->actions = kcalloc(TCA_ACT_MAX_PRIO, sizeof(struct tc_action *),
248250 GFP_KERNEL);
249251 if (!exts->actions)
@@ -254,6 +256,28 @@ static inline int tcf_exts_init(struct tcf_exts *exts, int action, int police) · 4 unmodified lines
254256 return 0;
255257 }
256258
259+/* Return false if the netns is being destroyed in cleanup_net(). Callers
260+ * need to do cleanup synchronously in this case, otherwise may race with
261+ * tc_action_net_exit(). Return true for other cases.
262+ */
263+static inline bool tcf_exts_get_net(struct tcf_exts *exts)
264+{
265+#ifdef CONFIG_NET_CLS_ACT
266+ exts->net = maybe_get_net(exts->net);
267+ return exts->net != NULL;
268+#else
269+ return true;
270+#endif
271+}
272+
273+static inline void tcf_exts_put_net(struct tcf_exts *exts)
274+{
275+#ifdef CONFIG_NET_CLS_ACT
276+ if (exts->net)
277+ put_net(exts->net);
278+#endif
279+}
280+
257281 static inline void tcf_exts_to_list(const struct tcf_exts *exts,
258282 struct list_head *actions)
259283 {
include/sound/seq_kernel.h+2−1
@@ -49,7 +49,8 @@ typedef union snd_seq_timestamp snd_seq_timestamp_t; · 48 unmodified lines
4949 #define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 200
5050
5151 /* max delivery path length */
52−#define SNDRV_SEQ_MAX_HOPS 10
52+/* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */
53+#define SNDRV_SEQ_MAX_HOPS 8
5354
5455 /* max size of event size */
5556 #define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
include/sound/timer.h+2−0
@@ -90,6 +90,8 @@ struct snd_timer { · 89 unmodified lines
9090 struct list_head ack_list_head;
9191 struct list_head sack_list_head; /* slow ack list head */
9292 struct tasklet_struct task_queue;
93+ int max_instances; /* upper limit of timer instances */
94+ int num_instances; /* current number of timer instances */
9395 };
9496
9597 struct snd_timer_instance {
include/uapi/sound/asound.h+3−3
@@ -94,7 +94,7 @@ enum { · 93 unmodified lines
9494 SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */
9595 SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */
9696 SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */
97− SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
97+ SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
9898 SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */
9999 SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */
100100 SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */
@@ -384,7 +384,7 @@ struct snd_mask { · 283 unmodified lines
384384
385385 struct snd_pcm_hw_params {
386386 unsigned int flags;
387− struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
387+ struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
388388 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
389389 struct snd_mask mres[5]; /* reserved masks */
390390 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
@@ -857,7 +857,7 @@ typedef int __bitwise snd_ctl_elem_iface_t; · 466 unmodified lines
857857 #define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */
858858 #define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */
859859 #define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */
860−#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */
860+#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */
861861 #define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */
862862 /* bits 30 and 31 are obsoleted (for indirect access) */
863863
kernel/events/core.c+4−2
@@ -901,9 +901,11 @@ list_update_cgroup_event(struct perf_event *event, · 900 unmodified lines
901901 cpuctx_entry = &cpuctx->cgrp_cpuctx_entry;
902902 /* cpuctx->cgrp is NULL unless a cgroup event is active in this CPU .*/
903903 if (add) {
904+ struct perf_cgroup *cgrp = perf_cgroup_from_task(current, ctx);
905+
904906 list_add(cpuctx_entry, this_cpu_ptr(&cgrp_cpuctx_list));
905− if (perf_cgroup_from_task(current, ctx) == event->cgrp)
906− cpuctx->cgrp = event->cgrp;
907+ if (cgroup_is_descendant(cgrp->css.cgroup, event->cgrp->css.cgroup))
908+ cpuctx->cgrp = cgrp;
907909 } else {
908910 list_del(cpuctx_entry);
909911 cpuctx->cgrp = NULL;
kernel/futex.c+20−3
@@ -903,11 +903,27 @@ void exit_pi_state_list(struct task_struct *curr) · 902 unmodified lines
903903 */
904904 raw_spin_lock_irq(&curr->pi_lock);
905905 while (!list_empty(head)) {
906−
907906 next = head->next;
908907 pi_state = list_entry(next, struct futex_pi_state, list);
909908 key = pi_state->key;
910909 hb = hash_futex(&key);
910+
911+ /*
912+ * We can race against put_pi_state() removing itself from the
913+ * list (a waiter going away). put_pi_state() will first
914+ * decrement the reference count and then modify the list, so
915+ * its possible to see the list entry but fail this reference
916+ * acquire.
917+ *
918+ * In that case; drop the locks to let put_pi_state() make
919+ * progress and retry the loop.
920+ */
921+ if (!atomic_inc_not_zero(&pi_state->refcount)) {
922+ raw_spin_unlock_irq(&curr->pi_lock);
923+ cpu_relax();
924+ raw_spin_lock_irq(&curr->pi_lock);
925+ continue;
926+ }
911927 raw_spin_unlock_irq(&curr->pi_lock);
912928
913929 spin_lock(&hb->lock);
@@ -918,8 +934,10 @@ void exit_pi_state_list(struct task_struct *curr) · 4 unmodified lines
918934 * task still owns the PI-state:
919935 */
920936 if (head->next != next) {
937+ /* retain curr->pi_lock for the loop invariant */
921938 raw_spin_unlock(&pi_state->pi_mutex.wait_lock);
922939 spin_unlock(&hb->lock);
940+ put_pi_state(pi_state);
923941 continue;
924942 }
925943
@@ -927,9 +945,8 @@ void exit_pi_state_list(struct task_struct *curr) · 1 unmodified line
927945 WARN_ON(list_empty(&pi_state->list));
928946 list_del_init(&pi_state->list);
929947 pi_state->owner = NULL;
930− raw_spin_unlock(&curr->pi_lock);
931948
932− get_pi_state(pi_state);
949+ raw_spin_unlock(&curr->pi_lock);
933950 raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
934951 spin_unlock(&hb->lock);
935952
kernel/sched/cpufreq_schedutil.c+1−5
@@ -649,6 +649,7 @@ static int sugov_start(struct cpufreq_policy *policy) · 648 unmodified lines
649649 struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu);
650650
651651 memset(sg_cpu, 0, sizeof(*sg_cpu));
652+ sg_cpu->cpu = cpu;
652653 sg_cpu->sg_policy = sg_policy;
653654 sg_cpu->flags = SCHED_CPUFREQ_RT;
654655 sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq;
@@ -714,11 +715,6 @@ struct cpufreq_governor *cpufreq_default_governor(void) · 59 unmodified lines
714715
715716 static int __init sugov_register(void)
716717 {
717− int cpu;
718−
719− for_each_possible_cpu(cpu)
720− per_cpu(sugov_cpu, cpu).cpu = cpu;
721−
722718 return cpufreq_register_governor(&schedutil_gov);
723719 }
724720 fs_initcall(sugov_register);
kernel/watchdog_hld.c+10−5
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #define pr_fmt(fmt) "NMI watchdog: " fmt
1414
1515 #include <linux/nmi.h>
16+#include <linux/atomic.h>
1617 #include <linux/module.h>
1718 #include <linux/sched/debug.h>
1819
@@ -22,10 +23,11 @@ · 3 unmodified lines
2223 static DEFINE_PER_CPU(bool, hard_watchdog_warn);
2324 static DEFINE_PER_CPU(bool, watchdog_nmi_touch);
2425 static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
26+static DEFINE_PER_CPU(struct perf_event *, dead_event);
2527 static struct cpumask dead_events_mask;
2628
2729 static unsigned long hardlockup_allcpu_dumped;
28−static unsigned int watchdog_cpus;
30+static atomic_t watchdog_cpus = ATOMIC_INIT(0);
2931
3032 void arch_touch_nmi_watchdog(void)
3133 {
@@ -189,7 +191,8 @@ void hardlockup_detector_perf_enable(void) · 157 unmodified lines
189191 if (hardlockup_detector_event_create())
190192 return;
191193
192− if (!watchdog_cpus++)
194+ /* use original value for check */
195+ if (!atomic_fetch_inc(&watchdog_cpus))
193196 pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");
194197
195198 perf_event_enable(this_cpu_read(watchdog_ev));
@@ -204,8 +207,10 @@ void hardlockup_detector_perf_disable(void) · 8 unmodified lines
204207
205208 if (event) {
206209 perf_event_disable(event);
210+ this_cpu_write(watchdog_ev, NULL);
211+ this_cpu_write(dead_event, event);
207212 cpumask_set_cpu(smp_processor_id(), &dead_events_mask);
208− watchdog_cpus--;
213+ atomic_dec(&watchdog_cpus);
209214 }
210215 }
211216
@@ -219,7 +224,7 @@ void hardlockup_detector_perf_cleanup(void) · 7 unmodified lines
219224 int cpu;
220225
221226 for_each_cpu(cpu, &dead_events_mask) {
222− struct perf_event *event = per_cpu(watchdog_ev, cpu);
227+ struct perf_event *event = per_cpu(dead_event, cpu);
223228
224229 /*
225230 * Required because for_each_cpu() reports unconditionally
@@ -227,7 +232,7 @@ void hardlockup_detector_perf_cleanup(void) · 1 unmodified line
227232 */
228233 if (event)
229234 perf_event_release_kernel(event);
230− per_cpu(watchdog_ev, cpu) = NULL;
235+ per_cpu(dead_event, cpu) = NULL;
231236 }
232237 cpumask_clear(&dead_events_mask);
233238 }
kernel/workqueue_internal.h+2−1
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010
1111 #include <linux/workqueue.h>
1212 #include <linux/kthread.h>
13+#include <linux/preempt.h>
1314
1415 struct worker_pool;
1516
@@ -60,7 +61,7 @@ struct worker { · 44 unmodified lines
6061 */
6162 static inline struct worker *current_wq_worker(void)
6263 {
63− if (current->flags & PF_WQ_WORKER)
64+ if (in_task() && (current->flags & PF_WQ_WORKER))
6465 return kthread_data(current);
6566 return NULL;
6667 }
lib/asn1_decoder.c+2−2
@@ -228,7 +228,7 @@ next_op: · 227 unmodified lines
228228 hdr = 2;
229229
230230 /* Extract a tag from the data */
231− if (unlikely(dp >= datalen - 1))
231+ if (unlikely(datalen - dp < 2))
232232 goto data_overrun_error;
233233 tag = data[dp++];
234234 if (unlikely((tag & 0x1f) == ASN1_LONG_TAG))
@@ -274,7 +274,7 @@ next_op: · 39 unmodified lines
274274 int n = len - 0x80;
275275 if (unlikely(n > 2))
276276 goto length_too_long;
277− if (unlikely(dp >= datalen - n))
277+ if (unlikely(n > datalen - dp))
278278 goto data_overrun_error;
279279 hdr += n;
280280 for (len = 0; n > 0; n--) {
net/core/skbuff.c+1−0
@@ -4869,6 +4869,7 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet) · 4868 unmodified lines
48694869 if (!xnet)
48704870 return;
48714871
4872+ ipvs_reset(skb);
48724873 skb_orphan(skb);
48734874 skb->mark = 0;
48744875 }
net/ipv4/tcp_input.c+1−1
@@ -100,7 +100,7 @@ int sysctl_tcp_max_orphans __read_mostly = NR_FILE; · 99 unmodified lines
100100
101101 #define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED)
102102 #define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED)
103−#define FLAG_CA_ALERT (FLAG_DATA_SACKED|FLAG_ECE)
103+#define FLAG_CA_ALERT (FLAG_DATA_SACKED|FLAG_ECE|FLAG_DSACKING_ACK)
104104 #define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED)
105105
106106 #define TCP_REMNANT (TCP_FLAG_FIN|TCP_FLAG_URG|TCP_FLAG_SYN|TCP_FLAG_PSH)
net/l2tp/l2tp_ip.c+9−15
@@ -123,6 +123,7 @@ static int l2tp_ip_recv(struct sk_buff *skb) · 122 unmodified lines
123123 unsigned char *ptr, *optr;
124124 struct l2tp_session *session;
125125 struct l2tp_tunnel *tunnel = NULL;
126+ struct iphdr *iph;
126127 int length;
127128
128129 if (!pskb_may_pull(skb, 4))
@@ -178,24 +179,17 @@ pass_up: · 49 unmodified lines
178179 goto discard;
179180
180181 tunnel_id = ntohl(*(__be32 *) &skb->data[4]);
181− tunnel = l2tp_tunnel_find(net, tunnel_id);
182− if (tunnel) {
183− sk = tunnel->sock;
184− sock_hold(sk);
185− } else {
186− struct iphdr *iph = (struct iphdr *) skb_network_header(skb);
187−
188− read_lock_bh(&l2tp_ip_lock);
189− sk = __l2tp_ip_bind_lookup(net, iph->daddr, iph->saddr,
190− inet_iif(skb), tunnel_id);
191− if (!sk) {
192− read_unlock_bh(&l2tp_ip_lock);
193− goto discard;
194− }
182+ iph = (struct iphdr *)skb_network_header(skb);
195183
196− sock_hold(sk);
184+ read_lock_bh(&l2tp_ip_lock);
185+ sk = __l2tp_ip_bind_lookup(net, iph->daddr, iph->saddr, inet_iif(skb),
186+ tunnel_id);
187+ if (!sk) {
197188 read_unlock_bh(&l2tp_ip_lock);
189+ goto discard;
198190 }
191+ sock_hold(sk);
192+ read_unlock_bh(&l2tp_ip_lock);
199193
200194 if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
201195 goto discard_put;
net/l2tp/l2tp_ip6.c+9−15
@@ -136,6 +136,7 @@ static int l2tp_ip6_recv(struct sk_buff *skb) · 135 unmodified lines
136136 unsigned char *ptr, *optr;
137137 struct l2tp_session *session;
138138 struct l2tp_tunnel *tunnel = NULL;
139+ struct ipv6hdr *iph;
139140 int length;
140141
141142 if (!pskb_may_pull(skb, 4))
@@ -192,24 +193,17 @@ pass_up: · 50 unmodified lines
192193 goto discard;
193194
194195 tunnel_id = ntohl(*(__be32 *) &skb->data[4]);
195− tunnel = l2tp_tunnel_find(net, tunnel_id);
196− if (tunnel) {
197− sk = tunnel->sock;
198− sock_hold(sk);
199− } else {
200− struct ipv6hdr *iph = ipv6_hdr(skb);
201−
202− read_lock_bh(&l2tp_ip6_lock);
203− sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, &iph->saddr,
204− inet6_iif(skb), tunnel_id);
205− if (!sk) {
206− read_unlock_bh(&l2tp_ip6_lock);
207− goto discard;
208− }
196+ iph = ipv6_hdr(skb);
209197
210− sock_hold(sk);
198+ read_lock_bh(&l2tp_ip6_lock);
199+ sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, &iph->saddr,
200+ inet6_iif(skb), tunnel_id);
201+ if (!sk) {
211202 read_unlock_bh(&l2tp_ip6_lock);
203+ goto discard;
212204 }
205+ sock_hold(sk);
206+ read_unlock_bh(&l2tp_ip6_lock);
213207
214208 if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb))
215209 goto discard_put;
net/qrtr/qrtr.c+1−1
@@ -1120,7 +1120,7 @@ static int __init qrtr_proto_init(void) · 1119 unmodified lines
11201120
11211121 return 0;
11221122 }
1123−module_init(qrtr_proto_init);
1123+postcore_initcall(qrtr_proto_init);
11241124
11251125 static void __exit qrtr_proto_fini(void)
11261126 {
net/sched/act_api.c+0−2
@@ -80,7 +80,6 @@ static void tcf_idr_remove(struct tcf_idrinfo *idrinfo, struct tc_action *p) · 79 unmodified lines
8080 spin_lock_bh(&idrinfo->lock);
8181 idr_remove_ext(&idrinfo->action_idr, p->tcfa_index);
8282 spin_unlock_bh(&idrinfo->lock);
83− put_net(idrinfo->net);
8483 gen_kill_estimator(&p->tcfa_rate_est);
8584 free_tcf(p);
8685 }
@@ -339,7 +338,6 @@ err3: · 252 unmodified lines
339338 p->idrinfo = idrinfo;
340339 p->ops = ops;
341340 INIT_LIST_HEAD(&p->list);
342− get_net(idrinfo->net);
343341 *a = p;
344342 return 0;
345343 }
net/sched/act_bpf.c+1−1
@@ -398,7 +398,7 @@ static __net_init int bpf_init_net(struct net *net) · 397 unmodified lines
398398 {
399399 struct tc_action_net *tn = net_generic(net, bpf_net_id);
400400
401− return tc_action_net_init(tn, &act_bpf_ops, net);
401+ return tc_action_net_init(tn, &act_bpf_ops);
402402 }
403403
404404 static void __net_exit bpf_exit_net(struct net *net)
net/sched/act_connmark.c+1−1
@@ -206,7 +206,7 @@ static __net_init int connmark_init_net(struct net *net) · 205 unmodified lines
206206 {
207207 struct tc_action_net *tn = net_generic(net, connmark_net_id);
208208
209− return tc_action_net_init(tn, &act_connmark_ops, net);
209+ return tc_action_net_init(tn, &act_connmark_ops);
210210 }
211211
212212 static void __net_exit connmark_exit_net(struct net *net)
net/sched/act_csum.c+1−1
@@ -626,7 +626,7 @@ static __net_init int csum_init_net(struct net *net) · 625 unmodified lines
626626 {
627627 struct tc_action_net *tn = net_generic(net, csum_net_id);
628628
629− return tc_action_net_init(tn, &act_csum_ops, net);
629+ return tc_action_net_init(tn, &act_csum_ops);
630630 }
631631
632632 static void __net_exit csum_exit_net(struct net *net)
net/sched/act_gact.c+1−1
@@ -232,7 +232,7 @@ static __net_init int gact_init_net(struct net *net) · 231 unmodified lines
232232 {
233233 struct tc_action_net *tn = net_generic(net, gact_net_id);
234234
235− return tc_action_net_init(tn, &act_gact_ops, net);
235+ return tc_action_net_init(tn, &act_gact_ops);
236236 }
237237
238238 static void __net_exit gact_exit_net(struct net *net)
net/sched/act_ife.c+1−1
@@ -855,7 +855,7 @@ static __net_init int ife_init_net(struct net *net) · 854 unmodified lines
855855 {
856856 struct tc_action_net *tn = net_generic(net, ife_net_id);
857857
858− return tc_action_net_init(tn, &act_ife_ops, net);
858+ return tc_action_net_init(tn, &act_ife_ops);
859859 }
860860
861861 static void __net_exit ife_exit_net(struct net *net)
net/sched/act_ipt.c+2−2
@@ -334,7 +334,7 @@ static __net_init int ipt_init_net(struct net *net) · 333 unmodified lines
334334 {
335335 struct tc_action_net *tn = net_generic(net, ipt_net_id);
336336
337− return tc_action_net_init(tn, &act_ipt_ops, net);
337+ return tc_action_net_init(tn, &act_ipt_ops);
338338 }
339339
340340 static void __net_exit ipt_exit_net(struct net *net)
@@ -384,7 +384,7 @@ static __net_init int xt_init_net(struct net *net) · 43 unmodified lines
384384 {
385385 struct tc_action_net *tn = net_generic(net, xt_net_id);
386386
387− return tc_action_net_init(tn, &act_xt_ops, net);
387+ return tc_action_net_init(tn, &act_xt_ops);
388388 }
389389
390390 static void __net_exit xt_exit_net(struct net *net)
net/sched/act_mirred.c+1−1
@@ -340,7 +340,7 @@ static __net_init int mirred_init_net(struct net *net) · 339 unmodified lines
340340 {
341341 struct tc_action_net *tn = net_generic(net, mirred_net_id);
342342
343− return tc_action_net_init(tn, &act_mirred_ops, net);
343+ return tc_action_net_init(tn, &act_mirred_ops);
344344 }
345345
346346 static void __net_exit mirred_exit_net(struct net *net)
net/sched/act_nat.c+1−1
@@ -307,7 +307,7 @@ static __net_init int nat_init_net(struct net *net) · 306 unmodified lines
307307 {
308308 struct tc_action_net *tn = net_generic(net, nat_net_id);
309309
310− return tc_action_net_init(tn, &act_nat_ops, net);
310+ return tc_action_net_init(tn, &act_nat_ops);
311311 }
312312
313313 static void __net_exit nat_exit_net(struct net *net)
net/sched/act_pedit.c+1−1
@@ -450,7 +450,7 @@ static __net_init int pedit_init_net(struct net *net) · 449 unmodified lines
450450 {
451451 struct tc_action_net *tn = net_generic(net, pedit_net_id);
452452
453− return tc_action_net_init(tn, &act_pedit_ops, net);
453+ return tc_action_net_init(tn, &act_pedit_ops);
454454 }
455455
456456 static void __net_exit pedit_exit_net(struct net *net)
net/sched/act_police.c+1−1
@@ -331,7 +331,7 @@ static __net_init int police_init_net(struct net *net) · 330 unmodified lines
331331 {
332332 struct tc_action_net *tn = net_generic(net, police_net_id);
333333
334− return tc_action_net_init(tn, &act_police_ops, net);
334+ return tc_action_net_init(tn, &act_police_ops);
335335 }
336336
337337 static void __net_exit police_exit_net(struct net *net)
net/sched/act_sample.c+1−1
@@ -240,7 +240,7 @@ static __net_init int sample_init_net(struct net *net) · 239 unmodified lines
240240 {
241241 struct tc_action_net *tn = net_generic(net, sample_net_id);
242242
243− return tc_action_net_init(tn, &act_sample_ops, net);
243+ return tc_action_net_init(tn, &act_sample_ops);
244244 }
245245
246246 static void __net_exit sample_exit_net(struct net *net)
net/sched/act_simple.c+1−1
@@ -201,7 +201,7 @@ static __net_init int simp_init_net(struct net *net) · 200 unmodified lines
201201 {
202202 struct tc_action_net *tn = net_generic(net, simp_net_id);
203203
204− return tc_action_net_init(tn, &act_simp_ops, net);
204+ return tc_action_net_init(tn, &act_simp_ops);
205205 }
206206
207207 static void __net_exit simp_exit_net(struct net *net)
net/sched/act_skbedit.c+1−1
@@ -238,7 +238,7 @@ static __net_init int skbedit_init_net(struct net *net) · 237 unmodified lines
238238 {
239239 struct tc_action_net *tn = net_generic(net, skbedit_net_id);
240240
241− return tc_action_net_init(tn, &act_skbedit_ops, net);
241+ return tc_action_net_init(tn, &act_skbedit_ops);
242242 }
243243
244244 static void __net_exit skbedit_exit_net(struct net *net)
net/sched/act_skbmod.c+1−1
@@ -263,7 +263,7 @@ static __net_init int skbmod_init_net(struct net *net) · 262 unmodified lines
263263 {
264264 struct tc_action_net *tn = net_generic(net, skbmod_net_id);
265265
266− return tc_action_net_init(tn, &act_skbmod_ops, net);
266+ return tc_action_net_init(tn, &act_skbmod_ops);
267267 }
268268
269269 static void __net_exit skbmod_exit_net(struct net *net)
net/sched/act_tunnel_key.c+1−1
@@ -322,7 +322,7 @@ static __net_init int tunnel_key_init_net(struct net *net) · 321 unmodified lines
322322 {
323323 struct tc_action_net *tn = net_generic(net, tunnel_key_net_id);
324324
325− return tc_action_net_init(tn, &act_tunnel_key_ops, net);
325+ return tc_action_net_init(tn, &act_tunnel_key_ops);
326326 }
327327
328328 static void __net_exit tunnel_key_exit_net(struct net *net)
net/sched/act_vlan.c+1−1
@@ -269,7 +269,7 @@ static __net_init int vlan_init_net(struct net *net) · 268 unmodified lines
269269 {
270270 struct tc_action_net *tn = net_generic(net, vlan_net_id);
271271
272− return tc_action_net_init(tn, &act_vlan_ops, net);
272+ return tc_action_net_init(tn, &act_vlan_ops);
273273 }
274274
275275 static void __net_exit vlan_exit_net(struct net *net)
net/sched/cls_api.c+1−0
@@ -1110,6 +1110,7 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, · 1109 unmodified lines
11101110 exts->actions[i++] = act;
11111111 exts->nr_actions = i;
11121112 }
1113+ exts->net = net;
11131114 }
11141115 #else
11151116 if ((exts->action && tb[exts->action]) ||
net/sched/cls_basic.c+15−5
@@ -87,16 +87,21 @@ static int basic_init(struct tcf_proto *tp) · 86 unmodified lines
8787 return 0;
8888 }
8989
90+static void __basic_delete_filter(struct basic_filter *f)
91+{
92+ tcf_exts_destroy(&f->exts);
93+ tcf_em_tree_destroy(&f->ematches);
94+ tcf_exts_put_net(&f->exts);
95+ kfree(f);
96+}
97+
9098 static void basic_delete_filter_work(struct work_struct *work)
9199 {
92100 struct basic_filter *f = container_of(work, struct basic_filter, work);
93101
94102 rtnl_lock();
95− tcf_exts_destroy(&f->exts);
96− tcf_em_tree_destroy(&f->ematches);
103+ __basic_delete_filter(f);
97104 rtnl_unlock();
98−
99− kfree(f);
100105 }
101106
102107 static void basic_delete_filter(struct rcu_head *head)
@@ -116,7 +121,10 @@ static void basic_destroy(struct tcf_proto *tp) · 13 unmodified lines
116121 list_del_rcu(&f->link);
117122 tcf_unbind_filter(tp, &f->res);
118123 idr_remove_ext(&head->handle_idr, f->handle);
119− call_rcu(&f->rcu, basic_delete_filter);
124+ if (tcf_exts_get_net(&f->exts))
125+ call_rcu(&f->rcu, basic_delete_filter);
126+ else
127+ __basic_delete_filter(f);
120128 }
121129 idr_destroy(&head->handle_idr);
122130 kfree_rcu(head, rcu);
@@ -130,6 +138,7 @@ static int basic_delete(struct tcf_proto *tp, void *arg, bool *last) · 7 unmodified lines
130138 list_del_rcu(&f->link);
131139 tcf_unbind_filter(tp, &f->res);
132140 idr_remove_ext(&head->handle_idr, f->handle);
141+ tcf_exts_get_net(&f->exts);
133142 call_rcu(&f->rcu, basic_delete_filter);
134143 *last = list_empty(&head->flist);
135144 return 0;
@@ -225,6 +234,7 @@ static int basic_change(struct net *net, struct sk_buff *in_skb, · 89 unmodified lines
225234 idr_replace_ext(&head->handle_idr, fnew, fnew->handle);
226235 list_replace_rcu(&fold->link, &fnew->link);
227236 tcf_unbind_filter(tp, &fold->res);
237+ tcf_exts_get_net(&fold->exts);
228238 call_rcu(&fold->rcu, basic_delete_filter);
229239 } else {
230240 list_add_rcu(&fnew->link, &head->flist);
net/sched/cls_bpf.c+6−1
@@ -261,6 +261,7 @@ static int cls_bpf_init(struct tcf_proto *tp) · 260 unmodified lines
261261 static void __cls_bpf_delete_prog(struct cls_bpf_prog *prog)
262262 {
263263 tcf_exts_destroy(&prog->exts);
264+ tcf_exts_put_net(&prog->exts);
264265
265266 if (cls_bpf_is_ebpf(prog))
266267 bpf_prog_put(prog->filter);
@@ -297,7 +298,10 @@ static void __cls_bpf_delete(struct tcf_proto *tp, struct cls_bpf_prog *prog) · 30 unmodified lines
297298 cls_bpf_stop_offload(tp, prog);
298299 list_del_rcu(&prog->link);
299300 tcf_unbind_filter(tp, &prog->res);
300− call_rcu(&prog->rcu, cls_bpf_delete_prog_rcu);
301+ if (tcf_exts_get_net(&prog->exts))
302+ call_rcu(&prog->rcu, cls_bpf_delete_prog_rcu);
303+ else
304+ __cls_bpf_delete_prog(prog);
301305 }
302306
303307 static int cls_bpf_delete(struct tcf_proto *tp, void *arg, bool *last)
@@ -526,6 +530,7 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb, · 222 unmodified lines
526530 idr_replace_ext(&head->handle_idr, prog, handle);
527531 list_replace_rcu(&oldprog->link, &prog->link);
528532 tcf_unbind_filter(tp, &oldprog->res);
533+ tcf_exts_get_net(&oldprog->exts);
529534 call_rcu(&oldprog->rcu, cls_bpf_delete_prog_rcu);
530535 } else {
531536 list_add_rcu(&prog->link, &head->plist);
net/sched/cls_cgroup.c+18−6
@@ -60,15 +60,21 @@ static const struct nla_policy cgroup_policy[TCA_CGROUP_MAX + 1] = { · 59 unmodified lines
6060 [TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED },
6161 };
6262
63+static void __cls_cgroup_destroy(struct cls_cgroup_head *head)
64+{
65+ tcf_exts_destroy(&head->exts);
66+ tcf_em_tree_destroy(&head->ematches);
67+ tcf_exts_put_net(&head->exts);
68+ kfree(head);
69+}
70+
6371 static void cls_cgroup_destroy_work(struct work_struct *work)
6472 {
6573 struct cls_cgroup_head *head = container_of(work,
6674 struct cls_cgroup_head,
6775 work);
6876 rtnl_lock();
69− tcf_exts_destroy(&head->exts);
70− tcf_em_tree_destroy(&head->ematches);
71− kfree(head);
77+ __cls_cgroup_destroy(head);
7278 rtnl_unlock();
7379 }
7480
@@ -124,8 +130,10 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb, · 49 unmodified lines
124130 goto errout;
125131
126132 rcu_assign_pointer(tp->root, new);
127− if (head)
133+ if (head) {
134+ tcf_exts_get_net(&head->exts);
128135 call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
136+ }
129137 return 0;
130138 errout:
131139 tcf_exts_destroy(&new->exts);
@@ -138,8 +146,12 @@ static void cls_cgroup_destroy(struct tcf_proto *tp) · 6 unmodified lines
138146 struct cls_cgroup_head *head = rtnl_dereference(tp->root);
139147
140148 /* Head can still be NULL due to cls_cgroup_init(). */
141− if (head)
142− call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
149+ if (head) {
150+ if (tcf_exts_get_net(&head->exts))
151+ call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
152+ else
153+ __cls_cgroup_destroy(head);
154+ }
143155 }
144156
145157 static int cls_cgroup_delete(struct tcf_proto *tp, void *arg, bool *last)
net/sched/cls_flow.c+18−6
@@ -372,15 +372,21 @@ static const struct nla_policy flow_policy[TCA_FLOW_MAX + 1] = { · 371 unmodified lines
372372 [TCA_FLOW_PERTURB] = { .type = NLA_U32 },
373373 };
374374
375−static void flow_destroy_filter_work(struct work_struct *work)
375+static void __flow_destroy_filter(struct flow_filter *f)
376376 {
377− struct flow_filter *f = container_of(work, struct flow_filter, work);
378−
379− rtnl_lock();
380377 del_timer_sync(&f->perturb_timer);
381378 tcf_exts_destroy(&f->exts);
382379 tcf_em_tree_destroy(&f->ematches);
380+ tcf_exts_put_net(&f->exts);
383381 kfree(f);
382+}
383+
384+static void flow_destroy_filter_work(struct work_struct *work)
385+{
386+ struct flow_filter *f = container_of(work, struct flow_filter, work);
387+
388+ rtnl_lock();
389+ __flow_destroy_filter(f);
384390 rtnl_unlock();
385391 }
386392
@@ -554,8 +560,10 @@ static int flow_change(struct net *net, struct sk_buff *in_skb, · 167 unmodified lines
554560
555561 *arg = fnew;
556562
557− if (fold)
563+ if (fold) {
564+ tcf_exts_get_net(&fold->exts);
558565 call_rcu(&fold->rcu, flow_destroy_filter);
566+ }
559567 return 0;
560568
561569 err2:
@@ -572,6 +580,7 @@ static int flow_delete(struct tcf_proto *tp, void *arg, bool *last) · 10 unmodified lines
572580 struct flow_filter *f = arg;
573581
574582 list_del_rcu(&f->list);
583+ tcf_exts_get_net(&f->exts);
575584 call_rcu(&f->rcu, flow_destroy_filter);
576585 *last = list_empty(&head->filters);
577586 return 0;
@@ -596,7 +605,10 @@ static void flow_destroy(struct tcf_proto *tp) · 18 unmodified lines
596605
597606 list_for_each_entry_safe(f, next, &head->filters, list) {
598607 list_del_rcu(&f->list);
599− call_rcu(&f->rcu, flow_destroy_filter);
608+ if (tcf_exts_get_net(&f->exts))
609+ call_rcu(&f->rcu, flow_destroy_filter);
610+ else
611+ __flow_destroy_filter(f);
600612 }
601613 kfree_rcu(head, rcu);
602614 }
net/sched/cls_flower.c+13−3
@@ -193,13 +193,19 @@ static int fl_init(struct tcf_proto *tp) · 192 unmodified lines
193193 return 0;
194194 }
195195
196+static void __fl_destroy_filter(struct cls_fl_filter *f)
197+{
198+ tcf_exts_destroy(&f->exts);
199+ tcf_exts_put_net(&f->exts);
200+ kfree(f);
201+}
202+
196203 static void fl_destroy_filter_work(struct work_struct *work)
197204 {
198205 struct cls_fl_filter *f = container_of(work, struct cls_fl_filter, work);
199206
200207 rtnl_lock();
201− tcf_exts_destroy(&f->exts);
202− kfree(f);
208+ __fl_destroy_filter(f);
203209 rtnl_unlock();
204210 }
205211
@@ -282,7 +288,10 @@ static void __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f) · 76 unmodified lines
282288 if (!tc_skip_hw(f->flags))
283289 fl_hw_destroy_filter(tp, f);
284290 tcf_unbind_filter(tp, &f->res);
285− call_rcu(&f->rcu, fl_destroy_filter);
291+ if (tcf_exts_get_net(&f->exts))
292+ call_rcu(&f->rcu, fl_destroy_filter);
293+ else
294+ __fl_destroy_filter(f);
286295 }
287296
288297 static void fl_destroy_sleepable(struct work_struct *work)
@@ -952,6 +961,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, · 663 unmodified lines
952961 idr_replace_ext(&head->handle_idr, fnew, fnew->handle);
953962 list_replace_rcu(&fold->list, &fnew->list);
954963 tcf_unbind_filter(tp, &fold->res);
964+ tcf_exts_get_net(&fold->exts);
955965 call_rcu(&fold->rcu, fl_destroy_filter);
956966 } else {
957967 list_add_tail_rcu(&fnew->list, &head->filters);
net/sched/cls_fw.c+14−3
@@ -125,13 +125,19 @@ static int fw_init(struct tcf_proto *tp) · 124 unmodified lines
125125 return 0;
126126 }
127127
128+static void __fw_delete_filter(struct fw_filter *f)
129+{
130+ tcf_exts_destroy(&f->exts);
131+ tcf_exts_put_net(&f->exts);
132+ kfree(f);
133+}
134+
128135 static void fw_delete_filter_work(struct work_struct *work)
129136 {
130137 struct fw_filter *f = container_of(work, struct fw_filter, work);
131138
132139 rtnl_lock();
133− tcf_exts_destroy(&f->exts);
134− kfree(f);
140+ __fw_delete_filter(f);
135141 rtnl_unlock();
136142 }
137143
@@ -157,7 +163,10 @@ static void fw_destroy(struct tcf_proto *tp) · 19 unmodified lines
157163 RCU_INIT_POINTER(head->ht[h],
158164 rtnl_dereference(f->next));
159165 tcf_unbind_filter(tp, &f->res);
160− call_rcu(&f->rcu, fw_delete_filter);
166+ if (tcf_exts_get_net(&f->exts))
167+ call_rcu(&f->rcu, fw_delete_filter);
168+ else
169+ __fw_delete_filter(f);
161170 }
162171 }
163172 kfree_rcu(head, rcu);
@@ -182,6 +191,7 @@ static int fw_delete(struct tcf_proto *tp, void *arg, bool *last) · 18 unmodified lines
182191 if (pfp == f) {
183192 RCU_INIT_POINTER(*fp, rtnl_dereference(f->next));
184193 tcf_unbind_filter(tp, &f->res);
194+ tcf_exts_get_net(&f->exts);
185195 call_rcu(&f->rcu, fw_delete_filter);
186196 ret = 0;
187197 break;
@@ -302,6 +312,7 @@ static int fw_change(struct net *net, struct sk_buff *in_skb, · 114 unmodified lines
302312 RCU_INIT_POINTER(fnew->next, rtnl_dereference(pfp->next));
303313 rcu_assign_pointer(*fp, fnew);
304314 tcf_unbind_filter(tp, &f->res);
315+ tcf_exts_get_net(&f->exts);
305316 call_rcu(&f->rcu, fw_delete_filter);
306317
307318 *arg = fnew;
net/sched/cls_matchall.c+12−3
@@ -44,13 +44,19 @@ static int mall_init(struct tcf_proto *tp) · 43 unmodified lines
4444 return 0;
4545 }
4646
47+static void __mall_destroy(struct cls_mall_head *head)
48+{
49+ tcf_exts_destroy(&head->exts);
50+ tcf_exts_put_net(&head->exts);
51+ kfree(head);
52+}
53+
4754 static void mall_destroy_work(struct work_struct *work)
4855 {
4956 struct cls_mall_head *head = container_of(work, struct cls_mall_head,
5057 work);
5158 rtnl_lock();
52− tcf_exts_destroy(&head->exts);
53− kfree(head);
59+ __mall_destroy(head);
5460 rtnl_unlock();
5561 }
5662
@@ -116,7 +122,10 @@ static void mall_destroy(struct tcf_proto *tp) · 59 unmodified lines
116122 if (!tc_skip_hw(head->flags))
117123 mall_destroy_hw_filter(tp, head, (unsigned long) head);
118124
119− call_rcu(&head->rcu, mall_destroy_rcu);
125+ if (tcf_exts_get_net(&head->exts))
126+ call_rcu(&head->rcu, mall_destroy_rcu);
127+ else
128+ __mall_destroy(head);
120129 }
121130
122131 static void *mall_get(struct tcf_proto *tp, u32 handle)
net/sched/cls_route.c+14−3
@@ -257,13 +257,19 @@ static int route4_init(struct tcf_proto *tp) · 256 unmodified lines
257257 return 0;
258258 }
259259
260+static void __route4_delete_filter(struct route4_filter *f)
261+{
262+ tcf_exts_destroy(&f->exts);
263+ tcf_exts_put_net(&f->exts);
264+ kfree(f);
265+}
266+
260267 static void route4_delete_filter_work(struct work_struct *work)
261268 {
262269 struct route4_filter *f = container_of(work, struct route4_filter, work);
263270
264271 rtnl_lock();
265− tcf_exts_destroy(&f->exts);
266− kfree(f);
272+ __route4_delete_filter(f);
267273 rtnl_unlock();
268274 }
269275
@@ -297,7 +303,10 @@ static void route4_destroy(struct tcf_proto *tp) · 27 unmodified lines
297303 next = rtnl_dereference(f->next);
298304 RCU_INIT_POINTER(b->ht[h2], next);
299305 tcf_unbind_filter(tp, &f->res);
300− call_rcu(&f->rcu, route4_delete_filter);
306+ if (tcf_exts_get_net(&f->exts))
307+ call_rcu(&f->rcu, route4_delete_filter);
308+ else
309+ __route4_delete_filter(f);
301310 }
302311 }
303312 RCU_INIT_POINTER(head->table[h1], NULL);
@@ -338,6 +347,7 @@ static int route4_delete(struct tcf_proto *tp, void *arg, bool *last) · 34 unmodified lines
338347
339348 /* Delete it */
340349 tcf_unbind_filter(tp, &f->res);
350+ tcf_exts_get_net(&f->exts);
341351 call_rcu(&f->rcu, route4_delete_filter);
342352
343353 /* Strip RTNL protected tree */
@@ -541,6 +551,7 @@ static int route4_change(struct net *net, struct sk_buff *in_skb, · 197 unmodified lines
541551 *arg = f;
542552 if (fold) {
543553 tcf_unbind_filter(tp, &fold->res);
554+ tcf_exts_get_net(&fold->exts);
544555 call_rcu(&fold->rcu, route4_delete_filter);
545556 }
546557 return 0;
net/sched/cls_rsvp.h+12−3
@@ -285,13 +285,19 @@ static int rsvp_init(struct tcf_proto *tp) · 284 unmodified lines
285285 return -ENOBUFS;
286286 }
287287
288+static void __rsvp_delete_filter(struct rsvp_filter *f)
289+{
290+ tcf_exts_destroy(&f->exts);
291+ tcf_exts_put_net(&f->exts);
292+ kfree(f);
293+}
294+
288295 static void rsvp_delete_filter_work(struct work_struct *work)
289296 {
290297 struct rsvp_filter *f = container_of(work, struct rsvp_filter, work);
291298
292299 rtnl_lock();
293− tcf_exts_destroy(&f->exts);
294− kfree(f);
300+ __rsvp_delete_filter(f);
295301 rtnl_unlock();
296302 }
297303
@@ -310,7 +316,10 @@ static void rsvp_delete_filter(struct tcf_proto *tp, struct rsvp_filter *f) · 12 unmodified lines
310316 * grace period, since converted-to-rcu actions are relying on that
311317 * in cleanup() callback
312318 */
313− call_rcu(&f->rcu, rsvp_delete_filter_rcu);
319+ if (tcf_exts_get_net(&f->exts))
320+ call_rcu(&f->rcu, rsvp_delete_filter_rcu);
321+ else
322+ __rsvp_delete_filter(f);
314323 }
315324
316325 static void rsvp_destroy(struct tcf_proto *tp)
net/sched/cls_tcindex.c+26−7
@@ -142,13 +142,19 @@ static int tcindex_init(struct tcf_proto *tp) · 141 unmodified lines
142142 return 0;
143143 }
144144
145+static void __tcindex_destroy_rexts(struct tcindex_filter_result *r)
146+{
147+ tcf_exts_destroy(&r->exts);
148+ tcf_exts_put_net(&r->exts);
149+}
150+
145151 static void tcindex_destroy_rexts_work(struct work_struct *work)
146152 {
147153 struct tcindex_filter_result *r;
148154
149155 r = container_of(work, struct tcindex_filter_result, work);
150156 rtnl_lock();
151− tcf_exts_destroy(&r->exts);
157+ __tcindex_destroy_rexts(r);
152158 rtnl_unlock();
153159 }
154160
@@ -161,14 +167,20 @@ static void tcindex_destroy_rexts(struct rcu_head *head) · 6 unmodified lines
161167 tcf_queue_work(&r->work);
162168 }
163169
170+static void __tcindex_destroy_fexts(struct tcindex_filter *f)
171+{
172+ tcf_exts_destroy(&f->result.exts);
173+ tcf_exts_put_net(&f->result.exts);
174+ kfree(f);
175+}
176+
164177 static void tcindex_destroy_fexts_work(struct work_struct *work)
165178 {
166179 struct tcindex_filter *f = container_of(work, struct tcindex_filter,
167180 work);
168181
169182 rtnl_lock();
170− tcf_exts_destroy(&f->result.exts);
171− kfree(f);
183+ __tcindex_destroy_fexts(f);
172184 rtnl_unlock();
173185 }
174186
@@ -213,10 +225,17 @@ found: · 38 unmodified lines
213225 * grace period, since converted-to-rcu actions are relying on that
214226 * in cleanup() callback
215227 */
216− if (f)
217− call_rcu(&f->rcu, tcindex_destroy_fexts);
218− else
219− call_rcu(&r->rcu, tcindex_destroy_rexts);
228+ if (f) {
229+ if (tcf_exts_get_net(&f->result.exts))
230+ call_rcu(&f->rcu, tcindex_destroy_fexts);
231+ else
232+ __tcindex_destroy_fexts(f);
233+ } else {
234+ if (tcf_exts_get_net(&r->exts))
235+ call_rcu(&r->rcu, tcindex_destroy_rexts);
236+ else
237+ __tcindex_destroy_rexts(r);
238+ }
220239
221240 *last = false;
222241 return 0;
net/sched/cls_u32.c+7−1
@@ -399,6 +399,7 @@ static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n, · 398 unmodified lines
399399 bool free_pf)
400400 {
401401 tcf_exts_destroy(&n->exts);
402+ tcf_exts_put_net(&n->exts);
402403 if (n->ht_down)
403404 n->ht_down->refcnt--;
404405 #ifdef CONFIG_CLS_U32_PERF
@@ -476,6 +477,7 @@ static int u32_delete_key(struct tcf_proto *tp, struct tc_u_knode *key) · 71 unmodified lines
476477 RCU_INIT_POINTER(*kp, key->next);
477478
478479 tcf_unbind_filter(tp, &key->res);
480+ tcf_exts_get_net(&key->exts);
479481 call_rcu(&key->rcu, u32_delete_key_freepf_rcu);
480482 return 0;
481483 }
@@ -590,7 +592,10 @@ static void u32_clear_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht) · 108 unmodified lines
590592 tcf_unbind_filter(tp, &n->res);
591593 u32_remove_hw_knode(tp, n->handle);
592594 idr_remove_ext(&ht->handle_idr, n->handle);
593− call_rcu(&n->rcu, u32_delete_key_freepf_rcu);
595+ if (tcf_exts_get_net(&n->exts))
596+ call_rcu(&n->rcu, u32_delete_key_freepf_rcu);
597+ else
598+ u32_destroy_key(n->tp, n, true);
594599 }
595600 }
596601 }
@@ -949,6 +954,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, · 352 unmodified lines
949954
950955 u32_replace_knode(tp, tp_c, new);
951956 tcf_unbind_filter(tp, &n->res);
957+ tcf_exts_get_net(&n->exts);
952958 call_rcu(&n->rcu, u32_delete_key_rcu);
953959 return 0;
954960 }
net/xfrm/xfrm_input.c+2−2
@@ -266,8 +266,6 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) · 265 unmodified lines
266266 goto lock;
267267 }
268268
269− daddr = (xfrm_address_t *)(skb_network_header(skb) +
270− XFRM_SPI_SKB_CB(skb)->daddroff);
271269 family = XFRM_SPI_SKB_CB(skb)->family;
272270
273271 /* if tunnel is present override skb->mark value with tunnel i_key */
@@ -294,6 +292,8 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) · 20 unmodified lines
294292 goto drop;
295293 }
296294
295+ daddr = (xfrm_address_t *)(skb_network_header(skb) +
296+ XFRM_SPI_SKB_CB(skb)->daddroff);
297297 do {
298298 if (skb->sp->len == XFRM_MAX_DEPTH) {
299299 XFRM_INC_STATS(net, LINUX_MIB_XFRMINBUFFERERROR);
net/xfrm/xfrm_policy.c+35−36
@@ -1360,36 +1360,29 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, const struct flowi *fl, · 1359 unmodified lines
13601360 struct net *net = xp_net(policy);
13611361 int nx;
13621362 int i, error;
1363− xfrm_address_t *daddr = xfrm_flowi_daddr(fl, family);
1364− xfrm_address_t *saddr = xfrm_flowi_saddr(fl, family);
13651363 xfrm_address_t tmp;
13661364
13671365 for (nx = 0, i = 0; i < policy->xfrm_nr; i++) {
13681366 struct xfrm_state *x;
1369− xfrm_address_t *remote = daddr;
1370− xfrm_address_t *local = saddr;
1367+ xfrm_address_t *local;
1368+ xfrm_address_t *remote;
13711369 struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i];
13721370
1373− if (tmpl->mode == XFRM_MODE_TUNNEL ||
1374− tmpl->mode == XFRM_MODE_BEET) {
1375− remote = &tmpl->id.daddr;
1376− local = &tmpl->saddr;
1377− if (xfrm_addr_any(local, tmpl->encap_family)) {
1378− error = xfrm_get_saddr(net, fl->flowi_oif,
1379− &tmp, remote,
1380− tmpl->encap_family, 0);
1381− if (error)
1382− goto fail;
1383− local = &tmp;
1384− }
1371+ remote = &tmpl->id.daddr;
1372+ local = &tmpl->saddr;
1373+ if (xfrm_addr_any(local, tmpl->encap_family)) {
1374+ error = xfrm_get_saddr(net, fl->flowi_oif,
1375+ &tmp, remote,
1376+ tmpl->encap_family, 0);
1377+ if (error)
1378+ goto fail;
1379+ local = &tmp;
13851380 }
13861381
13871382 x = xfrm_state_find(remote, local, fl, tmpl, policy, &error, family);
13881383
13891384 if (x && x->km.state == XFRM_STATE_VALID) {
13901385 xfrm[nx++] = x;
1391− daddr = remote;
1392− saddr = local;
13931386 continue;
13941387 }
13951388 if (x) {
@@ -1786,19 +1779,23 @@ void xfrm_policy_cache_flush(void) · 390 unmodified lines
17861779 put_online_cpus();
17871780 }
17881781
1789−static bool xfrm_pol_dead(struct xfrm_dst *xdst)
1782+static bool xfrm_xdst_can_reuse(struct xfrm_dst *xdst,
1783+ struct xfrm_state * const xfrm[],
1784+ int num)
17901785 {
1791− unsigned int num_pols = xdst->num_pols;
1792− unsigned int pol_dead = 0, i;
1786+ const struct dst_entry *dst = &xdst->u.dst;
1787+ int i;
17931788
1794− for (i = 0; i < num_pols; i++)
1795− pol_dead |= xdst->pols[i]->walk.dead;
1789+ if (xdst->num_xfrms != num)
1790+ return false;
17961791
1797− /* Mark DST_OBSOLETE_DEAD to fail the next xfrm_dst_check() */
1798− if (pol_dead)
1799− xdst->u.dst.obsolete = DST_OBSOLETE_DEAD;
1792+ for (i = 0; i < num; i++) {
1793+ if (!dst || dst->xfrm != xfrm[i])
1794+ return false;
1795+ dst = dst->child;
1796+ }
18001797
1801− return pol_dead;
1798+ return xfrm_bundle_ok(xdst);
18021799 }
18031800
18041801 static struct xfrm_dst *
@@ -1812,26 +1809,28 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols, · 7 unmodified lines
18121809 struct dst_entry *dst;
18131810 int err;
18141811
1812+ /* Try to instantiate a bundle */
1813+ err = xfrm_tmpl_resolve(pols, num_pols, fl, xfrm, family);
1814+ if (err <= 0) {
1815+ if (err != 0 && err != -EAGAIN)
1816+ XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
1817+ return ERR_PTR(err);
1818+ }
1819+
18151820 xdst = this_cpu_read(xfrm_last_dst);
18161821 if (xdst &&
18171822 xdst->u.dst.dev == dst_orig->dev &&
18181823 xdst->num_pols == num_pols &&
1819− !xfrm_pol_dead(xdst) &&
18201824 memcmp(xdst->pols, pols,
18211825 sizeof(struct xfrm_policy *) * num_pols) == 0 &&
1822− xfrm_bundle_ok(xdst)) {
1826+ xfrm_xdst_can_reuse(xdst, xfrm, err)) {
18231827 dst_hold(&xdst->u.dst);
1828+ while (err > 0)
1829+ xfrm_state_put(xfrm[--err]);
18241830 return xdst;
18251831 }
18261832
18271833 old = xdst;
1828− /* Try to instantiate a bundle */
1829− err = xfrm_tmpl_resolve(pols, num_pols, fl, xfrm, family);
1830− if (err <= 0) {
1831− if (err != 0 && err != -EAGAIN)
1832− XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
1833− return ERR_PTR(err);
1834− }
18351834
18361835 dst = xfrm_bundle_create(pols[0], xfrm, err, fl, dst_orig);
18371836 if (IS_ERR(dst)) {
scripts/leaking_addresses.pl+305−0
@@ -0,0 +1,305 @@
1+#!/usr/bin/env perl
2+#
3+# (c) 2017 Tobin C. Harding <me@tobin.cc>
4+# Licensed under the terms of the GNU GPL License version 2
5+#
6+# leaking_addresses.pl: Scan 64 bit kernel for potential leaking addresses.
7+# - Scans dmesg output.
8+# - Walks directory tree and parses each file (for each directory in @DIRS).
9+#
10+# You can configure the behaviour of the script;
11+#
12+# - By adding paths, for directories you do not want to walk;
13+# absolute paths: @skip_walk_dirs_abs
14+# directory names: @skip_walk_dirs_any
15+#
16+# - By adding paths, for files you do not want to parse;
17+# absolute paths: @skip_parse_files_abs
18+# file names: @skip_parse_files_any
19+#
20+# The use of @skip_xxx_xxx_any causes files to be skipped where ever they occur.
21+# For example adding 'fd' to @skip_walk_dirs_any causes the fd/ directory to be
22+# skipped for all PID sub-directories of /proc
23+#
24+# The same thing can be achieved by passing command line options to --dont-walk
25+# and --dont-parse. If absolute paths are supplied to these options they are
26+# appended to the @skip_xxx_xxx_abs arrays. If file names are supplied to these
27+# options, they are appended to the @skip_xxx_xxx_any arrays.
28+#
29+# Use --debug to output path before parsing, this is useful to find files that
30+# cause the script to choke.
31+#
32+# You may like to set kptr_restrict=2 before running script
33+# (see Documentation/sysctl/kernel.txt).
34+
35+use warnings;
36+use strict;
37+use POSIX;
38+use File::Basename;
39+use File::Spec;
40+use Cwd 'abs_path';
41+use Term::ANSIColor qw(:constants);
42+use Getopt::Long qw(:config no_auto_abbrev);
43+
44+my $P = $0;
45+my $V = '0.01';
46+
47+# Directories to scan.
48+my @DIRS = ('/proc', '/sys');
49+
50+# Command line options.
51+my $help = 0;
52+my $debug = 0;
53+my @dont_walk = ();
54+my @dont_parse = ();
55+
56+# Do not parse these files (absolute path).
57+my @skip_parse_files_abs = ('/proc/kmsg',
58+ '/proc/kcore',
59+ '/proc/fs/ext4/sdb1/mb_groups',
60+ '/proc/1/fd/3',
61+ '/sys/kernel/debug/tracing/trace_pipe',
62+ '/sys/kernel/security/apparmor/revision');
63+
64+# Do not parse thes files under any subdirectory.
65+my @skip_parse_files_any = ('0',
66+ '1',
67+ '2',
68+ 'pagemap',
69+ 'events',
70+ 'access',
71+ 'registers',
72+ 'snapshot_raw',
73+ 'trace_pipe_raw',
74+ 'ptmx',
75+ 'trace_pipe');
76+
77+# Do not walk these directories (absolute path).
78+my @skip_walk_dirs_abs = ();
79+
80+# Do not walk these directories under any subdirectory.
81+my @skip_walk_dirs_any = ('self',
82+ 'thread-self',
83+ 'cwd',
84+ 'fd',
85+ 'stderr',
86+ 'stdin',
87+ 'stdout');
88+
89+sub help
90+{
91+ my ($exitcode) = @_;
92+
93+ print << "EOM";
94+Usage: $P [OPTIONS]
95+Version: $V
96+
97+Options:
98+
99+ --dont-walk=<dir> Don't walk tree starting at <dir>.
100+ --dont-parse=<file> Don't parse <file>.
101+ -d, --debug Display debugging output.
102+ -h, --help, --version Display this help and exit.
103+
104+If an absolute path is passed to --dont_XXX then this path is skipped. If a
105+single filename is passed then this file/directory will be skipped when
106+appearing under any subdirectory.
107+
108+Example:
109+
110+ # Just scan dmesg output.
111+ scripts/leaking_addresses.pl --dont_walk_abs /proc --dont_walk_abs /sys
112+
113+Scans the running (64 bit) kernel for potential leaking addresses.
114+
115+EOM
116+ exit($exitcode);
117+}
118+
119+GetOptions(
120+ 'dont-walk=s' => \@dont_walk,
121+ 'dont-parse=s' => \@dont_parse,
122+ 'd|debug' => \$debug,
123+ 'h|help' => \$help,
124+ 'version' => \$help
125+) or help(1);
126+
127+help(0) if ($help);
128+
129+push_to_global();
130+
131+parse_dmesg();
132+walk(@DIRS);
133+
134+exit 0;
135+
136+sub debug_arrays
137+{
138+ print 'dirs_any: ' . join(", ", @skip_walk_dirs_any) . "\n";
139+ print 'dirs_abs: ' . join(", ", @skip_walk_dirs_abs) . "\n";
140+ print 'parse_any: ' . join(", ", @skip_parse_files_any) . "\n";
141+ print 'parse_abs: ' . join(", ", @skip_parse_files_abs) . "\n";
142+}
143+
144+sub dprint
145+{
146+ printf(STDERR @_) if $debug;
147+}
148+
149+sub push_in_abs_any
150+{
151+ my ($in, $abs, $any) = @_;
152+
153+ foreach my $path (@$in) {
154+ if (File::Spec->file_name_is_absolute($path)) {
155+ push @$abs, $path;
156+ } elsif (index($path,'/') == -1) {
157+ push @$any, $path;
158+ } else {
159+ print 'path error: ' . $path;
160+ }
161+ }
162+}
163+
164+# Push command line options to global arrays.
165+sub push_to_global
166+{
167+ push_in_abs_any(\@dont_walk, \@skip_walk_dirs_abs, \@skip_walk_dirs_any);
168+ push_in_abs_any(\@dont_parse, \@skip_parse_files_abs, \@skip_parse_files_any);
169+}
170+
171+sub is_false_positive
172+{
173+ my ($match) = @_;
174+
175+ if ($match =~ '\b(0x)?(f|F){16}\b' or
176+ $match =~ '\b(0x)?0{16}\b') {
177+ return 1;
178+ }
179+
180+ # vsyscall memory region, we should probably check against a range here.
181+ if ($match =~ '\bf{10}600000\b' or
182+ $match =~ '\bf{10}601000\b') {
183+ return 1;
184+ }
185+
186+ return 0;
187+}
188+
189+# True if argument potentially contains a kernel address.
190+sub may_leak_address
191+{
192+ my ($line) = @_;
193+ my $address = '\b(0x)?ffff[[:xdigit:]]{12}\b';
194+
195+ # Signal masks.
196+ if ($line =~ '^SigBlk:' or
197+ $line =~ '^SigCgt:') {
198+ return 0;
199+ }
200+
201+ if ($line =~ '\bKEY=[[:xdigit:]]{14} [[:xdigit:]]{16} [[:xdigit:]]{16}\b' or
202+ $line =~ '\b[[:xdigit:]]{14} [[:xdigit:]]{16} [[:xdigit:]]{16}\b') {
203+ return 0;
204+ }
205+
206+ while (/($address)/g) {
207+ if (!is_false_positive($1)) {
208+ return 1;
209+ }
210+ }
211+
212+ return 0;
213+}
214+
215+sub parse_dmesg
216+{
217+ open my $cmd, '-|', 'dmesg';
218+ while (<$cmd>) {
219+ if (may_leak_address($_)) {
220+ print 'dmesg: ' . $_;
221+ }
222+ }
223+ close $cmd;
224+}
225+
226+# True if we should skip this path.
227+sub skip
228+{
229+ my ($path, $paths_abs, $paths_any) = @_;
230+
231+ foreach (@$paths_abs) {
232+ return 1 if (/^$path$/);
233+ }
234+
235+ my($filename, $dirs, $suffix) = fileparse($path);
236+ foreach (@$paths_any) {
237+ return 1 if (/^$filename$/);
238+ }
239+
240+ return 0;
241+}
242+
243+sub skip_parse
244+{
245+ my ($path) = @_;
246+ return skip($path, \@skip_parse_files_abs, \@skip_parse_files_any);
247+}
248+
249+sub parse_file
250+{
251+ my ($file) = @_;
252+
253+ if (! -R $file) {
254+ return;
255+ }
256+
257+ if (skip_parse($file)) {
258+ dprint "skipping file: $file\n";
259+ return;
260+ }
261+ dprint "parsing: $file\n";
262+
263+ open my $fh, "<", $file or return;
264+ while ( <$fh> ) {
265+ if (may_leak_address($_)) {
266+ print $file . ': ' . $_;
267+ }
268+ }
269+ close $fh;
270+}
271+
272+
273+# True if we should skip walking this directory.
274+sub skip_walk
275+{
276+ my ($path) = @_;
277+ return skip($path, \@skip_walk_dirs_abs, \@skip_walk_dirs_any)
278+}
279+
280+# Recursively walk directory tree.
281+sub walk
282+{
283+ my @dirs = @_;
284+ my %seen;
285+
286+ while (my $pwd = shift @dirs) {
287+ next if (skip_walk($pwd));
288+ next if (!opendir(DIR, $pwd));
289+ my @files = readdir(DIR);
290+ closedir(DIR);
291+
292+ foreach my $file (@files) {
293+ next if ($file eq '.' or $file eq '..');
294+
295+ my $path = "$pwd/$file";
296+ next if (-l $path);
297+
298+ if (-d $path) {
299+ push @dirs, $path;
300+ } else {
301+ parse_file($path);
302+ }
303+ }
304+ }
305+}
security/apparmor/ipc.c+2−2
@@ -128,7 +128,7 @@ static inline int map_signal_num(int sig) · 127 unmodified lines
128128 return SIGUNKNOWN;
129129 else if (sig >= SIGRTMIN)
130130 return sig - SIGRTMIN + 128; /* rt sigs mapped to 128 */
131− else if (sig <= MAXMAPPED_SIG)
131+ else if (sig < MAXMAPPED_SIG)
132132 return sig_map[sig];
133133 return SIGUNKNOWN;
134134 }
@@ -163,7 +163,7 @@ static void audit_signal_cb(struct audit_buffer *ab, void *va) · 28 unmodified lines
163163 audit_signal_mask(ab, aad(sa)->denied);
164164 }
165165 }
166− if (aad(sa)->signal <= MAXMAPPED_SIG)
166+ if (aad(sa)->signal < MAXMAPPED_SIG)
167167 audit_log_format(ab, " signal=%s", sig_names[aad(sa)->signal]);
168168 else
169169 audit_log_format(ab, " signal=rtmin+%d",
sound/core/hrtimer.c+1−0
@@ -159,6 +159,7 @@ static int __init snd_hrtimer_init(void) · 158 unmodified lines
159159 timer->hw = hrtimer_hw;
160160 timer->hw.resolution = resolution;
161161 timer->hw.ticks = NANO_SEC / resolution;
162+ timer->max_instances = 100; /* lower the limit */
162163
163164 err = snd_timer_global_register(timer);
164165 if (err < 0) {
sound/core/seq/oss/seq_oss_midi.c+1−3
@@ -612,9 +612,7 @@ send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, struct seq · 611 unmodified lines
612612 if (!dp->timer->running)
613613 len = snd_seq_oss_timer_start(dp->timer);
614614 if (ev->type == SNDRV_SEQ_EVENT_SYSEX) {
615− if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
616− snd_seq_oss_readq_puts(dp->readq, mdev->seq_device,
617− ev->data.ext.ptr, ev->data.ext.len);
615+ snd_seq_oss_readq_sysex(dp->readq, mdev->seq_device, ev);
618616 } else {
619617 len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev);
620618 if (len > 0)
sound/core/seq/oss/seq_oss_readq.c+29−0
@@ -117,6 +117,35 @@ snd_seq_oss_readq_puts(struct seq_oss_readq *q, int dev, unsigned char *data, in · 116 unmodified lines
117117 return 0;
118118 }
119119
120+/*
121+ * put MIDI sysex bytes; the event buffer may be chained, thus it has
122+ * to be expanded via snd_seq_dump_var_event().
123+ */
124+struct readq_sysex_ctx {
125+ struct seq_oss_readq *readq;
126+ int dev;
127+};
128+
129+static int readq_dump_sysex(void *ptr, void *buf, int count)
130+{
131+ struct readq_sysex_ctx *ctx = ptr;
132+
133+ return snd_seq_oss_readq_puts(ctx->readq, ctx->dev, buf, count);
134+}
135+
136+int snd_seq_oss_readq_sysex(struct seq_oss_readq *q, int dev,
137+ struct snd_seq_event *ev)
138+{
139+ struct readq_sysex_ctx ctx = {
140+ .readq = q,
141+ .dev = dev
142+ };
143+
144+ if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
145+ return 0;
146+ return snd_seq_dump_var_event(ev, readq_dump_sysex, &ctx);
147+}
148+
120149 /*
121150 * copy an event to input queue:
122151 * return zero if enqueued
sound/core/seq/oss/seq_oss_readq.h+2−0
@@ -44,6 +44,8 @@ void snd_seq_oss_readq_delete(struct seq_oss_readq *q); · 43 unmodified lines
4444 void snd_seq_oss_readq_clear(struct seq_oss_readq *readq);
4545 unsigned int snd_seq_oss_readq_poll(struct seq_oss_readq *readq, struct file *file, poll_table *wait);
4646 int snd_seq_oss_readq_puts(struct seq_oss_readq *readq, int dev, unsigned char *data, int len);
47+int snd_seq_oss_readq_sysex(struct seq_oss_readq *q, int dev,
48+ struct snd_seq_event *ev);
4749 int snd_seq_oss_readq_put_event(struct seq_oss_readq *readq, union evrec *ev);
4850 int snd_seq_oss_readq_put_timestamp(struct seq_oss_readq *readq, unsigned long curt, int seq_mode);
4951 int snd_seq_oss_readq_pick(struct seq_oss_readq *q, union evrec *rec);
sound/core/timer.c+54−13
@@ -180,7 +180,7 @@ static void snd_timer_request(struct snd_timer_id *tid) · 179 unmodified lines
180180 *
181181 * call this with register_mutex down.
182182 */
183−static void snd_timer_check_slave(struct snd_timer_instance *slave)
183+static int snd_timer_check_slave(struct snd_timer_instance *slave)
184184 {
185185 struct snd_timer *timer;
186186 struct snd_timer_instance *master;
@@ -190,16 +190,21 @@ static void snd_timer_check_slave(struct snd_timer_instance *slave) · 3 unmodified lines
190190 list_for_each_entry(master, &timer->open_list_head, open_list) {
191191 if (slave->slave_class == master->slave_class &&
192192 slave->slave_id == master->slave_id) {
193+ if (master->timer->num_instances >=
194+ master->timer->max_instances)
195+ return -EBUSY;
193196 list_move_tail(&slave->open_list,
194197 &master->slave_list_head);
198+ master->timer->num_instances++;
195199 spin_lock_irq(&slave_active_lock);
196200 slave->master = master;
197201 slave->timer = master->timer;
198202 spin_unlock_irq(&slave_active_lock);
199− return;
203+ return 0;
200204 }
201205 }
202206 }
207+ return 0;
203208 }
204209
205210 /*
@@ -208,7 +213,7 @@ static void snd_timer_check_slave(struct snd_timer_instance *slave) · 2 unmodified lines
208213 *
209214 * call this with register_mutex down.
210215 */
211−static void snd_timer_check_master(struct snd_timer_instance *master)
216+static int snd_timer_check_master(struct snd_timer_instance *master)
212217 {
213218 struct snd_timer_instance *slave, *tmp;
214219
@@ -216,7 +221,11 @@ static void snd_timer_check_master(struct snd_timer_instance *master) · 1 unmodified line
216221 list_for_each_entry_safe(slave, tmp, &snd_timer_slave_list, open_list) {
217222 if (slave->slave_class == master->slave_class &&
218223 slave->slave_id == master->slave_id) {
224+ if (master->timer->num_instances >=
225+ master->timer->max_instances)
226+ return -EBUSY;
219227 list_move_tail(&slave->open_list, &master->slave_list_head);
228+ master->timer->num_instances++;
220229 spin_lock_irq(&slave_active_lock);
221230 spin_lock(&master->timer->lock);
222231 slave->master = master;
@@ -228,8 +237,11 @@ static void snd_timer_check_master(struct snd_timer_instance *master) · 5 unmodified lines
228237 spin_unlock_irq(&slave_active_lock);
229238 }
230239 }
240+ return 0;
231241 }
232242
243+static int snd_timer_close_locked(struct snd_timer_instance *timeri);
244+
233245 /*
234246 * open a timer instance
235247 * when opening a master, the slave id must be here given.
@@ -240,6 +252,7 @@ int snd_timer_open(struct snd_timer_instance **ti, · 4 unmodified lines
240252 {
241253 struct snd_timer *timer;
242254 struct snd_timer_instance *timeri = NULL;
255+ int err;
243256
244257 if (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) {
245258 /* open a slave instance */
@@ -259,10 +272,14 @@ int snd_timer_open(struct snd_timer_instance **ti, · 13 unmodified lines
259272 timeri->slave_id = tid->device;
260273 timeri->flags |= SNDRV_TIMER_IFLG_SLAVE;
261274 list_add_tail(&timeri->open_list, &snd_timer_slave_list);
262− snd_timer_check_slave(timeri);
275+ err = snd_timer_check_slave(timeri);
276+ if (err < 0) {
277+ snd_timer_close_locked(timeri);
278+ timeri = NULL;
279+ }
263280 mutex_unlock(&register_mutex);
264281 *ti = timeri;
265− return 0;
282+ return err;
266283 }
267284
268285 /* open a master instance */
@@ -288,6 +305,10 @@ int snd_timer_open(struct snd_timer_instance **ti, · 19 unmodified lines
288305 return -EBUSY;
289306 }
290307 }
308+ if (timer->num_instances >= timer->max_instances) {
309+ mutex_unlock(&register_mutex);
310+ return -EBUSY;
311+ }
291312 timeri = snd_timer_instance_new(owner, timer);
292313 if (!timeri) {
293314 mutex_unlock(&register_mutex);
@@ -314,25 +335,27 @@ int snd_timer_open(struct snd_timer_instance **ti, · 20 unmodified lines
314335 }
315336
316337 list_add_tail(&timeri->open_list, &timer->open_list_head);
317− snd_timer_check_master(timeri);
338+ timer->num_instances++;
339+ err = snd_timer_check_master(timeri);
340+ if (err < 0) {
341+ snd_timer_close_locked(timeri);
342+ timeri = NULL;
343+ }
318344 mutex_unlock(&register_mutex);
319345 *ti = timeri;
320− return 0;
346+ return err;
321347 }
322348 EXPORT_SYMBOL(snd_timer_open);
323349
324350 /*
325351 * close a timer instance
352+ * call this with register_mutex down.
326353 */
327−int snd_timer_close(struct snd_timer_instance *timeri)
354+static int snd_timer_close_locked(struct snd_timer_instance *timeri)
328355 {
329356 struct snd_timer *timer = NULL;
330357 struct snd_timer_instance *slave, *tmp;
331358
332− if (snd_BUG_ON(!timeri))
333− return -ENXIO;
334−
335− mutex_lock(&register_mutex);
336359 list_del(&timeri->open_list);
337360
338361 /* force to stop the timer */
@@ -340,6 +363,7 @@ int snd_timer_close(struct snd_timer_instance *timeri) · 1 unmodified line
340363
341364 timer = timeri->timer;
342365 if (timer) {
366+ timer->num_instances--;
343367 /* wait, until the active callback is finished */
344368 spin_lock_irq(&timer->lock);
345369 while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) {
@@ -355,6 +379,7 @@ int snd_timer_close(struct snd_timer_instance *timeri) · 9 unmodified lines
355379 list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head,
356380 open_list) {
357381 list_move_tail(&slave->open_list, &snd_timer_slave_list);
382+ timer->num_instances--;
358383 slave->master = NULL;
359384 slave->timer = NULL;
360385 list_del_init(&slave->ack_list);
@@ -382,9 +407,24 @@ int snd_timer_close(struct snd_timer_instance *timeri) · 21 unmodified lines
382407 module_put(timer->module);
383408 }
384409
385− mutex_unlock(&register_mutex);
386410 return 0;
387411 }
412+
413+/*
414+ * close a timer instance
415+ */
416+int snd_timer_close(struct snd_timer_instance *timeri)
417+{
418+ int err;
419+
420+ if (snd_BUG_ON(!timeri))
421+ return -ENXIO;
422+
423+ mutex_lock(&register_mutex);
424+ err = snd_timer_close_locked(timeri);
425+ mutex_unlock(&register_mutex);
426+ return err;
427+}
388428 EXPORT_SYMBOL(snd_timer_close);
389429
390430 unsigned long snd_timer_resolution(struct snd_timer_instance *timeri)
@@ -856,6 +896,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, · 465 unmodified lines
856896 spin_lock_init(&timer->lock);
857897 tasklet_init(&timer->task_queue, snd_timer_tasklet,
858898 (unsigned long)timer);
899+ timer->max_instances = 1000; /* default limit per timer */
859900 if (card != NULL) {
860901 timer->module = card->module;
861902 err = snd_device_new(card, SNDRV_DEV_TIMER, timer, &ops);
sound/pci/hda/patch_realtek.c+5−0
@@ -6544,6 +6544,11 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { · 6543 unmodified lines
65446544 {0x14, 0x90170110},
65456545 {0x1b, 0x90a70130},
65466546 {0x21, 0x03211020}),
6547+ SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6548+ {0x12, 0xb7a60130},
6549+ {0x13, 0xb8a61140},
6550+ {0x16, 0x90170110},
6551+ {0x21, 0x04211020}),
65476552 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
65486553 {0x12, 0x90a60130},
65496554 {0x14, 0x90170110},
sound/usb/quirks.c+1−0
@@ -1375,6 +1375,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, · 1374 unmodified lines
13751375 case 0x199:
13761376 return SNDRV_PCM_FMTBIT_DSD_U32_LE;
13771377 case 0x19b:
1378+ case 0x203:
13781379 return SNDRV_PCM_FMTBIT_DSD_U32_BE;
13791380 default:
13801381 break;
tools/arch/x86/include/asm/disabled-features.h+0−1
@@ -1,4 +1,3 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
21 #ifndef _ASM_X86_DISABLED_FEATURES_H
32 #define _ASM_X86_DISABLED_FEATURES_H
43
tools/arch/x86/include/asm/required-features.h+0−1
@@ -1,4 +1,3 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
21 #ifndef _ASM_X86_REQUIRED_FEATURES_H
32 #define _ASM_X86_REQUIRED_FEATURES_H
43
tools/arch/x86/include/uapi/asm/unistd.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
12 #ifndef _UAPI_ASM_X86_UNISTD_H
23 #define _UAPI_ASM_X86_UNISTD_H
34
tools/arch/x86/lib/memcpy_64.S+4−1
@@ -1,10 +1,10 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
21 /* Copyright 2002 Andi Kleen */
32
43 #include <linux/linkage.h>
54 #include <asm/errno.h>
65 #include <asm/cpufeatures.h>
76 #include <asm/alternative-asm.h>
7+#include <asm/export.h>
88
99 /*
1010 * We build a jump to memcpy_orig by default which gets NOPped out on
@@ -41,6 +41,8 @@ ENTRY(memcpy) · 30 unmodified lines
4141 ret
4242 ENDPROC(memcpy)
4343 ENDPROC(__memcpy)
44+EXPORT_SYMBOL(memcpy)
45+EXPORT_SYMBOL(__memcpy)
4446
4547 /*
4648 * memcpy_erms() - enhanced fast string memcpy. This is faster and
@@ -275,6 +277,7 @@ ENTRY(memcpy_mcsafe_unrolled) · 228 unmodified lines
275277 xorq %rax, %rax
276278 ret
277279 ENDPROC(memcpy_mcsafe_unrolled)
280+EXPORT_SYMBOL_GPL(memcpy_mcsafe_unrolled)
278281
279282 .section .fixup, "ax"
280283 /* Return -EFAULT for any failure */
tools/include/asm-generic/bitops/__fls.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
12 #ifndef _ASM_GENERIC_BITOPS___FLS_H_
23 #define _ASM_GENERIC_BITOPS___FLS_H_
34
tools/include/asm-generic/bitops/arch_hweight.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
12 #ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
23 #define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
34
tools/include/asm-generic/bitops/const_hweight.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
12 #ifndef _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
23 #define _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
34
tools/include/asm-generic/bitops/fls.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
12 #ifndef _ASM_GENERIC_BITOPS_FLS_H_
23 #define _ASM_GENERIC_BITOPS_FLS_H_
34
tools/include/asm-generic/bitops/fls64.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
12 #ifndef _ASM_GENERIC_BITOPS_FLS64_H_
23 #define _ASM_GENERIC_BITOPS_FLS64_H_
34
tools/include/asm/export.h+7−0
@@ -0,0 +1,7 @@
1+#ifndef _TOOLS_ASM_EXPORT_H
2+#define _TOOLS_ASM_EXPORT_H
3+
4+#define EXPORT_SYMBOL(x)
5+#define EXPORT_SYMBOL_GPL(x)
6+
7+#endif /* _TOOLS_ASM_EXPORT_H */
tools/include/linux/hash.h+0−1
@@ -1,4 +1,3 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
21 #ifndef _LINUX_HASH_H
32 #define _LINUX_HASH_H
43 /* Fast hashing routine for ints, longs and pointers.
tools/include/uapi/asm-generic/ioctls.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
12 #ifndef __ASM_GENERIC_IOCTLS_H
23 #define __ASM_GENERIC_IOCTLS_H
34
tools/include/uapi/asm-generic/mman-common.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
12 #ifndef __ASM_GENERIC_MMAN_COMMON_H
23 #define __ASM_GENERIC_MMAN_COMMON_H
34
tools/include/uapi/asm-generic/mman.h+2−2
@@ -1,8 +1,8 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
22 #ifndef __ASM_GENERIC_MMAN_H
33 #define __ASM_GENERIC_MMAN_H
44
5−#include <uapi/asm-generic/mman-common.h>
5+#include <asm-generic/mman-common.h>
66
77 #define MAP_GROWSDOWN 0x0100 /* stack-like segment */
88 #define MAP_DENYWRITE 0x0800 /* ETXTBSY */
tools/include/uapi/linux/bpf.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
12 /* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
23 *
34 * This program is free software; you can redistribute it and/or
tools/include/uapi/linux/bpf_common.h+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
22 #ifndef _UAPI__LINUX_BPF_COMMON_H__
33 #define _UAPI__LINUX_BPF_COMMON_H__
44
tools/include/uapi/linux/fcntl.h+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
22 #ifndef _UAPI_LINUX_FCNTL_H
33 #define _UAPI_LINUX_FCNTL_H
44
tools/include/uapi/linux/hw_breakpoint.h+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
22 #ifndef _UAPI_LINUX_HW_BREAKPOINT_H
33 #define _UAPI_LINUX_HW_BREAKPOINT_H
44
tools/include/uapi/linux/kvm.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
12 #ifndef __LINUX_KVM_H
23 #define __LINUX_KVM_H
34
tools/include/uapi/linux/mman.h+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
22 #ifndef _UAPI_LINUX_MMAN_H
33 #define _UAPI_LINUX_MMAN_H
44
tools/include/uapi/linux/perf_event.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
12 /*
23 * Performance events:
34 *
tools/include/uapi/linux/sched.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
12 #ifndef _UAPI_LINUX_SCHED_H
23 #define _UAPI_LINUX_SCHED_H
34
tools/include/uapi/linux/stat.h+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
22 #ifndef _UAPI_LINUX_STAT_H
33 #define _UAPI_LINUX_STAT_H
44
tools/include/uapi/linux/vhost.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
12 #ifndef _LINUX_VHOST_H
23 #define _LINUX_VHOST_H
34 /* Userspace interface for in-kernel virtio accelerators. */
tools/include/uapi/sound/asound.h+1−0
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
12 /*
23 * Advanced Linux Sound Architecture - ALSA - Driver
34 * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,
tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk+1−0
@@ -1,4 +1,5 @@
11 #!/bin/awk -f
2+# SPDX-License-Identifier: GPL-2.0
23 # gen-insn-attr-x86.awk: Instruction attribute table generator
34 # Written by Masami Hiramatsu <mhiramat@redhat.com>
45 #
tools/perf/util/annotate.c+11−1
@@ -606,9 +606,19 @@ static struct arch *arch__find(const char *name) · 605 unmodified lines
606606 int symbol__alloc_hist(struct symbol *sym)
607607 {
608608 struct annotation *notes = symbol__annotation(sym);
609− const size_t size = symbol__size(sym);
609+ size_t size = symbol__size(sym);
610610 size_t sizeof_sym_hist;
611611
612+ /*
613+ * Add buffer of one element for zero length symbol.
614+ * When sample is taken from first instruction of
615+ * zero length symbol, perf still resolves it and
616+ * shows symbol name in perf report and allows to
617+ * annotate it.
618+ */
619+ if (size == 0)
620+ size = 1;
621+
612622 /* Check for overflow when calculating sizeof_sym_hist */
613623 if (size > (SIZE_MAX - sizeof(struct sym_hist)) / sizeof(struct sym_hist_entry))
614624 return -1;
tools/perf/util/parse-events.l+6−2
@@ -154,6 +154,10 @@ do { \ · 153 unmodified lines
154154 yycolumn += yyleng; \
155155 } while (0);
156156
157+#define USER_REJECT \
158+ yycolumn -= yyleng; \
159+ REJECT
160+
157161 %}
158162
159163 %x mem
@@ -335,8 +339,8 @@ r{num_raw_hex} { return raw(yyscanner); } · 175 unmodified lines
335339 {num_hex} { return value(yyscanner, 16); }
336340
337341 {modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); }
338−{bpf_object} { if (!isbpf(yyscanner)) REJECT; return str(yyscanner, PE_BPF_OBJECT); }
339−{bpf_source} { if (!isbpf(yyscanner)) REJECT; return str(yyscanner, PE_BPF_SOURCE); }
342+{bpf_object} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_OBJECT); }
343+{bpf_source} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_SOURCE); }
340344 {name} { return pmu_str_check(yyscanner); }
341345 "/" { BEGIN(config); return '/'; }
342346 - { return '-'; }
virt/kvm/arm/arm.c+14−17
@@ -1326,21 +1326,12 @@ static void teardown_hyp_mode(void) · 1325 unmodified lines
13261326 {
13271327 int cpu;
13281328
1329− if (is_kernel_in_hyp_mode())
1330− return;
1331−
13321329 free_hyp_pgds();
13331330 for_each_possible_cpu(cpu)
13341331 free_page(per_cpu(kvm_arm_hyp_stack_page, cpu));
13351332 hyp_cpu_pm_exit();
13361333 }
13371334
1338−static int init_vhe_mode(void)
1339−{
1340− kvm_info("VHE mode initialized successfully\n");
1341− return 0;
1342−}
1343−
13441335 /**
13451336 * Inits Hyp-mode on all online CPUs
13461337 */
@@ -1421,8 +1412,6 @@ static int init_hyp_mode(void) · 74 unmodified lines
14211412 }
14221413 }
14231414
1424− kvm_info("Hyp mode initialized successfully\n");
1425−
14261415 return 0;
14271416
14281417 out_err:
@@ -1456,6 +1445,7 @@ int kvm_arch_init(void *opaque) · 27 unmodified lines
14561445 {
14571446 int err;
14581447 int ret, cpu;
1448+ bool in_hyp_mode;
14591449
14601450 if (!is_hyp_mode_available()) {
14611451 kvm_err("HYP mode not available\n");
@@ -1474,21 +1464,28 @@ int kvm_arch_init(void *opaque) · 12 unmodified lines
14741464 if (err)
14751465 return err;
14761466
1477− if (is_kernel_in_hyp_mode())
1478− err = init_vhe_mode();
1479− else
1467+ in_hyp_mode = is_kernel_in_hyp_mode();
1468+
1469+ if (!in_hyp_mode) {
14801470 err = init_hyp_mode();
1481− if (err)
1482− goto out_err;
1471+ if (err)
1472+ goto out_err;
1473+ }
14831474
14841475 err = init_subsystems();
14851476 if (err)
14861477 goto out_hyp;
14871478
1479+ if (in_hyp_mode)
1480+ kvm_info("VHE mode initialized successfully\n");
1481+ else
1482+ kvm_info("Hyp mode initialized successfully\n");
1483+
14881484 return 0;
14891485
14901486 out_hyp:
1491− teardown_hyp_mode();
1487+ if (!in_hyp_mode)
1488+ teardown_hyp_mode();
14921489 out_err:
14931490 teardown_common_resources();
14941491 return err;
virt/kvm/arm/vgic/vgic-its.c+48−25
@@ -1466,6 +1466,16 @@ static void vgic_mmio_write_its_ctlr(struct kvm *kvm, struct vgic_its *its, · 1465 unmodified lines
14661466 {
14671467 mutex_lock(&its->cmd_lock);
14681468
1469+ /*
1470+ * It is UNPREDICTABLE to enable the ITS if any of the CBASER or
1471+ * device/collection BASER are invalid
1472+ */
1473+ if (!its->enabled && (val & GITS_CTLR_ENABLE) &&
1474+ (!(its->baser_device_table & GITS_BASER_VALID) ||
1475+ !(its->baser_coll_table & GITS_BASER_VALID) ||
1476+ !(its->cbaser & GITS_CBASER_VALID)))
1477+ goto out;
1478+
14691479 its->enabled = !!(val & GITS_CTLR_ENABLE);
14701480
14711481 /*
@@ -1474,6 +1484,7 @@ static void vgic_mmio_write_its_ctlr(struct kvm *kvm, struct vgic_its *its, · 2 unmodified lines
14741484 */
14751485 vgic_its_process_commands(kvm, its);
14761486
1487+out:
14771488 mutex_unlock(&its->cmd_lock);
14781489 }
14791490
@@ -1801,37 +1812,33 @@ typedef int (*entry_fn_t)(struct vgic_its *its, u32 id, void *entry, · 321 unmodified lines
18011812 static int scan_its_table(struct vgic_its *its, gpa_t base, int size, int esz,
18021813 int start_id, entry_fn_t fn, void *opaque)
18031814 {
1804− void *entry = kzalloc(esz, GFP_KERNEL);
18051815 struct kvm *kvm = its->dev->kvm;
18061816 unsigned long len = size;
18071817 int id = start_id;
18081818 gpa_t gpa = base;
1819+ char entry[esz];
18091820 int ret;
18101821
1822+ memset(entry, 0, esz);
1823+
18111824 while (len > 0) {
18121825 int next_offset;
18131826 size_t byte_offset;
18141827
18151828 ret = kvm_read_guest(kvm, gpa, entry, esz);
18161829 if (ret)
1817− goto out;
1830+ return ret;
18181831
18191832 next_offset = fn(its, id, entry, opaque);
1820− if (next_offset <= 0) {
1821− ret = next_offset;
1822− goto out;
1823− }
1833+ if (next_offset <= 0)
1834+ return next_offset;
18241835
18251836 byte_offset = next_offset * esz;
18261837 id += next_offset;
18271838 gpa += byte_offset;
18281839 len -= byte_offset;
18291840 }
1830− ret = 1;
1831−
1832−out:
1833− kfree(entry);
1834− return ret;
1841+ return 1;
18351842 }
18361843
18371844 /**
@@ -1940,6 +1947,14 @@ static int vgic_its_save_itt(struct vgic_its *its, struct its_device *device) · 102 unmodified lines
19401947 return 0;
19411948 }
19421949
1950+/**
1951+ * vgic_its_restore_itt - restore the ITT of a device
1952+ *
1953+ * @its: its handle
1954+ * @dev: device handle
1955+ *
1956+ * Return 0 on success, < 0 on error
1957+ */
19431958 static int vgic_its_restore_itt(struct vgic_its *its, struct its_device *dev)
19441959 {
19451960 const struct vgic_its_abi *abi = vgic_its_get_abi(its);
@@ -1951,6 +1966,10 @@ static int vgic_its_restore_itt(struct vgic_its *its, struct its_device *dev) · 5 unmodified lines
19511966 ret = scan_its_table(its, base, max_size, ite_esz, 0,
19521967 vgic_its_restore_ite, dev);
19531968
1969+ /* scan_its_table returns +1 if all ITEs are invalid */
1970+ if (ret > 0)
1971+ ret = 0;
1972+
19541973 return ret;
19551974 }
19561975
@@ -2048,11 +2067,12 @@ static int vgic_its_device_cmp(void *priv, struct list_head *a, · 91 unmodified lines
20482067 static int vgic_its_save_device_tables(struct vgic_its *its)
20492068 {
20502069 const struct vgic_its_abi *abi = vgic_its_get_abi(its);
2070+ u64 baser = its->baser_device_table;
20512071 struct its_device *dev;
20522072 int dte_esz = abi->dte_esz;
2053− u64 baser;
20542073
2055− baser = its->baser_device_table;
2074+ if (!(baser & GITS_BASER_VALID))
2075+ return 0;
20562076
20572077 list_sort(NULL, &its->device_list, vgic_its_device_cmp);
20582078
@@ -2107,10 +2127,7 @@ static int handle_l1_dte(struct vgic_its *its, u32 id, void *addr, · 48 unmodified lines
21072127 ret = scan_its_table(its, gpa, SZ_64K, dte_esz,
21082128 l2_start_id, vgic_its_restore_dte, NULL);
21092129
2110− if (ret <= 0)
2111− return ret;
2112−
2113− return 1;
2130+ return ret;
21142131 }
21152132
21162133 /**
@@ -2140,8 +2157,9 @@ static int vgic_its_restore_device_tables(struct vgic_its *its) · 23 unmodified lines
21402157 vgic_its_restore_dte, NULL);
21412158 }
21422159
2160+ /* scan_its_table returns +1 if all entries are invalid */
21432161 if (ret > 0)
2144− ret = -EINVAL;
2162+ ret = 0;
21452163
21462164 return ret;
21472165 }
@@ -2198,17 +2216,17 @@ static int vgic_its_restore_cte(struct vgic_its *its, gpa_t gpa, int esz) · 50 unmodified lines
21982216 static int vgic_its_save_collection_table(struct vgic_its *its)
21992217 {
22002218 const struct vgic_its_abi *abi = vgic_its_get_abi(its);
2219+ u64 baser = its->baser_coll_table;
2220+ gpa_t gpa = BASER_ADDRESS(baser);
22012221 struct its_collection *collection;
22022222 u64 val;
2203− gpa_t gpa;
22042223 size_t max_size, filled = 0;
22052224 int ret, cte_esz = abi->cte_esz;
22062225
2207− gpa = BASER_ADDRESS(its->baser_coll_table);
2208− if (!gpa)
2226+ if (!(baser & GITS_BASER_VALID))
22092227 return 0;
22102228
2211− max_size = GITS_BASER_NR_PAGES(its->baser_coll_table) * SZ_64K;
2229+ max_size = GITS_BASER_NR_PAGES(baser) * SZ_64K;
22122230
22132231 list_for_each_entry(collection, &its->collection_list, coll_list) {
22142232 ret = vgic_its_save_cte(its, collection, gpa, cte_esz);
@@ -2239,17 +2257,18 @@ static int vgic_its_save_collection_table(struct vgic_its *its) · 24 unmodified lines
22392257 static int vgic_its_restore_collection_table(struct vgic_its *its)
22402258 {
22412259 const struct vgic_its_abi *abi = vgic_its_get_abi(its);
2260+ u64 baser = its->baser_coll_table;
22422261 int cte_esz = abi->cte_esz;
22432262 size_t max_size, read = 0;
22442263 gpa_t gpa;
22452264 int ret;
22462265
2247− if (!(its->baser_coll_table & GITS_BASER_VALID))
2266+ if (!(baser & GITS_BASER_VALID))
22482267 return 0;
22492268
2250− gpa = BASER_ADDRESS(its->baser_coll_table);
2269+ gpa = BASER_ADDRESS(baser);
22512270
2252− max_size = GITS_BASER_NR_PAGES(its->baser_coll_table) * SZ_64K;
2271+ max_size = GITS_BASER_NR_PAGES(baser) * SZ_64K;
22532272
22542273 while (read < max_size) {
22552274 ret = vgic_its_restore_cte(its, gpa, cte_esz);
@@ -2258,6 +2277,10 @@ static int vgic_its_restore_collection_table(struct vgic_its *its) · 2 unmodified lines
22582277 gpa += cte_esz;
22592278 read += cte_esz;
22602279 }
2280+
2281+ if (ret > 0)
2282+ return 0;
2283+
22612284 return ret;
22622285 }
22632286