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
15Alan Cox <alan@lxorguk.ukuu.org.uk>15Alan Cox <alan@lxorguk.ukuu.org.uk>
16Alan Cox <root@hraefn.swansea.linux.org.uk>16Alan Cox <root@hraefn.swansea.linux.org.uk>
17Aleksey Gorelov <aleksey_gorelov@phoenix.com>17Aleksey Gorelov <aleksey_gorelov@phoenix.com>
18Aleksandar Markovic <aleksandar.markovic@mips.com> <aleksandar.markovic@imgtec.com>
18Al Viro <viro@ftp.linux.org.uk>19Al Viro <viro@ftp.linux.org.uk>
19Al Viro <viro@zenIV.linux.org.uk>20Al Viro <viro@zenIV.linux.org.uk>
20Andreas Herrmann <aherrman@de.ibm.com>21Andreas Herrmann <aherrman@de.ibm.com>
@@ -101,6 +102,7 @@ Leonid I Ananiev <leonid.i.ananiev@intel.com> · 80 unmodified lines
101Linas Vepstas <linas@austin.ibm.com>102Linas Vepstas <linas@austin.ibm.com>
102Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de>103Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de>
103Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@ascom.ch>104Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@ascom.ch>
105Marcin Nowakowski <marcin.nowakowski@mips.com> <marcin.nowakowski@imgtec.com>
104Mark Brown <broonie@sirena.org.uk>106Mark Brown <broonie@sirena.org.uk>
105Martin Kepplinger <martink@posteo.de> <martin.kepplinger@theobroma-systems.com>107Martin Kepplinger <martink@posteo.de> <martin.kepplinger@theobroma-systems.com>
106Martin Kepplinger <martink@posteo.de> <martin.kepplinger@ginzinger.com>108Martin 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
119Mayuresh Janorkar <mayur@ti.com>121Mayuresh Janorkar <mayur@ti.com>
120Michael Buesch <m@bues.ch>122Michael Buesch <m@bues.ch>
121Michel Dänzer <michel@tungstengraphics.com>123Michel Dänzer <michel@tungstengraphics.com>
124Miodrag Dinic <miodrag.dinic@mips.com> <miodrag.dinic@imgtec.com>
122Mitesh shah <mshah@teja.com>125Mitesh shah <mshah@teja.com>
123Mohit Kumar <mohit.kumar@st.com> <mohit.kumar.dhaka@gmail.com>126Mohit Kumar <mohit.kumar@st.com> <mohit.kumar.dhaka@gmail.com>
124Morten Welinder <terra@gnome.org>127Morten Welinder <terra@gnome.org>
Documentation/process/kernel-enforcement-statement.rst+16−6
@@ -50,8 +50,9 @@ be stronger. · 49 unmodified lines
50Except where noted below, we speak only for ourselves, and not for any company50Except where noted below, we speak only for ourselves, and not for any company
51we might work for today, have in the past, or will in the future.51we might work for today, have in the past, or will in the future.
52 52
53 - Laura Abbott
53 - Bjorn Andersson (Linaro)54 - Bjorn Andersson (Linaro)
54 - Andrea Arcangeli (Red Hat)55 - Andrea Arcangeli
55 - Neil Armstrong56 - Neil Armstrong
56 - Jens Axboe57 - Jens Axboe
57 - Pablo Neira Ayuso58 - Pablo Neira Ayuso
@@ -60,15 +61,17 @@ we might work for today, have in the past, or will in the future. · 2 unmodified lines
60 - Felipe Balbi61 - Felipe Balbi
61 - Arnd Bergmann62 - Arnd Bergmann
62 - Ard Biesheuvel63 - Ard Biesheuvel
63 - Paolo Bonzini (Red Hat)64 - Tim Bird
65 - Paolo Bonzini
64 - Christian Borntraeger66 - Christian Borntraeger
65 - Mark Brown (Linaro)67 - Mark Brown (Linaro)
66 - Paul Burton68 - Paul Burton
67 - Javier Martinez Canillas69 - Javier Martinez Canillas
68 - Rob Clark70 - Rob Clark
69 - Jonathan Corbet71 - Jonathan Corbet
72 - Dennis Dalessandro
70 - Vivien Didelot (Savoir-faire Linux)73 - Vivien Didelot (Savoir-faire Linux)
71 - Hans de Goede (Red Hat)74 - Hans de Goede
72 - Mel Gorman (SUSE)75 - Mel Gorman (SUSE)
73 - Sven Eckelmann76 - Sven Eckelmann
74 - Alex Elder (Linaro)77 - Alex Elder (Linaro)
@@ -79,6 +82,7 @@ we might work for today, have in the past, or will in the future. · 4 unmodified lines
79 - Juergen Gross82 - Juergen Gross
80 - Shawn Guo83 - Shawn Guo
81 - Ulf Hansson84 - Ulf Hansson
85 - Stephen Hemminger (Microsoft)
82 - Tejun Heo86 - Tejun Heo
83 - Rob Herring87 - Rob Herring
84 - Masami Hiramatsu88 - Masami Hiramatsu
@@ -104,18 +108,21 @@ we might work for today, have in the past, or will in the future. · 19 unmodified lines
104 - Viresh Kumar108 - Viresh Kumar
105 - Aneesh Kumar K.V109 - Aneesh Kumar K.V
106 - Julia Lawall110 - Julia Lawall
107 - Doug Ledford (Red Hat)111 - Doug Ledford
108 - Chuck Lever (Oracle)112 - Chuck Lever (Oracle)
109 - Daniel Lezcano113 - Daniel Lezcano
110 - Shaohua Li114 - Shaohua Li
111 - Xin Long (Red Hat)115 - Xin Long
112 - Tony Luck116 - Tony Luck
117 - Catalin Marinas (Arm Ltd)
113 - Mike Marshall118 - Mike Marshall
114 - Chris Mason119 - Chris Mason
115 - Paul E. McKenney120 - Paul E. McKenney
116 - David S. Miller121 - David S. Miller
117 - Ingo Molnar122 - Ingo Molnar
118 - Kuninori Morimoto123 - Kuninori Morimoto
124 - Trond Myklebust
125 - Martin K. Petersen (Oracle)
119 - Borislav Petkov126 - Borislav Petkov
120 - Jiri Pirko127 - Jiri Pirko
121 - Josh Poimboeuf128 - Josh Poimboeuf
@@ -124,18 +131,20 @@ we might work for today, have in the past, or will in the future. · 2 unmodified lines
124 - Joerg Roedel131 - Joerg Roedel
125 - Leon Romanovsky132 - Leon Romanovsky
126 - Steven Rostedt (VMware)133 - Steven Rostedt (VMware)
127 - Ivan Safonov134 - Frank Rowand
128 - Ivan Safonov135 - Ivan Safonov
129 - Anna Schumaker136 - Anna Schumaker
130 - Jes Sorensen137 - Jes Sorensen
131 - K.Y. Srinivasan138 - K.Y. Srinivasan
132 - Heiko Stuebner139 - Heiko Stuebner
133 - Jiri Kosina (SUSE)140 - Jiri Kosina (SUSE)
141 - Willy Tarreau
134 - Dmitry Torokhov142 - Dmitry Torokhov
135 - Linus Torvalds143 - Linus Torvalds
136 - Thierry Reding144 - Thierry Reding
137 - Rik van Riel145 - Rik van Riel
138 - Geert Uytterhoeven (Glider bvba)146 - Geert Uytterhoeven (Glider bvba)
147 - Eduardo Valentin (Amazon.com)
139 - Daniel Vetter148 - Daniel Vetter
140 - Linus Walleij149 - Linus Walleij
141 - Richard Weinberger150 - Richard Weinberger
@@ -145,3 +154,4 @@ we might work for today, have in the past, or will in the future. · 3 unmodified lines
145 - Masahiro Yamada154 - Masahiro Yamada
146 - Wei Yongjun155 - Wei Yongjun
147 - Lv Zheng156 - Lv Zheng
157 - Marc Zyngier (Arm Ltd)
MAINTAINERS+9−5
@@ -873,7 +873,7 @@ F: drivers/android/ · 872 unmodified lines
873F: drivers/staging/android/873F: drivers/staging/android/
874 874
875ANDROID GOLDFISH RTC DRIVER875ANDROID GOLDFISH RTC DRIVER
876M: Miodrag Dinic <miodrag.dinic@imgtec.com>876M: Miodrag Dinic <miodrag.dinic@mips.com>
877S: Supported877S: Supported
878F: Documentation/devicetree/bindings/rtc/google,goldfish-rtc.txt878F: Documentation/devicetree/bindings/rtc/google,goldfish-rtc.txt
879F: drivers/rtc/rtc-goldfish.c879F: drivers/rtc/rtc-goldfish.c
@@ -7752,6 +7752,11 @@ S: Maintained · 6872 unmodified lines
7752F: Documentation/scsi/53c700.txt7752F: Documentation/scsi/53c700.txt
7753F: drivers/scsi/53c700*7753F: drivers/scsi/53c700*
7754 7754
7755LEAKING_ADDRESSES
7756M: Tobin C. Harding <me@tobin.cc>
7757S: Maintained
7758F: scripts/leaking_addresses.pl
7759
7755LED SUBSYSTEM7760LED SUBSYSTEM
7756M: Richard Purdie <rpurdie@rpsys.net>7761M: Richard Purdie <rpurdie@rpsys.net>
7757M: Jacek Anaszewski <jacek.anaszewski@gmail.com>7762M: Jacek Anaszewski <jacek.anaszewski@gmail.com>
@@ -9027,7 +9032,7 @@ F: drivers/*/*loongson1* · 1269 unmodified lines
9027F: drivers/*/*/*loongson1*9032F: drivers/*/*/*loongson1*
9028 9033
9029MIPS RINT INSTRUCTION EMULATION9034MIPS RINT INSTRUCTION EMULATION
9030M: Aleksandar Markovic <aleksandar.markovic@imgtec.com>9035M: Aleksandar Markovic <aleksandar.markovic@mips.com>
9031L: linux-mips@linux-mips.org9036L: linux-mips@linux-mips.org
9032S: Supported9037S: Supported
9033F: arch/mips/math-emu/sp_rint.c9038F: arch/mips/math-emu/sp_rint.c
@@ -10692,10 +10697,9 @@ S: Maintained · 1658 unmodified lines
10692F: drivers/pinctrl/spear/10697F: drivers/pinctrl/spear/
10693 10698
10694PISTACHIO SOC SUPPORT10699PISTACHIO SOC SUPPORT
10695M: James Hartley <james.hartley@imgtec.com>10700M: James Hartley <james.hartley@sondrel.com>
10696M: Ionela Voinescu <ionela.voinescu@imgtec.com>
10697L: linux-mips@linux-mips.org10701L: linux-mips@linux-mips.org
10698S: Maintained10702S: Odd Fixes
10699F: arch/mips/pistachio/10703F: arch/mips/pistachio/
10700F: arch/mips/include/asm/mach-pistachio/10704F: arch/mips/include/asm/mach-pistachio/
10701F: arch/mips/boot/dts/img/pistachio*10705F: arch/mips/boot/dts/img/pistachio*
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
2VERSION = 42VERSION = 4
3PATCHLEVEL = 143PATCHLEVEL = 14
4SUBLEVEL = 04SUBLEVEL = 0
5EXTRAVERSION = -rc75EXTRAVERSION = -rc8
6NAME = Fearless Coyote6NAME = Fearless Coyote
7 7
8# *DOCUMENTATION*8# *DOCUMENTATION*
arch/arm/Makefile+2−0
@@ -44,10 +44,12 @@ endif · 43 unmodified lines
44 44
45ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)45ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
46KBUILD_CPPFLAGS += -mbig-endian46KBUILD_CPPFLAGS += -mbig-endian
47CHECKFLAGS += -D__ARMEB__
47AS += -EB48AS += -EB
48LD += -EB49LD += -EB
49else50else
50KBUILD_CPPFLAGS += -mlittle-endian51KBUILD_CPPFLAGS += -mlittle-endian
52CHECKFLAGS += -D__ARMEL__
51AS += -EL53AS += -EL
52LD += -EL54LD += -EL
53endif55endif
arch/arm/boot/compressed/vmlinux.lds.S+9−0
@@ -85,6 +85,15 @@ SECTIONS · 84 unmodified lines
85 85
86 _edata = .;86 _edata = .;
87 87
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
88 _magic_sig = ZIMAGE_MAGIC(0x016f2818);97 _magic_sig = ZIMAGE_MAGIC(0x016f2818);
89 _magic_start = ZIMAGE_MAGIC(_start);98 _magic_start = ZIMAGE_MAGIC(_start);
90 _magic_end = ZIMAGE_MAGIC(_edata);99 _magic_end = ZIMAGE_MAGIC(_edata);
arch/arm/boot/dts/armada-375.dtsi+2−2
@@ -178,9 +178,9 @@ · 177 unmodified lines
178 reg = <0x8000 0x1000>;178 reg = <0x8000 0x1000>;
179 cache-unified;179 cache-unified;
180 cache-level = <2>;180 cache-level = <2>;
181 arm,double-linefill-incr = <1>;181 arm,double-linefill-incr = <0>;
182 arm,double-linefill-wrap = <0>;182 arm,double-linefill-wrap = <0>;
183 arm,double-linefill = <1>;183 arm,double-linefill = <0>;
184 prefetch-data = <1>;184 prefetch-data = <1>;
185 };185 };
186 186
arch/arm/boot/dts/armada-38x.dtsi+2−2
@@ -143,9 +143,9 @@ · 142 unmodified lines
143 reg = <0x8000 0x1000>;143 reg = <0x8000 0x1000>;
144 cache-unified;144 cache-unified;
145 cache-level = <2>;145 cache-level = <2>;
146 arm,double-linefill-incr = <1>;146 arm,double-linefill-incr = <0>;
147 arm,double-linefill-wrap = <0>;147 arm,double-linefill-wrap = <0>;
148 arm,double-linefill = <1>;148 arm,double-linefill = <0>;
149 prefetch-data = <1>;149 prefetch-data = <1>;
150 };150 };
151 151
arch/arm/boot/dts/armada-39x.dtsi+2−2
@@ -111,9 +111,9 @@ · 110 unmodified lines
111 reg = <0x8000 0x1000>;111 reg = <0x8000 0x1000>;
112 cache-unified;112 cache-unified;
113 cache-level = <2>;113 cache-level = <2>;
114 arm,double-linefill-incr = <1>;114 arm,double-linefill-incr = <0>;
115 arm,double-linefill-wrap = <0>;115 arm,double-linefill-wrap = <0>;
116 arm,double-linefill = <1>;116 arm,double-linefill = <0>;
117 prefetch-data = <1>;117 prefetch-data = <1>;
118 };118 };
119 119
arch/arm/boot/dts/uniphier-ld4.dtsi+6−3
@@ -209,7 +209,8 @@ · 208 unmodified lines
209 interrupts = <0 80 4>;209 interrupts = <0 80 4>;
210 pinctrl-names = "default";210 pinctrl-names = "default";
211 pinctrl-0 = <&pinctrl_usb0>;211 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>;
213 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,214 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,
214 <&mio_rst 12>;215 <&mio_rst 12>;
215 };216 };
@@ -221,7 +222,8 @@ · 5 unmodified lines
221 interrupts = <0 81 4>;222 interrupts = <0 81 4>;
222 pinctrl-names = "default";223 pinctrl-names = "default";
223 pinctrl-0 = <&pinctrl_usb1>;224 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>;
225 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,227 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,
226 <&mio_rst 13>;228 <&mio_rst 13>;
227 };229 };
@@ -233,7 +235,8 @@ · 5 unmodified lines
233 interrupts = <0 82 4>;235 interrupts = <0 82 4>;
234 pinctrl-names = "default";236 pinctrl-names = "default";
235 pinctrl-0 = <&pinctrl_usb2>;237 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>;
237 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>,240 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>,
238 <&mio_rst 14>;241 <&mio_rst 14>;
239 };242 };
arch/arm/boot/dts/uniphier-pro4.dtsi+4−2
@@ -241,7 +241,8 @@ · 240 unmodified lines
241 interrupts = <0 80 4>;241 interrupts = <0 80 4>;
242 pinctrl-names = "default";242 pinctrl-names = "default";
243 pinctrl-0 = <&pinctrl_usb2>;243 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>;
245 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,246 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,
246 <&mio_rst 12>;247 <&mio_rst 12>;
247 };248 };
@@ -253,7 +254,8 @@ · 5 unmodified lines
253 interrupts = <0 81 4>;254 interrupts = <0 81 4>;
254 pinctrl-names = "default";255 pinctrl-names = "default";
255 pinctrl-0 = <&pinctrl_usb3>;256 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>;
257 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,259 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,
258 <&mio_rst 13>;260 <&mio_rst 13>;
259 };261 };
arch/arm/boot/dts/uniphier-sld8.dtsi+6−3
@@ -209,7 +209,8 @@ · 208 unmodified lines
209 interrupts = <0 80 4>;209 interrupts = <0 80 4>;
210 pinctrl-names = "default";210 pinctrl-names = "default";
211 pinctrl-0 = <&pinctrl_usb0>;211 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>;
213 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,214 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,
214 <&mio_rst 12>;215 <&mio_rst 12>;
215 };216 };
@@ -221,7 +222,8 @@ · 5 unmodified lines
221 interrupts = <0 81 4>;222 interrupts = <0 81 4>;
222 pinctrl-names = "default";223 pinctrl-names = "default";
223 pinctrl-0 = <&pinctrl_usb1>;224 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>;
225 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,227 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,
226 <&mio_rst 13>;228 <&mio_rst 13>;
227 };229 };
@@ -233,7 +235,8 @@ · 5 unmodified lines
233 interrupts = <0 82 4>;235 interrupts = <0 82 4>;
234 pinctrl-names = "default";236 pinctrl-names = "default";
235 pinctrl-0 = <&pinctrl_usb2>;237 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>;
237 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>,240 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>,
238 <&mio_rst 14>;241 <&mio_rst 14>;
239 };242 };
arch/arm/include/asm/Kbuild+0−1
@@ -20,7 +20,6 @@ generic-y += simd.h · 19 unmodified lines
20generic-y += sizes.h20generic-y += sizes.h
21generic-y += timex.h21generic-y += timex.h
22generic-y += trace_clock.h22generic-y += trace_clock.h
23generic-y += unaligned.h
24 23
25generated-y += mach-types.h24generated-y += mach-types.h
26generated-y += unistd-nr.h25generated-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
227 u32 return_offset = (is_thumb) ? 2 : 4;227 u32 return_offset = (is_thumb) ? 2 : 4;
228 228
229 kvm_update_psr(vcpu, UND_MODE);229 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;
231 231
232 /* Branch to exception vector */232 /* Branch to exception vector */
233 *vcpu_pc(vcpu) = exc_vector_base(vcpu) + vect_offset;233 *vcpu_pc(vcpu) = exc_vector_base(vcpu) + vect_offset;
@@ -239,10 +239,8 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu) · 5 unmodified lines
239 */239 */
240static void inject_abt(struct kvm_vcpu *vcpu, bool is_pabt, unsigned long addr)240static void inject_abt(struct kvm_vcpu *vcpu, bool is_pabt, unsigned long addr)
241{241{
242 unsigned long cpsr = *vcpu_cpsr(vcpu);
243 bool is_thumb = (cpsr & PSR_T_BIT);
244 u32 vect_offset;242 u32 vect_offset;
245 u32 return_offset = (is_thumb) ? 4 : 0;243 u32 return_offset = (is_pabt) ? 4 : 8;
246 bool is_lpae;244 bool is_lpae;
247 245
248 kvm_update_psr(vcpu, ABT_MODE);246 kvm_update_psr(vcpu, ABT_MODE);
arch/arm/kvm/hyp/Makefile+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
3# Makefile for Kernel-based Virtual Machine module, HYP part3# Makefile for Kernel-based Virtual Machine module, HYP part
4#4#
5 5
6ccflags-y += -fno-stack-protector6ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING
7 7
8KVM=../../../../virt/kvm8KVM=../../../../virt/kvm
9 9
arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi+6−3
@@ -299,7 +299,8 @@ · 298 unmodified lines
299 interrupts = <0 243 4>;299 interrupts = <0 243 4>;
300 pinctrl-names = "default";300 pinctrl-names = "default";
301 pinctrl-0 = <&pinctrl_usb0>;301 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>;
303 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,304 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>,
304 <&mio_rst 12>;305 <&mio_rst 12>;
305 };306 };
@@ -311,7 +312,8 @@ · 5 unmodified lines
311 interrupts = <0 244 4>;312 interrupts = <0 244 4>;
312 pinctrl-names = "default";313 pinctrl-names = "default";
313 pinctrl-0 = <&pinctrl_usb1>;314 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>;
315 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,317 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>,
316 <&mio_rst 13>;318 <&mio_rst 13>;
317 };319 };
@@ -323,7 +325,8 @@ · 5 unmodified lines
323 interrupts = <0 245 4>;325 interrupts = <0 245 4>;
324 pinctrl-names = "default";326 pinctrl-names = "default";
325 pinctrl-0 = <&pinctrl_usb2>;327 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>;
327 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>,330 resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>,
328 <&mio_rst 14>;331 <&mio_rst 14>;
329 };332 };
arch/arm64/kvm/hyp/Makefile+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
3# Makefile for Kernel-based Virtual Machine module, HYP part3# Makefile for Kernel-based Virtual Machine module, HYP part
4#4#
5 5
6ccflags-y += -fno-stack-protector6ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING
7 7
8KVM=../../../../virt/kvm8KVM=../../../../virt/kvm
9 9
arch/arm64/kvm/inject_fault.c+15−1
@@ -33,12 +33,26 @@ · 32 unmodified lines
33#define LOWER_EL_AArch64_VECTOR 0x40033#define LOWER_EL_AArch64_VECTOR 0x400
34#define LOWER_EL_AArch32_VECTOR 0x60034#define LOWER_EL_AArch32_VECTOR 0x600
35 35
36/*
37 * Table taken from ARMv8 ARM DDI0487B-B, table G1-10.
38 */
39static 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
36static void prepare_fault32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset)50static void prepare_fault32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset)
37{51{
38 unsigned long cpsr;52 unsigned long cpsr;
39 unsigned long new_spsr_value = *vcpu_cpsr(vcpu);53 unsigned long new_spsr_value = *vcpu_cpsr(vcpu);
40 bool is_thumb = (new_spsr_value & COMPAT_PSR_T_BIT);54 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];
42 u32 sctlr = vcpu_cp15(vcpu, c1_SCTLR);56 u32 sctlr = vcpu_cp15(vcpu, c1_SCTLR);
43 57
44 cpsr = mode | COMPAT_PSR_I_BIT;58 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
112 buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;112 buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
113}113}
114 114
115#define acpi_unlazy_tlb(x)
116
115#ifdef CONFIG_ACPI_NUMA117#ifdef CONFIG_ACPI_NUMA
116extern cpumask_t early_cpu_possible_map;118extern cpumask_t early_cpu_possible_map;
117#define for_each_possible_early_cpu(cpu) \119#define for_each_possible_early_cpu(cpu) \
arch/mips/generic/board-ni169445.its.S+1−1
@@ -1,4 +1,4 @@
1{1/ {
2 images {2 images {
3 fdt@ni169445 {3 fdt@ni169445 {
4 description = "NI 169445 device tree";4 description = "NI 169445 device tree";
arch/mips/generic/init.c+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
20#include <asm/fw/fw.h>20#include <asm/fw/fw.h>
21#include <asm/irq_cpu.h>21#include <asm/irq_cpu.h>
22#include <asm/machine.h>22#include <asm/machine.h>
23#include <asm/mips-cpc.h>23#include <asm/mips-cps.h>
24#include <asm/prom.h>24#include <asm/prom.h>
25#include <asm/smp-ops.h>25#include <asm/smp-ops.h>
26#include <asm/time.h>26#include <asm/time.h>
arch/mips/generic/kexec.c+1−1
@@ -1,6 +1,6 @@
1/*1/*
2 * Copyright (C) 2016 Imagination Technologies2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Marcin Nowakowski <marcin.nowakowski@imgtec.com>3 * Author: Marcin Nowakowski <marcin.nowakowski@mips.com>
4 *4 *
5 * This program is free software; you can redistribute it and/or modify it5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the6 * 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
142GCR_ACCESSOR_RW(64, 0x008, base)142GCR_ACCESSOR_RW(64, 0x008, base)
143#define CM_GCR_BASE_GCRBASE GENMASK_ULL(47, 15)143#define CM_GCR_BASE_GCRBASE GENMASK_ULL(47, 15)
144#define CM_GCR_BASE_CMDEFTGT GENMASK(1, 0)144#define CM_GCR_BASE_CMDEFTGT GENMASK(1, 0)
145#define CM_GCR_BASE_CMDEFTGT_DISABLED 0145#define CM_GCR_BASE_CMDEFTGT_MEM 0
146#define CM_GCR_BASE_CMDEFTGT_MEM 1146#define CM_GCR_BASE_CMDEFTGT_RESERVED 1
147#define CM_GCR_BASE_CMDEFTGT_IOCU0 2147#define CM_GCR_BASE_CMDEFTGT_IOCU0 2
148#define CM_GCR_BASE_CMDEFTGT_IOCU1 3148#define CM_GCR_BASE_CMDEFTGT_IOCU1 3
149 149
arch/mips/include/asm/stackframe.h+4−4
@@ -199,6 +199,10 @@ · 198 unmodified lines
199 sll k0, 3 /* extract cu0 bit */199 sll k0, 3 /* extract cu0 bit */
200 .set noreorder200 .set noreorder
201 bltz k0, 8f201 bltz k0, 8f
202 move k0, sp
203 .if \docfi
204 .cfi_register sp, k0
205 .endif
202#ifdef CONFIG_EVA206#ifdef CONFIG_EVA
203 /*207 /*
204 * Flush interAptiv's Return Prediction Stack (RPS) by writing208 * Flush interAptiv's Return Prediction Stack (RPS) by writing
@@ -225,10 +229,6 @@ · 20 unmodified lines
225 MTC0 k0, CP0_ENTRYHI229 MTC0 k0, CP0_ENTRYHI
226#endif230#endif
227 .set reorder231 .set reorder
228 move k0, sp
229 .if \docfi
230 .cfi_register sp, k0
231 .endif
232 /* Called from user mode, new stack. */232 /* Called from user mode, new stack. */
233 get_saved_sp docfi=\docfi tosp=1233 get_saved_sp docfi=\docfi tosp=1
2348:2348:
arch/mips/kernel/probes-common.h+1−1
@@ -1,6 +1,6 @@
1/*1/*
2 * Copyright (C) 2016 Imagination Technologies2 * Copyright (C) 2016 Imagination Technologies
3 * Author: Marcin Nowakowski <marcin.nowakowski@imgtec.com>3 * Author: Marcin Nowakowski <marcin.nowakowski@mips.com>
4 *4 *
5 * This program is free software; you can redistribute it and/or modify it5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the6 * 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
19#undef DEBUG19#undef DEBUG
20 20
21#include <linux/kernel.h>21#include <linux/kernel.h>
22#include <linux/sched.h>22#include <linux/sched/task_stack.h>
23#include <linux/smp.h>23#include <linux/smp.h>
24#include <linux/cpumask.h>24#include <linux/cpumask.h>
25#include <linux/interrupt.h>25#include <linux/interrupt.h>
@@ -50,8 +50,8 @@ static void cmp_init_secondary(void) · 24 unmodified lines
50 50
51#ifdef CONFIG_MIPS_MT_SMP51#ifdef CONFIG_MIPS_MT_SMP
52 if (cpu_has_mipsmt)52 if (cpu_has_mipsmt)
53 c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) &53 cpu_set_vpe_id(c, (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) &
54 TCBIND_CURVPE;54 TCBIND_CURVPE);
55#endif55#endif
56}56}
57 57
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
306 int err;306 int err;
307 307
308 /* We don't yet support booting CPUs in other clusters */308 /* 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))
310 return -ENOSYS;310 return -ENOSYS;
311 311
312 vpe_cfg->pc = (unsigned long)&smp_bootstrap;312 vpe_cfg->pc = (unsigned long)&smp_bootstrap;
arch/mips/kernel/smp.c+17−7
@@ -42,7 +42,7 @@ · 41 unmodified lines
42#include <asm/processor.h>42#include <asm/processor.h>
43#include <asm/idle.h>43#include <asm/idle.h>
44#include <asm/r4k-timer.h>44#include <asm/r4k-timer.h>
45#include <asm/mips-cpc.h>45#include <asm/mips-cps.h>
46#include <asm/mmu_context.h>46#include <asm/mmu_context.h>
47#include <asm/time.h>47#include <asm/time.h>
48#include <asm/setup.h>48#include <asm/setup.h>
@@ -66,6 +66,7 @@ EXPORT_SYMBOL(cpu_sibling_map); · 17 unmodified lines
66cpumask_t cpu_core_map[NR_CPUS] __read_mostly;66cpumask_t cpu_core_map[NR_CPUS] __read_mostly;
67EXPORT_SYMBOL(cpu_core_map);67EXPORT_SYMBOL(cpu_core_map);
68 68
69static DECLARE_COMPLETION(cpu_starting);
69static DECLARE_COMPLETION(cpu_running);70static DECLARE_COMPLETION(cpu_running);
70 71
71/*72/*
@@ -374,6 +375,12 @@ asmlinkage void start_secondary(void) · 302 unmodified lines
374 cpumask_set_cpu(cpu, &cpu_coherent_mask);375 cpumask_set_cpu(cpu, &cpu_coherent_mask);
375 notify_cpu_starting(cpu);376 notify_cpu_starting(cpu);
376 377
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 */
377 set_cpu_online(cpu, true);384 set_cpu_online(cpu, true);
378 385
379 set_cpu_sibling_map(cpu);386 set_cpu_sibling_map(cpu);
@@ -381,8 +388,11 @@ asmlinkage void start_secondary(void) · 1 unmodified line
381 388
382 calculate_cpu_foreign_map();389 calculate_cpu_foreign_map();
383 390
391 /*
392 * Notify boot CPU that we're up & online and it can safely return
393 * from __cpu_up
394 */
384 complete(&cpu_running);395 complete(&cpu_running);
385 synchronise_count_slave(cpu);
386 396
387 /*397 /*
388 * irq will be enabled in ->smp_finish(), enabling it too early398 * 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
445 if (err)455 if (err)
446 return err;456 return err;
447 457
448 /*458 /* Wait for CPU to start and be ready to sync counters */
449 * We must check for timeout here, as the CPU will not be marked459 if (!wait_for_completion_timeout(&cpu_starting,
450 * online until the counters are synchronised.
451 */
452 if (!wait_for_completion_timeout(&cpu_running,
453 msecs_to_jiffies(1000))) {460 msecs_to_jiffies(1000))) {
454 pr_crit("CPU%u: failed to start\n", cpu);461 pr_crit("CPU%u: failed to start\n", cpu);
455 return -EIO;462 return -EIO;
456 }463 }
457 464
458 synchronise_count_master(cpu);465 synchronise_count_master(cpu);
466
467 /* Wait for CPU to finish startup & mark itself online before return */
468 wait_for_completion(&cpu_running);
459 return 0;469 return 0;
460}470}
461 471
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
80 [insn_jr] = {M(mm_pool32a_op, 0, 0, 0, mm_jalr_op, mm_pool32axf_op), RS},80 [insn_jr] = {M(mm_pool32a_op, 0, 0, 0, mm_jalr_op, mm_pool32axf_op), RS},
81 [insn_lb] = {M(mm_lb32_op, 0, 0, 0, 0, 0), RT | RS | SIMM},81 [insn_lb] = {M(mm_lb32_op, 0, 0, 0, 0, 0), RT | RS | SIMM},
82 [insn_ld] = {0, 0},82 [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},
84 [insn_ll] = {M(mm_pool32c_op, 0, 0, (mm_ll_func << 1), 0, 0), RS | RT | SIMM},84 [insn_ll] = {M(mm_pool32c_op, 0, 0, (mm_ll_func << 1), 0, 0), RS | RT | SIMM},
85 [insn_lld] = {0, 0},85 [insn_lld] = {0, 0},
86 [insn_lui] = {M(mm_pool32i_op, mm_lui_op, 0, 0, 0, 0), RS | SIMM},86 [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
1513 }1513 }
1514 src = ebpf_to_mips_reg(ctx, insn, src_reg_no_fp);1514 src = ebpf_to_mips_reg(ctx, insn, src_reg_no_fp);
1515 if (src < 0)1515 if (src < 0)
1516 return dst;1516 return src;
1517 if (BPF_MODE(insn->code) == BPF_XADD) {1517 if (BPF_MODE(insn->code) == BPF_XADD) {
1518 switch (BPF_SIZE(insn->code)) {1518 switch (BPF_SIZE(insn->code)) {
1519 case BPF_W:1519 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
157.endr157.endr
158 158
159 # Find min length159 # Find min length
160 vmovdqa _lens+0*16(state), %xmm0160 vmovdqu _lens+0*16(state), %xmm0
161 vmovdqa _lens+1*16(state), %xmm1161 vmovdqu _lens+1*16(state), %xmm1
162 162
163 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}163 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
164 vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}164 vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
@@ -178,8 +178,8 @@ LABEL skip_ %I · 13 unmodified lines
178 vpsubd %xmm2, %xmm0, %xmm0178 vpsubd %xmm2, %xmm0, %xmm0
179 vpsubd %xmm2, %xmm1, %xmm1179 vpsubd %xmm2, %xmm1, %xmm1
180 180
181 vmovdqa %xmm0, _lens+0*16(state)181 vmovdqu %xmm0, _lens+0*16(state)
182 vmovdqa %xmm1, _lens+1*16(state)182 vmovdqu %xmm1, _lens+1*16(state)
183 183
184 # "state" and "args" are the same address, arg1184 # "state" and "args" are the same address, arg1
185 # len is arg2185 # len is arg2
@@ -235,8 +235,8 @@ ENTRY(sha1_mb_mgr_get_comp_job_avx2) · 49 unmodified lines
235 jc .return_null235 jc .return_null
236 236
237 # Find min length237 # Find min length
238 vmovdqa _lens(state), %xmm0238 vmovdqu _lens(state), %xmm0
239 vmovdqa _lens+1*16(state), %xmm1239 vmovdqu _lens+1*16(state), %xmm1
240 240
241 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}241 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
242 vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}242 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
155.endr155.endr
156 156
157 # Find min length157 # Find min length
158 vmovdqa _lens+0*16(state), %xmm0158 vmovdqu _lens+0*16(state), %xmm0
159 vmovdqa _lens+1*16(state), %xmm1159 vmovdqu _lens+1*16(state), %xmm1
160 160
161 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}161 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
162 vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}162 vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
@@ -176,8 +176,8 @@ LABEL skip_ %I · 13 unmodified lines
176 vpsubd %xmm2, %xmm0, %xmm0176 vpsubd %xmm2, %xmm0, %xmm0
177 vpsubd %xmm2, %xmm1, %xmm1177 vpsubd %xmm2, %xmm1, %xmm1
178 178
179 vmovdqa %xmm0, _lens+0*16(state)179 vmovdqu %xmm0, _lens+0*16(state)
180 vmovdqa %xmm1, _lens+1*16(state)180 vmovdqu %xmm1, _lens+1*16(state)
181 181
182 # "state" and "args" are the same address, arg1182 # "state" and "args" are the same address, arg1
183 # len is arg2183 # len is arg2
@@ -234,8 +234,8 @@ ENTRY(sha256_mb_mgr_get_comp_job_avx2) · 50 unmodified lines
234 jc .return_null234 jc .return_null
235 235
236 # Find min length236 # Find min length
237 vmovdqa _lens(state), %xmm0237 vmovdqu _lens(state), %xmm0
238 vmovdqa _lens+1*16(state), %xmm1238 vmovdqu _lens+1*16(state), %xmm1
239 239
240 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}240 vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
241 vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}241 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
150extern int x86_acpi_numa_init(void);150extern int x86_acpi_numa_init(void);
151#endif /* CONFIG_ACPI_NUMA */151#endif /* CONFIG_ACPI_NUMA */
152 152
153#define acpi_unlazy_tlb(x) leave_mm(x)
154
153#ifdef CONFIG_ACPI_APEI155#ifdef CONFIG_ACPI_APEI
154static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)156static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
155{157{
arch/x86/kernel/cpu/mcheck/dev-mcelog.c+27−94
@@ -24,14 +24,6 @@ static DEFINE_MUTEX(mce_chrdev_read_mutex); · 23 unmodified lines
24static char mce_helper[128];24static char mce_helper[128];
25static char *mce_helper_argv[2] = { mce_helper, NULL };25static char *mce_helper_argv[2] = { mce_helper, NULL };
26 26
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
35/*27/*
36 * Lockless MCE logging infrastructure.28 * Lockless MCE logging infrastructure.
37 * This avoids deadlocks on printk locks without having to break locks. Also29 * 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
53 void *data)45 void *data)
54{46{
55 struct mce *mce = (struct mce *)data;47 struct mce *mce = (struct mce *)data;
56 unsigned int next, entry;48 unsigned int entry;
57 49
58 wmb();50 mutex_lock(&mce_chrdev_read_mutex);
59 for (;;) {51
60 entry = mce_log_get_idx_check(mcelog.next);52 entry = mcelog.next;
61 for (;;) {53
62 54 /*
63 /*55 * When the buffer fills up discard new entries. Assume that the
64 * When the buffer fills up discard new entries.56 * earlier errors are the more interesting ones:
65 * Assume that the earlier errors are the more57 */
66 * interesting ones:58 if (entry >= MCE_LOG_LEN) {
67 */59 set_bit(MCE_OVERFLOW, (unsigned long *)&mcelog.flags);
68 if (entry >= MCE_LOG_LEN) {60 goto unlock;
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;
84 }61 }
62
63 mcelog.next = entry + 1;
64
85 memcpy(mcelog.entry + entry, mce, sizeof(struct mce));65 memcpy(mcelog.entry + entry, mce, sizeof(struct mce));
86 wmb();
87 mcelog.entry[entry].finished = 1;66 mcelog.entry[entry].finished = 1;
88 wmb();
89 67
90 /* wake processes polling /dev/mcelog */68 /* wake processes polling /dev/mcelog */
91 wake_up_interruptible(&mce_chrdev_wait);69 wake_up_interruptible(&mce_chrdev_wait);
92 70
71unlock:
72 mutex_unlock(&mce_chrdev_read_mutex);
73
93 return NOTIFY_OK;74 return NOTIFY_OK;
94}75}
95 76
@@ -177,13 +158,6 @@ static int mce_chrdev_release(struct inode *inode, struct file *file) · 81 unmodified lines
177 return 0;158 return 0;
178}159}
179 160
180static void collect_tscs(void *data)
181{
182 unsigned long *cpu_tsc = (unsigned long *)data;
183
184 cpu_tsc[smp_processor_id()] = rdtsc();
185}
186
187static int mce_apei_read_done;161static int mce_apei_read_done;
188 162
189/* Collect MCE record of previous boot in persistent storage via APEI ERST. */163/* 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
231 size_t usize, loff_t *off)205 size_t usize, loff_t *off)
232{206{
233 char __user *buf = ubuf;207 char __user *buf = ubuf;
234 unsigned long *cpu_tsc;208 unsigned next;
235 unsigned prev, next;
236 int i, err;209 int i, err;
237 210
238 cpu_tsc = kmalloc(nr_cpu_ids * sizeof(long), GFP_KERNEL);
239 if (!cpu_tsc)
240 return -ENOMEM;
241
242 mutex_lock(&mce_chrdev_read_mutex);211 mutex_lock(&mce_chrdev_read_mutex);
243 212
244 if (!mce_apei_read_done) {213 if (!mce_apei_read_done) {
@@ -247,65 +216,29 @@ static ssize_t mce_chrdev_read(struct file *filp, char __user *ubuf, · 2 unmodified lines
247 goto out;216 goto out;
248 }217 }
249 218
250 next = mce_log_get_idx_check(mcelog.next);
251
252 /* Only supports full reads right now */219 /* Only supports full reads right now */
253 err = -EINVAL;220 err = -EINVAL;
254 if (*off != 0 || usize < MCE_LOG_LEN*sizeof(struct mce))221 if (*off != 0 || usize < MCE_LOG_LEN*sizeof(struct mce))
255 goto out;222 goto out;
256 223
224 next = mcelog.next;
257 err = 0;225 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);
274timeout:
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();
285 226
286 /*227 for (i = 0; i < next; i++) {
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++) {
293 struct mce *m = &mcelog.entry[i];228 struct mce *m = &mcelog.entry[i];
294 229
295 if (m->finished && m->tsc < cpu_tsc[m->cpu]) {230 err |= copy_to_user(buf, m, sizeof(*m));
296 err |= copy_to_user(buf, m, sizeof(*m));231 buf += sizeof(*m);
297 smp_rmb();
298 buf += sizeof(*m);
299 memset(m, 0, sizeof(*m));
300 }
301 }232 }
302 233
234 memset(mcelog.entry, 0, next * sizeof(struct mce));
235 mcelog.next = 0;
236
303 if (err)237 if (err)
304 err = -EFAULT;238 err = -EFAULT;
305 239
306out:240out:
307 mutex_unlock(&mce_chrdev_read_mutex);241 mutex_unlock(&mce_chrdev_read_mutex);
308 kfree(cpu_tsc);
309 242
310 return err ? err : buf - ubuf;243 return err ? err : buf - ubuf;
311}244}
arch/x86/kernel/kvmclock.c+1−1
@@ -79,7 +79,7 @@ static void kvm_get_wallclock(struct timespec *now) · 78 unmodified lines
79 79
80static int kvm_set_wallclock(const struct timespec *now)80static int kvm_set_wallclock(const struct timespec *now)
81{81{
82 return -1;82 return -ENODEV;
83}83}
84 84
85static u64 kvm_clock_read(void)85static 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
172 case R_X86_64_NONE:172 case R_X86_64_NONE:
173 break;173 break;
174 case R_X86_64_64:174 case R_X86_64_64:
175 if (*(u64 *)loc != 0)
176 goto invalid_relocation;
175 *(u64 *)loc = val;177 *(u64 *)loc = val;
176 break;178 break;
177 case R_X86_64_32:179 case R_X86_64_32:
180 if (*(u32 *)loc != 0)
181 goto invalid_relocation;
178 *(u32 *)loc = val;182 *(u32 *)loc = val;
179 if (val != *(u32 *)loc)183 if (val != *(u32 *)loc)
180 goto overflow;184 goto overflow;
181 break;185 break;
182 case R_X86_64_32S:186 case R_X86_64_32S:
187 if (*(s32 *)loc != 0)
188 goto invalid_relocation;
183 *(s32 *)loc = val;189 *(s32 *)loc = val;
184 if ((s64)val != *(s32 *)loc)190 if ((s64)val != *(s32 *)loc)
185 goto overflow;191 goto overflow;
186 break;192 break;
187 case R_X86_64_PC32:193 case R_X86_64_PC32:
194 if (*(u32 *)loc != 0)
195 goto invalid_relocation;
188 val -= (u64)loc;196 val -= (u64)loc;
189 *(u32 *)loc = val;197 *(u32 *)loc = val;
190#if 0198#if 0
@@ -200,6 +208,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, · 9 unmodified lines
200 }208 }
201 return 0;209 return 0;
202 210
211invalid_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
203overflow:216overflow:
204 pr_err("overflow in relocation type %d val %Lx\n",217 pr_err("overflow in relocation type %d val %Lx\n",
205 (int)ELF64_R_TYPE(rel[i].r_info), val);218 (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
1992 vcpu->arch.apic_base | MSR_IA32_APICBASE_BSP);1992 vcpu->arch.apic_base | MSR_IA32_APICBASE_BSP);
1993 vcpu->arch.pv_eoi.msr_val = 0;1993 vcpu->arch.pv_eoi.msr_val = 0;
1994 apic_update_ppr(apic);1994 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 }
1995 2000
1996 vcpu->arch.apic_arb_prio = 0;2001 vcpu->arch.apic_arb_prio = 0;
1997 vcpu->arch.apic_attention = 0;2002 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
5619 5619
5620 kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu);5620 kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu);
5621 5621
5622 if (kvm_vcpu_apicv_active(vcpu))
5623 memset(&vmx->pi_desc, 0, sizeof(struct pi_desc));
5624
5625 if (vmx->vpid != 0)5622 if (vmx->vpid != 0)
5626 vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);5623 vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
5627 5624
arch/x86/mm/mem_encrypt.c+1−1
@@ -40,7 +40,7 @@ static char sme_cmdline_off[] __initdata = "off"; · 39 unmodified lines
40 * section is later cleared.40 * section is later cleared.
41 */41 */
42u64 sme_me_mask __section(.data) = 0;42u64 sme_me_mask __section(.data) = 0;
43EXPORT_SYMBOL_GPL(sme_me_mask);43EXPORT_SYMBOL(sme_me_mask);
44 44
45/* Buffer used for early in-place encryption by BSP, no locking needed */45/* Buffer used for early in-place encryption by BSP, no locking needed */
46static char sme_early_buffer[PAGE_SIZE] __aligned(PAGE_SIZE);46static 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
85 85
86 switch_mm(NULL, &init_mm, NULL);86 switch_mm(NULL, &init_mm, NULL);
87}87}
88EXPORT_SYMBOL_GPL(leave_mm);
88 89
89void switch_mm(struct mm_struct *prev, struct mm_struct *next,90void switch_mm(struct mm_struct *prev, struct mm_struct *next,
90 struct task_struct *tsk)91 struct task_struct *tsk)
@@ -195,12 +196,22 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next, · 104 unmodified lines
195 this_cpu_write(cpu_tlbstate.ctxs[new_asid].ctx_id, next->context.ctx_id);196 this_cpu_write(cpu_tlbstate.ctxs[new_asid].ctx_id, next->context.ctx_id);
196 this_cpu_write(cpu_tlbstate.ctxs[new_asid].tlb_gen, next_tlb_gen);197 this_cpu_write(cpu_tlbstate.ctxs[new_asid].tlb_gen, next_tlb_gen);
197 write_cr3(build_cr3(next, new_asid));198 write_cr3(build_cr3(next, new_asid));
198 trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH,199
199 TLB_FLUSH_ALL);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);
200 } else {209 } else {
201 /* The new ASID is already up to date. */210 /* The new ASID is already up to date. */
202 write_cr3(build_cr3_noflush(next, new_asid));211 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);
204 }215 }
205 216
206 this_cpu_write(cpu_tlbstate.loaded_mm, next);217 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
363 unsigned int cryptlen = req->cryptlen;363 unsigned int cryptlen = req->cryptlen;
364 u8 *authtag = pctx->auth_tag;364 u8 *authtag = pctx->auth_tag;
365 u8 *odata = pctx->odata;365 u8 *odata = pctx->odata;
366 u8 *iv = req->iv;366 u8 *iv = pctx->idata;
367 int err;367 int err;
368 368
369 cryptlen -= authsize;369 cryptlen -= authsize;
@@ -379,6 +379,8 @@ static int crypto_ccm_decrypt(struct aead_request *req) · 9 unmodified lines
379 if (req->src != req->dst)379 if (req->src != req->dst)
380 dst = pctx->dst;380 dst = pctx->dst;
381 381
382 memcpy(iv, req->iv, 16);
383
382 skcipher_request_set_tfm(skreq, ctx->ctr);384 skcipher_request_set_tfm(skreq, ctx->ctr);
383 skcipher_request_set_callback(skreq, pctx->flags,385 skcipher_request_set_callback(skreq, pctx->flags,
384 crypto_ccm_decrypt_done, req);386 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
710static void acpi_idle_enter_bm(struct acpi_processor *pr,710static void acpi_idle_enter_bm(struct acpi_processor *pr,
711 struct acpi_processor_cx *cx, bool timer_bc)711 struct acpi_processor_cx *cx, bool timer_bc)
712{712{
713 acpi_unlazy_tlb(smp_processor_id());
714
713 /*715 /*
714 * Must be done before busmaster disable as we might need to716 * Must be done before busmaster disable as we might need to
715 * access HPET !717 * 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
160 return 0;160 return 0;
161}161}
162 162
163static bool acpi_sleep_no_lps0;
164
165static int __init init_no_lps0(const struct dmi_system_id *d)
166{
167 acpi_sleep_no_lps0 = true;
168 return 0;
169}
170
163static const struct dmi_system_id acpisleep_dmi_table[] __initconst = {171static const struct dmi_system_id acpisleep_dmi_table[] __initconst = {
164 {172 {
165 .callback = init_old_suspend_ordering,173 .callback = init_old_suspend_ordering,
@@ -343,6 +351,19 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { · 177 unmodified lines
343 DMI_MATCH(DMI_PRODUCT_NAME, "80E3"),351 DMI_MATCH(DMI_PRODUCT_NAME, "80E3"),
344 },352 },
345 },353 },
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 },
346 {},367 {},
347};368};
348 369
@@ -485,6 +506,7 @@ static void acpi_pm_end(void) · 136 unmodified lines
485}506}
486#else /* !CONFIG_ACPI_SLEEP */507#else /* !CONFIG_ACPI_SLEEP */
487#define acpi_target_sleep_state ACPI_STATE_S0508#define acpi_target_sleep_state ACPI_STATE_S0
509#define acpi_sleep_no_lps0 (false)
488static inline void acpi_sleep_dmi_check(void) {}510static inline void acpi_sleep_dmi_check(void) {}
489#endif /* CONFIG_ACPI_SLEEP */511#endif /* CONFIG_ACPI_SLEEP */
490 512
@@ -863,6 +885,12 @@ static int lps0_device_attach(struct acpi_device *adev, · 372 unmodified lines
863 if (lps0_device_handle)885 if (lps0_device_handle)
864 return 0;886 return 0;
865 887
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
866 if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))894 if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
867 return 0;895 return 0;
868 896
drivers/firmware/efi/libstub/Makefile+3−3
@@ -34,13 +34,14 @@ lib-y := efi-stub-helper.o gop.o secureboot.o · 33 unmodified lines
34lib-$(CONFIG_RESET_ATTACK_MITIGATION) += tpm.o34lib-$(CONFIG_RESET_ATTACK_MITIGATION) += tpm.o
35 35
36# include the stub's generic dependencies from lib/ when building for ARM/arm6436# include the stub's generic dependencies from lib/ when building for ARM/arm64
37arm-deps := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c fdt_sw.c sort.c37arm-deps-y := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c fdt_sw.c
38arm-deps-$(CONFIG_ARM64) += sort.c
38 39
39$(obj)/lib-%.o: $(srctree)/lib/%.c FORCE40$(obj)/lib-%.o: $(srctree)/lib/%.c FORCE
40 $(call if_changed_rule,cc_o_c)41 $(call if_changed_rule,cc_o_c)
41 42
42lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o string.o random.o \43lib-$(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))
44 45
45lib-$(CONFIG_ARM) += arm32-stub.o46lib-$(CONFIG_ARM) += arm32-stub.o
46lib-$(CONFIG_ARM64) += arm64-stub.o47lib-$(CONFIG_ARM64) += arm64-stub.o
@@ -91,5 +92,4 @@ quiet_cmd_stubcopy = STUBCPY $@ · 44 unmodified lines
91# explicitly by the decompressor linker script.92# explicitly by the decompressor linker script.
92#93#
93STUBCOPY_FLAGS-$(CONFIG_ARM) += --rename-section .data=.data.efistub94STUBCOPY_FLAGS-$(CONFIG_ARM) += --rename-section .data=.data.efistub
94STUBCOPY_RM-$(CONFIG_ARM) += -R ___ksymtab+sort -R ___kcrctab+sort
95STUBCOPY_RELOC-$(CONFIG_ARM) := R_ARM_ABS95STUBCOPY_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
350 * The easiest way to find adjacent regions is to sort the memory map350 * The easiest way to find adjacent regions is to sort the memory map
351 * before traversing it.351 * before traversing it.
352 */352 */
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);
354 356
355 for (l = 0; l < map_size; l += desc_size, prev = in) {357 for (l = 0; l < map_size; l += desc_size, prev = in) {
356 u64 paddr, size;358 u64 paddr, size;
@@ -367,7 +369,8 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size, · 10 unmodified lines
367 * a 4k page size kernel to kexec a 64k page size kernel and369 * a 4k page size kernel to kexec a 64k page size kernel and
368 * vice versa.370 * vice versa.
369 */371 */
370 if (!regions_are_adjacent(prev, in) ||372 if ((IS_ENABLED(CONFIG_ARM64) &&
373 !regions_are_adjacent(prev, in)) ||
371 !regions_have_compatible_memory_type_attrs(prev, in)) {374 !regions_have_compatible_memory_type_attrs(prev, in)) {
372 375
373 paddr = round_down(in->phys_addr, SZ_64K);376 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
867int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense)867int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense)
868{868{
869 struct cdrom_info *info = drive->driver_data;869 struct cdrom_info *info = drive->driver_data;
870 struct cdrom_device_info *cdi = &info->devinfo;870 struct cdrom_device_info *cdi;
871 unsigned char cmd[BLK_MAX_CDB];871 unsigned char cmd[BLK_MAX_CDB];
872 872
873 ide_debug_log(IDE_DBG_FUNC, "enter");873 ide_debug_log(IDE_DBG_FUNC, "enter");
874 874
875 if (!info)
876 return -EIO;
877
878 cdi = &info->devinfo;
879
875 memset(cmd, 0, BLK_MAX_CDB);880 memset(cmd, 0, BLK_MAX_CDB);
876 cmd[0] = GPCMD_TEST_UNIT_READY;881 cmd[0] = GPCMD_TEST_UNIT_READY;
877 882
drivers/idle/intel_idle.c+5−4
@@ -913,15 +913,16 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev, · 912 unmodified lines
913 struct cpuidle_state *state = &drv->states[index];913 struct cpuidle_state *state = &drv->states[index];
914 unsigned long eax = flg2MWAIT(state->flags);914 unsigned long eax = flg2MWAIT(state->flags);
915 unsigned int cstate;915 unsigned int cstate;
916 int cpu = smp_processor_id();
916 917
917 cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;918 cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
918 919
919 /*920 /*
920 * NB: if CPUIDLE_FLAG_TLB_FLUSHED is set, this idle transition921 * leave_mm() to avoid costly and often unnecessary wakeups
921 * will probably flush the TLB. It's not guaranteed to flush922 * for flushing the user TLB's associated with the active mm.
922 * the TLB, though, so it's not clear that we can do anything
923 * useful with this knowledge.
924 */923 */
924 if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED)
925 leave_mm(cpu);
925 926
926 if (!(lapic_timer_reliable_states & (1 << (cstate))))927 if (!(lapic_timer_reliable_states & (1 << (cstate))))
927 tick_broadcast_enter();928 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
255 255
256 case KE_VSW:256 case KE_VSW:
257 input_report_switch(dev, ke->sw.code, value);257 input_report_switch(dev, ke->sw.code, value);
258 input_sync(dev);
258 break;259 break;
259 }260 }
260}261}
drivers/input/touchscreen/ar1021_i2c.c+1−0
@@ -117,6 +117,7 @@ static int ar1021_i2c_probe(struct i2c_client *client, · 116 unmodified lines
117 input->open = ar1021_i2c_open;117 input->open = ar1021_i2c_open;
118 input->close = ar1021_i2c_close;118 input->close = ar1021_i2c_close;
119 119
120 __set_bit(INPUT_PROP_DIRECT, input->propbit);
120 input_set_capability(input, EV_KEY, BTN_TOUCH);121 input_set_capability(input, EV_KEY, BTN_TOUCH);
121 input_set_abs_params(input, ABS_X, 0, AR1021_MAX_X, 0, 0);122 input_set_abs_params(input, ABS_X, 0, AR1021_MAX_X, 0, 0);
122 input_set_abs_params(input, ABS_Y, 0, AR1021_MAX_Y, 0, 0);123 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
194 return -ENOMEM;194 return -ENOMEM;
195 195
196 gicp->dev = &pdev->dev;196 gicp->dev = &pdev->dev;
197 spin_lock_init(&gicp->spi_lock);
197 198
198 gicp->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);199 gicp->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
199 if (!gicp->res)200 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
2046 2046
2047 bond_for_each_slave_rcu(bond, slave, iter) {2047 bond_for_each_slave_rcu(bond, slave, iter) {
2048 slave->new_link = BOND_LINK_NOCHANGE;2048 slave->new_link = BOND_LINK_NOCHANGE;
2049 slave->link_new_state = slave->link;
2049 2050
2050 link_state = bond_check_dev_link(bond, slave->dev, 0);2051 link_state = bond_check_dev_link(bond, slave->dev, 0);
2051 2052
@@ -3267,7 +3268,7 @@ u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb) · 1215 unmodified lines
3267 hash ^= (hash >> 16);3268 hash ^= (hash >> 16);
3268 hash ^= (hash >> 8);3269 hash ^= (hash >> 8);
3269 3270
3270 return hash;3271 return hash >> 1;
3271}3272}
3272 3273
3273/*-------------------------- Device entry points ----------------------------*/3274/*-------------------------- Device entry points ----------------------------*/
drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h+3−3
@@ -37,7 +37,7 @@ · 36 unmodified lines
37 37
38#define T4FW_VERSION_MAJOR 0x0138#define T4FW_VERSION_MAJOR 0x01
39#define T4FW_VERSION_MINOR 0x1039#define T4FW_VERSION_MINOR 0x10
40#define T4FW_VERSION_MICRO 0x2D40#define T4FW_VERSION_MICRO 0x3F
41#define T4FW_VERSION_BUILD 0x0041#define T4FW_VERSION_BUILD 0x00
42 42
43#define T4FW_MIN_VERSION_MAJOR 0x0143#define T4FW_MIN_VERSION_MAJOR 0x01
@@ -46,7 +46,7 @@ · 2 unmodified lines
46 46
47#define T5FW_VERSION_MAJOR 0x0147#define T5FW_VERSION_MAJOR 0x01
48#define T5FW_VERSION_MINOR 0x1048#define T5FW_VERSION_MINOR 0x10
49#define T5FW_VERSION_MICRO 0x2D49#define T5FW_VERSION_MICRO 0x3F
50#define T5FW_VERSION_BUILD 0x0050#define T5FW_VERSION_BUILD 0x00
51 51
52#define T5FW_MIN_VERSION_MAJOR 0x0052#define T5FW_MIN_VERSION_MAJOR 0x00
@@ -55,7 +55,7 @@ · 2 unmodified lines
55 55
56#define T6FW_VERSION_MAJOR 0x0156#define T6FW_VERSION_MAJOR 0x01
57#define T6FW_VERSION_MINOR 0x1057#define T6FW_VERSION_MINOR 0x10
58#define T6FW_VERSION_MICRO 0x2D58#define T6FW_VERSION_MICRO 0x3F
59#define T6FW_VERSION_BUILD 0x0059#define T6FW_VERSION_BUILD 0x00
60 60
61#define T6FW_MIN_VERSION_MAJOR 0x0061#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
6941 for (i = 0; i < port->nqvecs; i++) {6941 for (i = 0; i < port->nqvecs; i++) {
6942 struct mvpp2_queue_vector *qv = port->qvecs + i;6942 struct mvpp2_queue_vector *qv = port->qvecs + i;
6943 6943
6944 if (qv->type == MVPP2_QUEUE_VECTOR_PRIVATE)
6945 irq_set_status_flags(qv->irq, IRQ_NO_BALANCING);
6946
6944 err = request_irq(qv->irq, mvpp2_isr, 0, port->dev->name, qv);6947 err = request_irq(qv->irq, mvpp2_isr, 0, port->dev->name, qv);
6945 if (err)6948 if (err)
6946 goto err;6949 goto err;
@@ -6970,6 +6973,7 @@ static void mvpp2_irqs_deinit(struct mvpp2_port *port) · 23 unmodified lines
6970 struct mvpp2_queue_vector *qv = port->qvecs + i;6973 struct mvpp2_queue_vector *qv = port->qvecs + i;
6971 6974
6972 irq_set_affinity_hint(qv->irq, NULL);6975 irq_set_affinity_hint(qv->irq, NULL);
6976 irq_clear_status_flags(qv->irq, IRQ_NO_BALANCING);
6973 free_irq(qv->irq, qv);6977 free_irq(qv->irq, qv);
6974 }6978 }
6975}6979}
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
365 struct mlx5e_l2_hash_node *hn)365 struct mlx5e_l2_hash_node *hn)
366{366{
367 u8 action = hn->action;367 u8 action = hn->action;
368 u8 mac_addr[ETH_ALEN];
368 int l2_err = 0;369 int l2_err = 0;
369 370
371 ether_addr_copy(mac_addr, hn->ai.addr);
372
370 switch (action) {373 switch (action) {
371 case MLX5E_ACTION_ADD:374 case MLX5E_ACTION_ADD:
372 mlx5e_add_l2_flow_rule(priv, &hn->ai, MLX5E_FULLMATCH);375 mlx5e_add_l2_flow_rule(priv, &hn->ai, MLX5E_FULLMATCH);
373 if (!is_multicast_ether_addr(hn->ai.addr)) {376 if (!is_multicast_ether_addr(mac_addr)) {
374 l2_err = mlx5_mpfs_add_mac(priv->mdev, hn->ai.addr);377 l2_err = mlx5_mpfs_add_mac(priv->mdev, mac_addr);
375 hn->mpfs = !l2_err;378 hn->mpfs = !l2_err;
376 }379 }
377 hn->action = MLX5E_ACTION_NONE;380 hn->action = MLX5E_ACTION_NONE;
378 break;381 break;
379 382
380 case MLX5E_ACTION_DEL:383 case MLX5E_ACTION_DEL:
381 if (!is_multicast_ether_addr(hn->ai.addr) && hn->mpfs)384 if (!is_multicast_ether_addr(mac_addr) && hn->mpfs)
382 l2_err = mlx5_mpfs_del_mac(priv->mdev, hn->ai.addr);385 l2_err = mlx5_mpfs_del_mac(priv->mdev, mac_addr);
383 mlx5e_del_l2_flow_rule(priv, &hn->ai);386 mlx5e_del_l2_flow_rule(priv, &hn->ai);
384 mlx5e_del_l2_from_hash(hn);387 mlx5e_del_l2_from_hash(hn);
385 break;388 break;
@@ -387,7 +390,7 @@ static void mlx5e_execute_l2_action(struct mlx5e_priv *priv, · 1 unmodified line
387 390
388 if (l2_err)391 if (l2_err)
389 netdev_warn(priv->netdev, "MPFS, failed to %s mac %pM, err(%d)\n",392 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);
391}394}
392 395
393static void mlx5e_sync_netdev_addr(struct mlx5e_priv *priv)396static 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
626 struct usbnet *dev = usb_get_intfdata(intf);626 struct usbnet *dev = usb_get_intfdata(intf);
627 struct asix_common_private *priv = dev->driver_priv;627 struct asix_common_private *priv = dev->driver_priv;
628 628
629 if (priv->suspend)629 if (priv && priv->suspend)
630 priv->suspend(dev);630 priv->suspend(dev);
631 631
632 return usbnet_suspend(intf, message);632 return usbnet_suspend(intf, message);
@@ -678,7 +678,7 @@ static int asix_resume(struct usb_interface *intf) · 45 unmodified lines
678 struct usbnet *dev = usb_get_intfdata(intf);678 struct usbnet *dev = usb_get_intfdata(intf);
679 struct asix_common_private *priv = dev->driver_priv;679 struct asix_common_private *priv = dev->driver_priv;
680 680
681 if (priv->resume)681 if (priv && priv->resume)
682 priv->resume(dev);682 priv->resume(dev);
683 683
684 return usbnet_resume(intf);684 return usbnet_resume(intf);
drivers/net/usb/cdc_ether.c+1−1
@@ -230,7 +230,7 @@ skip: · 229 unmodified lines
230 goto bad_desc;230 goto bad_desc;
231 }231 }
232 232
233 if (header.usb_cdc_ether_desc) {233 if (header.usb_cdc_ether_desc && info->ether->wMaxSegmentSize) {
234 dev->hard_mtu = le16_to_cpu(info->ether->wMaxSegmentSize);234 dev->hard_mtu = le16_to_cpu(info->ether->wMaxSegmentSize);
235 /* because of Zaurus, we may be ignoring the host235 /* because of Zaurus, we may be ignoring the host
236 * side link address we were given.236 * 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
499 return 1;499 return 1;
500 }500 }
501 if (rawip) {501 if (rawip) {
502 skb_reset_mac_header(skb);
502 skb->dev = dev->net; /* normally set by eth_type_trans */503 skb->dev = dev->net; /* normally set by eth_type_trans */
503 skb->protocol = proto;504 skb->protocol = proto;
504 return 1;505 return 1;
@@ -681,7 +682,7 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) · 176 unmodified lines
681 }682 }
682 683
683 /* errors aren't fatal - we can live with the dynamic address */684 /* errors aren't fatal - we can live with the dynamic address */
684 if (cdc_ether) {685 if (cdc_ether && cdc_ether->wMaxSegmentSize) {
685 dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize);686 dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize);
686 usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress);687 usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress);
687 }688 }
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
2685 2685
2686 }2686 }
2687 sdev->sdev_state = state;2687 sdev->sdev_state = state;
2688 sysfs_notify(&sdev->sdev_gendev.kobj, NULL, "state");
2689 return 0;2688 return 0;
2690 2689
2691 illegal:2690 illegal:
@@ -3109,7 +3108,6 @@ int scsi_internal_device_unblock_nowait(struct scsi_device *sdev, · 417 unmodified lines
3109 case SDEV_BLOCK:3108 case SDEV_BLOCK:
3110 case SDEV_TRANSPORT_OFFLINE:3109 case SDEV_TRANSPORT_OFFLINE:
3111 sdev->sdev_state = new_state;3110 sdev->sdev_state = new_state;
3112 sysfs_notify(&sdev->sdev_gendev.kobj, NULL, "state");
3113 break;3111 break;
3114 case SDEV_CREATED_BLOCK:3112 case SDEV_CREATED_BLOCK:
3115 if (new_state == SDEV_TRANSPORT_OFFLINE ||3113 if (new_state == SDEV_TRANSPORT_OFFLINE ||
@@ -3117,7 +3115,6 @@ int scsi_internal_device_unblock_nowait(struct scsi_device *sdev, · 1 unmodified line
3117 sdev->sdev_state = new_state;3115 sdev->sdev_state = new_state;
3118 else3116 else
3119 sdev->sdev_state = SDEV_CREATED;3117 sdev->sdev_state = SDEV_CREATED;
3120 sysfs_notify(&sdev->sdev_gendev.kobj, NULL, "state");
3121 break;3118 break;
3122 case SDEV_CANCEL:3119 case SDEV_CANCEL:
3123 case SDEV_OFFLINE:3120 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
556 */556 */
557 shost_for_each_device(sdev, shost) {557 shost_for_each_device(sdev, shost) {
558 mutex_lock(&sdev->state_mutex);558 mutex_lock(&sdev->state_mutex);
559 if (sdev->sdev_state == SDEV_OFFLINE) {559 if (sdev->sdev_state == SDEV_OFFLINE)
560 sdev->sdev_state = SDEV_RUNNING;560 sdev->sdev_state = SDEV_RUNNING;
561 sysfs_notify(&sdev->sdev_gendev.kobj,
562 NULL, "state");
563 }
564 mutex_unlock(&sdev->state_mutex);561 mutex_unlock(&sdev->state_mutex);
565 }562 }
566 } else if (rport->state == SRP_RPORT_RUNNING) {563 } 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
191 asm("%c0:\n\t" \191 asm("%c0:\n\t" \
192 ".pushsection .discard.reachable\n\t" \192 ".pushsection .discard.reachable\n\t" \
193 ".long %c0b - .\n\t" \193 ".long %c0b - .\n\t" \
194 ".popsection\n\t" : : "i" (__LINE__)); \194 ".popsection\n\t" : : "i" (__COUNTER__)); \
195})195})
196#define annotate_unreachable() ({ \196#define annotate_unreachable() ({ \
197 asm("%c0:\n\t" \197 asm("%c0:\n\t" \
198 ".pushsection .discard.unreachable\n\t" \198 ".pushsection .discard.unreachable\n\t" \
199 ".long %c0b - .\n\t" \199 ".long %c0b - .\n\t" \
200 ".popsection\n\t" : : "i" (__LINE__)); \200 ".popsection\n\t" : : "i" (__COUNTER__)); \
201})201})
202#define ASM_UNREACHABLE \202#define ASM_UNREACHABLE \
203 "999:\n\t" \203 "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
3841#endif3841#endif
3842}3842}
3843 3843
3844static 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
3844/* Note: This doesn't put any conntrack and bridge info in dst. */3851/* Note: This doesn't put any conntrack and bridge info in dst. */
3845static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src,3852static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src,
3846 bool copy)3853 bool copy)
include/net/act_api.h+1−3
@@ -14,7 +14,6 @@ · 13 unmodified lines
14struct tcf_idrinfo {14struct tcf_idrinfo {
15 spinlock_t lock;15 spinlock_t lock;
16 struct idr action_idr;16 struct idr action_idr;
17 struct net *net;
18};17};
19 18
20struct tc_action_ops;19struct tc_action_ops;
@@ -105,7 +104,7 @@ struct tc_action_net { · 84 unmodified lines
105 104
106static inline105static inline
107int tc_action_net_init(struct tc_action_net *tn,106int 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)
109{108{
110 int err = 0;109 int err = 0;
111 110
@@ -113,7 +112,6 @@ int tc_action_net_init(struct tc_action_net *tn, · 1 unmodified line
113 if (!tn->idrinfo)112 if (!tn->idrinfo)
114 return -ENOMEM;113 return -ENOMEM;
115 tn->ops = ops;114 tn->ops = ops;
116 tn->idrinfo->net = net;
117 spin_lock_init(&tn->idrinfo->lock);115 spin_lock_init(&tn->idrinfo->lock);
118 idr_init(&tn->idrinfo->action_idr);116 idr_init(&tn->idrinfo->action_idr);
119 return err;117 return err;
include/net/pkt_cls.h+24−0
@@ -231,6 +231,7 @@ struct tcf_exts { · 230 unmodified lines
231 __u32 type; /* for backward compat(TCA_OLD_COMPAT) */231 __u32 type; /* for backward compat(TCA_OLD_COMPAT) */
232 int nr_actions;232 int nr_actions;
233 struct tc_action **actions;233 struct tc_action **actions;
234 struct net *net;
234#endif235#endif
235 /* Map to export classifier specific extension TLV types to the236 /* Map to export classifier specific extension TLV types to the
236 * generic extensions API. Unsupported extensions must be set to 0.237 * 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
244#ifdef CONFIG_NET_CLS_ACT245#ifdef CONFIG_NET_CLS_ACT
245 exts->type = 0;246 exts->type = 0;
246 exts->nr_actions = 0;247 exts->nr_actions = 0;
248 exts->net = NULL;
247 exts->actions = kcalloc(TCA_ACT_MAX_PRIO, sizeof(struct tc_action *),249 exts->actions = kcalloc(TCA_ACT_MAX_PRIO, sizeof(struct tc_action *),
248 GFP_KERNEL);250 GFP_KERNEL);
249 if (!exts->actions)251 if (!exts->actions)
@@ -254,6 +256,28 @@ static inline int tcf_exts_init(struct tcf_exts *exts, int action, int police) · 4 unmodified lines
254 return 0;256 return 0;
255}257}
256 258
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 */
263static 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
273static 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
257static inline void tcf_exts_to_list(const struct tcf_exts *exts,281static inline void tcf_exts_to_list(const struct tcf_exts *exts,
258 struct list_head *actions)282 struct list_head *actions)
259{283{
include/sound/seq_kernel.h+2−1
@@ -49,7 +49,8 @@ typedef union snd_seq_timestamp snd_seq_timestamp_t; · 48 unmodified lines
49#define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 20049#define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 200
50 50
51/* max delivery path length */51/* max delivery path length */
52#define SNDRV_SEQ_MAX_HOPS 1052/* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */
53#define SNDRV_SEQ_MAX_HOPS 8
53 54
54/* max size of event size */55/* max size of event size */
55#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff56#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
include/sound/timer.h+2−0
@@ -90,6 +90,8 @@ struct snd_timer { · 89 unmodified lines
90 struct list_head ack_list_head;90 struct list_head ack_list_head;
91 struct list_head sack_list_head; /* slow ack list head */91 struct list_head sack_list_head; /* slow ack list head */
92 struct tasklet_struct task_queue;92 struct tasklet_struct task_queue;
93 int max_instances; /* upper limit of timer instances */
94 int num_instances; /* current number of timer instances */
93};95};
94 96
95struct snd_timer_instance {97struct snd_timer_instance {
include/uapi/sound/asound.h+3−3
@@ -94,7 +94,7 @@ enum { · 93 unmodified lines
94 SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */94 SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */
95 SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */95 SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */
96 SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */96 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 */
98 SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */98 SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */
99 SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */99 SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */
100 SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */100 SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */
@@ -384,7 +384,7 @@ struct snd_mask { · 283 unmodified lines
384 384
385struct snd_pcm_hw_params {385struct snd_pcm_hw_params {
386 unsigned int flags;386 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 -
388 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];388 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
389 struct snd_mask mres[5]; /* reserved masks */389 struct snd_mask mres[5]; /* reserved masks */
390 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -390 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
857#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */857#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */
858#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */858#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */
859#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */859#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 */
861#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */861#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */
862/* bits 30 and 31 are obsoleted (for indirect access) */862/* bits 30 and 31 are obsoleted (for indirect access) */
863 863
kernel/events/core.c+4−2
@@ -901,9 +901,11 @@ list_update_cgroup_event(struct perf_event *event, · 900 unmodified lines
901 cpuctx_entry = &cpuctx->cgrp_cpuctx_entry;901 cpuctx_entry = &cpuctx->cgrp_cpuctx_entry;
902 /* cpuctx->cgrp is NULL unless a cgroup event is active in this CPU .*/902 /* cpuctx->cgrp is NULL unless a cgroup event is active in this CPU .*/
903 if (add) {903 if (add) {
904 struct perf_cgroup *cgrp = perf_cgroup_from_task(current, ctx);
905
904 list_add(cpuctx_entry, this_cpu_ptr(&cgrp_cpuctx_list));906 list_add(cpuctx_entry, this_cpu_ptr(&cgrp_cpuctx_list));
905 if (perf_cgroup_from_task(current, ctx) == event->cgrp)907 if (cgroup_is_descendant(cgrp->css.cgroup, event->cgrp->css.cgroup))
906 cpuctx->cgrp = event->cgrp;908 cpuctx->cgrp = cgrp;
907 } else {909 } else {
908 list_del(cpuctx_entry);910 list_del(cpuctx_entry);
909 cpuctx->cgrp = NULL;911 cpuctx->cgrp = NULL;
kernel/futex.c+20−3
@@ -903,11 +903,27 @@ void exit_pi_state_list(struct task_struct *curr) · 902 unmodified lines
903 */903 */
904 raw_spin_lock_irq(&curr->pi_lock);904 raw_spin_lock_irq(&curr->pi_lock);
905 while (!list_empty(head)) {905 while (!list_empty(head)) {
906
907 next = head->next;906 next = head->next;
908 pi_state = list_entry(next, struct futex_pi_state, list);907 pi_state = list_entry(next, struct futex_pi_state, list);
909 key = pi_state->key;908 key = pi_state->key;
910 hb = hash_futex(&key);909 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 }
911 raw_spin_unlock_irq(&curr->pi_lock);927 raw_spin_unlock_irq(&curr->pi_lock);
912 928
913 spin_lock(&hb->lock);929 spin_lock(&hb->lock);
@@ -918,8 +934,10 @@ void exit_pi_state_list(struct task_struct *curr) · 4 unmodified lines
918 * task still owns the PI-state:934 * task still owns the PI-state:
919 */935 */
920 if (head->next != next) {936 if (head->next != next) {
937 /* retain curr->pi_lock for the loop invariant */
921 raw_spin_unlock(&pi_state->pi_mutex.wait_lock);938 raw_spin_unlock(&pi_state->pi_mutex.wait_lock);
922 spin_unlock(&hb->lock);939 spin_unlock(&hb->lock);
940 put_pi_state(pi_state);
923 continue;941 continue;
924 }942 }
925 943
@@ -927,9 +945,8 @@ void exit_pi_state_list(struct task_struct *curr) · 1 unmodified line
927 WARN_ON(list_empty(&pi_state->list));945 WARN_ON(list_empty(&pi_state->list));
928 list_del_init(&pi_state->list);946 list_del_init(&pi_state->list);
929 pi_state->owner = NULL;947 pi_state->owner = NULL;
930 raw_spin_unlock(&curr->pi_lock);
931 948
932 get_pi_state(pi_state);949 raw_spin_unlock(&curr->pi_lock);
933 raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);950 raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
934 spin_unlock(&hb->lock);951 spin_unlock(&hb->lock);
935 952
kernel/sched/cpufreq_schedutil.c+1−5
@@ -649,6 +649,7 @@ static int sugov_start(struct cpufreq_policy *policy) · 648 unmodified lines
649 struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu);649 struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu);
650 650
651 memset(sg_cpu, 0, sizeof(*sg_cpu));651 memset(sg_cpu, 0, sizeof(*sg_cpu));
652 sg_cpu->cpu = cpu;
652 sg_cpu->sg_policy = sg_policy;653 sg_cpu->sg_policy = sg_policy;
653 sg_cpu->flags = SCHED_CPUFREQ_RT;654 sg_cpu->flags = SCHED_CPUFREQ_RT;
654 sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq;655 sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq;
@@ -714,11 +715,6 @@ struct cpufreq_governor *cpufreq_default_governor(void) · 59 unmodified lines
714 715
715static int __init sugov_register(void)716static int __init sugov_register(void)
716{717{
717 int cpu;
718
719 for_each_possible_cpu(cpu)
720 per_cpu(sugov_cpu, cpu).cpu = cpu;
721
722 return cpufreq_register_governor(&schedutil_gov);718 return cpufreq_register_governor(&schedutil_gov);
723}719}
724fs_initcall(sugov_register);720fs_initcall(sugov_register);
kernel/watchdog_hld.c+10−5
@@ -13,6 +13,7 @@ · 12 unmodified lines
13#define pr_fmt(fmt) "NMI watchdog: " fmt13#define pr_fmt(fmt) "NMI watchdog: " fmt
14 14
15#include <linux/nmi.h>15#include <linux/nmi.h>
16#include <linux/atomic.h>
16#include <linux/module.h>17#include <linux/module.h>
17#include <linux/sched/debug.h>18#include <linux/sched/debug.h>
18 19
@@ -22,10 +23,11 @@ · 3 unmodified lines
22static DEFINE_PER_CPU(bool, hard_watchdog_warn);23static DEFINE_PER_CPU(bool, hard_watchdog_warn);
23static DEFINE_PER_CPU(bool, watchdog_nmi_touch);24static DEFINE_PER_CPU(bool, watchdog_nmi_touch);
24static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);25static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
26static DEFINE_PER_CPU(struct perf_event *, dead_event);
25static struct cpumask dead_events_mask;27static struct cpumask dead_events_mask;
26 28
27static unsigned long hardlockup_allcpu_dumped;29static unsigned long hardlockup_allcpu_dumped;
28static unsigned int watchdog_cpus;30static atomic_t watchdog_cpus = ATOMIC_INIT(0);
29 31
30void arch_touch_nmi_watchdog(void)32void arch_touch_nmi_watchdog(void)
31{33{
@@ -189,7 +191,8 @@ void hardlockup_detector_perf_enable(void) · 157 unmodified lines
189 if (hardlockup_detector_event_create())191 if (hardlockup_detector_event_create())
190 return;192 return;
191 193
192 if (!watchdog_cpus++)194 /* use original value for check */
195 if (!atomic_fetch_inc(&watchdog_cpus))
193 pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");196 pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");
194 197
195 perf_event_enable(this_cpu_read(watchdog_ev));198 perf_event_enable(this_cpu_read(watchdog_ev));
@@ -204,8 +207,10 @@ void hardlockup_detector_perf_disable(void) · 8 unmodified lines
204 207
205 if (event) {208 if (event) {
206 perf_event_disable(event);209 perf_event_disable(event);
210 this_cpu_write(watchdog_ev, NULL);
211 this_cpu_write(dead_event, event);
207 cpumask_set_cpu(smp_processor_id(), &dead_events_mask);212 cpumask_set_cpu(smp_processor_id(), &dead_events_mask);
208 watchdog_cpus--;213 atomic_dec(&watchdog_cpus);
209 }214 }
210}215}
211 216
@@ -219,7 +224,7 @@ void hardlockup_detector_perf_cleanup(void) · 7 unmodified lines
219 int cpu;224 int cpu;
220 225
221 for_each_cpu(cpu, &dead_events_mask) {226 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);
223 228
224 /*229 /*
225 * Required because for_each_cpu() reports unconditionally230 * Required because for_each_cpu() reports unconditionally
@@ -227,7 +232,7 @@ void hardlockup_detector_perf_cleanup(void) · 1 unmodified line
227 */232 */
228 if (event)233 if (event)
229 perf_event_release_kernel(event);234 perf_event_release_kernel(event);
230 per_cpu(watchdog_ev, cpu) = NULL;235 per_cpu(dead_event, cpu) = NULL;
231 }236 }
232 cpumask_clear(&dead_events_mask);237 cpumask_clear(&dead_events_mask);
233}238}
kernel/workqueue_internal.h+2−1
@@ -10,6 +10,7 @@ · 9 unmodified lines
10 10
11#include <linux/workqueue.h>11#include <linux/workqueue.h>
12#include <linux/kthread.h>12#include <linux/kthread.h>
13#include <linux/preempt.h>
13 14
14struct worker_pool;15struct worker_pool;
15 16
@@ -60,7 +61,7 @@ struct worker { · 44 unmodified lines
60 */61 */
61static inline struct worker *current_wq_worker(void)62static inline struct worker *current_wq_worker(void)
62{63{
63 if (current->flags & PF_WQ_WORKER)64 if (in_task() && (current->flags & PF_WQ_WORKER))
64 return kthread_data(current);65 return kthread_data(current);
65 return NULL;66 return NULL;
66}67}
lib/asn1_decoder.c+2−2
@@ -228,7 +228,7 @@ next_op: · 227 unmodified lines
228 hdr = 2;228 hdr = 2;
229 229
230 /* Extract a tag from the data */230 /* Extract a tag from the data */
231 if (unlikely(dp >= datalen - 1))231 if (unlikely(datalen - dp < 2))
232 goto data_overrun_error;232 goto data_overrun_error;
233 tag = data[dp++];233 tag = data[dp++];
234 if (unlikely((tag & 0x1f) == ASN1_LONG_TAG))234 if (unlikely((tag & 0x1f) == ASN1_LONG_TAG))
@@ -274,7 +274,7 @@ next_op: · 39 unmodified lines
274 int n = len - 0x80;274 int n = len - 0x80;
275 if (unlikely(n > 2))275 if (unlikely(n > 2))
276 goto length_too_long;276 goto length_too_long;
277 if (unlikely(dp >= datalen - n))277 if (unlikely(n > datalen - dp))
278 goto data_overrun_error;278 goto data_overrun_error;
279 hdr += n;279 hdr += n;
280 for (len = 0; n > 0; n--) {280 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
4869 if (!xnet)4869 if (!xnet)
4870 return;4870 return;
4871 4871
4872 ipvs_reset(skb);
4872 skb_orphan(skb);4873 skb_orphan(skb);
4873 skb->mark = 0;4874 skb->mark = 0;
4874}4875}
net/ipv4/tcp_input.c+1−1
@@ -100,7 +100,7 @@ int sysctl_tcp_max_orphans __read_mostly = NR_FILE; · 99 unmodified lines
100 100
101#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED)101#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED)
102#define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED)102#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)
104#define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED)104#define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED)
105 105
106#define TCP_REMNANT (TCP_FLAG_FIN|TCP_FLAG_URG|TCP_FLAG_SYN|TCP_FLAG_PSH)106#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
123 unsigned char *ptr, *optr;123 unsigned char *ptr, *optr;
124 struct l2tp_session *session;124 struct l2tp_session *session;
125 struct l2tp_tunnel *tunnel = NULL;125 struct l2tp_tunnel *tunnel = NULL;
126 struct iphdr *iph;
126 int length;127 int length;
127 128
128 if (!pskb_may_pull(skb, 4))129 if (!pskb_may_pull(skb, 4))
@@ -178,24 +179,17 @@ pass_up: · 49 unmodified lines
178 goto discard;179 goto discard;
179 180
180 tunnel_id = ntohl(*(__be32 *) &skb->data[4]);181 tunnel_id = ntohl(*(__be32 *) &skb->data[4]);
181 tunnel = l2tp_tunnel_find(net, tunnel_id);182 iph = (struct iphdr *)skb_network_header(skb);
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 }
195 183
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) {
197 read_unlock_bh(&l2tp_ip_lock);188 read_unlock_bh(&l2tp_ip_lock);
189 goto discard;
198 }190 }
191 sock_hold(sk);
192 read_unlock_bh(&l2tp_ip_lock);
199 193
200 if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))194 if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
201 goto discard_put;195 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
136 unsigned char *ptr, *optr;136 unsigned char *ptr, *optr;
137 struct l2tp_session *session;137 struct l2tp_session *session;
138 struct l2tp_tunnel *tunnel = NULL;138 struct l2tp_tunnel *tunnel = NULL;
139 struct ipv6hdr *iph;
139 int length;140 int length;
140 141
141 if (!pskb_may_pull(skb, 4))142 if (!pskb_may_pull(skb, 4))
@@ -192,24 +193,17 @@ pass_up: · 50 unmodified lines
192 goto discard;193 goto discard;
193 194
194 tunnel_id = ntohl(*(__be32 *) &skb->data[4]);195 tunnel_id = ntohl(*(__be32 *) &skb->data[4]);
195 tunnel = l2tp_tunnel_find(net, tunnel_id);196 iph = ipv6_hdr(skb);
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 }
209 197
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) {
211 read_unlock_bh(&l2tp_ip6_lock);202 read_unlock_bh(&l2tp_ip6_lock);
203 goto discard;
212 }204 }
205 sock_hold(sk);
206 read_unlock_bh(&l2tp_ip6_lock);
213 207
214 if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb))208 if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb))
215 goto discard_put;209 goto discard_put;
net/qrtr/qrtr.c+1−1
@@ -1120,7 +1120,7 @@ static int __init qrtr_proto_init(void) · 1119 unmodified lines
1120 1120
1121 return 0;1121 return 0;
1122}1122}
1123module_init(qrtr_proto_init);1123postcore_initcall(qrtr_proto_init);
1124 1124
1125static void __exit qrtr_proto_fini(void)1125static void __exit qrtr_proto_fini(void)
1126{1126{
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
80 spin_lock_bh(&idrinfo->lock);80 spin_lock_bh(&idrinfo->lock);
81 idr_remove_ext(&idrinfo->action_idr, p->tcfa_index);81 idr_remove_ext(&idrinfo->action_idr, p->tcfa_index);
82 spin_unlock_bh(&idrinfo->lock);82 spin_unlock_bh(&idrinfo->lock);
83 put_net(idrinfo->net);
84 gen_kill_estimator(&p->tcfa_rate_est);83 gen_kill_estimator(&p->tcfa_rate_est);
85 free_tcf(p);84 free_tcf(p);
86}85}
@@ -339,7 +338,6 @@ err3: · 252 unmodified lines
339 p->idrinfo = idrinfo;338 p->idrinfo = idrinfo;
340 p->ops = ops;339 p->ops = ops;
341 INIT_LIST_HEAD(&p->list);340 INIT_LIST_HEAD(&p->list);
342 get_net(idrinfo->net);
343 *a = p;341 *a = p;
344 return 0;342 return 0;
345}343}
net/sched/act_bpf.c+1−1
@@ -398,7 +398,7 @@ static __net_init int bpf_init_net(struct net *net) · 397 unmodified lines
398{398{
399 struct tc_action_net *tn = net_generic(net, bpf_net_id);399 struct tc_action_net *tn = net_generic(net, bpf_net_id);
400 400
401 return tc_action_net_init(tn, &act_bpf_ops, net);401 return tc_action_net_init(tn, &act_bpf_ops);
402}402}
403 403
404static void __net_exit bpf_exit_net(struct net *net)404static 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
206{206{
207 struct tc_action_net *tn = net_generic(net, connmark_net_id);207 struct tc_action_net *tn = net_generic(net, connmark_net_id);
208 208
209 return tc_action_net_init(tn, &act_connmark_ops, net);209 return tc_action_net_init(tn, &act_connmark_ops);
210}210}
211 211
212static void __net_exit connmark_exit_net(struct net *net)212static 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
626{626{
627 struct tc_action_net *tn = net_generic(net, csum_net_id);627 struct tc_action_net *tn = net_generic(net, csum_net_id);
628 628
629 return tc_action_net_init(tn, &act_csum_ops, net);629 return tc_action_net_init(tn, &act_csum_ops);
630}630}
631 631
632static void __net_exit csum_exit_net(struct net *net)632static 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
232{232{
233 struct tc_action_net *tn = net_generic(net, gact_net_id);233 struct tc_action_net *tn = net_generic(net, gact_net_id);
234 234
235 return tc_action_net_init(tn, &act_gact_ops, net);235 return tc_action_net_init(tn, &act_gact_ops);
236}236}
237 237
238static void __net_exit gact_exit_net(struct net *net)238static 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
855{855{
856 struct tc_action_net *tn = net_generic(net, ife_net_id);856 struct tc_action_net *tn = net_generic(net, ife_net_id);
857 857
858 return tc_action_net_init(tn, &act_ife_ops, net);858 return tc_action_net_init(tn, &act_ife_ops);
859}859}
860 860
861static void __net_exit ife_exit_net(struct net *net)861static 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
334{334{
335 struct tc_action_net *tn = net_generic(net, ipt_net_id);335 struct tc_action_net *tn = net_generic(net, ipt_net_id);
336 336
337 return tc_action_net_init(tn, &act_ipt_ops, net);337 return tc_action_net_init(tn, &act_ipt_ops);
338}338}
339 339
340static void __net_exit ipt_exit_net(struct net *net)340static 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
384{384{
385 struct tc_action_net *tn = net_generic(net, xt_net_id);385 struct tc_action_net *tn = net_generic(net, xt_net_id);
386 386
387 return tc_action_net_init(tn, &act_xt_ops, net);387 return tc_action_net_init(tn, &act_xt_ops);
388}388}
389 389
390static void __net_exit xt_exit_net(struct net *net)390static 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
340{340{
341 struct tc_action_net *tn = net_generic(net, mirred_net_id);341 struct tc_action_net *tn = net_generic(net, mirred_net_id);
342 342
343 return tc_action_net_init(tn, &act_mirred_ops, net);343 return tc_action_net_init(tn, &act_mirred_ops);
344}344}
345 345
346static void __net_exit mirred_exit_net(struct net *net)346static 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
307{307{
308 struct tc_action_net *tn = net_generic(net, nat_net_id);308 struct tc_action_net *tn = net_generic(net, nat_net_id);
309 309
310 return tc_action_net_init(tn, &act_nat_ops, net);310 return tc_action_net_init(tn, &act_nat_ops);
311}311}
312 312
313static void __net_exit nat_exit_net(struct net *net)313static 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
450{450{
451 struct tc_action_net *tn = net_generic(net, pedit_net_id);451 struct tc_action_net *tn = net_generic(net, pedit_net_id);
452 452
453 return tc_action_net_init(tn, &act_pedit_ops, net);453 return tc_action_net_init(tn, &act_pedit_ops);
454}454}
455 455
456static void __net_exit pedit_exit_net(struct net *net)456static 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
331{331{
332 struct tc_action_net *tn = net_generic(net, police_net_id);332 struct tc_action_net *tn = net_generic(net, police_net_id);
333 333
334 return tc_action_net_init(tn, &act_police_ops, net);334 return tc_action_net_init(tn, &act_police_ops);
335}335}
336 336
337static void __net_exit police_exit_net(struct net *net)337static 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
240{240{
241 struct tc_action_net *tn = net_generic(net, sample_net_id);241 struct tc_action_net *tn = net_generic(net, sample_net_id);
242 242
243 return tc_action_net_init(tn, &act_sample_ops, net);243 return tc_action_net_init(tn, &act_sample_ops);
244}244}
245 245
246static void __net_exit sample_exit_net(struct net *net)246static 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
201{201{
202 struct tc_action_net *tn = net_generic(net, simp_net_id);202 struct tc_action_net *tn = net_generic(net, simp_net_id);
203 203
204 return tc_action_net_init(tn, &act_simp_ops, net);204 return tc_action_net_init(tn, &act_simp_ops);
205}205}
206 206
207static void __net_exit simp_exit_net(struct net *net)207static 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
238{238{
239 struct tc_action_net *tn = net_generic(net, skbedit_net_id);239 struct tc_action_net *tn = net_generic(net, skbedit_net_id);
240 240
241 return tc_action_net_init(tn, &act_skbedit_ops, net);241 return tc_action_net_init(tn, &act_skbedit_ops);
242}242}
243 243
244static void __net_exit skbedit_exit_net(struct net *net)244static 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
263{263{
264 struct tc_action_net *tn = net_generic(net, skbmod_net_id);264 struct tc_action_net *tn = net_generic(net, skbmod_net_id);
265 265
266 return tc_action_net_init(tn, &act_skbmod_ops, net);266 return tc_action_net_init(tn, &act_skbmod_ops);
267}267}
268 268
269static void __net_exit skbmod_exit_net(struct net *net)269static 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
322{322{
323 struct tc_action_net *tn = net_generic(net, tunnel_key_net_id);323 struct tc_action_net *tn = net_generic(net, tunnel_key_net_id);
324 324
325 return tc_action_net_init(tn, &act_tunnel_key_ops, net);325 return tc_action_net_init(tn, &act_tunnel_key_ops);
326}326}
327 327
328static void __net_exit tunnel_key_exit_net(struct net *net)328static 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
269{269{
270 struct tc_action_net *tn = net_generic(net, vlan_net_id);270 struct tc_action_net *tn = net_generic(net, vlan_net_id);
271 271
272 return tc_action_net_init(tn, &act_vlan_ops, net);272 return tc_action_net_init(tn, &act_vlan_ops);
273}273}
274 274
275static void __net_exit vlan_exit_net(struct net *net)275static 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
1110 exts->actions[i++] = act;1110 exts->actions[i++] = act;
1111 exts->nr_actions = i;1111 exts->nr_actions = i;
1112 }1112 }
1113 exts->net = net;
1113 }1114 }
1114#else1115#else
1115 if ((exts->action && tb[exts->action]) ||1116 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
87 return 0;87 return 0;
88}88}
89 89
90static 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
90static void basic_delete_filter_work(struct work_struct *work)98static void basic_delete_filter_work(struct work_struct *work)
91{99{
92 struct basic_filter *f = container_of(work, struct basic_filter, work);100 struct basic_filter *f = container_of(work, struct basic_filter, work);
93 101
94 rtnl_lock();102 rtnl_lock();
95 tcf_exts_destroy(&f->exts);103 __basic_delete_filter(f);
96 tcf_em_tree_destroy(&f->ematches);
97 rtnl_unlock();104 rtnl_unlock();
98
99 kfree(f);
100}105}
101 106
102static void basic_delete_filter(struct rcu_head *head)107static void basic_delete_filter(struct rcu_head *head)
@@ -116,7 +121,10 @@ static void basic_destroy(struct tcf_proto *tp) · 13 unmodified lines
116 list_del_rcu(&f->link);121 list_del_rcu(&f->link);
117 tcf_unbind_filter(tp, &f->res);122 tcf_unbind_filter(tp, &f->res);
118 idr_remove_ext(&head->handle_idr, f->handle);123 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);
120 }128 }
121 idr_destroy(&head->handle_idr);129 idr_destroy(&head->handle_idr);
122 kfree_rcu(head, rcu);130 kfree_rcu(head, rcu);
@@ -130,6 +138,7 @@ static int basic_delete(struct tcf_proto *tp, void *arg, bool *last) · 7 unmodified lines
130 list_del_rcu(&f->link);138 list_del_rcu(&f->link);
131 tcf_unbind_filter(tp, &f->res);139 tcf_unbind_filter(tp, &f->res);
132 idr_remove_ext(&head->handle_idr, f->handle);140 idr_remove_ext(&head->handle_idr, f->handle);
141 tcf_exts_get_net(&f->exts);
133 call_rcu(&f->rcu, basic_delete_filter);142 call_rcu(&f->rcu, basic_delete_filter);
134 *last = list_empty(&head->flist);143 *last = list_empty(&head->flist);
135 return 0;144 return 0;
@@ -225,6 +234,7 @@ static int basic_change(struct net *net, struct sk_buff *in_skb, · 89 unmodified lines
225 idr_replace_ext(&head->handle_idr, fnew, fnew->handle);234 idr_replace_ext(&head->handle_idr, fnew, fnew->handle);
226 list_replace_rcu(&fold->link, &fnew->link);235 list_replace_rcu(&fold->link, &fnew->link);
227 tcf_unbind_filter(tp, &fold->res);236 tcf_unbind_filter(tp, &fold->res);
237 tcf_exts_get_net(&fold->exts);
228 call_rcu(&fold->rcu, basic_delete_filter);238 call_rcu(&fold->rcu, basic_delete_filter);
229 } else {239 } else {
230 list_add_rcu(&fnew->link, &head->flist);240 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
261static void __cls_bpf_delete_prog(struct cls_bpf_prog *prog)261static void __cls_bpf_delete_prog(struct cls_bpf_prog *prog)
262{262{
263 tcf_exts_destroy(&prog->exts);263 tcf_exts_destroy(&prog->exts);
264 tcf_exts_put_net(&prog->exts);
264 265
265 if (cls_bpf_is_ebpf(prog))266 if (cls_bpf_is_ebpf(prog))
266 bpf_prog_put(prog->filter);267 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
297 cls_bpf_stop_offload(tp, prog);298 cls_bpf_stop_offload(tp, prog);
298 list_del_rcu(&prog->link);299 list_del_rcu(&prog->link);
299 tcf_unbind_filter(tp, &prog->res);300 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);
301}305}
302 306
303static int cls_bpf_delete(struct tcf_proto *tp, void *arg, bool *last)307static 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
526 idr_replace_ext(&head->handle_idr, prog, handle);530 idr_replace_ext(&head->handle_idr, prog, handle);
527 list_replace_rcu(&oldprog->link, &prog->link);531 list_replace_rcu(&oldprog->link, &prog->link);
528 tcf_unbind_filter(tp, &oldprog->res);532 tcf_unbind_filter(tp, &oldprog->res);
533 tcf_exts_get_net(&oldprog->exts);
529 call_rcu(&oldprog->rcu, cls_bpf_delete_prog_rcu);534 call_rcu(&oldprog->rcu, cls_bpf_delete_prog_rcu);
530 } else {535 } else {
531 list_add_rcu(&prog->link, &head->plist);536 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
60 [TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED },60 [TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED },
61};61};
62 62
63static 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
63static void cls_cgroup_destroy_work(struct work_struct *work)71static void cls_cgroup_destroy_work(struct work_struct *work)
64{72{
65 struct cls_cgroup_head *head = container_of(work,73 struct cls_cgroup_head *head = container_of(work,
66 struct cls_cgroup_head,74 struct cls_cgroup_head,
67 work);75 work);
68 rtnl_lock();76 rtnl_lock();
69 tcf_exts_destroy(&head->exts);77 __cls_cgroup_destroy(head);
70 tcf_em_tree_destroy(&head->ematches);
71 kfree(head);
72 rtnl_unlock();78 rtnl_unlock();
73}79}
74 80
@@ -124,8 +130,10 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb, · 49 unmodified lines
124 goto errout;130 goto errout;
125 131
126 rcu_assign_pointer(tp->root, new);132 rcu_assign_pointer(tp->root, new);
127 if (head)133 if (head) {
134 tcf_exts_get_net(&head->exts);
128 call_rcu(&head->rcu, cls_cgroup_destroy_rcu);135 call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
136 }
129 return 0;137 return 0;
130errout:138errout:
131 tcf_exts_destroy(&new->exts);139 tcf_exts_destroy(&new->exts);
@@ -138,8 +146,12 @@ static void cls_cgroup_destroy(struct tcf_proto *tp) · 6 unmodified lines
138 struct cls_cgroup_head *head = rtnl_dereference(tp->root);146 struct cls_cgroup_head *head = rtnl_dereference(tp->root);
139 147
140 /* Head can still be NULL due to cls_cgroup_init(). */148 /* Head can still be NULL due to cls_cgroup_init(). */
141 if (head)149 if (head) {
142 call_rcu(&head->rcu, cls_cgroup_destroy_rcu);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 }
143}155}
144 156
145static int cls_cgroup_delete(struct tcf_proto *tp, void *arg, bool *last)157static 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
372 [TCA_FLOW_PERTURB] = { .type = NLA_U32 },372 [TCA_FLOW_PERTURB] = { .type = NLA_U32 },
373};373};
374 374
375static void flow_destroy_filter_work(struct work_struct *work)375static void __flow_destroy_filter(struct flow_filter *f)
376{376{
377 struct flow_filter *f = container_of(work, struct flow_filter, work);
378
379 rtnl_lock();
380 del_timer_sync(&f->perturb_timer);377 del_timer_sync(&f->perturb_timer);
381 tcf_exts_destroy(&f->exts);378 tcf_exts_destroy(&f->exts);
382 tcf_em_tree_destroy(&f->ematches);379 tcf_em_tree_destroy(&f->ematches);
380 tcf_exts_put_net(&f->exts);
383 kfree(f);381 kfree(f);
382}
383
384static 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);
384 rtnl_unlock();390 rtnl_unlock();
385}391}
386 392
@@ -554,8 +560,10 @@ static int flow_change(struct net *net, struct sk_buff *in_skb, · 167 unmodified lines
554 560
555 *arg = fnew;561 *arg = fnew;
556 562
557 if (fold)563 if (fold) {
564 tcf_exts_get_net(&fold->exts);
558 call_rcu(&fold->rcu, flow_destroy_filter);565 call_rcu(&fold->rcu, flow_destroy_filter);
566 }
559 return 0;567 return 0;
560 568
561err2:569err2:
@@ -572,6 +580,7 @@ static int flow_delete(struct tcf_proto *tp, void *arg, bool *last) · 10 unmodified lines
572 struct flow_filter *f = arg;580 struct flow_filter *f = arg;
573 581
574 list_del_rcu(&f->list);582 list_del_rcu(&f->list);
583 tcf_exts_get_net(&f->exts);
575 call_rcu(&f->rcu, flow_destroy_filter);584 call_rcu(&f->rcu, flow_destroy_filter);
576 *last = list_empty(&head->filters);585 *last = list_empty(&head->filters);
577 return 0;586 return 0;
@@ -596,7 +605,10 @@ static void flow_destroy(struct tcf_proto *tp) · 18 unmodified lines
596 605
597 list_for_each_entry_safe(f, next, &head->filters, list) {606 list_for_each_entry_safe(f, next, &head->filters, list) {
598 list_del_rcu(&f->list);607 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);
600 }612 }
601 kfree_rcu(head, rcu);613 kfree_rcu(head, rcu);
602}614}
net/sched/cls_flower.c+13−3
@@ -193,13 +193,19 @@ static int fl_init(struct tcf_proto *tp) · 192 unmodified lines
193 return 0;193 return 0;
194}194}
195 195
196static 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
196static void fl_destroy_filter_work(struct work_struct *work)203static void fl_destroy_filter_work(struct work_struct *work)
197{204{
198 struct cls_fl_filter *f = container_of(work, struct cls_fl_filter, work);205 struct cls_fl_filter *f = container_of(work, struct cls_fl_filter, work);
199 206
200 rtnl_lock();207 rtnl_lock();
201 tcf_exts_destroy(&f->exts);208 __fl_destroy_filter(f);
202 kfree(f);
203 rtnl_unlock();209 rtnl_unlock();
204}210}
205 211
@@ -282,7 +288,10 @@ static void __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f) · 76 unmodified lines
282 if (!tc_skip_hw(f->flags))288 if (!tc_skip_hw(f->flags))
283 fl_hw_destroy_filter(tp, f);289 fl_hw_destroy_filter(tp, f);
284 tcf_unbind_filter(tp, &f->res);290 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);
286}295}
287 296
288static void fl_destroy_sleepable(struct work_struct *work)297static 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
952 idr_replace_ext(&head->handle_idr, fnew, fnew->handle);961 idr_replace_ext(&head->handle_idr, fnew, fnew->handle);
953 list_replace_rcu(&fold->list, &fnew->list);962 list_replace_rcu(&fold->list, &fnew->list);
954 tcf_unbind_filter(tp, &fold->res);963 tcf_unbind_filter(tp, &fold->res);
964 tcf_exts_get_net(&fold->exts);
955 call_rcu(&fold->rcu, fl_destroy_filter);965 call_rcu(&fold->rcu, fl_destroy_filter);
956 } else {966 } else {
957 list_add_tail_rcu(&fnew->list, &head->filters);967 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
125 return 0;125 return 0;
126}126}
127 127
128static 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
128static void fw_delete_filter_work(struct work_struct *work)135static void fw_delete_filter_work(struct work_struct *work)
129{136{
130 struct fw_filter *f = container_of(work, struct fw_filter, work);137 struct fw_filter *f = container_of(work, struct fw_filter, work);
131 138
132 rtnl_lock();139 rtnl_lock();
133 tcf_exts_destroy(&f->exts);140 __fw_delete_filter(f);
134 kfree(f);
135 rtnl_unlock();141 rtnl_unlock();
136}142}
137 143
@@ -157,7 +163,10 @@ static void fw_destroy(struct tcf_proto *tp) · 19 unmodified lines
157 RCU_INIT_POINTER(head->ht[h],163 RCU_INIT_POINTER(head->ht[h],
158 rtnl_dereference(f->next));164 rtnl_dereference(f->next));
159 tcf_unbind_filter(tp, &f->res);165 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);
161 }170 }
162 }171 }
163 kfree_rcu(head, rcu);172 kfree_rcu(head, rcu);
@@ -182,6 +191,7 @@ static int fw_delete(struct tcf_proto *tp, void *arg, bool *last) · 18 unmodified lines
182 if (pfp == f) {191 if (pfp == f) {
183 RCU_INIT_POINTER(*fp, rtnl_dereference(f->next));192 RCU_INIT_POINTER(*fp, rtnl_dereference(f->next));
184 tcf_unbind_filter(tp, &f->res);193 tcf_unbind_filter(tp, &f->res);
194 tcf_exts_get_net(&f->exts);
185 call_rcu(&f->rcu, fw_delete_filter);195 call_rcu(&f->rcu, fw_delete_filter);
186 ret = 0;196 ret = 0;
187 break;197 break;
@@ -302,6 +312,7 @@ static int fw_change(struct net *net, struct sk_buff *in_skb, · 114 unmodified lines
302 RCU_INIT_POINTER(fnew->next, rtnl_dereference(pfp->next));312 RCU_INIT_POINTER(fnew->next, rtnl_dereference(pfp->next));
303 rcu_assign_pointer(*fp, fnew);313 rcu_assign_pointer(*fp, fnew);
304 tcf_unbind_filter(tp, &f->res);314 tcf_unbind_filter(tp, &f->res);
315 tcf_exts_get_net(&f->exts);
305 call_rcu(&f->rcu, fw_delete_filter);316 call_rcu(&f->rcu, fw_delete_filter);
306 317
307 *arg = fnew;318 *arg = fnew;
net/sched/cls_matchall.c+12−3
@@ -44,13 +44,19 @@ static int mall_init(struct tcf_proto *tp) · 43 unmodified lines
44 return 0;44 return 0;
45}45}
46 46
47static 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
47static void mall_destroy_work(struct work_struct *work)54static void mall_destroy_work(struct work_struct *work)
48{55{
49 struct cls_mall_head *head = container_of(work, struct cls_mall_head,56 struct cls_mall_head *head = container_of(work, struct cls_mall_head,
50 work);57 work);
51 rtnl_lock();58 rtnl_lock();
52 tcf_exts_destroy(&head->exts);59 __mall_destroy(head);
53 kfree(head);
54 rtnl_unlock();60 rtnl_unlock();
55}61}
56 62
@@ -116,7 +122,10 @@ static void mall_destroy(struct tcf_proto *tp) · 59 unmodified lines
116 if (!tc_skip_hw(head->flags))122 if (!tc_skip_hw(head->flags))
117 mall_destroy_hw_filter(tp, head, (unsigned long) head);123 mall_destroy_hw_filter(tp, head, (unsigned long) head);
118 124
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);
120}129}
121 130
122static void *mall_get(struct tcf_proto *tp, u32 handle)131static 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
257 return 0;257 return 0;
258}258}
259 259
260static 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
260static void route4_delete_filter_work(struct work_struct *work)267static void route4_delete_filter_work(struct work_struct *work)
261{268{
262 struct route4_filter *f = container_of(work, struct route4_filter, work);269 struct route4_filter *f = container_of(work, struct route4_filter, work);
263 270
264 rtnl_lock();271 rtnl_lock();
265 tcf_exts_destroy(&f->exts);272 __route4_delete_filter(f);
266 kfree(f);
267 rtnl_unlock();273 rtnl_unlock();
268}274}
269 275
@@ -297,7 +303,10 @@ static void route4_destroy(struct tcf_proto *tp) · 27 unmodified lines
297 next = rtnl_dereference(f->next);303 next = rtnl_dereference(f->next);
298 RCU_INIT_POINTER(b->ht[h2], next);304 RCU_INIT_POINTER(b->ht[h2], next);
299 tcf_unbind_filter(tp, &f->res);305 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);
301 }310 }
302 }311 }
303 RCU_INIT_POINTER(head->table[h1], NULL);312 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
338 347
339 /* Delete it */348 /* Delete it */
340 tcf_unbind_filter(tp, &f->res);349 tcf_unbind_filter(tp, &f->res);
350 tcf_exts_get_net(&f->exts);
341 call_rcu(&f->rcu, route4_delete_filter);351 call_rcu(&f->rcu, route4_delete_filter);
342 352
343 /* Strip RTNL protected tree */353 /* Strip RTNL protected tree */
@@ -541,6 +551,7 @@ static int route4_change(struct net *net, struct sk_buff *in_skb, · 197 unmodified lines
541 *arg = f;551 *arg = f;
542 if (fold) {552 if (fold) {
543 tcf_unbind_filter(tp, &fold->res);553 tcf_unbind_filter(tp, &fold->res);
554 tcf_exts_get_net(&fold->exts);
544 call_rcu(&fold->rcu, route4_delete_filter);555 call_rcu(&fold->rcu, route4_delete_filter);
545 }556 }
546 return 0;557 return 0;
net/sched/cls_rsvp.h+12−3
@@ -285,13 +285,19 @@ static int rsvp_init(struct tcf_proto *tp) · 284 unmodified lines
285 return -ENOBUFS;285 return -ENOBUFS;
286}286}
287 287
288static 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
288static void rsvp_delete_filter_work(struct work_struct *work)295static void rsvp_delete_filter_work(struct work_struct *work)
289{296{
290 struct rsvp_filter *f = container_of(work, struct rsvp_filter, work);297 struct rsvp_filter *f = container_of(work, struct rsvp_filter, work);
291 298
292 rtnl_lock();299 rtnl_lock();
293 tcf_exts_destroy(&f->exts);300 __rsvp_delete_filter(f);
294 kfree(f);
295 rtnl_unlock();301 rtnl_unlock();
296}302}
297 303
@@ -310,7 +316,10 @@ static void rsvp_delete_filter(struct tcf_proto *tp, struct rsvp_filter *f) · 12 unmodified lines
310 * grace period, since converted-to-rcu actions are relying on that316 * grace period, since converted-to-rcu actions are relying on that
311 * in cleanup() callback317 * in cleanup() callback
312 */318 */
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);
314}323}
315 324
316static void rsvp_destroy(struct tcf_proto *tp)325static 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
142 return 0;142 return 0;
143}143}
144 144
145static 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
145static void tcindex_destroy_rexts_work(struct work_struct *work)151static void tcindex_destroy_rexts_work(struct work_struct *work)
146{152{
147 struct tcindex_filter_result *r;153 struct tcindex_filter_result *r;
148 154
149 r = container_of(work, struct tcindex_filter_result, work);155 r = container_of(work, struct tcindex_filter_result, work);
150 rtnl_lock();156 rtnl_lock();
151 tcf_exts_destroy(&r->exts);157 __tcindex_destroy_rexts(r);
152 rtnl_unlock();158 rtnl_unlock();
153}159}
154 160
@@ -161,14 +167,20 @@ static void tcindex_destroy_rexts(struct rcu_head *head) · 6 unmodified lines
161 tcf_queue_work(&r->work);167 tcf_queue_work(&r->work);
162}168}
163 169
170static 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
164static void tcindex_destroy_fexts_work(struct work_struct *work)177static void tcindex_destroy_fexts_work(struct work_struct *work)
165{178{
166 struct tcindex_filter *f = container_of(work, struct tcindex_filter,179 struct tcindex_filter *f = container_of(work, struct tcindex_filter,
167 work);180 work);
168 181
169 rtnl_lock();182 rtnl_lock();
170 tcf_exts_destroy(&f->result.exts);183 __tcindex_destroy_fexts(f);
171 kfree(f);
172 rtnl_unlock();184 rtnl_unlock();
173}185}
174 186
@@ -213,10 +225,17 @@ found: · 38 unmodified lines
213 * grace period, since converted-to-rcu actions are relying on that225 * grace period, since converted-to-rcu actions are relying on that
214 * in cleanup() callback226 * in cleanup() callback
215 */227 */
216 if (f)228 if (f) {
217 call_rcu(&f->rcu, tcindex_destroy_fexts);229 if (tcf_exts_get_net(&f->result.exts))
218 else230 call_rcu(&f->rcu, tcindex_destroy_fexts);
219 call_rcu(&r->rcu, tcindex_destroy_rexts);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 }
220 239
221 *last = false;240 *last = false;
222 return 0;241 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
399 bool free_pf)399 bool free_pf)
400{400{
401 tcf_exts_destroy(&n->exts);401 tcf_exts_destroy(&n->exts);
402 tcf_exts_put_net(&n->exts);
402 if (n->ht_down)403 if (n->ht_down)
403 n->ht_down->refcnt--;404 n->ht_down->refcnt--;
404#ifdef CONFIG_CLS_U32_PERF405#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
476 RCU_INIT_POINTER(*kp, key->next);477 RCU_INIT_POINTER(*kp, key->next);
477 478
478 tcf_unbind_filter(tp, &key->res);479 tcf_unbind_filter(tp, &key->res);
480 tcf_exts_get_net(&key->exts);
479 call_rcu(&key->rcu, u32_delete_key_freepf_rcu);481 call_rcu(&key->rcu, u32_delete_key_freepf_rcu);
480 return 0;482 return 0;
481 }483 }
@@ -590,7 +592,10 @@ static void u32_clear_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht) · 108 unmodified lines
590 tcf_unbind_filter(tp, &n->res);592 tcf_unbind_filter(tp, &n->res);
591 u32_remove_hw_knode(tp, n->handle);593 u32_remove_hw_knode(tp, n->handle);
592 idr_remove_ext(&ht->handle_idr, n->handle);594 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);
594 }599 }
595 }600 }
596}601}
@@ -949,6 +954,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, · 352 unmodified lines
949 954
950 u32_replace_knode(tp, tp_c, new);955 u32_replace_knode(tp, tp_c, new);
951 tcf_unbind_filter(tp, &n->res);956 tcf_unbind_filter(tp, &n->res);
957 tcf_exts_get_net(&n->exts);
952 call_rcu(&n->rcu, u32_delete_key_rcu);958 call_rcu(&n->rcu, u32_delete_key_rcu);
953 return 0;959 return 0;
954 }960 }
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
266 goto lock;266 goto lock;
267 }267 }
268 268
269 daddr = (xfrm_address_t *)(skb_network_header(skb) +
270 XFRM_SPI_SKB_CB(skb)->daddroff);
271 family = XFRM_SPI_SKB_CB(skb)->family;269 family = XFRM_SPI_SKB_CB(skb)->family;
272 270
273 /* if tunnel is present override skb->mark value with tunnel i_key */271 /* 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
294 goto drop;292 goto drop;
295 }293 }
296 294
295 daddr = (xfrm_address_t *)(skb_network_header(skb) +
296 XFRM_SPI_SKB_CB(skb)->daddroff);
297 do {297 do {
298 if (skb->sp->len == XFRM_MAX_DEPTH) {298 if (skb->sp->len == XFRM_MAX_DEPTH) {
299 XFRM_INC_STATS(net, LINUX_MIB_XFRMINBUFFERERROR);299 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
1360 struct net *net = xp_net(policy);1360 struct net *net = xp_net(policy);
1361 int nx;1361 int nx;
1362 int i, error;1362 int i, error;
1363 xfrm_address_t *daddr = xfrm_flowi_daddr(fl, family);
1364 xfrm_address_t *saddr = xfrm_flowi_saddr(fl, family);
1365 xfrm_address_t tmp;1363 xfrm_address_t tmp;
1366 1364
1367 for (nx = 0, i = 0; i < policy->xfrm_nr; i++) {1365 for (nx = 0, i = 0; i < policy->xfrm_nr; i++) {
1368 struct xfrm_state *x;1366 struct xfrm_state *x;
1369 xfrm_address_t *remote = daddr;1367 xfrm_address_t *local;
1370 xfrm_address_t *local = saddr;1368 xfrm_address_t *remote;
1371 struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i];1369 struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i];
1372 1370
1373 if (tmpl->mode == XFRM_MODE_TUNNEL ||1371 remote = &tmpl->id.daddr;
1374 tmpl->mode == XFRM_MODE_BEET) {1372 local = &tmpl->saddr;
1375 remote = &tmpl->id.daddr;1373 if (xfrm_addr_any(local, tmpl->encap_family)) {
1376 local = &tmpl->saddr;1374 error = xfrm_get_saddr(net, fl->flowi_oif,
1377 if (xfrm_addr_any(local, tmpl->encap_family)) {1375 &tmp, remote,
1378 error = xfrm_get_saddr(net, fl->flowi_oif,1376 tmpl->encap_family, 0);
1379 &tmp, remote,1377 if (error)
1380 tmpl->encap_family, 0);1378 goto fail;
1381 if (error)1379 local = &tmp;
1382 goto fail;
1383 local = &tmp;
1384 }
1385 }1380 }
1386 1381
1387 x = xfrm_state_find(remote, local, fl, tmpl, policy, &error, family);1382 x = xfrm_state_find(remote, local, fl, tmpl, policy, &error, family);
1388 1383
1389 if (x && x->km.state == XFRM_STATE_VALID) {1384 if (x && x->km.state == XFRM_STATE_VALID) {
1390 xfrm[nx++] = x;1385 xfrm[nx++] = x;
1391 daddr = remote;
1392 saddr = local;
1393 continue;1386 continue;
1394 }1387 }
1395 if (x) {1388 if (x) {
@@ -1786,19 +1779,23 @@ void xfrm_policy_cache_flush(void) · 390 unmodified lines
1786 put_online_cpus();1779 put_online_cpus();
1787}1780}
1788 1781
1789static bool xfrm_pol_dead(struct xfrm_dst *xdst)1782static bool xfrm_xdst_can_reuse(struct xfrm_dst *xdst,
1783 struct xfrm_state * const xfrm[],
1784 int num)
1790{1785{
1791 unsigned int num_pols = xdst->num_pols;1786 const struct dst_entry *dst = &xdst->u.dst;
1792 unsigned int pol_dead = 0, i;1787 int i;
1793 1788
1794 for (i = 0; i < num_pols; i++)1789 if (xdst->num_xfrms != num)
1795 pol_dead |= xdst->pols[i]->walk.dead;1790 return false;
1796 1791
1797 /* Mark DST_OBSOLETE_DEAD to fail the next xfrm_dst_check() */1792 for (i = 0; i < num; i++) {
1798 if (pol_dead)1793 if (!dst || dst->xfrm != xfrm[i])
1799 xdst->u.dst.obsolete = DST_OBSOLETE_DEAD;1794 return false;
1795 dst = dst->child;
1796 }
1800 1797
1801 return pol_dead;1798 return xfrm_bundle_ok(xdst);
1802}1799}
1803 1800
1804static struct xfrm_dst *1801static struct xfrm_dst *
@@ -1812,26 +1809,28 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols, · 7 unmodified lines
1812 struct dst_entry *dst;1809 struct dst_entry *dst;
1813 int err;1810 int err;
1814 1811
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
1815 xdst = this_cpu_read(xfrm_last_dst);1820 xdst = this_cpu_read(xfrm_last_dst);
1816 if (xdst &&1821 if (xdst &&
1817 xdst->u.dst.dev == dst_orig->dev &&1822 xdst->u.dst.dev == dst_orig->dev &&
1818 xdst->num_pols == num_pols &&1823 xdst->num_pols == num_pols &&
1819 !xfrm_pol_dead(xdst) &&
1820 memcmp(xdst->pols, pols,1824 memcmp(xdst->pols, pols,
1821 sizeof(struct xfrm_policy *) * num_pols) == 0 &&1825 sizeof(struct xfrm_policy *) * num_pols) == 0 &&
1822 xfrm_bundle_ok(xdst)) {1826 xfrm_xdst_can_reuse(xdst, xfrm, err)) {
1823 dst_hold(&xdst->u.dst);1827 dst_hold(&xdst->u.dst);
1828 while (err > 0)
1829 xfrm_state_put(xfrm[--err]);
1824 return xdst;1830 return xdst;
1825 }1831 }
1826 1832
1827 old = xdst;1833 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 }
1835 1834
1836 dst = xfrm_bundle_create(pols[0], xfrm, err, fl, dst_orig);1835 dst = xfrm_bundle_create(pols[0], xfrm, err, fl, dst_orig);
1837 if (IS_ERR(dst)) {1836 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
35use warnings;
36use strict;
37use POSIX;
38use File::Basename;
39use File::Spec;
40use Cwd 'abs_path';
41use Term::ANSIColor qw(:constants);
42use Getopt::Long qw(:config no_auto_abbrev);
43
44my $P = $0;
45my $V = '0.01';
46
47# Directories to scan.
48my @DIRS = ('/proc', '/sys');
49
50# Command line options.
51my $help = 0;
52my $debug = 0;
53my @dont_walk = ();
54my @dont_parse = ();
55
56# Do not parse these files (absolute path).
57my @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.
65my @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).
78my @skip_walk_dirs_abs = ();
79
80# Do not walk these directories under any subdirectory.
81my @skip_walk_dirs_any = ('self',
82 'thread-self',
83 'cwd',
84 'fd',
85 'stderr',
86 'stdin',
87 'stdout');
88
89sub help
90{
91 my ($exitcode) = @_;
92
93 print << "EOM";
94Usage: $P [OPTIONS]
95Version: $V
96
97Options:
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
104If an absolute path is passed to --dont_XXX then this path is skipped. If a
105single filename is passed then this file/directory will be skipped when
106appearing under any subdirectory.
107
108Example:
109
110 # Just scan dmesg output.
111 scripts/leaking_addresses.pl --dont_walk_abs /proc --dont_walk_abs /sys
112
113Scans the running (64 bit) kernel for potential leaking addresses.
114
115EOM
116 exit($exitcode);
117}
118
119GetOptions(
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
127help(0) if ($help);
128
129push_to_global();
130
131parse_dmesg();
132walk(@DIRS);
133
134exit 0;
135
136sub 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
144sub dprint
145{
146 printf(STDERR @_) if $debug;
147}
148
149sub 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.
165sub 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
171sub 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.
190sub 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
215sub 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.
227sub 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
243sub skip_parse
244{
245 my ($path) = @_;
246 return skip($path, \@skip_parse_files_abs, \@skip_parse_files_any);
247}
248
249sub 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.
274sub 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.
281sub 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
128 return SIGUNKNOWN;128 return SIGUNKNOWN;
129 else if (sig >= SIGRTMIN)129 else if (sig >= SIGRTMIN)
130 return sig - SIGRTMIN + 128; /* rt sigs mapped to 128 */130 return sig - SIGRTMIN + 128; /* rt sigs mapped to 128 */
131 else if (sig <= MAXMAPPED_SIG)131 else if (sig < MAXMAPPED_SIG)
132 return sig_map[sig];132 return sig_map[sig];
133 return SIGUNKNOWN;133 return SIGUNKNOWN;
134}134}
@@ -163,7 +163,7 @@ static void audit_signal_cb(struct audit_buffer *ab, void *va) · 28 unmodified lines
163 audit_signal_mask(ab, aad(sa)->denied);163 audit_signal_mask(ab, aad(sa)->denied);
164 }164 }
165 }165 }
166 if (aad(sa)->signal <= MAXMAPPED_SIG)166 if (aad(sa)->signal < MAXMAPPED_SIG)
167 audit_log_format(ab, " signal=%s", sig_names[aad(sa)->signal]);167 audit_log_format(ab, " signal=%s", sig_names[aad(sa)->signal]);
168 else168 else
169 audit_log_format(ab, " signal=rtmin+%d",169 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
159 timer->hw = hrtimer_hw;159 timer->hw = hrtimer_hw;
160 timer->hw.resolution = resolution;160 timer->hw.resolution = resolution;
161 timer->hw.ticks = NANO_SEC / resolution;161 timer->hw.ticks = NANO_SEC / resolution;
162 timer->max_instances = 100; /* lower the limit */
162 163
163 err = snd_timer_global_register(timer);164 err = snd_timer_global_register(timer);
164 if (err < 0) {165 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
612 if (!dp->timer->running)612 if (!dp->timer->running)
613 len = snd_seq_oss_timer_start(dp->timer);613 len = snd_seq_oss_timer_start(dp->timer);
614 if (ev->type == SNDRV_SEQ_EVENT_SYSEX) {614 if (ev->type == SNDRV_SEQ_EVENT_SYSEX) {
615 if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)615 snd_seq_oss_readq_sysex(dp->readq, mdev->seq_device, ev);
616 snd_seq_oss_readq_puts(dp->readq, mdev->seq_device,
617 ev->data.ext.ptr, ev->data.ext.len);
618 } else {616 } else {
619 len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev);617 len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev);
620 if (len > 0)618 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
117 return 0;117 return 0;
118}118}
119 119
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 */
124struct readq_sysex_ctx {
125 struct seq_oss_readq *readq;
126 int dev;
127};
128
129static 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
136int 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
120/*149/*
121 * copy an event to input queue:150 * copy an event to input queue:
122 * return zero if enqueued151 * 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
44void snd_seq_oss_readq_clear(struct seq_oss_readq *readq);44void snd_seq_oss_readq_clear(struct seq_oss_readq *readq);
45unsigned int snd_seq_oss_readq_poll(struct seq_oss_readq *readq, struct file *file, poll_table *wait);45unsigned int snd_seq_oss_readq_poll(struct seq_oss_readq *readq, struct file *file, poll_table *wait);
46int snd_seq_oss_readq_puts(struct seq_oss_readq *readq, int dev, unsigned char *data, int len);46int snd_seq_oss_readq_puts(struct seq_oss_readq *readq, int dev, unsigned char *data, int len);
47int snd_seq_oss_readq_sysex(struct seq_oss_readq *q, int dev,
48 struct snd_seq_event *ev);
47int snd_seq_oss_readq_put_event(struct seq_oss_readq *readq, union evrec *ev);49int snd_seq_oss_readq_put_event(struct seq_oss_readq *readq, union evrec *ev);
48int snd_seq_oss_readq_put_timestamp(struct seq_oss_readq *readq, unsigned long curt, int seq_mode);50int snd_seq_oss_readq_put_timestamp(struct seq_oss_readq *readq, unsigned long curt, int seq_mode);
49int snd_seq_oss_readq_pick(struct seq_oss_readq *q, union evrec *rec);51int 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
180 *180 *
181 * call this with register_mutex down.181 * call this with register_mutex down.
182 */182 */
183static void snd_timer_check_slave(struct snd_timer_instance *slave)183static int snd_timer_check_slave(struct snd_timer_instance *slave)
184{184{
185 struct snd_timer *timer;185 struct snd_timer *timer;
186 struct snd_timer_instance *master;186 struct snd_timer_instance *master;
@@ -190,16 +190,21 @@ static void snd_timer_check_slave(struct snd_timer_instance *slave) · 3 unmodified lines
190 list_for_each_entry(master, &timer->open_list_head, open_list) {190 list_for_each_entry(master, &timer->open_list_head, open_list) {
191 if (slave->slave_class == master->slave_class &&191 if (slave->slave_class == master->slave_class &&
192 slave->slave_id == master->slave_id) {192 slave->slave_id == master->slave_id) {
193 if (master->timer->num_instances >=
194 master->timer->max_instances)
195 return -EBUSY;
193 list_move_tail(&slave->open_list,196 list_move_tail(&slave->open_list,
194 &master->slave_list_head);197 &master->slave_list_head);
198 master->timer->num_instances++;
195 spin_lock_irq(&slave_active_lock);199 spin_lock_irq(&slave_active_lock);
196 slave->master = master;200 slave->master = master;
197 slave->timer = master->timer;201 slave->timer = master->timer;
198 spin_unlock_irq(&slave_active_lock);202 spin_unlock_irq(&slave_active_lock);
199 return;203 return 0;
200 }204 }
201 }205 }
202 }206 }
207 return 0;
203}208}
204 209
205/*210/*
@@ -208,7 +213,7 @@ static void snd_timer_check_slave(struct snd_timer_instance *slave) · 2 unmodified lines
208 *213 *
209 * call this with register_mutex down.214 * call this with register_mutex down.
210 */215 */
211static void snd_timer_check_master(struct snd_timer_instance *master)216static int snd_timer_check_master(struct snd_timer_instance *master)
212{217{
213 struct snd_timer_instance *slave, *tmp;218 struct snd_timer_instance *slave, *tmp;
214 219
@@ -216,7 +221,11 @@ static void snd_timer_check_master(struct snd_timer_instance *master) · 1 unmodified line
216 list_for_each_entry_safe(slave, tmp, &snd_timer_slave_list, open_list) {221 list_for_each_entry_safe(slave, tmp, &snd_timer_slave_list, open_list) {
217 if (slave->slave_class == master->slave_class &&222 if (slave->slave_class == master->slave_class &&
218 slave->slave_id == master->slave_id) {223 slave->slave_id == master->slave_id) {
224 if (master->timer->num_instances >=
225 master->timer->max_instances)
226 return -EBUSY;
219 list_move_tail(&slave->open_list, &master->slave_list_head);227 list_move_tail(&slave->open_list, &master->slave_list_head);
228 master->timer->num_instances++;
220 spin_lock_irq(&slave_active_lock);229 spin_lock_irq(&slave_active_lock);
221 spin_lock(&master->timer->lock);230 spin_lock(&master->timer->lock);
222 slave->master = master;231 slave->master = master;
@@ -228,8 +237,11 @@ static void snd_timer_check_master(struct snd_timer_instance *master) · 5 unmodified lines
228 spin_unlock_irq(&slave_active_lock);237 spin_unlock_irq(&slave_active_lock);
229 }238 }
230 }239 }
240 return 0;
231}241}
232 242
243static int snd_timer_close_locked(struct snd_timer_instance *timeri);
244
233/*245/*
234 * open a timer instance246 * open a timer instance
235 * when opening a master, the slave id must be here given.247 * 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
240{252{
241 struct snd_timer *timer;253 struct snd_timer *timer;
242 struct snd_timer_instance *timeri = NULL;254 struct snd_timer_instance *timeri = NULL;
255 int err;
243 256
244 if (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) {257 if (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) {
245 /* open a slave instance */258 /* open a slave instance */
@@ -259,10 +272,14 @@ int snd_timer_open(struct snd_timer_instance **ti, · 13 unmodified lines
259 timeri->slave_id = tid->device;272 timeri->slave_id = tid->device;
260 timeri->flags |= SNDRV_TIMER_IFLG_SLAVE;273 timeri->flags |= SNDRV_TIMER_IFLG_SLAVE;
261 list_add_tail(&timeri->open_list, &snd_timer_slave_list);274 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 }
263 mutex_unlock(&register_mutex);280 mutex_unlock(&register_mutex);
264 *ti = timeri;281 *ti = timeri;
265 return 0;282 return err;
266 }283 }
267 284
268 /* open a master instance */285 /* open a master instance */
@@ -288,6 +305,10 @@ int snd_timer_open(struct snd_timer_instance **ti, · 19 unmodified lines
288 return -EBUSY;305 return -EBUSY;
289 }306 }
290 }307 }
308 if (timer->num_instances >= timer->max_instances) {
309 mutex_unlock(&register_mutex);
310 return -EBUSY;
311 }
291 timeri = snd_timer_instance_new(owner, timer);312 timeri = snd_timer_instance_new(owner, timer);
292 if (!timeri) {313 if (!timeri) {
293 mutex_unlock(&register_mutex);314 mutex_unlock(&register_mutex);
@@ -314,25 +335,27 @@ int snd_timer_open(struct snd_timer_instance **ti, · 20 unmodified lines
314 }335 }
315 336
316 list_add_tail(&timeri->open_list, &timer->open_list_head);337 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 }
318 mutex_unlock(&register_mutex);344 mutex_unlock(&register_mutex);
319 *ti = timeri;345 *ti = timeri;
320 return 0;346 return err;
321}347}
322EXPORT_SYMBOL(snd_timer_open);348EXPORT_SYMBOL(snd_timer_open);
323 349
324/*350/*
325 * close a timer instance351 * close a timer instance
352 * call this with register_mutex down.
326 */353 */
327int snd_timer_close(struct snd_timer_instance *timeri)354static int snd_timer_close_locked(struct snd_timer_instance *timeri)
328{355{
329 struct snd_timer *timer = NULL;356 struct snd_timer *timer = NULL;
330 struct snd_timer_instance *slave, *tmp;357 struct snd_timer_instance *slave, *tmp;
331 358
332 if (snd_BUG_ON(!timeri))
333 return -ENXIO;
334
335 mutex_lock(&register_mutex);
336 list_del(&timeri->open_list);359 list_del(&timeri->open_list);
337 360
338 /* force to stop the timer */361 /* force to stop the timer */
@@ -340,6 +363,7 @@ int snd_timer_close(struct snd_timer_instance *timeri) · 1 unmodified line
340 363
341 timer = timeri->timer;364 timer = timeri->timer;
342 if (timer) {365 if (timer) {
366 timer->num_instances--;
343 /* wait, until the active callback is finished */367 /* wait, until the active callback is finished */
344 spin_lock_irq(&timer->lock);368 spin_lock_irq(&timer->lock);
345 while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) {369 while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) {
@@ -355,6 +379,7 @@ int snd_timer_close(struct snd_timer_instance *timeri) · 9 unmodified lines
355 list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head,379 list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head,
356 open_list) {380 open_list) {
357 list_move_tail(&slave->open_list, &snd_timer_slave_list);381 list_move_tail(&slave->open_list, &snd_timer_slave_list);
382 timer->num_instances--;
358 slave->master = NULL;383 slave->master = NULL;
359 slave->timer = NULL;384 slave->timer = NULL;
360 list_del_init(&slave->ack_list);385 list_del_init(&slave->ack_list);
@@ -382,9 +407,24 @@ int snd_timer_close(struct snd_timer_instance *timeri) · 21 unmodified lines
382 module_put(timer->module);407 module_put(timer->module);
383 }408 }
384 409
385 mutex_unlock(&register_mutex);
386 return 0;410 return 0;
387}411}
412
413/*
414 * close a timer instance
415 */
416int 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}
388EXPORT_SYMBOL(snd_timer_close);428EXPORT_SYMBOL(snd_timer_close);
389 429
390unsigned long snd_timer_resolution(struct snd_timer_instance *timeri)430unsigned 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
856 spin_lock_init(&timer->lock);896 spin_lock_init(&timer->lock);
857 tasklet_init(&timer->task_queue, snd_timer_tasklet,897 tasklet_init(&timer->task_queue, snd_timer_tasklet,
858 (unsigned long)timer);898 (unsigned long)timer);
899 timer->max_instances = 1000; /* default limit per timer */
859 if (card != NULL) {900 if (card != NULL) {
860 timer->module = card->module;901 timer->module = card->module;
861 err = snd_device_new(card, SNDRV_DEV_TIMER, timer, &ops);902 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
6544 {0x14, 0x90170110},6544 {0x14, 0x90170110},
6545 {0x1b, 0x90a70130},6545 {0x1b, 0x90a70130},
6546 {0x21, 0x03211020}),6546 {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}),
6547 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,6552 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
6548 {0x12, 0x90a60130},6553 {0x12, 0x90a60130},
6549 {0x14, 0x90170110},6554 {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
1375 case 0x199:1375 case 0x199:
1376 return SNDRV_PCM_FMTBIT_DSD_U32_LE;1376 return SNDRV_PCM_FMTBIT_DSD_U32_LE;
1377 case 0x19b:1377 case 0x19b:
1378 case 0x203:
1378 return SNDRV_PCM_FMTBIT_DSD_U32_BE;1379 return SNDRV_PCM_FMTBIT_DSD_U32_BE;
1379 default:1380 default:
1380 break;1381 break;
tools/arch/x86/include/asm/disabled-features.h+0−1
@@ -1,4 +1,3 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_DISABLED_FEATURES_H1#ifndef _ASM_X86_DISABLED_FEATURES_H
3#define _ASM_X86_DISABLED_FEATURES_H2#define _ASM_X86_DISABLED_FEATURES_H
4 3
tools/arch/x86/include/asm/required-features.h+0−1
@@ -1,4 +1,3 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_REQUIRED_FEATURES_H1#ifndef _ASM_X86_REQUIRED_FEATURES_H
3#define _ASM_X86_REQUIRED_FEATURES_H2#define _ASM_X86_REQUIRED_FEATURES_H
4 3
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 */
1#ifndef _UAPI_ASM_X86_UNISTD_H2#ifndef _UAPI_ASM_X86_UNISTD_H
2#define _UAPI_ASM_X86_UNISTD_H3#define _UAPI_ASM_X86_UNISTD_H
3 4
tools/arch/x86/lib/memcpy_64.S+4−1
@@ -1,10 +1,10 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/* Copyright 2002 Andi Kleen */1/* Copyright 2002 Andi Kleen */
3 2
4#include <linux/linkage.h>3#include <linux/linkage.h>
5#include <asm/errno.h>4#include <asm/errno.h>
6#include <asm/cpufeatures.h>5#include <asm/cpufeatures.h>
7#include <asm/alternative-asm.h>6#include <asm/alternative-asm.h>
7#include <asm/export.h>
8 8
9/*9/*
10 * We build a jump to memcpy_orig by default which gets NOPped out on10 * We build a jump to memcpy_orig by default which gets NOPped out on
@@ -41,6 +41,8 @@ ENTRY(memcpy) · 30 unmodified lines
41 ret41 ret
42ENDPROC(memcpy)42ENDPROC(memcpy)
43ENDPROC(__memcpy)43ENDPROC(__memcpy)
44EXPORT_SYMBOL(memcpy)
45EXPORT_SYMBOL(__memcpy)
44 46
45/*47/*
46 * memcpy_erms() - enhanced fast string memcpy. This is faster and48 * memcpy_erms() - enhanced fast string memcpy. This is faster and
@@ -275,6 +277,7 @@ ENTRY(memcpy_mcsafe_unrolled) · 228 unmodified lines
275 xorq %rax, %rax277 xorq %rax, %rax
276 ret278 ret
277ENDPROC(memcpy_mcsafe_unrolled)279ENDPROC(memcpy_mcsafe_unrolled)
280EXPORT_SYMBOL_GPL(memcpy_mcsafe_unrolled)
278 281
279 .section .fixup, "ax"282 .section .fixup, "ax"
280 /* Return -EFAULT for any failure */283 /* 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 */
1#ifndef _ASM_GENERIC_BITOPS___FLS_H_2#ifndef _ASM_GENERIC_BITOPS___FLS_H_
2#define _ASM_GENERIC_BITOPS___FLS_H_3#define _ASM_GENERIC_BITOPS___FLS_H_
3 4
tools/include/asm-generic/bitops/arch_hweight.h+1−0
@@ -1,3 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1#ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_2#ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
2#define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_3#define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
3 4
tools/include/asm-generic/bitops/const_hweight.h+1−0
@@ -1,3 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1#ifndef _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_2#ifndef _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
2#define _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_3#define _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
3 4
tools/include/asm-generic/bitops/fls.h+1−0
@@ -1,3 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1#ifndef _ASM_GENERIC_BITOPS_FLS_H_2#ifndef _ASM_GENERIC_BITOPS_FLS_H_
2#define _ASM_GENERIC_BITOPS_FLS_H_3#define _ASM_GENERIC_BITOPS_FLS_H_
3 4
tools/include/asm-generic/bitops/fls64.h+1−0
@@ -1,3 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1#ifndef _ASM_GENERIC_BITOPS_FLS64_H_2#ifndef _ASM_GENERIC_BITOPS_FLS64_H_
2#define _ASM_GENERIC_BITOPS_FLS64_H_3#define _ASM_GENERIC_BITOPS_FLS64_H_
3 4
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 */
2#ifndef _LINUX_HASH_H1#ifndef _LINUX_HASH_H
3#define _LINUX_HASH_H2#define _LINUX_HASH_H
4/* Fast hashing routine for ints, longs and pointers.3/* 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 */
1#ifndef __ASM_GENERIC_IOCTLS_H2#ifndef __ASM_GENERIC_IOCTLS_H
2#define __ASM_GENERIC_IOCTLS_H3#define __ASM_GENERIC_IOCTLS_H
3 4
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 */
1#ifndef __ASM_GENERIC_MMAN_COMMON_H2#ifndef __ASM_GENERIC_MMAN_COMMON_H
2#define __ASM_GENERIC_MMAN_COMMON_H3#define __ASM_GENERIC_MMAN_COMMON_H
3 4
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 */
2#ifndef __ASM_GENERIC_MMAN_H2#ifndef __ASM_GENERIC_MMAN_H
3#define __ASM_GENERIC_MMAN_H3#define __ASM_GENERIC_MMAN_H
4 4
5#include <uapi/asm-generic/mman-common.h>5#include <asm-generic/mman-common.h>
6 6
7#define MAP_GROWSDOWN 0x0100 /* stack-like segment */7#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
8#define MAP_DENYWRITE 0x0800 /* ETXTBSY */8#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 */
1/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com2/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
2 *3 *
3 * This program is free software; you can redistribute it and/or4 * 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 */
2#ifndef _UAPI__LINUX_BPF_COMMON_H__2#ifndef _UAPI__LINUX_BPF_COMMON_H__
3#define _UAPI__LINUX_BPF_COMMON_H__3#define _UAPI__LINUX_BPF_COMMON_H__
4 4
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 */
2#ifndef _UAPI_LINUX_FCNTL_H2#ifndef _UAPI_LINUX_FCNTL_H
3#define _UAPI_LINUX_FCNTL_H3#define _UAPI_LINUX_FCNTL_H
4 4
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 */
2#ifndef _UAPI_LINUX_HW_BREAKPOINT_H2#ifndef _UAPI_LINUX_HW_BREAKPOINT_H
3#define _UAPI_LINUX_HW_BREAKPOINT_H3#define _UAPI_LINUX_HW_BREAKPOINT_H
4 4
tools/include/uapi/linux/kvm.h+1−0
@@ -1,3 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1#ifndef __LINUX_KVM_H2#ifndef __LINUX_KVM_H
2#define __LINUX_KVM_H3#define __LINUX_KVM_H
3 4
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 */
2#ifndef _UAPI_LINUX_MMAN_H2#ifndef _UAPI_LINUX_MMAN_H
3#define _UAPI_LINUX_MMAN_H3#define _UAPI_LINUX_MMAN_H
4 4
tools/include/uapi/linux/perf_event.h+1−0
@@ -1,3 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1/*2/*
2 * Performance events:3 * Performance events:
3 *4 *
tools/include/uapi/linux/sched.h+1−0
@@ -1,3 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1#ifndef _UAPI_LINUX_SCHED_H2#ifndef _UAPI_LINUX_SCHED_H
2#define _UAPI_LINUX_SCHED_H3#define _UAPI_LINUX_SCHED_H
3 4
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 */
2#ifndef _UAPI_LINUX_STAT_H2#ifndef _UAPI_LINUX_STAT_H
3#define _UAPI_LINUX_STAT_H3#define _UAPI_LINUX_STAT_H
4 4
tools/include/uapi/linux/vhost.h+1−0
@@ -1,3 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1#ifndef _LINUX_VHOST_H2#ifndef _LINUX_VHOST_H
2#define _LINUX_VHOST_H3#define _LINUX_VHOST_H
3/* Userspace interface for in-kernel virtio accelerators. */4/* 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 */
1/*2/*
2 * Advanced Linux Sound Architecture - ALSA - Driver3 * Advanced Linux Sound Architecture - ALSA - Driver
3 * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>,4 * 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 @@
1#!/bin/awk -f1#!/bin/awk -f
2# SPDX-License-Identifier: GPL-2.0
2# gen-insn-attr-x86.awk: Instruction attribute table generator3# gen-insn-attr-x86.awk: Instruction attribute table generator
3# Written by Masami Hiramatsu <mhiramat@redhat.com>4# Written by Masami Hiramatsu <mhiramat@redhat.com>
4#5#
tools/perf/util/annotate.c+11−1
@@ -606,9 +606,19 @@ static struct arch *arch__find(const char *name) · 605 unmodified lines
606int symbol__alloc_hist(struct symbol *sym)606int symbol__alloc_hist(struct symbol *sym)
607{607{
608 struct annotation *notes = symbol__annotation(sym);608 struct annotation *notes = symbol__annotation(sym);
609 const size_t size = symbol__size(sym);609 size_t size = symbol__size(sym);
610 size_t sizeof_sym_hist;610 size_t sizeof_sym_hist;
611 611
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
612 /* Check for overflow when calculating sizeof_sym_hist */622 /* Check for overflow when calculating sizeof_sym_hist */
613 if (size > (SIZE_MAX - sizeof(struct sym_hist)) / sizeof(struct sym_hist_entry))623 if (size > (SIZE_MAX - sizeof(struct sym_hist)) / sizeof(struct sym_hist_entry))
614 return -1;624 return -1;
tools/perf/util/parse-events.l+6−2
@@ -154,6 +154,10 @@ do { \ · 153 unmodified lines
154 yycolumn += yyleng; \154 yycolumn += yyleng; \
155} while (0);155} while (0);
156 156
157#define USER_REJECT \
158 yycolumn -= yyleng; \
159 REJECT
160
157%}161%}
158 162
159%x mem163%x mem
@@ -335,8 +339,8 @@ r{num_raw_hex} { return raw(yyscanner); } · 175 unmodified lines
335{num_hex} { return value(yyscanner, 16); }339{num_hex} { return value(yyscanner, 16); }
336 340
337{modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); }341{modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); }
338{bpf_object} { if (!isbpf(yyscanner)) REJECT; return str(yyscanner, PE_BPF_OBJECT); }342{bpf_object} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_OBJECT); }
339{bpf_source} { if (!isbpf(yyscanner)) REJECT; return str(yyscanner, PE_BPF_SOURCE); }343{bpf_source} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_SOURCE); }
340{name} { return pmu_str_check(yyscanner); }344{name} { return pmu_str_check(yyscanner); }
341"/" { BEGIN(config); return '/'; }345"/" { BEGIN(config); return '/'; }
342- { return '-'; }346- { return '-'; }
virt/kvm/arm/arm.c+14−17
@@ -1326,21 +1326,12 @@ static void teardown_hyp_mode(void) · 1325 unmodified lines
1326{1326{
1327 int cpu;1327 int cpu;
1328 1328
1329 if (is_kernel_in_hyp_mode())
1330 return;
1331
1332 free_hyp_pgds();1329 free_hyp_pgds();
1333 for_each_possible_cpu(cpu)1330 for_each_possible_cpu(cpu)
1334 free_page(per_cpu(kvm_arm_hyp_stack_page, cpu));1331 free_page(per_cpu(kvm_arm_hyp_stack_page, cpu));
1335 hyp_cpu_pm_exit();1332 hyp_cpu_pm_exit();
1336}1333}
1337 1334
1338static int init_vhe_mode(void)
1339{
1340 kvm_info("VHE mode initialized successfully\n");
1341 return 0;
1342}
1343
1344/**1335/**
1345 * Inits Hyp-mode on all online CPUs1336 * Inits Hyp-mode on all online CPUs
1346 */1337 */
@@ -1421,8 +1412,6 @@ static int init_hyp_mode(void) · 74 unmodified lines
1421 }1412 }
1422 }1413 }
1423 1414
1424 kvm_info("Hyp mode initialized successfully\n");
1425
1426 return 0;1415 return 0;
1427 1416
1428out_err:1417out_err:
@@ -1456,6 +1445,7 @@ int kvm_arch_init(void *opaque) · 27 unmodified lines
1456{1445{
1457 int err;1446 int err;
1458 int ret, cpu;1447 int ret, cpu;
1448 bool in_hyp_mode;
1459 1449
1460 if (!is_hyp_mode_available()) {1450 if (!is_hyp_mode_available()) {
1461 kvm_err("HYP mode not available\n");1451 kvm_err("HYP mode not available\n");
@@ -1474,21 +1464,28 @@ int kvm_arch_init(void *opaque) · 12 unmodified lines
1474 if (err)1464 if (err)
1475 return err;1465 return err;
1476 1466
1477 if (is_kernel_in_hyp_mode())1467 in_hyp_mode = is_kernel_in_hyp_mode();
1478 err = init_vhe_mode();1468
1479 else1469 if (!in_hyp_mode) {
1480 err = init_hyp_mode();1470 err = init_hyp_mode();
1481 if (err)1471 if (err)
1482 goto out_err;1472 goto out_err;
1473 }
1483 1474
1484 err = init_subsystems();1475 err = init_subsystems();
1485 if (err)1476 if (err)
1486 goto out_hyp;1477 goto out_hyp;
1487 1478
1479 if (in_hyp_mode)
1480 kvm_info("VHE mode initialized successfully\n");
1481 else
1482 kvm_info("Hyp mode initialized successfully\n");
1483
1488 return 0;1484 return 0;
1489 1485
1490out_hyp:1486out_hyp:
1491 teardown_hyp_mode();1487 if (!in_hyp_mode)
1488 teardown_hyp_mode();
1492out_err:1489out_err:
1493 teardown_common_resources();1490 teardown_common_resources();
1494 return err;1491 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
1466{1466{
1467 mutex_lock(&its->cmd_lock);1467 mutex_lock(&its->cmd_lock);
1468 1468
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
1469 its->enabled = !!(val & GITS_CTLR_ENABLE);1479 its->enabled = !!(val & GITS_CTLR_ENABLE);
1470 1480
1471 /*1481 /*
@@ -1474,6 +1484,7 @@ static void vgic_mmio_write_its_ctlr(struct kvm *kvm, struct vgic_its *its, · 2 unmodified lines
1474 */1484 */
1475 vgic_its_process_commands(kvm, its);1485 vgic_its_process_commands(kvm, its);
1476 1486
1487out:
1477 mutex_unlock(&its->cmd_lock);1488 mutex_unlock(&its->cmd_lock);
1478}1489}
1479 1490
@@ -1801,37 +1812,33 @@ typedef int (*entry_fn_t)(struct vgic_its *its, u32 id, void *entry, · 321 unmodified lines
1801static int scan_its_table(struct vgic_its *its, gpa_t base, int size, int esz,1812static int scan_its_table(struct vgic_its *its, gpa_t base, int size, int esz,
1802 int start_id, entry_fn_t fn, void *opaque)1813 int start_id, entry_fn_t fn, void *opaque)
1803{1814{
1804 void *entry = kzalloc(esz, GFP_KERNEL);
1805 struct kvm *kvm = its->dev->kvm;1815 struct kvm *kvm = its->dev->kvm;
1806 unsigned long len = size;1816 unsigned long len = size;
1807 int id = start_id;1817 int id = start_id;
1808 gpa_t gpa = base;1818 gpa_t gpa = base;
1819 char entry[esz];
1809 int ret;1820 int ret;
1810 1821
1822 memset(entry, 0, esz);
1823
1811 while (len > 0) {1824 while (len > 0) {
1812 int next_offset;1825 int next_offset;
1813 size_t byte_offset;1826 size_t byte_offset;
1814 1827
1815 ret = kvm_read_guest(kvm, gpa, entry, esz);1828 ret = kvm_read_guest(kvm, gpa, entry, esz);
1816 if (ret)1829 if (ret)
1817 goto out;1830 return ret;
1818 1831
1819 next_offset = fn(its, id, entry, opaque);1832 next_offset = fn(its, id, entry, opaque);
1820 if (next_offset <= 0) {1833 if (next_offset <= 0)
1821 ret = next_offset;1834 return next_offset;
1822 goto out;
1823 }
1824 1835
1825 byte_offset = next_offset * esz;1836 byte_offset = next_offset * esz;
1826 id += next_offset;1837 id += next_offset;
1827 gpa += byte_offset;1838 gpa += byte_offset;
1828 len -= byte_offset;1839 len -= byte_offset;
1829 }1840 }
1830 ret = 1;1841 return 1;
1831
1832out:
1833 kfree(entry);
1834 return ret;
1835}1842}
1836 1843
1837/**1844/**
@@ -1940,6 +1947,14 @@ static int vgic_its_save_itt(struct vgic_its *its, struct its_device *device) · 102 unmodified lines
1940 return 0;1947 return 0;
1941}1948}
1942 1949
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 */
1943static int vgic_its_restore_itt(struct vgic_its *its, struct its_device *dev)1958static int vgic_its_restore_itt(struct vgic_its *its, struct its_device *dev)
1944{1959{
1945 const struct vgic_its_abi *abi = vgic_its_get_abi(its);1960 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
1951 ret = scan_its_table(its, base, max_size, ite_esz, 0,1966 ret = scan_its_table(its, base, max_size, ite_esz, 0,
1952 vgic_its_restore_ite, dev);1967 vgic_its_restore_ite, dev);
1953 1968
1969 /* scan_its_table returns +1 if all ITEs are invalid */
1970 if (ret > 0)
1971 ret = 0;
1972
1954 return ret;1973 return ret;
1955}1974}
1956 1975
@@ -2048,11 +2067,12 @@ static int vgic_its_device_cmp(void *priv, struct list_head *a, · 91 unmodified lines
2048static int vgic_its_save_device_tables(struct vgic_its *its)2067static int vgic_its_save_device_tables(struct vgic_its *its)
2049{2068{
2050 const struct vgic_its_abi *abi = vgic_its_get_abi(its);2069 const struct vgic_its_abi *abi = vgic_its_get_abi(its);
2070 u64 baser = its->baser_device_table;
2051 struct its_device *dev;2071 struct its_device *dev;
2052 int dte_esz = abi->dte_esz;2072 int dte_esz = abi->dte_esz;
2053 u64 baser;
2054 2073
2055 baser = its->baser_device_table;2074 if (!(baser & GITS_BASER_VALID))
2075 return 0;
2056 2076
2057 list_sort(NULL, &its->device_list, vgic_its_device_cmp);2077 list_sort(NULL, &its->device_list, vgic_its_device_cmp);
2058 2078
@@ -2107,10 +2127,7 @@ static int handle_l1_dte(struct vgic_its *its, u32 id, void *addr, · 48 unmodified lines
2107 ret = scan_its_table(its, gpa, SZ_64K, dte_esz,2127 ret = scan_its_table(its, gpa, SZ_64K, dte_esz,
2108 l2_start_id, vgic_its_restore_dte, NULL);2128 l2_start_id, vgic_its_restore_dte, NULL);
2109 2129
2110 if (ret <= 0)2130 return ret;
2111 return ret;
2112
2113 return 1;
2114}2131}
2115 2132
2116/**2133/**
@@ -2140,8 +2157,9 @@ static int vgic_its_restore_device_tables(struct vgic_its *its) · 23 unmodified lines
2140 vgic_its_restore_dte, NULL);2157 vgic_its_restore_dte, NULL);
2141 }2158 }
2142 2159
2160 /* scan_its_table returns +1 if all entries are invalid */
2143 if (ret > 0)2161 if (ret > 0)
2144 ret = -EINVAL;2162 ret = 0;
2145 2163
2146 return ret;2164 return ret;
2147}2165}
@@ -2198,17 +2216,17 @@ static int vgic_its_restore_cte(struct vgic_its *its, gpa_t gpa, int esz) · 50 unmodified lines
2198static int vgic_its_save_collection_table(struct vgic_its *its)2216static int vgic_its_save_collection_table(struct vgic_its *its)
2199{2217{
2200 const struct vgic_its_abi *abi = vgic_its_get_abi(its);2218 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);
2201 struct its_collection *collection;2221 struct its_collection *collection;
2202 u64 val;2222 u64 val;
2203 gpa_t gpa;
2204 size_t max_size, filled = 0;2223 size_t max_size, filled = 0;
2205 int ret, cte_esz = abi->cte_esz;2224 int ret, cte_esz = abi->cte_esz;
2206 2225
2207 gpa = BASER_ADDRESS(its->baser_coll_table);2226 if (!(baser & GITS_BASER_VALID))
2208 if (!gpa)
2209 return 0;2227 return 0;
2210 2228
2211 max_size = GITS_BASER_NR_PAGES(its->baser_coll_table) * SZ_64K;2229 max_size = GITS_BASER_NR_PAGES(baser) * SZ_64K;
2212 2230
2213 list_for_each_entry(collection, &its->collection_list, coll_list) {2231 list_for_each_entry(collection, &its->collection_list, coll_list) {
2214 ret = vgic_its_save_cte(its, collection, gpa, cte_esz);2232 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
2239static int vgic_its_restore_collection_table(struct vgic_its *its)2257static int vgic_its_restore_collection_table(struct vgic_its *its)
2240{2258{
2241 const struct vgic_its_abi *abi = vgic_its_get_abi(its);2259 const struct vgic_its_abi *abi = vgic_its_get_abi(its);
2260 u64 baser = its->baser_coll_table;
2242 int cte_esz = abi->cte_esz;2261 int cte_esz = abi->cte_esz;
2243 size_t max_size, read = 0;2262 size_t max_size, read = 0;
2244 gpa_t gpa;2263 gpa_t gpa;
2245 int ret;2264 int ret;
2246 2265
2247 if (!(its->baser_coll_table & GITS_BASER_VALID))2266 if (!(baser & GITS_BASER_VALID))
2248 return 0;2267 return 0;
2249 2268
2250 gpa = BASER_ADDRESS(its->baser_coll_table);2269 gpa = BASER_ADDRESS(baser);
2251 2270
2252 max_size = GITS_BASER_NR_PAGES(its->baser_coll_table) * SZ_64K;2271 max_size = GITS_BASER_NR_PAGES(baser) * SZ_64K;
2253 2272
2254 while (read < max_size) {2273 while (read < max_size) {
2255 ret = vgic_its_restore_cte(its, gpa, cte_esz);2274 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
2258 gpa += cte_esz;2277 gpa += cte_esz;
2259 read += cte_esz;2278 read += cte_esz;
2260 }2279 }
2280
2281 if (ret > 0)
2282 return 0;
2283
2261 return ret;2284 return ret;
2262}2285}
2263 2286