Simple cases of overlapping changes in the packet scheduler. Must easier to resolve this time. Which probably means that I screwed it up somehow.
Unified · Split
| @@ -15,6 +15,7 @@ Adriana Reus <adi.reus@gmail.com> <adriana.reus@intel.com> · 14 unmodified lines | ||
| 15 | 15 | Alan Cox <alan@lxorguk.ukuu.org.uk> |
| 16 | 16 | Alan Cox <root@hraefn.swansea.linux.org.uk> |
| 17 | 17 | Aleksey Gorelov <aleksey_gorelov@phoenix.com> |
| 18 | +Aleksandar Markovic <aleksandar.markovic@mips.com> <aleksandar.markovic@imgtec.com> | |
| 18 | 19 | Al Viro <viro@ftp.linux.org.uk> |
| 19 | 20 | Al Viro <viro@zenIV.linux.org.uk> |
| 20 | 21 | Andreas Herrmann <aherrman@de.ibm.com> |
| @@ -101,6 +102,7 @@ Leonid I Ananiev <leonid.i.ananiev@intel.com> · 80 unmodified lines | ||
| 101 | 102 | Linas Vepstas <linas@austin.ibm.com> |
| 102 | 103 | Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de> |
| 103 | 104 | Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@ascom.ch> |
| 105 | +Marcin Nowakowski <marcin.nowakowski@mips.com> <marcin.nowakowski@imgtec.com> | |
| 104 | 106 | Mark Brown <broonie@sirena.org.uk> |
| 105 | 107 | Martin Kepplinger <martink@posteo.de> <martin.kepplinger@theobroma-systems.com> |
| 106 | 108 | Martin Kepplinger <martink@posteo.de> <martin.kepplinger@ginzinger.com> |
| @@ -119,6 +121,7 @@ Matt Redfearn <matt.redfearn@mips.com> <matt.redfearn@imgtec.com> · 12 unmodified lines | ||
| 119 | 121 | Mayuresh Janorkar <mayur@ti.com> |
| 120 | 122 | Michael Buesch <m@bues.ch> |
| 121 | 123 | Michel Dänzer <michel@tungstengraphics.com> |
| 124 | +Miodrag Dinic <miodrag.dinic@mips.com> <miodrag.dinic@imgtec.com> | |
| 122 | 125 | Mitesh shah <mshah@teja.com> |
| 123 | 126 | Mohit Kumar <mohit.kumar@st.com> <mohit.kumar.dhaka@gmail.com> |
| 124 | 127 | Morten Welinder <terra@gnome.org> |
| @@ -50,8 +50,9 @@ be stronger. · 49 unmodified lines | ||
| 50 | 50 | Except where noted below, we speak only for ourselves, and not for any company |
| 51 | 51 | we might work for today, have in the past, or will in the future. |
| 52 | 52 | |
| 53 | + - Laura Abbott | |
| 53 | 54 | - Bjorn Andersson (Linaro) |
| 54 | − - Andrea Arcangeli (Red Hat) | |
| 55 | + - Andrea Arcangeli | |
| 55 | 56 | - Neil Armstrong |
| 56 | 57 | - Jens Axboe |
| 57 | 58 | - 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 | 61 | - Felipe Balbi |
| 61 | 62 | - Arnd Bergmann |
| 62 | 63 | - Ard Biesheuvel |
| 63 | − - Paolo Bonzini (Red Hat) | |
| 64 | + - Tim Bird | |
| 65 | + - Paolo Bonzini | |
| 64 | 66 | - Christian Borntraeger |
| 65 | 67 | - Mark Brown (Linaro) |
| 66 | 68 | - Paul Burton |
| 67 | 69 | - Javier Martinez Canillas |
| 68 | 70 | - Rob Clark |
| 69 | 71 | - Jonathan Corbet |
| 72 | + - Dennis Dalessandro | |
| 70 | 73 | - Vivien Didelot (Savoir-faire Linux) |
| 71 | − - Hans de Goede (Red Hat) | |
| 74 | + - Hans de Goede | |
| 72 | 75 | - Mel Gorman (SUSE) |
| 73 | 76 | - Sven Eckelmann |
| 74 | 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 | 82 | - Juergen Gross |
| 80 | 83 | - Shawn Guo |
| 81 | 84 | - Ulf Hansson |
| 85 | + - Stephen Hemminger (Microsoft) | |
| 82 | 86 | - Tejun Heo |
| 83 | 87 | - Rob Herring |
| 84 | 88 | - Masami Hiramatsu |
| @@ -104,18 +108,21 @@ we might work for today, have in the past, or will in the future. · 19 unmodified lines | ||
| 104 | 108 | - Viresh Kumar |
| 105 | 109 | - Aneesh Kumar K.V |
| 106 | 110 | - Julia Lawall |
| 107 | − - Doug Ledford (Red Hat) | |
| 111 | + - Doug Ledford | |
| 108 | 112 | - Chuck Lever (Oracle) |
| 109 | 113 | - Daniel Lezcano |
| 110 | 114 | - Shaohua Li |
| 111 | − - Xin Long (Red Hat) | |
| 115 | + - Xin Long | |
| 112 | 116 | - Tony Luck |
| 117 | + - Catalin Marinas (Arm Ltd) | |
| 113 | 118 | - Mike Marshall |
| 114 | 119 | - Chris Mason |
| 115 | 120 | - Paul E. McKenney |
| 116 | 121 | - David S. Miller |
| 117 | 122 | - Ingo Molnar |
| 118 | 123 | - Kuninori Morimoto |
| 124 | + - Trond Myklebust | |
| 125 | + - Martin K. Petersen (Oracle) | |
| 119 | 126 | - Borislav Petkov |
| 120 | 127 | - Jiri Pirko |
| 121 | 128 | - Josh Poimboeuf |
| @@ -124,18 +131,20 @@ we might work for today, have in the past, or will in the future. · 2 unmodified lines | ||
| 124 | 131 | - Joerg Roedel |
| 125 | 132 | - Leon Romanovsky |
| 126 | 133 | - Steven Rostedt (VMware) |
| 127 | − - Ivan Safonov | |
| 134 | + - Frank Rowand | |
| 128 | 135 | - Ivan Safonov |
| 129 | 136 | - Anna Schumaker |
| 130 | 137 | - Jes Sorensen |
| 131 | 138 | - K.Y. Srinivasan |
| 132 | 139 | - Heiko Stuebner |
| 133 | 140 | - Jiri Kosina (SUSE) |
| 141 | + - Willy Tarreau | |
| 134 | 142 | - Dmitry Torokhov |
| 135 | 143 | - Linus Torvalds |
| 136 | 144 | - Thierry Reding |
| 137 | 145 | - Rik van Riel |
| 138 | 146 | - Geert Uytterhoeven (Glider bvba) |
| 147 | + - Eduardo Valentin (Amazon.com) | |
| 139 | 148 | - Daniel Vetter |
| 140 | 149 | - Linus Walleij |
| 141 | 150 | - Richard Weinberger |
| @@ -145,3 +154,4 @@ we might work for today, have in the past, or will in the future. · 3 unmodified lines | ||
| 145 | 154 | - Masahiro Yamada |
| 146 | 155 | - Wei Yongjun |
| 147 | 156 | - Lv Zheng |
| 157 | + - Marc Zyngier (Arm Ltd) | |
| @@ -873,7 +873,7 @@ F: drivers/android/ · 872 unmodified lines | ||
| 873 | 873 | F: drivers/staging/android/ |
| 874 | 874 | |
| 875 | 875 | ANDROID GOLDFISH RTC DRIVER |
| 876 | −M: Miodrag Dinic <miodrag.dinic@imgtec.com> | |
| 876 | +M: Miodrag Dinic <miodrag.dinic@mips.com> | |
| 877 | 877 | S: Supported |
| 878 | 878 | F: Documentation/devicetree/bindings/rtc/google,goldfish-rtc.txt |
| 879 | 879 | F: drivers/rtc/rtc-goldfish.c |
| @@ -7752,6 +7752,11 @@ S: Maintained · 6872 unmodified lines | ||
| 7752 | 7752 | F: Documentation/scsi/53c700.txt |
| 7753 | 7753 | F: drivers/scsi/53c700* |
| 7754 | 7754 | |
| 7755 | +LEAKING_ADDRESSES | |
| 7756 | +M: Tobin C. Harding <me@tobin.cc> | |
| 7757 | +S: Maintained | |
| 7758 | +F: scripts/leaking_addresses.pl | |
| 7759 | + | |
| 7755 | 7760 | LED SUBSYSTEM |
| 7756 | 7761 | M: Richard Purdie <rpurdie@rpsys.net> |
| 7757 | 7762 | M: Jacek Anaszewski <jacek.anaszewski@gmail.com> |
| @@ -9027,7 +9032,7 @@ F: drivers/*/*loongson1* · 1269 unmodified lines | ||
| 9027 | 9032 | F: drivers/*/*/*loongson1* |
| 9028 | 9033 | |
| 9029 | 9034 | MIPS RINT INSTRUCTION EMULATION |
| 9030 | −M: Aleksandar Markovic <aleksandar.markovic@imgtec.com> | |
| 9035 | +M: Aleksandar Markovic <aleksandar.markovic@mips.com> | |
| 9031 | 9036 | L: linux-mips@linux-mips.org |
| 9032 | 9037 | S: Supported |
| 9033 | 9038 | F: arch/mips/math-emu/sp_rint.c |
| @@ -10692,10 +10697,9 @@ S: Maintained · 1658 unmodified lines | ||
| 10692 | 10697 | F: drivers/pinctrl/spear/ |
| 10693 | 10698 | |
| 10694 | 10699 | PISTACHIO SOC SUPPORT |
| 10695 | −M: James Hartley <james.hartley@imgtec.com> | |
| 10696 | −M: Ionela Voinescu <ionela.voinescu@imgtec.com> | |
| 10700 | +M: James Hartley <james.hartley@sondrel.com> | |
| 10697 | 10701 | L: linux-mips@linux-mips.org |
| 10698 | −S: Maintained | |
| 10702 | +S: Odd Fixes | |
| 10699 | 10703 | F: arch/mips/pistachio/ |
| 10700 | 10704 | F: arch/mips/include/asm/mach-pistachio/ |
| 10701 | 10705 | F: arch/mips/boot/dts/img/pistachio* |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | VERSION = 4 |
| 3 | 3 | PATCHLEVEL = 14 |
| 4 | 4 | SUBLEVEL = 0 |
| 5 | −EXTRAVERSION = -rc7 | |
| 5 | +EXTRAVERSION = -rc8 | |
| 6 | 6 | NAME = Fearless Coyote |
| 7 | 7 | |
| 8 | 8 | # *DOCUMENTATION* |
| @@ -44,10 +44,12 @@ endif · 43 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) |
| 46 | 46 | KBUILD_CPPFLAGS += -mbig-endian |
| 47 | +CHECKFLAGS += -D__ARMEB__ | |
| 47 | 48 | AS += -EB |
| 48 | 49 | LD += -EB |
| 49 | 50 | else |
| 50 | 51 | KBUILD_CPPFLAGS += -mlittle-endian |
| 52 | +CHECKFLAGS += -D__ARMEL__ | |
| 51 | 53 | AS += -EL |
| 52 | 54 | LD += -EL |
| 53 | 55 | endif |
| @@ -85,6 +85,15 @@ SECTIONS · 84 unmodified lines | ||
| 85 | 85 | |
| 86 | 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 | 97 | _magic_sig = ZIMAGE_MAGIC(0x016f2818); |
| 89 | 98 | _magic_start = ZIMAGE_MAGIC(_start); |
| 90 | 99 | _magic_end = ZIMAGE_MAGIC(_edata); |
| @@ -178,9 +178,9 @@ · 177 unmodified lines | ||
| 178 | 178 | reg = <0x8000 0x1000>; |
| 179 | 179 | cache-unified; |
| 180 | 180 | cache-level = <2>; |
| 181 | − arm,double-linefill-incr = <1>; | |
| 181 | + arm,double-linefill-incr = <0>; | |
| 182 | 182 | arm,double-linefill-wrap = <0>; |
| 183 | − arm,double-linefill = <1>; | |
| 183 | + arm,double-linefill = <0>; | |
| 184 | 184 | prefetch-data = <1>; |
| 185 | 185 | }; |
| 186 | 186 | |
| @@ -143,9 +143,9 @@ · 142 unmodified lines | ||
| 143 | 143 | reg = <0x8000 0x1000>; |
| 144 | 144 | cache-unified; |
| 145 | 145 | cache-level = <2>; |
| 146 | − arm,double-linefill-incr = <1>; | |
| 146 | + arm,double-linefill-incr = <0>; | |
| 147 | 147 | arm,double-linefill-wrap = <0>; |
| 148 | − arm,double-linefill = <1>; | |
| 148 | + arm,double-linefill = <0>; | |
| 149 | 149 | prefetch-data = <1>; |
| 150 | 150 | }; |
| 151 | 151 | |
| @@ -111,9 +111,9 @@ · 110 unmodified lines | ||
| 111 | 111 | reg = <0x8000 0x1000>; |
| 112 | 112 | cache-unified; |
| 113 | 113 | cache-level = <2>; |
| 114 | − arm,double-linefill-incr = <1>; | |
| 114 | + arm,double-linefill-incr = <0>; | |
| 115 | 115 | arm,double-linefill-wrap = <0>; |
| 116 | − arm,double-linefill = <1>; | |
| 116 | + arm,double-linefill = <0>; | |
| 117 | 117 | prefetch-data = <1>; |
| 118 | 118 | }; |
| 119 | 119 | |
| @@ -209,7 +209,8 @@ · 208 unmodified lines | ||
| 209 | 209 | interrupts = <0 80 4>; |
| 210 | 210 | pinctrl-names = "default"; |
| 211 | 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 | 214 | resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>, |
| 214 | 215 | <&mio_rst 12>; |
| 215 | 216 | }; |
| @@ -221,7 +222,8 @@ · 5 unmodified lines | ||
| 221 | 222 | interrupts = <0 81 4>; |
| 222 | 223 | pinctrl-names = "default"; |
| 223 | 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 | 227 | resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>, |
| 226 | 228 | <&mio_rst 13>; |
| 227 | 229 | }; |
| @@ -233,7 +235,8 @@ · 5 unmodified lines | ||
| 233 | 235 | interrupts = <0 82 4>; |
| 234 | 236 | pinctrl-names = "default"; |
| 235 | 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 | 240 | resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>, |
| 238 | 241 | <&mio_rst 14>; |
| 239 | 242 | }; |
| @@ -241,7 +241,8 @@ · 240 unmodified lines | ||
| 241 | 241 | interrupts = <0 80 4>; |
| 242 | 242 | pinctrl-names = "default"; |
| 243 | 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 | 246 | resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>, |
| 246 | 247 | <&mio_rst 12>; |
| 247 | 248 | }; |
| @@ -253,7 +254,8 @@ · 5 unmodified lines | ||
| 253 | 254 | interrupts = <0 81 4>; |
| 254 | 255 | pinctrl-names = "default"; |
| 255 | 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 | 259 | resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>, |
| 258 | 260 | <&mio_rst 13>; |
| 259 | 261 | }; |
| @@ -209,7 +209,8 @@ · 208 unmodified lines | ||
| 209 | 209 | interrupts = <0 80 4>; |
| 210 | 210 | pinctrl-names = "default"; |
| 211 | 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 | 214 | resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>, |
| 214 | 215 | <&mio_rst 12>; |
| 215 | 216 | }; |
| @@ -221,7 +222,8 @@ · 5 unmodified lines | ||
| 221 | 222 | interrupts = <0 81 4>; |
| 222 | 223 | pinctrl-names = "default"; |
| 223 | 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 | 227 | resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>, |
| 226 | 228 | <&mio_rst 13>; |
| 227 | 229 | }; |
| @@ -233,7 +235,8 @@ · 5 unmodified lines | ||
| 233 | 235 | interrupts = <0 82 4>; |
| 234 | 236 | pinctrl-names = "default"; |
| 235 | 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 | 240 | resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>, |
| 238 | 241 | <&mio_rst 14>; |
| 239 | 242 | }; |
| @@ -20,7 +20,6 @@ generic-y += simd.h · 19 unmodified lines | ||
| 20 | 20 | generic-y += sizes.h |
| 21 | 21 | generic-y += timex.h |
| 22 | 22 | generic-y += trace_clock.h |
| 23 | −generic-y += unaligned.h | |
| 24 | 23 | |
| 25 | 24 | generated-y += mach-types.h |
| 26 | 25 | generated-y += unistd-nr.h |
| @@ -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 */ | |
| @@ -227,7 +227,7 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu) · 226 unmodified lines | ||
| 227 | 227 | u32 return_offset = (is_thumb) ? 2 : 4; |
| 228 | 228 | |
| 229 | 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 | 232 | /* Branch to exception vector */ |
| 233 | 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 | */ |
| 240 | 240 | static 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 | 242 | u32 vect_offset; |
| 245 | − u32 return_offset = (is_thumb) ? 4 : 0; | |
| 243 | + u32 return_offset = (is_pabt) ? 4 : 8; | |
| 246 | 244 | bool is_lpae; |
| 247 | 245 | |
| 248 | 246 | kvm_update_psr(vcpu, ABT_MODE); |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | # Makefile for Kernel-based Virtual Machine module, HYP part |
| 4 | 4 | # |
| 5 | 5 | |
| 6 | −ccflags-y += -fno-stack-protector | |
| 6 | +ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING | |
| 7 | 7 | |
| 8 | 8 | KVM=../../../../virt/kvm |
| 9 | 9 | |
| @@ -299,7 +299,8 @@ · 298 unmodified lines | ||
| 299 | 299 | interrupts = <0 243 4>; |
| 300 | 300 | pinctrl-names = "default"; |
| 301 | 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 | 304 | resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 8>, |
| 304 | 305 | <&mio_rst 12>; |
| 305 | 306 | }; |
| @@ -311,7 +312,8 @@ · 5 unmodified lines | ||
| 311 | 312 | interrupts = <0 244 4>; |
| 312 | 313 | pinctrl-names = "default"; |
| 313 | 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 | 317 | resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 9>, |
| 316 | 318 | <&mio_rst 13>; |
| 317 | 319 | }; |
| @@ -323,7 +325,8 @@ · 5 unmodified lines | ||
| 323 | 325 | interrupts = <0 245 4>; |
| 324 | 326 | pinctrl-names = "default"; |
| 325 | 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 | 330 | resets = <&sys_rst 8>, <&mio_rst 7>, <&mio_rst 10>, |
| 328 | 331 | <&mio_rst 14>; |
| 329 | 332 | }; |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | # Makefile for Kernel-based Virtual Machine module, HYP part |
| 4 | 4 | # |
| 5 | 5 | |
| 6 | −ccflags-y += -fno-stack-protector | |
| 6 | +ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING | |
| 7 | 7 | |
| 8 | 8 | KVM=../../../../virt/kvm |
| 9 | 9 | |
| @@ -33,12 +33,26 @@ · 32 unmodified lines | ||
| 33 | 33 | #define LOWER_EL_AArch64_VECTOR 0x400 |
| 34 | 34 | #define LOWER_EL_AArch32_VECTOR 0x600 |
| 35 | 35 | |
| 36 | +/* | |
| 37 | + * Table taken from ARMv8 ARM DDI0487B-B, table G1-10. | |
| 38 | + */ | |
| 39 | +static const u8 return_offsets[8][2] = { | |
| 40 | + [0] = { 0, 0 }, /* Reset, unused */ | |
| 41 | + [1] = { 4, 2 }, /* Undefined */ | |
| 42 | + [2] = { 0, 0 }, /* SVC, unused */ | |
| 43 | + [3] = { 4, 4 }, /* Prefetch abort */ | |
| 44 | + [4] = { 8, 8 }, /* Data abort */ | |
| 45 | + [5] = { 0, 0 }, /* HVC, unused */ | |
| 46 | + [6] = { 4, 4 }, /* IRQ, unused */ | |
| 47 | + [7] = { 4, 4 }, /* FIQ, unused */ | |
| 48 | +}; | |
| 49 | + | |
| 36 | 50 | static void prepare_fault32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset) |
| 37 | 51 | { |
| 38 | 52 | unsigned long cpsr; |
| 39 | 53 | unsigned long new_spsr_value = *vcpu_cpsr(vcpu); |
| 40 | 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 | 56 | u32 sctlr = vcpu_cp15(vcpu, c1_SCTLR); |
| 43 | 57 | |
| 44 | 58 | cpsr = mode | COMPAT_PSR_I_BIT; |
| @@ -112,6 +112,8 @@ static inline void arch_acpi_set_pdc_bits(u32 *buf) · 111 unmodified lines | ||
| 112 | 112 | buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | +#define acpi_unlazy_tlb(x) | |
| 116 | + | |
| 115 | 117 | #ifdef CONFIG_ACPI_NUMA |
| 116 | 118 | extern cpumask_t early_cpu_possible_map; |
| 117 | 119 | #define for_each_possible_early_cpu(cpu) \ |
| @@ -1,4 +1,4 @@ | ||
| 1 | −{ | |
| 1 | +/ { | |
| 2 | 2 | images { |
| 3 | 3 | fdt@ni169445 { |
| 4 | 4 | description = "NI 169445 device tree"; |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <asm/fw/fw.h> |
| 21 | 21 | #include <asm/irq_cpu.h> |
| 22 | 22 | #include <asm/machine.h> |
| 23 | −#include <asm/mips-cpc.h> | |
| 23 | +#include <asm/mips-cps.h> | |
| 24 | 24 | #include <asm/prom.h> |
| 25 | 25 | #include <asm/smp-ops.h> |
| 26 | 26 | #include <asm/time.h> |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * Copyright (C) 2016 Imagination Technologies |
| 3 | − * Author: Marcin Nowakowski <marcin.nowakowski@imgtec.com> | |
| 3 | + * Author: Marcin Nowakowski <marcin.nowakowski@mips.com> | |
| 4 | 4 | * |
| 5 | 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | 6 | * under the terms of the GNU General Public License as published by the |
| @@ -142,8 +142,8 @@ GCR_ACCESSOR_RO(64, 0x000, config) · 141 unmodified lines | ||
| 142 | 142 | GCR_ACCESSOR_RW(64, 0x008, base) |
| 143 | 143 | #define CM_GCR_BASE_GCRBASE GENMASK_ULL(47, 15) |
| 144 | 144 | #define CM_GCR_BASE_CMDEFTGT GENMASK(1, 0) |
| 145 | −#define CM_GCR_BASE_CMDEFTGT_DISABLED 0 | |
| 146 | −#define CM_GCR_BASE_CMDEFTGT_MEM 1 | |
| 145 | +#define CM_GCR_BASE_CMDEFTGT_MEM 0 | |
| 146 | +#define CM_GCR_BASE_CMDEFTGT_RESERVED 1 | |
| 147 | 147 | #define CM_GCR_BASE_CMDEFTGT_IOCU0 2 |
| 148 | 148 | #define CM_GCR_BASE_CMDEFTGT_IOCU1 3 |
| 149 | 149 | |
| @@ -199,6 +199,10 @@ · 198 unmodified lines | ||
| 199 | 199 | sll k0, 3 /* extract cu0 bit */ |
| 200 | 200 | .set noreorder |
| 201 | 201 | bltz k0, 8f |
| 202 | + move k0, sp | |
| 203 | + .if \docfi | |
| 204 | + .cfi_register sp, k0 | |
| 205 | + .endif | |
| 202 | 206 | #ifdef CONFIG_EVA |
| 203 | 207 | /* |
| 204 | 208 | * Flush interAptiv's Return Prediction Stack (RPS) by writing |
| @@ -225,10 +229,6 @@ · 20 unmodified lines | ||
| 225 | 229 | MTC0 k0, CP0_ENTRYHI |
| 226 | 230 | #endif |
| 227 | 231 | .set reorder |
| 228 | − move k0, sp | |
| 229 | − .if \docfi | |
| 230 | − .cfi_register sp, k0 | |
| 231 | − .endif | |
| 232 | 232 | /* Called from user mode, new stack. */ |
| 233 | 233 | get_saved_sp docfi=\docfi tosp=1 |
| 234 | 234 | 8: |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * Copyright (C) 2016 Imagination Technologies |
| 3 | − * Author: Marcin Nowakowski <marcin.nowakowski@imgtec.com> | |
| 3 | + * Author: Marcin Nowakowski <marcin.nowakowski@mips.com> | |
| 4 | 4 | * |
| 5 | 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | 6 | * under the terms of the GNU General Public License as published by the |
| @@ -19,7 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | #undef DEBUG |
| 20 | 20 | |
| 21 | 21 | #include <linux/kernel.h> |
| 22 | −#include <linux/sched.h> | |
| 22 | +#include <linux/sched/task_stack.h> | |
| 23 | 23 | #include <linux/smp.h> |
| 24 | 24 | #include <linux/cpumask.h> |
| 25 | 25 | #include <linux/interrupt.h> |
| @@ -50,8 +50,8 @@ static void cmp_init_secondary(void) · 24 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | #ifdef CONFIG_MIPS_MT_SMP |
| 52 | 52 | if (cpu_has_mipsmt) |
| 53 | − c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & | |
| 54 | − TCBIND_CURVPE; | |
| 53 | + cpu_set_vpe_id(c, (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & | |
| 54 | + TCBIND_CURVPE); | |
| 55 | 55 | #endif |
| 56 | 56 | } |
| 57 | 57 | |
| @@ -306,7 +306,7 @@ static int cps_boot_secondary(int cpu, struct task_struct *idle) · 305 unmodified lines | ||
| 306 | 306 | int err; |
| 307 | 307 | |
| 308 | 308 | /* We don't yet support booting CPUs in other clusters */ |
| 309 | − if (cpu_cluster(&cpu_data[cpu]) != cpu_cluster(¤t_cpu_data)) | |
| 309 | + if (cpu_cluster(&cpu_data[cpu]) != cpu_cluster(&raw_current_cpu_data)) | |
| 310 | 310 | return -ENOSYS; |
| 311 | 311 | |
| 312 | 312 | vpe_cfg->pc = (unsigned long)&smp_bootstrap; |
| @@ -42,7 +42,7 @@ · 41 unmodified lines | ||
| 42 | 42 | #include <asm/processor.h> |
| 43 | 43 | #include <asm/idle.h> |
| 44 | 44 | #include <asm/r4k-timer.h> |
| 45 | −#include <asm/mips-cpc.h> | |
| 45 | +#include <asm/mips-cps.h> | |
| 46 | 46 | #include <asm/mmu_context.h> |
| 47 | 47 | #include <asm/time.h> |
| 48 | 48 | #include <asm/setup.h> |
| @@ -66,6 +66,7 @@ EXPORT_SYMBOL(cpu_sibling_map); · 17 unmodified lines | ||
| 66 | 66 | cpumask_t cpu_core_map[NR_CPUS] __read_mostly; |
| 67 | 67 | EXPORT_SYMBOL(cpu_core_map); |
| 68 | 68 | |
| 69 | +static DECLARE_COMPLETION(cpu_starting); | |
| 69 | 70 | static DECLARE_COMPLETION(cpu_running); |
| 70 | 71 | |
| 71 | 72 | /* |
| @@ -374,6 +375,12 @@ asmlinkage void start_secondary(void) · 302 unmodified lines | ||
| 374 | 375 | cpumask_set_cpu(cpu, &cpu_coherent_mask); |
| 375 | 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 | 384 | set_cpu_online(cpu, true); |
| 378 | 385 | |
| 379 | 386 | set_cpu_sibling_map(cpu); |
| @@ -381,8 +388,11 @@ asmlinkage void start_secondary(void) · 1 unmodified line | ||
| 381 | 388 | |
| 382 | 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 | 395 | complete(&cpu_running); |
| 385 | − synchronise_count_slave(cpu); | |
| 386 | 396 | |
| 387 | 397 | /* |
| 388 | 398 | * 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 | 455 | if (err) |
| 446 | 456 | return err; |
| 447 | 457 | |
| 448 | − /* | |
| 449 | − * We must check for timeout here, as the CPU will not be marked | |
| 450 | − * online until the counters are synchronised. | |
| 451 | − */ | |
| 452 | − if (!wait_for_completion_timeout(&cpu_running, | |
| 458 | + /* Wait for CPU to start and be ready to sync counters */ | |
| 459 | + if (!wait_for_completion_timeout(&cpu_starting, | |
| 453 | 460 | msecs_to_jiffies(1000))) { |
| 454 | 461 | pr_crit("CPU%u: failed to start\n", cpu); |
| 455 | 462 | return -EIO; |
| 456 | 463 | } |
| 457 | 464 | |
| 458 | 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 | 469 | return 0; |
| 460 | 470 | } |
| 461 | 471 | |
| @@ -80,7 +80,7 @@ static const struct insn const insn_table_MM[insn_invalid] = { · 79 unmodified lines | ||
| 80 | 80 | [insn_jr] = {M(mm_pool32a_op, 0, 0, 0, mm_jalr_op, mm_pool32axf_op), RS}, |
| 81 | 81 | [insn_lb] = {M(mm_lb32_op, 0, 0, 0, 0, 0), RT | RS | SIMM}, |
| 82 | 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 | 84 | [insn_ll] = {M(mm_pool32c_op, 0, 0, (mm_ll_func << 1), 0, 0), RS | RT | SIMM}, |
| 85 | 85 | [insn_lld] = {0, 0}, |
| 86 | 86 | [insn_lui] = {M(mm_pool32i_op, mm_lui_op, 0, 0, 0, 0), RS | SIMM}, |
| @@ -1513,7 +1513,7 @@ ld_skb_common: · 1512 unmodified lines | ||
| 1513 | 1513 | } |
| 1514 | 1514 | src = ebpf_to_mips_reg(ctx, insn, src_reg_no_fp); |
| 1515 | 1515 | if (src < 0) |
| 1516 | − return dst; | |
| 1516 | + return src; | |
| 1517 | 1517 | if (BPF_MODE(insn->code) == BPF_XADD) { |
| 1518 | 1518 | switch (BPF_SIZE(insn->code)) { |
| 1519 | 1519 | case BPF_W: |
| @@ -157,8 +157,8 @@ LABEL skip_ %I · 156 unmodified lines | ||
| 157 | 157 | .endr |
| 158 | 158 | |
| 159 | 159 | # Find min length |
| 160 | − vmovdqa _lens+0*16(state), %xmm0 | |
| 161 | − vmovdqa _lens+1*16(state), %xmm1 | |
| 160 | + vmovdqu _lens+0*16(state), %xmm0 | |
| 161 | + vmovdqu _lens+1*16(state), %xmm1 | |
| 162 | 162 | |
| 163 | 163 | vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A} |
| 164 | 164 | vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C} |
| @@ -178,8 +178,8 @@ LABEL skip_ %I · 13 unmodified lines | ||
| 178 | 178 | vpsubd %xmm2, %xmm0, %xmm0 |
| 179 | 179 | vpsubd %xmm2, %xmm1, %xmm1 |
| 180 | 180 | |
| 181 | − vmovdqa %xmm0, _lens+0*16(state) | |
| 182 | − vmovdqa %xmm1, _lens+1*16(state) | |
| 181 | + vmovdqu %xmm0, _lens+0*16(state) | |
| 182 | + vmovdqu %xmm1, _lens+1*16(state) | |
| 183 | 183 | |
| 184 | 184 | # "state" and "args" are the same address, arg1 |
| 185 | 185 | # len is arg2 |
| @@ -235,8 +235,8 @@ ENTRY(sha1_mb_mgr_get_comp_job_avx2) · 49 unmodified lines | ||
| 235 | 235 | jc .return_null |
| 236 | 236 | |
| 237 | 237 | # Find min length |
| 238 | − vmovdqa _lens(state), %xmm0 | |
| 239 | − vmovdqa _lens+1*16(state), %xmm1 | |
| 238 | + vmovdqu _lens(state), %xmm0 | |
| 239 | + vmovdqu _lens+1*16(state), %xmm1 | |
| 240 | 240 | |
| 241 | 241 | vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A} |
| 242 | 242 | vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C} |
| @@ -155,8 +155,8 @@ LABEL skip_ %I · 154 unmodified lines | ||
| 155 | 155 | .endr |
| 156 | 156 | |
| 157 | 157 | # Find min length |
| 158 | − vmovdqa _lens+0*16(state), %xmm0 | |
| 159 | − vmovdqa _lens+1*16(state), %xmm1 | |
| 158 | + vmovdqu _lens+0*16(state), %xmm0 | |
| 159 | + vmovdqu _lens+1*16(state), %xmm1 | |
| 160 | 160 | |
| 161 | 161 | vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A} |
| 162 | 162 | vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C} |
| @@ -176,8 +176,8 @@ LABEL skip_ %I · 13 unmodified lines | ||
| 176 | 176 | vpsubd %xmm2, %xmm0, %xmm0 |
| 177 | 177 | vpsubd %xmm2, %xmm1, %xmm1 |
| 178 | 178 | |
| 179 | − vmovdqa %xmm0, _lens+0*16(state) | |
| 180 | − vmovdqa %xmm1, _lens+1*16(state) | |
| 179 | + vmovdqu %xmm0, _lens+0*16(state) | |
| 180 | + vmovdqu %xmm1, _lens+1*16(state) | |
| 181 | 181 | |
| 182 | 182 | # "state" and "args" are the same address, arg1 |
| 183 | 183 | # len is arg2 |
| @@ -234,8 +234,8 @@ ENTRY(sha256_mb_mgr_get_comp_job_avx2) · 50 unmodified lines | ||
| 234 | 234 | jc .return_null |
| 235 | 235 | |
| 236 | 236 | # Find min length |
| 237 | − vmovdqa _lens(state), %xmm0 | |
| 238 | − vmovdqa _lens+1*16(state), %xmm1 | |
| 237 | + vmovdqu _lens(state), %xmm0 | |
| 238 | + vmovdqu _lens+1*16(state), %xmm1 | |
| 239 | 239 | |
| 240 | 240 | vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A} |
| 241 | 241 | vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C} |
| @@ -150,6 +150,8 @@ static inline void disable_acpi(void) { } · 149 unmodified lines | ||
| 150 | 150 | extern int x86_acpi_numa_init(void); |
| 151 | 151 | #endif /* CONFIG_ACPI_NUMA */ |
| 152 | 152 | |
| 153 | +#define acpi_unlazy_tlb(x) leave_mm(x) | |
| 154 | + | |
| 153 | 155 | #ifdef CONFIG_ACPI_APEI |
| 154 | 156 | static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr) |
| 155 | 157 | { |
| @@ -24,14 +24,6 @@ static DEFINE_MUTEX(mce_chrdev_read_mutex); · 23 unmodified lines | ||
| 24 | 24 | static char mce_helper[128]; |
| 25 | 25 | static 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 | 28 | * Lockless MCE logging infrastructure. |
| 37 | 29 | * 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 | 45 | void *data) |
| 54 | 46 | { |
| 55 | 47 | struct mce *mce = (struct mce *)data; |
| 56 | − unsigned int next, entry; | |
| 57 | − | |
| 58 | − wmb(); | |
| 59 | − for (;;) { | |
| 60 | − entry = mce_log_get_idx_check(mcelog.next); | |
| 61 | − for (;;) { | |
| 62 | − | |
| 63 | − /* | |
| 64 | − * When the buffer fills up discard new entries. | |
| 65 | − * Assume that the earlier errors are the more | |
| 66 | − * interesting ones: | |
| 67 | − */ | |
| 68 | − if (entry >= MCE_LOG_LEN) { | |
| 69 | − set_bit(MCE_OVERFLOW, | |
| 70 | − (unsigned long *)&mcelog.flags); | |
| 71 | − return NOTIFY_OK; | |
| 72 | − } | |
| 73 | − /* Old left over entry. Skip: */ | |
| 74 | − if (mcelog.entry[entry].finished) { | |
| 75 | − entry++; | |
| 76 | − continue; | |
| 77 | − } | |
| 78 | − break; | |
| 79 | − } | |
| 80 | − smp_rmb(); | |
| 81 | − next = entry + 1; | |
| 82 | − if (cmpxchg(&mcelog.next, entry, next) == entry) | |
| 83 | − break; | |
| 48 | + unsigned int entry; | |
| 49 | + | |
| 50 | + mutex_lock(&mce_chrdev_read_mutex); | |
| 51 | + | |
| 52 | + entry = mcelog.next; | |
| 53 | + | |
| 54 | + /* | |
| 55 | + * When the buffer fills up discard new entries. Assume that the | |
| 56 | + * earlier errors are the more interesting ones: | |
| 57 | + */ | |
| 58 | + if (entry >= MCE_LOG_LEN) { | |
| 59 | + set_bit(MCE_OVERFLOW, (unsigned long *)&mcelog.flags); | |
| 60 | + goto unlock; | |
| 84 | 61 | } |
| 62 | + | |
| 63 | + mcelog.next = entry + 1; | |
| 64 | + | |
| 85 | 65 | memcpy(mcelog.entry + entry, mce, sizeof(struct mce)); |
| 86 | − wmb(); | |
| 87 | 66 | mcelog.entry[entry].finished = 1; |
| 88 | − wmb(); | |
| 89 | 67 | |
| 90 | 68 | /* wake processes polling /dev/mcelog */ |
| 91 | 69 | wake_up_interruptible(&mce_chrdev_wait); |
| 92 | 70 | |
| 71 | +unlock: | |
| 72 | + mutex_unlock(&mce_chrdev_read_mutex); | |
| 73 | + | |
| 93 | 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 | 158 | return 0; |
| 178 | 159 | } |
| 179 | 160 | |
| 180 | −static void collect_tscs(void *data) | |
| 181 | −{ | |
| 182 | − unsigned long *cpu_tsc = (unsigned long *)data; | |
| 183 | − | |
| 184 | − cpu_tsc[smp_processor_id()] = rdtsc(); | |
| 185 | −} | |
| 186 | − | |
| 187 | 161 | static int mce_apei_read_done; |
| 188 | 162 | |
| 189 | 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 | 205 | size_t usize, loff_t *off) |
| 232 | 206 | { |
| 233 | 207 | char __user *buf = ubuf; |
| 234 | − unsigned long *cpu_tsc; | |
| 235 | − unsigned prev, next; | |
| 208 | + unsigned next; | |
| 236 | 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 | 211 | mutex_lock(&mce_chrdev_read_mutex); |
| 243 | 212 | |
| 244 | 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 | 216 | goto out; |
| 248 | 217 | } |
| 249 | 218 | |
| 250 | − next = mce_log_get_idx_check(mcelog.next); | |
| 251 | − | |
| 252 | 219 | /* Only supports full reads right now */ |
| 253 | 220 | err = -EINVAL; |
| 254 | 221 | if (*off != 0 || usize < MCE_LOG_LEN*sizeof(struct mce)) |
| 255 | 222 | goto out; |
| 256 | 223 | |
| 224 | + next = mcelog.next; | |
| 257 | 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); | |
| 274 | −timeout: | |
| 275 | − ; | |
| 276 | − } | |
| 277 | − | |
| 278 | − memset(mcelog.entry + prev, 0, | |
| 279 | − (next - prev) * sizeof(struct mce)); | |
| 280 | − prev = next; | |
| 281 | − next = cmpxchg(&mcelog.next, prev, 0); | |
| 282 | − } while (next != prev); | |
| 283 | − | |
| 284 | − synchronize_sched(); | |
| 285 | 226 | |
| 286 | − /* | |
| 287 | − * Collect entries that were still getting written before the | |
| 288 | − * synchronize. | |
| 289 | − */ | |
| 290 | − on_each_cpu(collect_tscs, cpu_tsc, 1); | |
| 291 | − | |
| 292 | − for (i = next; i < MCE_LOG_LEN; i++) { | |
| 227 | + for (i = 0; i < next; i++) { | |
| 293 | 228 | struct mce *m = &mcelog.entry[i]; |
| 294 | 229 | |
| 295 | − if (m->finished && m->tsc < cpu_tsc[m->cpu]) { | |
| 296 | − err |= copy_to_user(buf, m, sizeof(*m)); | |
| 297 | − smp_rmb(); | |
| 298 | − buf += sizeof(*m); | |
| 299 | − memset(m, 0, sizeof(*m)); | |
| 300 | − } | |
| 230 | + err |= copy_to_user(buf, m, sizeof(*m)); | |
| 231 | + buf += sizeof(*m); | |
| 301 | 232 | } |
| 302 | 233 | |
| 234 | + memset(mcelog.entry, 0, next * sizeof(struct mce)); | |
| 235 | + mcelog.next = 0; | |
| 236 | + | |
| 303 | 237 | if (err) |
| 304 | 238 | err = -EFAULT; |
| 305 | 239 | |
| 306 | 240 | out: |
| 307 | 241 | mutex_unlock(&mce_chrdev_read_mutex); |
| 308 | − kfree(cpu_tsc); | |
| 309 | 242 | |
| 310 | 243 | return err ? err : buf - ubuf; |
| 311 | 244 | } |
| @@ -79,7 +79,7 @@ static void kvm_get_wallclock(struct timespec *now) · 78 unmodified lines | ||
| 79 | 79 | |
| 80 | 80 | static int kvm_set_wallclock(const struct timespec *now) |
| 81 | 81 | { |
| 82 | − return -1; | |
| 82 | + return -ENODEV; | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | static u64 kvm_clock_read(void) |
| @@ -172,19 +172,27 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, · 171 unmodified lines | ||
| 172 | 172 | case R_X86_64_NONE: |
| 173 | 173 | break; |
| 174 | 174 | case R_X86_64_64: |
| 175 | + if (*(u64 *)loc != 0) | |
| 176 | + goto invalid_relocation; | |
| 175 | 177 | *(u64 *)loc = val; |
| 176 | 178 | break; |
| 177 | 179 | case R_X86_64_32: |
| 180 | + if (*(u32 *)loc != 0) | |
| 181 | + goto invalid_relocation; | |
| 178 | 182 | *(u32 *)loc = val; |
| 179 | 183 | if (val != *(u32 *)loc) |
| 180 | 184 | goto overflow; |
| 181 | 185 | break; |
| 182 | 186 | case R_X86_64_32S: |
| 187 | + if (*(s32 *)loc != 0) | |
| 188 | + goto invalid_relocation; | |
| 183 | 189 | *(s32 *)loc = val; |
| 184 | 190 | if ((s64)val != *(s32 *)loc) |
| 185 | 191 | goto overflow; |
| 186 | 192 | break; |
| 187 | 193 | case R_X86_64_PC32: |
| 194 | + if (*(u32 *)loc != 0) | |
| 195 | + goto invalid_relocation; | |
| 188 | 196 | val -= (u64)loc; |
| 189 | 197 | *(u32 *)loc = val; |
| 190 | 198 | #if 0 |
| @@ -200,6 +208,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, · 9 unmodified lines | ||
| 200 | 208 | } |
| 201 | 209 | return 0; |
| 202 | 210 | |
| 211 | +invalid_relocation: | |
| 212 | + pr_err("x86/modules: Skipping invalid relocation target, existing value is nonzero for type %d, loc %p, val %Lx\n", | |
| 213 | + (int)ELF64_R_TYPE(rel[i].r_info), loc, val); | |
| 214 | + return -ENOEXEC; | |
| 215 | + | |
| 203 | 216 | overflow: |
| 204 | 217 | pr_err("overflow in relocation type %d val %Lx\n", |
| 205 | 218 | (int)ELF64_R_TYPE(rel[i].r_info), val); |
| @@ -1992,6 +1992,11 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu, bool init_event) · 1991 unmodified lines | ||
| 1992 | 1992 | vcpu->arch.apic_base | MSR_IA32_APICBASE_BSP); |
| 1993 | 1993 | vcpu->arch.pv_eoi.msr_val = 0; |
| 1994 | 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 | 2001 | vcpu->arch.apic_arb_prio = 0; |
| 1997 | 2002 | vcpu->arch.apic_attention = 0; |
| @@ -5619,9 +5619,6 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) · 5618 unmodified lines | ||
| 5619 | 5619 | |
| 5620 | 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 | 5622 | if (vmx->vpid != 0) |
| 5626 | 5623 | vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid); |
| 5627 | 5624 | |
| @@ -40,7 +40,7 @@ static char sme_cmdline_off[] __initdata = "off"; · 39 unmodified lines | ||
| 40 | 40 | * section is later cleared. |
| 41 | 41 | */ |
| 42 | 42 | u64 sme_me_mask __section(.data) = 0; |
| 43 | −EXPORT_SYMBOL_GPL(sme_me_mask); | |
| 43 | +EXPORT_SYMBOL(sme_me_mask); | |
| 44 | 44 | |
| 45 | 45 | /* Buffer used for early in-place encryption by BSP, no locking needed */ |
| 46 | 46 | static char sme_early_buffer[PAGE_SIZE] __aligned(PAGE_SIZE); |
| @@ -85,6 +85,7 @@ void leave_mm(int cpu) · 84 unmodified lines | ||
| 85 | 85 | |
| 86 | 86 | switch_mm(NULL, &init_mm, NULL); |
| 87 | 87 | } |
| 88 | +EXPORT_SYMBOL_GPL(leave_mm); | |
| 88 | 89 | |
| 89 | 90 | void switch_mm(struct mm_struct *prev, struct mm_struct *next, |
| 90 | 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 | 196 | this_cpu_write(cpu_tlbstate.ctxs[new_asid].ctx_id, next->context.ctx_id); |
| 196 | 197 | this_cpu_write(cpu_tlbstate.ctxs[new_asid].tlb_gen, next_tlb_gen); |
| 197 | 198 | write_cr3(build_cr3(next, new_asid)); |
| 198 | − trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, | |
| 199 | − TLB_FLUSH_ALL); | |
| 199 | + | |
| 200 | + /* | |
| 201 | + * NB: This gets called via leave_mm() in the idle path | |
| 202 | + * where RCU functions differently. Tracing normally | |
| 203 | + * uses RCU, so we need to use the _rcuidle variant. | |
| 204 | + * | |
| 205 | + * (There is no good reason for this. The idle code should | |
| 206 | + * be rearranged to call this before rcu_idle_enter().) | |
| 207 | + */ | |
| 208 | + trace_tlb_flush_rcuidle(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL); | |
| 200 | 209 | } else { |
| 201 | 210 | /* The new ASID is already up to date. */ |
| 202 | 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 | 217 | this_cpu_write(cpu_tlbstate.loaded_mm, next); |
| @@ -363,7 +363,7 @@ static int crypto_ccm_decrypt(struct aead_request *req) · 362 unmodified lines | ||
| 363 | 363 | unsigned int cryptlen = req->cryptlen; |
| 364 | 364 | u8 *authtag = pctx->auth_tag; |
| 365 | 365 | u8 *odata = pctx->odata; |
| 366 | − u8 *iv = req->iv; | |
| 366 | + u8 *iv = pctx->idata; | |
| 367 | 367 | int err; |
| 368 | 368 | |
| 369 | 369 | cryptlen -= authsize; |
| @@ -379,6 +379,8 @@ static int crypto_ccm_decrypt(struct aead_request *req) · 9 unmodified lines | ||
| 379 | 379 | if (req->src != req->dst) |
| 380 | 380 | dst = pctx->dst; |
| 381 | 381 | |
| 382 | + memcpy(iv, req->iv, 16); | |
| 383 | + | |
| 382 | 384 | skcipher_request_set_tfm(skreq, ctx->ctr); |
| 383 | 385 | skcipher_request_set_callback(skreq, pctx->flags, |
| 384 | 386 | crypto_ccm_decrypt_done, req); |
| @@ -710,6 +710,8 @@ static DEFINE_RAW_SPINLOCK(c3_lock); · 709 unmodified lines | ||
| 710 | 710 | static void acpi_idle_enter_bm(struct acpi_processor *pr, |
| 711 | 711 | struct acpi_processor_cx *cx, bool timer_bc) |
| 712 | 712 | { |
| 713 | + acpi_unlazy_tlb(smp_processor_id()); | |
| 714 | + | |
| 713 | 715 | /* |
| 714 | 716 | * Must be done before busmaster disable as we might need to |
| 715 | 717 | * access HPET ! |
| @@ -160,6 +160,14 @@ static int __init init_nvs_nosave(const struct dmi_system_id *d) · 159 unmodified lines | ||
| 160 | 160 | return 0; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | +static bool acpi_sleep_no_lps0; | |
| 164 | + | |
| 165 | +static int __init init_no_lps0(const struct dmi_system_id *d) | |
| 166 | +{ | |
| 167 | + acpi_sleep_no_lps0 = true; | |
| 168 | + return 0; | |
| 169 | +} | |
| 170 | + | |
| 163 | 171 | static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { |
| 164 | 172 | { |
| 165 | 173 | .callback = init_old_suspend_ordering, |
| @@ -343,6 +351,19 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { · 177 unmodified lines | ||
| 343 | 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 | 507 | #else /* !CONFIG_ACPI_SLEEP */ |
| 487 | 508 | #define acpi_target_sleep_state ACPI_STATE_S0 |
| 509 | +#define acpi_sleep_no_lps0 (false) | |
| 488 | 510 | static inline void acpi_sleep_dmi_check(void) {} |
| 489 | 511 | #endif /* CONFIG_ACPI_SLEEP */ |
| 490 | 512 | |
| @@ -863,6 +885,12 @@ static int lps0_device_attach(struct acpi_device *adev, · 372 unmodified lines | ||
| 863 | 885 | if (lps0_device_handle) |
| 864 | 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 | 894 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) |
| 867 | 895 | return 0; |
| 868 | 896 | |
| @@ -34,13 +34,14 @@ lib-y := efi-stub-helper.o gop.o secureboot.o · 33 unmodified lines | ||
| 34 | 34 | lib-$(CONFIG_RESET_ATTACK_MITIGATION) += tpm.o |
| 35 | 35 | |
| 36 | 36 | # include the stub's generic dependencies from lib/ when building for ARM/arm64 |
| 37 | −arm-deps := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c fdt_sw.c sort.c | |
| 37 | +arm-deps-y := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c fdt_sw.c | |
| 38 | +arm-deps-$(CONFIG_ARM64) += sort.c | |
| 38 | 39 | |
| 39 | 40 | $(obj)/lib-%.o: $(srctree)/lib/%.c FORCE |
| 40 | 41 | $(call if_changed_rule,cc_o_c) |
| 41 | 42 | |
| 42 | 43 | lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o string.o random.o \ |
| 43 | − $(patsubst %.c,lib-%.o,$(arm-deps)) | |
| 44 | + $(patsubst %.c,lib-%.o,$(arm-deps-y)) | |
| 44 | 45 | |
| 45 | 46 | lib-$(CONFIG_ARM) += arm32-stub.o |
| 46 | 47 | lib-$(CONFIG_ARM64) += arm64-stub.o |
| @@ -91,5 +92,4 @@ quiet_cmd_stubcopy = STUBCPY $@ · 44 unmodified lines | ||
| 91 | 92 | # explicitly by the decompressor linker script. |
| 92 | 93 | # |
| 93 | 94 | STUBCOPY_FLAGS-$(CONFIG_ARM) += --rename-section .data=.data.efistub |
| 94 | −STUBCOPY_RM-$(CONFIG_ARM) += -R ___ksymtab+sort -R ___kcrctab+sort | |
| 95 | 95 | STUBCOPY_RELOC-$(CONFIG_ARM) := R_ARM_ABS |
| @@ -350,7 +350,9 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size, · 349 unmodified lines | ||
| 350 | 350 | * The easiest way to find adjacent regions is to sort the memory map |
| 351 | 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 | 357 | for (l = 0; l < map_size; l += desc_size, prev = in) { |
| 356 | 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 | 369 | * a 4k page size kernel to kexec a 64k page size kernel and |
| 368 | 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 | 374 | !regions_have_compatible_memory_type_attrs(prev, in)) { |
| 372 | 375 | |
| 373 | 376 | paddr = round_down(in->phys_addr, SZ_64K); |
| @@ -867,11 +867,16 @@ static void msf_from_bcd(struct atapi_msf *msf) · 866 unmodified lines | ||
| 867 | 867 | int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense) |
| 868 | 868 | { |
| 869 | 869 | struct cdrom_info *info = drive->driver_data; |
| 870 | − struct cdrom_device_info *cdi = &info->devinfo; | |
| 870 | + struct cdrom_device_info *cdi; | |
| 871 | 871 | unsigned char cmd[BLK_MAX_CDB]; |
| 872 | 872 | |
| 873 | 873 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
| 874 | 874 | |
| 875 | + if (!info) | |
| 876 | + return -EIO; | |
| 877 | + | |
| 878 | + cdi = &info->devinfo; | |
| 879 | + | |
| 875 | 880 | memset(cmd, 0, BLK_MAX_CDB); |
| 876 | 881 | cmd[0] = GPCMD_TEST_UNIT_READY; |
| 877 | 882 | |
| @@ -913,15 +913,16 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev, · 912 unmodified lines | ||
| 913 | 913 | struct cpuidle_state *state = &drv->states[index]; |
| 914 | 914 | unsigned long eax = flg2MWAIT(state->flags); |
| 915 | 915 | unsigned int cstate; |
| 916 | + int cpu = smp_processor_id(); | |
| 916 | 917 | |
| 917 | 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 transition | |
| 921 | − * will probably flush the TLB. It's not guaranteed to flush | |
| 922 | − * the TLB, though, so it's not clear that we can do anything | |
| 923 | − * useful with this knowledge. | |
| 921 | + * leave_mm() to avoid costly and often unnecessary wakeups | |
| 922 | + * for flushing the user TLB's associated with the active mm. | |
| 924 | 923 | */ |
| 924 | + if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED) | |
| 925 | + leave_mm(cpu); | |
| 925 | 926 | |
| 926 | 927 | if (!(lapic_timer_reliable_states & (1 << (cstate)))) |
| 927 | 928 | tick_broadcast_enter(); |
| @@ -255,6 +255,7 @@ void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *k · 254 unmodified lines | ||
| 255 | 255 | |
| 256 | 256 | case KE_VSW: |
| 257 | 257 | input_report_switch(dev, ke->sw.code, value); |
| 258 | + input_sync(dev); | |
| 258 | 259 | break; |
| 259 | 260 | } |
| 260 | 261 | } |
| @@ -117,6 +117,7 @@ static int ar1021_i2c_probe(struct i2c_client *client, · 116 unmodified lines | ||
| 117 | 117 | input->open = ar1021_i2c_open; |
| 118 | 118 | input->close = ar1021_i2c_close; |
| 119 | 119 | |
| 120 | + __set_bit(INPUT_PROP_DIRECT, input->propbit); | |
| 120 | 121 | input_set_capability(input, EV_KEY, BTN_TOUCH); |
| 121 | 122 | input_set_abs_params(input, ABS_X, 0, AR1021_MAX_X, 0, 0); |
| 122 | 123 | input_set_abs_params(input, ABS_Y, 0, AR1021_MAX_Y, 0, 0); |
| @@ -194,6 +194,7 @@ static int mvebu_gicp_probe(struct platform_device *pdev) · 193 unmodified lines | ||
| 194 | 194 | return -ENOMEM; |
| 195 | 195 | |
| 196 | 196 | gicp->dev = &pdev->dev; |
| 197 | + spin_lock_init(&gicp->spi_lock); | |
| 197 | 198 | |
| 198 | 199 | gicp->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 199 | 200 | if (!gicp->res) |
| @@ -2046,6 +2046,7 @@ static int bond_miimon_inspect(struct bonding *bond) · 2045 unmodified lines | ||
| 2046 | 2046 | |
| 2047 | 2047 | bond_for_each_slave_rcu(bond, slave, iter) { |
| 2048 | 2048 | slave->new_link = BOND_LINK_NOCHANGE; |
| 2049 | + slave->link_new_state = slave->link; | |
| 2049 | 2050 | |
| 2050 | 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 | 3268 | hash ^= (hash >> 16); |
| 3268 | 3269 | hash ^= (hash >> 8); |
| 3269 | 3270 | |
| 3270 | − return hash; | |
| 3271 | + return hash >> 1; | |
| 3271 | 3272 | } |
| 3272 | 3273 | |
| 3273 | 3274 | /*-------------------------- Device entry points ----------------------------*/ |
| @@ -37,7 +37,7 @@ · 36 unmodified lines | ||
| 37 | 37 | |
| 38 | 38 | #define T4FW_VERSION_MAJOR 0x01 |
| 39 | 39 | #define T4FW_VERSION_MINOR 0x10 |
| 40 | −#define T4FW_VERSION_MICRO 0x2D | |
| 40 | +#define T4FW_VERSION_MICRO 0x3F | |
| 41 | 41 | #define T4FW_VERSION_BUILD 0x00 |
| 42 | 42 | |
| 43 | 43 | #define T4FW_MIN_VERSION_MAJOR 0x01 |
| @@ -46,7 +46,7 @@ · 2 unmodified lines | ||
| 46 | 46 | |
| 47 | 47 | #define T5FW_VERSION_MAJOR 0x01 |
| 48 | 48 | #define T5FW_VERSION_MINOR 0x10 |
| 49 | −#define T5FW_VERSION_MICRO 0x2D | |
| 49 | +#define T5FW_VERSION_MICRO 0x3F | |
| 50 | 50 | #define T5FW_VERSION_BUILD 0x00 |
| 51 | 51 | |
| 52 | 52 | #define T5FW_MIN_VERSION_MAJOR 0x00 |
| @@ -55,7 +55,7 @@ · 2 unmodified lines | ||
| 55 | 55 | |
| 56 | 56 | #define T6FW_VERSION_MAJOR 0x01 |
| 57 | 57 | #define T6FW_VERSION_MINOR 0x10 |
| 58 | −#define T6FW_VERSION_MICRO 0x2D | |
| 58 | +#define T6FW_VERSION_MICRO 0x3F | |
| 59 | 59 | #define T6FW_VERSION_BUILD 0x00 |
| 60 | 60 | |
| 61 | 61 | #define T6FW_MIN_VERSION_MAJOR 0x00 |
| @@ -6941,6 +6941,9 @@ static int mvpp2_irqs_init(struct mvpp2_port *port) · 6940 unmodified lines | ||
| 6941 | 6941 | for (i = 0; i < port->nqvecs; i++) { |
| 6942 | 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 | 6947 | err = request_irq(qv->irq, mvpp2_isr, 0, port->dev->name, qv); |
| 6945 | 6948 | if (err) |
| 6946 | 6949 | goto err; |
| @@ -6970,6 +6973,7 @@ static void mvpp2_irqs_deinit(struct mvpp2_port *port) · 23 unmodified lines | ||
| 6970 | 6973 | struct mvpp2_queue_vector *qv = port->qvecs + i; |
| 6971 | 6974 | |
| 6972 | 6975 | irq_set_affinity_hint(qv->irq, NULL); |
| 6976 | + irq_clear_status_flags(qv->irq, IRQ_NO_BALANCING); | |
| 6973 | 6977 | free_irq(qv->irq, qv); |
| 6974 | 6978 | } |
| 6975 | 6979 | } |
| @@ -365,21 +365,24 @@ static void mlx5e_execute_l2_action(struct mlx5e_priv *priv, · 364 unmodified lines | ||
| 365 | 365 | struct mlx5e_l2_hash_node *hn) |
| 366 | 366 | { |
| 367 | 367 | u8 action = hn->action; |
| 368 | + u8 mac_addr[ETH_ALEN]; | |
| 368 | 369 | int l2_err = 0; |
| 369 | 370 | |
| 371 | + ether_addr_copy(mac_addr, hn->ai.addr); | |
| 372 | + | |
| 370 | 373 | switch (action) { |
| 371 | 374 | case MLX5E_ACTION_ADD: |
| 372 | 375 | mlx5e_add_l2_flow_rule(priv, &hn->ai, MLX5E_FULLMATCH); |
| 373 | − if (!is_multicast_ether_addr(hn->ai.addr)) { | |
| 374 | − l2_err = mlx5_mpfs_add_mac(priv->mdev, hn->ai.addr); | |
| 376 | + if (!is_multicast_ether_addr(mac_addr)) { | |
| 377 | + l2_err = mlx5_mpfs_add_mac(priv->mdev, mac_addr); | |
| 375 | 378 | hn->mpfs = !l2_err; |
| 376 | 379 | } |
| 377 | 380 | hn->action = MLX5E_ACTION_NONE; |
| 378 | 381 | break; |
| 379 | 382 | |
| 380 | 383 | case MLX5E_ACTION_DEL: |
| 381 | − if (!is_multicast_ether_addr(hn->ai.addr) && hn->mpfs) | |
| 382 | − l2_err = mlx5_mpfs_del_mac(priv->mdev, hn->ai.addr); | |
| 384 | + if (!is_multicast_ether_addr(mac_addr) && hn->mpfs) | |
| 385 | + l2_err = mlx5_mpfs_del_mac(priv->mdev, mac_addr); | |
| 383 | 386 | mlx5e_del_l2_flow_rule(priv, &hn->ai); |
| 384 | 387 | mlx5e_del_l2_from_hash(hn); |
| 385 | 388 | break; |
| @@ -387,7 +390,7 @@ static void mlx5e_execute_l2_action(struct mlx5e_priv *priv, · 1 unmodified line | ||
| 387 | 390 | |
| 388 | 391 | if (l2_err) |
| 389 | 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 | |
| 393 | 396 | static void mlx5e_sync_netdev_addr(struct mlx5e_priv *priv) |
| @@ -626,7 +626,7 @@ static int asix_suspend(struct usb_interface *intf, pm_message_t message) · 625 unmodified lines | ||
| 626 | 626 | struct usbnet *dev = usb_get_intfdata(intf); |
| 627 | 627 | struct asix_common_private *priv = dev->driver_priv; |
| 628 | 628 | |
| 629 | − if (priv->suspend) | |
| 629 | + if (priv && priv->suspend) | |
| 630 | 630 | priv->suspend(dev); |
| 631 | 631 | |
| 632 | 632 | return usbnet_suspend(intf, message); |
| @@ -678,7 +678,7 @@ static int asix_resume(struct usb_interface *intf) · 45 unmodified lines | ||
| 678 | 678 | struct usbnet *dev = usb_get_intfdata(intf); |
| 679 | 679 | struct asix_common_private *priv = dev->driver_priv; |
| 680 | 680 | |
| 681 | − if (priv->resume) | |
| 681 | + if (priv && priv->resume) | |
| 682 | 682 | priv->resume(dev); |
| 683 | 683 | |
| 684 | 684 | return usbnet_resume(intf); |
| @@ -230,7 +230,7 @@ skip: · 229 unmodified lines | ||
| 230 | 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 | 234 | dev->hard_mtu = le16_to_cpu(info->ether->wMaxSegmentSize); |
| 235 | 235 | /* because of Zaurus, we may be ignoring the host |
| 236 | 236 | * side link address we were given. |
| @@ -499,6 +499,7 @@ static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb) · 498 unmodified lines | ||
| 499 | 499 | return 1; |
| 500 | 500 | } |
| 501 | 501 | if (rawip) { |
| 502 | + skb_reset_mac_header(skb); | |
| 502 | 503 | skb->dev = dev->net; /* normally set by eth_type_trans */ |
| 503 | 504 | skb->protocol = proto; |
| 504 | 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 | 684 | /* errors aren't fatal - we can live with the dynamic address */ |
| 684 | − if (cdc_ether) { | |
| 685 | + if (cdc_ether && cdc_ether->wMaxSegmentSize) { | |
| 685 | 686 | dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize); |
| 686 | 687 | usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress); |
| 687 | 688 | } |
| @@ -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 | 2687 | sdev->sdev_state = state; |
| 2688 | − sysfs_notify(&sdev->sdev_gendev.kobj, NULL, "state"); | |
| 2689 | 2688 | return 0; |
| 2690 | 2689 | |
| 2691 | 2690 | illegal: |
| @@ -3109,7 +3108,6 @@ int scsi_internal_device_unblock_nowait(struct scsi_device *sdev, · 417 unmodified lines | ||
| 3109 | 3108 | case SDEV_BLOCK: |
| 3110 | 3109 | case SDEV_TRANSPORT_OFFLINE: |
| 3111 | 3110 | sdev->sdev_state = new_state; |
| 3112 | − sysfs_notify(&sdev->sdev_gendev.kobj, NULL, "state"); | |
| 3113 | 3111 | break; |
| 3114 | 3112 | case SDEV_CREATED_BLOCK: |
| 3115 | 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 | 3115 | sdev->sdev_state = new_state; |
| 3118 | 3116 | else |
| 3119 | 3117 | sdev->sdev_state = SDEV_CREATED; |
| 3120 | − sysfs_notify(&sdev->sdev_gendev.kobj, NULL, "state"); | |
| 3121 | 3118 | break; |
| 3122 | 3119 | case SDEV_CANCEL: |
| 3123 | 3120 | case SDEV_OFFLINE: |
| @@ -556,11 +556,8 @@ int srp_reconnect_rport(struct srp_rport *rport) · 555 unmodified lines | ||
| 556 | 556 | */ |
| 557 | 557 | shost_for_each_device(sdev, shost) { |
| 558 | 558 | mutex_lock(&sdev->state_mutex); |
| 559 | − if (sdev->sdev_state == SDEV_OFFLINE) { | |
| 559 | + if (sdev->sdev_state == SDEV_OFFLINE) | |
| 560 | 560 | sdev->sdev_state = SDEV_RUNNING; |
| 561 | − sysfs_notify(&sdev->sdev_gendev.kobj, | |
| 562 | − NULL, "state"); | |
| 563 | − } | |
| 564 | 561 | mutex_unlock(&sdev->state_mutex); |
| 565 | 562 | } |
| 566 | 563 | } else if (rport->state == SRP_RPORT_RUNNING) { |
| @@ -191,13 +191,13 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 190 unmodified lines | ||
| 191 | 191 | asm("%c0:\n\t" \ |
| 192 | 192 | ".pushsection .discard.reachable\n\t" \ |
| 193 | 193 | ".long %c0b - .\n\t" \ |
| 194 | − ".popsection\n\t" : : "i" (__LINE__)); \ | |
| 194 | + ".popsection\n\t" : : "i" (__COUNTER__)); \ | |
| 195 | 195 | }) |
| 196 | 196 | #define annotate_unreachable() ({ \ |
| 197 | 197 | asm("%c0:\n\t" \ |
| 198 | 198 | ".pushsection .discard.unreachable\n\t" \ |
| 199 | 199 | ".long %c0b - .\n\t" \ |
| 200 | − ".popsection\n\t" : : "i" (__LINE__)); \ | |
| 200 | + ".popsection\n\t" : : "i" (__COUNTER__)); \ | |
| 201 | 201 | }) |
| 202 | 202 | #define ASM_UNREACHABLE \ |
| 203 | 203 | "999:\n\t" \ |
| @@ -3841,6 +3841,13 @@ static inline void nf_reset_trace(struct sk_buff *skb) · 3840 unmodified lines | ||
| 3841 | 3841 | #endif |
| 3842 | 3842 | } |
| 3843 | 3843 | |
| 3844 | +static inline void ipvs_reset(struct sk_buff *skb) | |
| 3845 | +{ | |
| 3846 | +#if IS_ENABLED(CONFIG_IP_VS) | |
| 3847 | + skb->ipvs_property = 0; | |
| 3848 | +#endif | |
| 3849 | +} | |
| 3850 | + | |
| 3844 | 3851 | /* Note: This doesn't put any conntrack and bridge info in dst. */ |
| 3845 | 3852 | static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src, |
| 3846 | 3853 | bool copy) |
| @@ -14,7 +14,6 @@ · 13 unmodified lines | ||
| 14 | 14 | struct tcf_idrinfo { |
| 15 | 15 | spinlock_t lock; |
| 16 | 16 | struct idr action_idr; |
| 17 | − struct net *net; | |
| 18 | 17 | }; |
| 19 | 18 | |
| 20 | 19 | struct tc_action_ops; |
| @@ -105,7 +104,7 @@ struct tc_action_net { · 84 unmodified lines | ||
| 105 | 104 | |
| 106 | 105 | static inline |
| 107 | 106 | int tc_action_net_init(struct tc_action_net *tn, |
| 108 | − const struct tc_action_ops *ops, struct net *net) | |
| 107 | + const struct tc_action_ops *ops) | |
| 109 | 108 | { |
| 110 | 109 | int err = 0; |
| 111 | 110 | |
| @@ -113,7 +112,6 @@ int tc_action_net_init(struct tc_action_net *tn, · 1 unmodified line | ||
| 113 | 112 | if (!tn->idrinfo) |
| 114 | 113 | return -ENOMEM; |
| 115 | 114 | tn->ops = ops; |
| 116 | − tn->idrinfo->net = net; | |
| 117 | 115 | spin_lock_init(&tn->idrinfo->lock); |
| 118 | 116 | idr_init(&tn->idrinfo->action_idr); |
| 119 | 117 | return err; |
| @@ -231,6 +231,7 @@ struct tcf_exts { · 230 unmodified lines | ||
| 231 | 231 | __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ |
| 232 | 232 | int nr_actions; |
| 233 | 233 | struct tc_action **actions; |
| 234 | + struct net *net; | |
| 234 | 235 | #endif |
| 235 | 236 | /* Map to export classifier specific extension TLV types to the |
| 236 | 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 | 245 | #ifdef CONFIG_NET_CLS_ACT |
| 245 | 246 | exts->type = 0; |
| 246 | 247 | exts->nr_actions = 0; |
| 248 | + exts->net = NULL; | |
| 247 | 249 | exts->actions = kcalloc(TCA_ACT_MAX_PRIO, sizeof(struct tc_action *), |
| 248 | 250 | GFP_KERNEL); |
| 249 | 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 | 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 | + */ | |
| 263 | +static inline bool tcf_exts_get_net(struct tcf_exts *exts) | |
| 264 | +{ | |
| 265 | +#ifdef CONFIG_NET_CLS_ACT | |
| 266 | + exts->net = maybe_get_net(exts->net); | |
| 267 | + return exts->net != NULL; | |
| 268 | +#else | |
| 269 | + return true; | |
| 270 | +#endif | |
| 271 | +} | |
| 272 | + | |
| 273 | +static inline void tcf_exts_put_net(struct tcf_exts *exts) | |
| 274 | +{ | |
| 275 | +#ifdef CONFIG_NET_CLS_ACT | |
| 276 | + if (exts->net) | |
| 277 | + put_net(exts->net); | |
| 278 | +#endif | |
| 279 | +} | |
| 280 | + | |
| 257 | 281 | static inline void tcf_exts_to_list(const struct tcf_exts *exts, |
| 258 | 282 | struct list_head *actions) |
| 259 | 283 | { |
| @@ -49,7 +49,8 @@ typedef union snd_seq_timestamp snd_seq_timestamp_t; · 48 unmodified lines | ||
| 49 | 49 | #define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 200 |
| 50 | 50 | |
| 51 | 51 | /* max delivery path length */ |
| 52 | −#define SNDRV_SEQ_MAX_HOPS 10 | |
| 52 | +/* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */ | |
| 53 | +#define SNDRV_SEQ_MAX_HOPS 8 | |
| 53 | 54 | |
| 54 | 55 | /* max size of event size */ |
| 55 | 56 | #define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff |
| @@ -90,6 +90,8 @@ struct snd_timer { · 89 unmodified lines | ||
| 90 | 90 | struct list_head ack_list_head; |
| 91 | 91 | struct list_head sack_list_head; /* slow ack list head */ |
| 92 | 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 | |
| 95 | 97 | struct snd_timer_instance { |
| @@ -94,7 +94,7 @@ enum { · 93 unmodified lines | ||
| 94 | 94 | SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */ |
| 95 | 95 | SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */ |
| 96 | 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 | 98 | SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */ |
| 99 | 99 | SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */ |
| 100 | 100 | SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ |
| @@ -384,7 +384,7 @@ struct snd_mask { · 283 unmodified lines | ||
| 384 | 384 | |
| 385 | 385 | struct snd_pcm_hw_params { |
| 386 | 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 | 388 | SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; |
| 389 | 389 | struct snd_mask mres[5]; /* reserved masks */ |
| 390 | 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 | 857 | #define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ |
| 858 | 858 | #define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ |
| 859 | 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 | 861 | #define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ |
| 862 | 862 | /* bits 30 and 31 are obsoleted (for indirect access) */ |
| 863 | 863 | |
| @@ -901,9 +901,11 @@ list_update_cgroup_event(struct perf_event *event, · 900 unmodified lines | ||
| 901 | 901 | cpuctx_entry = &cpuctx->cgrp_cpuctx_entry; |
| 902 | 902 | /* cpuctx->cgrp is NULL unless a cgroup event is active in this CPU .*/ |
| 903 | 903 | if (add) { |
| 904 | + struct perf_cgroup *cgrp = perf_cgroup_from_task(current, ctx); | |
| 905 | + | |
| 904 | 906 | list_add(cpuctx_entry, this_cpu_ptr(&cgrp_cpuctx_list)); |
| 905 | − if (perf_cgroup_from_task(current, ctx) == event->cgrp) | |
| 906 | − cpuctx->cgrp = event->cgrp; | |
| 907 | + if (cgroup_is_descendant(cgrp->css.cgroup, event->cgrp->css.cgroup)) | |
| 908 | + cpuctx->cgrp = cgrp; | |
| 907 | 909 | } else { |
| 908 | 910 | list_del(cpuctx_entry); |
| 909 | 911 | cpuctx->cgrp = NULL; |
| @@ -903,11 +903,27 @@ void exit_pi_state_list(struct task_struct *curr) · 902 unmodified lines | ||
| 903 | 903 | */ |
| 904 | 904 | raw_spin_lock_irq(&curr->pi_lock); |
| 905 | 905 | while (!list_empty(head)) { |
| 906 | − | |
| 907 | 906 | next = head->next; |
| 908 | 907 | pi_state = list_entry(next, struct futex_pi_state, list); |
| 909 | 908 | key = pi_state->key; |
| 910 | 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 | 927 | raw_spin_unlock_irq(&curr->pi_lock); |
| 912 | 928 | |
| 913 | 929 | spin_lock(&hb->lock); |
| @@ -918,8 +934,10 @@ void exit_pi_state_list(struct task_struct *curr) · 4 unmodified lines | ||
| 918 | 934 | * task still owns the PI-state: |
| 919 | 935 | */ |
| 920 | 936 | if (head->next != next) { |
| 937 | + /* retain curr->pi_lock for the loop invariant */ | |
| 921 | 938 | raw_spin_unlock(&pi_state->pi_mutex.wait_lock); |
| 922 | 939 | spin_unlock(&hb->lock); |
| 940 | + put_pi_state(pi_state); | |
| 923 | 941 | continue; |
| 924 | 942 | } |
| 925 | 943 | |
| @@ -927,9 +945,8 @@ void exit_pi_state_list(struct task_struct *curr) · 1 unmodified line | ||
| 927 | 945 | WARN_ON(list_empty(&pi_state->list)); |
| 928 | 946 | list_del_init(&pi_state->list); |
| 929 | 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 | 950 | raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); |
| 934 | 951 | spin_unlock(&hb->lock); |
| 935 | 952 | |
| @@ -649,6 +649,7 @@ static int sugov_start(struct cpufreq_policy *policy) · 648 unmodified lines | ||
| 649 | 649 | struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu); |
| 650 | 650 | |
| 651 | 651 | memset(sg_cpu, 0, sizeof(*sg_cpu)); |
| 652 | + sg_cpu->cpu = cpu; | |
| 652 | 653 | sg_cpu->sg_policy = sg_policy; |
| 653 | 654 | sg_cpu->flags = SCHED_CPUFREQ_RT; |
| 654 | 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 | |
| 715 | 716 | static 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 | 718 | return cpufreq_register_governor(&schedutil_gov); |
| 723 | 719 | } |
| 724 | 720 | fs_initcall(sugov_register); |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #define pr_fmt(fmt) "NMI watchdog: " fmt |
| 14 | 14 | |
| 15 | 15 | #include <linux/nmi.h> |
| 16 | +#include <linux/atomic.h> | |
| 16 | 17 | #include <linux/module.h> |
| 17 | 18 | #include <linux/sched/debug.h> |
| 18 | 19 | |
| @@ -22,10 +23,11 @@ · 3 unmodified lines | ||
| 22 | 23 | static DEFINE_PER_CPU(bool, hard_watchdog_warn); |
| 23 | 24 | static DEFINE_PER_CPU(bool, watchdog_nmi_touch); |
| 24 | 25 | static DEFINE_PER_CPU(struct perf_event *, watchdog_ev); |
| 26 | +static DEFINE_PER_CPU(struct perf_event *, dead_event); | |
| 25 | 27 | static struct cpumask dead_events_mask; |
| 26 | 28 | |
| 27 | 29 | static unsigned long hardlockup_allcpu_dumped; |
| 28 | −static unsigned int watchdog_cpus; | |
| 30 | +static atomic_t watchdog_cpus = ATOMIC_INIT(0); | |
| 29 | 31 | |
| 30 | 32 | void arch_touch_nmi_watchdog(void) |
| 31 | 33 | { |
| @@ -189,7 +191,8 @@ void hardlockup_detector_perf_enable(void) · 157 unmodified lines | ||
| 189 | 191 | if (hardlockup_detector_event_create()) |
| 190 | 192 | return; |
| 191 | 193 | |
| 192 | − if (!watchdog_cpus++) | |
| 194 | + /* use original value for check */ | |
| 195 | + if (!atomic_fetch_inc(&watchdog_cpus)) | |
| 193 | 196 | pr_info("Enabled. Permanently consumes one hw-PMU counter.\n"); |
| 194 | 197 | |
| 195 | 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 | 208 | if (event) { |
| 206 | 209 | perf_event_disable(event); |
| 210 | + this_cpu_write(watchdog_ev, NULL); | |
| 211 | + this_cpu_write(dead_event, event); | |
| 207 | 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 | 224 | int cpu; |
| 220 | 225 | |
| 221 | 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 | 230 | * Required because for_each_cpu() reports unconditionally |
| @@ -227,7 +232,7 @@ void hardlockup_detector_perf_cleanup(void) · 1 unmodified line | ||
| 227 | 232 | */ |
| 228 | 233 | if (event) |
| 229 | 234 | perf_event_release_kernel(event); |
| 230 | − per_cpu(watchdog_ev, cpu) = NULL; | |
| 235 | + per_cpu(dead_event, cpu) = NULL; | |
| 231 | 236 | } |
| 232 | 237 | cpumask_clear(&dead_events_mask); |
| 233 | 238 | } |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | ||
| 10 | 10 | |
| 11 | 11 | #include <linux/workqueue.h> |
| 12 | 12 | #include <linux/kthread.h> |
| 13 | +#include <linux/preempt.h> | |
| 13 | 14 | |
| 14 | 15 | struct worker_pool; |
| 15 | 16 | |
| @@ -60,7 +61,7 @@ struct worker { · 44 unmodified lines | ||
| 60 | 61 | */ |
| 61 | 62 | static 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 | 65 | return kthread_data(current); |
| 65 | 66 | return NULL; |
| 66 | 67 | } |
| @@ -228,7 +228,7 @@ next_op: · 227 unmodified lines | ||
| 228 | 228 | hdr = 2; |
| 229 | 229 | |
| 230 | 230 | /* Extract a tag from the data */ |
| 231 | − if (unlikely(dp >= datalen - 1)) | |
| 231 | + if (unlikely(datalen - dp < 2)) | |
| 232 | 232 | goto data_overrun_error; |
| 233 | 233 | tag = data[dp++]; |
| 234 | 234 | if (unlikely((tag & 0x1f) == ASN1_LONG_TAG)) |
| @@ -274,7 +274,7 @@ next_op: · 39 unmodified lines | ||
| 274 | 274 | int n = len - 0x80; |
| 275 | 275 | if (unlikely(n > 2)) |
| 276 | 276 | goto length_too_long; |
| 277 | − if (unlikely(dp >= datalen - n)) | |
| 277 | + if (unlikely(n > datalen - dp)) | |
| 278 | 278 | goto data_overrun_error; |
| 279 | 279 | hdr += n; |
| 280 | 280 | for (len = 0; n > 0; n--) { |
| @@ -4869,6 +4869,7 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet) · 4868 unmodified lines | ||
| 4869 | 4869 | if (!xnet) |
| 4870 | 4870 | return; |
| 4871 | 4871 | |
| 4872 | + ipvs_reset(skb); | |
| 4872 | 4873 | skb_orphan(skb); |
| 4873 | 4874 | skb->mark = 0; |
| 4874 | 4875 | } |
| @@ -100,7 +100,7 @@ int sysctl_tcp_max_orphans __read_mostly = NR_FILE; · 99 unmodified lines | ||
| 100 | 100 | |
| 101 | 101 | #define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED) |
| 102 | 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 | 104 | #define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED) |
| 105 | 105 | |
| 106 | 106 | #define TCP_REMNANT (TCP_FLAG_FIN|TCP_FLAG_URG|TCP_FLAG_SYN|TCP_FLAG_PSH) |
| @@ -123,6 +123,7 @@ static int l2tp_ip_recv(struct sk_buff *skb) · 122 unmodified lines | ||
| 123 | 123 | unsigned char *ptr, *optr; |
| 124 | 124 | struct l2tp_session *session; |
| 125 | 125 | struct l2tp_tunnel *tunnel = NULL; |
| 126 | + struct iphdr *iph; | |
| 126 | 127 | int length; |
| 127 | 128 | |
| 128 | 129 | if (!pskb_may_pull(skb, 4)) |
| @@ -178,24 +179,17 @@ pass_up: · 49 unmodified lines | ||
| 178 | 179 | goto discard; |
| 179 | 180 | |
| 180 | 181 | tunnel_id = ntohl(*(__be32 *) &skb->data[4]); |
| 181 | − tunnel = l2tp_tunnel_find(net, tunnel_id); | |
| 182 | − if (tunnel) { | |
| 183 | − sk = tunnel->sock; | |
| 184 | − sock_hold(sk); | |
| 185 | − } else { | |
| 186 | − struct iphdr *iph = (struct iphdr *) skb_network_header(skb); | |
| 187 | − | |
| 188 | − read_lock_bh(&l2tp_ip_lock); | |
| 189 | − sk = __l2tp_ip_bind_lookup(net, iph->daddr, iph->saddr, | |
| 190 | − inet_iif(skb), tunnel_id); | |
| 191 | − if (!sk) { | |
| 192 | − read_unlock_bh(&l2tp_ip_lock); | |
| 193 | − goto discard; | |
| 194 | − } | |
| 182 | + iph = (struct iphdr *)skb_network_header(skb); | |
| 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 | 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 | 194 | if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) |
| 201 | 195 | goto discard_put; |
| @@ -136,6 +136,7 @@ static int l2tp_ip6_recv(struct sk_buff *skb) · 135 unmodified lines | ||
| 136 | 136 | unsigned char *ptr, *optr; |
| 137 | 137 | struct l2tp_session *session; |
| 138 | 138 | struct l2tp_tunnel *tunnel = NULL; |
| 139 | + struct ipv6hdr *iph; | |
| 139 | 140 | int length; |
| 140 | 141 | |
| 141 | 142 | if (!pskb_may_pull(skb, 4)) |
| @@ -192,24 +193,17 @@ pass_up: · 50 unmodified lines | ||
| 192 | 193 | goto discard; |
| 193 | 194 | |
| 194 | 195 | tunnel_id = ntohl(*(__be32 *) &skb->data[4]); |
| 195 | − tunnel = l2tp_tunnel_find(net, tunnel_id); | |
| 196 | − if (tunnel) { | |
| 197 | − sk = tunnel->sock; | |
| 198 | − sock_hold(sk); | |
| 199 | − } else { | |
| 200 | − struct ipv6hdr *iph = ipv6_hdr(skb); | |
| 201 | − | |
| 202 | − read_lock_bh(&l2tp_ip6_lock); | |
| 203 | − sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, &iph->saddr, | |
| 204 | − inet6_iif(skb), tunnel_id); | |
| 205 | − if (!sk) { | |
| 206 | − read_unlock_bh(&l2tp_ip6_lock); | |
| 207 | − goto discard; | |
| 208 | − } | |
| 196 | + iph = ipv6_hdr(skb); | |
| 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 | 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 | 208 | if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) |
| 215 | 209 | goto discard_put; |
| @@ -1120,7 +1120,7 @@ static int __init qrtr_proto_init(void) · 1119 unmodified lines | ||
| 1120 | 1120 | |
| 1121 | 1121 | return 0; |
| 1122 | 1122 | } |
| 1123 | −module_init(qrtr_proto_init); | |
| 1123 | +postcore_initcall(qrtr_proto_init); | |
| 1124 | 1124 | |
| 1125 | 1125 | static void __exit qrtr_proto_fini(void) |
| 1126 | 1126 | { |
| @@ -80,7 +80,6 @@ static void tcf_idr_remove(struct tcf_idrinfo *idrinfo, struct tc_action *p) · 79 unmodified lines | ||
| 80 | 80 | spin_lock_bh(&idrinfo->lock); |
| 81 | 81 | idr_remove_ext(&idrinfo->action_idr, p->tcfa_index); |
| 82 | 82 | spin_unlock_bh(&idrinfo->lock); |
| 83 | − put_net(idrinfo->net); | |
| 84 | 83 | gen_kill_estimator(&p->tcfa_rate_est); |
| 85 | 84 | free_tcf(p); |
| 86 | 85 | } |
| @@ -339,7 +338,6 @@ err3: · 252 unmodified lines | ||
| 339 | 338 | p->idrinfo = idrinfo; |
| 340 | 339 | p->ops = ops; |
| 341 | 340 | INIT_LIST_HEAD(&p->list); |
| 342 | − get_net(idrinfo->net); | |
| 343 | 341 | *a = p; |
| 344 | 342 | return 0; |
| 345 | 343 | } |
| @@ -398,7 +398,7 @@ static __net_init int bpf_init_net(struct net *net) · 397 unmodified lines | ||
| 398 | 398 | { |
| 399 | 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 | |
| 404 | 404 | static void __net_exit bpf_exit_net(struct net *net) |
| @@ -206,7 +206,7 @@ static __net_init int connmark_init_net(struct net *net) · 205 unmodified lines | ||
| 206 | 206 | { |
| 207 | 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 | |
| 212 | 212 | static void __net_exit connmark_exit_net(struct net *net) |
| @@ -626,7 +626,7 @@ static __net_init int csum_init_net(struct net *net) · 625 unmodified lines | ||
| 626 | 626 | { |
| 627 | 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 | |
| 632 | 632 | static void __net_exit csum_exit_net(struct net *net) |
| @@ -232,7 +232,7 @@ static __net_init int gact_init_net(struct net *net) · 231 unmodified lines | ||
| 232 | 232 | { |
| 233 | 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 | |
| 238 | 238 | static void __net_exit gact_exit_net(struct net *net) |
| @@ -855,7 +855,7 @@ static __net_init int ife_init_net(struct net *net) · 854 unmodified lines | ||
| 855 | 855 | { |
| 856 | 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 | |
| 861 | 861 | static void __net_exit ife_exit_net(struct net *net) |
| @@ -334,7 +334,7 @@ static __net_init int ipt_init_net(struct net *net) · 333 unmodified lines | ||
| 334 | 334 | { |
| 335 | 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 | |
| 340 | 340 | static void __net_exit ipt_exit_net(struct net *net) |
| @@ -384,7 +384,7 @@ static __net_init int xt_init_net(struct net *net) · 43 unmodified lines | ||
| 384 | 384 | { |
| 385 | 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 | |
| 390 | 390 | static void __net_exit xt_exit_net(struct net *net) |
| @@ -340,7 +340,7 @@ static __net_init int mirred_init_net(struct net *net) · 339 unmodified lines | ||
| 340 | 340 | { |
| 341 | 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 | |
| 346 | 346 | static void __net_exit mirred_exit_net(struct net *net) |
| @@ -307,7 +307,7 @@ static __net_init int nat_init_net(struct net *net) · 306 unmodified lines | ||
| 307 | 307 | { |
| 308 | 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 | |
| 313 | 313 | static void __net_exit nat_exit_net(struct net *net) |
| @@ -450,7 +450,7 @@ static __net_init int pedit_init_net(struct net *net) · 449 unmodified lines | ||
| 450 | 450 | { |
| 451 | 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 | |
| 456 | 456 | static void __net_exit pedit_exit_net(struct net *net) |
| @@ -331,7 +331,7 @@ static __net_init int police_init_net(struct net *net) · 330 unmodified lines | ||
| 331 | 331 | { |
| 332 | 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 | |
| 337 | 337 | static void __net_exit police_exit_net(struct net *net) |
| @@ -240,7 +240,7 @@ static __net_init int sample_init_net(struct net *net) · 239 unmodified lines | ||
| 240 | 240 | { |
| 241 | 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 | |
| 246 | 246 | static void __net_exit sample_exit_net(struct net *net) |
| @@ -201,7 +201,7 @@ static __net_init int simp_init_net(struct net *net) · 200 unmodified lines | ||
| 201 | 201 | { |
| 202 | 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 | |
| 207 | 207 | static void __net_exit simp_exit_net(struct net *net) |
| @@ -238,7 +238,7 @@ static __net_init int skbedit_init_net(struct net *net) · 237 unmodified lines | ||
| 238 | 238 | { |
| 239 | 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 | |
| 244 | 244 | static void __net_exit skbedit_exit_net(struct net *net) |
| @@ -263,7 +263,7 @@ static __net_init int skbmod_init_net(struct net *net) · 262 unmodified lines | ||
| 263 | 263 | { |
| 264 | 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 | |
| 269 | 269 | static void __net_exit skbmod_exit_net(struct net *net) |
| @@ -322,7 +322,7 @@ static __net_init int tunnel_key_init_net(struct net *net) · 321 unmodified lines | ||
| 322 | 322 | { |
| 323 | 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 | |
| 328 | 328 | static void __net_exit tunnel_key_exit_net(struct net *net) |
| @@ -269,7 +269,7 @@ static __net_init int vlan_init_net(struct net *net) · 268 unmodified lines | ||
| 269 | 269 | { |
| 270 | 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 | |
| 275 | 275 | static void __net_exit vlan_exit_net(struct net *net) |
| @@ -1110,6 +1110,7 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, · 1109 unmodified lines | ||
| 1110 | 1110 | exts->actions[i++] = act; |
| 1111 | 1111 | exts->nr_actions = i; |
| 1112 | 1112 | } |
| 1113 | + exts->net = net; | |
| 1113 | 1114 | } |
| 1114 | 1115 | #else |
| 1115 | 1116 | if ((exts->action && tb[exts->action]) || |
| @@ -87,16 +87,21 @@ static int basic_init(struct tcf_proto *tp) · 86 unmodified lines | ||
| 87 | 87 | return 0; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | +static void __basic_delete_filter(struct basic_filter *f) | |
| 91 | +{ | |
| 92 | + tcf_exts_destroy(&f->exts); | |
| 93 | + tcf_em_tree_destroy(&f->ematches); | |
| 94 | + tcf_exts_put_net(&f->exts); | |
| 95 | + kfree(f); | |
| 96 | +} | |
| 97 | + | |
| 90 | 98 | static void basic_delete_filter_work(struct work_struct *work) |
| 91 | 99 | { |
| 92 | 100 | struct basic_filter *f = container_of(work, struct basic_filter, work); |
| 93 | 101 | |
| 94 | 102 | rtnl_lock(); |
| 95 | − tcf_exts_destroy(&f->exts); | |
| 96 | − tcf_em_tree_destroy(&f->ematches); | |
| 103 | + __basic_delete_filter(f); | |
| 97 | 104 | rtnl_unlock(); |
| 98 | − | |
| 99 | − kfree(f); | |
| 100 | 105 | } |
| 101 | 106 | |
| 102 | 107 | static void basic_delete_filter(struct rcu_head *head) |
| @@ -116,7 +121,10 @@ static void basic_destroy(struct tcf_proto *tp) · 13 unmodified lines | ||
| 116 | 121 | list_del_rcu(&f->link); |
| 117 | 122 | tcf_unbind_filter(tp, &f->res); |
| 118 | 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 | 129 | idr_destroy(&head->handle_idr); |
| 122 | 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 | 138 | list_del_rcu(&f->link); |
| 131 | 139 | tcf_unbind_filter(tp, &f->res); |
| 132 | 140 | idr_remove_ext(&head->handle_idr, f->handle); |
| 141 | + tcf_exts_get_net(&f->exts); | |
| 133 | 142 | call_rcu(&f->rcu, basic_delete_filter); |
| 134 | 143 | *last = list_empty(&head->flist); |
| 135 | 144 | return 0; |
| @@ -225,6 +234,7 @@ static int basic_change(struct net *net, struct sk_buff *in_skb, · 89 unmodified lines | ||
| 225 | 234 | idr_replace_ext(&head->handle_idr, fnew, fnew->handle); |
| 226 | 235 | list_replace_rcu(&fold->link, &fnew->link); |
| 227 | 236 | tcf_unbind_filter(tp, &fold->res); |
| 237 | + tcf_exts_get_net(&fold->exts); | |
| 228 | 238 | call_rcu(&fold->rcu, basic_delete_filter); |
| 229 | 239 | } else { |
| 230 | 240 | list_add_rcu(&fnew->link, &head->flist); |
| @@ -261,6 +261,7 @@ static int cls_bpf_init(struct tcf_proto *tp) · 260 unmodified lines | ||
| 261 | 261 | static void __cls_bpf_delete_prog(struct cls_bpf_prog *prog) |
| 262 | 262 | { |
| 263 | 263 | tcf_exts_destroy(&prog->exts); |
| 264 | + tcf_exts_put_net(&prog->exts); | |
| 264 | 265 | |
| 265 | 266 | if (cls_bpf_is_ebpf(prog)) |
| 266 | 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 | 298 | cls_bpf_stop_offload(tp, prog); |
| 298 | 299 | list_del_rcu(&prog->link); |
| 299 | 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 | |
| 303 | 307 | static int cls_bpf_delete(struct tcf_proto *tp, void *arg, bool *last) |
| @@ -526,6 +530,7 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb, · 222 unmodified lines | ||
| 526 | 530 | idr_replace_ext(&head->handle_idr, prog, handle); |
| 527 | 531 | list_replace_rcu(&oldprog->link, &prog->link); |
| 528 | 532 | tcf_unbind_filter(tp, &oldprog->res); |
| 533 | + tcf_exts_get_net(&oldprog->exts); | |
| 529 | 534 | call_rcu(&oldprog->rcu, cls_bpf_delete_prog_rcu); |
| 530 | 535 | } else { |
| 531 | 536 | list_add_rcu(&prog->link, &head->plist); |
| @@ -60,15 +60,21 @@ static const struct nla_policy cgroup_policy[TCA_CGROUP_MAX + 1] = { · 59 unmodified lines | ||
| 60 | 60 | [TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED }, |
| 61 | 61 | }; |
| 62 | 62 | |
| 63 | +static void __cls_cgroup_destroy(struct cls_cgroup_head *head) | |
| 64 | +{ | |
| 65 | + tcf_exts_destroy(&head->exts); | |
| 66 | + tcf_em_tree_destroy(&head->ematches); | |
| 67 | + tcf_exts_put_net(&head->exts); | |
| 68 | + kfree(head); | |
| 69 | +} | |
| 70 | + | |
| 63 | 71 | static void cls_cgroup_destroy_work(struct work_struct *work) |
| 64 | 72 | { |
| 65 | 73 | struct cls_cgroup_head *head = container_of(work, |
| 66 | 74 | struct cls_cgroup_head, |
| 67 | 75 | work); |
| 68 | 76 | rtnl_lock(); |
| 69 | − tcf_exts_destroy(&head->exts); | |
| 70 | − tcf_em_tree_destroy(&head->ematches); | |
| 71 | − kfree(head); | |
| 77 | + __cls_cgroup_destroy(head); | |
| 72 | 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 | 130 | goto errout; |
| 125 | 131 | |
| 126 | 132 | rcu_assign_pointer(tp->root, new); |
| 127 | − if (head) | |
| 133 | + if (head) { | |
| 134 | + tcf_exts_get_net(&head->exts); | |
| 128 | 135 | call_rcu(&head->rcu, cls_cgroup_destroy_rcu); |
| 136 | + } | |
| 129 | 137 | return 0; |
| 130 | 138 | errout: |
| 131 | 139 | tcf_exts_destroy(&new->exts); |
| @@ -138,8 +146,12 @@ static void cls_cgroup_destroy(struct tcf_proto *tp) · 6 unmodified lines | ||
| 138 | 146 | struct cls_cgroup_head *head = rtnl_dereference(tp->root); |
| 139 | 147 | |
| 140 | 148 | /* Head can still be NULL due to cls_cgroup_init(). */ |
| 141 | − if (head) | |
| 142 | − call_rcu(&head->rcu, cls_cgroup_destroy_rcu); | |
| 149 | + if (head) { | |
| 150 | + if (tcf_exts_get_net(&head->exts)) | |
| 151 | + call_rcu(&head->rcu, cls_cgroup_destroy_rcu); | |
| 152 | + else | |
| 153 | + __cls_cgroup_destroy(head); | |
| 154 | + } | |
| 143 | 155 | } |
| 144 | 156 | |
| 145 | 157 | static int cls_cgroup_delete(struct tcf_proto *tp, void *arg, bool *last) |
| @@ -372,15 +372,21 @@ static const struct nla_policy flow_policy[TCA_FLOW_MAX + 1] = { · 371 unmodified lines | ||
| 372 | 372 | [TCA_FLOW_PERTURB] = { .type = NLA_U32 }, |
| 373 | 373 | }; |
| 374 | 374 | |
| 375 | −static void flow_destroy_filter_work(struct work_struct *work) | |
| 375 | +static 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 | 377 | del_timer_sync(&f->perturb_timer); |
| 381 | 378 | tcf_exts_destroy(&f->exts); |
| 382 | 379 | tcf_em_tree_destroy(&f->ematches); |
| 380 | + tcf_exts_put_net(&f->exts); | |
| 383 | 381 | kfree(f); |
| 382 | +} | |
| 383 | + | |
| 384 | +static void flow_destroy_filter_work(struct work_struct *work) | |
| 385 | +{ | |
| 386 | + struct flow_filter *f = container_of(work, struct flow_filter, work); | |
| 387 | + | |
| 388 | + rtnl_lock(); | |
| 389 | + __flow_destroy_filter(f); | |
| 384 | 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 | 561 | *arg = fnew; |
| 556 | 562 | |
| 557 | − if (fold) | |
| 563 | + if (fold) { | |
| 564 | + tcf_exts_get_net(&fold->exts); | |
| 558 | 565 | call_rcu(&fold->rcu, flow_destroy_filter); |
| 566 | + } | |
| 559 | 567 | return 0; |
| 560 | 568 | |
| 561 | 569 | err2: |
| @@ -572,6 +580,7 @@ static int flow_delete(struct tcf_proto *tp, void *arg, bool *last) · 10 unmodified lines | ||
| 572 | 580 | struct flow_filter *f = arg; |
| 573 | 581 | |
| 574 | 582 | list_del_rcu(&f->list); |
| 583 | + tcf_exts_get_net(&f->exts); | |
| 575 | 584 | call_rcu(&f->rcu, flow_destroy_filter); |
| 576 | 585 | *last = list_empty(&head->filters); |
| 577 | 586 | return 0; |
| @@ -596,7 +605,10 @@ static void flow_destroy(struct tcf_proto *tp) · 18 unmodified lines | ||
| 596 | 605 | |
| 597 | 606 | list_for_each_entry_safe(f, next, &head->filters, list) { |
| 598 | 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 | 613 | kfree_rcu(head, rcu); |
| 602 | 614 | } |
| @@ -193,13 +193,19 @@ static int fl_init(struct tcf_proto *tp) · 192 unmodified lines | ||
| 193 | 193 | return 0; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | +static void __fl_destroy_filter(struct cls_fl_filter *f) | |
| 197 | +{ | |
| 198 | + tcf_exts_destroy(&f->exts); | |
| 199 | + tcf_exts_put_net(&f->exts); | |
| 200 | + kfree(f); | |
| 201 | +} | |
| 202 | + | |
| 196 | 203 | static void fl_destroy_filter_work(struct work_struct *work) |
| 197 | 204 | { |
| 198 | 205 | struct cls_fl_filter *f = container_of(work, struct cls_fl_filter, work); |
| 199 | 206 | |
| 200 | 207 | rtnl_lock(); |
| 201 | − tcf_exts_destroy(&f->exts); | |
| 202 | − kfree(f); | |
| 208 | + __fl_destroy_filter(f); | |
| 203 | 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 | 288 | if (!tc_skip_hw(f->flags)) |
| 283 | 289 | fl_hw_destroy_filter(tp, f); |
| 284 | 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 | |
| 288 | 297 | static void fl_destroy_sleepable(struct work_struct *work) |
| @@ -952,6 +961,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, · 663 unmodified lines | ||
| 952 | 961 | idr_replace_ext(&head->handle_idr, fnew, fnew->handle); |
| 953 | 962 | list_replace_rcu(&fold->list, &fnew->list); |
| 954 | 963 | tcf_unbind_filter(tp, &fold->res); |
| 964 | + tcf_exts_get_net(&fold->exts); | |
| 955 | 965 | call_rcu(&fold->rcu, fl_destroy_filter); |
| 956 | 966 | } else { |
| 957 | 967 | list_add_tail_rcu(&fnew->list, &head->filters); |
| @@ -125,13 +125,19 @@ static int fw_init(struct tcf_proto *tp) · 124 unmodified lines | ||
| 125 | 125 | return 0; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | +static void __fw_delete_filter(struct fw_filter *f) | |
| 129 | +{ | |
| 130 | + tcf_exts_destroy(&f->exts); | |
| 131 | + tcf_exts_put_net(&f->exts); | |
| 132 | + kfree(f); | |
| 133 | +} | |
| 134 | + | |
| 128 | 135 | static void fw_delete_filter_work(struct work_struct *work) |
| 129 | 136 | { |
| 130 | 137 | struct fw_filter *f = container_of(work, struct fw_filter, work); |
| 131 | 138 | |
| 132 | 139 | rtnl_lock(); |
| 133 | − tcf_exts_destroy(&f->exts); | |
| 134 | − kfree(f); | |
| 140 | + __fw_delete_filter(f); | |
| 135 | 141 | rtnl_unlock(); |
| 136 | 142 | } |
| 137 | 143 | |
| @@ -157,7 +163,10 @@ static void fw_destroy(struct tcf_proto *tp) · 19 unmodified lines | ||
| 157 | 163 | RCU_INIT_POINTER(head->ht[h], |
| 158 | 164 | rtnl_dereference(f->next)); |
| 159 | 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 | 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 | 191 | if (pfp == f) { |
| 183 | 192 | RCU_INIT_POINTER(*fp, rtnl_dereference(f->next)); |
| 184 | 193 | tcf_unbind_filter(tp, &f->res); |
| 194 | + tcf_exts_get_net(&f->exts); | |
| 185 | 195 | call_rcu(&f->rcu, fw_delete_filter); |
| 186 | 196 | ret = 0; |
| 187 | 197 | break; |
| @@ -302,6 +312,7 @@ static int fw_change(struct net *net, struct sk_buff *in_skb, · 114 unmodified lines | ||
| 302 | 312 | RCU_INIT_POINTER(fnew->next, rtnl_dereference(pfp->next)); |
| 303 | 313 | rcu_assign_pointer(*fp, fnew); |
| 304 | 314 | tcf_unbind_filter(tp, &f->res); |
| 315 | + tcf_exts_get_net(&f->exts); | |
| 305 | 316 | call_rcu(&f->rcu, fw_delete_filter); |
| 306 | 317 | |
| 307 | 318 | *arg = fnew; |
| @@ -44,13 +44,19 @@ static int mall_init(struct tcf_proto *tp) · 43 unmodified lines | ||
| 44 | 44 | return 0; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | +static void __mall_destroy(struct cls_mall_head *head) | |
| 48 | +{ | |
| 49 | + tcf_exts_destroy(&head->exts); | |
| 50 | + tcf_exts_put_net(&head->exts); | |
| 51 | + kfree(head); | |
| 52 | +} | |
| 53 | + | |
| 47 | 54 | static void mall_destroy_work(struct work_struct *work) |
| 48 | 55 | { |
| 49 | 56 | struct cls_mall_head *head = container_of(work, struct cls_mall_head, |
| 50 | 57 | work); |
| 51 | 58 | rtnl_lock(); |
| 52 | − tcf_exts_destroy(&head->exts); | |
| 53 | − kfree(head); | |
| 59 | + __mall_destroy(head); | |
| 54 | 60 | rtnl_unlock(); |
| 55 | 61 | } |
| 56 | 62 | |
| @@ -116,7 +122,10 @@ static void mall_destroy(struct tcf_proto *tp) · 59 unmodified lines | ||
| 116 | 122 | if (!tc_skip_hw(head->flags)) |
| 117 | 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 | |
| 122 | 131 | static void *mall_get(struct tcf_proto *tp, u32 handle) |
| @@ -257,13 +257,19 @@ static int route4_init(struct tcf_proto *tp) · 256 unmodified lines | ||
| 257 | 257 | return 0; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | +static void __route4_delete_filter(struct route4_filter *f) | |
| 261 | +{ | |
| 262 | + tcf_exts_destroy(&f->exts); | |
| 263 | + tcf_exts_put_net(&f->exts); | |
| 264 | + kfree(f); | |
| 265 | +} | |
| 266 | + | |
| 260 | 267 | static void route4_delete_filter_work(struct work_struct *work) |
| 261 | 268 | { |
| 262 | 269 | struct route4_filter *f = container_of(work, struct route4_filter, work); |
| 263 | 270 | |
| 264 | 271 | rtnl_lock(); |
| 265 | − tcf_exts_destroy(&f->exts); | |
| 266 | − kfree(f); | |
| 272 | + __route4_delete_filter(f); | |
| 267 | 273 | rtnl_unlock(); |
| 268 | 274 | } |
| 269 | 275 | |
| @@ -297,7 +303,10 @@ static void route4_destroy(struct tcf_proto *tp) · 27 unmodified lines | ||
| 297 | 303 | next = rtnl_dereference(f->next); |
| 298 | 304 | RCU_INIT_POINTER(b->ht[h2], next); |
| 299 | 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 | 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 | 348 | /* Delete it */ |
| 340 | 349 | tcf_unbind_filter(tp, &f->res); |
| 350 | + tcf_exts_get_net(&f->exts); | |
| 341 | 351 | call_rcu(&f->rcu, route4_delete_filter); |
| 342 | 352 | |
| 343 | 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 | 551 | *arg = f; |
| 542 | 552 | if (fold) { |
| 543 | 553 | tcf_unbind_filter(tp, &fold->res); |
| 554 | + tcf_exts_get_net(&fold->exts); | |
| 544 | 555 | call_rcu(&fold->rcu, route4_delete_filter); |
| 545 | 556 | } |
| 546 | 557 | return 0; |
| @@ -285,13 +285,19 @@ static int rsvp_init(struct tcf_proto *tp) · 284 unmodified lines | ||
| 285 | 285 | return -ENOBUFS; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | +static void __rsvp_delete_filter(struct rsvp_filter *f) | |
| 289 | +{ | |
| 290 | + tcf_exts_destroy(&f->exts); | |
| 291 | + tcf_exts_put_net(&f->exts); | |
| 292 | + kfree(f); | |
| 293 | +} | |
| 294 | + | |
| 288 | 295 | static void rsvp_delete_filter_work(struct work_struct *work) |
| 289 | 296 | { |
| 290 | 297 | struct rsvp_filter *f = container_of(work, struct rsvp_filter, work); |
| 291 | 298 | |
| 292 | 299 | rtnl_lock(); |
| 293 | − tcf_exts_destroy(&f->exts); | |
| 294 | − kfree(f); | |
| 300 | + __rsvp_delete_filter(f); | |
| 295 | 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 | 316 | * grace period, since converted-to-rcu actions are relying on that |
| 311 | 317 | * 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 | |
| 316 | 325 | static void rsvp_destroy(struct tcf_proto *tp) |
| @@ -142,13 +142,19 @@ static int tcindex_init(struct tcf_proto *tp) · 141 unmodified lines | ||
| 142 | 142 | return 0; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | +static void __tcindex_destroy_rexts(struct tcindex_filter_result *r) | |
| 146 | +{ | |
| 147 | + tcf_exts_destroy(&r->exts); | |
| 148 | + tcf_exts_put_net(&r->exts); | |
| 149 | +} | |
| 150 | + | |
| 145 | 151 | static void tcindex_destroy_rexts_work(struct work_struct *work) |
| 146 | 152 | { |
| 147 | 153 | struct tcindex_filter_result *r; |
| 148 | 154 | |
| 149 | 155 | r = container_of(work, struct tcindex_filter_result, work); |
| 150 | 156 | rtnl_lock(); |
| 151 | − tcf_exts_destroy(&r->exts); | |
| 157 | + __tcindex_destroy_rexts(r); | |
| 152 | 158 | rtnl_unlock(); |
| 153 | 159 | } |
| 154 | 160 | |
| @@ -161,14 +167,20 @@ static void tcindex_destroy_rexts(struct rcu_head *head) · 6 unmodified lines | ||
| 161 | 167 | tcf_queue_work(&r->work); |
| 162 | 168 | } |
| 163 | 169 | |
| 170 | +static void __tcindex_destroy_fexts(struct tcindex_filter *f) | |
| 171 | +{ | |
| 172 | + tcf_exts_destroy(&f->result.exts); | |
| 173 | + tcf_exts_put_net(&f->result.exts); | |
| 174 | + kfree(f); | |
| 175 | +} | |
| 176 | + | |
| 164 | 177 | static void tcindex_destroy_fexts_work(struct work_struct *work) |
| 165 | 178 | { |
| 166 | 179 | struct tcindex_filter *f = container_of(work, struct tcindex_filter, |
| 167 | 180 | work); |
| 168 | 181 | |
| 169 | 182 | rtnl_lock(); |
| 170 | − tcf_exts_destroy(&f->result.exts); | |
| 171 | − kfree(f); | |
| 183 | + __tcindex_destroy_fexts(f); | |
| 172 | 184 | rtnl_unlock(); |
| 173 | 185 | } |
| 174 | 186 | |
| @@ -213,10 +225,17 @@ found: · 38 unmodified lines | ||
| 213 | 225 | * grace period, since converted-to-rcu actions are relying on that |
| 214 | 226 | * in cleanup() callback |
| 215 | 227 | */ |
| 216 | − if (f) | |
| 217 | − call_rcu(&f->rcu, tcindex_destroy_fexts); | |
| 218 | − else | |
| 219 | − call_rcu(&r->rcu, tcindex_destroy_rexts); | |
| 228 | + if (f) { | |
| 229 | + if (tcf_exts_get_net(&f->result.exts)) | |
| 230 | + call_rcu(&f->rcu, tcindex_destroy_fexts); | |
| 231 | + else | |
| 232 | + __tcindex_destroy_fexts(f); | |
| 233 | + } else { | |
| 234 | + if (tcf_exts_get_net(&r->exts)) | |
| 235 | + call_rcu(&r->rcu, tcindex_destroy_rexts); | |
| 236 | + else | |
| 237 | + __tcindex_destroy_rexts(r); | |
| 238 | + } | |
| 220 | 239 | |
| 221 | 240 | *last = false; |
| 222 | 241 | return 0; |
| @@ -399,6 +399,7 @@ static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n, · 398 unmodified lines | ||
| 399 | 399 | bool free_pf) |
| 400 | 400 | { |
| 401 | 401 | tcf_exts_destroy(&n->exts); |
| 402 | + tcf_exts_put_net(&n->exts); | |
| 402 | 403 | if (n->ht_down) |
| 403 | 404 | n->ht_down->refcnt--; |
| 404 | 405 | #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 | 477 | RCU_INIT_POINTER(*kp, key->next); |
| 477 | 478 | |
| 478 | 479 | tcf_unbind_filter(tp, &key->res); |
| 480 | + tcf_exts_get_net(&key->exts); | |
| 479 | 481 | call_rcu(&key->rcu, u32_delete_key_freepf_rcu); |
| 480 | 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 | 592 | tcf_unbind_filter(tp, &n->res); |
| 591 | 593 | u32_remove_hw_knode(tp, n->handle); |
| 592 | 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 | 955 | u32_replace_knode(tp, tp_c, new); |
| 951 | 956 | tcf_unbind_filter(tp, &n->res); |
| 957 | + tcf_exts_get_net(&n->exts); | |
| 952 | 958 | call_rcu(&n->rcu, u32_delete_key_rcu); |
| 953 | 959 | return 0; |
| 954 | 960 | } |
| @@ -266,8 +266,6 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) · 265 unmodified lines | ||
| 266 | 266 | goto lock; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | − daddr = (xfrm_address_t *)(skb_network_header(skb) + | |
| 270 | − XFRM_SPI_SKB_CB(skb)->daddroff); | |
| 271 | 269 | family = XFRM_SPI_SKB_CB(skb)->family; |
| 272 | 270 | |
| 273 | 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 | 292 | goto drop; |
| 295 | 293 | } |
| 296 | 294 | |
| 295 | + daddr = (xfrm_address_t *)(skb_network_header(skb) + | |
| 296 | + XFRM_SPI_SKB_CB(skb)->daddroff); | |
| 297 | 297 | do { |
| 298 | 298 | if (skb->sp->len == XFRM_MAX_DEPTH) { |
| 299 | 299 | XFRM_INC_STATS(net, LINUX_MIB_XFRMINBUFFERERROR); |
| @@ -1360,36 +1360,29 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, const struct flowi *fl, · 1359 unmodified lines | ||
| 1360 | 1360 | struct net *net = xp_net(policy); |
| 1361 | 1361 | int nx; |
| 1362 | 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 | 1363 | xfrm_address_t tmp; |
| 1366 | 1364 | |
| 1367 | 1365 | for (nx = 0, i = 0; i < policy->xfrm_nr; i++) { |
| 1368 | 1366 | struct xfrm_state *x; |
| 1369 | − xfrm_address_t *remote = daddr; | |
| 1370 | − xfrm_address_t *local = saddr; | |
| 1367 | + xfrm_address_t *local; | |
| 1368 | + xfrm_address_t *remote; | |
| 1371 | 1369 | struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i]; |
| 1372 | 1370 | |
| 1373 | − if (tmpl->mode == XFRM_MODE_TUNNEL || | |
| 1374 | − tmpl->mode == XFRM_MODE_BEET) { | |
| 1375 | − remote = &tmpl->id.daddr; | |
| 1376 | − local = &tmpl->saddr; | |
| 1377 | − if (xfrm_addr_any(local, tmpl->encap_family)) { | |
| 1378 | − error = xfrm_get_saddr(net, fl->flowi_oif, | |
| 1379 | − &tmp, remote, | |
| 1380 | − tmpl->encap_family, 0); | |
| 1381 | − if (error) | |
| 1382 | − goto fail; | |
| 1383 | − local = &tmp; | |
| 1384 | − } | |
| 1371 | + remote = &tmpl->id.daddr; | |
| 1372 | + local = &tmpl->saddr; | |
| 1373 | + if (xfrm_addr_any(local, tmpl->encap_family)) { | |
| 1374 | + error = xfrm_get_saddr(net, fl->flowi_oif, | |
| 1375 | + &tmp, remote, | |
| 1376 | + tmpl->encap_family, 0); | |
| 1377 | + if (error) | |
| 1378 | + goto fail; | |
| 1379 | + local = &tmp; | |
| 1385 | 1380 | } |
| 1386 | 1381 | |
| 1387 | 1382 | x = xfrm_state_find(remote, local, fl, tmpl, policy, &error, family); |
| 1388 | 1383 | |
| 1389 | 1384 | if (x && x->km.state == XFRM_STATE_VALID) { |
| 1390 | 1385 | xfrm[nx++] = x; |
| 1391 | − daddr = remote; | |
| 1392 | − saddr = local; | |
| 1393 | 1386 | continue; |
| 1394 | 1387 | } |
| 1395 | 1388 | if (x) { |
| @@ -1786,19 +1779,23 @@ void xfrm_policy_cache_flush(void) · 390 unmodified lines | ||
| 1786 | 1779 | put_online_cpus(); |
| 1787 | 1780 | } |
| 1788 | 1781 | |
| 1789 | −static bool xfrm_pol_dead(struct xfrm_dst *xdst) | |
| 1782 | +static bool xfrm_xdst_can_reuse(struct xfrm_dst *xdst, | |
| 1783 | + struct xfrm_state * const xfrm[], | |
| 1784 | + int num) | |
| 1790 | 1785 | { |
| 1791 | − unsigned int num_pols = xdst->num_pols; | |
| 1792 | − unsigned int pol_dead = 0, i; | |
| 1786 | + const struct dst_entry *dst = &xdst->u.dst; | |
| 1787 | + int i; | |
| 1793 | 1788 | |
| 1794 | − for (i = 0; i < num_pols; i++) | |
| 1795 | − pol_dead |= xdst->pols[i]->walk.dead; | |
| 1789 | + if (xdst->num_xfrms != num) | |
| 1790 | + return false; | |
| 1796 | 1791 | |
| 1797 | − /* Mark DST_OBSOLETE_DEAD to fail the next xfrm_dst_check() */ | |
| 1798 | − if (pol_dead) | |
| 1799 | − xdst->u.dst.obsolete = DST_OBSOLETE_DEAD; | |
| 1792 | + for (i = 0; i < num; i++) { | |
| 1793 | + if (!dst || dst->xfrm != xfrm[i]) | |
| 1794 | + return false; | |
| 1795 | + dst = dst->child; | |
| 1796 | + } | |
| 1800 | 1797 | |
| 1801 | − return pol_dead; | |
| 1798 | + return xfrm_bundle_ok(xdst); | |
| 1802 | 1799 | } |
| 1803 | 1800 | |
| 1804 | 1801 | static struct xfrm_dst * |
| @@ -1812,26 +1809,28 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols, · 7 unmodified lines | ||
| 1812 | 1809 | struct dst_entry *dst; |
| 1813 | 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 | 1820 | xdst = this_cpu_read(xfrm_last_dst); |
| 1816 | 1821 | if (xdst && |
| 1817 | 1822 | xdst->u.dst.dev == dst_orig->dev && |
| 1818 | 1823 | xdst->num_pols == num_pols && |
| 1819 | − !xfrm_pol_dead(xdst) && | |
| 1820 | 1824 | memcmp(xdst->pols, pols, |
| 1821 | 1825 | sizeof(struct xfrm_policy *) * num_pols) == 0 && |
| 1822 | − xfrm_bundle_ok(xdst)) { | |
| 1826 | + xfrm_xdst_can_reuse(xdst, xfrm, err)) { | |
| 1823 | 1827 | dst_hold(&xdst->u.dst); |
| 1828 | + while (err > 0) | |
| 1829 | + xfrm_state_put(xfrm[--err]); | |
| 1824 | 1830 | return xdst; |
| 1825 | 1831 | } |
| 1826 | 1832 | |
| 1827 | 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 | 1835 | dst = xfrm_bundle_create(pols[0], xfrm, err, fl, dst_orig); |
| 1837 | 1836 | if (IS_ERR(dst)) { |
| @@ -0,0 +1,305 @@ | ||
| 1 | +#!/usr/bin/env perl | |
| 2 | +# | |
| 3 | +# (c) 2017 Tobin C. Harding <me@tobin.cc> | |
| 4 | +# Licensed under the terms of the GNU GPL License version 2 | |
| 5 | +# | |
| 6 | +# leaking_addresses.pl: Scan 64 bit kernel for potential leaking addresses. | |
| 7 | +# - Scans dmesg output. | |
| 8 | +# - Walks directory tree and parses each file (for each directory in @DIRS). | |
| 9 | +# | |
| 10 | +# You can configure the behaviour of the script; | |
| 11 | +# | |
| 12 | +# - By adding paths, for directories you do not want to walk; | |
| 13 | +# absolute paths: @skip_walk_dirs_abs | |
| 14 | +# directory names: @skip_walk_dirs_any | |
| 15 | +# | |
| 16 | +# - By adding paths, for files you do not want to parse; | |
| 17 | +# absolute paths: @skip_parse_files_abs | |
| 18 | +# file names: @skip_parse_files_any | |
| 19 | +# | |
| 20 | +# The use of @skip_xxx_xxx_any causes files to be skipped where ever they occur. | |
| 21 | +# For example adding 'fd' to @skip_walk_dirs_any causes the fd/ directory to be | |
| 22 | +# skipped for all PID sub-directories of /proc | |
| 23 | +# | |
| 24 | +# The same thing can be achieved by passing command line options to --dont-walk | |
| 25 | +# and --dont-parse. If absolute paths are supplied to these options they are | |
| 26 | +# appended to the @skip_xxx_xxx_abs arrays. If file names are supplied to these | |
| 27 | +# options, they are appended to the @skip_xxx_xxx_any arrays. | |
| 28 | +# | |
| 29 | +# Use --debug to output path before parsing, this is useful to find files that | |
| 30 | +# cause the script to choke. | |
| 31 | +# | |
| 32 | +# You may like to set kptr_restrict=2 before running script | |
| 33 | +# (see Documentation/sysctl/kernel.txt). | |
| 34 | + | |
| 35 | +use warnings; | |
| 36 | +use strict; | |
| 37 | +use POSIX; | |
| 38 | +use File::Basename; | |
| 39 | +use File::Spec; | |
| 40 | +use Cwd 'abs_path'; | |
| 41 | +use Term::ANSIColor qw(:constants); | |
| 42 | +use Getopt::Long qw(:config no_auto_abbrev); | |
| 43 | + | |
| 44 | +my $P = $0; | |
| 45 | +my $V = '0.01'; | |
| 46 | + | |
| 47 | +# Directories to scan. | |
| 48 | +my @DIRS = ('/proc', '/sys'); | |
| 49 | + | |
| 50 | +# Command line options. | |
| 51 | +my $help = 0; | |
| 52 | +my $debug = 0; | |
| 53 | +my @dont_walk = (); | |
| 54 | +my @dont_parse = (); | |
| 55 | + | |
| 56 | +# Do not parse these files (absolute path). | |
| 57 | +my @skip_parse_files_abs = ('/proc/kmsg', | |
| 58 | + '/proc/kcore', | |
| 59 | + '/proc/fs/ext4/sdb1/mb_groups', | |
| 60 | + '/proc/1/fd/3', | |
| 61 | + '/sys/kernel/debug/tracing/trace_pipe', | |
| 62 | + '/sys/kernel/security/apparmor/revision'); | |
| 63 | + | |
| 64 | +# Do not parse thes files under any subdirectory. | |
| 65 | +my @skip_parse_files_any = ('0', | |
| 66 | + '1', | |
| 67 | + '2', | |
| 68 | + 'pagemap', | |
| 69 | + 'events', | |
| 70 | + 'access', | |
| 71 | + 'registers', | |
| 72 | + 'snapshot_raw', | |
| 73 | + 'trace_pipe_raw', | |
| 74 | + 'ptmx', | |
| 75 | + 'trace_pipe'); | |
| 76 | + | |
| 77 | +# Do not walk these directories (absolute path). | |
| 78 | +my @skip_walk_dirs_abs = (); | |
| 79 | + | |
| 80 | +# Do not walk these directories under any subdirectory. | |
| 81 | +my @skip_walk_dirs_any = ('self', | |
| 82 | + 'thread-self', | |
| 83 | + 'cwd', | |
| 84 | + 'fd', | |
| 85 | + 'stderr', | |
| 86 | + 'stdin', | |
| 87 | + 'stdout'); | |
| 88 | + | |
| 89 | +sub help | |
| 90 | +{ | |
| 91 | + my ($exitcode) = @_; | |
| 92 | + | |
| 93 | + print << "EOM"; | |
| 94 | +Usage: $P [OPTIONS] | |
| 95 | +Version: $V | |
| 96 | + | |
| 97 | +Options: | |
| 98 | + | |
| 99 | + --dont-walk=<dir> Don't walk tree starting at <dir>. | |
| 100 | + --dont-parse=<file> Don't parse <file>. | |
| 101 | + -d, --debug Display debugging output. | |
| 102 | + -h, --help, --version Display this help and exit. | |
| 103 | + | |
| 104 | +If an absolute path is passed to --dont_XXX then this path is skipped. If a | |
| 105 | +single filename is passed then this file/directory will be skipped when | |
| 106 | +appearing under any subdirectory. | |
| 107 | + | |
| 108 | +Example: | |
| 109 | + | |
| 110 | + # Just scan dmesg output. | |
| 111 | + scripts/leaking_addresses.pl --dont_walk_abs /proc --dont_walk_abs /sys | |
| 112 | + | |
| 113 | +Scans the running (64 bit) kernel for potential leaking addresses. | |
| 114 | + | |
| 115 | +EOM | |
| 116 | + exit($exitcode); | |
| 117 | +} | |
| 118 | + | |
| 119 | +GetOptions( | |
| 120 | + 'dont-walk=s' => \@dont_walk, | |
| 121 | + 'dont-parse=s' => \@dont_parse, | |
| 122 | + 'd|debug' => \$debug, | |
| 123 | + 'h|help' => \$help, | |
| 124 | + 'version' => \$help | |
| 125 | +) or help(1); | |
| 126 | + | |
| 127 | +help(0) if ($help); | |
| 128 | + | |
| 129 | +push_to_global(); | |
| 130 | + | |
| 131 | +parse_dmesg(); | |
| 132 | +walk(@DIRS); | |
| 133 | + | |
| 134 | +exit 0; | |
| 135 | + | |
| 136 | +sub debug_arrays | |
| 137 | +{ | |
| 138 | + print 'dirs_any: ' . join(", ", @skip_walk_dirs_any) . "\n"; | |
| 139 | + print 'dirs_abs: ' . join(", ", @skip_walk_dirs_abs) . "\n"; | |
| 140 | + print 'parse_any: ' . join(", ", @skip_parse_files_any) . "\n"; | |
| 141 | + print 'parse_abs: ' . join(", ", @skip_parse_files_abs) . "\n"; | |
| 142 | +} | |
| 143 | + | |
| 144 | +sub dprint | |
| 145 | +{ | |
| 146 | + printf(STDERR @_) if $debug; | |
| 147 | +} | |
| 148 | + | |
| 149 | +sub push_in_abs_any | |
| 150 | +{ | |
| 151 | + my ($in, $abs, $any) = @_; | |
| 152 | + | |
| 153 | + foreach my $path (@$in) { | |
| 154 | + if (File::Spec->file_name_is_absolute($path)) { | |
| 155 | + push @$abs, $path; | |
| 156 | + } elsif (index($path,'/') == -1) { | |
| 157 | + push @$any, $path; | |
| 158 | + } else { | |
| 159 | + print 'path error: ' . $path; | |
| 160 | + } | |
| 161 | + } | |
| 162 | +} | |
| 163 | + | |
| 164 | +# Push command line options to global arrays. | |
| 165 | +sub push_to_global | |
| 166 | +{ | |
| 167 | + push_in_abs_any(\@dont_walk, \@skip_walk_dirs_abs, \@skip_walk_dirs_any); | |
| 168 | + push_in_abs_any(\@dont_parse, \@skip_parse_files_abs, \@skip_parse_files_any); | |
| 169 | +} | |
| 170 | + | |
| 171 | +sub is_false_positive | |
| 172 | +{ | |
| 173 | + my ($match) = @_; | |
| 174 | + | |
| 175 | + if ($match =~ '\b(0x)?(f|F){16}\b' or | |
| 176 | + $match =~ '\b(0x)?0{16}\b') { | |
| 177 | + return 1; | |
| 178 | + } | |
| 179 | + | |
| 180 | + # vsyscall memory region, we should probably check against a range here. | |
| 181 | + if ($match =~ '\bf{10}600000\b' or | |
| 182 | + $match =~ '\bf{10}601000\b') { | |
| 183 | + return 1; | |
| 184 | + } | |
| 185 | + | |
| 186 | + return 0; | |
| 187 | +} | |
| 188 | + | |
| 189 | +# True if argument potentially contains a kernel address. | |
| 190 | +sub may_leak_address | |
| 191 | +{ | |
| 192 | + my ($line) = @_; | |
| 193 | + my $address = '\b(0x)?ffff[[:xdigit:]]{12}\b'; | |
| 194 | + | |
| 195 | + # Signal masks. | |
| 196 | + if ($line =~ '^SigBlk:' or | |
| 197 | + $line =~ '^SigCgt:') { | |
| 198 | + return 0; | |
| 199 | + } | |
| 200 | + | |
| 201 | + if ($line =~ '\bKEY=[[:xdigit:]]{14} [[:xdigit:]]{16} [[:xdigit:]]{16}\b' or | |
| 202 | + $line =~ '\b[[:xdigit:]]{14} [[:xdigit:]]{16} [[:xdigit:]]{16}\b') { | |
| 203 | + return 0; | |
| 204 | + } | |
| 205 | + | |
| 206 | + while (/($address)/g) { | |
| 207 | + if (!is_false_positive($1)) { | |
| 208 | + return 1; | |
| 209 | + } | |
| 210 | + } | |
| 211 | + | |
| 212 | + return 0; | |
| 213 | +} | |
| 214 | + | |
| 215 | +sub parse_dmesg | |
| 216 | +{ | |
| 217 | + open my $cmd, '-|', 'dmesg'; | |
| 218 | + while (<$cmd>) { | |
| 219 | + if (may_leak_address($_)) { | |
| 220 | + print 'dmesg: ' . $_; | |
| 221 | + } | |
| 222 | + } | |
| 223 | + close $cmd; | |
| 224 | +} | |
| 225 | + | |
| 226 | +# True if we should skip this path. | |
| 227 | +sub skip | |
| 228 | +{ | |
| 229 | + my ($path, $paths_abs, $paths_any) = @_; | |
| 230 | + | |
| 231 | + foreach (@$paths_abs) { | |
| 232 | + return 1 if (/^$path$/); | |
| 233 | + } | |
| 234 | + | |
| 235 | + my($filename, $dirs, $suffix) = fileparse($path); | |
| 236 | + foreach (@$paths_any) { | |
| 237 | + return 1 if (/^$filename$/); | |
| 238 | + } | |
| 239 | + | |
| 240 | + return 0; | |
| 241 | +} | |
| 242 | + | |
| 243 | +sub skip_parse | |
| 244 | +{ | |
| 245 | + my ($path) = @_; | |
| 246 | + return skip($path, \@skip_parse_files_abs, \@skip_parse_files_any); | |
| 247 | +} | |
| 248 | + | |
| 249 | +sub parse_file | |
| 250 | +{ | |
| 251 | + my ($file) = @_; | |
| 252 | + | |
| 253 | + if (! -R $file) { | |
| 254 | + return; | |
| 255 | + } | |
| 256 | + | |
| 257 | + if (skip_parse($file)) { | |
| 258 | + dprint "skipping file: $file\n"; | |
| 259 | + return; | |
| 260 | + } | |
| 261 | + dprint "parsing: $file\n"; | |
| 262 | + | |
| 263 | + open my $fh, "<", $file or return; | |
| 264 | + while ( <$fh> ) { | |
| 265 | + if (may_leak_address($_)) { | |
| 266 | + print $file . ': ' . $_; | |
| 267 | + } | |
| 268 | + } | |
| 269 | + close $fh; | |
| 270 | +} | |
| 271 | + | |
| 272 | + | |
| 273 | +# True if we should skip walking this directory. | |
| 274 | +sub skip_walk | |
| 275 | +{ | |
| 276 | + my ($path) = @_; | |
| 277 | + return skip($path, \@skip_walk_dirs_abs, \@skip_walk_dirs_any) | |
| 278 | +} | |
| 279 | + | |
| 280 | +# Recursively walk directory tree. | |
| 281 | +sub walk | |
| 282 | +{ | |
| 283 | + my @dirs = @_; | |
| 284 | + my %seen; | |
| 285 | + | |
| 286 | + while (my $pwd = shift @dirs) { | |
| 287 | + next if (skip_walk($pwd)); | |
| 288 | + next if (!opendir(DIR, $pwd)); | |
| 289 | + my @files = readdir(DIR); | |
| 290 | + closedir(DIR); | |
| 291 | + | |
| 292 | + foreach my $file (@files) { | |
| 293 | + next if ($file eq '.' or $file eq '..'); | |
| 294 | + | |
| 295 | + my $path = "$pwd/$file"; | |
| 296 | + next if (-l $path); | |
| 297 | + | |
| 298 | + if (-d $path) { | |
| 299 | + push @dirs, $path; | |
| 300 | + } else { | |
| 301 | + parse_file($path); | |
| 302 | + } | |
| 303 | + } | |
| 304 | + } | |
| 305 | +} | |
| @@ -128,7 +128,7 @@ static inline int map_signal_num(int sig) · 127 unmodified lines | ||
| 128 | 128 | return SIGUNKNOWN; |
| 129 | 129 | else if (sig >= SIGRTMIN) |
| 130 | 130 | return sig - SIGRTMIN + 128; /* rt sigs mapped to 128 */ |
| 131 | − else if (sig <= MAXMAPPED_SIG) | |
| 131 | + else if (sig < MAXMAPPED_SIG) | |
| 132 | 132 | return sig_map[sig]; |
| 133 | 133 | return SIGUNKNOWN; |
| 134 | 134 | } |
| @@ -163,7 +163,7 @@ static void audit_signal_cb(struct audit_buffer *ab, void *va) · 28 unmodified lines | ||
| 163 | 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 | 167 | audit_log_format(ab, " signal=%s", sig_names[aad(sa)->signal]); |
| 168 | 168 | else |
| 169 | 169 | audit_log_format(ab, " signal=rtmin+%d", |
| @@ -159,6 +159,7 @@ static int __init snd_hrtimer_init(void) · 158 unmodified lines | ||
| 159 | 159 | timer->hw = hrtimer_hw; |
| 160 | 160 | timer->hw.resolution = resolution; |
| 161 | 161 | timer->hw.ticks = NANO_SEC / resolution; |
| 162 | + timer->max_instances = 100; /* lower the limit */ | |
| 162 | 163 | |
| 163 | 164 | err = snd_timer_global_register(timer); |
| 164 | 165 | if (err < 0) { |
| @@ -612,9 +612,7 @@ send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, struct seq · 611 unmodified lines | ||
| 612 | 612 | if (!dp->timer->running) |
| 613 | 613 | len = snd_seq_oss_timer_start(dp->timer); |
| 614 | 614 | if (ev->type == SNDRV_SEQ_EVENT_SYSEX) { |
| 615 | − if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE) | |
| 616 | − snd_seq_oss_readq_puts(dp->readq, mdev->seq_device, | |
| 617 | − ev->data.ext.ptr, ev->data.ext.len); | |
| 615 | + snd_seq_oss_readq_sysex(dp->readq, mdev->seq_device, ev); | |
| 618 | 616 | } else { |
| 619 | 617 | len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev); |
| 620 | 618 | if (len > 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 | 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 | + */ | |
| 124 | +struct readq_sysex_ctx { | |
| 125 | + struct seq_oss_readq *readq; | |
| 126 | + int dev; | |
| 127 | +}; | |
| 128 | + | |
| 129 | +static int readq_dump_sysex(void *ptr, void *buf, int count) | |
| 130 | +{ | |
| 131 | + struct readq_sysex_ctx *ctx = ptr; | |
| 132 | + | |
| 133 | + return snd_seq_oss_readq_puts(ctx->readq, ctx->dev, buf, count); | |
| 134 | +} | |
| 135 | + | |
| 136 | +int snd_seq_oss_readq_sysex(struct seq_oss_readq *q, int dev, | |
| 137 | + struct snd_seq_event *ev) | |
| 138 | +{ | |
| 139 | + struct readq_sysex_ctx ctx = { | |
| 140 | + .readq = q, | |
| 141 | + .dev = dev | |
| 142 | + }; | |
| 143 | + | |
| 144 | + if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE) | |
| 145 | + return 0; | |
| 146 | + return snd_seq_dump_var_event(ev, readq_dump_sysex, &ctx); | |
| 147 | +} | |
| 148 | + | |
| 120 | 149 | /* |
| 121 | 150 | * copy an event to input queue: |
| 122 | 151 | * return zero if enqueued |
| @@ -44,6 +44,8 @@ void snd_seq_oss_readq_delete(struct seq_oss_readq *q); · 43 unmodified lines | ||
| 44 | 44 | void snd_seq_oss_readq_clear(struct seq_oss_readq *readq); |
| 45 | 45 | unsigned int snd_seq_oss_readq_poll(struct seq_oss_readq *readq, struct file *file, poll_table *wait); |
| 46 | 46 | int snd_seq_oss_readq_puts(struct seq_oss_readq *readq, int dev, unsigned char *data, int len); |
| 47 | +int snd_seq_oss_readq_sysex(struct seq_oss_readq *q, int dev, | |
| 48 | + struct snd_seq_event *ev); | |
| 47 | 49 | int snd_seq_oss_readq_put_event(struct seq_oss_readq *readq, union evrec *ev); |
| 48 | 50 | int snd_seq_oss_readq_put_timestamp(struct seq_oss_readq *readq, unsigned long curt, int seq_mode); |
| 49 | 51 | int snd_seq_oss_readq_pick(struct seq_oss_readq *q, union evrec *rec); |
| @@ -180,7 +180,7 @@ static void snd_timer_request(struct snd_timer_id *tid) · 179 unmodified lines | ||
| 180 | 180 | * |
| 181 | 181 | * call this with register_mutex down. |
| 182 | 182 | */ |
| 183 | −static void snd_timer_check_slave(struct snd_timer_instance *slave) | |
| 183 | +static int snd_timer_check_slave(struct snd_timer_instance *slave) | |
| 184 | 184 | { |
| 185 | 185 | struct snd_timer *timer; |
| 186 | 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 | 190 | list_for_each_entry(master, &timer->open_list_head, open_list) { |
| 191 | 191 | if (slave->slave_class == master->slave_class && |
| 192 | 192 | slave->slave_id == master->slave_id) { |
| 193 | + if (master->timer->num_instances >= | |
| 194 | + master->timer->max_instances) | |
| 195 | + return -EBUSY; | |
| 193 | 196 | list_move_tail(&slave->open_list, |
| 194 | 197 | &master->slave_list_head); |
| 198 | + master->timer->num_instances++; | |
| 195 | 199 | spin_lock_irq(&slave_active_lock); |
| 196 | 200 | slave->master = master; |
| 197 | 201 | slave->timer = master->timer; |
| 198 | 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 | 214 | * call this with register_mutex down. |
| 210 | 215 | */ |
| 211 | −static void snd_timer_check_master(struct snd_timer_instance *master) | |
| 216 | +static int snd_timer_check_master(struct snd_timer_instance *master) | |
| 212 | 217 | { |
| 213 | 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 | 221 | list_for_each_entry_safe(slave, tmp, &snd_timer_slave_list, open_list) { |
| 217 | 222 | if (slave->slave_class == master->slave_class && |
| 218 | 223 | slave->slave_id == master->slave_id) { |
| 224 | + if (master->timer->num_instances >= | |
| 225 | + master->timer->max_instances) | |
| 226 | + return -EBUSY; | |
| 219 | 227 | list_move_tail(&slave->open_list, &master->slave_list_head); |
| 228 | + master->timer->num_instances++; | |
| 220 | 229 | spin_lock_irq(&slave_active_lock); |
| 221 | 230 | spin_lock(&master->timer->lock); |
| 222 | 231 | slave->master = master; |
| @@ -228,8 +237,11 @@ static void snd_timer_check_master(struct snd_timer_instance *master) · 5 unmodified lines | ||
| 228 | 237 | spin_unlock_irq(&slave_active_lock); |
| 229 | 238 | } |
| 230 | 239 | } |
| 240 | + return 0; | |
| 231 | 241 | } |
| 232 | 242 | |
| 243 | +static int snd_timer_close_locked(struct snd_timer_instance *timeri); | |
| 244 | + | |
| 233 | 245 | /* |
| 234 | 246 | * open a timer instance |
| 235 | 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 | 253 | struct snd_timer *timer; |
| 242 | 254 | struct snd_timer_instance *timeri = NULL; |
| 255 | + int err; | |
| 243 | 256 | |
| 244 | 257 | if (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) { |
| 245 | 258 | /* open a slave instance */ |
| @@ -259,10 +272,14 @@ int snd_timer_open(struct snd_timer_instance **ti, · 13 unmodified lines | ||
| 259 | 272 | timeri->slave_id = tid->device; |
| 260 | 273 | timeri->flags |= SNDRV_TIMER_IFLG_SLAVE; |
| 261 | 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 | 280 | mutex_unlock(®ister_mutex); |
| 264 | 281 | *ti = timeri; |
| 265 | − return 0; | |
| 282 | + return err; | |
| 266 | 283 | } |
| 267 | 284 | |
| 268 | 285 | /* open a master instance */ |
| @@ -288,6 +305,10 @@ int snd_timer_open(struct snd_timer_instance **ti, · 19 unmodified lines | ||
| 288 | 305 | return -EBUSY; |
| 289 | 306 | } |
| 290 | 307 | } |
| 308 | + if (timer->num_instances >= timer->max_instances) { | |
| 309 | + mutex_unlock(®ister_mutex); | |
| 310 | + return -EBUSY; | |
| 311 | + } | |
| 291 | 312 | timeri = snd_timer_instance_new(owner, timer); |
| 292 | 313 | if (!timeri) { |
| 293 | 314 | mutex_unlock(®ister_mutex); |
| @@ -314,25 +335,27 @@ int snd_timer_open(struct snd_timer_instance **ti, · 20 unmodified lines | ||
| 314 | 335 | } |
| 315 | 336 | |
| 316 | 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 | 344 | mutex_unlock(®ister_mutex); |
| 319 | 345 | *ti = timeri; |
| 320 | − return 0; | |
| 346 | + return err; | |
| 321 | 347 | } |
| 322 | 348 | EXPORT_SYMBOL(snd_timer_open); |
| 323 | 349 | |
| 324 | 350 | /* |
| 325 | 351 | * close a timer instance |
| 352 | + * call this with register_mutex down. | |
| 326 | 353 | */ |
| 327 | −int snd_timer_close(struct snd_timer_instance *timeri) | |
| 354 | +static int snd_timer_close_locked(struct snd_timer_instance *timeri) | |
| 328 | 355 | { |
| 329 | 356 | struct snd_timer *timer = NULL; |
| 330 | 357 | struct snd_timer_instance *slave, *tmp; |
| 331 | 358 | |
| 332 | − if (snd_BUG_ON(!timeri)) | |
| 333 | − return -ENXIO; | |
| 334 | − | |
| 335 | − mutex_lock(®ister_mutex); | |
| 336 | 359 | list_del(&timeri->open_list); |
| 337 | 360 | |
| 338 | 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 | 364 | timer = timeri->timer; |
| 342 | 365 | if (timer) { |
| 366 | + timer->num_instances--; | |
| 343 | 367 | /* wait, until the active callback is finished */ |
| 344 | 368 | spin_lock_irq(&timer->lock); |
| 345 | 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 | 379 | list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head, |
| 356 | 380 | open_list) { |
| 357 | 381 | list_move_tail(&slave->open_list, &snd_timer_slave_list); |
| 382 | + timer->num_instances--; | |
| 358 | 383 | slave->master = NULL; |
| 359 | 384 | slave->timer = NULL; |
| 360 | 385 | list_del_init(&slave->ack_list); |
| @@ -382,9 +407,24 @@ int snd_timer_close(struct snd_timer_instance *timeri) · 21 unmodified lines | ||
| 382 | 407 | module_put(timer->module); |
| 383 | 408 | } |
| 384 | 409 | |
| 385 | − mutex_unlock(®ister_mutex); | |
| 386 | 410 | return 0; |
| 387 | 411 | } |
| 412 | + | |
| 413 | +/* | |
| 414 | + * close a timer instance | |
| 415 | + */ | |
| 416 | +int snd_timer_close(struct snd_timer_instance *timeri) | |
| 417 | +{ | |
| 418 | + int err; | |
| 419 | + | |
| 420 | + if (snd_BUG_ON(!timeri)) | |
| 421 | + return -ENXIO; | |
| 422 | + | |
| 423 | + mutex_lock(®ister_mutex); | |
| 424 | + err = snd_timer_close_locked(timeri); | |
| 425 | + mutex_unlock(®ister_mutex); | |
| 426 | + return err; | |
| 427 | +} | |
| 388 | 428 | EXPORT_SYMBOL(snd_timer_close); |
| 389 | 429 | |
| 390 | 430 | unsigned long snd_timer_resolution(struct snd_timer_instance *timeri) |
| @@ -856,6 +896,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, · 465 unmodified lines | ||
| 856 | 896 | spin_lock_init(&timer->lock); |
| 857 | 897 | tasklet_init(&timer->task_queue, snd_timer_tasklet, |
| 858 | 898 | (unsigned long)timer); |
| 899 | + timer->max_instances = 1000; /* default limit per timer */ | |
| 859 | 900 | if (card != NULL) { |
| 860 | 901 | timer->module = card->module; |
| 861 | 902 | err = snd_device_new(card, SNDRV_DEV_TIMER, timer, &ops); |
| @@ -6544,6 +6544,11 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { · 6543 unmodified lines | ||
| 6544 | 6544 | {0x14, 0x90170110}, |
| 6545 | 6545 | {0x1b, 0x90a70130}, |
| 6546 | 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 | 6552 | SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4, |
| 6548 | 6553 | {0x12, 0x90a60130}, |
| 6549 | 6554 | {0x14, 0x90170110}, |
| @@ -1375,6 +1375,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, · 1374 unmodified lines | ||
| 1375 | 1375 | case 0x199: |
| 1376 | 1376 | return SNDRV_PCM_FMTBIT_DSD_U32_LE; |
| 1377 | 1377 | case 0x19b: |
| 1378 | + case 0x203: | |
| 1378 | 1379 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
| 1379 | 1380 | default: |
| 1380 | 1381 | break; |
| @@ -1,4 +1,3 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | 1 | #ifndef _ASM_X86_DISABLED_FEATURES_H |
| 3 | 2 | #define _ASM_X86_DISABLED_FEATURES_H |
| 4 | 3 | |
| @@ -1,4 +1,3 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | 1 | #ifndef _ASM_X86_REQUIRED_FEATURES_H |
| 3 | 2 | #define _ASM_X86_REQUIRED_FEATURES_H |
| 4 | 3 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 1 | 2 | #ifndef _UAPI_ASM_X86_UNISTD_H |
| 2 | 3 | #define _UAPI_ASM_X86_UNISTD_H |
| 3 | 4 | |
| @@ -1,10 +1,10 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | 1 | /* Copyright 2002 Andi Kleen */ |
| 3 | 2 | |
| 4 | 3 | #include <linux/linkage.h> |
| 5 | 4 | #include <asm/errno.h> |
| 6 | 5 | #include <asm/cpufeatures.h> |
| 7 | 6 | #include <asm/alternative-asm.h> |
| 7 | +#include <asm/export.h> | |
| 8 | 8 | |
| 9 | 9 | /* |
| 10 | 10 | * We build a jump to memcpy_orig by default which gets NOPped out on |
| @@ -41,6 +41,8 @@ ENTRY(memcpy) · 30 unmodified lines | ||
| 41 | 41 | ret |
| 42 | 42 | ENDPROC(memcpy) |
| 43 | 43 | ENDPROC(__memcpy) |
| 44 | +EXPORT_SYMBOL(memcpy) | |
| 45 | +EXPORT_SYMBOL(__memcpy) | |
| 44 | 46 | |
| 45 | 47 | /* |
| 46 | 48 | * memcpy_erms() - enhanced fast string memcpy. This is faster and |
| @@ -275,6 +277,7 @@ ENTRY(memcpy_mcsafe_unrolled) · 228 unmodified lines | ||
| 275 | 277 | xorq %rax, %rax |
| 276 | 278 | ret |
| 277 | 279 | ENDPROC(memcpy_mcsafe_unrolled) |
| 280 | +EXPORT_SYMBOL_GPL(memcpy_mcsafe_unrolled) | |
| 278 | 281 | |
| 279 | 282 | .section .fixup, "ax" |
| 280 | 283 | /* Return -EFAULT for any failure */ |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | 2 | #ifndef _ASM_GENERIC_BITOPS___FLS_H_ |
| 2 | 3 | #define _ASM_GENERIC_BITOPS___FLS_H_ |
| 3 | 4 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | 2 | #ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_ |
| 2 | 3 | #define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_ |
| 3 | 4 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | 2 | #ifndef _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_ |
| 2 | 3 | #define _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_ |
| 3 | 4 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | 2 | #ifndef _ASM_GENERIC_BITOPS_FLS_H_ |
| 2 | 3 | #define _ASM_GENERIC_BITOPS_FLS_H_ |
| 3 | 4 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | 2 | #ifndef _ASM_GENERIC_BITOPS_FLS64_H_ |
| 2 | 3 | #define _ASM_GENERIC_BITOPS_FLS64_H_ |
| 3 | 4 | |
| @@ -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 */ | |
| @@ -1,4 +1,3 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | 1 | #ifndef _LINUX_HASH_H |
| 3 | 2 | #define _LINUX_HASH_H |
| 4 | 3 | /* Fast hashing routine for ints, longs and pointers. |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 1 | 2 | #ifndef __ASM_GENERIC_IOCTLS_H |
| 2 | 3 | #define __ASM_GENERIC_IOCTLS_H |
| 3 | 4 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 1 | 2 | #ifndef __ASM_GENERIC_MMAN_COMMON_H |
| 2 | 3 | #define __ASM_GENERIC_MMAN_COMMON_H |
| 3 | 4 | |
| @@ -1,8 +1,8 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 2 | 2 | #ifndef __ASM_GENERIC_MMAN_H |
| 3 | 3 | #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 | 7 | #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ |
| 8 | 8 | #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 1 | 2 | /* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com |
| 2 | 3 | * |
| 3 | 4 | * This program is free software; you can redistribute it and/or |
| @@ -1,4 +1,4 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 2 | 2 | #ifndef _UAPI__LINUX_BPF_COMMON_H__ |
| 3 | 3 | #define _UAPI__LINUX_BPF_COMMON_H__ |
| 4 | 4 | |
| @@ -1,4 +1,4 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 2 | 2 | #ifndef _UAPI_LINUX_FCNTL_H |
| 3 | 3 | #define _UAPI_LINUX_FCNTL_H |
| 4 | 4 | |
| @@ -1,4 +1,4 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 2 | 2 | #ifndef _UAPI_LINUX_HW_BREAKPOINT_H |
| 3 | 3 | #define _UAPI_LINUX_HW_BREAKPOINT_H |
| 4 | 4 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 1 | 2 | #ifndef __LINUX_KVM_H |
| 2 | 3 | #define __LINUX_KVM_H |
| 3 | 4 | |
| @@ -1,4 +1,4 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 2 | 2 | #ifndef _UAPI_LINUX_MMAN_H |
| 3 | 3 | #define _UAPI_LINUX_MMAN_H |
| 4 | 4 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 1 | 2 | /* |
| 2 | 3 | * Performance events: |
| 3 | 4 | * |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 1 | 2 | #ifndef _UAPI_LINUX_SCHED_H |
| 2 | 3 | #define _UAPI_LINUX_SCHED_H |
| 3 | 4 | |
| @@ -1,4 +1,4 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 2 | 2 | #ifndef _UAPI_LINUX_STAT_H |
| 3 | 3 | #define _UAPI_LINUX_STAT_H |
| 4 | 4 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 1 | 2 | #ifndef _LINUX_VHOST_H |
| 2 | 3 | #define _LINUX_VHOST_H |
| 3 | 4 | /* Userspace interface for in-kernel virtio accelerators. */ |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ | |
| 1 | 2 | /* |
| 2 | 3 | * Advanced Linux Sound Architecture - ALSA - Driver |
| 3 | 4 | * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>, |
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | #!/bin/awk -f |
| 2 | +# SPDX-License-Identifier: GPL-2.0 | |
| 2 | 3 | # gen-insn-attr-x86.awk: Instruction attribute table generator |
| 3 | 4 | # Written by Masami Hiramatsu <mhiramat@redhat.com> |
| 4 | 5 | # |
| @@ -606,9 +606,19 @@ static struct arch *arch__find(const char *name) · 605 unmodified lines | ||
| 606 | 606 | int symbol__alloc_hist(struct symbol *sym) |
| 607 | 607 | { |
| 608 | 608 | struct annotation *notes = symbol__annotation(sym); |
| 609 | − const size_t size = symbol__size(sym); | |
| 609 | + size_t size = symbol__size(sym); | |
| 610 | 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 | 622 | /* Check for overflow when calculating sizeof_sym_hist */ |
| 613 | 623 | if (size > (SIZE_MAX - sizeof(struct sym_hist)) / sizeof(struct sym_hist_entry)) |
| 614 | 624 | return -1; |
| @@ -154,6 +154,10 @@ do { \ · 153 unmodified lines | ||
| 154 | 154 | yycolumn += yyleng; \ |
| 155 | 155 | } while (0); |
| 156 | 156 | |
| 157 | +#define USER_REJECT \ | |
| 158 | + yycolumn -= yyleng; \ | |
| 159 | + REJECT | |
| 160 | + | |
| 157 | 161 | %} |
| 158 | 162 | |
| 159 | 163 | %x mem |
| @@ -335,8 +339,8 @@ r{num_raw_hex} { return raw(yyscanner); } · 175 unmodified lines | ||
| 335 | 339 | {num_hex} { return value(yyscanner, 16); } |
| 336 | 340 | |
| 337 | 341 | {modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); } |
| 338 | −{bpf_object} { if (!isbpf(yyscanner)) REJECT; return str(yyscanner, PE_BPF_OBJECT); } | |
| 339 | −{bpf_source} { if (!isbpf(yyscanner)) REJECT; return str(yyscanner, PE_BPF_SOURCE); } | |
| 342 | +{bpf_object} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_OBJECT); } | |
| 343 | +{bpf_source} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_SOURCE); } | |
| 340 | 344 | {name} { return pmu_str_check(yyscanner); } |
| 341 | 345 | "/" { BEGIN(config); return '/'; } |
| 342 | 346 | - { return '-'; } |
| @@ -1326,21 +1326,12 @@ static void teardown_hyp_mode(void) · 1325 unmodified lines | ||
| 1326 | 1326 | { |
| 1327 | 1327 | int cpu; |
| 1328 | 1328 | |
| 1329 | − if (is_kernel_in_hyp_mode()) | |
| 1330 | − return; | |
| 1331 | − | |
| 1332 | 1329 | free_hyp_pgds(); |
| 1333 | 1330 | for_each_possible_cpu(cpu) |
| 1334 | 1331 | free_page(per_cpu(kvm_arm_hyp_stack_page, cpu)); |
| 1335 | 1332 | hyp_cpu_pm_exit(); |
| 1336 | 1333 | } |
| 1337 | 1334 | |
| 1338 | −static int init_vhe_mode(void) | |
| 1339 | −{ | |
| 1340 | − kvm_info("VHE mode initialized successfully\n"); | |
| 1341 | − return 0; | |
| 1342 | −} | |
| 1343 | − | |
| 1344 | 1335 | /** |
| 1345 | 1336 | * 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 | 1415 | return 0; |
| 1427 | 1416 | |
| 1428 | 1417 | out_err: |
| @@ -1456,6 +1445,7 @@ int kvm_arch_init(void *opaque) · 27 unmodified lines | ||
| 1456 | 1445 | { |
| 1457 | 1446 | int err; |
| 1458 | 1447 | int ret, cpu; |
| 1448 | + bool in_hyp_mode; | |
| 1459 | 1449 | |
| 1460 | 1450 | if (!is_hyp_mode_available()) { |
| 1461 | 1451 | kvm_err("HYP mode not available\n"); |
| @@ -1474,21 +1464,28 @@ int kvm_arch_init(void *opaque) · 12 unmodified lines | ||
| 1474 | 1464 | if (err) |
| 1475 | 1465 | return err; |
| 1476 | 1466 | |
| 1477 | − if (is_kernel_in_hyp_mode()) | |
| 1478 | − err = init_vhe_mode(); | |
| 1479 | − else | |
| 1467 | + in_hyp_mode = is_kernel_in_hyp_mode(); | |
| 1468 | + | |
| 1469 | + if (!in_hyp_mode) { | |
| 1480 | 1470 | err = init_hyp_mode(); |
| 1481 | − if (err) | |
| 1482 | − goto out_err; | |
| 1471 | + if (err) | |
| 1472 | + goto out_err; | |
| 1473 | + } | |
| 1483 | 1474 | |
| 1484 | 1475 | err = init_subsystems(); |
| 1485 | 1476 | if (err) |
| 1486 | 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 | 1484 | return 0; |
| 1489 | 1485 | |
| 1490 | 1486 | out_hyp: |
| 1491 | − teardown_hyp_mode(); | |
| 1487 | + if (!in_hyp_mode) | |
| 1488 | + teardown_hyp_mode(); | |
| 1492 | 1489 | out_err: |
| 1493 | 1490 | teardown_common_resources(); |
| 1494 | 1491 | return err; |
| @@ -1466,6 +1466,16 @@ static void vgic_mmio_write_its_ctlr(struct kvm *kvm, struct vgic_its *its, · 1465 unmodified lines | ||
| 1466 | 1466 | { |
| 1467 | 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 | 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 | 1485 | vgic_its_process_commands(kvm, its); |
| 1476 | 1486 | |
| 1487 | +out: | |
| 1477 | 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 | ||
| 1801 | 1812 | static int scan_its_table(struct vgic_its *its, gpa_t base, int size, int esz, |
| 1802 | 1813 | int start_id, entry_fn_t fn, void *opaque) |
| 1803 | 1814 | { |
| 1804 | − void *entry = kzalloc(esz, GFP_KERNEL); | |
| 1805 | 1815 | struct kvm *kvm = its->dev->kvm; |
| 1806 | 1816 | unsigned long len = size; |
| 1807 | 1817 | int id = start_id; |
| 1808 | 1818 | gpa_t gpa = base; |
| 1819 | + char entry[esz]; | |
| 1809 | 1820 | int ret; |
| 1810 | 1821 | |
| 1822 | + memset(entry, 0, esz); | |
| 1823 | + | |
| 1811 | 1824 | while (len > 0) { |
| 1812 | 1825 | int next_offset; |
| 1813 | 1826 | size_t byte_offset; |
| 1814 | 1827 | |
| 1815 | 1828 | ret = kvm_read_guest(kvm, gpa, entry, esz); |
| 1816 | 1829 | if (ret) |
| 1817 | − goto out; | |
| 1830 | + return ret; | |
| 1818 | 1831 | |
| 1819 | 1832 | next_offset = fn(its, id, entry, opaque); |
| 1820 | − if (next_offset <= 0) { | |
| 1821 | − ret = next_offset; | |
| 1822 | − goto out; | |
| 1823 | − } | |
| 1833 | + if (next_offset <= 0) | |
| 1834 | + return next_offset; | |
| 1824 | 1835 | |
| 1825 | 1836 | byte_offset = next_offset * esz; |
| 1826 | 1837 | id += next_offset; |
| 1827 | 1838 | gpa += byte_offset; |
| 1828 | 1839 | len -= byte_offset; |
| 1829 | 1840 | } |
| 1830 | − ret = 1; | |
| 1831 | − | |
| 1832 | −out: | |
| 1833 | − kfree(entry); | |
| 1834 | − return ret; | |
| 1841 | + return 1; | |
| 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 | 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 | + */ | |
| 1943 | 1958 | static int vgic_its_restore_itt(struct vgic_its *its, struct its_device *dev) |
| 1944 | 1959 | { |
| 1945 | 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 | 1966 | ret = scan_its_table(its, base, max_size, ite_esz, 0, |
| 1952 | 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 | 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 | ||
| 2048 | 2067 | static int vgic_its_save_device_tables(struct vgic_its *its) |
| 2049 | 2068 | { |
| 2050 | 2069 | const struct vgic_its_abi *abi = vgic_its_get_abi(its); |
| 2070 | + u64 baser = its->baser_device_table; | |
| 2051 | 2071 | struct its_device *dev; |
| 2052 | 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 | 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 | 2127 | ret = scan_its_table(its, gpa, SZ_64K, dte_esz, |
| 2108 | 2128 | l2_start_id, vgic_its_restore_dte, NULL); |
| 2109 | 2129 | |
| 2110 | − if (ret <= 0) | |
| 2111 | − return ret; | |
| 2112 | − | |
| 2113 | − return 1; | |
| 2130 | + return ret; | |
| 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 | 2157 | vgic_its_restore_dte, NULL); |
| 2141 | 2158 | } |
| 2142 | 2159 | |
| 2160 | + /* scan_its_table returns +1 if all entries are invalid */ | |
| 2143 | 2161 | if (ret > 0) |
| 2144 | − ret = -EINVAL; | |
| 2162 | + ret = 0; | |
| 2145 | 2163 | |
| 2146 | 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 | ||
| 2198 | 2216 | static int vgic_its_save_collection_table(struct vgic_its *its) |
| 2199 | 2217 | { |
| 2200 | 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 | 2221 | struct its_collection *collection; |
| 2202 | 2222 | u64 val; |
| 2203 | − gpa_t gpa; | |
| 2204 | 2223 | size_t max_size, filled = 0; |
| 2205 | 2224 | int ret, cte_esz = abi->cte_esz; |
| 2206 | 2225 | |
| 2207 | − gpa = BASER_ADDRESS(its->baser_coll_table); | |
| 2208 | − if (!gpa) | |
| 2226 | + if (!(baser & GITS_BASER_VALID)) | |
| 2209 | 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 | 2231 | list_for_each_entry(collection, &its->collection_list, coll_list) { |
| 2214 | 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 | ||
| 2239 | 2257 | static int vgic_its_restore_collection_table(struct vgic_its *its) |
| 2240 | 2258 | { |
| 2241 | 2259 | const struct vgic_its_abi *abi = vgic_its_get_abi(its); |
| 2260 | + u64 baser = its->baser_coll_table; | |
| 2242 | 2261 | int cte_esz = abi->cte_esz; |
| 2243 | 2262 | size_t max_size, read = 0; |
| 2244 | 2263 | gpa_t gpa; |
| 2245 | 2264 | int ret; |
| 2246 | 2265 | |
| 2247 | − if (!(its->baser_coll_table & GITS_BASER_VALID)) | |
| 2266 | + if (!(baser & GITS_BASER_VALID)) | |
| 2248 | 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 | 2273 | while (read < max_size) { |
| 2255 | 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 | 2277 | gpa += cte_esz; |
| 2259 | 2278 | read += cte_esz; |
| 2260 | 2279 | } |
| 2280 | + | |
| 2281 | + if (ret > 0) | |
| 2282 | + return 0; | |
| 2283 | + | |
| 2261 | 2284 | return ret; |
| 2262 | 2285 | } |
| 2263 | 2286 | |